lib/iqvoc/configuration/core.rb in iqvoc-4.7.0 vs lib/iqvoc/configuration/core.rb in iqvoc-4.8.0

- old
+ new

@@ -18,11 +18,12 @@ :localized_routes, :core_assets, :search_sections, :export_path, :upload_path, - :truncation_blacklist + :truncation_blacklist, + :host_namespace self.localized_routes = [] # routing extensibility hook self.core_assets = %w( manifest.css @@ -91,10 +92,13 @@ action: 'help', :authorized? => proc { can? :read, :help } }, { text: proc { t('txt.views.navigation.about') }, href: 'http://iqvoc.net/' + }, { + text: proc { t('txt.views.navigation.version') }, + href: proc { version_path } }] }] self.searchable_class_names = { 'Labeling::SKOS::Base' => 'labels', @@ -121,11 +125,11 @@ # The class to use for automatic generation of change notes on every save self.change_note_class_name = 'Note::SKOS::ChangeNote' self.first_level_class_configuration_modules = [] # Will be set in the modules - self.ability_class_name = 'Iqvoc::Ability' + self.ability_class_name = 'Ability' self.search_sections = [ 'klass', 'mode', 'terms', @@ -156,11 +160,11 @@ module ClassMethods # ************** instance configuration ************** def config(&block) - cfg = InstanceConfiguration.instance + cfg = Iqvoc::Configuration::InstanceConfiguration.instance if block block.call(cfg) else return cfg end @@ -201,21 +205,31 @@ def title=(value) ActiveSupport::Deprecation.warn 'title has been moved into instance configuration', caller self.config.register_setting('title', value) end + def engine? + Iqvoc.const_defined?(:Engine) + end + def root - if Iqvoc.const_defined?(:Engine) + if engine? Iqvoc::Engine.root else Rails.root end end def routing_constraint lambda do |params, req| langs = Iqvoc::Concept.pref_labeling_languages.join('|').presence || 'en' return params[:lang].to_s =~ /^#{langs}$/ + end + end + + def host_version + if Iqvoc.host_namespace + Iqvoc.host_namespace::VERSION end end end end end