Commit b53de0ff0d7a17e250f1e20d7d2768dbd20b1a59

Authored by JoenioCosta
1 parent f889a85c

ActionItem241: focus on 'name' for non logged users

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1585 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/content_viewer_controller.rb
@@ -58,6 +58,7 @@ class ContentViewerController < PublicController @@ -58,6 +58,7 @@ class ContentViewerController < PublicController
58 @comment = @page.comments.find(params[:remove_comment]) 58 @comment = @page.comments.find(params[:remove_comment])
59 if (user == @comment.author) || (user == @page.profile) 59 if (user == @comment.author) || (user == @page.profile)
60 @comment.destroy 60 @comment.destroy
  61 + flash[:notice] = _('Comment succesfully deleted')
61 end 62 end
62 redirect_to :action => 'view_page' 63 redirect_to :action => 'view_page'
63 end 64 end
app/views/content_viewer/_comment_form.rhtml
1 <% 1 <%
2 comment_form_id = 'comment_form'+ rand(9999).to_s 2 comment_form_id = 'comment_form'+ rand(9999).to_s
3 %> 3 %>
  4 +
  5 +<% focus_on = logged_in? ? 'title' : 'name' %>
  6 +
4 <div 7 <div
5 class="post_comment_box closed" 8 class="post_comment_box closed"
6 onclick="f=$(<%= comment_form_id %>); f.style.display='block'; 9 onclick="f=$(<%= comment_form_id %>); f.style.display='block';
7 this.className = this.className.replace(/closed/,'opened'); 10 this.className = this.className.replace(/closed/,'opened');
8 - f.commit.focus(); f['comment[title]'].focus(); 11 + f.commit.focus(); f['comment[<%= focus_on %>]'].focus();
9 this.onclick=null"> 12 this.onclick=null">
10 13
11 <h4><%= _('Post a comment') %></h4> 14 <h4><%= _('Post a comment') %></h4>