Skip to content

Instantly share code, notes, and snippets.

@zigzag
Created December 17, 2009 09:03
Show Gist options
  • Save zigzag/258634 to your computer and use it in GitHub Desktop.
Save zigzag/258634 to your computer and use it in GitHub Desktop.
<table width="100%">
<tr>
<td valign="top">
<h1><%=t(:text_groups)%></h1>
<br/>
<table class="data" id="groups">
<thead>
<tr>
<th class="left"><%=t(:text_group_name)%></th>
<th class="left"><%=t(:text_description)%></th>
<th class="left"><%=t(:text_members)%></th>
<th class="left" nowrap><%=t(:text_operations)%></th>
</tr>
</thead>
<tbody >
<% @groups.each do |group|%>
<% clazz = cycle("even", "odd", :name => 'index_user') %>
<tr class="<%= clazz %>" id="group-<%= u group.name -%>">
<td class="left"><%= group.name %></td>
<td class="left" style="word-break:break-all"><%=group.description%></td>
<td class="left">
<span id="count-<%= u group.name -%>"><%= group.users.count %></span> (<%= link_to t(:label_select), { :action => 'select_user', :id => group.id}, :id => "select-#{u group.name}" %>)
</td>
<td class="left">
<%= link_to t(:label_edit), { :action => 'index', :id => group.id}, :class => 'action',
:method => :get, :id => "edit-#{u group.name}" %> |
<%= link_to t(:label_delete), { :action => 'destroy', :id => group.id}, {:confirm => "Are you sure to delete this group ? Members will not be deleted.", :class => 'action', :method => 'get', :id => "delete-#{u group.name}"} %>
</td>
</tr>
<% end %>
</tbody>
</table>
</td>
<td class="sep"> </td>
<td valign="top" align="right" width="210">
<%
action_name = 'create'
title="Add new group"
if @group.id
action_name = 'update'
title='Edit group'
end
%>
<table class="admintable" width="100%">
<% form_for :group, @group, :url => { :action => action_name, :id => @group.id} do |f| %>
<tbody>
<tr>
<td><h1><%= title %></h1></td>
</tr>
<tr>
<td class="left">
<%=t(:text_name)%><br/>
<%= f.text_field :name, :size => 25 %><br/>
<span class="desc"><%=t(:text_ex_my_group)%></span></td>
</tr>
<tr>
<td class="left" valign="top"><%=t(:text_description)%><br/><%= f.text_area :description, :rows => 3, :cols => 25 %></td>
</tr>
<tr>
<td class="left" nowrap="nowrap" valign="top" colspan="2">
<%= submit_tag @group.id.nil? ? 'Create':'Update' %>
<%= link_to t(:label_cancel), { :controller => 'groups', :action => 'index', :id => nil}, { :class => 'action' } %><br/>
</td>
</tr>
</tbody>
<% end %>
</table>
</td>
</tr>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment