summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/group_memberships_controller.rb51
-rw-r--r--app/controllers/group_permissions_controller.rb48
-rw-r--r--app/controllers/groups_controller.rb49
-rw-r--r--app/helpers/group_memberships_helper.rb2
-rw-r--r--app/helpers/group_permissions_helper.rb2
-rw-r--r--app/helpers/groups_helper.rb2
-rw-r--r--app/models/group.rb11
-rw-r--r--app/models/group_membership.rb37
-rw-r--r--app/models/group_permission.rb24
-rw-r--r--app/views/group_memberships/_form.html.haml7
-rw-r--r--app/views/group_memberships/_form_core.html.haml4
-rw-r--r--app/views/group_memberships/_index_core.html.haml11
-rw-r--r--app/views/group_memberships/edit.html.haml3
-rw-r--r--app/views/group_memberships/index.html.haml6
-rw-r--r--app/views/group_memberships/new.html.haml3
-rw-r--r--app/views/group_memberships/show.html.haml10
-rw-r--r--app/views/group_permissions/_form.html.haml7
-rw-r--r--app/views/group_permissions/_form_core.html.haml3
-rw-r--r--app/views/group_permissions/_index_core.html.haml11
-rw-r--r--app/views/group_permissions/edit.html.haml3
-rw-r--r--app/views/group_permissions/index.html.haml6
-rw-r--r--app/views/group_permissions/new.html.haml3
-rw-r--r--app/views/group_permissions/show.html.haml10
-rw-r--r--app/views/groups/_form.html.haml7
-rw-r--r--app/views/groups/_form_core.html.haml4
-rw-r--r--app/views/groups/_index_core.html.haml13
-rw-r--r--app/views/groups/edit.html.haml3
-rw-r--r--app/views/groups/index.html.haml6
-rw-r--r--app/views/groups/new.html.haml3
-rw-r--r--app/views/groups/show.html.haml25
-rw-r--r--config/locales/views/group_memberships/de.yml50
-rw-r--r--config/locales/views/group_memberships/en.yml50
-rw-r--r--config/locales/views/group_permissions/de.yml50
-rw-r--r--config/locales/views/group_permissions/en.yml50
-rw-r--r--config/locales/views/groups/de.yml50
-rw-r--r--config/locales/views/groups/en.yml50
-rw-r--r--config/routes.rb5
-rw-r--r--db/migrate/20130222074610_create_groups.rb14
-rw-r--r--db/migrate/20130222074652_create_group_memberships.rb14
-rw-r--r--db/migrate/20130222092313_create_group_permissions.rb14
-rw-r--r--test/functional/group_memberships_controller_test.rb49
-rw-r--r--test/functional/group_permissions_controller_test.rb49
-rw-r--r--test/functional/groups_controller_test.rb49
-rw-r--r--test/unit/group_membership_test.rb7
-rw-r--r--test/unit/group_permission_test.rb7
-rw-r--r--test/unit/group_test.rb7
46 files changed, 889 insertions, 0 deletions
diff --git a/app/controllers/group_memberships_controller.rb b/app/controllers/group_memberships_controller.rb
new file mode 100644
index 0000000..df9f6b3
--- /dev/null
+++ b/app/controllers/group_memberships_controller.rb
@@ -0,0 +1,51 @@
+class GroupMembershipsController < ApplicationController
+ load_and_authorize_resource :group
+ load_and_authorize_resource :group_membership, :through => [:group]
+
+ def index
+ end
+
+ def show
+ end
+
+ def new
+ end
+
+ def create
+ if params[:group_membership][:item_type].blank?
+ params[:group_membership][:item_type] = @group.group_memberships.first.item_type
+ end
+ @group_membership = @group.group_memberships.new(params[:group_membership])
+ if @group_membership.save
+ redirect_to action: "index", :notice => t('group_memberships.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ end
+
+ def update
+ if @group_membership.update_attributes(params[:group_membership])
+ redirect_to action: "index", :notice => t('group_memberships.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @group_membership.destroy
+ redirect_to action: "index", :notice => t('group_memberships.controller.successfuly_destroyed')
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("groups.index.page_title"), groups_path
+ add_breadcrumb @group, group_path(@group)
+ add_breadcrumb t("group_memberships.index.page_title"), group_group_memberships_path(@group)
+ if @group_membership && !@group_membership.new_record?
+ add_breadcrumb @group_membership, group_group_membership_path(@group, @group_membership)
+ end
+ end
+end
diff --git a/app/controllers/group_permissions_controller.rb b/app/controllers/group_permissions_controller.rb
new file mode 100644
index 0000000..3abdc51
--- /dev/null
+++ b/app/controllers/group_permissions_controller.rb
@@ -0,0 +1,48 @@
+class GroupPermissionsController < ApplicationController
+ load_and_authorize_resource :group
+ load_and_authorize_resource :group_permission, :through => [:group]
+
+ def index
+ end
+
+ def show
+ end
+
+ def new
+ end
+
+ def create
+ @group_permission = @group.group_permissions.new(params[:group_permission])
+ if @group_permission.save
+ redirect_to action: "index", :notice => t('group_permissions.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ end
+
+ def update
+ if @group_permission.update_attributes(params[:group_permission])
+ redirect_to action: "index", :notice => t('group_permissions.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @group_permission.destroy
+ redirect_to action: "index", :notice => t('group_permissions.controller.successfuly_destroyed')
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("groups.index.page_title"), groups_path
+ add_breadcrumb @group, group_path(@group)
+ add_breadcrumb t("group_permissions.index.page_title"), group_group_permissions_path(@group)
+ if @group_permission && !@group_permission.new_record?
+ add_breadcrumb @group_permission, group_group_permission_path(@group, @group_permission)
+ end
+ end
+end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
new file mode 100644
index 0000000..1ab7a4f
--- /dev/null
+++ b/app/controllers/groups_controller.rb
@@ -0,0 +1,49 @@
+class GroupsController < ApplicationController
+ def index
+ @groups = Group.all
+ end
+
+ def show
+ @group = Group.find(params[:id])
+ end
+
+ def new
+ @group = Group.new
+ end
+
+ def create
+ @group = Group.new(params[:group])
+ if @group.save
+ redirect_to @group, :notice => t('groups.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @group = Group.find(params[:id])
+ end
+
+ def update
+ @group = Group.find(params[:id])
+ if @group.update_attributes(params[:group])
+ redirect_to @group, :notice => t('groups.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @group = Group.find(params[:id])
+ @group.destroy
+ redirect_to groups_url, :notice => t('groups.controller.successfuly_destroyed')
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("groups.index.page_title"), groups_path
+ if @group && !@group.new_record?
+ add_breadcrumb @group, @group
+ end
+ end
+end
diff --git a/app/helpers/group_memberships_helper.rb b/app/helpers/group_memberships_helper.rb
new file mode 100644
index 0000000..837bafd
--- /dev/null
+++ b/app/helpers/group_memberships_helper.rb
@@ -0,0 +1,2 @@
+module GroupMembershipsHelper
+end
diff --git a/app/helpers/group_permissions_helper.rb b/app/helpers/group_permissions_helper.rb
new file mode 100644
index 0000000..45571d0
--- /dev/null
+++ b/app/helpers/group_permissions_helper.rb
@@ -0,0 +1,2 @@
+module GroupPermissionsHelper
+end
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
new file mode 100644
index 0000000..c091b2f
--- /dev/null
+++ b/app/helpers/groups_helper.rb
@@ -0,0 +1,2 @@
+module GroupsHelper
+end
diff --git a/app/models/group.rb b/app/models/group.rb
new file mode 100644
index 0000000..e0cfaab
--- /dev/null
+++ b/app/models/group.rb
@@ -0,0 +1,11 @@
+class Group < ActiveRecord::Base
+ attr_accessible :name, :active, :comment
+
+ has_many :group_memberships, :dependent => :destroy
+ has_many :group_permissions, :dependent => :destroy
+ has_many :permittances, :foreign_key => :target_group_id, :class_name => "GroupPermission", :dependent => :destroy
+
+ def to_s
+ self.name
+ end
+end
diff --git a/app/models/group_membership.rb b/app/models/group_membership.rb
new file mode 100644
index 0000000..0f04ae1
--- /dev/null
+++ b/app/models/group_membership.rb
@@ -0,0 +1,37 @@
+class GroupMembership < ActiveRecord::Base
+ attr_accessible :group_id, :item_type, :item_id
+
+ belongs_to :group
+ belongs_to :item, :polymorphic => true
+
+ validates :item_id,
+ :presence => true,
+ :uniqueness => { :scope => [:group_id, :item_type] }
+
+ validates :item_type,
+ :presence => true,
+ :uniqueness => { :scope => [:group_id, :item_id] }
+
+ validate :validate_item_type_consitency
+
+ validates :item,
+ :presence => true
+
+ def to_s
+ "#{self.item_type}: #{self.item}"
+ end
+
+ def item_type_allowed
+ fist_item = self.group.group_memberships.first.try(:item)
+ if fist_item
+ return fist_item.class.name
+ end
+ end
+
+ def validate_item_type_consitency
+ type_allowed = self.item_type_allowed
+ if type_allowed && type_allowed != self.item_type
+ errors.add(:item_type, "must be of type: #{type_allowed}")
+ end
+ end
+end
diff --git a/app/models/group_permission.rb b/app/models/group_permission.rb
new file mode 100644
index 0000000..fe988ba
--- /dev/null
+++ b/app/models/group_permission.rb
@@ -0,0 +1,24 @@
+class GroupPermission < ActiveRecord::Base
+ attr_accessible :group_id, :permission, :target_group_id
+
+ PERMISSION_TYPES = ['pickup']
+
+ belongs_to :group
+ belongs_to :target_group, :class_name => "Group"
+
+ validates :target_group_id,
+ :presence => true,
+ :uniqueness => { :scope => [:group_id, :permission] }
+
+ validates :target_group,
+ :presence => true
+
+ validates :permission,
+ :presence => true,
+ :uniqueness => { :scope => [:group_id, :target_group_id] },
+ :inclusion => { :in => PERMISSION_TYPES }
+
+ def to_s
+ "#{self.permission} => #{self.target_group}"
+ end
+end
diff --git a/app/views/group_memberships/_form.html.haml b/app/views/group_memberships/_form.html.haml
new file mode 100644
index 0000000..c8a6a51
--- /dev/null
+++ b/app/views/group_memberships/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for([@group, @group_membership]) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('group_memberships.form.submit')
diff --git a/app/views/group_memberships/_form_core.html.haml b/app/views/group_memberships/_form_core.html.haml
new file mode 100644
index 0000000..4a28a06
--- /dev/null
+++ b/app/views/group_memberships/_form_core.html.haml
@@ -0,0 +1,4 @@
+.inputs
+ - if @group.group_memberships.count < 1
+ = f.input :item_type, :label => t('group_memberships.form.item_type.label'), :hint => conditional_hint('group_memberships.form.item_type.hint')
+ = f.input :item_id, :label => t('group_memberships.form.item_id.label'), :hint => conditional_hint('group_memberships.form.item_id.hint')
diff --git a/app/views/group_memberships/_index_core.html.haml b/app/views/group_memberships/_index_core.html.haml
new file mode 100644
index 0000000..beeefc9
--- /dev/null
+++ b/app/views/group_memberships/_index_core.html.haml
@@ -0,0 +1,11 @@
+%table.table.table-striped
+ %tr
+ %th= t('group_memberships.index.item_type')
+ %th= t('group_memberships.index.item_id')
+
+
+ - for group_membership in group_memberships
+ %tr
+ %td= group_membership.item_type
+ %td= group_membership.item_id
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => group_membership.group, :child => group_membership}
diff --git a/app/views/group_memberships/edit.html.haml b/app/views/group_memberships/edit.html.haml
new file mode 100644
index 0000000..643c095
--- /dev/null
+++ b/app/views/group_memberships/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("group_memberships.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/group_memberships/index.html.haml b/app/views/group_memberships/index.html.haml
new file mode 100644
index 0000000..b493017
--- /dev/null
+++ b/app/views/group_memberships/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("group_memberships.index.page_title")
+
+- if @group_memberships && @group_memberships.count > 0
+ = render "index_core", :group_memberships => @group_memberships
+
+= render :partial => 'shared/create_link', :locals => {:parent => @group, :child_class => GroupMembership}
diff --git a/app/views/group_memberships/new.html.haml b/app/views/group_memberships/new.html.haml
new file mode 100644
index 0000000..6cf2ce7
--- /dev/null
+++ b/app/views/group_memberships/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("group_memberships.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/group_memberships/show.html.haml b/app/views/group_memberships/show.html.haml
new file mode 100644
index 0000000..0875f0b
--- /dev/null
+++ b/app/views/group_memberships/show.html.haml
@@ -0,0 +1,10 @@
+- content_for :title, t("group_memberships.show.page_title")
+
+%p
+ %strong= t('group_memberships.show.item_type') + ":"
+ = @group_membership.item_type
+%p
+ %strong= t('group_memberships.show.item_id') + ":"
+ = @group_membership.item_id
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @group, :child => @group_membership }
diff --git a/app/views/group_permissions/_form.html.haml b/app/views/group_permissions/_form.html.haml
new file mode 100644
index 0000000..5f593f2
--- /dev/null
+++ b/app/views/group_permissions/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for([@group, @group_permission]) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('group_permissions.form.submit')
diff --git a/app/views/group_permissions/_form_core.html.haml b/app/views/group_permissions/_form_core.html.haml
new file mode 100644
index 0000000..49c9e7c
--- /dev/null
+++ b/app/views/group_permissions/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.input :permission, :collection => GroupPermission::PERMISSION_TYPES, :label => t('group_permissions.form.permission.label'), :hint => conditional_hint('group_permissions.form.permission.hint'), :include_blank => false
+ = f.input :target_group_id, :collection => Group.all.collect, :label => t('group_permissions.form.target_group_id.label'), :hint => conditional_hint('group_permissions.form.target_group_id.hint'), :include_blank => false
diff --git a/app/views/group_permissions/_index_core.html.haml b/app/views/group_permissions/_index_core.html.haml
new file mode 100644
index 0000000..ad06b38
--- /dev/null
+++ b/app/views/group_permissions/_index_core.html.haml
@@ -0,0 +1,11 @@
+%table.table.table-striped
+ %tr
+ %th= t('group_permissions.index.permission')
+ %th= t('group_permissions.index.target_group_id')
+
+
+ - for group_permission in group_permissions
+ %tr
+ %td= group_permission.permission
+ %td= group_permission.target_group
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => group_permission.group, :child => group_permission}
diff --git a/app/views/group_permissions/edit.html.haml b/app/views/group_permissions/edit.html.haml
new file mode 100644
index 0000000..c673eea
--- /dev/null
+++ b/app/views/group_permissions/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("group_permissions.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/group_permissions/index.html.haml b/app/views/group_permissions/index.html.haml
new file mode 100644
index 0000000..0bc0c37
--- /dev/null
+++ b/app/views/group_permissions/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("group_permissions.index.page_title")
+
+- if @group_permissions && @group_permissions.count > 0
+ = render "index_core", :group_permissions => @group_permissions
+
+= render :partial => 'shared/create_link', :locals => {:parent => @group, :child_class => GroupPermission} \ No newline at end of file
diff --git a/app/views/group_permissions/new.html.haml b/app/views/group_permissions/new.html.haml
new file mode 100644
index 0000000..8012273
--- /dev/null
+++ b/app/views/group_permissions/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("group_permissions.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/group_permissions/show.html.haml b/app/views/group_permissions/show.html.haml
new file mode 100644
index 0000000..402c5ce
--- /dev/null
+++ b/app/views/group_permissions/show.html.haml
@@ -0,0 +1,10 @@
+- content_for :title, t("group_permissions.show.page_title")
+
+%p
+ %strong= t('group_permissions.show.permission') + ":"
+ = @group_permission.permission
+%p
+ %strong= t('group_permissions.show.target_group_id') + ":"
+ = @group_permission.target_group_id
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @group, :child => @group_permission }
diff --git a/app/views/groups/_form.html.haml b/app/views/groups/_form.html.haml
new file mode 100644
index 0000000..f5bdece
--- /dev/null
+++ b/app/views/groups/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@group) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('groups.form.submit')
diff --git a/app/views/groups/_form_core.html.haml b/app/views/groups/_form_core.html.haml
new file mode 100644
index 0000000..1f9a39f
--- /dev/null
+++ b/app/views/groups/_form_core.html.haml
@@ -0,0 +1,4 @@
+.inputs
+ = f.input :name, :label => t('groups.form.name.label'), :hint => conditional_hint('groups.form.name.hint')
+ = f.input :active, :label => t('groups.form.active.label'), :hint => conditional_hint('groups.form.active.hint')
+ = f.input :comment, :label => t('groups.form.comment.label'), :hint => conditional_hint('groups.form.comment.hint')
diff --git a/app/views/groups/_index_core.html.haml b/app/views/groups/_index_core.html.haml
new file mode 100644
index 0000000..d99874a
--- /dev/null
+++ b/app/views/groups/_index_core.html.haml
@@ -0,0 +1,13 @@
+%table.table.table-striped
+ %tr
+ %th= t('groups.index.name')
+ %th= t('groups.index.active')
+ %th= t('groups.index.comment')
+
+
+ - for group in groups
+ %tr
+ %td= group.name
+ %td= group.active
+ %td= group.comment
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => group} \ No newline at end of file
diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml
new file mode 100644
index 0000000..7a3f784
--- /dev/null
+++ b/app/views/groups/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("groups.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/groups/index.html.haml b/app/views/groups/index.html.haml
new file mode 100644
index 0000000..7984b9e
--- /dev/null
+++ b/app/views/groups/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("groups.index.page_title")
+
+- if @groups && @groups.count > 0
+ = render "index_core", :groups => @groups
+
+= render :partial => 'shared/create_link', :locals => {:child_class => Group} \ No newline at end of file
diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml
new file mode 100644
index 0000000..e8017a8
--- /dev/null
+++ b/app/views/groups/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("groups.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml
new file mode 100644
index 0000000..fc291f3
--- /dev/null
+++ b/app/views/groups/show.html.haml
@@ -0,0 +1,25 @@
+- content_for :title, t("groups.show.page_title")
+
+%p
+ %strong= t('groups.show.name') + ":"
+ = @group.name
+%p
+ %strong= t('groups.show.active') + ":"
+ = @group.active
+%p
+ %strong= t('groups.show.comment') + ":"
+ = @group.comment
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @group }
+
+%h3= t('group_permissions.index.page_title')
+- if @group.group_permissions.any?
+ = render "group_permissions/index_core", :group_permissions => @group.group_permissions
+ %br
+= render :partial => 'shared/create_link', :locals => { :parent => @group, :child_class => GroupPermission }
+
+%h3= t('group_memberships.index.page_title')
+- if @group.group_memberships.any?
+ = render "group_memberships/index_core", :group_memberships => @group.group_memberships
+ %br
+= render :partial => 'shared/create_link', :locals => { :parent => @group, :child_class => GroupMembership }
diff --git a/config/locales/views/group_memberships/de.yml b/config/locales/views/group_memberships/de.yml
new file mode 100644
index 0000000..7fdc100
--- /dev/null
+++ b/config/locales/views/group_memberships/de.yml
@@ -0,0 +1,50 @@
+de:
+ group_memberships:
+ name: 'Groupmembership'
+ controller:
+ successfuly_created: 'Groupmembership wurde angelegt.'
+ successfuly_updated: 'Groupmembership wurde aktualisiert.'
+ successfuly_destroyed: 'Groupmembership wurde gelöscht.'
+ index:
+ page_title: 'Übersicht von Groupmembership'
+ group_id: 'Group'
+ item_type: 'Item type'
+ item_id: 'Item'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Groupmembership'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ show: 'Anzeigen'
+ create: 'Neu anlegen'
+ create_for: 'Groupmembership neu anlegen für %{resource}'
+ show:
+ page_title: 'Groupmembership bearbeiten'
+ group_id: 'Group'
+ item_type: 'Item type'
+ item_id: 'Item'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ new:
+ page_title: 'Groupmembership neu anlegen'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit:
+ page_title: 'Groupmembership bearbeiten'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ form:
+ group_id:
+ label: 'Group'
+ hint: ''
+ item_type:
+ label: 'Item type'
+ hint: ''
+ item_id:
+ label: 'Item'
+ hint: ''
+ submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/group_memberships/en.yml b/config/locales/views/group_memberships/en.yml
new file mode 100644
index 0000000..35740a3
--- /dev/null
+++ b/config/locales/views/group_memberships/en.yml
@@ -0,0 +1,50 @@
+en:
+ group_memberships:
+ name: 'Groupmembership'
+ controller:
+ successfuly_created: 'Successfully created Groupmembership.'
+ successfuly_updated: 'Successfully updated Groupmembership.'
+ successfuly_destroyed: 'Successfully destroyed Groupmembership.'
+ index:
+ page_title: 'Listing Groupmembership'
+ group_id: 'Group'
+ item_type: 'Item type'
+ item_id: 'Item'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this Groupmembership?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ show: 'View'
+ create: 'New'
+ create_for: 'New Groupmembership for %{resource}'
+ show:
+ page_title: 'Show Groupmembership'
+ group_id: 'Group'
+ item_type: 'Item type'
+ item_id: 'Item'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this element?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ view_all: 'View All'
+ new:
+ page_title: 'New Groupmembership'
+ actions:
+ back_to_list: 'Back to Index'
+ edit:
+ page_title: 'Editing Groupmembership'
+ actions:
+ back_to_list: 'Back to Index'
+ edit: 'Edit'
+ view_all: 'View All'
+ form:
+ group_id:
+ label: 'Group'
+ hint: ''
+ item_type:
+ label: 'Item type'
+ hint: ''
+ item_id:
+ label: 'Item'
+ hint: ''
+ submit: 'Submit' \ No newline at end of file
diff --git a/config/locales/views/group_permissions/de.yml b/config/locales/views/group_permissions/de.yml
new file mode 100644
index 0000000..c075830
--- /dev/null
+++ b/config/locales/views/group_permissions/de.yml
@@ -0,0 +1,50 @@
+de:
+ group_permissions:
+ name: 'Grouppermission'
+ controller:
+ successfuly_created: 'Grouppermission wurde angelegt.'
+ successfuly_updated: 'Grouppermission wurde aktualisiert.'
+ successfuly_destroyed: 'Grouppermission wurde gelöscht.'
+ index:
+ page_title: 'Übersicht von Grouppermission'
+ group_id: 'Group'
+ permission: 'Permission'
+ target_group_id: 'Target group'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Grouppermission'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ show: 'Anzeigen'
+ create: 'Neu anlegen'
+ create_for: 'Grouppermission neu anlegen für %{resource}'
+ show:
+ page_title: 'Grouppermission bearbeiten'
+ group_id: 'Group'
+ permission: 'Permission'
+ target_group_id: 'Target group'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ new:
+ page_title: 'Grouppermission neu anlegen'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit:
+ page_title: 'Grouppermission bearbeiten'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ form:
+ group_id:
+ label: 'Group'
+ hint: ''
+ permission:
+ label: 'Permission'
+ hint: ''
+ target_group_id:
+ label: 'Target group'
+ hint: ''
+ submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/group_permissions/en.yml b/config/locales/views/group_permissions/en.yml
new file mode 100644
index 0000000..2a5f48e
--- /dev/null
+++ b/config/locales/views/group_permissions/en.yml
@@ -0,0 +1,50 @@
+en:
+ group_permissions:
+ name: 'Grouppermission'
+ controller:
+ successfuly_created: 'Successfully created Grouppermission.'
+ successfuly_updated: 'Successfully updated Grouppermission.'
+ successfuly_destroyed: 'Successfully destroyed Grouppermission.'
+ index:
+ page_title: 'Listing Grouppermission'
+ group_id: 'Group'
+ permission: 'Permission'
+ target_group_id: 'Target group'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this Grouppermission?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ show: 'View'
+ create: 'New'
+ create_for: 'New Grouppermission for %{resource}'
+ show:
+ page_title: 'Show Grouppermission'
+ group_id: 'Group'
+ permission: 'Permission'
+ target_group_id: 'Target group'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this element?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ view_all: 'View All'
+ new:
+ page_title: 'New Grouppermission'
+ actions:
+ back_to_list: 'Back to Index'
+ edit:
+ page_title: 'Editing Grouppermission'
+ actions:
+ back_to_list: 'Back to Index'
+ edit: 'Edit'
+ view_all: 'View All'
+ form:
+ group_id:
+ label: 'Group'
+ hint: ''
+ permission:
+ label: 'Permission'
+ hint: ''
+ target_group_id:
+ label: 'Target group'
+ hint: ''
+ submit: 'Submit' \ No newline at end of file
diff --git a/config/locales/views/groups/de.yml b/config/locales/views/groups/de.yml
new file mode 100644
index 0000000..fc60a72
--- /dev/null
+++ b/config/locales/views/groups/de.yml
@@ -0,0 +1,50 @@
+de:
+ groups:
+ name: 'Group'
+ controller:
+ successfuly_created: 'Group wurde angelegt.'
+ successfuly_updated: 'Group wurde aktualisiert.'
+ successfuly_destroyed: 'Group wurde gelöscht.'
+ index:
+ page_title: 'Übersicht von Group'
+ name: 'Name'
+ active: 'Active'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Group'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ show: 'Anzeigen'
+ create: 'Neu anlegen'
+ create_for: 'Group neu anlegen für %{resource}'
+ show:
+ page_title: 'Group bearbeiten'
+ name: 'Name'
+ active: 'Active'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ new:
+ page_title: 'Group neu anlegen'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit:
+ page_title: 'Group bearbeiten'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ form:
+ name:
+ label: 'Name'
+ hint: ''
+ active:
+ label: 'Active'
+ hint: ''
+ comment:
+ label: 'Comment'
+ hint: ''
+ submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/groups/en.yml b/config/locales/views/groups/en.yml
new file mode 100644
index 0000000..a7fb666
--- /dev/null
+++ b/config/locales/views/groups/en.yml
@@ -0,0 +1,50 @@
+en:
+ groups:
+ name: 'Group'
+ controller:
+ successfuly_created: 'Successfully created Group.'
+ successfuly_updated: 'Successfully updated Group.'
+ successfuly_destroyed: 'Successfully destroyed Group.'
+ index:
+ page_title: 'Listing Group'
+ name: 'Name'
+ active: 'Active'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this Group?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ show: 'View'
+ create: 'New'
+ create_for: 'New Group for %{resource}'
+ show:
+ page_title: 'Show Group'
+ name: 'Name'
+ active: 'Active'
+ comment: 'Comment'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this element?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ view_all: 'View All'
+ new:
+ page_title: 'New Group'
+ actions:
+ back_to_list: 'Back to Index'
+ edit:
+ page_title: 'Editing Group'
+ actions:
+ back_to_list: 'Back to Index'
+ edit: 'Edit'
+ view_all: 'View All'
+ form:
+ name:
+ label: 'Name'
+ hint: ''
+ active:
+ label: 'Active'
+ hint: ''
+ comment:
+ label: 'Comment'
+ hint: ''
+ submit: 'Submit' \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 65a9ac2..ce0566c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,10 @@
Gemeinschaft42c::Application.routes.draw do
+ resources :groups do
+ resources :group_memberships
+ resources :group_permissions
+ end
+
resources :sim_card_providers do
resources :sim_cards, :except => [:edit, :update]
end
diff --git a/db/migrate/20130222074610_create_groups.rb b/db/migrate/20130222074610_create_groups.rb
new file mode 100644
index 0000000..e5848b9
--- /dev/null
+++ b/db/migrate/20130222074610_create_groups.rb
@@ -0,0 +1,14 @@
+class CreateGroups < ActiveRecord::Migration
+ def self.up
+ create_table :groups do |t|
+ t.string :name
+ t.boolean :active
+ t.string :comment
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :groups
+ end
+end
diff --git a/db/migrate/20130222074652_create_group_memberships.rb b/db/migrate/20130222074652_create_group_memberships.rb
new file mode 100644
index 0000000..e572445
--- /dev/null
+++ b/db/migrate/20130222074652_create_group_memberships.rb
@@ -0,0 +1,14 @@
+class CreateGroupMemberships < ActiveRecord::Migration
+ def self.up
+ create_table :group_memberships do |t|
+ t.integer :group_id
+ t.string :item_type
+ t.integer :item_id
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :group_memberships
+ end
+end
diff --git a/db/migrate/20130222092313_create_group_permissions.rb b/db/migrate/20130222092313_create_group_permissions.rb
new file mode 100644
index 0000000..5949819
--- /dev/null
+++ b/db/migrate/20130222092313_create_group_permissions.rb
@@ -0,0 +1,14 @@
+class CreateGroupPermissions < ActiveRecord::Migration
+ def self.up
+ create_table :group_permissions do |t|
+ t.integer :group_id
+ t.string :permission
+ t.integer :target_group_id
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :group_permissions
+ end
+end
diff --git a/test/functional/group_memberships_controller_test.rb b/test/functional/group_memberships_controller_test.rb
new file mode 100644
index 0000000..596de1f
--- /dev/null
+++ b/test/functional/group_memberships_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GroupMembershipsControllerTest < ActionController::TestCase
+ setup do
+ @group_membership = group_memberships(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:group_memberships)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create group_membership" do
+ assert_difference('GroupMembership.count') do
+ post :create, group_membership: @group_membership.attributes
+ end
+
+ assert_redirected_to group_membership_path(assigns(:group_membership))
+ end
+
+ test "should show group_membership" do
+ get :show, id: @group_membership.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @group_membership.to_param
+ assert_response :success
+ end
+
+ test "should update group_membership" do
+ put :update, id: @group_membership.to_param, group_membership: @group_membership.attributes
+ assert_redirected_to group_membership_path(assigns(:group_membership))
+ end
+
+ test "should destroy group_membership" do
+ assert_difference('GroupMembership.count', -1) do
+ delete :destroy, id: @group_membership.to_param
+ end
+
+ assert_redirected_to group_memberships_path
+ end
+end
diff --git a/test/functional/group_permissions_controller_test.rb b/test/functional/group_permissions_controller_test.rb
new file mode 100644
index 0000000..4b70ae3
--- /dev/null
+++ b/test/functional/group_permissions_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GroupPermissionsControllerTest < ActionController::TestCase
+ setup do
+ @group_permission = group_permissions(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:group_permissions)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create group_permission" do
+ assert_difference('GroupPermission.count') do
+ post :create, group_permission: @group_permission.attributes
+ end
+
+ assert_redirected_to group_permission_path(assigns(:group_permission))
+ end
+
+ test "should show group_permission" do
+ get :show, id: @group_permission.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @group_permission.to_param
+ assert_response :success
+ end
+
+ test "should update group_permission" do
+ put :update, id: @group_permission.to_param, group_permission: @group_permission.attributes
+ assert_redirected_to group_permission_path(assigns(:group_permission))
+ end
+
+ test "should destroy group_permission" do
+ assert_difference('GroupPermission.count', -1) do
+ delete :destroy, id: @group_permission.to_param
+ end
+
+ assert_redirected_to group_permissions_path
+ end
+end
diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb
new file mode 100644
index 0000000..2981018
--- /dev/null
+++ b/test/functional/groups_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GroupsControllerTest < ActionController::TestCase
+ setup do
+ @group = groups(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:groups)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create group" do
+ assert_difference('Group.count') do
+ post :create, group: @group.attributes
+ end
+
+ assert_redirected_to group_path(assigns(:group))
+ end
+
+ test "should show group" do
+ get :show, id: @group.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @group.to_param
+ assert_response :success
+ end
+
+ test "should update group" do
+ put :update, id: @group.to_param, group: @group.attributes
+ assert_redirected_to group_path(assigns(:group))
+ end
+
+ test "should destroy group" do
+ assert_difference('Group.count', -1) do
+ delete :destroy, id: @group.to_param
+ end
+
+ assert_redirected_to groups_path
+ end
+end
diff --git a/test/unit/group_membership_test.rb b/test/unit/group_membership_test.rb
new file mode 100644
index 0000000..3719323
--- /dev/null
+++ b/test/unit/group_membership_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class GroupMembershipTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert GroupMembership.new.valid?
+ end
+end
diff --git a/test/unit/group_permission_test.rb b/test/unit/group_permission_test.rb
new file mode 100644
index 0000000..44e0b28
--- /dev/null
+++ b/test/unit/group_permission_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class GroupPermissionTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert GroupPermission.new.valid?
+ end
+end
diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb
new file mode 100644
index 0000000..68ecdc0
--- /dev/null
+++ b/test/unit/group_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class GroupTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert Group.new.valid?
+ end
+end