Replaced IndexController by Home- and FoodcoopController. Some reorganizing in groups/memberships-logic (moved memberships out of admin-namespace).
This commit is contained in:
parent
fadc951208
commit
6ce6c2c75a
70 changed files with 553 additions and 934 deletions
|
@ -113,6 +113,20 @@ class ApplicationController < ActionController::Base
|
||||||
authenticate('orders')
|
authenticate('orders')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# checks if the current_user is member of given group.
|
||||||
|
# if fails the user will redirected to startpage
|
||||||
|
def authenticate_membership_or_admin
|
||||||
|
@group = Group.find(params[:id])
|
||||||
|
unless @group.member?(@current_user) or @current_user.role_admin?
|
||||||
|
flash[:error] = ERROR_NO_GROUP_MEMBER
|
||||||
|
if request.xml_http_request?
|
||||||
|
render(:update) {|page| page.redirect_to root_path }
|
||||||
|
else
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Stores this controller instance as a thread local varibale to be accessible from outside ActionController/ActionView.
|
# Stores this controller instance as a thread local varibale to be accessible from outside ActionController/ActionView.
|
||||||
def store_controller
|
def store_controller
|
||||||
Thread.current[:application_controller] = self
|
Thread.current[:application_controller] = self
|
||||||
|
|
|
@ -23,15 +23,12 @@ class Finance::TransactionsController < ApplicationController
|
||||||
conditions = "name LIKE '%#{params[:query]}%'" unless params[:query].nil?
|
conditions = "name LIKE '%#{params[:query]}%'" unless params[:query].nil?
|
||||||
|
|
||||||
@total = Ordergroup.count(:conditions => conditions)
|
@total = Ordergroup.count(:conditions => conditions)
|
||||||
@groups = Ordergroup.paginate :conditions => conditions, :page => params[:page], :per_page => @per_page, :order => sort
|
@groups = Ordergroup.paginate :conditions => conditions, :page => params[:page],
|
||||||
|
:per_page => @per_page, :order => sort
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.js do
|
format.js { render :partial => "ordergroups" }
|
||||||
render :update do |page|
|
|
||||||
page.replace_html 'table', :partial => "ordergroups"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,17 +51,15 @@ class Finance::TransactionsController < ApplicationController
|
||||||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||||
|
|
||||||
@total = @group.financial_transactions.count(:conditions => conditions)
|
@total = @group.financial_transactions.count(:conditions => conditions)
|
||||||
@financial_transactions = @group.financial_transactions.paginate(:page => params[:page],
|
@financial_transactions = @group.financial_transactions.paginate(
|
||||||
|
:page => params[:page],
|
||||||
:per_page => 10,
|
:per_page => 10,
|
||||||
:conditions => conditions,
|
:conditions => conditions,
|
||||||
:order => sort)
|
:order => sort)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.js do
|
format.js { render :partial => "list" }
|
||||||
render :update do |page|
|
|
||||||
page.replace_html 'table', :partial => "list"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
67
app/controllers/foodcoop_controller.rb
Normal file
67
app/controllers/foodcoop_controller.rb
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
class FoodcoopController < ApplicationController
|
||||||
|
|
||||||
|
before_filter :authenticate_membership_or_admin,
|
||||||
|
:only => [:edit_group, :update_group, :memberships, :invite, :send_invitation]
|
||||||
|
|
||||||
|
# gives a view to list all members of the foodcoop
|
||||||
|
def members
|
||||||
|
|
||||||
|
# sort by ordergroups
|
||||||
|
if params[:sort_by_ordergroups]
|
||||||
|
@users = []
|
||||||
|
Ordergroup.find(:all, :order => "name").each do |group|
|
||||||
|
group.users.each do |user|
|
||||||
|
@users << user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@total = @users.size
|
||||||
|
else
|
||||||
|
# sort by nick, thats default
|
||||||
|
if (params[:per_page] && params[:per_page].to_i > 0 && params[:per_page].to_i <= 100)
|
||||||
|
@per_page = params[:per_page].to_i
|
||||||
|
else
|
||||||
|
@per_page = 20
|
||||||
|
end
|
||||||
|
|
||||||
|
# if somebody uses the search field:
|
||||||
|
conditions = "first_name LIKE '%#{params[:query]}%' OR last_name LIKE '%#{params[:query]}%'" unless params[:query].blank?
|
||||||
|
|
||||||
|
@total = User.count(:conditions => conditions)
|
||||||
|
@users = User.paginate(:page => params[:page], :per_page => @per_page, :conditions => conditions, :order => "nick", :include => "groups")
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.js { render :partial => "users" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# gives an overview for the workgroups and its members
|
||||||
|
def workgroups
|
||||||
|
@groups = Workgroup.find :all, :order => "name"
|
||||||
|
end
|
||||||
|
|
||||||
|
def group
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit_group
|
||||||
|
end
|
||||||
|
|
||||||
|
def memberships
|
||||||
|
end
|
||||||
|
|
||||||
|
# Invites a new user to join foodsoft in this group.
|
||||||
|
def invite
|
||||||
|
@invite = Invite.new
|
||||||
|
end
|
||||||
|
# Sends an email
|
||||||
|
def send_invitation
|
||||||
|
@invite = Invite.new(:user => @current_user, :group => @group, :email => params[:invite][:email])
|
||||||
|
if @invite.save
|
||||||
|
flash[:notice] = format('Es wurde eine Einladung an %s geschickt.', @invite.email)
|
||||||
|
redirect_to(:action => 'index')
|
||||||
|
else
|
||||||
|
render :action => 'invite'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
86
app/controllers/home_controller.rb
Normal file
86
app/controllers/home_controller.rb
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
class HomeController < ApplicationController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@currentOrders = Order.find_current
|
||||||
|
@orderGroup = @current_user.find_ordergroup
|
||||||
|
if @orderGroup
|
||||||
|
@financial_transactions = @orderGroup.financial_transactions.find(:all, :order => 'created_on desc', :limit => 3)
|
||||||
|
end
|
||||||
|
# unread messages
|
||||||
|
@messages = Message.find_all_by_recipient_id_and_read(@current_user.id, false, :order => 'messages.created_on desc', :include => :sender)
|
||||||
|
# unaccepted tasks
|
||||||
|
@unaccepted_tasks = @current_user.unaccepted_tasks
|
||||||
|
# task in next week
|
||||||
|
@next_tasks = @current_user.next_tasks
|
||||||
|
|
||||||
|
# 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.is_member_of(task.workgroup)
|
||||||
|
end
|
||||||
|
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'
|
||||||
|
else
|
||||||
|
render :action => 'profile'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def ordergroup
|
||||||
|
@user = @current_user
|
||||||
|
@ordergroup = @user.find_ordergroup
|
||||||
|
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
||||||
|
@ordergroup_columns = ["description", "actual_size", "account_balance", "account_updated"]
|
||||||
|
|
||||||
|
#listing the financial transactions with ajax...
|
||||||
|
|
||||||
|
if params['sort']
|
||||||
|
sort = case params['sort']
|
||||||
|
when "date" then "created_on"
|
||||||
|
when "note" then "note"
|
||||||
|
when "amount" then "amount"
|
||||||
|
when "date_reverse" then "created_on DESC"
|
||||||
|
when "note_reverse" then "note DESC"
|
||||||
|
when "amount_reverse" then "amount DESC"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sort = "created_on DESC"
|
||||||
|
end
|
||||||
|
|
||||||
|
# or if somebody uses the search field:
|
||||||
|
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
||||||
|
|
||||||
|
@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 :partial => "finance/transactions/list" }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# cancel personal memberships direct from the myProfile-page
|
||||||
|
def cancel_membership
|
||||||
|
membership = Membership.find(params[:membership_id])
|
||||||
|
if membership.user == current_user
|
||||||
|
membership.destroy
|
||||||
|
flash[:notice] = "Du bist jetzt kein Mitglied der Gruppe #{@group.name} mehr."
|
||||||
|
else
|
||||||
|
flash[:error] = "Ein Problem ist aufgetreten."
|
||||||
|
end
|
||||||
|
redirect_to my_profile_path
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -1,261 +0,0 @@
|
||||||
class IndexController < ApplicationController
|
|
||||||
# Messages
|
|
||||||
MSG_USER_UPDATED = 'Benutzeränderungen wurden gespeichert'
|
|
||||||
ERROR_NO_GROUP_MEMBER = 'Du bist kein Gruppenmitglied.'
|
|
||||||
MSG_GROUP_UPDATED = 'Gruppe wurde erfolgreich bearbeitet'
|
|
||||||
ERR_LAST_MEMBER = "Eine Benutzerin muss der Bestellgruppe erhalten bleiben"
|
|
||||||
MSG_MEMBERSHIP_ENDS = 'Du bist nun nicht mehr Mitglied der Gruppe '
|
|
||||||
ERR_CANNOT_INVITE = 'Du kannst niemanden in diese Gruppe einladen.'
|
|
||||||
MSG_INVITE_SUCCESS = 'Es wurde eine Einladung an %s geschickt.'
|
|
||||||
|
|
||||||
def index
|
|
||||||
@currentOrders = Order.find_current
|
|
||||||
@orderGroup = @current_user.find_ordergroup
|
|
||||||
if @orderGroup
|
|
||||||
@financial_transactions = @orderGroup.financial_transactions.find(:all, :order => 'created_on desc', :limit => 3)
|
|
||||||
end
|
|
||||||
# unread messages
|
|
||||||
@messages = Message.find_all_by_recipient_id_and_read(@current_user.id, false, :order => 'messages.created_on desc', :include => :sender)
|
|
||||||
# unaccepted tasks
|
|
||||||
@unaccepted_tasks = @current_user.unaccepted_tasks
|
|
||||||
# task in next week
|
|
||||||
@next_tasks = @current_user.next_tasks
|
|
||||||
|
|
||||||
# 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.group && !current_user.is_member_of(task.group)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def myProfile
|
|
||||||
@user = @current_user
|
|
||||||
@user_columns = ["first_name", "last_name", "email", "phone", "address"]
|
|
||||||
end
|
|
||||||
|
|
||||||
def editProfile
|
|
||||||
@user = @current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
def updateProfile
|
|
||||||
@user = @current_user
|
|
||||||
@user.set_password({:required => false}, params[:user][:password], params[:user][:password_confirmation])
|
|
||||||
@user.attributes = params[:user]
|
|
||||||
for setting in User::setting_keys.keys
|
|
||||||
@user.settings[setting] = (params[:user][:settings] && params[:user][:settings][setting] == '1' ? '1' : nil)
|
|
||||||
end
|
|
||||||
if @user.errors.empty? && @user.save
|
|
||||||
flash[:notice] = MSG_USER_UPDATED
|
|
||||||
redirect_to :action => 'myProfile'
|
|
||||||
else
|
|
||||||
render :action => 'editProfile'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def myOrdergroup
|
|
||||||
@user = @current_user
|
|
||||||
@ordergroup = @user.find_ordergroup
|
|
||||||
@ordergroup_column_names = ["Description", "Actual Size", "Balance", "Updated"]
|
|
||||||
@ordergroup_columns = ["description", "actual_size", "account_balance", "account_updated"]
|
|
||||||
|
|
||||||
#listing the financial transactions with ajax...
|
|
||||||
|
|
||||||
if params['sort']
|
|
||||||
sort = case params['sort']
|
|
||||||
when "date" then "created_on"
|
|
||||||
when "note" then "note"
|
|
||||||
when "amount" then "amount"
|
|
||||||
when "date_reverse" then "created_on DESC"
|
|
||||||
when "note_reverse" then "note DESC"
|
|
||||||
when "amount_reverse" then "amount DESC"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
sort = "created_on DESC"
|
|
||||||
end
|
|
||||||
|
|
||||||
# or if somebody uses the search field:
|
|
||||||
conditions = ["note LIKE ?", "%#{params[:query]}%"] unless params[:query].nil?
|
|
||||||
|
|
||||||
@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 do
|
|
||||||
render :update do |page|
|
|
||||||
page.replace_html 'table', :partial => "financial_transactions/list"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def showGroup
|
|
||||||
@user = @current_user
|
|
||||||
@group = Group.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def showUser
|
|
||||||
@user = User.find(params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
def editGroup
|
|
||||||
@group = Group.find(params[:id])
|
|
||||||
authenticate_membership(@group)
|
|
||||||
# unless @group.member?(@current_user)
|
|
||||||
# flash[:error] = ERROR_NO_GROUP_MEMBER
|
|
||||||
# redirect_to :action => 'index'
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
|
|
||||||
# update the Group
|
|
||||||
# only access to description for Ordergroups
|
|
||||||
def updateGroup
|
|
||||||
@group = Group.find(params[:id])
|
|
||||||
authenticate_membership(@group)
|
|
||||||
if @group.is_a?(Ordergroup)
|
|
||||||
@group.update_attribute(:description, params[:group][:description])
|
|
||||||
else
|
|
||||||
@group.update_attributes(params[:group])
|
|
||||||
end
|
|
||||||
if @group.errors.empty?
|
|
||||||
flash[:notice] = MSG_GROUP_UPDATED
|
|
||||||
redirect_to :action => 'showGroup', :id => @group
|
|
||||||
else
|
|
||||||
render :action => 'editGroup'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def members
|
|
||||||
@group = Group.find(params[:id])
|
|
||||||
authenticate_membership(@group)
|
|
||||||
end
|
|
||||||
|
|
||||||
# adds a new member to the group
|
|
||||||
def addMember
|
|
||||||
@group = Group.find(params[:id])
|
|
||||||
authenticate_membership(@group)
|
|
||||||
user = User.find(params[:user])
|
|
||||||
Membership.create(:group => @group, :user => user)
|
|
||||||
redirect_to :action => 'memberships_reload', :id => @group
|
|
||||||
end
|
|
||||||
|
|
||||||
# the membership will find an end....
|
|
||||||
def dropMember
|
|
||||||
begin
|
|
||||||
group = Group.find(params[:group])
|
|
||||||
authenticate_membership(group)
|
|
||||||
membership = Membership.find(params[:membership])
|
|
||||||
if group.is_a?(Ordergroup) && group.memberships.size == 1
|
|
||||||
# Deny dropping member if the group is an Ordergroup and there is only one member left.
|
|
||||||
flash[:error] = ERR_LAST_MEMBER
|
|
||||||
else
|
|
||||||
membership.destroy
|
|
||||||
end
|
|
||||||
redirect_to :action => 'memberships_reload', :id => group
|
|
||||||
rescue => error
|
|
||||||
flash[:error] = error.to_s
|
|
||||||
redirect_to :action => 'memberships_reload', :id => group
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# the two boxes 'members' and 'non members' will be reload through ajax
|
|
||||||
def memberships_reload
|
|
||||||
@group = Group.find(params[:id])
|
|
||||||
unless @group.member?(@current_user)
|
|
||||||
flash[:error] = ERROR_NO_GROUP_MEMBER
|
|
||||||
render(:update) {|page| page.redirect_to :action => "myProfile"}
|
|
||||||
else
|
|
||||||
render :update do |page|
|
|
||||||
page.replace_html 'members', :partial => 'groups/members', :object => @group
|
|
||||||
page.replace_html 'non_members', :partial => 'groups/non_members', :object => @group
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# checks if the current_user is member of given group.
|
|
||||||
# if fails the user will redirected to startpage
|
|
||||||
# method used while group/memberships beeing edit
|
|
||||||
def authenticate_membership(group)
|
|
||||||
unless group.member?(@current_user)
|
|
||||||
flash[:error] = ERROR_NO_GROUP_MEMBER
|
|
||||||
if request.xml_http_request?
|
|
||||||
render(:update) {|page| page.redirect_to :action => "index"}
|
|
||||||
else
|
|
||||||
redirect_to :action => 'index'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# gives a view to list all members of the foodcoop
|
|
||||||
def foodcoop_members
|
|
||||||
|
|
||||||
# sort by ordergroups
|
|
||||||
if params[:sort_by_ordergroups]
|
|
||||||
@users = []
|
|
||||||
Ordergroup.find(:all, :order => "name").each do |group|
|
|
||||||
group.users.each do |user|
|
|
||||||
@users << user
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@total = @users.size
|
|
||||||
else
|
|
||||||
# sort by nick, thats default
|
|
||||||
if (params[:per_page] && params[:per_page].to_i > 0 && params[:per_page].to_i <= 100)
|
|
||||||
@per_page = params[:per_page].to_i
|
|
||||||
else
|
|
||||||
@per_page = 20
|
|
||||||
end
|
|
||||||
|
|
||||||
# if somebody uses the search field:
|
|
||||||
conditions = "first_name LIKE '%#{params[:query]}%' OR last_name LIKE '%#{params[:query]}%'" unless params[:query].blank?
|
|
||||||
|
|
||||||
@total = User.count(:conditions => conditions)
|
|
||||||
@users = User.paginate(:page => params[:page], :per_page => @per_page, :conditions => conditions, :order => "nick", :include => "groups")
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.js do
|
|
||||||
render :update do |page|
|
|
||||||
page.replace_html 'user_table', :partial => "list_members"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# gives an overview for the workgroups and its members
|
|
||||||
def workgroups
|
|
||||||
@groups = Group.find :all, :conditions => "type != 'Ordergroup'", :order => "name"
|
|
||||||
end
|
|
||||||
|
|
||||||
# Invites a new user to join foodsoft in this group.
|
|
||||||
def invite
|
|
||||||
@group = Group.find(params[:id])
|
|
||||||
if (!@group || (!@current_user.is_member_of(@group) && !@current_user.role_admin?))
|
|
||||||
flash[:error] = ERR_CANNOT_INVITE
|
|
||||||
redirect_to(:action => "index")
|
|
||||||
elsif (request.post?)
|
|
||||||
@invite = Invite.new(:user => @current_user, :group => @group, :email => params[:invite][:email])
|
|
||||||
if @invite.save
|
|
||||||
flash[:notice] = format(MSG_INVITE_SUCCESS, @invite.email)
|
|
||||||
redirect_to(:action => 'index')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# cancel personal memberships direct from the myProfile-page
|
|
||||||
def cancel_membership
|
|
||||||
membership = Membership.find(params[:id])
|
|
||||||
if membership.user == current_user
|
|
||||||
membership.destroy
|
|
||||||
flash[:notice] = _("The membership was cancelled.")
|
|
||||||
else
|
|
||||||
flash[:error] = _("You are not allowed to cancel this membership")
|
|
||||||
end
|
|
||||||
redirect_to my_profile_path
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,4 +1,5 @@
|
||||||
class Admin::MembershipsController < ApplicationController
|
class MembershipsController < ApplicationController
|
||||||
|
before_filter :authenticate_membership_or_admin
|
||||||
|
|
||||||
def add_member
|
def add_member
|
||||||
@group = Group.find(params[:group_id])
|
@group = Group.find(params[:group_id])
|
||||||
|
@ -27,8 +28,8 @@ class Admin::MembershipsController < ApplicationController
|
||||||
def reload
|
def reload
|
||||||
@group = Group.find(params[:group_id])
|
@group = Group.find(params[:group_id])
|
||||||
render :update do |page|
|
render :update do |page|
|
||||||
page.replace_html 'members', :partial => 'members', :object => @group
|
page.replace_html 'members', :partial => 'shared/memberships/current_members', :object => @group
|
||||||
page.replace_html 'non_members', :partial => 'non_members', :object => @group
|
page.replace_html 'non_members', :partial => 'shared/memberships/non_members', :object => @group
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ class TasksController < ApplicationController
|
||||||
#auto_complete_for :user, :nick
|
#auto_complete_for :user, :nick
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@non_group_tasks = Task.find :all, :conditions => "group_id IS NULL AND done = 0", :order => "due_date ASC"
|
@non_group_tasks = Task.non_group
|
||||||
@groups = Group.find :all, :conditions => "type != 'Ordergroup'"
|
@groups = Group.find :all, :conditions => "type != 'Ordergroup'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ class TasksController < ApplicationController
|
||||||
if @task.errors.empty?
|
if @task.errors.empty?
|
||||||
@task.save
|
@task.save
|
||||||
flash[:notice] = "Aufgabe wurde erstellt"
|
flash[:notice] = "Aufgabe wurde erstellt"
|
||||||
if @task.group
|
if @task.workgroup
|
||||||
redirect_to :action => "workgroup", :id => @task.group
|
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||||
else
|
else
|
||||||
redirect_to :action => "index"
|
redirect_to :action => "index"
|
||||||
end
|
end
|
||||||
|
@ -52,8 +52,8 @@ class TasksController < ApplicationController
|
||||||
if @task.errors.empty?
|
if @task.errors.empty?
|
||||||
@task.save
|
@task.save
|
||||||
flash[:notice] = "Aufgabe wurde aktualisiert"
|
flash[:notice] = "Aufgabe wurde aktualisiert"
|
||||||
if @task.group
|
if @task.workgroup
|
||||||
redirect_to :action => "workgroup", :id => @task.group
|
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||||
else
|
else
|
||||||
redirect_to :action => "index"
|
redirect_to :action => "index"
|
||||||
end
|
end
|
||||||
|
|
2
app/helpers/foodcoop_helper.rb
Normal file
2
app/helpers/foodcoop_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module FoodcoopHelper
|
||||||
|
end
|
2
app/helpers/home_helper.rb
Normal file
2
app/helpers/home_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module HomeHelper
|
||||||
|
end
|
|
@ -18,7 +18,7 @@ class Invite < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
|
||||||
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => 'ist keine gültige Email-Adresse'
|
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
|
||||||
validates_presence_of :user
|
validates_presence_of :user
|
||||||
validates_presence_of :group
|
validates_presence_of :group
|
||||||
validates_presence_of :token
|
validates_presence_of :token
|
||||||
|
@ -26,9 +26,6 @@ class Invite < ActiveRecord::Base
|
||||||
|
|
||||||
attr_accessible :email, :user, :group
|
attr_accessible :email, :user, :group
|
||||||
|
|
||||||
# messages
|
|
||||||
ERR_EMAIL_IN_USE = 'ist bereits in Verwendung'
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Before validation, set token and expires_at.
|
# Before validation, set token and expires_at.
|
||||||
|
@ -46,7 +43,9 @@ class Invite < ActiveRecord::Base
|
||||||
|
|
||||||
# Custom validation: check that email does not already belong to a registered user.
|
# Custom validation: check that email does not already belong to a registered user.
|
||||||
def validate_on_create
|
def validate_on_create
|
||||||
errors.add(:email, ERR_EMAIL_IN_USE) unless User.find_by_email(self.email).nil?
|
unless User.find_by_email(self.email).nil?
|
||||||
|
errors.add(:email, 'ist bereits in Verwendung. Person ist schon Mitglied der Foodcoop.')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
# Schema version: 20090102171850
|
# Schema version: 20090114101610
|
||||||
#
|
#
|
||||||
# Table name: tasks
|
# Table name: tasks
|
||||||
#
|
#
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
# description :string(255)
|
# description :string(255)
|
||||||
# due_date :date
|
# due_date :date
|
||||||
# done :boolean(1)
|
# done :boolean(1)
|
||||||
# group_id :integer(4)
|
# workgroup_id :integer(4)
|
||||||
# assigned :boolean(1)
|
# assigned :boolean(1)
|
||||||
# created_on :datetime not null
|
# created_on :datetime not null
|
||||||
# updated_on :datetime not null
|
# updated_on :datetime not null
|
||||||
|
@ -18,7 +18,9 @@
|
||||||
class Task < ActiveRecord::Base
|
class Task < ActiveRecord::Base
|
||||||
has_many :assignments, :dependent => :destroy
|
has_many :assignments, :dependent => :destroy
|
||||||
has_many :users, :through => :assignments
|
has_many :users, :through => :assignments
|
||||||
belongs_to :group
|
belongs_to :workgroup
|
||||||
|
|
||||||
|
named_scope :non_group, :conditions => { :workgroup_id => nil, :done => false }, :order => "due_date ASC"
|
||||||
|
|
||||||
# form will send user in string. responsibilities will added later
|
# form will send user in string. responsibilities will added later
|
||||||
attr_protected :users
|
attr_protected :users
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<% for user in @users %>
|
<% for user in @users %>
|
||||||
<tr class="<%= cycle('even','odd', :name => 'users') %>">
|
<tr class="<%= cycle('even','odd', :name => 'users') %>">
|
||||||
<td><%= link_to user.nick, :action => 'showUser', :id => user.id %></td>
|
<td><%= link_to user.nick, [:admin, user] %></td>
|
||||||
<td><%= user.first_name %> <%= user.last_name %></td>
|
<td><%= user.first_name %> <%= user.last_name %></td>
|
||||||
<td><%= format_date(user.created_on) %></td>
|
<td><%= format_date(user.created_on) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -36,8 +36,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% for group in @groups %>
|
<% for group in @groups %>
|
||||||
<tr class="<%= cycle('even','odd', :name => 'groups') %>">
|
<tr class="<%= cycle('even','odd', :name => 'groups') %>">
|
||||||
<td><%= link_to group.name, :action => 'showGroup', :id => group %></td>
|
<td><%= link_to group.name, [:admin, group] %></td>
|
||||||
<td><%= group.is_a?(Ordergroup) ? 'Bestellgruppe' : 'Gruppe' %></td>
|
<td><%= group.class.human_name %></td>
|
||||||
<td><%= group.users.size %></td>
|
<td><%= group.users.size %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
<h1>Mitglieder von <%=h @group.name %></h1>
|
|
||||||
<p>
|
|
||||||
<i>Hier kannst Du die Mitglieder der Gruppe verwalten.</i>
|
|
||||||
</p>
|
|
||||||
<div class="left_column" style="width:48%">
|
|
||||||
<div class="box_title">
|
|
||||||
<h2>Sind schon Mitglieder</h2>
|
|
||||||
</div>
|
|
||||||
<div class="column_content" id="members">
|
|
||||||
<%=render :partial => 'admin/memberships/members' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="right_column" style="width:48%">
|
|
||||||
<div class="box_title">
|
|
||||||
<h2>Sind noch keine Mitglieder</h2>
|
|
||||||
</div>
|
|
||||||
<div class="column_content" id="non_members">
|
|
||||||
<%= render :partial => 'admin/memberships/non_members' %>
|
|
||||||
<%= link_to('Person einladen', :controller =>'index', :action => 'invite', :id => @group) if (@current_user.is_member_of(@group) || @current_user.role_admin?) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,44 +1,12 @@
|
||||||
- form_for [:admin, @ordergroup] do |@form|
|
- form_for [:admin, @ordergroup] do |@form|
|
||||||
= @form.error_messages
|
= render :partial => 'shared/group_form'
|
||||||
|
|
||||||
%div{:style => "float:left;width:55%;"}
|
%div{:style => "float:left;width:55%;"}
|
||||||
%p
|
|
||||||
= @form.label :name
|
|
||||||
%br/
|
|
||||||
= @form.text_field :name, :size => 20
|
|
||||||
%p
|
|
||||||
= @form.label :description
|
|
||||||
%br/
|
|
||||||
= @form.text_field :description, :size => 40
|
|
||||||
%p
|
%p
|
||||||
= @form.label :actual_size, "Aktuelle Gruppengröße"
|
= @form.label :actual_size, "Aktuelle Gruppengröße"
|
||||||
%br/
|
%br/
|
||||||
= @form.text_field :actual_size, :size => 3
|
= @form.text_field :actual_size, :size => 3
|
||||||
|
|
||||||
%div{:style => "float:right;width:40%"}
|
|
||||||
%h3 Gruppe hat Zugriff auf
|
|
||||||
%table
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :role_admin, "Administration"
|
|
||||||
%td= @form.check_box :role_admin
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :role_finance, "Finanzen"
|
|
||||||
%td= @form.check_box :role_finance
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :role_suppliers, "Lieferantenverwaltung"
|
|
||||||
%td= @form.check_box :role_suppliers
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :role_article_meta, "Artikelverwaltung"
|
|
||||||
%td= @form.check_box :role_article_meta
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :role_orders, "Bestellungsverwaltung"
|
|
||||||
%td= @form.check_box :role_orders
|
|
||||||
|
|
||||||
%br{ :style => "clear:both" }
|
%br{ :style => "clear:both" }
|
||||||
= submit_tag "Speichern"
|
= submit_tag "Speichern"
|
||||||
|
|
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
= render :partial => 'admin/memberships/edit_members'
|
= render :partial => 'shared/memberships/members'
|
||||||
%p{ :style => "clear:both" }
|
%p{ :style => "clear:both" }
|
||||||
= link_to 'Gruppenübersicht', admin_ordergroups_path
|
= link_to 'Gruppenübersicht', admin_ordergroups_path
|
|
@ -1,42 +1,15 @@
|
||||||
- title "Arbeitsgruppe #{@ordergroup.name}"
|
- title "Bestellgruppe #{@ordergroup.name}"
|
||||||
.left_column{:style => "width:45em"}
|
.left_column{:style => "width:45em"}
|
||||||
.box_title
|
.box_title
|
||||||
%h2 Übersicht
|
%h2 Übersicht
|
||||||
.column_content
|
.column_content
|
||||||
|
= render :partial => 'shared/group', :locals => { :group => @ordergroup }
|
||||||
%p
|
%p
|
||||||
%b Beschreibung:
|
|
||||||
=h @ordergroup.description
|
|
||||||
%p
|
|
||||||
%b Gruppe hat Zugriff auf:
|
|
||||||
- roles = Array.new
|
|
||||||
- roles << 'Administration' if @ordergroup.role_admin?
|
|
||||||
- roles << 'Finanzen' if @ordergroup.role_finance?
|
|
||||||
- roles << 'Lieferanten' if @ordergroup.role_suppliers?
|
|
||||||
- roles << 'Artikel' if @ordergroup.role_article_meta?
|
|
||||||
- roles << 'Bestellungsverwaltung' if @ordergroup.role_orders?
|
|
||||||
=h roles.join(', ')
|
|
||||||
%p
|
|
||||||
- if @ordergroup.weekly_task
|
|
||||||
%b wöchentlicher Job:
|
|
||||||
=h @ordergroup.task_name
|
|
||||||
am
|
|
||||||
= weekday(@ordergroup.weekday)
|
|
||||||
- else
|
|
||||||
kein wöchentlicher Job definiert
|
|
||||||
|
|
||||||
= link_to 'Gruppe bearbeiten', edit_admin_ordergroup_path(@ordergroup)
|
= link_to 'Gruppe bearbeiten', edit_admin_ordergroup_path(@ordergroup)
|
||||||
|
|
|
|
||||||
= link_to 'Löschen', [:admin, @ordergroup], :confirm => 'Bist Du sicher?', :method => :delete
|
= link_to 'Löschen', [:admin, @ordergroup], :confirm => 'Bist Du sicher?', :method => :delete
|
||||||
|
|
|
|
||||||
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @ordergroup
|
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @ordergroup
|
||||||
.box_title
|
|
|
||||||
%h2 Mitglieder
|
= link_to 'Mitglieder bearbeiten', memberships_admin_ordergroup_path(@ordergroup)
|
||||||
.column_content
|
|
||||||
- if @ordergroup.memberships.empty?
|
|
||||||
%i Diese Gruppe hat derzeit keine Mitglieder
|
|
||||||
- else
|
|
||||||
%ul{:style => "list-style-type:decimal;"}
|
|
||||||
- for membership in @ordergroup.memberships
|
|
||||||
%li= link_to membership.user.nick, [:admin, membership.user]
|
|
||||||
%p= link_to 'Mitglieder bearbeiten', memberships_admin_ordergroup_path(@ordergroup)
|
|
||||||
%p{:style => "clear:both"}= link_to "Gruppenübersicht", admin_ordergroups_path
|
%p{:style => "clear:both"}= link_to "Gruppenübersicht", admin_ordergroups_path
|
|
@ -4,7 +4,44 @@
|
||||||
<h2>Übersicht</h2>
|
<h2>Übersicht</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="column_content">
|
<div class="column_content">
|
||||||
<%= render :partial => 'users/show'%>
|
<p>
|
||||||
|
Mitglied seit <%= distance_of_time_in_words(Time.now, @user.created_on) -%>
|
||||||
|
</p>
|
||||||
|
<div style="float:left;margin:5px; margin-right:10px;" class="box">
|
||||||
|
<p><b>Person</b></p>
|
||||||
|
<p><b>Nick:</b> <%=h @user.nick %></p>
|
||||||
|
<p><b>Name:</b> <%=h @user.first_name + ' ' + @user.last_name %></p>
|
||||||
|
<p><b>Email:</b> <%=h @user.email %></p>
|
||||||
|
<p><b>Telefon:</b> <%=h @user.phone %></p>
|
||||||
|
<p><b>Adresse:</b> <%=h @user.address %></p>
|
||||||
|
</div>
|
||||||
|
<div style="float:left; margin:5px;" class="box">
|
||||||
|
<p>
|
||||||
|
<b>Einstellungen</b>
|
||||||
|
</p>
|
||||||
|
<table style="width:26em">
|
||||||
|
<tbody>
|
||||||
|
<% for setting in User::setting_keys.keys -%>
|
||||||
|
<tr>
|
||||||
|
<td><%= User::setting_keys[setting] %></td>
|
||||||
|
<td><%= @user.settings[setting] == '1' ? 'ja' : 'nein' %></td>
|
||||||
|
</tr>
|
||||||
|
<% end -%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>
|
||||||
|
<b>Benutzer_in hat Zugriff auf:</b>
|
||||||
|
</p>
|
||||||
|
<% roles = Array.new
|
||||||
|
roles << 'Admin' if @user.role_admin?
|
||||||
|
roles << 'Finanzen' if @user.role_finance?
|
||||||
|
roles << 'Lieferanten' if @user.role_suppliers?
|
||||||
|
roles << 'Artikel' if @user.role_article_meta?
|
||||||
|
roles << 'Bestellung' if @user.role_orders? %>
|
||||||
|
<p>
|
||||||
|
<%=h roles.join(', ') %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<p style="clear:both">
|
<p style="clear:both">
|
||||||
<%= link_to 'Bearbeiten', edit_admin_user_path(@user) %>
|
<%= link_to 'Bearbeiten', edit_admin_user_path(@user) %>
|
||||||
| <%= link_to 'Löschen', [:admin, @user], :confirm => "Willst du #{@user.first_name} wirklich rausschmeißen?", :method => :delete %>
|
| <%= link_to 'Löschen', [:admin, @user], :confirm => "Willst du #{@user.first_name} wirklich rausschmeißen?", :method => :delete %>
|
||||||
|
@ -13,7 +50,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="box_title"><h2>Gruppenabos</h2></div>
|
<div class="box_title"><h2>Gruppenabos</h2></div>
|
||||||
<div class="column_content">
|
<div class="column_content">
|
||||||
<%= render :partial => 'users/memberships'%>
|
<%= render :partial => 'shared/user_memberships'%>
|
||||||
<p><%= link_to 'Gruppenübersicht', :action => 'listGroups' %></p>
|
<p><%= link_to 'Gruppenübersicht', :action => 'listGroups' %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,16 +1,5 @@
|
||||||
- form_for [:admin, @workgroup] do |@form|
|
- form_for [:admin, @workgroup] do |@form|
|
||||||
= @form.error_messages
|
- render :layout => 'shared/group_form' do
|
||||||
|
|
||||||
%div{:style => "float:left;width:55%;"}
|
|
||||||
%p
|
|
||||||
= @form.label :name
|
|
||||||
%br/
|
|
||||||
= @form.text_field :name, :size => 20
|
|
||||||
%p
|
|
||||||
= @form.label :description
|
|
||||||
%br/
|
|
||||||
= @form.text_field :description, :size => 40
|
|
||||||
|
|
||||||
%div{:style => "float:right;width:40%"}
|
%div{:style => "float:right;width:40%"}
|
||||||
%h3 Gruppe hat Zugriff auf
|
%h3 Gruppe hat Zugriff auf
|
||||||
%table
|
%table
|
||||||
|
@ -35,50 +24,7 @@
|
||||||
= @form.label :role_orders, "Bestellungsverwaltung"
|
= @form.label :role_orders, "Bestellungsverwaltung"
|
||||||
%td= @form.check_box :role_orders
|
%td= @form.check_box :role_orders
|
||||||
|
|
||||||
%div{:style => "clear:both"}
|
|
||||||
%h3
|
|
||||||
Wöchentliche Jobs definieren?
|
|
||||||
= @form.check_box :weekly_task, {:onclick => "toggleWeeklyTask();"}
|
|
||||||
%table
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :weekday, "Wochentag:"
|
|
||||||
%td
|
|
||||||
= @form.select :weekday, Workgroup.weekdays
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :task_name, "Dienstname:"
|
|
||||||
%td= @form.text_field :task_name, :size => 20
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :task_required_users, "Benötigte Verantwortliche:"
|
|
||||||
%td= @form.text_field :task_required_users, :size => 3
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= @form.label :task_description, "Beschreibung:"
|
|
||||||
%td= @form.text_area :task_description
|
|
||||||
|
|
||||||
%br{ :style => "clear:both" }
|
%br{ :style => "clear:both" }
|
||||||
= submit_tag "Speichern"
|
= submit_tag "Speichern"
|
||||||
|
|
|
|
||||||
= link_to "Abbrechen", admin_workgroups_path
|
= link_to "Abbrechen", admin_workgroups_path
|
||||||
|
|
||||||
%script{ 'type' => "text/javascript"}
|
|
||||||
:plain
|
|
||||||
//<![CDATA[
|
|
||||||
// preset data
|
|
||||||
function toggleWeeklyTask(){
|
|
||||||
if ($("workgroup_weekly_task").checked == true) {
|
|
||||||
$('workgroup_weekday').disabled = false;
|
|
||||||
$('workgroup_task_name').disabled = false;
|
|
||||||
$('workgroup_task_required_users').disabled = false;
|
|
||||||
$('workgroup_task_description').disabled = false;
|
|
||||||
} else {
|
|
||||||
$('workgroup_weekday').disabled = true;
|
|
||||||
$('workgroup_task_name').disabled = true;
|
|
||||||
$('workgroup_task_required_users').disabled = true;
|
|
||||||
$('workgroup_task_description').disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toggleWeeklyTask();
|
|
||||||
//]]>
|
|
|
@ -1,3 +1,3 @@
|
||||||
= render :partial => 'admin/memberships/edit_members'
|
= render :partial => 'shared/memberships/members'
|
||||||
%p{ :style => "clear:both" }
|
%p{ :style => "clear:both" }
|
||||||
= link_to 'Gruppenübersicht', admin_workgroups_path
|
= link_to 'Gruppenübersicht', admin_workgroups_path
|
|
@ -3,40 +3,14 @@
|
||||||
.box_title
|
.box_title
|
||||||
%h2 Übersicht
|
%h2 Übersicht
|
||||||
.column_content
|
.column_content
|
||||||
%p
|
= render :partial => 'shared/group', :locals => { :group => @workgroup }
|
||||||
%b Beschreibung:
|
|
||||||
=h @workgroup.description
|
|
||||||
%p
|
|
||||||
%b Gruppe hat Zugriff auf:
|
|
||||||
- roles = Array.new
|
|
||||||
- roles << 'Administration' if @workgroup.role_admin?
|
|
||||||
- roles << 'Finanzen' if @workgroup.role_finance?
|
|
||||||
- roles << 'Lieferanten' if @workgroup.role_suppliers?
|
|
||||||
- roles << 'Artikel' if @workgroup.role_article_meta?
|
|
||||||
- roles << 'Bestellungsverwaltung' if @workgroup.role_orders?
|
|
||||||
=h roles.join(', ')
|
|
||||||
%p
|
|
||||||
- if @workgroup.weekly_task
|
|
||||||
%b wöchentlicher Job:
|
|
||||||
=h @workgroup.task_name
|
|
||||||
am
|
|
||||||
= weekday(@workgroup.weekday)
|
|
||||||
- else
|
|
||||||
kein wöchentlicher Job definiert
|
|
||||||
|
|
||||||
|
%p
|
||||||
= link_to 'Gruppe bearbeiten', edit_admin_workgroup_path(@workgroup)
|
= link_to 'Gruppe bearbeiten', edit_admin_workgroup_path(@workgroup)
|
||||||
|
|
|
|
||||||
= link_to 'Löschen', [:admin, @workgroup], :confirm => 'Bist Du sicher?', :method => :delete
|
= link_to 'Löschen', [:admin, @workgroup], :confirm => 'Bist Du sicher?', :method => :delete
|
||||||
|
|
|
|
||||||
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @workgroup
|
= link_to 'Nachricht senden', :controller => 'messages', :action => 'group', :id => @workgroup
|
||||||
.box_title
|
|
|
||||||
%h2 Mitglieder
|
= link_to 'Mitglieder bearbeiten', memberships_admin_workgroup_path(@workgroup)
|
||||||
.column_content
|
|
||||||
- if @workgroup.memberships.empty?
|
|
||||||
%i Diese Gruppe hat derzeit keine Mitglieder
|
|
||||||
- else
|
|
||||||
%ul{:style => "list-style-type:decimal;"}
|
|
||||||
- for membership in @workgroup.memberships
|
|
||||||
%li= link_to membership.user.nick, [:admin, membership.user]
|
|
||||||
%p= link_to 'Mitglieder bearbeiten', memberships_admin_workgroup_path(@workgroup)
|
|
||||||
%p{:style => "clear:both"}= link_to "Gruppenübersicht", admin_workgroups_path
|
%p{:style => "clear:both"}= link_to "Gruppenübersicht", admin_workgroups_path
|
|
@ -7,7 +7,8 @@
|
||||||
<p>Anzahl gefundener Transaktionen: <b><%= @total %></b></p>
|
<p>Anzahl gefundener Transaktionen: <b><%= @total %></b></p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= pagination_links_remote @financial_transactions, :params => {:sort => params[:sort], :query => params['query']}%>
|
<%= pagination_links_remote @financial_transactions, :update => 'transactions',
|
||||||
|
:params => {:sort => params[:sort], :query => params['query']}%>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
%table{:style => "width:100%"}
|
%table{:style => "width:100%"}
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= pagination_links_remote @groups, :params => {:sort => params[:sort]}
|
= pagination_links_remote @groups, :update => :ordergroups, :params => {:sort => params[:sort]}
|
||||||
%td{:style => "text-align:right"}
|
%td{:style => "text-align:right"}
|
||||||
- if @total > 20
|
- if @total > 20
|
||||||
= items_per_page
|
= items_per_page :update => :ordergroups
|
||||||
%table.list
|
%table.list
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
:before => "Element.show('loader')", |
|
:before => "Element.show('loader')", |
|
||||||
:success => "Element.hide('loader')", |
|
:success => "Element.hide('loader')", |
|
||||||
:url => {:action => 'index'}, |
|
:url => {:action => 'index'}, |
|
||||||
:with => 'query' |
|
:with => 'query', |
|
||||||
#table
|
:update => 'ordergroups' |
|
||||||
|
#ordergroups
|
||||||
= render :partial => "ordergroups"
|
= render :partial => "ordergroups"
|
||||||
%br/
|
%br/
|
||||||
- if @current_user.role_admin?
|
- if @current_user.role_admin?
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
:before => "Element.show('loader')",
|
:before => "Element.show('loader')",
|
||||||
:success => "Element.hide('loader')",
|
:success => "Element.hide('loader')",
|
||||||
:url => {:action => 'list'},
|
:url => {:action => 'list'},
|
||||||
:with => 'query' %>
|
:with => 'query',
|
||||||
<div id="table">
|
:update => 'transactions' %>
|
||||||
|
<div id="transactions">
|
||||||
<%= render :partial => "list" %>
|
<%= render :partial => "list" %>
|
||||||
</div>
|
</div>
|
||||||
<p><%= link_to 'Neue Transaktion', :action => 'new', :id => @group %></p>
|
<p><%= link_to 'Neue Transaktion', :action => 'new', :id => @group %></p>
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
%table{:style => "width:100%"}
|
%table{:style => "width:100%"}
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= pagination_links_remote @users
|
= pagination_links_remote @users, :update => :users
|
||||||
%td{:style => "text-align:right"}
|
%td{:style => "text-align:right"}
|
||||||
- if @total > 20
|
- if @total > 20
|
||||||
= items_per_page
|
= items_per_page :update => :users
|
||||||
%table.list
|
%table.list
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
12
app/views/foodcoop/_workgroup.html.haml
Normal file
12
app/views/foodcoop/_workgroup.html.haml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
.single_column{:style => "width:50em"}
|
||||||
|
.box_title
|
||||||
|
%h2= @group.name
|
||||||
|
.column_content
|
||||||
|
= render :partial => 'shared/group', :locals => { :group => @group }
|
||||||
|
%p
|
||||||
|
= link_to _("Show all tasks"), :controller => "tasks", :action => "workgroup", :id => @group
|
||||||
|
|
|
||||||
|
- if @group.member?(@current_user)
|
||||||
|
= link_to _("Edit group"), :action => "edit_group", :id => @group
|
||||||
|
|
|
||||||
|
= link_to _('Send members a message'), :controller => 'messages', :action => 'group', :id => @group
|
15
app/views/foodcoop/edit_group.html.haml
Normal file
15
app/views/foodcoop/edit_group.html.haml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
- title "Gruppe bearbeiten"
|
||||||
|
|
||||||
|
%p
|
||||||
|
%i
|
||||||
|
Mitglieder kannst du
|
||||||
|
= link_to "hier", :action => "memberships", :id => @group
|
||||||
|
hinzufügen.
|
||||||
|
.edit_form{:style => "width:35em"}
|
||||||
|
- form_for(@group, :url => {:action => 'update_group', :id => @group}) do |@form|
|
||||||
|
= render :partial => "shared/group_form"
|
||||||
|
|
||||||
|
%p{:style => "clear:both"}
|
||||||
|
= submit_tag 'Speichern'
|
||||||
|
|
|
||||||
|
= link_to "Abbrechen", :action => "workgroups"
|
14
app/views/foodcoop/invite.haml
Normal file
14
app/views/foodcoop/invite.haml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
- title "Neues Foodcoop-Mitglied einladen"
|
||||||
|
|
||||||
|
%p
|
||||||
|
Hier kannst du eine Person in die Gruppe
|
||||||
|
%b=h @group.name
|
||||||
|
einladen, die noch nicht Mitglied der Foodcoop ist.
|
||||||
|
.edit_form{:style => 'width:35em'}
|
||||||
|
- form_for(@invite, :url => {:action => 'send_invitation', :id => @group}) do |form|
|
||||||
|
= form.error_messages
|
||||||
|
%p
|
||||||
|
Email-Adresse:
|
||||||
|
= form.text_field('email', :size => 40, :maxlength => 128)
|
||||||
|
%p
|
||||||
|
= submit_tag('Einladung abschicken')
|
|
@ -4,7 +4,7 @@
|
||||||
Hier kannst Du den Mitgliedern Deiner Foodcoop eine Nachricht schreiben.
|
Hier kannst Du den Mitgliedern Deiner Foodcoop eine Nachricht schreiben.
|
||||||
%br/
|
%br/
|
||||||
Damit Deine Kontaktdaten einzusehen sind, musst Du sie unter
|
Damit Deine Kontaktdaten einzusehen sind, musst Du sie unter
|
||||||
= link_to "Einstellungen", :action => "editProfile"
|
= link_to "Einstellungen", my_profile_path
|
||||||
freigeben.
|
freigeben.
|
||||||
|
|
||||||
.left_column{:style => "width:100%"}
|
.left_column{:style => "width:100%"}
|
||||||
|
@ -21,13 +21,11 @@
|
||||||
:before => "Element.show('loader')", |
|
:before => "Element.show('loader')", |
|
||||||
:success => "Element.hide('loader')", |
|
:success => "Element.hide('loader')", |
|
||||||
:url => {:action => 'foodcoop_members'}, |
|
:url => {:action => 'foodcoop_members'}, |
|
||||||
|
:update => :users, |
|
||||||
:with => 'query' |
|
:with => 'query' |
|
||||||
|
|
||||||
=_ "Sort by Ordergroups :"
|
=_ "Sort by Ordergroups :"
|
||||||
- form_tag({:action => "foodcoop_members"}, :method => "get", :style=>"display:inline;") do
|
- form_tag({:action => "members"}, :method => "get", :style=>"display:inline;") do
|
||||||
-unless params[:sort_by_ordergroups]
|
= check_box_tag :sort_by_ordergroups, 1, params[:sort_by_ordergroups], :onclick => "submit();"
|
||||||
%input{:type => "checkbox", :name => :sort_by_ordergroups, :value => "1", :onclick => "submit();"}
|
#users
|
||||||
-else
|
= render :partial => "users"
|
||||||
%input{:type => "checkbox", :name => :sort_by_ordergroups, :value => "0", :checked => "checked", :onclick => "submit();"}
|
|
||||||
#user_table
|
|
||||||
= render :partial => "list_members"
|
|
1
app/views/foodcoop/memberships.rhtml
Normal file
1
app/views/foodcoop/memberships.rhtml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<%= render :partial => 'shared/memberships/members' %>
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
- unless @groups.empty?
|
- unless @groups.empty?
|
||||||
-for @group in @groups
|
-for @group in @groups
|
||||||
= render :partial => "showGroup"
|
= render :partial => "workgroup"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
<h1>Mitglieder von <%=h @group.name %></h1>
|
|
||||||
<p>
|
|
||||||
<i>Hier kannst Du die Mitglieder der Gruppe verwalten.</i>
|
|
||||||
</p>
|
|
||||||
<div class="left_column" style="width:48%">
|
|
||||||
<div class="box_title">
|
|
||||||
<h2>Sind schon Mitglieder</h2>
|
|
||||||
</div>
|
|
||||||
<div class="column_content" id="members">
|
|
||||||
<%=render :partial => 'groups/members' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="right_column" style="width:48%">
|
|
||||||
<div class="box_title">
|
|
||||||
<h2>Sind noch keine Mitglieder</h2>
|
|
||||||
</div>
|
|
||||||
<div class="column_content" id="non_members">
|
|
||||||
<%= render :partial => 'groups/non_members' %>
|
|
||||||
<%= link_to('Person einladen', :controller =>'index', :action => 'invite', :id => @group) if (@current_user.is_member_of(@group) || @current_user.role_admin?) %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,87 +0,0 @@
|
||||||
= error_messages_for 'group'
|
|
||||||
|
|
||||||
<!--[form:group]-->
|
|
||||||
%div{:style => "float:left;width:55%;"}
|
|
||||||
- if controller.controller_name == "admin" || !@group.is_a?(Ordergroup)
|
|
||||||
%p
|
|
||||||
%label{:for => "group_name"} Names
|
|
||||||
%br/
|
|
||||||
= text_field 'group', 'name', :size => 20
|
|
||||||
%p
|
|
||||||
%label{:for => "group_description"} Beschreibung
|
|
||||||
%br/
|
|
||||||
= text_field 'group', 'description', :size => 40
|
|
||||||
- if @group.is_a?(Ordergroup) && controller.controller_name == "admin"
|
|
||||||
%p
|
|
||||||
%label{:for => "group_actual_size"} Aktuelle Gruppengröße
|
|
||||||
%br/
|
|
||||||
= text_field "group", "actual_size", :size => 3
|
|
||||||
- if controller.controller_name == "admin"
|
|
||||||
%div{:style => "float:right;width:40%"}
|
|
||||||
%h3 Gruppe hat Zugriff auf
|
|
||||||
%table
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_role_admin"} Administration
|
|
||||||
%td= check_box 'group', 'role_admin'
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_role_finance"} Finanzen
|
|
||||||
%td= check_box 'group', 'role_finance'
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_role_suppliers"} Lieferantenverwaltung
|
|
||||||
%td= check_box 'group', 'role_suppliers'
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_role_article_meta"} Artikelverwaltung
|
|
||||||
%td= check_box 'group', 'role_article_meta'
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_role_orders"} Bestellungsverwaltung
|
|
||||||
%td= check_box 'group', 'role_orders'
|
|
||||||
-unless @group.is_a?(Ordergroup)
|
|
||||||
%div{:style => "clear:both"}
|
|
||||||
%h3
|
|
||||||
Wöchentliche Jobs definieren?
|
|
||||||
= check_box "group", "weekly_task", {:onclick => "toggleWeeklyTask();"}
|
|
||||||
%table
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_weekday"} Wochentag:
|
|
||||||
%td
|
|
||||||
%select#group_weekday{:name => "group[weekday]"}
|
|
||||||
= options_for_select([["Montag", "1"], ["Dienstag", "2"], ["Mittwoch","3"],["Donnerstag","4"],["Freitag","5"],["Samstag","6"],["Sonntag","0"]], [@group.weekday.to_s])
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_task_name"} Dienstname:
|
|
||||||
%td= text_field "group", "task_name",:size => 20
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_task_name"} Benötigte Verantwortliche:
|
|
||||||
%td= text_field "group", "task_required_users",:size => 3
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
%label{:for => "group_task_name"} Beschreibung:
|
|
||||||
%td= text_area "group", "task_description"
|
|
||||||
|
|
||||||
%script{ 'type' => "text/javascript"}
|
|
||||||
:plain
|
|
||||||
//<![CDATA[
|
|
||||||
// preset data
|
|
||||||
function toggleWeeklyTask(){
|
|
||||||
if ($("group_weekly_task").checked == true) {
|
|
||||||
$('group_weekday').disabled = false;
|
|
||||||
$('group_task_name').disabled = false;
|
|
||||||
$('group_task_required_users').disabled = false;
|
|
||||||
$('group_task_description').disabled = false;
|
|
||||||
} else {
|
|
||||||
$('group_weekday').disabled = true;
|
|
||||||
$('group_task_name').disabled = true;
|
|
||||||
$('group_task_required_users').disabled = true;
|
|
||||||
$('group_task_description').disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toggleWeeklyTask();
|
|
||||||
//]]>
|
|
||||||
<!--[eoform:group]-->
|
|
|
@ -1,16 +0,0 @@
|
||||||
<% if flash[:error] %><h3 class="error" id="flashError" ><%= flash[:error] %></h3><%= javascript_tag("new Effect.Highlight('flashError', {delay:0.8, duration:1});") -%><% end %>
|
|
||||||
<% memberships = @group.memberships
|
|
||||||
if memberships.size != 0 %>
|
|
||||||
<ul style="">
|
|
||||||
<% for membership in memberships %>
|
|
||||||
<li style="margin-left:-15px">
|
|
||||||
<b><%= link_to membership.user.nick, :action => "showUser", :id => membership.user %></b> (<%=h membership.user.first_name + ' ' + membership.user.last_name %>)
|
|
||||||
| <%= link_to_remote 'entfernen', :url => {:action => 'dropMember', :group => @group, :membership => membership},
|
|
||||||
:before => "Element.show('loader')",
|
|
||||||
:success => "Element.hide('loader')" %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<% else %>
|
|
||||||
<p><i><%= @group.name %> hat keine Mitglieder.</i></p>
|
|
||||||
<% end %>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<ul>
|
|
||||||
<% for user in @group.non_members %>
|
|
||||||
<li><b><%= link_to user.nick, :action => "showUser", :id => user %></b> (<%=h user.first_name + ' ' + user.last_name %>)
|
|
||||||
| <%= link_to_remote 'hinzufügen', :url => {:action => 'addMember', :id => @group, :user => user},
|
|
||||||
:before => "Element.show('loader')",
|
|
||||||
:success => "Element.hide('loader')" %> </li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<h1>Gruppe bearbeiten</h1>
|
|
||||||
<div class="edit_form" style="width:50em">
|
|
||||||
<% form_tag(:action => 'updateGroup', :id => @group) do %>
|
|
||||||
<%= render :partial => 'groups/form' %>
|
|
||||||
<br style="clear:both" />
|
|
||||||
<%= submit_tag 'Speichern' %> | <%= link_to "Abbrechen", :action => "listGroups" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="box_title"><h2><%=h @ordergroup.name %></h2></div>
|
<div class="box_title"><h2><%=h @ordergroup.name %></h2></div>
|
||||||
<div class="column_content">
|
<div class="column_content">
|
||||||
<p><b>Beschreibung:</b> <%=h @ordergroup.description %>
|
<p><b>Beschreibung:</b> <%=h @ordergroup.description %>
|
||||||
<%= link_to '(ändern)', :action => 'editGroup', :id => @ordergroup %>
|
<%= link_to '(ändern)', :controller => 'foodcoop', :action => 'edit_group', :id => @ordergroup %>
|
||||||
</p>
|
</p>
|
||||||
<p><b>Gruppengröße:</b> <%=h @ordergroup.actual_size %></p>
|
<p><b>Gruppengröße:</b> <%=h @ordergroup.actual_size %></p>
|
||||||
<p><b>Kontostand:</b> <%= number_to_currency(@ordergroup.account_balance) %></p>
|
<p><b>Kontostand:</b> <%= number_to_currency(@ordergroup.account_balance) %></p>
|
||||||
|
@ -32,10 +32,11 @@
|
||||||
<%= observe_field 'query', :frequency => 2,
|
<%= observe_field 'query', :frequency => 2,
|
||||||
:before => "Element.show('loader')",
|
:before => "Element.show('loader')",
|
||||||
:success => "Element.hide('loader')",
|
:success => "Element.hide('loader')",
|
||||||
:url => {:action => 'myOrdergroup'},
|
:url => {:action => 'ordergroup'},
|
||||||
:with => 'query' %>
|
:with => 'query',
|
||||||
<div id="table">
|
:update => 'transactions' %>
|
||||||
<%= render :partial => "/financial_transactions/list" %>
|
<div id="transactions">
|
||||||
|
<%= render :partial => "/finance/transactions/list" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
38
app/views/home/profile.html.erb
Normal file
38
app/views/home/profile.html.erb
Normal 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>
|
|
@ -1,40 +0,0 @@
|
||||||
.single_column{:style => "width:50em"}
|
|
||||||
.box_title
|
|
||||||
%h2= @group.name
|
|
||||||
.column_content
|
|
||||||
%table
|
|
||||||
%tr
|
|
||||||
%td= _("Description") + ":"
|
|
||||||
%td= @group.description
|
|
||||||
%tr
|
|
||||||
%td= _("Group has access to") + ":"
|
|
||||||
%td
|
|
||||||
- roles = Array.new
|
|
||||||
- roles << 'Administration' if @group.role_admin?
|
|
||||||
- roles << 'Finanzen' if @group.role_finance?
|
|
||||||
- roles << 'Lieferanten' if @group.role_suppliers?
|
|
||||||
- roles << 'Artikel' if @group.role_article_meta?
|
|
||||||
- roles << 'Bestellungsverwaltung' if @group.role_orders?
|
|
||||||
=h roles.join(', ')
|
|
||||||
%tr
|
|
||||||
%td= _("Members") + ":"
|
|
||||||
%td
|
|
||||||
- members = @group.users
|
|
||||||
= "(#{members.size})"
|
|
||||||
= members.collect(&:nick).join(", ")
|
|
||||||
%tr
|
|
||||||
%td= _("Weekly task") + ":"
|
|
||||||
%td
|
|
||||||
- if @group.weekly_task
|
|
||||||
=h @group.task_name
|
|
||||||
=_ "at"
|
|
||||||
= weekday(@group.weekday)
|
|
||||||
- else
|
|
||||||
=_ 'No weekly tasks defined yet'
|
|
||||||
%p
|
|
||||||
= link_to _("Show all tasks"), :controller => "tasks", :action => "workgroup", :id => @group
|
|
||||||
|
|
|
||||||
- if @group.member?(@current_user)
|
|
||||||
= link_to _("Edit group"), :action => "editGroup", :id => @group
|
|
||||||
|
|
|
||||||
= link_to _('Send members a message'), :controller => 'messages', :action => 'group', :id => @group
|
|
|
@ -1,14 +0,0 @@
|
||||||
%h1 Gruppe bearbeiten
|
|
||||||
|
|
||||||
%p
|
|
||||||
%i
|
|
||||||
Mitglieder kannst du
|
|
||||||
= link_to "hier", :action => "members", :id => @group
|
|
||||||
hinzufügen.
|
|
||||||
.edit_form{:style => "width:35em"}
|
|
||||||
- form_tag(:action => 'updateGroup', :id => @group) do
|
|
||||||
= render :partial => "/groups/form"
|
|
||||||
%p{:style => "clear:both"}
|
|
||||||
= submit_tag 'Speichern'
|
|
||||||
|
|
|
||||||
= link_to "Abbrechen", :action => "showGroup", :id => @group
|
|
|
@ -1,11 +0,0 @@
|
||||||
<h1>Meine Daten bearbeiten</h1>
|
|
||||||
<div class="left_column" style="width: 100%;">
|
|
||||||
<div class="box_title"><h2><%= h @user.nick %></h2></div>
|
|
||||||
<div class="column_content">
|
|
||||||
<% form_tag(:action => 'updateProfile') do %>
|
|
||||||
<%= render :partial => 'users/form' %>
|
|
||||||
<p style="clear:both">
|
|
||||||
<%= submit_tag 'Speichern' %> | <%= link_to 'Abbrechen', :action => 'myProfile' %></p>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,13 +0,0 @@
|
||||||
%h1 Einladen
|
|
||||||
%p
|
|
||||||
Hier kannst du eine Person in die Gruppe
|
|
||||||
=h @group.name
|
|
||||||
einladen, die noch nicht Mitglied der Foodcoop ist.
|
|
||||||
= error_messages_for('invite')
|
|
||||||
.edit_form{:style => 'width:35em'}
|
|
||||||
- form_for(:invite, @invite) do |i|
|
|
||||||
%p
|
|
||||||
Email-Adresse:
|
|
||||||
= i.text_field('email', :size => 40, :maxlength => 128)
|
|
||||||
%p
|
|
||||||
= submit_tag('Einladung abschicken')
|
|
|
@ -1,8 +0,0 @@
|
||||||
<%= render :partial => 'groups/edit_members' %>
|
|
||||||
<p style="clear:both">
|
|
||||||
<% if @group.is_a?(Ordergroup) -%>
|
|
||||||
<%= link_to "Zurück", :action => "myOrdergroup" %>
|
|
||||||
<% else -%>
|
|
||||||
<%= link_to 'Zurück', :action => 'showGroup', :id => @group %>
|
|
||||||
<% end -%>
|
|
||||||
</p>
|
|
|
@ -1,30 +0,0 @@
|
||||||
<h1><%= _('edit my profile')%></h1>
|
|
||||||
<%= _('Here you can change your preferences. For example you can change your phone number or your password.
|
|
||||||
<br>
|
|
||||||
You can also see in which workgroups you are.
|
|
||||||
<p></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_tag(:action => 'updateProfile') do %>
|
|
||||||
<%= render :partial => 'users/form' %>
|
|
||||||
<p style="clear:both">
|
|
||||||
<%= submit_tag 'Speichern' %> | <%= link_to 'Abbrechen', :action => 'myProfile' %></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>
|
|
||||||
<%= link_to(membership.group.name, :action => 'showGroup', :id => membership.group) %>
|
|
||||||
<% if membership.group.type != 'Ordergroup' %>
|
|
||||||
(<%= link_to _("Cancel membership"), { :action => 'cancel_membership', :id => membership }, :confirm => _("Are you sure to cancel this membership?"), :method => :post %>)
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,8 +0,0 @@
|
||||||
%h1
|
|
||||||
=h @group.is_a?(Ordergroup) ? "Bestellgruppe:" : "Gruppe:"
|
|
||||||
=h @group.name
|
|
||||||
= render :partial => "showGroup"
|
|
||||||
|
|
||||||
- unless @group.is_a?(Ordergroup)
|
|
||||||
%p{:style => "clear:both"}
|
|
||||||
= link_to "alle Arbeitsgruppen", :action => "workgroups"
|
|
|
@ -1,12 +0,0 @@
|
||||||
%h1=h @user.nick
|
|
||||||
.left_column{:style => "width:50em"}
|
|
||||||
.box_title
|
|
||||||
%h2 Übersicht
|
|
||||||
.column_content
|
|
||||||
= render :partial => "users/show"
|
|
||||||
%p{:style => "clear:both"}
|
|
||||||
%p= link_to "Nachricht senden", :controller => "messages", :action => 'user', :id => @user
|
|
||||||
.box_title
|
|
||||||
%h2 Gruppenabos
|
|
||||||
.column_content
|
|
||||||
= render :partial => "users/memberships"
|
|
|
@ -1,14 +1,19 @@
|
||||||
<%
|
<%
|
||||||
u = @current_user
|
u = @current_user
|
||||||
tabs = [
|
tabs = [
|
||||||
{ :name => "Start", :url => root_path, :active => ["index", "messages", "tasks"],
|
{ :name => "Start", :url => root_path, :active => ["index", "messages", "home"],
|
||||||
:subnav => [
|
:subnav => [
|
||||||
{ :name => "Members", :url => "/index/foodcoop_members"},
|
|
||||||
{ :name => "Workgroups", :url => "/index/workgroups"},
|
|
||||||
{ :name => "Tasks", :url => "/tasks"},
|
|
||||||
{ :name => "Messages", :url => "/messages/inbox"},
|
{ :name => "Messages", :url => "/messages/inbox"},
|
||||||
{ :name => "My Ordergroup", :url => my_ordergroup_path},
|
{ :name => "My tasks", :url => "/home/tasks" },
|
||||||
{ :name => "My Ordergroup", :url => my_profile_path}
|
{ :name => "My ordergroup", :url => "/home/ordergroup"},
|
||||||
|
{ :name => "My profile", :url => "/home/profile"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ :name => "Foodcoop", :url => "/foodcoop/members", :active => ["foodcoop", "tasks"],
|
||||||
|
:subnav => [
|
||||||
|
{ :name => "Members", :url => "/foodcoop/members"},
|
||||||
|
{ :name => "Workgroups", :url => "/foodcoop/workgroups"},
|
||||||
|
{ :name => "Tasks", :url => "/tasks"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ :name => "Orders", :url => "/ordering", :active => ["orders", "ordering"],
|
{ :name => "Orders", :url => "/ordering", :active => ["orders", "ordering"],
|
||||||
|
@ -48,12 +53,12 @@
|
||||||
-%>
|
-%>
|
||||||
<ul>
|
<ul>
|
||||||
<% for tab in tabs -%>
|
<% for tab in tabs -%>
|
||||||
<% unless tab[:access?] and tab[:access?] == false %>
|
<% unless tab[:access?] and tab[:access?] == false -%>
|
||||||
<li class="<%= 'current' if tab_is_active?(tab) %>">
|
<li class="<%= 'current' if tab_is_active?(tab) %>">
|
||||||
<%= link_to tab[:name], tab[:url] %>
|
<%= link_to tab[:name], tab[:url] %>
|
||||||
<ul>
|
<ul>
|
||||||
<% for subtab in tab[:subnav] -%>
|
<% for subtab in tab[:subnav] -%>
|
||||||
<% unless subtab[:access?] and subtab[:access?] == false %>
|
<% unless subtab[:access?] and subtab[:access?] == false -%>
|
||||||
<li><%= link_to subtab[:name], subtab[:url] %></li>
|
<li><%= link_to subtab[:name], subtab[:url] %></li>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
28
app/views/shared/_group.html.haml
Normal file
28
app/views/shared/_group.html.haml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
%table
|
||||||
|
%tr
|
||||||
|
%td Beschreibung:
|
||||||
|
%td=h group.description
|
||||||
|
%tr
|
||||||
|
%td Gruppe hat Zugriff auf:
|
||||||
|
%td
|
||||||
|
- roles = Array.new
|
||||||
|
- roles << 'Administration' if group.role_admin?
|
||||||
|
- roles << 'Finanzen' if group.role_finance?
|
||||||
|
- roles << 'Lieferanten' if group.role_suppliers?
|
||||||
|
- roles << 'Artikel' if group.role_article_meta?
|
||||||
|
- roles << 'Bestellungsverwaltung' if group.role_orders?
|
||||||
|
= roles.join(', ')
|
||||||
|
%tr
|
||||||
|
%td Mitglieder:
|
||||||
|
%td
|
||||||
|
- members = group.users
|
||||||
|
= "(#{members.size})"
|
||||||
|
= members.collect(&:nick).join(", ")
|
||||||
|
- if group.is_a?(Workgroup)
|
||||||
|
%tr
|
||||||
|
%td wöchentlicher Job:
|
||||||
|
%td
|
||||||
|
- if group.weekly_task
|
||||||
|
=h "#{group.task_name} am #{weekday(group.weekday)}"
|
||||||
|
- else
|
||||||
|
kein wöchentlicher Job definiert
|
57
app/views/shared/_group_form.html.haml
Normal file
57
app/views/shared/_group_form.html.haml
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
= @form.error_messages
|
||||||
|
|
||||||
|
%div{:style => "float:left;width:55%;"}
|
||||||
|
%p
|
||||||
|
= @form.label :name
|
||||||
|
%br/
|
||||||
|
= @form.text_field :name, :size => 20
|
||||||
|
%p
|
||||||
|
= @form.label :description
|
||||||
|
%br/
|
||||||
|
= @form.text_field :description, :size => 40
|
||||||
|
|
||||||
|
= yield
|
||||||
|
|
||||||
|
- if @group.is_a?(Workgroup)
|
||||||
|
%div{:style => "clear:both"}
|
||||||
|
%h3
|
||||||
|
Wöchentliche Jobs definieren?
|
||||||
|
= @form.check_box :weekly_task, {:onclick => "toggleWeeklyTask();"}
|
||||||
|
%table
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= @form.label :weekday, "Wochentag:"
|
||||||
|
%td
|
||||||
|
= @form.select :weekday, Workgroup.weekdays
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= @form.label :task_name, "Dienstname:"
|
||||||
|
%td= @form.text_field :task_name, :size => 20
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= @form.label :task_required_users, "Benötigte Verantwortliche:"
|
||||||
|
%td= @form.text_field :task_required_users, :size => 3
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= @form.label :task_description, "Beschreibung:"
|
||||||
|
%td= @form.text_area :task_description
|
||||||
|
|
||||||
|
%script{ 'type' => "text/javascript"}
|
||||||
|
:plain
|
||||||
|
//<![CDATA[
|
||||||
|
// preset data
|
||||||
|
function toggleWeeklyTask(){
|
||||||
|
if ($("workgroup_weekly_task").checked == true) {
|
||||||
|
$('workgroup_weekday').disabled = false;
|
||||||
|
$('workgroup_task_name').disabled = false;
|
||||||
|
$('workgroup_task_required_users').disabled = false;
|
||||||
|
$('workgroup_task_description').disabled = false;
|
||||||
|
} else {
|
||||||
|
$('workgroup_weekday').disabled = true;
|
||||||
|
$('workgroup_task_name').disabled = true;
|
||||||
|
$('workgroup_task_required_users').disabled = true;
|
||||||
|
$('workgroup_task_description').disabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toggleWeeklyTask();
|
||||||
|
//]]>
|
|
@ -1,7 +1,7 @@
|
||||||
%ul
|
%ul
|
||||||
%li
|
%li
|
||||||
= image_tag 'b_user.png' , :size => '7x10', :border => 0, :alt => _("User")
|
= image_tag 'b_user.png' , :size => '7x10', :border => 0, :alt => _("User")
|
||||||
= link_to h(@current_user.nick), { :controller => 'index', :action => 'myProfile' }, { :title => _("User Settings") }
|
= link_to h(@current_user.nick), my_profile_path, { :title => _("User Settings") }
|
||||||
- if APP_CONFIG[:base_url]
|
- if APP_CONFIG[:base_url]
|
||||||
%li= link_to APP_CONFIG[:name], APP_CONFIG[:base_url], { :title => _("Go to your FoodCoop-Hompage") }
|
%li= link_to APP_CONFIG[:name], APP_CONFIG[:base_url], { :title => _("Go to your FoodCoop-Hompage") }
|
||||||
%li= link_to _("Help"), 'http://dev.foodcoops.net/wiki/FoodsoftDoku'
|
%li= link_to _("Help"), 'http://dev.foodcoops.net/wiki/FoodsoftDoku'
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<li style="margin-left:-15px">
|
<li style="margin-left:-15px">
|
||||||
<b><%= membership.user.nick %></b> (<%=h membership.user.first_name + ' ' + membership.user.last_name %>)
|
<b><%= membership.user.nick %></b> (<%=h membership.user.first_name + ' ' + membership.user.last_name %>)
|
||||||
| <%= link_to_remote 'entfernen',
|
| <%= link_to_remote 'entfernen',
|
||||||
:url => { :controller => 'admin/memberships', :action => 'drop_member', :group_id => @group, :membership_id => membership },
|
:url => { :controller => '/memberships', :action => 'drop_member', :group_id => @group, :membership_id => membership },
|
||||||
:before => "Element.show('loader')",
|
:before => "Element.show('loader')",
|
||||||
:success => "Element.hide('loader')" %>
|
:success => "Element.hide('loader')" %>
|
||||||
</li>
|
</li>
|
24
app/views/shared/memberships/_members.rhtml
Normal file
24
app/views/shared/memberships/_members.rhtml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<h1>Mitglieder von <%=h @group.name %></h1>
|
||||||
|
<p>
|
||||||
|
<i>
|
||||||
|
Hier kannst Du die Mitglieder der Gruppe verwalten oder ein neues Foodcoop-Mitglied in die Gruppe
|
||||||
|
<%= link_to('einladen', :controller => '/foodcoop', :action => 'invite', :id => @group) %>.
|
||||||
|
</i>
|
||||||
|
</p>
|
||||||
|
<div class="left_column" style="width:48%">
|
||||||
|
<div class="box_title">
|
||||||
|
<h2>Sind schon Mitglieder</h2>
|
||||||
|
</div>
|
||||||
|
<div class="column_content" id="members">
|
||||||
|
<%=render :partial => 'shared/memberships/current_members' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="right_column" style="width:48%">
|
||||||
|
<div class="box_title">
|
||||||
|
<h2>Sind noch keine Mitglieder</h2>
|
||||||
|
</div>
|
||||||
|
<div class="column_content" id="non_members">
|
||||||
|
<%= render :partial => 'shared/memberships/non_members' %>
|
||||||
|
<%= link_to('Person einladen', :controller => '/foodcoop', :action => 'invite', :id => @group) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -3,7 +3,7 @@
|
||||||
<li>
|
<li>
|
||||||
<b><%= user.nick %></b> (<%=h user.first_name + ' ' + user.last_name %>)
|
<b><%= user.nick %></b> (<%=h user.first_name + ' ' + user.last_name %>)
|
||||||
| <%= link_to_remote 'hinzufügen',
|
| <%= link_to_remote 'hinzufügen',
|
||||||
:url => { :controller => 'admin/memberships', :action => 'add_member', :group_id => @group, :user_id => user },
|
:url => { :controller => '/memberships', :action => 'add_member', :group_id => @group, :user_id => user },
|
||||||
:before => "Element.show('loader')",
|
:before => "Element.show('loader')",
|
||||||
:success => "Element.hide('loader')" %>
|
:success => "Element.hide('loader')" %>
|
||||||
</li>
|
</li>
|
|
@ -9,4 +9,4 @@
|
||||||
#workgroup_members{:style => "padding-left:41em"}
|
#workgroup_members{:style => "padding-left:41em"}
|
||||||
%h3=_ 'Members of the workgroups'
|
%h3=_ 'Members of the workgroups'
|
||||||
#list
|
#list
|
||||||
= render :partial => "/groups/workgroup_members"
|
= render :partial => "shared/workgroup_members"
|
|
@ -8,4 +8,4 @@
|
||||||
#workgroup_members{:style => "padding-left:41em"}
|
#workgroup_members{:style => "padding-left:41em"}
|
||||||
%h3=_ 'Members of the workgroups'
|
%h3=_ 'Members of the workgroups'
|
||||||
#list
|
#list
|
||||||
= render :partial => "/groups/workgroup_members"
|
= render :partial => "shared/workgroup_members"
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
%tr
|
%tr
|
||||||
%td=_ 'Group'
|
%td=_ 'Group'
|
||||||
%td
|
%td
|
||||||
- if @task.group
|
- if @task.workgroup
|
||||||
= link_to @task.group.name, :action => "workgroup", :id => @task.group
|
= link_to @task.workgroup.name, :action => "workgroup", :id => @task.workgroup
|
||||||
|
|
||||||
%tr
|
%tr
|
||||||
%td{:colspan => "2"}
|
%td{:colspan => "2"}
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
<%= error_messages_for 'user' %>
|
|
||||||
|
|
||||||
<table style="float:left;width:52%;">
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_nick">Nick</label></td>
|
|
||||||
<td><%= text_field 'user', 'nick' %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_first_name">Vorname</label></td>
|
|
||||||
<td><%= text_field 'user', 'first_name' %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_last_name">Nachname</label></td>
|
|
||||||
<td><%= text_field 'user', 'last_name' %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_email">Email</label></td>
|
|
||||||
<td><%= text_field 'user', 'email' %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_phone">Telefon</label></td>
|
|
||||||
<td><%= text_field 'user', 'phone' %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_address">Adresse</label></td>
|
|
||||||
<td><%= text_field 'user', 'address' %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td/>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_password_entry">Neues Passwort</label></td>
|
|
||||||
<td><%= password_field_tag "user", "password_entry" %></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user_password_entry_confirmation">Passwort wiederholen</label></td>
|
|
||||||
<td><%= password_field_tag "user", "password_entry_confirmation" %></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<table style="float:right;width:45%;">
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><b>Einstellungen:</b></td>
|
|
||||||
</tr>
|
|
||||||
<% for setting in User::setting_keys.keys -%>
|
|
||||||
<tr>
|
|
||||||
<td><label for="user[settings][<%= setting %>]"><%=h User::setting_keys[setting]%></label></td>
|
|
||||||
<td><%= check_box_tag "user[settings][#{setting}]", '1', @user.settings[setting] == '1' || @user.settings_default(setting) %></td>
|
|
||||||
</tr>
|
|
||||||
<% end -%>
|
|
||||||
</table>
|
|
|
@ -1,6 +0,0 @@
|
||||||
%table{:style => "width:26em"}
|
|
||||||
%tbody
|
|
||||||
- for setting in User::setting_keys.keys
|
|
||||||
%tr
|
|
||||||
%td=h User::setting_keys[setting]
|
|
||||||
%td= @user.settings[setting] == '1' ? 'ja' : 'nein'
|
|
|
@ -1,26 +0,0 @@
|
||||||
<p>Mitglied seit <%= distance_of_time_in_words(Time.now, @user.created_on) -%></p>
|
|
||||||
|
|
||||||
<% if @current_user.role_admin? %>
|
|
||||||
<div style="float:left;margin:5px; margin-right:10px;" class="box">
|
|
||||||
<p><b>Person</b></p>
|
|
||||||
<p><b>Nick:</b> <%=h @user.nick %></p>
|
|
||||||
<p><b>Name:</b> <%=h @user.first_name + ' ' + @user.last_name %></p>
|
|
||||||
<p><b>Email:</b> <%=h @user.email %></p>
|
|
||||||
<p><b>Telefon:</b> <%=h @user.phone %></p>
|
|
||||||
<p><b>Adresse:</b> <%=h @user.address %></p>
|
|
||||||
</div>
|
|
||||||
<div style="float:left; margin:5px;" class="box">
|
|
||||||
<p><b>Einstellungen</b></p>
|
|
||||||
<%= render :partial => 'users/settings' %>
|
|
||||||
<p><b>Benutzer_in hat Zugriff auf:</b></p>
|
|
||||||
<% roles = Array.new
|
|
||||||
roles << 'Admin' if @user.role_admin?
|
|
||||||
roles << 'Finanzen' if @user.role_finance?
|
|
||||||
roles << 'Lieferanten' if @user.role_suppliers?
|
|
||||||
roles << 'Artikel' if @user.role_article_meta?
|
|
||||||
roles << 'Bestellung' if @user.role_orders? %>
|
|
||||||
<p>
|
|
||||||
<%=h roles.join(', ') %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
|
@ -1,10 +1,11 @@
|
||||||
ActionController::Routing::Routes.draw do |map|
|
ActionController::Routing::Routes.draw do |map|
|
||||||
|
map.my_profile '/home/profile', :controller => 'home', :action => 'profile'
|
||||||
|
map.my_tasks '/home/tasks', :controller => 'tasks', :action => 'myTasks'
|
||||||
|
|
||||||
map.namespace :admin do |admin|
|
map.namespace :admin do |admin|
|
||||||
admin.resources :users
|
admin.resources :users
|
||||||
admin.resources :workgroups, :member => { :memberships => :get }
|
admin.resources :workgroups, :member => { :memberships => :get }
|
||||||
admin.resources :ordergroups, :member => { :memberships => :get }
|
admin.resources :ordergroups, :member => { :memberships => :get }
|
||||||
admin.connect 'memberships/:action/:id', :controller => 'memberships'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
map.namespace :finance do |finance|
|
map.namespace :finance do |finance|
|
||||||
|
@ -17,10 +18,7 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
:has_many => [:deliveries],
|
:has_many => [:deliveries],
|
||||||
:collection => { :shared_suppliers => :get }
|
:collection => { :shared_suppliers => :get }
|
||||||
|
|
||||||
map.my_profile 'my_profile', :controller => 'index', :action => 'myProfile'
|
map.root :controller => 'home', :action => 'index'
|
||||||
map.my_ordergroup 'my_ordergroup', :controller => 'index', :action => 'myOrdergroup'
|
|
||||||
|
|
||||||
map.root :controller => 'index'
|
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ class RenameOrdergroups < ActiveRecord::Migration
|
||||||
def self.up
|
def self.up
|
||||||
rename_column :financial_transactions, :order_group_id, :ordergroup_id
|
rename_column :financial_transactions, :order_group_id, :ordergroup_id
|
||||||
rename_column :group_orders, :order_group_id, :ordergroup_id
|
rename_column :group_orders, :order_group_id, :ordergroup_id
|
||||||
|
rename_column :tasks, :group_id, :workgroup_id
|
||||||
remove_index :group_orders, :name => "index_group_orders_on_order_group_id_and_order_id"
|
remove_index :group_orders, :name => "index_group_orders_on_order_group_id_and_order_id"
|
||||||
add_index :group_orders, [:ordergroup_id, :order_id], :unique => true
|
add_index :group_orders, [:ordergroup_id, :order_id], :unique => true
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20090114101610) do
|
ActiveRecord::Schema.define(:version => 20090113111624) do
|
||||||
|
|
||||||
create_table "article_categories", :force => true do |t|
|
create_table "article_categories", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
|
@ -269,7 +269,7 @@ ActiveRecord::Schema.define(:version => 20090114101610) do
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.date "due_date"
|
t.date "due_date"
|
||||||
t.boolean "done", :default => false
|
t.boolean "done", :default => false
|
||||||
t.integer "group_id"
|
t.integer "workgroup_id"
|
||||||
t.boolean "assigned", :default => false
|
t.boolean "assigned", :default => false
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_on", :null => false
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_on", :null => false
|
||||||
|
|
4
test/fixtures/tasks.yml
vendored
4
test/fixtures/tasks.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
# Schema version: 20090102171850
|
# Schema version: 20090114101610
|
||||||
#
|
#
|
||||||
# Table name: tasks
|
# Table name: tasks
|
||||||
#
|
#
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
# description :string(255)
|
# description :string(255)
|
||||||
# due_date :date
|
# due_date :date
|
||||||
# done :boolean(1)
|
# done :boolean(1)
|
||||||
# group_id :integer(4)
|
# workgroup_id :integer(4)
|
||||||
# assigned :boolean(1)
|
# assigned :boolean(1)
|
||||||
# created_on :datetime not null
|
# created_on :datetime not null
|
||||||
# updated_on :datetime not null
|
# updated_on :datetime not null
|
||||||
|
|
8
test/functional/foodcoop_controller_test.rb
Normal file
8
test/functional/foodcoop_controller_test.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class FoodcoopControllerTest < ActionController::TestCase
|
||||||
|
# Replace this with your real tests.
|
||||||
|
test "the truth" do
|
||||||
|
assert true
|
||||||
|
end
|
||||||
|
end
|
8
test/functional/home_controller_test.rb
Normal file
8
test/functional/home_controller_test.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class HomeControllerTest < ActionController::TestCase
|
||||||
|
# Replace this with your real tests.
|
||||||
|
test "the truth" do
|
||||||
|
assert true
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,18 +0,0 @@
|
||||||
require File.dirname(__FILE__) + '/../test_helper'
|
|
||||||
require 'index_controller'
|
|
||||||
|
|
||||||
# Re-raise errors caught by the controller.
|
|
||||||
class IndexController; def rescue_action(e) raise e end; end
|
|
||||||
|
|
||||||
class IndexControllerTest < Test::Unit::TestCase
|
|
||||||
def setup
|
|
||||||
@controller = IndexController.new
|
|
||||||
@request = ActionController::TestRequest.new
|
|
||||||
@response = ActionController::TestResponse.new
|
|
||||||
end
|
|
||||||
|
|
||||||
# Replace this with your real tests.
|
|
||||||
def test_truth
|
|
||||||
assert true
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue