Moved foodcoop/workgroups into new namespace foodcoop. Closes #20
This commit is contained in:
parent
1a8026c5a7
commit
0d910dfbbd
13 changed files with 196 additions and 38 deletions
26
app/controllers/foodcoop/workgroups_controller.rb
Normal file
26
app/controllers/foodcoop/workgroups_controller.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
class Foodcoop::WorkgroupsController < ApplicationController
|
||||||
|
|
||||||
|
before_filter :authenticate_membership_or_admin,
|
||||||
|
:except => [:index]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@workgroups = Workgroup.all :order => "name"
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@workgroup = Workgroup.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@workgroup = Workgroup.find(params[:id])
|
||||||
|
if @workgroup.update_attributes(params[:workgroup])
|
||||||
|
flash[:notice] = "Arbeitsgruppe wurde aktualisiert"
|
||||||
|
redirect_to foodcoop_workgroups_url
|
||||||
|
else
|
||||||
|
render :action => 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def memberships
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,7 +1,6 @@
|
||||||
class FoodcoopController < ApplicationController
|
class FoodcoopController < ApplicationController
|
||||||
|
|
||||||
before_filter :authenticate_membership_or_admin,
|
before_filter :authenticate_membership_or_admin, :except => [:members]
|
||||||
:only => [:edit_group, :update_group, :memberships, :invite, :send_invitation]
|
|
||||||
|
|
||||||
# gives a view to list all members of the foodcoop
|
# gives a view to list all members of the foodcoop
|
||||||
def members
|
def members
|
||||||
|
@ -39,20 +38,6 @@ class FoodcoopController < ApplicationController
|
||||||
end
|
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.
|
# Invites a new user to join foodsoft in this group.
|
||||||
def invite
|
def invite
|
||||||
@invite = Invite.new
|
@invite = Invite.new
|
||||||
|
|
|
@ -32,6 +32,9 @@ class Workgroup < Group
|
||||||
# returns all non-finished tasks
|
# returns all non-finished tasks
|
||||||
has_many :open_tasks, :class_name => 'Task', :conditions => ['done = ?', false], :order => 'due_date ASC'
|
has_many :open_tasks, :class_name => 'Task', :conditions => ['done = ?', false], :order => 'due_date ASC'
|
||||||
|
|
||||||
|
validates_presence_of :task_name, :weekday, :task_required_users,
|
||||||
|
:if => Proc.new {|workgroup| workgroup.weekly_task }
|
||||||
|
|
||||||
def self.weekdays
|
def self.weekdays
|
||||||
[["Montag", "1"], ["Dienstag", "2"], ["Mittwoch","3"],["Donnerstag","4"],["Freitag","5"],["Samstag","6"],["Sonntag","0"]]
|
[["Montag", "1"], ["Dienstag", "2"], ["Mittwoch","3"],["Donnerstag","4"],["Freitag","5"],["Samstag","6"],["Sonntag","0"]]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
.single_column{:style => "width:55em"}
|
|
||||||
.box_title
|
|
||||||
%h2= workgroup.name
|
|
||||||
.column_content
|
|
||||||
= render :partial => 'shared/group', :locals => { :group => workgroup }
|
|
||||||
%p
|
|
||||||
= link_to "Alle Aufgaben zeigen", :controller => "tasks", :action => "workgroup", :id => workgroup
|
|
||||||
|
|
|
||||||
= link_to "Mitgliedern eine Nachricht schicken", :controller => 'messages', :action => 'group', :id => workgroup
|
|
||||||
- if workgroup.member?(@current_user)
|
|
||||||
|
|
|
||||||
= link_to "Gruppe bearbeiten", :action => "edit_group", :id => workgroup
|
|
||||||
|
|
|
||||||
= link_to "Mitglieder bearbeiten", :action => "memberships", :id => workgroup
|
|
|
@ -1 +0,0 @@
|
||||||
<%= render :partial => 'shared/memberships/members' %>
|
|
14
app/views/foodcoop/workgroups/_workgroup.html.haml
Normal file
14
app/views/foodcoop/workgroups/_workgroup.html.haml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
.single_column{:style => "width:55em"}
|
||||||
|
.box_title
|
||||||
|
%h2= workgroup.name
|
||||||
|
.column_content
|
||||||
|
= render :partial => 'shared/group', :locals => { :group => workgroup }
|
||||||
|
%p
|
||||||
|
= link_to "Alle Aufgaben zeigen", :controller => "/tasks", :action => "workgroup", :id => workgroup
|
||||||
|
|
|
||||||
|
= link_to "Mitgliedern eine Nachricht schicken", :controller => '/messages', :action => 'group', :id => workgroup
|
||||||
|
- if workgroup.member?(@current_user)
|
||||||
|
|
|
||||||
|
= link_to "Gruppe bearbeiten", edit_foodcoop_workgroup_path(workgroup)
|
||||||
|
|
|
||||||
|
= link_to "Mitglieder bearbeiten", memberships_foodcoop_workgroup_path(workgroup)
|
|
@ -3,13 +3,14 @@
|
||||||
%p
|
%p
|
||||||
%i
|
%i
|
||||||
Mitglieder kannst du
|
Mitglieder kannst du
|
||||||
= link_to "hier", :action => "memberships", :id => @group
|
= link_to "hier", :action => "memberships", :id => @workgroup
|
||||||
hinzufügen.
|
hinzufügen.
|
||||||
|
|
||||||
.edit_form{:style => "width:35em"}
|
.edit_form{:style => "width:35em"}
|
||||||
- form_for(@group, :url => {:action => 'update_group', :id => @group}) do |@form|
|
- form_for [:foodcoop, @workgroup] do |@form|
|
||||||
= render :partial => "shared/group_form"
|
= render :partial => "shared/group_form"
|
||||||
|
|
||||||
%p{:style => "clear:both"}
|
%p{:style => "clear:both"}
|
||||||
= submit_tag 'Speichern'
|
= submit_tag 'Speichern'
|
||||||
|
|
|
|
||||||
= link_to "Abbrechen", :action => "workgroups"
|
= link_to "Abbrechen", foodcoop_workgroups_path
|
|
@ -6,7 +6,7 @@
|
||||||
%br/
|
%br/
|
||||||
Wenn du einer Gruppe beitreten willst, dann schreib doch den Mitgliedern eine Nachricht.
|
Wenn du einer Gruppe beitreten willst, dann schreib doch den Mitgliedern eine Nachricht.
|
||||||
|
|
||||||
= render :partial => "workgroup", :collection => @groups
|
= render :partial => "workgroup", :collection => @workgroups
|
||||||
|
|
||||||
|
|
||||||
|
|
1
app/views/foodcoop/workgroups/memberships.html.haml
Normal file
1
app/views/foodcoop/workgroups/memberships.html.haml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
= render "shared/memberships/members"
|
|
@ -8,7 +8,8 @@
|
||||||
{ :name => "Mein Profil", :url => "/home/profile"}
|
{ :name => "Mein Profil", :url => "/home/profile"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ :name => "Foodcoop", :url => "/tasks", :active => ["foodcoop", "tasks", "messages", "foodcoop/ordergroups"],
|
{ :name => "Foodcoop", :url => "/tasks",
|
||||||
|
:active => ["foodcoop", "tasks", "messages", "foodcoop/ordergroups", "foodcoop/workgroups"],
|
||||||
:subnav => [
|
:subnav => [
|
||||||
{ :name => "Mitglieder", :url => "/foodcoop/members"},
|
{ :name => "Mitglieder", :url => "/foodcoop/members"},
|
||||||
{ :name => "Abeitsgruppen", :url => "/foodcoop/workgroups"},
|
{ :name => "Abeitsgruppen", :url => "/foodcoop/workgroups"},
|
||||||
|
|
88
app/views/workgroups/edit.html.erb
Normal file
88
app/views/workgroups/edit.html.erb
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
<% title "Edit Workgroup" %>
|
||||||
|
|
||||||
|
<% form_for @workgroup do |f| %>
|
||||||
|
<%= f.error_messages %>
|
||||||
|
<p>
|
||||||
|
<%= f.label :type %><br />
|
||||||
|
<%= f.text_field :type %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :name %><br />
|
||||||
|
<%= f.text_field :name %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :description %><br />
|
||||||
|
<%= f.text_field :description %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :account_balance %><br />
|
||||||
|
<%= f.text_field :account_balance %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :account_updated %><br />
|
||||||
|
<%= f.datetime_select :account_updated %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :created_on %><br />
|
||||||
|
<%= f.datetime_select :created_on %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :role_admin %><br />
|
||||||
|
<%= f.check_box :role_admin %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :role_suppliers %><br />
|
||||||
|
<%= f.check_box :role_suppliers %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :role_article_meta %><br />
|
||||||
|
<%= f.check_box :role_article_meta %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :role_finance %><br />
|
||||||
|
<%= f.check_box :role_finance %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :role_orders %><br />
|
||||||
|
<%= f.check_box :role_orders %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :weekly_task %><br />
|
||||||
|
<%= f.check_box :weekly_task %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :weekday %><br />
|
||||||
|
<%= f.text_field :weekday %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :task_name %><br />
|
||||||
|
<%= f.text_field :task_name %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :task_description %><br />
|
||||||
|
<%= f.text_field :task_description %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :task_required_users %><br />
|
||||||
|
<%= f.text_field :task_required_users %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :deleted_at %><br />
|
||||||
|
<%= f.datetime_select :deleted_at %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :contact_person %><br />
|
||||||
|
<%= f.text_field :contact_person %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :contact_phone %><br />
|
||||||
|
<%= f.text_field :contact_phone %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= f.label :contact_address %><br />
|
||||||
|
<%= f.text_field :contact_address %>
|
||||||
|
</p>
|
||||||
|
<p><%= f.submit "Submit" %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
52
app/views/workgroups/index.html.erb
Normal file
52
app/views/workgroups/index.html.erb
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
<% title "Workgroups" %>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Account Balance</th>
|
||||||
|
<th>Account Updated</th>
|
||||||
|
<th>Created On</th>
|
||||||
|
<th>Role Admin</th>
|
||||||
|
<th>Role Suppliers</th>
|
||||||
|
<th>Role Article Meta</th>
|
||||||
|
<th>Role Finance</th>
|
||||||
|
<th>Role Orders</th>
|
||||||
|
<th>Weekly Task</th>
|
||||||
|
<th>Weekday</th>
|
||||||
|
<th>Task Name</th>
|
||||||
|
<th>Task Description</th>
|
||||||
|
<th>Task Required Users</th>
|
||||||
|
<th>Deleted At</th>
|
||||||
|
<th>Contact Person</th>
|
||||||
|
<th>Contact Phone</th>
|
||||||
|
<th>Contact Address</th>
|
||||||
|
</tr>
|
||||||
|
<% for workgroup in @workgroups %>
|
||||||
|
<tr>
|
||||||
|
<td><%=h workgroup.type %></td>
|
||||||
|
<td><%=h workgroup.name %></td>
|
||||||
|
<td><%=h workgroup.description %></td>
|
||||||
|
<td><%=h workgroup.account_balance %></td>
|
||||||
|
<td><%=h workgroup.account_updated %></td>
|
||||||
|
<td><%=h workgroup.created_on %></td>
|
||||||
|
<td><%=h workgroup.role_admin %></td>
|
||||||
|
<td><%=h workgroup.role_suppliers %></td>
|
||||||
|
<td><%=h workgroup.role_article_meta %></td>
|
||||||
|
<td><%=h workgroup.role_finance %></td>
|
||||||
|
<td><%=h workgroup.role_orders %></td>
|
||||||
|
<td><%=h workgroup.weekly_task %></td>
|
||||||
|
<td><%=h workgroup.weekday %></td>
|
||||||
|
<td><%=h workgroup.task_name %></td>
|
||||||
|
<td><%=h workgroup.task_description %></td>
|
||||||
|
<td><%=h workgroup.task_required_users %></td>
|
||||||
|
<td><%=h workgroup.deleted_at %></td>
|
||||||
|
<td><%=h workgroup.contact_person %></td>
|
||||||
|
<td><%=h workgroup.contact_phone %></td>
|
||||||
|
<td><%=h workgroup.contact_address %></td>
|
||||||
|
<td><%= link_to "Edit", edit_workgroup_path(workgroup) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
|
@ -13,6 +13,8 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
map.namespace :foodcoop do |foodcoop|
|
map.namespace :foodcoop do |foodcoop|
|
||||||
foodcoop.root :controller => "foodcoop", :action => "members"
|
foodcoop.root :controller => "foodcoop", :action => "members"
|
||||||
foodcoop.resources :ordergroups, :only => [:index]
|
foodcoop.resources :ordergroups, :only => [:index]
|
||||||
|
foodcoop.resources :workgroups, :only => [:index, :edit, :update],
|
||||||
|
:member => {:memberships => :get}
|
||||||
end
|
end
|
||||||
|
|
||||||
map.namespace :admin do |admin|
|
map.namespace :admin do |admin|
|
||||||
|
|
Loading…
Reference in a new issue