diff options
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/gemeinschaft_parameters.rb | 81 | ||||
-rw-r--r-- | config/initializers/secret_token.rb | 2 | ||||
-rw-r--r-- | config/initializers/simple_form.rb | 173 | ||||
-rw-r--r-- | config/initializers/update_gs_version_number.rb | 16 |
4 files changed, 182 insertions, 90 deletions
diff --git a/config/initializers/gemeinschaft_parameters.rb b/config/initializers/gemeinschaft_parameters.rb deleted file mode 100644 index b1481ef..0000000 --- a/config/initializers/gemeinschaft_parameters.rb +++ /dev/null @@ -1,81 +0,0 @@ -# Use this file to set generic parameters for Gemeinschaft - -GEMEINSCHAFT_VERSION = '5.0.2' -SUPER_TENANT_NAME = 'Super-Tenant' - -# System defaults -MINIMUM_PIN_LENGTH = 4 -MAXIMUM_PIN_LENGTH = 10 - -# GUI -GUI_REDIRECT_HTTPS = false - -# Phone numbers -# Only touch this if you know what you are doing! -STRICT_INTERNAL_EXTENSION_HANDLING = false -STRICT_DID_HANDLING = false - -# SIP defaults -DEFAULT_LENGTH_SIP_AUTH_NAME = 10 -DEFAULT_LENGTH_SIP_PASSWORD = 15 -CALL_WAITING = false -DEFAULT_CLIR_SETTING = false -DEFAULT_CLIP_SETTING = true - -TO_S_MAX_CALLER_NAME_LENGTH = 25 -TO_S_MAX_LENGTH_OF_AUTH_NAME = 6 - -# Pagination defaults -DEFAULT_PAGINATION_ENTRIES_PER_PAGE = 50 - -# Conference defaults -MAXIMUM_NUMBER_OF_PEOPLE_IN_A_CONFERENCE = 100 -DEFAULT_MAX_CONFERENCE_MEMBERS = 10 - -# Misc defaults -MAX_EXTENSION_LENGTH = 6 - -# Fax defaults -DEFAULT_NUMBER_OF_RETRIES = 3 -DAYS_TILL_AUTO_DELETE = 90 - -# Names of PhoneNumberRanges -INTERNAL_EXTENSIONS = 'internal_extensions' -SERVICE_NUMBERS = 'service_numbers' -DIRECT_INWARD_DIALING_NUMBERS = 'direct_inward_dialing_numbers' - -# Callthrough defaults -CALLTHROUGH_HAS_WHITELISTS = true - -# Hunt groups -HUNT_GROUP_STRATEGIES = ['ring_all', 'ring_recursively'] -VALID_SECONDS_BETWEEN_JUMPS_VALUES = (1 .. 60).to_a.map{|x| x * 2} - -# Callforward -DEFAULT_CALL_FORWARD_DEPTH = 1 -MAX_CALL_FORWARD_DEPTH = 40 -CALLFORWARD_DESTINATION_DEFAULT = '+49' -CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT = true - -# Phone -PROVISIONING_AUTO_ADD_PHONE = true -PROVISIONING_AUTO_ADD_SIP_ACCOUNT = true -PROVISIONING_AUTO_TENANT_ID = 2 -PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX = 'Gemeinschaft ' -PROVISIONING_IEEE8021X_EAP_USERNAME = '' -PROVISIONING_IEEE8021X_EAP_PASSWORD = '' -NIGHTLY_REBOOT_OF_PHONES = true -SIEMENS_HISTORY_RELOAD_TIMES = {0..6 => 600, 7..20 => 40, 21..24 => 300} - -# API configuration -DEFAULT_API_TENANT_ID = 2 -REMOTE_IP_ADDRESS_WHITELIST = [] # e.g. ['10.0.0.1'] -IMPORT_CSV_FILE = '/var/tmp/ExampleVoipCsvExport.csv' -DOUBLE_CHECK_POSITIVE_USERS_CSV = '/var/tmp/ExampleDoubleCheckVoipCsvExport.csv' -IMPORT_CSV_ENCODING = 'UTF-8' -USER_NAME_PREFIX = 'dtc' -CALLTHROUGH_NAME_TO_BE_USED_FOR_DEFAULT_ACTIVATION = 'Callthrough for employees' - -# GS Cluster configuration -WRITE_GS_CLUSTER_SYNC_LOG = true -HOMEBASE_IP_ADDRESS = '0.0.0.0' diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 6f04f07..ecd511c 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,4 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Gemeinschaft42c::Application.config.secret_token = '9a59cac7fe4b23e0253a7beb341d9498d721923e966b45983f441f991e81f758067a6d9a949247d489773288284ab96b5015be52bf7b2834e666d43f864034e4' +Gemeinschaft42c::Application.config.secret_token = GsParameter.get('SECRET_TOKEN') diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index 2e3d9fb..ab84483 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -1,19 +1,176 @@ # Use this setup block to configure all options available in SimpleForm. SimpleForm.setup do |config| - config.wrappers :tag => :div, :class => :input, - :error_class => :field_with_errors do |b| + # Wrappers are used by the form builder to generate a + # complete input. You can remove any component from the + # wrapper, change the order or even add your own to the + # stack. The options given below are used to wrap the + # whole input. + config.wrappers :default, :class => :input, + :hint_class => :field_with_hint, :error_class => :field_with_errors do |b| + ## Extensions enabled by default + # Any of these extensions can be disabled for a + # given input by passing: `f.input EXTENSION_NAME => false`. + # You can make any of these extensions optional by + # renaming `b.use` to `b.optional`. - # Form extensions + # Determines whether to use HTML5 (:email, :url, ...) + # and required attributes b.use :html5 - b.optional :pattern - b.use :maxlength + + # Calculates placeholders automatically from I18n + # You can also pass a string as f.input :placeholder => "Placeholder" b.use :placeholder - b.use :readonly - # Form components + ## Optional extensions + # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup` + # to the input. If so, they will retrieve the values from the model + # if any exists. If you want to enable the lookup for any of those + # extensions by default, you can change `b.optional` to `b.use`. + + # Calculates maxlength from length validations for string inputs + b.optional :maxlength + + # Calculates pattern from format validations for string inputs + b.optional :pattern + + # Calculates min and max from length validations for numeric inputs + b.optional :min_max + + # Calculates readonly automatically from readonly attributes + b.optional :readonly + + ## Inputs b.use :label_input - b.use :error, :wrap_with => { :tag => :span, :class => :error } b.use :hint, :wrap_with => { :tag => :span, :class => :hint } + b.use :error, :wrap_with => { :tag => :span, :class => :error } + end + + config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper :tag => 'div', :class => 'controls' do |ba| + ba.use :input + ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' } + ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' } + end + end + + config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper :tag => 'div', :class => 'controls' do |input| + input.wrapper :tag => 'div', :class => 'input-prepend' do |prepend| + prepend.use :input + end + input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' } + input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' } + end end + config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper :tag => 'div', :class => 'controls' do |input| + input.wrapper :tag => 'div', :class => 'input-append' do |append| + append.use :input + end + input.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block' } + input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' } + end + end + + # Wrappers for forms and inputs using the Twitter Bootstrap toolkit. + # Check the Bootstrap docs (http://twitter.github.com/bootstrap) + # to learn about the different styles for forms and inputs, + # buttons and other elements. + config.default_wrapper = :bootstrap + + # Define the way to render check boxes / radio buttons with labels. + # Defaults to :nested for bootstrap config. + # :inline => input + label + # :nested => label > input + config.boolean_style = :nested + + # Default class for buttons + config.button_class = 'btn' + + # Method used to tidy up errors. + # config.error_method = :first + + # Default tag used for error notification helper. + config.error_notification_tag = :div + + # CSS class to add for error notification helper. + config.error_notification_class = 'alert alert-error' + + # ID to add for error notification helper. + # config.error_notification_id = nil + + # Series of attempts to detect a default label method for collection. + # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] + + # Series of attempts to detect a default value method for collection. + # config.collection_value_methods = [ :id, :to_s ] + + # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. + # config.collection_wrapper_tag = nil + + # You can define the class to use on all collection wrappers. Defaulting to none. + # config.collection_wrapper_class = nil + + # You can wrap each item in a collection of radio/check boxes with a tag, + # defaulting to :span. Please note that when using :boolean_style = :nested, + # SimpleForm will force this option to be a label. + # config.item_wrapper_tag = :span + + # You can define a class to use in all item wrappers. Defaulting to none. + # config.item_wrapper_class = nil + + # How the label text should be generated altogether with the required text. + # config.label_text = lambda { |label, required| "#{required} #{label}" } + + # You can define the class to use on all labels. Default is nil. + config.label_class = 'control-label' + + # You can define the class to use on all forms. Default is simple_form. + # config.form_class = :simple_form + + # You can define which elements should obtain additional classes + # config.generate_additional_classes_for = [:wrapper, :label, :input] + + # Whether attributes are required by default (or not). Default is true. + # config.required_by_default = true + + # Tell browsers whether to use default HTML5 validations (novalidate option). + # Default is enabled. + config.browser_validations = false + + # Collection of methods to detect if a file type was given. + # config.file_methods = [ :mounted_as, :file?, :public_filename ] + + # Custom mappings for input types. This should be a hash containing a regexp + # to match as key, and the input type that will be used when the field name + # matches the regexp as value. + # config.input_mappings = { /count/ => :integer } + + # Default priority for time_zone inputs. + # config.time_zone_priority = nil + + # Default priority for country inputs. + # config.country_priority = nil + + # Default size for text inputs. + # config.default_input_size = 50 + + # When false, do not use translations for labels. + # config.translate_labels = true + + # Automatically discover new inputs in Rails' autoload path. + # config.inputs_discovery = true + + # Cache SimpleForm inputs discovery + # config.cache_discovery = !Rails.env.development? end diff --git a/config/initializers/update_gs_version_number.rb b/config/initializers/update_gs_version_number.rb new file mode 100644 index 0000000..d9e1aae --- /dev/null +++ b/config/initializers/update_gs_version_number.rb @@ -0,0 +1,16 @@ +# The Gemeinschaft version is stored in an environment variable. +# It equals the branch in git. +# +if !ENV['GS_VERSION'].nil? && GsParameter.table_exists? && GsParameter.get('GEMEINSCHAFT_VERSION') != ENV['GS_VERSION'] + version = GsParameter.find_or_create_by_name('GEMEINSCHAFT_VERSION') + version.section = 'Generic' + version.value = ENV['GS_VERSION'] + version.save +end + +if !ENV['GS_BUILDNAME'].nil? && GsParameter.table_exists? && GsParameter.get('GS_BUILDNAME') != ENV['GS_BUILDNAME'] + buildname = GsParameter.find_or_create_by_name('GEMEINSCHAFT_BUILDNAME') + buildname.section = 'Generic' + buildname.value = ENV['GS_BUILDNAME'] + buildname.save +end |