beautify map invocations of users

This commit is contained in:
wvengen 2013-10-29 18:46:55 +01:00
parent 1870276cd2
commit e968919cce
4 changed files with 4 additions and 4 deletions

View file

@ -4,7 +4,7 @@ class UsersController < ApplicationController
def index def index
@users = User.natural_search(params[:q]) @users = User.natural_search(params[:q])
respond_to do |format| respond_to do |format|
format.json { render :json => @users.map { |u| u.token_attributes } } format.json { render :json => @users.map(&:token_attributes) }
end end
end end

View file

@ -36,7 +36,7 @@
= t '.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe]) = t '.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe])
#recipients #recipients
= f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map { |u| u.token_attributes }.to_json } = f.input :recipient_tokens, :input_html => { 'data-pre' => User.find_all_by_id(@message.recipients_ids).map(&:token_attributes).to_json }
= f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').all.reject { |g| g.memberships.empty? } = f.input :group_id, :as => :select, :collection => Group.undeleted.order('type DESC, name ASC').all.reject { |g| g.memberships.empty? }
= f.input :private = f.input :private
= f.input :subject, input_html: {class: 'input-xxlarge'} = f.input :subject, input_html: {class: 'input-xxlarge'}

View file

@ -4,7 +4,7 @@
= yield = yield
= f.input :user_tokens, :as => :string, = f.input :user_tokens, :as => :string,
:input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json } :input_html => { 'data-pre' => f.object.users.map(&:token_attributes).to_json }
- content_for :javascript do - content_for :javascript do
:javascript :javascript

View file

@ -19,7 +19,7 @@
= f.input :name = f.input :name
= f.input :description, as: :text, input_html: {rows: 10} = f.input :description, as: :text, input_html: {rows: 10}
= f.input :duration, :as => :select, :collection => 1..3 = f.input :duration, :as => :select, :collection => 1..3
= f.input :user_list, :as => :string, :input_html => { 'data-pre' => @task.users.map { |u| u.token_attributes }.to_json } = f.input :user_list, :as => :string, :input_html => { 'data-pre' => @task.users.map(&:token_attributes).to_json }
= f.input :required_users = f.input :required_users
= f.association :workgroup = f.association :workgroup
= f.input :due_date, as: :date_picker = f.input :due_date, as: :date_picker