Commit 38ea8816a68bf31aa3357fa18b6610c77e97b34c

Authored by Daniela Feitosa
1 parent 727baee6

Fixed problem wits scrap reply

app/views/profile/_create_article.rhtml
... ... @@ -10,7 +10,7 @@
10 10 <%= content_tag(:p, link_to(_('See complete forum'), activity.get_url), :class => 'see-forum') if activity.target.is_a?(Forum) %>
11 11 <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) %></p>
12 12 <div class='profile-wall-actions'>
13   - <%= link_to _('Comment'), "#reply_content_#{activity.id}" %>
  13 + <%= link_to_function _('Comment'), "$('reply_content_#{activity.id}').focus()" %>
14 14 <%= link_to_remote(content_tag(:span, _('Remove')), :url =>{:action => 'remove_activity', :activity_id => activity.id, :only_hide => true}, :confirm => _('Are you sure?'), :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %>
15 15 </div>
16 16 </div>
... ...
app/views/profile/_default_activity.rhtml
... ... @@ -5,7 +5,7 @@
5 5 <p class='profile-activity-text'><%= link_to activity.user.name, activity.user.url %> <%= describe activity %></p>
6 6 <p class='profile-activity-time'><%= time_ago_as_sentence(activity.created_at) %></p>
7 7 <div class='profile-wall-actions'>
8   - <%= link_to _('Comment'), "#reply_content_#{activity.id}" %>
  8 + <%= link_to_function _('Comment'), "$('reply_content_#{activity.id}').focus()" %>
9 9 <%= link_to_remote(content_tag(:span, _('Remove')), :confirm => _('Are you sure?'), :url =>{:action => 'remove_activity', :activity_id => activity.id}, :update => "profile-activity-item-#{activity.id}") if logged_in? && current_person == @profile %>
10 10 </div>
11 11 </div>
... ...
app/views/profile/_profile_scrap.rhtml
... ... @@ -8,7 +8,9 @@
8 8 <p class='profile-activity-time'><%= time_ago_as_sentence(scrap.created_at) %></p>
9 9 <div class='profile-wall-actions'>
10 10 <% if logged_in? && current_person.follows?(scrap.sender) %>
11   - <span class='profile-activity-send-reply'><%= link_to_function _('Comment'), "hide_and_show(['#profile-activity-reply-response-#{scrap.id}'],['#profile-activity-reply-#{scrap.id}', '#profile-activity-reply-form-#{scrap.id}']);$('reply_content_#{scrap.id}').value='';$('reply_content_#{scrap.id}').focus();$('scrap_id_#{scrap.id}').value='#{scrap.id}';return false", :class => "profile-send-reply" %></span>
  11 + <span class='profile-activity-send-reply'>
  12 + <%= link_to_function _('Comment'), "hide_and_show(['#profile-wall-reply-response-#{scrap.id}'],['#profile-wall-reply-#{scrap.id}', '#profile-wall-reply-form-#{scrap.id}']);$('reply_content_#{scrap.id}').value='';$('reply_content_#{scrap.id}').focus();$('scrap_id_#{scrap.id}').value='#{scrap.id}';return false", :class => "profile-send-reply" %>
  13 + </span>
12 14 <% end %>
13 15 <%= link_to_remote(content_tag(:span, _('Remove')), :confirm => _('Are you sure?'), :url =>{:action => 'remove_scrap', :scrap_id => scrap.id}, :update => "profile-activity-item-#{scrap.id}") if logged_in? && user.can_control_scrap?(scrap) %>
14 16 <% end %>
... ...
app/views/profile/_profile_scrap_reply_form.rhtml
... ... @@ -2,7 +2,14 @@
2 2 <div id='profile-wall-reply-form-<%= scrap.id%>' style='display:none;'>
3 3 <p class='profile-wall-reply'>
4 4 <% form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap'}, :update => "profile_activities", :success =>"hide_and_show(['#profile-wall-reply-form-#{scrap.id}'],['#profile-wall-reply-response-#{scrap.id}'])" do %>
5   - <%= text_area :scrap, :content, { :id => "reply_content_#{scrap.id}", :cols => 50, :rows => 1, :class => 'submit-with-keypress' } %>
  5 + <%= text_area :scrap, :content, { :id => "reply_content_#{scrap.id}",
  6 + :cols => 50,
  7 + :rows => 1,
  8 + :class => 'submit-with-keypress',
  9 + :onfocus => ('if(this.value==this.title){this.value="";this.style.color="#000"};this.style.backgroundImage="url(' + profile_icon(current_person, :icon, false) + ')"' if logged_in?),
  10 + :onblur => ('if(this.value==""){this.value=this.title;this.style.color="#ccc"};this.style.backgroundImage="none"' if logged_in?),
  11 +
  12 + } %>
6 13 <%= hidden_field :scrap, :scrap_id, :id => "scrap_id_#{scrap.id}" %>
7 14 <%= hidden_field_tag 'receiver_id', scrap.sender.id %>
8 15 <% end %>
... ...