diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-21 14:10:02 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-21 14:10:02 +0100 |
commit | 29a22b3f498f2962c45f0c834d04d550b22b9348 (patch) | |
tree | bf4eec95c2423027ef57e8e231d20608255733d3 | |
parent | f7c8227521a758f769d3bde892b8b7201bf841dc (diff) | |
parent | 86e94e36e52ff7a3dbc7219db5b3bea5a7f56711 (diff) |
Merge branch 'area_code' into develop
-rw-r--r-- | app/controllers/gemeinschaft_setups_controller.rb | 8 | ||||
-rw-r--r-- | app/models/gemeinschaft_setup.rb | 12 | ||||
-rw-r--r-- | app/views/gemeinschaft_setups/new.de.html.haml | 1 | ||||
-rw-r--r-- | app/views/gemeinschaft_setups/new.html.haml | 1 | ||||
-rw-r--r-- | config/locales/views/gemeinschaft_setups/de.yml | 3 | ||||
-rw-r--r-- | config/locales/views/gemeinschaft_setups/en.yml | 3 | ||||
-rw-r--r-- | db/migrate/20130121123742_add_default_area_code_to_gemeinschaft_setup.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 7 |
8 files changed, 37 insertions, 3 deletions
diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index 27c0a83..347e043 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -45,6 +45,14 @@ class GemeinschaftSetupsController < ApplicationController super_tenant_super_admin_group = super_tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.super_admin_group_name')) super_tenant_super_admin_group.user_group_memberships.create(:user_id => user.id) + # Set CallRoute defaults + CallRoute.factory_defaults_prerouting(@gemeinschaft_setup.country.country_code, + @gemeinschaft_setup.country.trunk_prefix, + @gemeinschaft_setup.country.international_call_prefix, + '', + @gemeinschaft_setup.default_area_code + ) + # Set a couple of URLs in the GsParameter table GsParameter.where(:name => 'phone_book_entry_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/phone_book_entry/image") GsParameter.where(:name => 'ringtone_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}") diff --git a/app/models/gemeinschaft_setup.rb b/app/models/gemeinschaft_setup.rb index 0b3eeae..6056236 100644 --- a/app/models/gemeinschaft_setup.rb +++ b/app/models/gemeinschaft_setup.rb @@ -10,8 +10,20 @@ class GemeinschaftSetup < ActiveRecord::Base # after_create :expire_cache + before_validation :format_default_area_code + private def expire_cache ActionController::Base.expire_page(Rails.application.routes.url_helpers.new_gemeinschaft_setup_path) end + + def format_default_area_code + if self.default_area_code.blank? + self.default_area_code = nil + else + if self.country != nil && !self.country.trunk_prefix.blank? + self.default_area_code.gsub(/^#{self.country.trunk_prefix}/,'') + end + end + end end diff --git a/app/views/gemeinschaft_setups/new.de.html.haml b/app/views/gemeinschaft_setups/new.de.html.haml index 2e148f3..1afa5d4 100644 --- a/app/views/gemeinschaft_setups/new.de.html.haml +++ b/app/views/gemeinschaft_setups/new.de.html.haml @@ -20,6 +20,7 @@ = f.association :country, :label => t('gemeinschaft_setups.form.country_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.country_id.hint'), :include_blank => false = f.association :language, :label => t('gemeinschaft_setups.form.language_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.language_id.hint'), :include_blank => false + = f.input :default_area_code, :label => t('gemeinschaft_setups.form.default_area_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_area_code.hint') .actions = f.button :submit, conditional_t('gemeinschaft_setups.form.submit')
\ No newline at end of file diff --git a/app/views/gemeinschaft_setups/new.html.haml b/app/views/gemeinschaft_setups/new.html.haml index ab5a70f..da3c60e 100644 --- a/app/views/gemeinschaft_setups/new.html.haml +++ b/app/views/gemeinschaft_setups/new.html.haml @@ -20,6 +20,7 @@ = f.association :country, :label => t('gemeinschaft_setups.form.country_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.country_id.hint'), :include_blank => false = f.association :language, :label => t('gemeinschaft_setups.form.language_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.language_id.hint'), :include_blank => false + = f.input :default_area_code, :label => t('gemeinschaft_setups.form.default_area_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_area_code.hint') .actions = f.button :submit, conditional_t('gemeinschaft_setups.form.submit')
\ No newline at end of file diff --git a/config/locales/views/gemeinschaft_setups/de.yml b/config/locales/views/gemeinschaft_setups/de.yml index a1dd989..d087583 100644 --- a/config/locales/views/gemeinschaft_setups/de.yml +++ b/config/locales/views/gemeinschaft_setups/de.yml @@ -25,4 +25,7 @@ de: language_id: label: 'Sprache' hint: '' + default_area_code: + label: 'Standard Ortsvorwahl' + hint: '030 für Berlin, 0261 für Koblenz, 02631 für Neuwied, usw.' button: 'Absenden'
\ No newline at end of file diff --git a/config/locales/views/gemeinschaft_setups/en.yml b/config/locales/views/gemeinschaft_setups/en.yml index aef2686..5e22e58 100644 --- a/config/locales/views/gemeinschaft_setups/en.yml +++ b/config/locales/views/gemeinschaft_setups/en.yml @@ -25,4 +25,7 @@ en: language_id: label: 'Language' hint: '' + default_area_code: + label: 'Default area code' + hint: '' button: 'Submit'
\ No newline at end of file diff --git a/db/migrate/20130121123742_add_default_area_code_to_gemeinschaft_setup.rb b/db/migrate/20130121123742_add_default_area_code_to_gemeinschaft_setup.rb new file mode 100644 index 0000000..63a9fd1 --- /dev/null +++ b/db/migrate/20130121123742_add_default_area_code_to_gemeinschaft_setup.rb @@ -0,0 +1,5 @@ +class AddDefaultAreaCodeToGemeinschaftSetup < ActiveRecord::Migration + def change + add_column :gemeinschaft_setups, :default_area_code, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 31fdaf7..1d91458 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130117191840) do +ActiveRecord::Schema.define(:version => 20130121123742) do create_table "access_authorizations", :force => true do |t| t.string "access_authorizationable_type" @@ -535,8 +535,9 @@ ActiveRecord::Schema.define(:version => 20130117191840) do t.integer "sip_domain_id" t.integer "country_id" t.integer "language_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "default_area_code" end create_table "gs_cluster_sync_log_entries", :force => true do |t| |