diff options
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/application_helper.rb | 9 | ||||
| -rw-r--r-- | app/helpers/commits_helper.rb | 15 | ||||
| -rw-r--r-- | app/helpers/issues_helper.rb | 4 | ||||
| -rw-r--r-- | app/helpers/notifications_helper.rb | 6 | ||||
| -rw-r--r-- | app/helpers/selects_helper.rb | 20 |
5 files changed, 33 insertions, 21 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1550e8b7e05..4e7d01acd2a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -162,15 +162,6 @@ module ApplicationHelper alias_method :url_to_image, :image_url - def users_select_tag(id, opts = {}) - css_class = "ajax-users-select " - css_class << "multiselect " if opts[:multiple] - css_class << (opts[:class] || '') - value = opts[:selected] || '' - - hidden_field_tag(id, value, class: css_class) - end - def body_data_page path = controller.controller_path.split('/') namespace = path.first if path.second diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 663369e4584..5e5f3f77a21 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -122,17 +122,18 @@ module CommitsHelper def commit_person_link(commit, options = {}) source_name = commit.send "#{options[:source]}_name".to_sym source_email = commit.send "#{options[:source]}_email".to_sym + + user = User.find_for_commit(source_email, source_name) + person_name = user.nil? ? source_name : user.name + person_email = user.nil? ? source_email : user.email + text = if options[:avatar] - avatar = image_tag(avatar_icon(source_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "") - %Q{#{avatar} <span class="commit-#{options[:source]}-name">#{source_name}</span>} + avatar = image_tag(avatar_icon(person_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "") + %Q{#{avatar} <span class="commit-#{options[:source]}-name">#{person_name}</span>} else - source_name + person_name end - # Prefer email match over name match - user = User.where(email: source_email).first - user ||= User.where(name: source_name).first - options = { class: "commit-#{options[:source]}-link has_tooltip", data: { :'original-title' => sanitize(source_email) } diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index cdba6ce84dc..16981edd980 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -70,11 +70,11 @@ module IssuesHelper end def bulk_update_milestone_options - options_for_select(["None (backlog)", nil]) + options_from_collection_for_select(project_active_milestones, "id", "title", params[:milestone_id]) + options_for_select(["None (backlog)"]) + options_from_collection_for_select(project_active_milestones, "id", "title", params[:milestone_id]) end def bulk_update_assignee_options - options_for_select(["None (unassigned)", nil]) + options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]) + options_for_select(["None (unassigned)"]) + options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]) end def assignee_options object diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index ae3402b2617..b2399bb6db1 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -1,11 +1,11 @@ module NotificationsHelper def notification_icon(notification) if notification.disabled? - content_tag :i, nil, class: 'icon-circle cred' + content_tag :i, nil, class: 'icon-volume-off cred' elsif notification.participating? - content_tag :i, nil, class: 'icon-circle cblue' + content_tag :i, nil, class: 'icon-volume-down cblue' elsif notification.watch? - content_tag :i, nil, class: 'icon-circle cgreen' + content_tag :i, nil, class: 'icon-volume-up cgreen' else content_tag :i, nil, class: 'icon-circle-blank cblue' end diff --git a/app/helpers/selects_helper.rb b/app/helpers/selects_helper.rb new file mode 100644 index 00000000000..a1fe4488ae9 --- /dev/null +++ b/app/helpers/selects_helper.rb @@ -0,0 +1,20 @@ +module SelectsHelper + def users_select_tag(id, opts = {}) + css_class = "ajax-users-select " + css_class << "multiselect " if opts[:multiple] + css_class << (opts[:class] || '') + value = opts[:selected] || '' + + hidden_field_tag(id, value, class: css_class) + end + + def project_users_select_tag(id, opts = {}) + css_class = "ajax-project-users-select " + 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, 'data-placeholder' => placeholder) + end +end |
