Permalink
Browse files

Add placeholder support for project_users_select_tag

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
  • Loading branch information...
1 parent f0f8839 commit 67798492bc5409b5a596fa28022e1e6cdf5985e4 @dzaporozhets dzaporozhets committed Feb 13, 2014
@@ -20,8 +20,9 @@ $ ->
$('.ajax-project-users-select').each (i, select) ->
project_id = $('body').data('project-id')
+
$(select).select2
- placeholder: "Search for a user"
+ placeholder: $(select).data('placeholder') || "Search for a user"
multiple: $(select).hasClass('multiselect')
minimumInputLength: 0
query: (query) ->
@@ -13,7 +13,8 @@ def project_users_select_tag(id, opts = {})
css_class << "multiselect " if opts[:multiple]
css_class << (opts[:class] || '')
value = opts[:selected] || ''
+ placeholder = opts[:placeholder] || 'Select user'
- hidden_field_tag(id, value, class: css_class)
+ hidden_field_tag(id, value, class: css_class, 'data-placeholder' => placeholder)
end
end
@@ -6,7 +6,7 @@
= form_tag bulk_update_project_issues_path(@project), method: :post do
%span Update selected issues with &nbsp;
= select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")
- = project_users_select_tag('update[assignee_id]')
+ = project_users_select_tag('update[assignee_id]', placeholder: 'Assignee')
= select_tag('update[milestone_id]', bulk_update_milestone_options, prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :status, params[:status]

0 comments on commit 6779849

Please sign in to comment.