diff --git a/app/views/content_viewer/_comment.rhtml b/app/views/content_viewer/_comment.rhtml index 240ae7d..a1c4a97 100644 --- a/app/views/content_viewer/_comment.rhtml +++ b/app/views/content_viewer/_comment.rhtml @@ -24,7 +24,7 @@ <% comment_balloon do %> <% if logged_in? && (user == @page.profile || user == comment.author || user.has_permission?(:moderate_comments, @page.profile)) %> <% button_bar(:style => 'float: right; margin-top: 0px;') do %> - <%= icon_button(:delete, _('Remove this comment'), { :profile => params[:profile], :remove_comment => comment.id, :view => params[:view] }, :method => :post, :confirm => _('Are you sure you want to remove this comment?')) %> + <%= icon_button(:delete, _('Remove this comment and all its replies'), { :profile => params[:profile], :remove_comment => comment.id, :view => params[:view] }, :method => :post, :confirm => _('Are you sure you want to remove this comment and all its replies?')) %> <% end %> <% end %> diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index 02cdedb..dfea761 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -125,10 +125,19 @@

> <%= number_of_comments(@page) %>

+ <% if @comments.size > 0 %> +

<%= _('Post a comment') %>

+ <% end %>
<%= render :partial => 'comment_form' %>
+ <% end %> diff --git a/features/comment.feature b/features/comment.feature index f0d54fc..3a416e5 100644 --- a/features/comment.feature +++ b/features/comment.feature @@ -67,4 +67,15 @@ Feature: comment And I fill in "Enter your comment" with "Hey ho, let's go!" When I press "Post comment" Then the "value.Post comment" button should not be enabled - And I should see "Hey ho, let's go" \ No newline at end of file + And I should see "Hey ho, let's go" + + @selenium + Scenario: render comment form and go to bottom + Given the following comment + | article | author | title | body | + | article to comment | booking | hi | how are you? | + Given I am on /booking/article-to-comment + When I follow "Post a comment" within ".post-comment-button" + Then I should see "Enter your comment" within "div#page-comment-form div.post_comment_box.opened" + And I should be exactly on /booking/article-to-comment + And I should be moved to anchor "comment_form" diff --git a/features/step_definitions/custom_webrat_steps.rb b/features/step_definitions/custom_webrat_steps.rb index e006214..e890b6d 100644 --- a/features/step_definitions/custom_webrat_steps.rb +++ b/features/step_definitions/custom_webrat_steps.rb @@ -10,6 +10,10 @@ Then /^I should be exactly on (.+)$/ do |page_name| URI.parse(current_url).request_uri.should == path_to(page_name) end +Then /^I should be moved to anchor "([^\"]+)"$/ do |anchor| + URI.parse(current_url).fragment.should == anchor +end + When /^I select "([^\"]*)"$/ do |value| select(value) end diff --git a/public/designs/themes/base/style.css b/public/designs/themes/base/style.css index c8c9771..cedd006 100644 --- a/public/designs/themes/base/style.css +++ b/public/designs/themes/base/style.css @@ -1087,28 +1087,28 @@ hr.pre-posts, hr.sep-posts { } .comment-from-owner .comment-wrapper-1 { - background: #cecece url(imgs/comment-owner-bg-N.png) repeat-x; + background: #fbf7b5 url(/images/comment-owner-bg-N.png) repeat-x; } .comment-from-owner .comment-wrapper-2 { - background: url(imgs/comment-owner-bg-S.png) 0% 100% repeat-x; + background: url(/images/comment-owner-bg-S.png) 0% 100% repeat-x; } .comment-from-owner .comment-wrapper-3 { - background: url(imgs/comment-owner-bg-L.png) 100% 0% repeat-y; + background: url(/images/comment-owner-bg-L.png) 100% 0% repeat-y; } .comment-from-owner .comment-wrapper-4 { - background: url(imgs/comment-owner-bg-O.png) 0% 0% repeat-y; + background: url(/images/comment-owner-bg-O.png) 0% 0% repeat-y; } .comment-from-owner .comment-wrapper-5 { - background: url(imgs/comment-owner-bg-SL.png) 100% 100% no-repeat; + background: url(/images/comment-owner-bg-SL.png) 100% 100% no-repeat; } .comment-from-owner .comment-wrapper-6 { - background: url(imgs/comment-owner-bg-SO.png) 0% 100% no-repeat; + background: url(/images/comment-owner-bg-SO.png) 0% 100% no-repeat; } .comment-from-owner .comment-wrapper-7 { - background: url(imgs/comment-owner-bg-NL.png) 100% 0% no-repeat; + background: url(/images/comment-owner-bg-NL.png) 100% 0% no-repeat; } .comment-from-owner .comment-wrapper-8 { - background: url(imgs/comment-owner-bg-NO.png) 0% 0% no-repeat; + background: url(/images/comment-owner-bg-NO.png) 0% 0% no-repeat; } .comment-created-at { diff --git a/public/images/comment-owner-bg-L.png b/public/images/comment-owner-bg-L.png new file mode 100644 index 0000000..457eaa1 Binary files /dev/null and b/public/images/comment-owner-bg-L.png differ diff --git a/public/images/comment-owner-bg-N.png b/public/images/comment-owner-bg-N.png new file mode 100644 index 0000000..f515550 Binary files /dev/null and b/public/images/comment-owner-bg-N.png differ diff --git a/public/images/comment-owner-bg-NL.png b/public/images/comment-owner-bg-NL.png new file mode 100644 index 0000000..ebbe1c5 Binary files /dev/null and b/public/images/comment-owner-bg-NL.png differ diff --git a/public/images/comment-owner-bg-NO.png b/public/images/comment-owner-bg-NO.png new file mode 100644 index 0000000..3482700 Binary files /dev/null and b/public/images/comment-owner-bg-NO.png differ diff --git a/public/images/comment-owner-bg-O.png b/public/images/comment-owner-bg-O.png new file mode 100644 index 0000000..4a73252 Binary files /dev/null and b/public/images/comment-owner-bg-O.png differ diff --git a/public/images/comment-owner-bg-S.png b/public/images/comment-owner-bg-S.png new file mode 100644 index 0000000..04b0ca3 Binary files /dev/null and b/public/images/comment-owner-bg-S.png differ diff --git a/public/images/comment-owner-bg-SL.png b/public/images/comment-owner-bg-SL.png new file mode 100644 index 0000000..9eaa0fd Binary files /dev/null and b/public/images/comment-owner-bg-SL.png differ diff --git a/public/images/comment-owner-bg-SO.png b/public/images/comment-owner-bg-SO.png new file mode 100644 index 0000000..b939083 Binary files /dev/null and b/public/images/comment-owner-bg-SO.png differ diff --git a/public/images/comment-reply-owner-bg.png b/public/images/comment-reply-owner-bg.png index 0224a60..a25aeb3 100644 Binary files a/public/images/comment-reply-owner-bg.png and b/public/images/comment-reply-owner-bg.png differ diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 30023e6..dc0e86f 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1087,6 +1087,17 @@ a.comment-picture { right: 8px; } +#content .comment-balloon a.button.icon-delete { + border: 0; + padding-top: 0; + padding-bottom: 0; + background-color: transparent; +} + +#content .comments .comment-balloon a.button.icon-delete { + display: none; +} + .msie7 .article-comments-list .comment-balloon { margin-top: -15px; } @@ -1139,7 +1150,7 @@ a.comment-picture { .article-comment .comment-details { margin: 0px; - padding: 7px 1px 3px 26px; + padding: 7px 1px 3px 5px; } #article .comment-reply-link { @@ -1166,6 +1177,22 @@ a.comment-picture { background: transparent; } +.block #article .post-comment-button a:hover, +.block #article .post-comment-button a:visited, +.block #article .post-comment-button a { + text-decoration: none; + font-size: 14px; + font-weight: bold; + color: #000; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +.comment-balloon-content { + margin-left: 15px; +} + /* * * Comment Replies * * */ .comment-replies .comment-wrapper-1 { @@ -1192,7 +1219,7 @@ a.comment-picture { } .comment-replies .comment-from-owner.comment-content { - background: transparent url(/images/comment-reply-owner-bg.png) left top repeat-x; + background: transparent url(/images/comment-reply-owner-bg.png) left bottom repeat-x; } .comment-replies .comment-user-status { @@ -1213,6 +1240,10 @@ a.comment-picture { padding-right: 7px; } +.comment-replies .comment-text { + margin-top: 1px; +} + .comment-replies .comment-picture { width: 40px; height: 57px; @@ -1333,12 +1364,14 @@ a.comment-picture { margin: 10px auto; } +.post-comment-button a, .post_comment_box h4 { padding: 1px 20px; margin: 0px; background: #eee; } +.post-comment-button a, .post_comment_box.closed h4 { display: inline; border: 1px solid #888; @@ -1409,6 +1442,11 @@ a.comment-picture { width: 100%; } +#page-comment-form .post_comment_box { + text-align: left; + padding-left: 0; +} + /* * * addThis button * * */ .msie #addThis { diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index d4a3a02..270e783 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -1324,4 +1324,22 @@ class ContentViewerControllerTest < Test::Unit::TestCase assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') end + should 'show a post comment button on top if there are comments' do + profile = create_user('testuser').person + article = profile.articles.build(:name => 'test') + article.save! + comment = article.comments.build(:author => profile, :title => 'hi', :body => 'hello') + comment.save! + get :view_page, :profile => 'testuser', :page => [ 'test' ] + assert_tag :tag => 'p', :attributes => { :class => 'post-comment-button' } + end + + should 'not show a post comment button on top if there are no comments' do + profile = create_user('testuser').person + article = profile.articles.build(:name => 'test') + article.save! + get :view_page, :profile => 'testuser', :page => [ 'test' ] + assert_no_tag :tag => 'p', :attributes => { :class => 'post-comment-button' } + end + end -- libgit2 0.21.2