aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2013-01-11 02:25:48 +0100
committerHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2013-01-11 02:29:19 +0100
commit285eb3ce0c7ab487db6a7b6ee813576414fad465 (patch)
treed22a73735765b3e3e92efd0bf8319547048398fc /app
parentea8b774ac3dd37927f62fc2a378476533fc6b8b3 (diff)
downloadecs2-285eb3ce0c7ab487db6a7b6ee813576414fad465.tar.gz
ecs2-285eb3ce0c7ab487db6a7b6ee813576414fad465.zip
Group resources list by namespace.
Diffstat (limited to 'app')
-rw-r--r--app/views/admin/ressources/list.html.erb58
-rw-r--r--app/views/admin/ressources/list.html.haml51
2 files changed, 51 insertions, 58 deletions
diff --git a/app/views/admin/ressources/list.html.erb b/app/views/admin/ressources/list.html.erb
deleted file mode 100644
index 9522820..0000000
--- a/app/views/admin/ressources/list.html.erb
+++ /dev/null
@@ -1,58 +0,0 @@
-<!--
-Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
-
-This file is part of ECS.
-
-ECS is free software: you can redistribute it and/or modify it
-under the terms of the GNU Affero General Public License as
-published by the Free Software Foundation, either version 3 of
-the License, or (at your option) any later version.
-
-ECS is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public
-License along with ECS. If not, see <http://www.gnu.org/licenses/>.
--->
-
-
-<h1 class="box1">Listing Ressources (<%= @list_ressources_count.to_s %>)</h1>
-
-<%= link_to 'New ressource', new_admin_ressource_url %>&nbsp;&nbsp;
-
-<p>
-
-<table class="list">
-
- <tr class="table-resource-label">
- <TH class="box2">Id</TH>
- <TH class="box2">Namespace</TH>
- <TH class="box2">Name</TH>
- <TH class="box2">Postrouted</TH>
- <TH class="box2">Events</TH>
- <TH class="box2" align="center">Operations</TH>
- </tr>
- <tr></tr>
-
-<% for ressource in @ressources %>
-
- <tr class="<%= cycle('list-line-odd', 'list-line-even') %>">
- <TD> <%= ressource.id %></TD>
- <TD> <%= h ressource.namespace %></TD>
- <TD> <%= h ressource.ressource %></TD>
- <TD align="center"> <%= check_box_tag "ressource[postroute]",1,ressource.postroute, :disabled => true %> </TD>
- <TD align="center"> <%= check_box_tag "ressource[events]",1,ressource.events, :disabled => true %> </TD>
- <TD>
- <%= link_to 'Show', admin_ressource_url(:id => ressource) %>
- <%= link_to 'Edit', edit_admin_ressource_url(:id => ressource) %>
- <%= link_to 'Destroy', admin_ressource_url(:id => ressource), :confirm => 'Are you sure?', :method => :delete %><BR>
- </TD>
- </tr>
-
-<% end %>
-
-</table>
-
-</p>
diff --git a/app/views/admin/ressources/list.html.haml b/app/views/admin/ressources/list.html.haml
new file mode 100644
index 0000000..ca6889f
--- /dev/null
+++ b/app/views/admin/ressources/list.html.haml
@@ -0,0 +1,51 @@
+-#
+ Copyright (C) 2007, 2013 Heiko Bernloehr (FreeIT.de).
+
+ This file is part of ECS.
+
+ ECS is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as
+ published by the Free Software Foundation, either version 3 of
+ the License, or (at your option) any later version.
+
+ ECS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public
+ License along with ECS. If not, see <http://www.gnu.org/licenses/>.
+
+
+%h1.box1 Listing Ressources (#{@list_ressources_count.to_s})
+
+.text-link= link_to 'New resource', new_admin_ressource_url
+
+%p
+ %table.list
+ %tr.table-resource-label
+ %th.box2 Namespace
+ %th.box2 ID
+ %th.box2 Name
+ %th.box2 Postrouted
+ %th.box2 Events
+ %th.box2(align="center") Operations:
+ %tr
+
+ - @ressources.group_by(&:namespace).each do |ns, ressources|
+ - ns_printed= false
+ - ressources.each do |ressource|
+ %tr{:class => [cycle('list-line-odd', 'list-line-even')]}
+ -if ns_printed
+ %td.center "
+ - else
+ %td #{ns}
+ %td.center= ressource.id
+ %td= h ressource.ressource
+ %td.center= check_box_tag "ressource[postroute]",1,ressource.postroute, :disabled => true
+ %td.center= check_box_tag "ressource[events]",1,ressource.events, :disabled => true
+ %td
+ = link_to 'Show', admin_ressource_url(:id => ressource)
+ = link_to 'Edit', edit_admin_ressource_url(:id => ressource)
+ = link_to 'Destroy', admin_ressource_url(:id => ressource), :confirm => 'Are you sure?', :method => :delete
+ - ns_printed= true