Big feactoring and bug fixing, Mailer, Tasks, GroupOrders

This commit is contained in:
benni 2012-08-24 11:11:40 +02:00
parent c936813967
commit 5fb0bc2444
43 changed files with 95 additions and 118 deletions

View file

@ -1,3 +1,4 @@
# encoding: utf-8
class Finance::FinancialTransactionsController < ApplicationController class Finance::FinancialTransactionsController < ApplicationController
before_filter :authenticate_finance before_filter :authenticate_finance
before_filter :find_ordergroup, :except => [:new_collection, :create_collection] before_filter :find_ordergroup, :except => [:new_collection, :create_collection]
@ -38,8 +39,8 @@ class Finance::FinancialTransactionsController < ApplicationController
@financial_transaction.user = current_user @financial_transaction.user = current_user
@financial_transaction.add_transaction! @financial_transaction.add_transaction!
redirect_to finance_ordergroup_transactions_url(@ordergroup), :notice => "Die Transaktion wurde gespeichert." redirect_to finance_ordergroup_transactions_url(@ordergroup), :notice => "Die Transaktion wurde gespeichert."
rescue #rescue
render :action => :new # render :action => :new
end end
def new_collection def new_collection

View file

@ -1,9 +1,10 @@
# Controller for all ordering-actions that are performed by a user who is member of an Ordergroup. # Controller for all ordering-actions that are performed by a user who is member of an Ordergroup.
# Management actions that require the "orders" role are handled by the OrdersController. # Management actions that require the "orders" role are handled by the OrdersController.
class OrderingController < ApplicationController class GroupOrdersController < ApplicationController
# Security # Security
before_filter :ensure_ordergroup_member before_filter :ensure_ordergroup_member
before_filter :ensure_open_order, :only => [:new, :create, :edit, :update, :order, :stock_order, :saveOrder] before_filter :ensure_open_order, :only => [:new, :create, :edit, :update, :order, :stock_order, :saveOrder]
before_filter :ensure_my_group_order, only: [:show, :edit, :update]
# Index page. # Index page.
def index def index
@ -28,17 +29,14 @@ class OrderingController < ApplicationController
end end
def show def show
@group_order = GroupOrder.find(params[:id])
@order= @group_order.order @order= @group_order.order
end end
def edit def edit
@group_order = GroupOrder.find(params[:id])
@ordering_data = @group_order.load_data @ordering_data = @group_order.load_data
end end
def update def update
@group_order = GroupOrder.find(params[:id])
@group_order.attributes = params[:group_order] @group_order.attributes = params[:group_order]
begin begin
@group_order.save_ordering! @group_order.save_ordering!
@ -84,4 +82,10 @@ class OrderingController < ApplicationController
end end
end end
def ensure_my_group_order
@group_order = @ordergroup.group_orders.find(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_to group_orders_url, alert: 'Fehlerhafte URL, das ist nicht Deine Bestellung.'
end
end end

View file

@ -5,11 +5,12 @@ class LoginController < ApplicationController
# Display the form to enter an email address requesting a token to set a new password. # Display the form to enter an email address requesting a token to set a new password.
def forgot_password def forgot_password
@user = User.new
end end
# Sends an email to a user with the token that allows setting a new password through action "password". # Sends an email to a user with the token that allows setting a new password through action "password".
def reset_password def reset_password
if (user = User.find_by_email(params[:login][:email])) if (user = User.find_by_email(params[:user][:email]))
user.reset_password_token = user.new_random_password(16) user.reset_password_token = user.new_random_password(16)
user.reset_password_expires = Time.now.advance(:days => 2) user.reset_password_expires = Time.now.advance(:days => 2)
if user.save if user.save

View file

@ -14,9 +14,7 @@ class MessagesController < ApplicationController
def create def create
@message = @current_user.send_messages.new(params[:message]) @message = @current_user.send_messages.new(params[:message])
if @message.save if @message.save
#FIXME: Send Mails wit ID instead of using message.state ... @message.deliver #TODO: Put this into a background job
#call_rake :send_emails
@message.deliver
redirect_to messages_url, :notice => "Nachricht ist gespeichert und wird versendet." redirect_to messages_url, :notice => "Nachricht ist gespeichert und wird versendet."
else else
render :action => 'new' render :action => 'new'

View file

@ -40,9 +40,9 @@ class TasksController < ApplicationController
@task.save @task.save
flash[:notice] = "Aufgabe wurde aktualisiert" flash[:notice] = "Aufgabe wurde aktualisiert"
if @task.workgroup if @task.workgroup
redirect_to :action => "workgroup", :id => @task.workgroup redirect_to workgroup_tasks_url(workgroup_id: @task.workgroup_id)
else else
redirect_to :action => "index" redirect_to tasks_url
end end
else else
render :template => "tasks/edit" render :template => "tasks/edit"
@ -84,20 +84,9 @@ class TasksController < ApplicationController
# shows workgroup (normal group) to edit weekly_tasks_template # shows workgroup (normal group) to edit weekly_tasks_template
def workgroup def workgroup
@group = Group.find(params[:id]) @group = Group.find(params[:workgroup_id])
if @group.is_a? Ordergroup if @group.is_a? Ordergroup
redirect_to tasks_url, :alert => "Keine Arbeitsgruppe gefunden" redirect_to tasks_url, :alert => "Keine Arbeitsgruppe gefunden"
end end
end end
# this method is uses for the auto_complete-function from script.aculo.us
def auto_complete_for_task_user_list
@users = User.find(
:all,
:conditions => [ 'LOWER(nick) LIKE ?', '%' + params[:task][:user_list].downcase + '%' ],
:order => 'nick ASC',
:limit => 8
)
render :partial => '/shared/auto_complete_users'
end
end end

View file

@ -1,4 +1,4 @@
module OrderingHelper module GroupOrdersHelper
def data_to_js(ordering_data) def data_to_js(ordering_data)
ordering_data[:order_articles].map { |id, data| ordering_data[:order_articles].map { |id, data|
[id, data[:price], data[:unit], data[:total_price], data[:others_quantity], data[:others_tolerance], data[:used_quantity], data[:quantity_available]] [id, data[:price], data[:unit], data[:total_price], data[:others_quantity], data[:others_tolerance], data[:used_quantity], data[:quantity_available]]

View file

@ -4,15 +4,15 @@ class Mailer < ActionMailer::Base
layout 'email' # Use views/layouts/email.txt.erb layout 'email' # Use views/layouts/email.txt.erb
default from: "FoodSoft <#{Foodsoft.config[:email_sender]}>" default from: "FoodSoft <#{Foodsoft.config[:email_sender]}>",
sender: Foodsoft.config[:email_sender],
errors_to: Foodsoft.config[:email_sender]
# Sends an email copy of the given internal foodsoft message. # Sends an email copy of the given internal foodsoft message.
def foodsoft_message(message, recipient) def foodsoft_message(message, recipient)
@message = message @message = message
mail sender: Foodsoft.config[:email_sender], mail subject: "[#{Foodsoft.config[:name]}] " + message.subject,
errors_to: Foodsoft.config[:email_sender],
subject: "[#{Foodsoft.config[:name]}] " + message.subject,
to: recipient.email, to: recipient.email,
from: "#{message.sender.nick} <#{message.sender.email}>" from: "#{message.sender.nick} <#{message.sender.email}>"
end end
@ -77,10 +77,9 @@ class Mailer < ActionMailer::Base
def not_enough_users_assigned(task, user) def not_enough_users_assigned(task, user)
@task = task @task = task
@user = user @user = user
@task_url = url_for(:controller => "tasks", :action => "workgroup", :id => task.workgroup_id)
mail :to => user.email, mail :to => user.email,
:subject => "[#{Foodsoft.config[:name]}] #{task.name} braucht noch Leute!" :subject => "[#{Foodsoft.config[:name]}] \"#{task.name}\" braucht noch Leute!"
end end
end end

View file

@ -68,12 +68,12 @@ class Message < ActiveRecord::Base
end end
def deliver def deliver
for recipient in recipients for user in recipients
if recipient.settings['messages.sendAsEmail'] == "1" && !recipient.email.blank? if user.receive_email?
begin begin
Mailer.foodsoft_message(self, recipient).deliver Mailer.foodsoft_message(self, user).deliver
# rescue rescue
# logger.warn "Deliver failed for #{recipient.nick}: #{recipient.email}" logger.warn "Deliver failed for #{user.nick}: #{user.email}"
end end
end end
end end

View file

@ -13,6 +13,7 @@ class Task < ActiveRecord::Base
validates :name, :presence => true, :length => { :minimum => 3 } validates :name, :presence => true, :length => { :minimum => 3 }
validates :required_users, :presence => true validates :required_users, :presence => true
validates_numericality_of :duration, :required_users, :only_integer => true, :greater_than => 0 validates_numericality_of :duration, :required_users, :only_integer => true, :greater_than => 0
validates_length_of :description, maximum: 250
after_save :update_ordergroup_stats after_save :update_ordergroup_stats

View file

@ -72,6 +72,10 @@ class User < ActiveRecord::Base
[first_name, last_name].join(" ") [first_name, last_name].join(" ")
end end
def receive_email?
settings['messages.sendAsEmail'] == "1" && email.present?
end
def ordergroup_name def ordergroup_name
ordergroup.name if ordergroup ordergroup.name if ordergroup
end end

View file

@ -9,6 +9,7 @@ class Workgroup < Group
:if => :weekly_task :if => :weekly_task
validates_numericality_of :next_weekly_tasks_number, :greater_than => 0, :less_than => 21, :only_integer => true, validates_numericality_of :next_weekly_tasks_number, :greater_than => 0, :less_than => 21, :only_integer => true,
:if => :weekly_task :if => :weekly_task
validates_length_of :task_description, maximum: 250
validate :last_admin_on_earth, :on => :update validate :last_admin_on_earth, :on => :update
before_destroy :check_last_admin_group before_destroy :check_last_admin_group

View file

@ -1,8 +1,10 @@
- title "Neue Transaktion" - title "Neue Transaktion"
%p Hier kannst du der Bestellgruppe <b>#{@ordergroup.name}</b> Geld gutschreiben/abziehen.
= simple_form_for @financial_transaction, :url => finance_ordergroup_transactions_path(@ordergroup), = simple_form_for @financial_transaction, :url => finance_ordergroup_transactions_path(@ordergroup),
:validate => true do |f| :validate => true do |f|
= f.association :ordergroup = f.hidden_field :ordergroup_id
= f.input :amount = f.input :amount
= f.input :note, :as => :text = f.input :note, :as => :text
= f.submit = f.submit

View file

@ -4,7 +4,7 @@
.column_content .column_content
= render :partial => 'shared/group', :locals => { :group => workgroup } = render :partial => 'shared/group', :locals => { :group => workgroup }
%p %p
= link_to "Alle Aufgaben zeigen", :controller => "/tasks", :action => "workgroup", :id => workgroup = link_to "Alle Aufgaben zeigen", workgroup_tasks_path(workgroup_id: workgroup)
| |
= link_to "Mitgliedern eine Nachricht schicken", new_message_path(:message => {:group_id => workgroup.id}) = link_to "Mitgliedern eine Nachricht schicken", new_message_path(:message => {:group_id => workgroup.id})
- if workgroup.member?(@current_user) - if workgroup.member?(@current_user)

View file

@ -147,6 +147,6 @@
#order-button #order-button
= submit_tag( "Bestellung speichern", :id => 'submit_button' ) = submit_tag( "Bestellung speichern", :id => 'submit_button' )
oder #{link_to "abbrechen", :controller => 'ordering'} oder #{link_to "abbrechen", group_orders_path}
%input#total_balance{:name => "total_balance", :type => "hidden", :value => @ordergroup.account_balance - @group_order.price}/ %input#total_balance{:name => "total_balance", :type => "hidden", :value => @ordergroup.account_balance - @group_order.price}/
%input{:name => "version", :type => "hidden", :value => @version}/ %input{:name => "version", :type => "hidden", :value => @version}/

View file

@ -11,7 +11,7 @@
- group_order = order.group_order(@ordergroup) # Get GroupOrder if possible - group_order = order.group_order(@ordergroup) # Get GroupOrder if possible
- order_class = group_order ? "" : "color:grey" - order_class = group_order ? "" : "color:grey"
%tr{:class=> cycle('even', 'odd', :name => 'orders'), :style => order_class} %tr{:class=> cycle('even', 'odd', :name => 'orders'), :style => order_class}
%td= link_to order.name, :action => 'my_order_result', :id => order %td= group_order.present? ? link_to(order.name, group_order_path(group_order)) : order.name
%td= format_time(order.ends) %td= format_time(order.ends)
%td{:class => "currency"}= group_order ? number_to_currency(group_order.price) : "--" %td{:class => "currency"}= group_order ? number_to_currency(group_order.price) : "--"

View file

@ -1,7 +1,7 @@
- title "Bestellungen der #{@ordergroup.name}" - title "Bestellungen der #{@ordergroup.name}"
%p %p
Siehe hier alle Siehe hier alle
= link_to "laufenden Bestellungen.", ordering_path = link_to "laufenden Bestellungen.", group_orders_path
.single_column{:style => "width:50em"} .single_column{:style => "width:50em"}
.box_title .box_title

View file

@ -15,7 +15,7 @@
Bestellungen Bestellungen
%ul %ul
- if has_ordergroup - if has_ordergroup
%li= link_to "Bestellübersicht", :controller => "ordering" %li= link_to "Bestellübersicht", group_orders_path
- if has_orders_role - if has_orders_role
%li= link_to "Bestellungen beenden", :controller => 'orders' %li= link_to "Bestellungen beenden", :controller => 'orders'
// Articles // Articles

View file

@ -24,10 +24,10 @@
{ :name => "Alle Seiten", :url => all_pages_path } { :name => "Alle Seiten", :url => all_pages_path }
] ]
}, },
{ :name => "Bestellungen", :url => u.ordergroup ? ordering_path : orders_path, { :name => "Bestellungen", :url => u.ordergroup ? group_orders_path : orders_path,
:active => ["orders", "ordering"], :active => ["orders", "ordering"],
:subnav => [ :subnav => [
{ :name => "Bestellen!", :url => ordering_path }, { :name => "Bestellen!", :url => group_orders_path },
{ :name => "Meine Bestellungen", :url => archive_group_orders_path }, { :name => "Meine Bestellungen", :url => archive_group_orders_path },
{ :name => "Bestellverwaltung", :url => orders_path, :access_denied? => (!u.role_orders?) } { :name => "Bestellverwaltung", :url => orders_path, :access_denied? => (!u.role_orders?) }
] ]

View file

@ -5,12 +5,7 @@
Dazu musst hier die E-Mail-Adresse eingeben, mit der Du in der FoodSoft angemeldet bist. Dazu musst hier die E-Mail-Adresse eingeben, mit der Du in der FoodSoft angemeldet bist.
Du erhälst dann eine E-Mail mit weiteren Instruktionen. Du erhälst dann eine E-Mail mit weiteren Instruktionen.
.edit_form{:style => "width:25em"} = simple_form_for User.new, url: {action: 'reset_password'} do |form|
- form_tag(:action => 'reset_password') do = form.input :email
%p = form.submit "Neues Passwort anfordern"
E-Mail: = link_to "Abbrechen", :back
%br/
= text_field 'login', 'email'
= submit_tag 'Neues Passwort anfordern'
|
= link_to 'Abbrechen', login_path

View file

@ -1,16 +1,6 @@
- title "Neues Passwort" - title "Neues Passwort"
%p=h "Bitte neues Passwort für #{@user.nick} eingeben." %p=h "Bitte neues Passwort für #{@user.nick} eingeben."
.edit_form{:style => "width:25em"} = simple_form_for @user, :url => {:action => 'update_password', :id => @user.id, :token => @user.reset_password_token} do |form|
- form_for @user, :url => {:action => 'update_password', :id => @user.id, :token => @user.reset_password_token} do |form| = form.input :password
= form.error_messages :header_message => "" = form.input :password_confirmation
%p = form.submit
Neues Passwort
%br/
= form.password_field :password
%p
Passwort wiederholen
%br/
= form.password_field :password_confirmation
= form.submit 'Speichern'
|
= link_to 'Abbrechen', login_path

View file

@ -1,9 +1,3 @@
Foodsoft-Nachricht
Von: <%= @message.sender.nick %>
======================================================================
<%= @message.body %> <%= @message.body %>
====================================================================== ======================================================================

View file

@ -2,7 +2,7 @@ Hallo!
<%= @invite.user.first_name %> <%= @invite.user.last_name %> (<%= @invite.user.email %>) hat dich in die Gruppe "<%= @invite.group.name %>" eingeladen. <%= @invite.user.first_name %> <%= @invite.user.last_name %> (<%= @invite.user.email %>) hat dich in die Gruppe "<%= @invite.group.name %>" eingeladen.
Um die Einladung anzunehmen und der Foodcoop beizutreten, gehe zu: <%= @link %> Um die Einladung anzunehmen und der Foodcoop beizutreten, gehe zu: <%= @link %>
Dieser Link kann nur einmal aufgerufen werden und ist nur bis <%= @invite.expires_at.strftime('%A den %d.%m.%Y um %H:%M') %> gültig. Dieser Link kann nur einmal aufgerufen werden und ist nur bis <%= I18n.l @invite.expires_at %> gültig.
Grüße sendet die Foodsoft! Grüße sendet die Foodsoft!
@ -12,6 +12,6 @@ Hi!
<%= @invite.user.first_name %> <%= @invite.user.last_name %> (<%= @invite.user.email %>) has invited you to join the group "<%= @invite.group.name %>". <%= @invite.user.first_name %> <%= @invite.user.last_name %> (<%= @invite.user.email %>) has invited you to join the group "<%= @invite.group.name %>".
To accept the invitation and to join the foodcoop please follow this link: <%= @link %> To accept the invitation and to join the foodcoop please follow this link: <%= @link %>
This link works only once and expires on <%= @invite.expires_at.strftime('%A den %d.%m.%Y um %H:%M') %>. This link works only once and expires on <%= I18n.l @invite.expires_at, locale: :en %>.
Greetings, your FoodSoft Team! Greetings, your FoodSoft Team!

View file

@ -1,11 +0,0 @@
Liebe(r) <%= @user.first_name %>,
Der Job <%= @task.name -%> Deiner Arbeitsgruppe ist am <%= @task.due_date.strftime("%d. %b") -%> fällig
und es fehlen noch Mitstreiterinnen!
Sofern Du Dich noch nicht für diese Aufgabe eingetragen hast ist das jetzt die Chance:
<%= @task_url %>
--
Deine Aufgaben: <%= url_for(:controller => "home", :actions => "user") %>

View file

@ -0,0 +1,11 @@
Liebe(r) <%= @user.first_name %>,
Der Job '<%= @task.name -%>' Deiner Arbeitsgruppe ist am <%= I18n.l @task.due_date, format: "%d. %b" %> fällig
und es fehlen noch Mitstreiterinnen!
Sofern Du Dich noch nicht für diese Aufgabe eingetragen hast ist das jetzt die Chance:
<%= workgroup_tasks_url(workgroup_id: task.workgroup_id) %>
--
Deine Aufgaben: <%= user_tasks_url %>

View file

@ -1,6 +1,6 @@
Liebe <%= @group_order.ordergroup.name %>, Liebe <%= @group_order.ordergroup.name %>,
die Bestellung für "<%= @order.name %>" wurde am <%= @order.ends.strftime('%d.%m.%Y um %H:%M') %> von <%= @order.updated_by.nick %> beendet. die Bestellung für "<%= @order.name %>" wurde am <%= I18n.l @order.ends %> von <%= @order.updated_by.nick %> beendet.
Für Euch wurden die folgenden Artikel bestellt: Für Euch wurden die folgenden Artikel bestellt:
<% for group_order_article in @group_order.group_order_articles.ordered.all(:include => :order_article) <% for group_order_article in @group_order.group_order_articles.ordered.all(:include => :order_article)
@ -9,6 +9,6 @@ Für Euch wurden die folgenden Artikel bestellt:
<% end -%> <% end -%>
Gesamtpreis: <%= @group_order.price %> Gesamtpreis: <%= @group_order.price %>
Bestellung online einsehen: <%= url_for(:controller => "ordering", :action => "my_order_result", :id => @order.id) %> Bestellung online einsehen: <%= group_order_url(@group_order) %>
Viele Grüße von <%= Foodsoft.config[:name] %> Viele Grüße von <%= Foodsoft.config[:name] %>

View file

@ -2,7 +2,7 @@ Hallo <%= @user.nick %>,
du (oder jemand anderes) hat auf der FoodSoft-Website ein neues Passwort angefordert. du (oder jemand anderes) hat auf der FoodSoft-Website ein neues Passwort angefordert.
Um ein neues Passwort einzugeben, gehe zu: <%= @link %> Um ein neues Passwort einzugeben, gehe zu: <%= @link %>
Dieser Link kann nur einmal aufgerufen werden und läuft am <%= @user.reset_password_expires.strftime('%A (%d.%m.%Y %H:%M)') %> ab. Dieser Link kann nur einmal aufgerufen werden und läuft am <%= I18n.l @user.reset_password_expires %> ab.
Wenn du das Passwort nicht ändern möchtest oder diese Email nicht ausgelöst hast, brauchst du nichts zu tun. Dein bisheriges Passwort wurde nicht geändert. Wenn du das Passwort nicht ändern möchtest oder diese Email nicht ausgelöst hast, brauchst du nichts zu tun. Dein bisheriges Passwort wurde nicht geändert.
Grüße sendet die Foodsoft! :) Grüße sendet die Foodsoft! :)
@ -12,7 +12,7 @@ Grüße sendet die Foodsoft! :)
Hi <%= @user.nick %>, Hi <%= @user.nick %>,
you have (or someone else has) requested a new password. you have (or someone else has) requested a new password.
In order to choose a new password follow this link: <%= @link %> In order to choose a new password follow this link: <%= @link %>
This link works only once and expires on <%= @user.reset_password_expires.strftime('%A (%d.%m.%Y %H:%M)') %>. This link works only once and expires on <%= I18n.l @user.reset_password_expires, locale: :en %>.
If you don't want to change your password, just ignore this message. Your password hasn't been changed yet. If you don't want to change your password, just ignore this message. Your password hasn't been changed yet.
Greetings, your FoodSoft Team! Greetings, your FoodSoft Team!

View file

@ -1,16 +0,0 @@
Liebe(r) <%= @user.name %>,
Du bist für "<%= @task.name -%>" eingetragen. Die Aufgabe ist morgen (<%= @task.due_date.strftime("%d. %b") -%>) fällig!
<% if @user.next_tasks.size > 1 -%>
Aufgaben für die nächste Woche:
<% for next_task in @user.next_tasks -%>
<% unless next_task == @task -%>
* <%= next_task.due_date.strftime("%d.%m.") -%> <%= next_task.name %>
<% end -%>
<% end -%>
<% end -%>
Meine Aufgaben: <%= url_for(:controller => "home", :actions => "user") %>
Viele Grüße von <%= Foodsoft.config[:name] %>

View file

@ -0,0 +1,15 @@
Liebe(r) <%= @user.name %>,
Du bist für "<%= @task.name -%>" eingetragen. Die Aufgabe ist morgen (<%= I18n.l @task.due_date, format: "%d. %b" %>) fällig!
<% if @user.next_tasks.size > 0 %>
Aufgaben für die nächste Woche:
<% for next_task in @user.next_tasks -%>
<% next if next_task == @task -%>
* <%= I18n.l next_task.due_date, format: "%d. %b" -%> <%= next_task.name %>
<% end -%>
<% end -%>
Meine Aufgaben: <%= user_tasks_url %>
Viele Grüße von <%= Foodsoft.config[:name] %>

View file

@ -11,7 +11,7 @@
= f.input :task_name = f.input :task_name
= f.input :task_required_users = f.input :task_required_users
= f.input :task_duration, :as => :select, :collection => (1..3) = f.input :task_duration, :as => :select, :collection => (1..3)
= f.input :task_description = f.input :task_description, as: :text, input_html: {rows: 10}
= f.input :next_weekly_tasks_number = f.input :next_weekly_tasks_number
= f.input :user_tokens, :as => :string, :input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json } = f.input :user_tokens, :as => :string, :input_html => { 'data-pre' => f.object.users.map { |u| u.token_attributes }.to_json }

View file

@ -12,7 +12,7 @@
= simple_form_for @task do |f| = simple_form_for @task do |f|
= f.input :name = f.input :name
= f.input :description = f.input :description, as: :text, input_html: {rows: 10}
= f.input :duration, :as => :select, :collection => 1..3 = f.input :duration, :as => :select, :collection => 1..3
= f.input :user_list, :as => :string, :input_html => { 'data-pre' => @task.users.map { |u| u.token_attributes }.to_json } = f.input :user_list, :as => :string, :input_html => { 'data-pre' => @task.users.map { |u| u.token_attributes }.to_json }
= f.input :required_users = f.input :required_users

View file

@ -16,4 +16,4 @@
Gruppenaufgaben Gruppenaufgaben
%ul %ul
- for group in Workgroup.all - for group in Workgroup.all
%li= link_to group.name, :controller => 'tasks', :action => "workgroup", :id => group %li= link_to group.name, workgroup_tasks_path(workgroup_id: group.id)

