Commit 7f75499b8de277afc76e3ce8fee09fbe41583250
Committed by
Rodrigo Souto
1 parent
cd68aebb
Exists in
web_steps_improvements
and in
6 other branches
Improve expandable text area
Expandable text area when you leave a big scrap in profile's wall Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com> Signed-off-by: Macártur Sousa <macartur.sc@gmail.com>
Showing
3 changed files
with
7 additions
and
3 deletions
Show diff stats
app/controllers/public/profile_controller.rb
... | ... | @@ -218,7 +218,10 @@ class ProfileController < PublicController |
218 | 218 | |
219 | 219 | def more_comments |
220 | 220 | profile_filter = @profile.person? ? {:user_id => @profile} : {:target_id => @profile} |
221 | - activity = ActionTracker::Record.where({:id => params[:activity]}.merge profile_filter).first | |
221 | + activity = ActionTracker::Record.where(:id => params[:activity]) | |
222 | + activity = activity.where(profile_filter) if !logged_in? || !current_person.follows?(@profile) | |
223 | + activity = activity.first | |
224 | + | |
222 | 225 | comments_count = activity.comments.count |
223 | 226 | comment_page = (params[:comment_page] || 1).to_i |
224 | 227 | comments_per_page = 5 | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -940,7 +940,8 @@ module ApplicationHelper |
940 | 940 | end |
941 | 941 | |
942 | 942 | def expandable_text_area(object_name, method, text_area_id, options = {}) |
943 | - text_area(object_name, method, { :id => text_area_id, :onkeyup => "grow_text_area('#{text_area_id}')" }.merge(options)) | |
943 | + options[:class] = (options[:class] || '') + ' autogrow' | |
944 | + text_area(object_name, method, { :id => text_area_id }.merge(options)) | |
944 | 945 | end |
945 | 946 | |
946 | 947 | def pluralize_without_count(count, singular, plural = nil) | ... | ... |
app/views/profile/_profile_scrap_reply_form.html.erb
1 | 1 | <div id='profile-wall-reply-<%= scrap.id%>' style='display:none'> |
2 | 2 | <div id='profile-wall-reply-form-<%= scrap.id%>' style='display:none'> |
3 | 3 | <p class='profile-wall-reply'> |
4 | - <%= form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap'}, :update => "profile_activities", :html => { :class => 'profile-wall-reply-form'} do %> | |
4 | + <%= form_remote_tag :url => {:controller => 'profile', :action => 'leave_scrap'}, :update => "profile_activities", :html => { :class => 'profile-wall-reply-form', 'data-update' => 'profile_activities'} do %> | |
5 | 5 | <%= expandable_text_area :scrap, |
6 | 6 | :content, |
7 | 7 | "reply_content_#{scrap.id}", | ... | ... |