Fixed some wrong links in admin-startpage and bugs in ordergroup-model.

This commit is contained in:
Benjamin Meichsner 2009-02-01 21:53:08 +01:00
parent eedee9f070
commit 7f09bb55e4
5 changed files with 50 additions and 55 deletions

View file

@ -35,7 +35,7 @@ class Admin::OrdergroupsController < ApplicationController
end end
def create def create
@ordergroup = Ordergroup.new(params[:Ordergroup]) @ordergroup = Ordergroup.new(params[:ordergroup])
if @ordergroup.save if @ordergroup.save
flash[:notice] = 'Ordergroup was successfully created.' flash[:notice] = 'Ordergroup was successfully created.'
@ -48,7 +48,7 @@ class Admin::OrdergroupsController < ApplicationController
def update def update
@ordergroup = Ordergroup.find(params[:id]) @ordergroup = Ordergroup.find(params[:id])
if @ordergroup.update_attributes(params[:Ordergroup]) if @ordergroup.update_attributes(params[:ordergroup])
flash[:notice] = 'Ordergroup was successfully updated.' flash[:notice] = 'Ordergroup was successfully updated.'
redirect_to([:admin, @ordergroup]) redirect_to([:admin, @ordergroup])
else else

View file

@ -41,8 +41,6 @@ class Ordergroup < Group
validates_inclusion_of :actual_size, :in => 1..99 validates_inclusion_of :actual_size, :in => 1..99
validates_numericality_of :account_balance, :message => 'ist keine gültige Zahl' validates_numericality_of :account_balance, :message => 'ist keine gültige Zahl'
attr_accessible :actual_size, :account_updated
def non_members def non_members
User.all(:order => 'nick').reject { |u| (users.include?(u) || u.ordergroup) } User.all(:order => 'nick').reject { |u| (users.include?(u) || u.ordergroup) }
end end

View file

@ -0,0 +1,45 @@
- title "Administration"
%p
%i Hier kannst Du die Gruppen und Benutzer der Foodsoft verwalten.
.left_column{:style => "width:48%"}
.box_title
%h2 Neuste Benutzer
.column_content
%table
%tr
%th Nick
%th Name
%th Erstellt am
- for user in @users
%tr{:class => cycle('even','odd', :name => 'users')}
%td= link_to user.nick, [:admin, user]
%td= [user.first_name, user.last_name].join(", ")
%td= format_date(user.created_on)
%br/
= link_to 'Alle Benutzerinnen', admin_users_path
|
= link_to "Neue Benutzerin", new_admin_user_path
.right_column{:style => "width:48%"}
.box_title
%h2 Neuste Gruppen
.column_content
%table
%tr
%th Name
%th Typ
%th Mitglieder
- for group in @groups
%tr{:class => cycle('even','odd', :name => 'groups')}
%td= link_to group.name, [:admin, group]
%td= group.class.human_name
%td= group.users.size
%br/
= link_to 'Alle Bestellgruppen', admin_ordergroups_path
|
= link_to "Neue Bestellgruppe", new_admin_ordergroup_path
|
= link_to 'Alle Arbeitsgruppen', admin_workgroups_path
|
= link_to "Neue Arbeitsgruppe", new_admin_workgroup_path

View file

@ -1,51 +0,0 @@
<h1>Administration</h1>
<p><i>Hier kannst Du die Gruppen und Benutzer der Foodsoft verwalten.</i></p>
<div class="left_column" style="width:48%">
<div class="box_title"><h2>Neuste Benutzer</h2></div>
<div class="column_content">
<table>
<tr>
<th>Nick</th>
<th>Name</th>
<th>Erstellt am</th>
</tr>
<% for user in @users %>
<tr class="<%= cycle('even','odd', :name => 'users') %>">
<td><%= link_to user.nick, [:admin, user] %></td>
<td><%= user.first_name %> <%= user.last_name %></td>
<td><%= format_date(user.created_on) %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'Alle Benutzerinnen', :action => 'listUsers' %> |
<%= link_to "Neue Benutzerin", :action => "newUser" %>
</div>
</div>
<div class="right_column" style="width:48%">
<div class="box_title"><h2>Neuste Gruppen</h2></div>
<div class="column_content">
<table>
<tr>
<th>Name</th>
<th>Typ</th>
<th>Mitglieder</th>
</tr>
<% for group in @groups %>
<tr class="<%= cycle('even','odd', :name => 'groups') %>">
<td><%= link_to group.name, [:admin, group] %></td>
<td><%= group.class.human_name %></td>
<td><%= group.users.size %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'Alle Gruppen', :action => 'listGroups' %> |
<%= link_to "Neue Bestellgruppe", :action => "newOrdergroup" %> |
<%= link_to "Neue Gruppe", :action => "newGroup" %>
</div>
</div>

View file

@ -119,6 +119,9 @@ de:
even: "muss gerade sein" even: "muss gerade sein"
models: models:
article: Artikel article: Artikel
user: Benutzerinnen
workgroup: Arbeitsgruppe
ordergroup: Bestellgruppe
attributes: attributes:
article: article:
price: Nettopreis price: Nettopreis