summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-07-27 11:22:05 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-07-27 11:22:05 +0300
commit0590aa9d6073e79ba47c4fe5c34318f6889c44d8 (patch)
treec7dfcfa0fc1f4f5f76946dffdce04542bcd1ecda
parent67ef96ea5f721cc620f3e931f05d918c904ec74e (diff)
downloadgitlab-ce-0590aa9d6073e79ba47c4fe5c34318f6889c44d8.tar.gz
commit.short_id as model method. Styled inline comment form
-rw-r--r--app/assets/javascripts/note.js2
-rw-r--r--app/assets/stylesheets/notes.scss23
-rw-r--r--app/decorators/commit_decorator.rb4
-rw-r--r--app/models/commit.rb8
-rw-r--r--app/views/commits/_commit_box.html.haml2
-rw-r--r--app/views/notes/_form.html.haml2
-rw-r--r--app/views/notes/_per_line_form.html.haml28
7 files changed, 46 insertions, 23 deletions
diff --git a/app/assets/javascripts/note.js b/app/assets/javascripts/note.js
index c45a45d2fcb..d9ae45d93c7 100644
--- a/app/assets/javascripts/note.js
+++ b/app/assets/javascripts/note.js
@@ -33,7 +33,7 @@ init:
})
$("#note_note").live("focus", function(){
- $(this).css("height", "100px");
+ $(this).css("height", "80px");
$('.note_advanced_opts').show();
});
diff --git a/app/assets/stylesheets/notes.scss b/app/assets/stylesheets/notes.scss
index 39e03813a8b..abce4c6893f 100644
--- a/app/assets/stylesheets/notes.scss
+++ b/app/assets/stylesheets/notes.scss
@@ -24,8 +24,8 @@
/* Note textare */
#note_note {
- height:100px;
- width:97%;
+ height:80px;
+ width:99%;
font-size:14px;
}
@@ -100,8 +100,25 @@ tr.line_notes_row {
td {
border-bottom:1px solid #ddd;
}
- .actions {
+ .note_actions {
margin:0;
+ padding-top: 10px;
+
+ .buttons {
+ float:left;
+ width:300px;
+ }
+ .options {
+ .labels {
+ float:left;
+ padding-left:10px;
+ label {
+ padding: 6px 0;
+ margin: 0;
+ width:120px;
+ }
+ }
+ }
}
}
diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb
index d9c880bee72..cc8fa97587b 100644
--- a/app/decorators/commit_decorator.rb
+++ b/app/decorators/commit_decorator.rb
@@ -1,10 +1,6 @@
class CommitDecorator < ApplicationDecorator
decorates :commit
- def short_id(length = 10)
- id.to_s[0..length]
- end
-
# Returns the commits title.
#
# Usually, the commit title is the first line of the commit message.
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 859bee29fa5..71c41350c95 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -114,6 +114,10 @@ class Commit
@head = head
end
+ def short_id(length = 10)
+ id.to_s[0..length]
+ end
+
def safe_message
utf8 message
end
@@ -150,4 +154,8 @@ class Commit
def prev_commit_id
prev_commit.try :id
end
+
+ def parents_count
+ parents && parents.count || 0
+ end
end
diff --git a/app/views/commits/_commit_box.html.haml b/app/views/commits/_commit_box.html.haml
index 8ccb3f1b72a..6994de4a134 100644
--- a/app/views/commits/_commit_box.html.haml
+++ b/app/views/commits/_commit_box.html.haml
@@ -1,4 +1,4 @@
-.commit-box{class: @commit.parents.count > 1 ? "merge-commit" : ""}
+.commit-box{class: @commit.parents_count > 1 ? "merge-commit" : ""}
.commit-head
.right
- if @notes_count > 0
diff --git a/app/views/notes/_form.html.haml b/app/views/notes/_form.html.haml
index f5aa1495796..aeaf57e6ddc 100644
--- a/app/views/notes/_form.html.haml
+++ b/app/views/notes/_form.html.haml
@@ -1,5 +1,5 @@
= form_for [@project, @note], :remote => "true", :multipart => true do |f|
- %h3 Leave a comment
+ %h3.page_title Leave a comment
-if @note.errors.any?
.alert-message.block-message.error
- @note.errors.full_messages.each do |msg|
diff --git a/app/views/notes/_per_line_form.html.haml b/app/views/notes/_per_line_form.html.haml
index 8beaf9b5e0c..a5a70053480 100644
--- a/app/views/notes/_per_line_form.html.haml
+++ b/app/views/notes/_per_line_form.html.haml
@@ -2,7 +2,7 @@
%tr.per_line_form
%td{:colspan => 3 }
= form_for [@project, @note], :remote => "true", :multipart => true do |f|
- %h3 Leave a note
+ %h3.page_title Leave a note
%div.span10
-if @note.errors.any?
.alert-message.block-message.error
@@ -13,19 +13,21 @@
= f.hidden_field :noteable_type
= f.hidden_field :line_code
= f.text_area :note, :size => 255
- %h5 Notify via email:
- .clearfix
- = label_tag :notify do
- = check_box_tag :notify, 1, @note.noteable_type != "Commit"
- %span Project team
+ .note_actions
+ .buttons
+ = f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note"
+ = link_to "Cancel", "#", :class => "btn hide-button"
+ .options
+ %h6.left Notify via email:
+ .labels
+ = label_tag :notify do
+ = check_box_tag :notify, 1, @note.noteable_type != "Commit"
+ %span Project team
- - if @note.notify_only_author?(current_user)
- = label_tag :notify_author do
- = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
- %span Commit author
- .actions
- = f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note"
- = link_to "Close", "#", :class => "btn hide-button"
+ - if @note.notify_only_author?(current_user)
+ = label_tag :notify_author do
+ = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
+ %span Commit author
:javascript
$(function(){