From 1587caa3e4d5b87e322612195a3db38212489c83 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 13 Mar 2013 19:24:30 +0200 Subject: [PATCH] Use name+username in team -> new --- app/decorators/user_decorator.rb | 4 ---- app/models/user.rb | 4 ++++ app/views/team_members/_form.html.haml | 2 +- app/views/teams/members/new.html.haml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index b781f237..af9c6a63 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -8,8 +8,4 @@ class UserDecorator < ApplicationDecorator def tm_of(project) project.team_member_by_id(self.id) end - - def name_with_email - "#{name} (#{email})" - end end diff --git a/app/models/user.rb b/app/models/user.rb index a8c39f5f..db807d71 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -340,4 +340,8 @@ class User < ActiveRecord::Base def owned_teams UserTeam.where(owner_id: self.id) end + + def name_with_username + "#{name} (#{username})" + end end diff --git a/app/views/team_members/_form.html.haml b/app/views/team_members/_form.html.haml index 05bea2db..63bfbecd 100644 --- a/app/views/team_members/_form.html.haml +++ b/app/views/team_members/_form.html.haml @@ -11,7 +11,7 @@ %h6 1. Choose people you want in the team .clearfix = f.label :user_ids, "People" - .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) + .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name_with_username), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) %h6 2. Set access level for them .clearfix diff --git a/app/views/teams/members/new.html.haml b/app/views/teams/members/new.html.haml index fd948d0c..1a03cea0 100644 --- a/app/views/teams/members/new.html.haml +++ b/app/views/teams/members/new.html.haml @@ -20,7 +20,7 @@ %td= @team.admin?(member) ? "Admin" : "Member" %td %tr - %td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name_with_email), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5' + %td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name_with_username), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5' %td= select_tag :default_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" } %td %span= check_box_tag :group_admin