summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-08-29 08:13:38 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-08-29 08:13:38 +0300
commite5adca1b813bf1646a08bbc239acc75a844c366d (patch)
tree19ff08cc4aac12ac166c110b95f7c9b8801deca2
parentb9b63fc36270f6d80ba42e09f34716b12e3277ae (diff)
downloadgitlab-ce-e5adca1b813bf1646a08bbc239acc75a844c366d.tar.gz
Preview as button. Disable note submit unless content
-rw-r--r--app/assets/javascripts/note.js11
-rw-r--r--app/views/notes/_form.html.haml9
2 files changed, 16 insertions, 4 deletions
diff --git a/app/assets/javascripts/note.js b/app/assets/javascripts/note.js
index d9ae45d93c7..dfa09986a26 100644
--- a/app/assets/javascripts/note.js
+++ b/app/assets/javascripts/note.js
@@ -24,6 +24,16 @@ init:
$('.delete-note').live('ajax:success', function() {
$(this).closest('li').fadeOut(); });
+ $('#note_note').on('keyup', function(){
+ var field = $(this);
+ var closest_submit = field.closest("form").find(".submit_note");
+ if(field.val() == "") {
+ closest_submit.attr("disabled", "disabled").addClass("disabled");
+ } else {
+ closest_submit.removeAttr("disabled").removeClass("disabled");
+ }
+ })
+
$("#new_note").live("ajax:before", function(){
$(".submit_note").attr("disabled", "disabled");
})
@@ -35,6 +45,7 @@ init:
$("#note_note").live("focus", function(){
$(this).css("height", "80px");
$('.note_advanced_opts').show();
+ $(this).closest("form").find(".submit_note").attr("disabled", "disabled");
});
$("#note_attachment").change(function(e){
diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml
index 326f1add485..adb6e2b4160 100644
--- a/app/views/notes/_form.html.haml
+++ b/app/views/notes/_form.html.haml
@@ -10,12 +10,13 @@
= f.text_area :note, size: 255
#preview-note.well.hide
.hint
- = link_to 'Preview', preview_project_notes_path(@project), id: 'preview-link'
.right Comments are parsed with #{link_to "Gitlab Flavored Markdown", help_markdown_path, target: '_blank'}.
+ .clearfix
.row.note_advanced_opts.hide
- .span2
- = f.submit 'Add Comment', class: "btn primary submit_note", id: "submit_note"
+ .span3
+ = f.submit 'Add Comment', class: "btn primary submit_note grouped", id: "submit_note"
+ = link_to 'Preview', preview_project_notes_path(@project), class: 'btn grouped', id: 'preview-link'
.span4.notify_opts
%h6.left Notify via email:
= label_tag :notify do
@@ -26,7 +27,7 @@
= label_tag :notify_author do
= check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
%span Commit author
- .span6.attachments
+ .span5.attachments
%h6.left Attachment:
%span.file_name File name...