iqvoc 3.4.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/Gemfile +5 -4
- data/Gemfile.lock +54 -27
- data/app/assets/javascripts/framework.js +0 -1
- data/app/assets/stylesheets/iqvoc/forms.css.erb +5 -1
- data/app/controllers/application_controller.rb +4 -107
- data/app/controllers/concepts/hierarchical_controller.rb +11 -12
- data/app/controllers/concepts/untranslated_controller.rb +1 -1
- data/app/controllers/instance_configuration_controller.rb +103 -0
- data/app/controllers/search_results_controller.rb +4 -3
- data/app/helpers/application_helper.rb +1 -1
- data/app/helpers/concepts_helper.rb +1 -1
- data/app/models/configuration_setting.rb +22 -0
- data/app/views/instance_configuration/index.html.erb +15 -0
- data/app/views/layouts/_controls.html.erb +3 -3
- data/app/views/layouts/_header.html.erb +1 -1
- data/app/views/layouts/_navigation.html.erb +6 -1
- data/app/views/layouts/application.html.erb +11 -4
- data/config/blazing.rb +36 -0
- data/config/database.yml +3 -16
- data/config/deploy.rb +1 -1
- data/config/engine.rb +8 -0
- data/config/environments/development.rb +2 -60
- data/config/environments/heroku.rb +1 -1
- data/config/environments/production.rb +2 -60
- data/config/environments/test.rb +2 -45
- data/config/initializers/iqvoc.rb +2 -12
- data/config/initializers/secret_token.rb +3 -1
- data/config/locales/de.yml +8 -0
- data/config/locales/en.yml +8 -0
- data/config/routes.rb +7 -1
- data/db/migrate/20120119000000_create_configuration_settings.rb +14 -0
- data/lib/debug.rb +4 -4
- data/lib/iqvoc.rb +11 -219
- data/lib/iqvoc/ability.rb +2 -1
- data/lib/iqvoc/configuration/collection.rb +22 -0
- data/lib/iqvoc/configuration/concept.rb +152 -0
- data/lib/iqvoc/configuration/core.rb +135 -0
- data/lib/iqvoc/configuration/label.rb +23 -0
- data/lib/iqvoc/controller_extensions.rb +115 -0
- data/lib/iqvoc/environments/development.rb +66 -0
- data/lib/iqvoc/environments/production.rb +64 -0
- data/lib/iqvoc/environments/test.rb +52 -0
- data/lib/iqvoc/instance_configuration.rb +122 -0
- data/lib/iqvoc/version.rb +1 -1
- data/public/assets/ajax-loader-5c1bf2208bffabddfb583013023b2b11.gif +0 -0
- data/public/assets/ajax-loader.gif +0 -0
- data/public/assets/arrow_down-e1f4aacd91274ce8d4db40d8b4ad781f.gif +0 -0
- data/public/assets/arrow_down.gif +0 -0
- data/public/assets/arrow_up-a48d7a55002e97f1b70e0e957edf3964.gif +0 -0
- data/public/assets/arrow_up.gif +0 -0
- data/public/assets/back-ffd41b7924770324ead91a4eb51604f6.png +0 -0
- data/public/assets/back.png +0 -0
- data/public/assets/blueprint/ie-d2ff4b1cc209dc6b08716b5e0098e106.css +36 -0
- data/public/assets/blueprint/ie-d2ff4b1cc209dc6b08716b5e0098e106.css.gz +0 -0
- data/public/assets/blueprint/ie.css +36 -0
- data/public/assets/blueprint/ie.css.gz +0 -0
- data/public/assets/blueprint/print-799a53ff649d9f14baf5f5fe643d04c4.css +30 -0
- data/public/assets/blueprint/print-799a53ff649d9f14baf5f5fe643d04c4.css.gz +0 -0
- data/public/assets/blueprint/print.css +30 -0
- data/public/assets/blueprint/print.css.gz +0 -0
- data/public/assets/blueprint/screen-d721f98ceac371a9294fc6f091ca1cb5.css +259 -0
- data/public/assets/blueprint/screen-d721f98ceac371a9294fc6f091ca1cb5.css.gz +0 -0
- data/public/assets/blueprint/screen.css +259 -0
- data/public/assets/blueprint/screen.css.gz +0 -0
- data/public/assets/branch-c950c8ac69ee2f753f86a75d944aa976.png +0 -0
- data/public/assets/branch.png +0 -0
- data/public/assets/categ-e1e1a5958017a5586456895785298c89.png +0 -0
- data/public/assets/categ.png +0 -0
- data/public/assets/categ_open-de616238db93a0645b4c4a2cdd4eece4.png +0 -0
- data/public/assets/categ_open.png +0 -0
- data/public/assets/excanvas-1f8c36f3578409126862b5c17e59b9bd.js +14 -0
- data/public/assets/excanvas-1f8c36f3578409126862b5c17e59b9bd.js.gz +0 -0
- data/public/assets/excanvas.js +14 -0
- data/public/assets/excanvas.js.gz +0 -0
- data/public/assets/file-48364459f087292aafa11168442bde71.gif +0 -0
- data/public/assets/file.gif +0 -0
- data/public/assets/folder-7e0f370ab3fcca5deab89784db42da4a.gif +0 -0
- data/public/assets/folder-closed-cb6c847cac4dea2cb59c98ecfc76b8ae.gif +0 -0
- data/public/assets/folder-closed.gif +0 -0
- data/public/assets/folder.gif +0 -0
- data/public/assets/footer-ea48e7e96122c8ab345da8ff67f29838.png +0 -0
- data/public/assets/footer.png +0 -0
- data/public/assets/go_there-ee7df641e73ef83e43180dbc07c40540.png +0 -0
- data/public/assets/go_there.png +0 -0
- data/public/assets/header_long-5c7970b5911f94433a696ae87918ecb0.png +0 -0
- data/public/assets/header_long.png +0 -0
- data/public/assets/iqvoc-ff2c5252d9877c38297164984d4a7a55.png +0 -0
- data/public/assets/iqvoc.png +0 -0
- data/public/assets/iqvoc/ie_fixes-7797396e9cd2f32961f56af18bacd33a.css +7 -0
- data/public/assets/iqvoc/ie_fixes-7797396e9cd2f32961f56af18bacd33a.css.gz +0 -0
- data/public/assets/iqvoc/ie_fixes.css +7 -0
- data/public/assets/iqvoc/ie_fixes.css.gz +0 -0
- data/public/assets/iqvoc/visualization-49b198ac7d8bc15fa13eafc528e96081.js +4 -0
- data/public/assets/iqvoc/visualization-49b198ac7d8bc15fa13eafc528e96081.js.gz +0 -0
- data/public/assets/iqvoc/visualization.js +4 -0
- data/public/assets/iqvoc/visualization.js.gz +0 -0
- data/public/assets/jit_rgraph-63bc6fa01820d73bb4076f2f62493e66.js +25 -0
- data/public/assets/jit_rgraph-63bc6fa01820d73bb4076f2f62493e66.js.gz +0 -0
- data/public/assets/jit_rgraph.js +25 -0
- data/public/assets/jit_rgraph.js.gz +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-951e2a65945b93d3f69c1994e5672f39.png +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_55_fbec88_40x100-befbc2de63b9556a093c0a5bb2e08a95.png +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_75_d0e5f5_1x400-faa3341c6543985d2c94bd65e36bd6d8.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_85_dfeffc_1x400-df1d30b336ee1530edc334458abd2417.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_95_fef1ec_1x400-5767880afddd9b98f4b4cfd43a09947b.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/jquery-ui/ui-bg_gloss-wave_55_5c9ccc_500x100-c563cdeeac0f1479b69e36b21d785ac4.png +0 -0
- data/public/assets/jquery-ui/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_f5f8f9_1x100-b837a3b8315a7ff270664ce469f2e6d7.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_fcfdfd_1x100-b5d3cda0e6142534937f71cf4438e28a.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/public/assets/jquery-ui/ui-icons_217bc0_256x240-14e62c24f88d00f227d88e5b16406eec.png +0 -0
- data/public/assets/jquery-ui/ui-icons_217bc0_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_2e83ff_256x240-c15e521f58d397c2fa31f4214f92a399.png +0 -0
- data/public/assets/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_469bdd_256x240-aceccf3311e1b369e71a4ac629953d61.png +0 -0
- data/public/assets/jquery-ui/ui-icons_469bdd_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_6da8d5_256x240-18148340aba4ce354c9d52c5aa2f5c0c.png +0 -0
- data/public/assets/jquery-ui/ui-icons_6da8d5_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_cd0a0a_256x240-279edbd373e73b1ecd1ea7a6ba19750d.png +0 -0
- data/public/assets/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_d8e7f3_256x240-732b446e2e1d4f4fec4277e2632a9adf.png +0 -0
- data/public/assets/jquery-ui/ui-icons_d8e7f3_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_f9bd01_256x240-1ee933e5956743f5607f2075ed21fac5.png +0 -0
- data/public/assets/jquery-ui/ui-icons_f9bd01_256x240.png +0 -0
- data/public/assets/json2-fdda51ffce29dd4cb684dc7bd0aede01.js +157 -0
- data/public/assets/json2-fdda51ffce29dd4cb684dc7bd0aede01.js.gz +0 -0
- data/public/assets/json2.js +157 -0
- data/public/assets/json2.js.gz +0 -0
- data/public/assets/leaf_end-2ac151e8d7b4928bacb557f96cb5b517.png +0 -0
- data/public/assets/leaf_end.png +0 -0
- data/public/assets/leaf_end_filled-cdb0eb9ce60425bf0a1fd12226e502eb.png +0 -0
- data/public/assets/leaf_end_filled.png +0 -0
- data/public/assets/leaf_mid-966f99acaeaddfaedb6b602eb1eed7e0.png +0 -0
- data/public/assets/leaf_mid.png +0 -0
- data/public/assets/leaf_mid_filled-fecf059c72a649fe77052a886fb030d5.png +0 -0
- data/public/assets/leaf_mid_filled.png +0 -0
- data/public/assets/leaf_nothing-e8b5532117e55a184d93e8bf66afa20a.png +0 -0
- data/public/assets/leaf_nothing.png +0 -0
- data/public/assets/leaf_only-e4fe523e451ad9dea6bba08b44cf8039.png +0 -0
- data/public/assets/leaf_only.png +0 -0
- data/public/assets/leaf_only_filled-7b9a97903759b89facd5fb2e03ba14d1.png +0 -0
- data/public/assets/leaf_only_filled.png +0 -0
- data/public/assets/leaf_top-61fbce4d3adf2235964e828647a52149.png +0 -0
- data/public/assets/leaf_top.png +0 -0
- data/public/assets/leaf_top_filled-003d96425167d3b74e63eb75e12d163e.png +0 -0
- data/public/assets/leaf_top_filled.png +0 -0
- data/public/assets/manifest-c08ebf92c2ea89fbce8705f984a7c604.css +1139 -0
- data/public/assets/manifest-c08ebf92c2ea89fbce8705f984a7c604.css.gz +0 -0
- data/public/assets/manifest-c6d880245ce63929a5842e48cb7c65f2.js +21 -0
- data/public/assets/manifest-c6d880245ce63929a5842e48cb7c65f2.js.gz +0 -0
- data/public/assets/manifest.css +1139 -0
- data/public/assets/manifest.css.gz +0 -0
- data/public/assets/manifest.js +21 -0
- data/public/assets/manifest.js.gz +0 -0
- data/public/assets/manifest.yml +73 -0
- data/public/assets/minus-633f45b71e7552c36214c9d81fce94b0.gif +0 -0
- data/public/assets/minus.gif +0 -0
- data/public/assets/nothing-19b9650c540a8776b047d6dde27687b0.png +0 -0
- data/public/assets/nothing.png +0 -0
- data/public/assets/ok-96195c6d50075a63cbdfa11818301f56.png +0 -0
- data/public/assets/ok.png +0 -0
- data/public/assets/plus-dd3920a86d5ea72497854d875c6afc00.gif +0 -0
- data/public/assets/plus.gif +0 -0
- data/public/assets/rdf_flyer-b2cc2d8b2a537a9c74b39450f8e6b16f.gif +0 -0
- data/public/assets/rdf_flyer.gif +0 -0
- data/public/assets/red_arrow-875d1bca1c4b97ec82635af86032a024.png +0 -0
- data/public/assets/red_arrow.png +0 -0
- data/public/assets/shadow-2975795dc944082531617a0c3ad2da70.png +0 -0
- data/public/assets/shadow.png +0 -0
- data/public/assets/spinner-0b76e32ff4e68b1e8789b4d0fe991cd7.gif +0 -0
- data/public/assets/spinner.gif +0 -0
- data/public/assets/tokenizer_delete-94c9b41ce566e499de2090b552e0d167.png +0 -0
- data/public/assets/tokenizer_delete.png +0 -0
- data/public/assets/tokenizer_pencile-b508830af36466f05620d83c544b22ff.png +0 -0
- data/public/assets/tokenizer_pencile.png +0 -0
- data/public/assets/tokenizer_show-152443b9a6c0b058cfb51c51f567116f.png +0 -0
- data/public/assets/tokenizer_show.png +0 -0
- data/public/assets/top_01-fab0825c0529e87fddf883074490dc19.png +0 -0
- data/public/assets/top_01.png +0 -0
- data/public/assets/treeview-black-116394dbf5afda75949a9925de790795.gif +0 -0
- data/public/assets/treeview-black-line-142d898d1f095b3cec1a5dd204daae0d.gif +0 -0
- data/public/assets/treeview-black-line.gif +0 -0
- data/public/assets/treeview-black.gif +0 -0
- data/public/assets/treeview-default-01747815c9007458fc391092548255f8.gif +0 -0
- data/public/assets/treeview-default-line-9aecef4278b9e684f18f3c52e3607f80.gif +0 -0
- data/public/assets/treeview-default-line.gif +0 -0
- data/public/assets/treeview-default.gif +0 -0
- data/public/assets/treeview-famfamfam-c5f86a8a52aa48e87b4bd58878c81ad8.gif +0 -0
- data/public/assets/treeview-famfamfam-line-897ce097b7d84700985608f22e2403c3.gif +0 -0
- data/public/assets/treeview-famfamfam-line.gif +0 -0
- data/public/assets/treeview-famfamfam.gif +0 -0
- data/public/assets/treeview-gray-56089927c44332a8375be41ab13130c8.gif +0 -0
- data/public/assets/treeview-gray-line-d4be395725623b1f39a0964fa479774e.gif +0 -0
- data/public/assets/treeview-gray-line.gif +0 -0
- data/public/assets/treeview-gray.gif +0 -0
- data/public/assets/treeview-red-cb4ed4e5654d76aef755e5c55b63e91c.gif +0 -0
- data/public/assets/treeview-red-line-fdf843bbfba11d00897c7971dff7e806.gif +0 -0
- data/public/assets/treeview-red-line.gif +0 -0
- data/public/assets/treeview-red.gif +0 -0
- data/public/assets/trunk-5686782333e8b4c7e4468c452fb52cec.png +0 -0
- data/public/assets/trunk.png +0 -0
- data/public/assets/unfinished-1cb6bae22a5b855f4b51cb03a1cce928.png +0 -0
- data/public/assets/unfinished.png +0 -0
- data/test/integration/client_edit_concept_test.rb +0 -1
- data/test/integration/instance_configuration_test.rb +74 -0
- data/test/integration/untranslated_test.rb +1 -1
- data/test/integration_test_helper.rb +2 -0
- data/test/unit/concept_test.rb +1 -1
- data/test/unit/instance_configuration_test.rb +42 -0
- data/test/unit/skos_import_test.rb +4 -3
- data/vendor/assets/javascripts/json2.js +27 -25
- metadata +201 -19
- data/db/iqvoc_test.sqlite3 +0 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
module Iqvoc
|
4
|
+
module Configuration
|
5
|
+
module Core
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
mattr_accessor :searchable_class_names,
|
10
|
+
:unlimited_search_results,
|
11
|
+
:default_rdf_namespace_helper_methods,
|
12
|
+
:rdf_namespaces,
|
13
|
+
:change_note_class_name,
|
14
|
+
:first_level_class_configuration_modules,
|
15
|
+
:ability_class_name,
|
16
|
+
:core_assets
|
17
|
+
|
18
|
+
self.core_assets = %w(
|
19
|
+
manifest.css
|
20
|
+
manifest.js
|
21
|
+
blueprint/screen.css
|
22
|
+
blueprint/print.css
|
23
|
+
blueprint/ie.css
|
24
|
+
iqvoc/ie_fixes.css
|
25
|
+
excanvas.js
|
26
|
+
jit_rgraph.js
|
27
|
+
iqvoc/visualization.js
|
28
|
+
json2.js
|
29
|
+
)
|
30
|
+
|
31
|
+
self.searchable_class_names = [
|
32
|
+
'Labeling::SKOS::Base',
|
33
|
+
'Labeling::SKOS::PrefLabel',
|
34
|
+
'Note::Base'
|
35
|
+
]
|
36
|
+
self.unlimited_search_results = false
|
37
|
+
|
38
|
+
self.default_rdf_namespace_helper_methods = [:iqvoc_default_rdf_namespaces]
|
39
|
+
|
40
|
+
self.rdf_namespaces = {
|
41
|
+
:rdf => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
42
|
+
:rdfs => "http://www.w3.org/2000/01/rdf-schema#",
|
43
|
+
:owl => "http://www.w3.org/2002/07/owl#",
|
44
|
+
:skos => "http://www.w3.org/2004/02/skos/core#",
|
45
|
+
:dct => "http://purl.org/dc/terms/"
|
46
|
+
}
|
47
|
+
|
48
|
+
# The class to use for automatic generation of change notes on every save
|
49
|
+
self.change_note_class_name = 'Note::SKOS::ChangeNote'
|
50
|
+
|
51
|
+
self.first_level_class_configuration_modules = [] # Will be set in the modules
|
52
|
+
|
53
|
+
self.ability_class_name = 'Iqvoc::Ability'
|
54
|
+
|
55
|
+
# initialize
|
56
|
+
self.config.register_settings({
|
57
|
+
"title" => "iQvoc",
|
58
|
+
"available_languages" => ["en", "de"],
|
59
|
+
"languages.pref_labeling" => ["en", "de"],
|
60
|
+
"languages.further_labelings.Labeling::SKOS::AltLabel" => ["en", "de"]
|
61
|
+
})
|
62
|
+
self.config.initialize_cache
|
63
|
+
end
|
64
|
+
|
65
|
+
module ClassMethods
|
66
|
+
def generate_secret_token
|
67
|
+
require 'securerandom'
|
68
|
+
|
69
|
+
template = Rails.root.join("config", "initializers", "secret_token.rb.template")
|
70
|
+
raise "File not found: #{template}" unless File.exist?(template)
|
71
|
+
|
72
|
+
file_name = "config/initializers/secret_token.rb"
|
73
|
+
|
74
|
+
token = SecureRandom.hex(64)
|
75
|
+
txt = File.read(template)
|
76
|
+
txt.gsub!("S-E-C-R-E-T", token)
|
77
|
+
|
78
|
+
File.open(file_name, "w") do |f|
|
79
|
+
f.write txt
|
80
|
+
end
|
81
|
+
|
82
|
+
puts "Secret token configuration has been created in #{file_name}."
|
83
|
+
end
|
84
|
+
|
85
|
+
# ************** instance configuration **************
|
86
|
+
|
87
|
+
def config(&block)
|
88
|
+
cfg = InstanceConfiguration.instance
|
89
|
+
if block
|
90
|
+
block.call(cfg)
|
91
|
+
else
|
92
|
+
return cfg
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def change_note_class
|
97
|
+
change_note_class_name.constantize
|
98
|
+
end
|
99
|
+
|
100
|
+
def searchable_classes
|
101
|
+
searchable_class_names.map(&:constantize)
|
102
|
+
end
|
103
|
+
|
104
|
+
def first_level_classes
|
105
|
+
self.first_level_class_configuration_modules.map { |mod| mod.send(:base_class) }
|
106
|
+
end
|
107
|
+
|
108
|
+
def ability_class
|
109
|
+
ability_class_name.constantize
|
110
|
+
end
|
111
|
+
|
112
|
+
def title
|
113
|
+
return config["title"]
|
114
|
+
end
|
115
|
+
|
116
|
+
def available_languages
|
117
|
+
return config["available_languages"]
|
118
|
+
end
|
119
|
+
|
120
|
+
# @deprecated
|
121
|
+
def title=(value)
|
122
|
+
ActiveSupport::Deprecation.warn "title has been moved into instance configuration", caller
|
123
|
+
self.config.register_setting("available_languages", value)
|
124
|
+
end
|
125
|
+
|
126
|
+
# @deprecated
|
127
|
+
def available_languages=(value)
|
128
|
+
ActiveSupport::Deprecation.warn "available_languages has been moved into instance configuration", caller
|
129
|
+
self.config.register_setting("available_languages", value)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
module Iqvoc
|
4
|
+
module Configuration
|
5
|
+
module Label
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
mattr_accessor :base_class_name
|
10
|
+
self.base_class_name = 'Label::SKOS::Base'
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
# Do not use the following method in models. This will probably cause a
|
15
|
+
# loading loop (something like "expected file xyz to load ...")
|
16
|
+
def base_class
|
17
|
+
base_class_name.constantize
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
module Iqvoc
|
4
|
+
module ControllerExtensions
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
prepend_before_filter :set_locale
|
9
|
+
before_filter :ensure_extension
|
10
|
+
before_filter :require_user
|
11
|
+
|
12
|
+
helper :all
|
13
|
+
helper_method :current_user_session, :current_user, :concept_widget_data, :collection_widget_data, :label_widget_data
|
14
|
+
|
15
|
+
rescue_from ActiveRecord::RecordNotFound, :with => :handle_not_found
|
16
|
+
rescue_from CanCan::AccessDenied, :with => :handle_access_denied
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
def default_url_options(options = nil)
|
22
|
+
{ :format => params[:format], :lang => I18n.locale }.
|
23
|
+
reject { |key, value| key == :lang and value.to_s.strip.blank? }. # Strip out the lang parameter if it's empty.
|
24
|
+
merge(options || {})
|
25
|
+
end
|
26
|
+
|
27
|
+
# Force an extension to every url. (LOD)
|
28
|
+
def ensure_extension
|
29
|
+
unless params[:format] || request.method != "GET"
|
30
|
+
flash.keep
|
31
|
+
redirect_to url_for(params.merge(:format => (request.format && request.format.symbol) || :html))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def handle_access_denied(exception)
|
36
|
+
@exception = exception
|
37
|
+
render :template => 'errors/access_denied', :status => :access_denied
|
38
|
+
end
|
39
|
+
|
40
|
+
def handle_multiple_choices(exception)
|
41
|
+
@exception = exception
|
42
|
+
render :template => 'errors/multiple_choices', :status => :multiple_choices
|
43
|
+
end
|
44
|
+
|
45
|
+
def handle_not_found(exception)
|
46
|
+
@exception = exception
|
47
|
+
SearchResultsController.prepare_basic_variables(self)
|
48
|
+
|
49
|
+
respond_to do |format|
|
50
|
+
format.html { render :template => 'errors/not_found', :status => :not_found }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_locale
|
55
|
+
if Iqvoc::Concept.pref_labeling_languages.include?(nil)
|
56
|
+
I18n.locale = " "
|
57
|
+
elsif params[:lang] && Iqvoc::Concept.pref_labeling_languages.include?(params[:lang])
|
58
|
+
I18n.locale = params[:lang]
|
59
|
+
else
|
60
|
+
I18n.locale = Iqvoc::Concept.pref_labeling_languages.first
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def concept_widget_data(concept)
|
65
|
+
{
|
66
|
+
:id => concept.origin,
|
67
|
+
:name => concept.pref_label.value.to_s + (concept.additional_info ? " (#{concept.additional_info })" : "")
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def collection_widget_data(collection)
|
72
|
+
{
|
73
|
+
:id => collection.origin,
|
74
|
+
:name => collection.pref_label.to_s
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
def label_widget_data(label)
|
79
|
+
{
|
80
|
+
:id => label.origin,
|
81
|
+
:name => label.value
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
# Configurable Ability class
|
86
|
+
def current_ability
|
87
|
+
@current_ability ||= Iqvoc.ability_class.new(current_user)
|
88
|
+
end
|
89
|
+
|
90
|
+
def current_user_session
|
91
|
+
return @current_user_session if defined?(@current_user_session)
|
92
|
+
@current_user_session = UserSession.find
|
93
|
+
end
|
94
|
+
|
95
|
+
def current_user
|
96
|
+
return @current_user if defined?(@current_user)
|
97
|
+
@current_user = current_user_session && current_user_session.user
|
98
|
+
end
|
99
|
+
|
100
|
+
# TODO: Don't require an user (this is skipped in nearly every controller).
|
101
|
+
# Use Abilitys instead and handle the AccessDeniedException: (#handle_access_denied)
|
102
|
+
# * User logged in: Exception!
|
103
|
+
# * User not logged in: Redirect to login path!
|
104
|
+
# Don't forget to delete this method and all the /.*before_filter :require_user/
|
105
|
+
# statements in the controllers.
|
106
|
+
def require_user
|
107
|
+
unless current_user
|
108
|
+
flash[:error] = I18n.t("txt.controllers.application.login_required")
|
109
|
+
redirect_to new_user_session_url(:back_to => request.fullpath)
|
110
|
+
return false
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'iqvoc'
|
2
|
+
|
3
|
+
module Iqvoc::Environments
|
4
|
+
|
5
|
+
def self.setup_development(config)
|
6
|
+
# In the development environment your application's code is reloaded on
|
7
|
+
# every request. This slows down response time but is perfect for development
|
8
|
+
# since you don't have to restart the web server when you make code changes.
|
9
|
+
config.cache_classes = false
|
10
|
+
|
11
|
+
# Log error messages when you accidentally call methods on nil.
|
12
|
+
config.whiny_nils = true
|
13
|
+
|
14
|
+
# Show full error reports and disable caching
|
15
|
+
config.consider_all_requests_local = true
|
16
|
+
config.action_controller.perform_caching = false
|
17
|
+
|
18
|
+
# Don't care if the mailer can't send
|
19
|
+
config.action_mailer.raise_delivery_errors = false
|
20
|
+
|
21
|
+
# Print deprecation notices to the Rails logger
|
22
|
+
config.active_support.deprecation = :log
|
23
|
+
|
24
|
+
# Only use best-standards-support built into browsers
|
25
|
+
config.action_dispatch.best_standards_support = :builtin
|
26
|
+
|
27
|
+
# Do not compress assets
|
28
|
+
config.assets.compress = false
|
29
|
+
|
30
|
+
# Expands the lines which load the assets
|
31
|
+
config.assets.debug = true
|
32
|
+
|
33
|
+
# Raise exception on mass assignment protection for Active Record models
|
34
|
+
config.active_record.mass_assignment_sanitizer = :logger
|
35
|
+
|
36
|
+
# Log the query plan for queries taking more than this (works
|
37
|
+
# with SQLite, MySQL, and PostgreSQL)
|
38
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
39
|
+
|
40
|
+
# Prepend all log lines with the following tags
|
41
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
42
|
+
|
43
|
+
# The default URI prefix for RDF data. This will be followed by a document
|
44
|
+
# specific shnippet like (specimenType) and the id.
|
45
|
+
|
46
|
+
# The JDBC driver URL for the connection to the virtuoso triple store.
|
47
|
+
# Login credentials have to be stored here too. See
|
48
|
+
# http://docs.openlinksw.com/virtuoso/VirtuosoDriverJDBC.html#jdbcurl4mat for
|
49
|
+
# more details.
|
50
|
+
# Example: "jdbc:virtuoso://localhost:1111/UID=dba/PWD=dba"
|
51
|
+
# Use nil to disable virtuoso triple synchronization
|
52
|
+
# Rails.application.config.virtuoso_jdbc_driver_url = "jdbc:virtuoso://virtuoso.dyndns.org:1111/UID=iqvoc/PWD=vocpass!/charset=UTF-8"
|
53
|
+
config.virtuoso_jdbc_driver_url = nil
|
54
|
+
|
55
|
+
# Set up the virtuoso synchronization (which is a triggered pull from the
|
56
|
+
# virtuoso server) to be run in a new thread.
|
57
|
+
# This is needed in environments where the web server only runs in a single
|
58
|
+
# process/thread (mostly in development environments).
|
59
|
+
# When a synchronization would be triggered e.g. from a running
|
60
|
+
# update action in the UPB, the update would trigger virtuoso to do a HTTP GET
|
61
|
+
# back to the UPB to fetch the RDF data. But the only process in the UPB would be
|
62
|
+
# blocked by the update... => Deadlock. You can avoid this by using the threaded
|
63
|
+
# mode.
|
64
|
+
config.virtuoso_sync_threaded = false
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'iqvoc'
|
2
|
+
|
3
|
+
module Iqvoc::Environments
|
4
|
+
|
5
|
+
def self.setup_production(config)
|
6
|
+
# The production environment is meant for finished, "live" apps.
|
7
|
+
# Code is not reloaded between requests
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Full error reports are disabled and caching is turned on
|
11
|
+
config.consider_all_requests_local = false
|
12
|
+
config.action_controller.perform_caching = true
|
13
|
+
|
14
|
+
# Specifies the header that your server uses for sending files
|
15
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
16
|
+
|
17
|
+
# For nginx:
|
18
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
19
|
+
|
20
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
21
|
+
# just comment this out and Rails will serve the files
|
22
|
+
|
23
|
+
# See everything in the log (default is :info)
|
24
|
+
# config.log_level = :debug
|
25
|
+
|
26
|
+
# Use a different logger for distributed setups
|
27
|
+
# config.logger = SyslogLogger.new
|
28
|
+
|
29
|
+
# Use a different cache store in production
|
30
|
+
# config.cache_store = :mem_cache_store
|
31
|
+
|
32
|
+
# Disable Rails's static asset server
|
33
|
+
# In production, Apache or nginx will already do this
|
34
|
+
config.serve_static_assets = false
|
35
|
+
|
36
|
+
# Compress JavaScripts and CSS
|
37
|
+
config.assets.compress = true
|
38
|
+
|
39
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
40
|
+
config.assets.compile = false
|
41
|
+
|
42
|
+
# Generate digests for assets URLs
|
43
|
+
config.assets.digest = true
|
44
|
+
|
45
|
+
config.assets.precompile += Iqvoc.core_assets
|
46
|
+
|
47
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
48
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
49
|
+
|
50
|
+
# Disable delivery errors, bad email addresses will be ignored
|
51
|
+
# config.action_mailer.raise_delivery_errors = false
|
52
|
+
|
53
|
+
# Enable threaded mode
|
54
|
+
# config.threadsafe!
|
55
|
+
|
56
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
57
|
+
# the I18n.default_locale when a translation can not be found)
|
58
|
+
config.i18n.fallbacks = true
|
59
|
+
|
60
|
+
# Send deprecation notices to registered listeners
|
61
|
+
config.active_support.deprecation = :notify
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'iqvoc'
|
2
|
+
|
3
|
+
module Iqvoc::Environments
|
4
|
+
|
5
|
+
def self.setup_test(config)
|
6
|
+
# The test environment is used exclusively to run your application's
|
7
|
+
# test suite. You never need to work with it otherwise. Remember that
|
8
|
+
# your test database is "scratch space" for the test suite and is wiped
|
9
|
+
# and recreated between test runs. Don't rely on the data there!
|
10
|
+
config.cache_classes = true
|
11
|
+
|
12
|
+
# Log error messages when you accidentally call methods on nil.
|
13
|
+
config.whiny_nils = true
|
14
|
+
|
15
|
+
# Show full error reports and disable caching
|
16
|
+
config.consider_all_requests_local = true
|
17
|
+
config.action_controller.perform_caching = false
|
18
|
+
|
19
|
+
# Raise exceptions instead of rendering exception templates
|
20
|
+
config.action_dispatch.show_exceptions = false
|
21
|
+
|
22
|
+
# Disable request forgery protection in test environment
|
23
|
+
config.action_controller.allow_forgery_protection = false
|
24
|
+
|
25
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
26
|
+
# The :test delivery method accumulates sent emails in the
|
27
|
+
# ActionMailer::Base.deliveries array.
|
28
|
+
config.action_mailer.delivery_method = :test
|
29
|
+
|
30
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
31
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
32
|
+
# like if you have constraints or database-specific column types
|
33
|
+
# config.active_record.schema_format = :sql
|
34
|
+
|
35
|
+
# Print deprecation notices to the stderr
|
36
|
+
config.active_support.deprecation = :stderr
|
37
|
+
|
38
|
+
# Configure static asset server for tests with Cache-Control for performance
|
39
|
+
config.serve_static_assets = true
|
40
|
+
config.static_cache_control = "public, max-age=3600"
|
41
|
+
|
42
|
+
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
|
43
|
+
config.assets.allow_debugging = true
|
44
|
+
|
45
|
+
# Raise exception on mass assignment protection for Active Record models
|
46
|
+
config.active_record.mass_assignment_sanitizer = :logger
|
47
|
+
|
48
|
+
# Print deprecation notices to the stderr
|
49
|
+
config.active_support.deprecation = :stderr
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|