Skip to content

Commit

Permalink
[webui] Fix display of groups and globalrole
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel authored and adrianschroeter committed May 15, 2013
1 parent 1bc70b4 commit fa0d0e8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
1 change: 1 addition & 0 deletions ReleaseNotes-2.4.2
Expand Up @@ -36,4 +36,5 @@ Bugfixes:
* build: rpm packages get installed again without fsync which speeds up the installation
* backend: fixed binary rpm cache handling for image building via interconnect
* webui: fixed change password dialog
* webui: fixed display of groups and globalrole

6 changes: 5 additions & 1 deletion src/webui/app/models/person.rb
Expand Up @@ -69,7 +69,11 @@ def login
end

def globalrole
self.to_hash["globalrole"]
roles = Array.new
to_hash.elements("globalrole").each do |role|
roles << role
end
roles if roles.length > 0
end

def to_str
Expand Down
22 changes: 12 additions & 10 deletions src/webui/app/views/home/index.html.erb
Expand Up @@ -4,9 +4,9 @@

<!-- user -->
<div class="grid_4 alpha box box-shadow" id="userinfo">
<!-- avatar -->
<!-- avatar -->
<%= user_icon(@displayed_user.login, 200, 'home-avatar') if @displayed_user.email %>
<!-- info -->
<!-- info -->
<h1>
<span id="home-realname">
<% if @displayed_user.realname && !@displayed_user.realname.to_s.empty? %>
Expand All @@ -15,29 +15,31 @@
</span>
<span id="home-username"><%= @displayed_user.login if @displayed_user.login %></span>
</h1>
<!-- mail -->
<p>
<% mail_to = 'mailto:' + @displayed_user.email %>
<%= link_to(image_tag('email.png', :alt => "Send mail", :title => "Send mail to user"), mail_to) %>
<%= mail_to(@displayed_user.email, nil, :title => "Send mail to user") %>
</p>
<!-- groups -->
<% if not @displayed_user.groups.empty? %>
<h6>Member of</h6>
<ul>
<p>Member of the group</p>
<ul>
<% @displayed_user.groups.each do |group| %>
<li><%= link_to(group, :controller => 'group', :action => 'show', :group => group) %></li>
<% end %>
</ul>
<% end %>
<% if @displayed_user.globalrole && !@displayed_user.globalrole.to_s.empty? %>
<% if @displayed_user.groups.empty? %>
<h6>Member of</h6>
<!-- roles -->
<% if @displayed_user.globalrole %>
<p>Has the role</p>
<ul>
<% end %>
<% @displayed_user.globalrole.each do |role| %>
<% @displayed_user.globalrole.each do |role| %>
<li><%= role %></li>
<% end %>
</ul>
<% end %>
<!-- roles -->
<!-- edit -->
<% if @user and @displayed_user.to_s == @user.login %>
<p>
<% if CONFIG['proxy_auth_mode'] == :on %>
Expand Down
10 changes: 6 additions & 4 deletions src/webui/app/views/user/edit.html.erb
Expand Up @@ -18,11 +18,13 @@
</p>
<p>
<% @roles.each do |r| %>
<%= label_tag "globalrole_#{r}", "#{r}" %>
<% if r.to_s == @displayed_user.globalrole.to_s %>
<% select = true %>
<% if @displayed_user.globalrole %>
<%= label_tag "globalrole_#{r}", "#{r}" %>
<% if @displayed_user.globalrole.include?(r) %>
<% select = true %>
<% end %>
<%= radio_button_tag :globalrole, r, select %>
<% end %>
<%= radio_button_tag :globalrole, r, select %>
<% end %>
</p>
<p>
Expand Down

0 comments on commit fa0d0e8

Please sign in to comment.