Skip to content

Commit

Permalink
[webui] Implement reverse owner "search" on the users home page
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Sep 5, 2013
1 parent 0bdc4e8 commit aa84037
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/webui/app/assets/stylesheets/bento/base.scss
Expand Up @@ -218,7 +218,9 @@ h2.box-header, h2.box-subheader{text-indent:10px;font-size:1em;}
.header-tabs .advanced_tabs li:first-child{border-left:none;}
.header-tabs a{display:inline-block;min-height:23px;margin:0px 0.5em -0.3em;padding-top:0.3em;}
.header-tabs li.selected{background:#f6f6f6 image-url('images/gradient-dark.png') repeat-x scroll 0 -10px;background:#333 image-url('images/gradient-dark.png') repeat-x scroll 0 -10px;background:white image-url('images/gradient-dark-nav.png') repeat-x scroll bottom left;border-color:#ccc;}
.header-tabs li.ui-state-active{background:#f6f6f6 image-url('images/gradient-dark.png') repeat-x scroll 0 -10px;background:#333 image-url('images/gradient-dark.png') repeat-x scroll 0 -10px;background:white image-url('images/gradient-dark-nav.png') repeat-x scroll bottom left;border-color:#ccc;}
.header-tabs li.selected a{color:#fff;text-shadow:none;}
.header-tabs li.ui-state-active a{color:#fff;text-shadow:none;}
.aside ul{list-style:none inside;}
.aside ul li{margin-left:0; line-height:100%;}
#display #lp-pr-image{margin-top:42px;margin-left:150px;}
Expand Down
3 changes: 3 additions & 0 deletions src/webui/app/controllers/home_controller.rb
Expand Up @@ -19,6 +19,9 @@ def index
end
end
@ipackages = @displayed_user.involved_packages.each.map {|x| [x.name, x.project]}
@owned = ReverseOwner.find_cached(:user => @displayed_user.login).each.map {|x| [x.rootproject, x.package, x.project]} || []
logger.debug "OWNED: #{@owned.inspect}"
# :limit => "#{@owner_limit}", :devel => "#{@owner_devel}"
if @user == @displayed_user
requests
end
Expand Down
2 changes: 2 additions & 0 deletions src/webui/app/models/reverse_owner.rb
@@ -0,0 +1,2 @@
class ReverseOwner < ActiveXML::Node
end
46 changes: 44 additions & 2 deletions src/webui/app/views/home/index.html.erb
Expand Up @@ -60,8 +60,9 @@
<div id="tabs1">
<div class="box-header header-tabs">
<ul>
<li><a href="#ipackages">Involved Packages</a></li>
<li><a href="#iprojects">Involved Projects</a></li>
<li><a href="#ipackages" title="Packages that you are involved with">Involved Packages</a></li>
<li><a href="#iprojects" title="Projects that you are involved with">Involved Projects</a></li>
<li><a href="#owned" title="Projects/Packages where you are responsible for the maintenance">Owned Project/Packages</a></li>
<!-- <li><a href="#activity">Public Activity</a></li> -->
</ul>
</div>
Expand All @@ -81,6 +82,7 @@
<p><i><%= @displayed_user.login %> is not involved in any packages</i></p>
<% end %>
</div>

<div id="iprojects" class="tab">
<% if @iprojects.blank? %>
<p><i><%= @displayed_user.login %> is not involved in any projects</i></p>
Expand All @@ -98,6 +100,39 @@
</div>
<% end %>
</div>

<div id="owned" class="tab">
<% if @owned.length > 0 %>
<table id='owned-table'>
<thead>
<tr>
<!-- <th>Product</th> -->
<th>Project/Package</th>
</tr>
</thead>
<tbody>
<% @owned.each do |i| -%>
<tr>
<!--
<td>
<%= i[0] %>
</td>
-->
<td>
<% if i[1] %>
<%= render :partial => 'shared/project_or_package_link', :locals => {:project => i[2], :package => i[1],:short => true} %>
<% else %>
<%= render :partial => 'shared/project_or_package_link', :locals => {:project => i[2], :short => true} %>
<%end %>
</td>
</tr>
<% end -%>
</tbody>
</table>
<% else -%>
<p><%= @displayed_user.login %> doesn't own packages/projects.</p>
<% end %>
</div>
<!--
<div id="activity" class="tab">
<p>Activity</p>
Expand Down Expand Up @@ -166,5 +201,12 @@
<% content_for :ready_function do %>
$( "#tabs1" ).tabs();
$( "#tabs2" ).tabs();
<% if @owned.length > 0 %>
$('#owned-table').dataTable({
"bLengthChange": false,
"bStateSave": true,
"iDisplayLength": 15,
});
<% end %>
<% end %>

1 change: 1 addition & 0 deletions src/webui/config/initializers/activexml.rb
Expand Up @@ -52,6 +52,7 @@ def add(d)
:all => "rest:///group/"
map.connect :persongroup, "rest:///person/:login/group"
map.connect :owner, "rest:///search/owner?:binary&:devel&:limit&:project&:attribute"
map.connect :reverseowner, "rest:///search/owner?:user&:devel&:limit&:project&:attribute"

map.connect :unregisteredperson, "rest:///person/register"
map.connect :userchangepasswd, "rest:///person/changepasswd"
Expand Down

0 comments on commit aa84037

Please sign in to comment.