Commit 0590aa9d authored by randx's avatar randx

commit.short_id as model method. Styled inline comment form

parent 67ef96ea
...@@ -33,7 +33,7 @@ init: ...@@ -33,7 +33,7 @@ init:
}) })
$("#note_note").live("focus", function(){ $("#note_note").live("focus", function(){
$(this).css("height", "100px"); $(this).css("height", "80px");
$('.note_advanced_opts').show(); $('.note_advanced_opts').show();
}); });
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
/* Note textare */ /* Note textare */
#note_note { #note_note {
height:100px; height:80px;
width:97%; width:99%;
font-size:14px; font-size:14px;
} }
...@@ -100,8 +100,25 @@ tr.line_notes_row { ...@@ -100,8 +100,25 @@ tr.line_notes_row {
td { td {
border-bottom:1px solid #ddd; border-bottom:1px solid #ddd;
} }
.actions { .note_actions {
margin:0; 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;
}
}
}
} }
} }
......
class CommitDecorator < ApplicationDecorator class CommitDecorator < ApplicationDecorator
decorates :commit decorates :commit
def short_id(length = 10)
id.to_s[0..length]
end
# Returns the commits title. # Returns the commits title.
# #
# Usually, the commit title is the first line of the commit message. # Usually, the commit title is the first line of the commit message.
......
...@@ -114,6 +114,10 @@ class Commit ...@@ -114,6 +114,10 @@ class Commit
@head = head @head = head
end end
def short_id(length = 10)
id.to_s[0..length]
end
def safe_message def safe_message
utf8 message utf8 message
end end
...@@ -150,4 +154,8 @@ class Commit ...@@ -150,4 +154,8 @@ class Commit
def prev_commit_id def prev_commit_id
prev_commit.try :id prev_commit.try :id
end end
def parents_count
parents && parents.count || 0
end
end end
.commit-box{class: @commit.parents.count > 1 ? "merge-commit" : ""} .commit-box{class: @commit.parents_count > 1 ? "merge-commit" : ""}
.commit-head .commit-head
.right .right
- if @notes_count > 0 - if @notes_count > 0
......
= form_for [@project, @note], :remote => "true", :multipart => true do |f| = form_for [@project, @note], :remote => "true", :multipart => true do |f|
%h3 Leave a comment %h3.page_title Leave a comment
-if @note.errors.any? -if @note.errors.any?
.alert-message.block-message.error .alert-message.block-message.error
- @note.errors.full_messages.each do |msg| - @note.errors.full_messages.each do |msg|
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
%tr.per_line_form %tr.per_line_form
%td{:colspan => 3 } %td{:colspan => 3 }
= form_for [@project, @note], :remote => "true", :multipart => true do |f| = form_for [@project, @note], :remote => "true", :multipart => true do |f|
%h3 Leave a note %h3.page_title Leave a note
%div.span10 %div.span10
-if @note.errors.any? -if @note.errors.any?
.alert-message.block-message.error .alert-message.block-message.error
...@@ -13,19 +13,21 @@ ...@@ -13,19 +13,21 @@
= f.hidden_field :noteable_type = f.hidden_field :noteable_type
= f.hidden_field :line_code = f.hidden_field :line_code
= f.text_area :note, :size => 255 = f.text_area :note, :size => 255
%h5 Notify via email: .note_actions
.clearfix .buttons
= label_tag :notify do = f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note"
= check_box_tag :notify, 1, @note.noteable_type != "Commit" = link_to "Cancel", "#", :class => "btn hide-button"
%span Project team .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) - if @note.notify_only_author?(current_user)
= label_tag :notify_author do = label_tag :notify_author do
= check_box_tag :notify_author, 1 , @note.noteable_type == "Commit" = check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
%span Commit author %span Commit author
.actions
= f.submit 'Add note', :class => "btn primary submit_note", :id => "submit_note"
= link_to "Close", "#", :class => "btn hide-button"
:javascript :javascript
$(function(){ $(function(){
......
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