Moved users into new admin-namespace and made the controller restful. Also moved some logic from the controller into the user-model (dry it up..).

This commit is contained in:
Benjamin Meichsner 2009-01-12 18:26:09 +01:00
parent 47398c6a70
commit 461dfa8531
19 changed files with 242 additions and 94 deletions

View file

@ -0,0 +1,38 @@
%p
%table{:style => "width:100%"}
%tr
%td
= pagination_links_remote @users
%td{:style => "text-align:right"}
- if @total > 20
= items_per_page
%table.list
%thead
%tr
%th= _('Username')
%th= _('First name')
%th= _('Last name')
%th= _('Email')
%th= _('Roles')
%th= _('Last Login')
%th{:style => "width:3em"}
%tbody
- for user in @users
- roles = Array.new
- roles << 'Admin' if user.role_admin?
- roles << 'Finanzen' if user.role_finance?
- roles << 'Lieferanten' if user.role_suppliers?
- roles << 'Artikel' if user.role_article_meta?
- roles << 'Bestellung' if user.role_orders?
%tr{:class => cycle('even','odd', :name => 'users')}
%td= link_to user.nick, [:admin, user]
%td=h user.first_name
%td=h user.last_name
%td=h user.email
%td=h roles.join(', ')
%td=h format_time(user.last_login)
%td
= link_to(image_tag('b_edit.png', :size => "16x16", :border => "0", :alt => 'Benutzer_in bearbeiten', :title => 'Benutzer_in bearbeiten'), edit_admin_user_path(user))
= link_to(image_tag('b_drop.png', :size => "16x16", :border => "0", :alt => 'Benutzer_in löschen', :title => 'Benutzer_in löschen'), |
[:admin, user], |
:confirm => 'Willst du ' + user.first_name + ' wirklich löschen?', :method => :delete) |

View file

@ -0,0 +1,12 @@
<h1>Benutzerin bearbeiten</h1>
<div id="newUser" style="width:65em">
<div class="box_title"><h2>Benutzerin bearbeiten</h2></div>
<div class="column_content" id="userForm">
<% form_for([:admin, @user]) do |@form| %>
<%= render :partial => 'shared/user_form' %>
<br style="clear:both" />
<p>
<%= submit_tag 'Speichern' %> | <%= link_to 'Abbrechen', admin_users_path %></p>
<% end %>
</div>
</div>

View file

@ -0,0 +1,28 @@
%h1 Admin/Benutzerinnen
%p
%i
Hier kannst du Benutzer_innen
= link_to 'neu Anlegen', new_admin_user_path
, bearbeiten und natürlich auch löschen.
#newUser{:style => "display:none;"}
.box_title
%h2 Neue Benutzerinn
.column_content#userForm
.left_column{:style => "width:100%"}
.box_title
%h2 Benutzerinnenübersicht
.column_content
#user_filter
%form{:name=>"sform", :action=>"", :style=>"display:inline;"}
%label{:for => 'article_name'} Suche in Name :
= text_field_tag("query", params['query'], :size => 10 )
= observe_field 'query', :frequency => 2, |
:before => "Element.show('loader')", |
:success => "Element.hide('loader')", |
:url => admin_users_path, |
:with => 'query', |
:method => :get |
#table
= render :partial => "users"
%p= link_to 'Neue Benutzerin', new_admin_user_path

View file

@ -0,0 +1,13 @@
- title "Neue Benutzerin"
#newUser
.box_title
%h2 Neue Benutzerin
.column_content#userForm
- form_for([:admin, @user]) do |@form|
= render :partial => 'shared/user_form'
%p{:style => "clear:both" }
= submit_tag "Speichern"
|
= link_to('Abbrechen', admin_users_path )
%p= link_to 'Benutzerinnenübersicht', admin_users_path

View file

@ -0,0 +1,19 @@
<h1><%=h @user.nick %></h1>
<div class="left_column" style="width:100%">
<div class="box_title">
<h2>Übersicht</h2>
</div>
<div class="column_content">
<%= render :partial => 'users/show'%>
<p style="clear:both">
<%= link_to 'Bearbeiten', edit_admin_user_path(@user) %>
| <%= link_to 'Löschen', [:admin, @user], :confirm => "Willst du #{@user.first_name} wirklich rausschmeißen?", :method => :delete %>
| <%= link_to 'Nachricht senden', :controller => 'messages', :action => 'user', :id => @user %>
</p>
</div>
<div class="box_title"><h2>Gruppenabos</h2></div>
<div class="column_content">
<%= render :partial => 'users/memberships'%>
<p><%= link_to 'Gruppenübersicht', :action => 'listGroups' %></p>
</div>
</div>