From e968919ccec1a2c0a918a7f27e0e8597e2030c82 Mon Sep 17 00:00:00 2001 From: wvengen Date: Tue, 29 Oct 2013 18:46:55 +0100 Subject: [PATCH] beautify map invocations of users --- app/controllers/users_controller.rb | 2 +- app/views/messages/new.haml | 2 +- app/views/shared/_group_form_fields.html.haml | 2 +- app/views/tasks/_form.html.haml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b6a7bb98..51ca228f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -4,7 +4,7 @@ class UsersController < ApplicationController def index @users = User.natural_search(params[:q]) respond_to do |format| - format.json { render :json => @users.map { |u| u.token_attributes } } + format.json { render :json => @users.map(&:token_attributes) } end end diff --git a/app/views/messages/new.haml b/app/views/messages/new.haml index 8541b996..5d3e0c89 100644 --- a/app/views/messages/new.haml +++ b/app/views/messages/new.haml @@ -36,7 +36,7 @@ = t '.list.mail', email: mail_to(FoodsoftConfig[:mailing_list_subscribe]) #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 :private = f.input :subject, input_html: {class: 'input-xxlarge'} diff --git a/app/views/shared/_group_form_fields.html.haml b/app/views/shared/_group_form_fields.html.haml index 44376eaf..d8401aa4 100644 --- a/app/views/shared/_group_form_fields.html.haml +++ b/app/views/shared/_group_form_fields.html.haml @@ -4,7 +4,7 @@ = yield = 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 :javascript diff --git a/app/views/tasks/_form.html.haml b/app/views/tasks/_form.html.haml index 95f3b134..78925c41 100644 --- a/app/views/tasks/_form.html.haml +++ b/app/views/tasks/_form.html.haml @@ -19,7 +19,7 @@ = f.input :name = f.input :description, as: :text, input_html: {rows: 10} = 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.association :workgroup = f.input :due_date, as: :date_picker