summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-01-18 11:19:28 +0100
committerspag <spag@golwen.net>2013-01-18 11:19:28 +0100
commitc11734ec34349a5d8dee4722ab798a6e5aa3c0f4 (patch)
tree9ec92b252ee8eb5913783725355e9532302887b3 /app
parent1e465e49670f6c0fccc1cd920992a14942d3cfba (diff)
parentd4e7d4a5d5bdb63fbda279dbc8dd2ec495b90907 (diff)
Merge branch 'develop' of github.com:amooma/GS5 into develop
Diffstat (limited to 'app')
-rw-r--r--app/controllers/gs_parameters_controller.rb8
-rw-r--r--app/models/ability.rb4
-rw-r--r--app/views/tenants/_admin_area.de.html.haml46
-rw-r--r--app/views/tenants/_admin_area.html.haml45
-rw-r--r--app/views/tenants/_sip_accounts_and_phones.html.haml2
-rw-r--r--app/views/tenants/show.html.haml14
-rw-r--r--app/views/users/_index_core.html.haml36
7 files changed, 65 insertions, 90 deletions
diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb
index 3c212c1..7ca4e8e 100644
--- a/app/controllers/gs_parameters_controller.rb
+++ b/app/controllers/gs_parameters_controller.rb
@@ -10,7 +10,7 @@ class GsParametersController < ApplicationController
end
def show
- @gs_parameter = GsParameter.find(gs_parameter_params[:id])
+ @gs_parameter = GsParameter.find(params[:id])
end
def new
@@ -18,11 +18,11 @@ class GsParametersController < ApplicationController
end
def edit
- @gs_parameter = GsParameter.find(gs_parameter_params[:id])
+ @gs_parameter = GsParameter.find(params[:id])
end
def update
- @gs_parameter = GsParameter.find(gs_parameter_params[:id])
+ @gs_parameter = GsParameter.find(params[:id])
if @gs_parameter.update_attributes(gs_parameter_params)
redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated')
else
@@ -32,7 +32,7 @@ class GsParametersController < ApplicationController
private
def gs_parameter_params
- params.require(:gs_parameter).permit(:id, :value, :class_type, :description)
+ params.require(:gs_parameter).permit(:value, :class_type, :description)
end
def spread_breadcrumbs
diff --git a/app/models/ability.rb b/app/models/ability.rb
index cd91a8a..b846af0 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -27,6 +27,10 @@ class Ability
#
cannot [:create, :destroy, :edit, :update], Tenant, :id => 1
+ # Can't destroy any tenant
+ #
+ cannot :destroy, Tenant
+
cannot :manage, PhoneBook
# Phonebooks and PhoneBookEntries
diff --git a/app/views/tenants/_admin_area.de.html.haml b/app/views/tenants/_admin_area.de.html.haml
index 0ef9da3..268c8e7 100644
--- a/app/views/tenants/_admin_area.de.html.haml
+++ b/app/views/tenants/_admin_area.de.html.haml
@@ -1,32 +1,3 @@
-- cache(['tenant_show_admin_area', I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do
- %p
- Sie sind Mitglied der
- = link_to 'Admin Gruppe', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins'))
- und haben deshalb besondere Rechte. Aber wie Peter Parker schon sagte: "With great power comes great responsibility."
-
- %p
- = @tenant
- hat
- = link_to pluralize(@tenant.user_groups.count, 'user group'), tenant_user_groups_path(@tenant)
- - if @tenant.user_groups.count < 5
- = "(#{@tenant.user_groups.order(:name).map{|group| group.to_s }.join(', ')})"
- die in Summe
- = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant)
- verwalten.
- Das System kann
- = PhoneModel.count
- verschiedene Telefonmodelle von den folgenden Herstellern verwalten:
- - Manufacturer.all.each do |manufacturer|
- - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
- = succeed ', ' do
- =link_to manufacturer, manufacturer_path(manufacturer)
- - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last
- = succeed ' und ' do
- =link_to manufacturer, manufacturer_path(manufacturer)
- - else
- = succeed '.' do
- =link_to manufacturer, manufacturer_path(manufacturer)
-
%h2 Admin Bereich
= render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant}
@@ -50,4 +21,19 @@
= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant}
%h2 Gemeinschaft Konfiguration
-= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} \ No newline at end of file
+= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant}
+
+%p
+ Das System kann
+ = PhoneModel.count
+ verschiedene Telefonmodelle von den folgenden Herstellern verwalten:
+ - Manufacturer.all.each do |manufacturer|
+ - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ', ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ' und ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - else
+ = succeed '.' do
+ =link_to manufacturer, manufacturer_path(manufacturer) \ No newline at end of file
diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.html.haml
index 7b47587..e708215 100644
--- a/app/views/tenants/_admin_area.html.haml
+++ b/app/views/tenants/_admin_area.html.haml
@@ -1,31 +1,3 @@
-- cache(['tenant_show_admin_area', I18n.locale, @tenant, UserGroup.count, UserGroup.order(:updated_at).last, User.count, User.order(:updated_at).last, Manufacturer.all]) do
- %p
- You belong to the
- = link_to 'admin group', tenant_user_group_path(@tenant, @tenant.user_groups.find_by_name('Admins'))
- and therefore have super powers. But always remember Peter Parker's: "With great power comes great responsibility."
-
- %p
- = succeed '.' do
- This tenant has
- = link_to pluralize(@tenant.user_groups.count, 'user group'), tenant_user_groups_path(@tenant)
- - if @tenant.user_groups.count < 5
- = "(#{@tenant.user_groups.order(:name).map{|group| group.to_s }.join(', ')})"
- which handle a total of
- = link_to pluralize(@tenant.users.count, 'user'), tenant_users_path(@tenant)
- This system can setup
- = PhoneModel.count
- different phone models from the manufacturers
- - Manufacturer.all.each do |manufacturer|
- - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
- = succeed ', ' do
- =link_to manufacturer, manufacturer_path(manufacturer)
- - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last
- = succeed ' and ' do
- =link_to manufacturer, manufacturer_path(manufacturer)
- - else
- = succeed '.' do
- =link_to manufacturer, manufacturer_path(manufacturer)
-
%h2 Admin Area
= render :partial => 'tenants/sip_accounts_and_phones', :locals => {:tenant => @tenant}
@@ -49,4 +21,19 @@
= render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => @tenant}
%h2 Gemeinschaft Configuration
-= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant} \ No newline at end of file
+= render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => @tenant}
+
+%p
+ This system can setup
+ = PhoneModel.count
+ different phone models from the manufacturers
+ - Manufacturer.all.each do |manufacturer|
+ - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ', ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ' and ' do
+ =link_to manufacturer, manufacturer_path(manufacturer)
+ - else
+ = succeed '.' do
+ =link_to manufacturer, manufacturer_path(manufacturer) \ No newline at end of file
diff --git a/app/views/tenants/_sip_accounts_and_phones.html.haml b/app/views/tenants/_sip_accounts_and_phones.html.haml
index e322b67..4b84b1c 100644
--- a/app/views/tenants/_sip_accounts_and_phones.html.haml
+++ b/app/views/tenants/_sip_accounts_and_phones.html.haml
@@ -21,7 +21,7 @@
= '[' + truncate(sip_account.phone_numbers.map{|phone_number| phone_number.to_s}.join(', '), :length => 25) + ']'
= render :partial => 'shared/create_link', :locals => {:parent => tenant, :child_class => SipAccount}
- - cache(['tenant_show_admin_area_sip_accounts_table_cell', I18n.locale, @tenant, @tenant.phones.count, @tenant.phones.reorder(:updated_at).last]) do
+ - cache(['tenant_show_admin_area_phones_table_cell', I18n.locale, @tenant, @tenant.phones.count, @tenant.phones.reorder(:updated_at).last]) do
%td
- if tenant.phones.any?
- if tenant.phones.count > GsParameter.get('NUMBER_OF_SHOWN_ITEMS')
diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml
index 10845cf..f5cff5f 100644
--- a/app/views/tenants/show.html.haml
+++ b/app/views/tenants/show.html.haml
@@ -1,15 +1,11 @@
-- title t("tenants.show.page_title")
+- title @tenant.name
-- cache(['tenant_show_name_and_description', I18n.locale, @tenant, current_user]) do
+- if !@tenant.description.blank?
%p
- %strong= t('tenants.show.name') + ":"
- = @tenant.name
- - if !@tenant.description.blank?
- %p
- %strong= t('tenants.show.description') + ":"
- = @tenant.description
+ %strong= t('tenants.show.description') + ":"
+ = @tenant.description
- = render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant }
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant }
- if @tenant.user_groups.where(:name => 'Admins').count > 0 && @tenant.user_groups.where(:name => 'Admins').first.users.include?(current_user)
= render 'admin_area' \ No newline at end of file
diff --git a/app/views/users/_index_core.html.haml b/app/views/users/_index_core.html.haml
index 51c15de..9376826 100644
--- a/app/views/users/_index_core.html.haml
+++ b/app/views/users/_index_core.html.haml
@@ -1,18 +1,20 @@
-%table
- %tr
- %th
- %th= t('users.index.user_name')
- %th= t('users.index.email')
- %th= t('users.index.first_name')
- %th= t('users.index.last_name')
+- cache(['user_table_row_inner_td', I18n.locale, current_user, users.order(:updated_at).last, users.count, GsParameter.get('NUMBER_OF_SHOWN_ITEMS')]) do
+ %table
+ %tr
+ %th
+ %th= t('users.index.user_name')
+ %th= t('users.index.email')
+ %th= t('users.index.first_name')
+ %th= t('users.index.last_name')
- - reset_cycle
- - for user in users
- %tr{:class => cycle('odd', 'even')}
- %td
- = image_tag user.image_url(:mini).to_s if user.image_url(:mini)
- %td= user.user_name
- %td= user.email
- %td= user.first_name
- %td= user.last_name
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => @tenant, :child => user} \ No newline at end of file
+ - reset_cycle
+ - for user in users
+ %tr{:class => cycle('odd', 'even')}
+ - cache(['user_table_row_inner_td', I18n.locale, current_user, user]) do
+ %td
+ = image_tag user.image_url(:mini).to_s if user.image_url(:mini)
+ %td= user.user_name
+ %td= user.email
+ %td= user.first_name
+ %td= user.last_name
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => @tenant, :child => user} \ No newline at end of file