Project

General

Profile

Patch #25491 » 25491-list-of-role-members-v3.diff

Go MAEDA, 2017-05-01 07:47

View differences:

app/controllers/roles_controller.rb (working copy)
100 100
    redirect_to roles_path
101 101
  end
102 102

  
103
  def members
104
    @role = Role.find(params[:id])
105
    @projects_members = Member.joins(:roles, :user).where(
106
      :roles => {:id => @role}
107
    ).group(:users, :id).group_by(&:project)
108
  end
109

  
103 110
  def permissions
104 111
    @roles = Role.sorted.to_a
105 112
    @permissions = Redmine::AccessControl.permissions.select { |p| !p.public? }
app/models/time_entry_query.rb (working copy)
107 107
  def default_totalable_names
108 108
    [:hours]
109 109
  end
110
 
110

  
111 111
  def default_sort_criteria
112 112
    [['spent_on', 'desc']]
113 113
  end
app/models/user.rb (working copy)
430 430
  def delete_autologin_token(value)
431 431
    Token.where(:user_id => id, :action => 'autologin', :value => value).delete_all
432 432
  end
433
  
433

  
434 434
  # Returns true if token is a valid session token for the user whose id is user_id
435 435
  def self.verify_session_token(user_id, token)
436 436
    return false if user_id.blank? || token.blank?
app/views/roles/index.html.erb (working copy)
16 16
  <td class="name"><%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, edit_role_path(role))) %></td>
17 17
  <td class="buttons">
18 18
    <%= reorder_handle(role) unless role.builtin? %>
19
    <%= link_to l(:label_member_plural), {:controller => 'roles', :action => 'members', :id => role.id}, :class => 'icon icon-user'  unless role.builtin? %>
19 20
    <%= link_to l(:button_copy), new_role_path(:copy => role), :class => 'icon icon-copy' %>
20 21
    <%= delete_link role_path(role) unless role.builtin? %>
21 22
  </td>
......
28 29

  
29 30
<%= javascript_tag do %>
30 31
  $(function() { $("table.roles tbody").positionedItems({items: ".givable"}); });
31
<% end %>
32
<% end %>
app/views/roles/members.html.erb (working copy)
1
<%= title [l(:label_role_plural), roles_path], @role.name, l(:label_member_plural) %>
2

  
3
<% if @projects_members.empty? %>
4

  
5
<p class="nodata"><%= l(:label_no_data) %></p>
6

  
7
<% else %>
8

  
9
<% @projects_members.each do |project, members| next if members.count == 0 %>
10

  
11
<h3><%= project.name %></h3>
12
<div class="box tabular" id="members_list">
13
  <div class="splitcontent">
14
    <ul>
15
      <% members.each do |member| next if member.nil? or member.user.nil? %>
16
        <li><%= link_to_user(member.user) %></li>
17
      <% end %>
18
    </ul>
19
  </div>
20
</div>
21
<% end %>
22
<% end %>
config/locales/ja.yml (working copy)
291 291
  field_port: ポート
292 292
  field_account: アカウント
293 293
  field_base_dn: ベースDN
294
  field_attr_login: ログイン属性
295
  field_attr_firstname: 名属性
296
  field_attr_lastname: 苗字属性
297
  field_attr_mail: メール属性
294
  field_attr_login: ログインIDの属性
295
  field_attr_firstname: 名属性
296
  field_attr_lastname: 姓の属性
297
  field_attr_mail: メールアドレスの属性
298 298
  field_onthefly: あわせてユーザーを作成
299 299
  field_start_date: 開始日
300 300
  field_done_ratio: 進捗率
config/routes.rb (working copy)
332 332
      match 'permissions', :via => [:get, :post]
333 333
    end
334 334
  end
335
  get '/roles/:id/members', :to => 'roles#members'
336

  
335 337
  resources :enumerations, :except => :show
336 338
  match 'enumerations/:type', :to => 'enumerations#index', :via => :get
337 339

  
public/stylesheets/application.css (working copy)
1303 1303

  
1304 1304
.contextual>*:not(:first-child), .buttons>.icon:not(:first-child) { margin-left: 5px; }
1305 1305

  
1306
#members_list ul {
1307
  -moz-column-count: 3;
1308
  -webkit-column-count: 3;
1309
  column-count: 3;
1310
  list-style-position: inside;
1311
}
1312

  
1306 1313
img.gravatar {
1307 1314
  vertical-align: middle;
1308 1315
  border-radius: 20%;
(7-7/7)