Commit 21191318ae616a88376977d2438f1f4d7826283e
1 parent
583bfac5
Exists in
master
and in
4 other branches
refactor wall.js. style wall page a bit
Showing
4 changed files
with
40 additions
and
20 deletions
Show diff stats
app/assets/javascripts/wall.js.coffee
... | ... | @@ -58,14 +58,26 @@ |
58 | 58 | form.show() |
59 | 59 | |
60 | 60 | renderNote: (note) -> |
61 | - author = '<strong class="wall-author">' + note.author.name + '</strong>' | |
62 | - body = '<span class="wall-text">' + linkify(sanitize(note.body)) + '</span>' | |
63 | - file = '' | |
64 | - time = '<abbr class="timeago" title="' + note.created_at + '">' + note.created_at + '</time>' | |
61 | + template = Wall.noteTemplate() | |
62 | + template = template.replace('{{author_name}}', note.author.name) | |
63 | + template = template.replace('{{created_at}}', note.created_at) | |
64 | + template = template.replace('{{text}}', linkify(sanitize(note.body))) | |
65 | 65 | |
66 | 66 | if note.attachment |
67 | - file = '<span class="wall-file"><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a></span>' | |
68 | - | |
69 | - html = '<li>' + author + body + file + time + '</li>' | |
67 | + file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>' | |
68 | + else | |
69 | + file = '' | |
70 | + template = template.replace('{{file}}', file) | |
71 | + | |
72 | + | |
73 | + $('ul.notes').append(template) | |
70 | 74 | |
71 | - $('ul.notes').append(html) | |
75 | + noteTemplate: -> | |
76 | + return '<li> | |
77 | + <strong class="wall-author">{{author_name}}</strong> | |
78 | + <span class="wall-text"> | |
79 | + {{text}} | |
80 | + <span class="wall-file">{{file}}</span> | |
81 | + </span> | |
82 | + <abbr class="timeago" title="{{created_at}}">{{created_at}}</abbr> | |
83 | + </li>' | ... | ... |
app/assets/stylesheets/sections/wall.scss
... | ... | @@ -14,12 +14,28 @@ |
14 | 14 | |
15 | 15 | .notes { |
16 | 16 | margin-bottom: 160px; |
17 | + background: #FFE; | |
18 | + border: 1px solid #EED; | |
19 | + | |
20 | + > li { | |
21 | + @extend .clearfix; | |
22 | + border-bottom: 1px solid #EED; | |
23 | + padding: 10px; | |
24 | + } | |
17 | 25 | |
18 | 26 | .wall-author { |
19 | 27 | color: #666; |
20 | - margin-right: 10px; | |
21 | - border-right: 1px solid #CCC; | |
22 | - padding-right: 5px | |
28 | + float: left; | |
29 | + width: 100px; | |
30 | + text-overflow: ellipsis; | |
31 | + } | |
32 | + | |
33 | + .wall-text { | |
34 | + border-left: 1px solid #CCC; | |
35 | + margin-left: 10px; | |
36 | + padding-left: 10px; | |
37 | + float: left; | |
38 | + width: 80%; | |
23 | 39 | } |
24 | 40 | |
25 | 41 | .wall-file { | ... | ... |
app/views/walls/show.html.haml
spec/features/notes_on_merge_requests_spec.rb
... | ... | @@ -21,11 +21,6 @@ describe "On a merge request", js: true do |
21 | 21 | it { find(".js-main-target-form input[type=submit]").value.should == "Add Comment" } |
22 | 22 | it { within(".js-main-target-form") { should_not have_link("Cancel") } } |
23 | 23 | |
24 | - # notifiactions | |
25 | - it { within(".js-main-target-form") { should have_unchecked_field("Notify team via email") } } | |
26 | - it { within(".js-main-target-form") { should_not have_checked_field("Notify commit author") } } | |
27 | - it { within(".js-main-target-form") { should_not have_unchecked_field("Notify commit author") } } | |
28 | - | |
29 | 24 | describe "without text" do |
30 | 25 | it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } } |
31 | 26 | end |
... | ... | @@ -126,9 +121,6 @@ describe "On a merge request diff", js: true, focus: true do |
126 | 121 | it { should have_button("Add Comment") } |
127 | 122 | it { should have_css(".js-close-discussion-note-form", text: "Cancel") } |
128 | 123 | |
129 | - # notification options | |
130 | - it { should have_unchecked_field("Notify team via email") } | |
131 | - | |
132 | 124 | it "shouldn't add a second form for same row" do |
133 | 125 | find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder .js-add-diff-note-button").trigger("click") |
134 | 126 | ... | ... |