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 58 @comment = @page.comments.find(params[:remove_comment])
59 59 if (user == @comment.author) || (user == @page.profile)
60 60 @comment.destroy
  61 + flash[:notice] = _('Comment succesfully deleted')
61 62 end
62 63 redirect_to :action => 'view_page'
63 64 end
... ...
app/views/content_viewer/_comment_form.rhtml
1 1 <%
2 2 comment_form_id = 'comment_form'+ rand(9999).to_s
3 3 %>
  4 +
  5 +<% focus_on = logged_in? ? 'title' : 'name' %>
  6 +
4 7 <div
5 8 class="post_comment_box closed"
6 9 onclick="f=$(<%= comment_form_id %>); f.style.display='block';
7 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 12 this.onclick=null">
10 13  
11 14 <h4><%= _('Post a comment') %></h4>
... ...