Commit 3c2b0e75 authored by Phil Hughes's avatar Phil Hughes

Added toolbar to comment form

parent 0331fa3f
...@@ -6,25 +6,10 @@ class @Issue ...@@ -6,25 +6,10 @@ class @Issue
constructor: -> constructor: ->
# Prevent duplicate event bindings # Prevent duplicate event bindings
@disableTaskList() @disableTaskList()
@fixAffixScroll()
if $('a.btn-close').length if $('a.btn-close').length
@initTaskList() @initTaskList()
@initIssueBtnEventListeners() @initIssueBtnEventListeners()
fixAffixScroll: ->
fixAffix = ->
$discussion = $('.issuable-discussion')
$sidebar = $('.issuable-sidebar')
if $sidebar.hasClass('no-affix')
$sidebar.removeClass(['affix-top','affix'])
discussionHeight = $discussion.height()
sidebarHeight = $sidebar.height()
if sidebarHeight > discussionHeight
$discussion.height(sidebarHeight + 50)
$sidebar.addClass('no-affix')
$(window).on('resize', fixAffix)
fixAffix()
initTaskList: -> initTaskList: ->
$('.detail-page-description .js-task-list-container').taskList('enable') $('.detail-page-description .js-task-list-container').taskList('enable')
$(document).on 'tasklist:changed', '.detail-page-description .js-task-list-container', @updateTaskList $(document).on 'tasklist:changed', '.detail-page-description .js-task-list-container', @updateTaskList
......
...@@ -15,8 +15,6 @@ class @MergeRequest ...@@ -15,8 +15,6 @@ class @MergeRequest
this.$('.show-all-commits').on 'click', => this.$('.show-all-commits').on 'click', =>
this.showAllCommits() this.showAllCommits()
@fixAffixScroll();
@initTabs() @initTabs()
# Prevent duplicate event bindings # Prevent duplicate event bindings
...@@ -30,20 +28,6 @@ class @MergeRequest ...@@ -30,20 +28,6 @@ class @MergeRequest
$: (selector) -> $: (selector) ->
this.$el.find(selector) this.$el.find(selector)
fixAffixScroll: ->
fixAffix = ->
$discussion = $('.issuable-discussion')
$sidebar = $('.issuable-sidebar')
if $sidebar.hasClass('no-affix')
$sidebar.removeClass(['affix-top','affix'])
discussionHeight = $discussion.height()
sidebarHeight = $sidebar.height()
if sidebarHeight > discussionHeight
$discussion.height(sidebarHeight + 50)
$sidebar.addClass('no-affix')
$(window).on('resize', fixAffix)
fixAffix()
initTabs: -> initTabs: ->
if @opts.action != 'new' if @opts.action != 'new'
# `MergeRequests#new` has no tab-persisting or lazy-loading behavior # `MergeRequests#new` has no tab-persisting or lazy-loading behavior
......
#= require autosave #= require autosave
#= require autosize
#= require dropzone #= require dropzone
#= require dropzone_input #= require dropzone_input
#= require gfm_auto_complete #= require gfm_auto_complete
...@@ -287,6 +288,8 @@ class @Notes ...@@ -287,6 +288,8 @@ class @Notes
else else
previewButton.removeClass("turn-on").addClass "turn-off" previewButton.removeClass("turn-on").addClass "turn-off"
autosize(textarea)
new Autosave textarea, [ new Autosave textarea, [
"Note" "Note"
form.find("#note_commit_id").val() form.find("#note_commit_id").val()
...@@ -368,6 +371,9 @@ class @Notes ...@@ -368,6 +371,9 @@ class @Notes
textarea = form.find("textarea") textarea = form.find("textarea")
textarea.focus() textarea.focus()
if isNewForm
autosize(textarea)
# HACK (rspeicher/DouweM): Work around a Chrome 43 bug(?). # HACK (rspeicher/DouweM): Work around a Chrome 43 bug(?).
# The textarea has the correct value, Chrome just won't show it unless we # The textarea has the correct value, Chrome just won't show it unless we
# modify it, so let's clear it and re-set it! # modify it, so let's clear it and re-set it!
......
.div-dropzone-wrapper { .div-dropzone-wrapper {
.div-dropzone { .div-dropzone {
position: relative; position: relative;
padding: 0; margin-bottom: -5px;
border: 0;
margin-bottom: 5px;
.div-dropzone-focus { .div-dropzone-focus {
border-color: #66afe9 !important; border-color: #66afe9 !important;
...@@ -25,12 +23,10 @@ ...@@ -25,12 +23,10 @@
.div-dropzone-spinner { .div-dropzone-spinner {
position: absolute; position: absolute;
top: 100%; bottom: 10px;
left: 100%; right: 5px;
margin-top: -1.1em;
margin-left: -1.1em;
opacity: 0; opacity: 0;
font-size: 30px; font-size: 20px;
transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out;
} }
......
.zennable { .zen-backdrop {
.zen-backdrop {
&.fullscreen { &.fullscreen {
background-color: white; background-color: white;
position: fixed; position: fixed;
...@@ -31,12 +30,22 @@ ...@@ -31,12 +30,22 @@
top: 0; top: 0;
} }
} }
}
} }
.zen-cotrol { .zen-cotrol {
padding: 0;
color: #555; color: #555;
line-height: 31px; background: none;
border: 0;
}
.zen-control-full {
color: #959494;
&:hover {
color: $gl-link-color;
text-decoration: none;
}
} }
.zen-control-leave { .zen-control-leave {
......
...@@ -47,9 +47,7 @@ ...@@ -47,9 +47,7 @@
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
font-family: $regular_font; font-family: $regular_font;
border-left: 0; border: 0;
border-right: 0;
resize: none!important; // TODO: Find a way to remove this !important
&:focus { &:focus {
outline: 0; outline: 0;
...@@ -63,10 +61,11 @@ ...@@ -63,10 +61,11 @@
} }
.common-note-form { .common-note-form {
margin: 0; .md-area {
padding: $gl-padding; padding: $gl-padding-top $gl-padding;
border: 1px solid #E5E5E5; border: 1px solid #E5E5E5;
border-radius: $border-radius-base; border-radius: $border-radius-base;
}
} }
.note-form-actions { .note-form-actions {
...@@ -151,11 +150,43 @@ ...@@ -151,11 +150,43 @@
} }
} }
.comment-hints { .comment-toolbar {
color: #999; padding-top: $gl-padding-top;
background: #fff; border-top: 1px solid $border-color;
padding: 7px; }
margin-top: -7px;
border: 1px solid $border-color; .toolbar-button {
font-size: 13px; float: left;
margin-right: $gl-padding;
padding: 0;
background: none;
border: 0;
color: #959494;
font-size: 14px;
line-height: 16px;
&:hover,
&:focus {
color: $gl-link-color;
outline: 0;
}
&:last-child {
margin-right: 0;
}
}
.toolbar-button-icon {
position: relative;
top: 1px;
margin-right: 3px;
color: inherit;
font-size: 16px;
}
.toolbar-text {
float: left;
color: #959494;
font-size: 14px;
line-height: 16px;
} }
.md-area .md-area
.md-header.clearfix .md-header
%ul.nav-links.pull-left %ul.nav-links
%li.active %li.active
%a.js-md-write-button{ href: "#md-write-holder" } %a.js-md-write-button{ href: "#md-write-holder" }
Write Write
%li %li
%a.js-md-preview-button{ href: "#md-preview-holder" } %a.js-md-preview-button{ href: "#md-preview-holder" }
Preview Preview
.pull-right %li.pull-right
%a.zen-cotrol.js-zen-enter{ href: "#" } %button.zen-cotrol.zen-control-full.js-zen-enter{ type: 'button' }
Go full screen Go full screen
.md-write-holder .md-write-holder
= yield = yield
.md.md-preview-holder.hide .md.md-preview-holder.js-md-preview.hide{class: (preview_class if defined?(preview_class))}
.js-md-preview{class: (preview_class if defined?(preview_class))}
- if defined?(referenced_users) && referenced_users - if defined?(referenced_users) && referenced_users
%div.referenced-users.hide %div.referenced-users.hide
......
.zennable .zen-backdrop
.zen-backdrop
- classes << ' js-gfm-input js-autosize markdown-area' - classes << ' js-gfm-input js-autosize markdown-area'
- if defined?(f) && f - if defined?(f) && f
= f.text_area attr, class: classes, placeholder: "Write a comment or drag your files here..." = f.text_area attr, class: classes, placeholder: "Write a comment or drag your files here..."
......
.comment-hints.clearfix .comment-toolbar.clearfix
.pull-left %button.toolbar-button.js-toolbar-button{ type: 'button', data: { prefix: ':' }, tabindex: '-1' }
= icon('smile-o', class: 'toolbar-button-icon')
Emoji
.toolbar-text
Styling with
= link_to 'Markdown', help_page_path('markdown', 'markdown'), target: '_blank', tabindex: -1 = link_to 'Markdown', help_page_path('markdown', 'markdown'), target: '_blank', tabindex: -1
tip: is supported
= random_markdown_tip %button.toolbar-button.markdown-selector.pull-right{ type: 'button', tabindex: '-1' }
.pull-right = icon('file-image-o', class: 'toolbar-button-icon')
= link_to '#', class: 'markdown-selector', tabindex: -1 do
= icon('paperclip')
Attach a file Attach a file
-# .comment-hints.clearfix
-# .pull-left
-# = link_to 'Markdown', help_page_path('markdown', 'markdown'), target: '_blank', tabindex: -1
-# tip:
-# = random_markdown_tip
-# .pull-right
-# = link_to '#', class: 'markdown-selector', tabindex: -1 do
-# = icon('paperclip')
-# Attach a file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment