Big feactoring and bug fixing, Mailer, Tasks, GroupOrders
This commit is contained in:
parent
c936813967
commit
5fb0bc2444
43 changed files with 95 additions and 118 deletions
|
|
@ -1,3 +1,4 @@
|
|||
# encoding: utf-8
|
||||
class Finance::FinancialTransactionsController < ApplicationController
|
||||
before_filter :authenticate_finance
|
||||
before_filter :find_ordergroup, :except => [:new_collection, :create_collection]
|
||||
|
|
@ -38,8 +39,8 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
@financial_transaction.user = current_user
|
||||
@financial_transaction.add_transaction!
|
||||
redirect_to finance_ordergroup_transactions_url(@ordergroup), :notice => "Die Transaktion wurde gespeichert."
|
||||
rescue
|
||||
render :action => :new
|
||||
#rescue
|
||||
# render :action => :new
|
||||
end
|
||||
|
||||
def new_collection
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
# 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.
|
||||
class OrderingController < ApplicationController
|
||||
class GroupOrdersController < ApplicationController
|
||||
# Security
|
||||
before_filter :ensure_ordergroup_member
|
||||
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.
|
||||
def index
|
||||
|
|
@ -28,17 +29,14 @@ class OrderingController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@group_order = GroupOrder.find(params[:id])
|
||||
@order= @group_order.order
|
||||
end
|
||||
|
||||
def edit
|
||||
@group_order = GroupOrder.find(params[:id])
|
||||
@ordering_data = @group_order.load_data
|
||||
end
|
||||
|
||||
def update
|
||||
@group_order = GroupOrder.find(params[:id])
|
||||
@group_order.attributes = params[:group_order]
|
||||
begin
|
||||
@group_order.save_ordering!
|
||||
|
|
@ -84,4 +82,10 @@ class OrderingController < ApplicationController
|
|||
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
|
||||
|
|
@ -5,11 +5,12 @@ class LoginController < ApplicationController
|
|||
|
||||
# Display the form to enter an email address requesting a token to set a new password.
|
||||
def forgot_password
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
# Sends an email to a user with the token that allows setting a new password through action "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_expires = Time.now.advance(:days => 2)
|
||||
if user.save
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ class MessagesController < ApplicationController
|
|||
def create
|
||||
@message = @current_user.send_messages.new(params[:message])
|
||||
if @message.save
|
||||
#FIXME: Send Mails wit ID instead of using message.state ...
|
||||
#call_rake :send_emails
|
||||
@message.deliver
|
||||
@message.deliver #TODO: Put this into a background job
|
||||
redirect_to messages_url, :notice => "Nachricht ist gespeichert und wird versendet."
|
||||
else
|
||||
render :action => 'new'
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ class TasksController < ApplicationController
|
|||
@task.save
|
||||
flash[:notice] = "Aufgabe wurde aktualisiert"
|
||||
if @task.workgroup
|
||||
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||
redirect_to workgroup_tasks_url(workgroup_id: @task.workgroup_id)
|
||||
else
|
||||
redirect_to :action => "index"
|
||||
redirect_to tasks_url
|
||||
end
|
||||
else
|
||||
render :template => "tasks/edit"
|
||||
|
|
@ -84,20 +84,9 @@ class TasksController < ApplicationController
|
|||
|
||||
# shows workgroup (normal group) to edit weekly_tasks_template
|
||||
def workgroup
|
||||
@group = Group.find(params[:id])
|
||||
@group = Group.find(params[:workgroup_id])
|
||||
if @group.is_a? Ordergroup
|
||||
redirect_to tasks_url, :alert => "Keine Arbeitsgruppe gefunden"
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue