summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/config_snom_controller.rb1
-rw-r--r--app/controllers/page_controller.rb1
-rw-r--r--app/controllers/phones_controller.rb7
-rw-r--r--app/controllers/tenants_controller.rb21
-rw-r--r--app/controllers/user_groups_controller.rb6
5 files changed, 27 insertions, 9 deletions
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index 4d12082..7542415 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -80,6 +80,7 @@ class ConfigSnomController < ApplicationController
'00041345' => 'Snom 821',
'00041348' => 'Snom 821',
'00041341' => 'Snom 870',
+ '00041332' => 'snom MeetingPoint',
}
@phone.phone_model = PhoneModel.where(:name => mac_address_to_model[@mac_address[0, 8]]).first
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index 1f37449..4ea4d25 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -7,6 +7,7 @@ class PageController < ApplicationController
def index;end
def conference;end
+ def beginners_intro;end
private
def if_fresh_system_then_go_to_wizard
diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb
index f1dcd3e..2698465 100644
--- a/app/controllers/phones_controller.rb
+++ b/app/controllers/phones_controller.rb
@@ -13,9 +13,9 @@ class PhonesController < ApplicationController
end
def new
- set_fallback_sip_accounts
-
@phone = @phoneable.phones.build()
+
+ set_fallback_sip_accounts
# Use the last phone.phone_model as the default.
#
@@ -80,6 +80,9 @@ class PhonesController < ApplicationController
def set_fallback_sip_accounts
used_sip_account_ids = Phone.where(:fallback_sip_account_id => SipAccount.pluck(:id)).pluck(:fallback_sip_account_id)
@fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant').where(:hotdeskable => true) - SipAccount.where(:id => used_sip_account_ids)
+ if @phone && !@phone.fallback_sip_account_id.blank? && SipAccount.exists?(@phone.fallback_sip_account_id)
+ @fallback_sip_accounts << SipAccount.where(:id => @phone.fallback_sip_account_id).first
+ end
end
end
diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb
index 724d179..7bb8ecd 100644
--- a/app/controllers/tenants_controller.rb
+++ b/app/controllers/tenants_controller.rb
@@ -58,14 +58,27 @@ class TenantsController < ApplicationController
end
if Delayed::Job.count > 0
- redirect_to @tenant, :notice => t('tenants.controller.successfuly_created_plus_delayed_jobs',
+ if SipAccount.any? || Phone.any?
+ redirect_to @tenant, :notice => t('tenants.controller.successfuly_created_plus_delayed_jobs',
:resource => @tenant,
:amount_of_numbers => @tenant.array_of_internal_extension_numbers.count + @tenant.array_of_dids.count
)
- else
- redirect_to @tenant, :notice => t('tenants.controller.successfuly_created',
- :resource => @tenant
+ else
+ redirect_to page_beginners_intro_path, :notice => t('tenants.controller.successfuly_created_plus_delayed_jobs',
+ :resource => @tenant,
+ :amount_of_numbers => @tenant.array_of_internal_extension_numbers.count + @tenant.array_of_dids.count
)
+ end
+ else
+ if SipAccount.any? || Phone.any?
+ redirect_to @tenant, :notice => t('tenants.controller.successfuly_created',
+ :resource => @tenant
+ )
+ else
+ redirect_to page_beginners_intro_path, :notice => t('tenants.controller.successfuly_created',
+ :resource => @tenant
+ )
+ end
end
else
render :new
diff --git a/app/controllers/user_groups_controller.rb b/app/controllers/user_groups_controller.rb
index 158abaa..ff3292c 100644
--- a/app/controllers/user_groups_controller.rb
+++ b/app/controllers/user_groups_controller.rb
@@ -19,7 +19,7 @@ class UserGroupsController < ApplicationController
def create
@user_group = @parent.user_groups.build(params[:user_group])
if @user_group.save
- redirect_to @user_group, :notice => t('user_groups.controller.successfuly_created')
+ redirect_to [@parent, @user_group], :notice => t('user_groups.controller.successfuly_created')
else
render :new
end
@@ -30,7 +30,7 @@ class UserGroupsController < ApplicationController
def update
if @user_group.update_attributes(params[:user_group])
- redirect_to @user_group, :notice => t('user_groups.controller.successfuly_updated')
+ redirect_to [@parent, @user_group], :notice => t('user_groups.controller.successfuly_updated')
else
render :edit
end
@@ -38,7 +38,7 @@ class UserGroupsController < ApplicationController
def destroy
@user_group.destroy
- redirect_to user_groups_url, :notice => t('user_groups.controller.successfuly_destroyed')
+ redirect_to method( :"#{@parent.class.name.underscore}_user_groups_path" ).(@parent), :notice => t('user_groups.controller.successfuly_destroyed')
end
private