View file

@ -23,7 +23,7 @@
%td Arbeitsgruppe %td Arbeitsgruppe
%td %td
- if @task.workgroup - if @task.workgroup
= link_to @task.workgroup.name, :action => "workgroup", :id => @task.workgroup = link_to @task.workgroup.name, workgroup_tasks_path(workgroup_id: @task.workgroup_id)
%tr %tr
%td{:colspan => "2"} %td{:colspan => "2"}

View file

@ -8,7 +8,7 @@
%h2 Wöchentliche Aufgaben verwalten %h2 Wöchentliche Aufgaben verwalten
.column_content .column_content
- if @group.weekly_task - if @group.weekly_task
%p= "Jeden <b>#{weekday(@group.weekday)}</b> hat diese Arbeitsgruppe folgenden Job: <b>#{@group.task_name}</b>" %p Jeden <b>#{weekday(@group.weekday)}</b> hat diese Arbeitsgruppe folgenden Job: <b>#{@group.task_name}</b>
%p Die Wochenaufgaben werden von der Foodsoft automatisch erstellt. Eintragen müsst Ihr Euch aber selber. %p Die Wochenaufgaben werden von der Foodsoft automatisch erstellt. Eintragen müsst Ihr Euch aber selber.
- else - else
Noch keine Wochenaufgaben angelegt. Noch keine Wochenaufgaben angelegt.

View file

@ -44,10 +44,9 @@ Foodsoft::Application.routes.draw do
end end
end end
resources :group_orders, :controller => 'ordering', :path => 'ordering' do resources :group_orders do
get :archive, :on => :collection get :archive, :on => :collection
end end
match '/ordering' => 'ordering#index', :as => 'ordering'
resources :order_comments, :only => [:new, :create] resources :order_comments, :only => [:new, :create]