Replaced IndexController by Home- and FoodcoopController. Some reorganizing in groups/memberships-logic (moved memberships out of admin-namespace).

This commit is contained in:
Benjamin Meichsner 2009-01-15 12:14:01 +01:00
parent fadc951208
commit 6ce6c2c75a
70 changed files with 553 additions and 934 deletions

View file

@ -0,0 +1,43 @@
%h2= _('Go to ...')
%ul
%li
= _('FoodCoop')
%ul
%li= link_to _("Member list"), :controller => "index", :action => "foodcoop_members"
%li= link_to _("My tasks"), :controller => "tasks", :action => "myTasks"
%li= link_to _("Write message"), :controller => "messages", :action => "new"
// Orders
- hasOrdergroup = !@current_user.find_ordergroup.nil?
- hasOrdersRole = @current_user.role_orders?
- if hasOrdergroup || hasOrdersRole
%li
= _("Orders")
%ul
- if hasOrdergroup
%li= link_to _('Order summary'), :controller => "ordering"
- if hasOrdersRole
%li= link_to _('Finish order'), :controller => 'orders'
// Articles
- if @current_user.role_article_meta? || @current_user.role_suppliers?
%li
= _("Artcle management")
%ul
%li= link_to _("Refresh articles"), :controller => "articles", :action => 'list'
%li= link_to _("Suppliers"), :controller => 'suppliers', :action => 'list'
// Finance
- if @current_user.role_finance?
%li
= _('Financial management')
%ul
%li= link_to _("Update account balances"), :controller => 'finance', :action => 'new_transactions'
%li= link_to _('Cancel orders'), :controller => 'finance'
// Administration
- if @current_user.role_admin?
%li
= _('Administration')
%ul
%li= link_to _("New ordergroup"), :controller => "admin", :action => "newOrdergroup"
%li= link_to _("New user"), :controller => "admin", :action => "newUser"

View file

@ -0,0 +1,68 @@
%h1 Startseite
#start_nav
= render :partial => 'start_nav'
.right_column{:style => "width:70%"}
- unless @unaccepted_tasks.empty? && @next_tasks.empty? && @unassigned_tasks_number == 0
.box_title
%h2=_ "Tasks"
.column_content
-unless @next_tasks.empty?
%div{:style => "float:left, margin-bottom:2em"}
%h3=_ "Your tasks for the upcoming week:"
%table{:style => "width:25em"}
-for task in @next_tasks
%tr
%td= format_date task.due_date
%td
%b= task.name
- unless @unaccepted_tasks.empty?
%h3=_ "Accept tasks"
= _("Your are responsible for a few tasks.")
= link_to _("Accept/Reject tasks"), :controller => "tasks", :action => "myTasks"
- unless @unassigned_tasks_number == 0
%h3=_ "Unassigned tasks"
= _("There are") + " #{@unassigned_tasks_number} " + link_to(_("unassigned task(s)"), :controller => "tasks")
%p{:style => "clear:both"}= link_to _("My tasks"), :controller => "tasks", :action => "myTasks"
- unless @messages.empty?
.box_title
%h2=_ "Unread messages"
.column_content
= render :partial => 'messages/unread'
%p= link_to _("All messages"), :controller => 'messages', :action => 'inbox'
- if @orderGroup
// Current orders
= render :partial => 'ordering/currentOrders'
// Ordergroup overview
.box_title
%h2=_ "My ordergroup"
.column_content
%p
%b= @orderGroup.name
|
=_ "Account balance:"
= number_to_currency(@orderGroup.account_balance)
%span{:style => "color:grey"}
(zuletzt aktualisiert vor
= distance_of_time_in_words(Time.now, @orderGroup.account_updated) + ")"
%h3=_ "Last transactions"
%table
%tr
%th=_ "When"
%th=_ "Who"
%th=_ "Note"
%th=_ "Amount"
- for ft in @financial_transactions
%tr{:class => cycle('even','odd')}
%td= format_time(ft.created_on)
%td= h(ft.user.nil? ? '?' : ft.user.nick)
%td= h(ft.note)
- color = ft.amount < 0 ? 'red' : 'black'
%td{:style => "color:#{color}; width:5em", :class => "currency"}= number_to_currency(ft.amount)
%br/
= link_to _("more ..."), :action => "myOrdergroup"

View file

@ -0,0 +1,43 @@
<h1>Meine Bestellgruppe</h1>
<div class="left_column">
<div class="box_title"><h2><%=h @ordergroup.name %></h2></div>
<div class="column_content">
<p><b>Beschreibung:</b> <%=h @ordergroup.description %>
<%= link_to '(ändern)', :controller => 'foodcoop', :action => 'edit_group', :id => @ordergroup %>
</p>
<p><b>Gruppengröße:</b> <%=h @ordergroup.actual_size %></p>
<p><b>Kontostand:</b> <%= number_to_currency(@ordergroup.account_balance) %></p>
<h2>Personen</h2>
<ul style="list-style-type:decimal;">
<% for membership in @ordergroup.memberships %>
<li>
<%= link_to membership.user.nick, :controller => 'index', :action => 'showUser', :id => membership.user %>
</li>
<% end %>
</ul>
<%= link_to('Hinzufügen/entfernen', :action => 'members', :id => @ordergroup) %> |
<%= link_to('Person einladen', :action => 'invite', :id => @ordergroup) %>
</div>
</div>
<div class="right_column">
<div class="box_title"><h2>Kontoauszug</h2></div>
<div class="column_content">
<p>
<form name="sform" action="" style="display:inline;">
<label for="financial_transaction_note">Filter für Notizen: </label>
<%= text_field_tag("query", params['query'], :size => 10 ) %>
</form>
</p>
<%= observe_field 'query', :frequency => 2,
:before => "Element.show('loader')",
:success => "Element.hide('loader')",
:url => {:action => 'ordergroup'},
:with => 'query',
:update => 'transactions' %>
<div id="transactions">
<%= render :partial => "/finance/transactions/list" %>
</div>
</div>
</div>

View file

@ -0,0 +1,38 @@
<% title "Mein Profil" -%>
<p>
Hier kannst Du deine Einstellungen ändern, z.b. Deine Telphonnummer oder Dein Passwort.
</p>
<div class="left_column" style="width: 60%;">
<div class="box_title">
<h2>
Nickname: <%= h @user.nick %>
<small>(Mitglied seit: <%= distance_of_time_in_words(Time.now, @user.created_on) -%>)</small>#
</h2>
</div>
<div class="column_content">
<% form_for(@user, :url => { :action => 'update_profile'}) do |@form| %>
<%= render :partial => 'shared/user_form' %>
<p style="clear:both">
<%= submit_tag 'Speichern' %> | <%= link_to 'Abbrechen', :action => 'profile' %></p>
<% end %>
</div>
</div>
<div class="right_column" style="width: 35%;">
<div class="box_title">
<h2>Du bist Mitglied in folgenden Gruppen</h2>
</div>
<div class="column_content">
<% for membership in Membership.find_all_by_user_id(@user.id) %>
<p>
<%= membership.group.name %>
<% if membership.group.type != 'Ordergroup' %>
(<%= link_to _("Cancel membership"), { :action => 'cancel_membership', :membership_id => membership },
:confirm => _("Are you sure to cancel this membership?"), :method => :post %>)
<% end %>
</p>
<% end %>
</div>
</div>