Removed fancybox. Fixed profile, my ordergroup and tasks.

This commit is contained in:
benni 2012-11-12 09:03:23 +01:00
parent dce79802e0
commit 1d9815731c
37 changed files with 124 additions and 518 deletions

View file

@ -3,29 +3,22 @@ class HomeController < ApplicationController
def index
# unaccepted tasks
@unaccepted_tasks = @current_user.unaccepted_tasks
@unaccepted_tasks = Task.unaccepted_tasks_for(current_user)
# task in next week
@next_tasks = @current_user.next_tasks
@next_tasks = Task.next_assigned_tasks_for(current_user)
# count tasks with no responsible person
# tasks for groups the current user is not a member are ignored
tasks = Task.find(:all, :conditions => ["assigned = ? and done = ?", false, false])
@unassigned_tasks_number = 0
for task in tasks
(@unassigned_tasks_number += 1) unless task.workgroup && !current_user.member_of?(task.workgroup)
end
@unassigned_tasks = Task.unassigned_tasks_for(current_user)
end
def profile
@user = @current_user
end
def update_profile
@user = @current_user
if @user.update_attributes(params[:user])
flash[:notice] = 'Änderungen wurden gespeichert.'
redirect_to :action => 'profile'
if @current_user.update_attributes(params[:user])
redirect_to my_profile_url, notice: 'Änderungen wurden gespeichert.'
else
render :action => 'profile'
render :profile
end
end
@ -34,10 +27,6 @@ class HomeController < ApplicationController
@ordergroup = @user.ordergroup
unless @ordergroup.nil?
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
@ordergroup_columns = ["description", "account_balance", "account_updated"]
#listing the financial transactions with ajax...
if params['sort']
sort = case params['sort']
@ -52,18 +41,9 @@ class HomeController < ApplicationController
sort = "created_on DESC"
end
# or if somebody uses the search field:
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
@financial_transactions = @ordergroup.financial_transactions.page(params[:page]).per(@per_page).order(sort)
@financial_transactions = @financial_transactions.where("note LIKE ?", "%#{params[:query]}%") if params[:query].present?
@total = @ordergroup.financial_transactions.count(:conditions => conditions)
@financial_transactions = @ordergroup.financial_transactions.paginate(:page => params[:page],
:per_page => 10,
:conditions => conditions,
:order => sort)
respond_to do |format|
format.html # myOrdergroup.haml
format.js { render :layout => false }
end
else
redirect_to root_path, :alert => "Leider bist Du kein Mitglied einer Bestellgruppe"
end

View file

@ -8,12 +8,12 @@ class TasksController < ApplicationController
end
def user
@unaccepted_tasks = @current_user.unaccepted_tasks
@accepted_tasks = @current_user.accepted_tasks
@unaccepted_tasks = Task.unaccepted_tasks_for(current_user)
@accepted_tasks = Task.accepted_tasks_for(current_user)
end
def new
@task = Task.new
@task = Task.new(current_user_id: current_user.id)
end
def create
@ -31,6 +31,7 @@ class TasksController < ApplicationController
def edit
@task = Task.find(params[:id])
@task.current_user_id = current_user.id
end
def update