[Xfce4-commits] <moka:nick/maintainer-improvements> Add list of maintainers for admins.

Nick Schermer noreply at xfce.org
Sun Apr 3 15:46:05 CEST 2011


Updating branch refs/heads/nick/maintainer-improvements
         to 5e11604c3a39dd175798a4f4fbe5ca0154f75ddb (commit)
       from b904035d700f693135e1a06baa736cbb34621693 (commit)

commit 5e11604c3a39dd175798a4f4fbe5ca0154f75ddb
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Apr 3 15:43:18 2011 +0200

    Add list of maintainers for admins.

 lib/controllers/maintainers.rb |    7 +++++++
 lib/views/head.erb             |    5 ++++-
 lib/views/maintainer.erb       |   26 ++++++++++++++++++++++++++
 moka.gemspec                   |    1 +
 4 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/lib/controllers/maintainers.rb b/lib/controllers/maintainers.rb
index 77f8498..2ce6448 100755
--- a/lib/controllers/maintainers.rb
+++ b/lib/controllers/maintainers.rb
@@ -12,6 +12,13 @@ module Moka
           view :maintainer_profile
         end
 
+        app.get '/maintainer' do
+
+          authentication_required
+
+          view :maintainer
+        end
+
         app.post '/maintainer/profile/:username' do
           @maintainer = Maintainer.find_by_username(params[:username])
 
diff --git a/lib/views/head.erb b/lib/views/head.erb
index 003434c..5932a6a 100755
--- a/lib/views/head.erb
+++ b/lib/views/head.erb
@@ -14,7 +14,10 @@
         <a href="/login">Manage Releases</a>
       <% end %>
       <% if not Moka::Models::Maintainer.use_http_auth? and env['warden'].authenticated? %>
-        <a href="/maintainer/profile/<%= authentication_user.username %>">Profile</a>
+        <% if not (authentication_user.roles & ["admin"]).empty? %>
+          <a href="/maintainer">Maintainers</a>
+        <% end %>
+        <a href="/maintainer/profile/<%= authentication_user.username %>">My Profile</a>
         <a href="/logout">Logout</a>
       <% end %>
       <br />
diff --git a/lib/views/maintainer.erb b/lib/views/maintainer.erb
new file mode 100644
index 0000000..d7d4a5a
--- /dev/null
+++ b/lib/views/maintainer.erb
@@ -0,0 +1,26 @@
+<%= header :title => "Maintainers" %>
+<h2>Pending Accounts</h2>
+<p>Account added by the request account page</p> 
+
+<h2>Active Maintainers</h2>
+<table cellspacing="0" cellpadding="0">
+  <tr>
+    <th>Username</th>
+    <th>Real Name</th>
+    <th>Email</th>
+  </tr>
+  <% for maintainer in Maintainer.find_all.sort! { |a,b| a.username <=> b.username } %>
+    <tr>
+      <td>
+        <a href="/maintainer/profile/<%= maintainer.username %>"><%= maintainer.username %></a>
+      </td>
+      <td>
+        <%= maintainer.realname %>
+      </td>
+      <td>
+        <%= maintainer.email %>
+      </td>
+    </tr>
+  <% end %>
+</table>
+<%= footer %>
diff --git a/moka.gemspec b/moka.gemspec
index 783cb34..36525a7 100644
--- a/moka.gemspec
+++ b/moka.gemspec
@@ -44,6 +44,7 @@ Gem::Specification.new do |s|
     "lib/views/foot.erb",
     "lib/views/head.erb",
     "lib/views/index.erb",
+    "lib/views/maintainer.erb",
     "lib/views/maintainer_profile.erb",
     "lib/views/manage_releases.erb",
     "lib/views/permission_denied.erb",



More information about the Xfce4-commits mailing list