iqvoc 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +43 -47
- data/app/assets/javascripts/framework.js +1 -1
- data/app/assets/javascripts/iqvoc/extract_concepts.js +19 -0
- data/app/assets/javascripts/iqvoc/iqvoc.js +8 -12
- data/app/assets/javascripts/iqvoc/manifest.js +3 -0
- data/app/assets/javascripts/iqvoc/onebox.js +44 -0
- data/app/assets/javascripts/iqvoc/quicksearch.js +41 -0
- data/app/assets/stylesheets/framework.css +1 -1
- data/app/assets/stylesheets/iqvoc/bootstrap_extensions.css.scss +0 -7
- data/app/assets/stylesheets/iqvoc/components.css.scss +27 -1
- data/app/assets/stylesheets/iqvoc/manifest.css +0 -1
- data/app/controllers/application_controller.rb +1 -1
- data/app/controllers/concepts/alphabetical_controller.rb +5 -1
- data/app/controllers/concepts/untranslated_controller.rb +1 -1
- data/app/controllers/concepts_controller.rb +2 -0
- data/app/controllers/frontpage_controller.rb +23 -0
- data/app/controllers/instance_configuration_controller.rb +10 -2
- data/app/controllers/pages_controller.rb +21 -0
- data/app/controllers/rdf_controller.rb +0 -21
- data/app/helpers/concepts_helper.rb +1 -1
- data/app/helpers/navigation_helper.rb +0 -10
- data/app/helpers/rdf_helper.rb +1 -1
- data/app/models/concept/base.rb +2 -2
- data/app/models/concept/skos/base.rb +1 -1
- data/app/models/label/base.rb +5 -2
- data/app/models/labeling/base.rb +2 -2
- data/app/models/labeling/skos/base.rb +1 -1
- data/app/models/note/base.rb +0 -6
- data/app/models/note/skos/base.rb +20 -8
- data/app/views/concepts/alphabetical/index.html.erb +2 -2
- data/app/views/{rdf/show_concept.iqrdf → concepts/show.iqrdf} +1 -1
- data/app/views/concepts/show_published.html.erb +0 -1
- data/app/views/concepts/show_unpublished.html.erb +0 -1
- data/app/views/concepts/sidebars/_plural.html.erb +3 -3
- data/app/views/concepts/sidebars/_singular.html.erb +4 -5
- data/app/views/concepts/untranslated/index.html.erb +1 -1
- data/app/views/frontpage/index.html.erb +8 -0
- data/app/views/instance_configuration/index.html.erb +8 -5
- data/app/views/layouts/_navigation.html.erb +10 -8
- data/app/views/layouts/application.html.erb +3 -1
- data/app/views/pages/help.html.erb +75 -0
- data/app/views/partials/labeling/skos/_base.html.erb +2 -1
- data/config/initializers/language.rb +1 -1
- data/config/locales/de.yml +8 -0
- data/config/locales/en.yml +8 -0
- data/config/routes.rb +8 -6
- data/lib/generators/app/template.rb +1 -1
- data/lib/iqvoc/ability.rb +3 -0
- data/lib/iqvoc/configuration/collection.rb +2 -2
- data/lib/iqvoc/configuration/concept.rb +1 -1
- data/lib/iqvoc/configuration/core.rb +6 -4
- data/lib/iqvoc/configuration/label.rb +2 -2
- data/lib/iqvoc/controller_extensions.rb +1 -1
- data/lib/iqvoc/environments/development.rb +6 -0
- data/lib/iqvoc/environments/production.rb +6 -0
- data/lib/iqvoc/environments/test.rb +6 -0
- data/lib/iqvoc/instance_configuration.rb +3 -2
- data/lib/iqvoc/skos_importer.rb +23 -0
- data/lib/iqvoc/version.rb +1 -1
- data/lib/tasks/importer.rake +2 -2
- data/test/integration/alphabetical_test.rb +2 -2
- data/test/integration/browse_concepts_and_labels_test.rb +4 -4
- data/test/integration/untranslated_test.rb +3 -3
- data/test/unit/hygiene_test.rb +4 -0
- data/test/unit/instance_configuration_test.rb +17 -1
- data/test/unit/skos_import_test.rb +19 -0
- data/vendor/assets/images/jquery-ui/ui-icons_469bdd_256x240.png +0 -0
- data/vendor/assets/javascripts/{jquery-ui-1.8.20.custom.js → jquery-ui-1.8.23.custom.js} +124 -69
- data/vendor/assets/stylesheets/{jquery-ui-1.8.20.custom.css → jquery-ui-1.8.23.custom.css} +5 -7
- metadata +34 -31
- data/app/assets/javascripts/iqvoc/visualization.js +0 -321
- data/app/views/concepts/_visualization.html.erb +0 -11
- data/vendor/assets/javascripts/excanvas.js +0 -35
- data/vendor/assets/javascripts/jit_rgraph.js +0 -153
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -36,18 +36,16 @@ GEM
|
|
|
36
36
|
activesupport (3.2.6)
|
|
37
37
|
i18n (~> 0.6)
|
|
38
38
|
multi_json (~> 1.0)
|
|
39
|
-
addressable (2.2
|
|
40
|
-
ansi (1.4.
|
|
39
|
+
addressable (2.3.2)
|
|
40
|
+
ansi (1.4.3)
|
|
41
41
|
arel (3.0.2)
|
|
42
|
-
authlogic (3.1.
|
|
42
|
+
authlogic (3.1.3)
|
|
43
43
|
activerecord (>= 3.0.0)
|
|
44
|
-
activerecord (>= 3.0.7)
|
|
45
44
|
activesupport (>= 3.0.0)
|
|
46
|
-
|
|
47
|
-
awesome_print (1.0.2)
|
|
45
|
+
awesome_print (1.1.0)
|
|
48
46
|
bouncy-castle-java (1.5.0146.1)
|
|
49
|
-
builder (3.0.
|
|
50
|
-
cancan (1.6.
|
|
47
|
+
builder (3.0.3)
|
|
48
|
+
cancan (1.6.8)
|
|
51
49
|
capybara (1.1.2)
|
|
52
50
|
mime-types (>= 1.16)
|
|
53
51
|
nokogiri (>= 1.3.3)
|
|
@@ -55,36 +53,36 @@ GEM
|
|
|
55
53
|
rack-test (>= 0.5.4)
|
|
56
54
|
selenium-webdriver (~> 2.0)
|
|
57
55
|
xpath (~> 0.1.4)
|
|
58
|
-
capybara-screenshot (0.
|
|
56
|
+
capybara-screenshot (0.2.2)
|
|
59
57
|
capybara (>= 1.0)
|
|
60
58
|
capybara-webkit (0.12.1)
|
|
61
59
|
capybara (>= 1.0.0, < 1.2)
|
|
62
60
|
json
|
|
63
|
-
childprocess (0.3.
|
|
64
|
-
ffi (~> 1.0.6)
|
|
61
|
+
childprocess (0.3.5)
|
|
62
|
+
ffi (~> 1.0, >= 1.0.6)
|
|
65
63
|
database_cleaner (0.8.0)
|
|
66
64
|
erubis (2.7.0)
|
|
67
|
-
excon (0.
|
|
65
|
+
excon (0.16.2)
|
|
68
66
|
execjs (1.4.0)
|
|
69
67
|
multi_json (~> 1.0)
|
|
70
|
-
factory_girl (
|
|
68
|
+
factory_girl (4.1.0)
|
|
71
69
|
activesupport (>= 3.0.0)
|
|
72
|
-
factory_girl_rails (
|
|
73
|
-
factory_girl (~>
|
|
70
|
+
factory_girl_rails (4.1.0)
|
|
71
|
+
factory_girl (~> 4.1.0)
|
|
74
72
|
railties (>= 3.0.0)
|
|
75
73
|
fastercsv (1.5.5)
|
|
76
|
-
ffi (1.
|
|
77
|
-
ffi (1.
|
|
78
|
-
heroku (2.
|
|
79
|
-
heroku-api (~> 0.
|
|
74
|
+
ffi (1.1.5)
|
|
75
|
+
ffi (1.1.5-java)
|
|
76
|
+
heroku (2.31.2)
|
|
77
|
+
heroku-api (~> 0.3.4)
|
|
80
78
|
launchy (>= 0.3.2)
|
|
81
|
-
netrc (~> 0.7.
|
|
79
|
+
netrc (~> 0.7.7)
|
|
82
80
|
rest-client (~> 1.6.1)
|
|
83
81
|
rubyzip
|
|
84
|
-
heroku-api (0.
|
|
85
|
-
excon (~> 0.
|
|
82
|
+
heroku-api (0.3.5)
|
|
83
|
+
excon (~> 0.16.1)
|
|
86
84
|
hike (1.2.1)
|
|
87
|
-
i18n (0.6.
|
|
85
|
+
i18n (0.6.1)
|
|
88
86
|
iq_rdf (0.1.5)
|
|
89
87
|
builder
|
|
90
88
|
bundler
|
|
@@ -93,33 +91,32 @@ GEM
|
|
|
93
91
|
journey (1.0.4)
|
|
94
92
|
jruby-openssl (0.7.7)
|
|
95
93
|
bouncy-castle-java (>= 1.5.0146.1)
|
|
96
|
-
json (1.7.
|
|
97
|
-
json (1.7.
|
|
94
|
+
json (1.7.5)
|
|
95
|
+
json (1.7.5-java)
|
|
98
96
|
kaminari (0.13.0)
|
|
99
97
|
actionpack (>= 3.0.0)
|
|
100
98
|
activesupport (>= 3.0.0)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
ffi (~> 1.0.9)
|
|
99
|
+
launchy (2.1.2)
|
|
100
|
+
addressable (~> 2.3)
|
|
101
|
+
launchy (2.1.2-java)
|
|
102
|
+
addressable (~> 2.3)
|
|
103
|
+
ffi (~> 1.1.1)
|
|
107
104
|
spoon (~> 0.0.1)
|
|
108
105
|
libv8 (3.3.10.4)
|
|
109
|
-
libwebsocket (0.1.
|
|
106
|
+
libwebsocket (0.1.5)
|
|
110
107
|
addressable
|
|
111
108
|
mail (2.4.4)
|
|
112
109
|
i18n (>= 0.4.0)
|
|
113
110
|
mime-types (~> 1.16)
|
|
114
111
|
treetop (~> 1.4.8)
|
|
115
|
-
mime-types (1.
|
|
116
|
-
minitest (3.0
|
|
112
|
+
mime-types (1.19)
|
|
113
|
+
minitest (3.4.0)
|
|
117
114
|
multi_json (1.3.6)
|
|
118
115
|
mysql2 (0.3.11)
|
|
119
|
-
netrc (0.7.
|
|
120
|
-
nokogiri (1.5.
|
|
121
|
-
nokogiri (1.5.
|
|
122
|
-
pg (0.
|
|
116
|
+
netrc (0.7.7)
|
|
117
|
+
nokogiri (1.5.5)
|
|
118
|
+
nokogiri (1.5.5-java)
|
|
119
|
+
pg (0.14.1)
|
|
123
120
|
polyglot (0.3.3)
|
|
124
121
|
rack (1.4.1)
|
|
125
122
|
rack-cache (1.2)
|
|
@@ -150,15 +147,14 @@ GEM
|
|
|
150
147
|
json (~> 1.4)
|
|
151
148
|
rest-client (1.6.7)
|
|
152
149
|
mime-types (>= 1.16)
|
|
153
|
-
rubyzip (0.9.
|
|
154
|
-
sass (3.1
|
|
150
|
+
rubyzip (0.9.9)
|
|
151
|
+
sass (3.2.1)
|
|
155
152
|
sass-rails (3.2.5)
|
|
156
153
|
railties (~> 3.2.0)
|
|
157
154
|
sass (>= 3.1.10)
|
|
158
155
|
tilt (~> 1.3)
|
|
159
|
-
selenium-webdriver (2.
|
|
156
|
+
selenium-webdriver (2.25.0)
|
|
160
157
|
childprocess (>= 0.2.5)
|
|
161
|
-
ffi (~> 1.0)
|
|
162
158
|
libwebsocket (~> 0.1.3)
|
|
163
159
|
multi_json (~> 1.0)
|
|
164
160
|
rubyzip
|
|
@@ -174,19 +170,19 @@ GEM
|
|
|
174
170
|
rack (~> 1.0)
|
|
175
171
|
tilt (~> 1.1, != 1.3.0)
|
|
176
172
|
sqlite3 (1.3.6)
|
|
177
|
-
therubyracer (0.10.
|
|
173
|
+
therubyracer (0.10.2)
|
|
178
174
|
libv8 (~> 3.3.10)
|
|
179
|
-
thor (0.
|
|
175
|
+
thor (0.16.0)
|
|
180
176
|
tilt (1.3.3)
|
|
181
177
|
treetop (1.4.10)
|
|
182
178
|
polyglot
|
|
183
179
|
polyglot (>= 0.3.1)
|
|
184
|
-
turn (0.9.
|
|
180
|
+
turn (0.9.6)
|
|
185
181
|
ansi
|
|
186
182
|
tzinfo (0.3.33)
|
|
187
|
-
uglifier (1.
|
|
183
|
+
uglifier (1.3.0)
|
|
188
184
|
execjs (>= 0.3.0)
|
|
189
|
-
multi_json (>= 1.0.2)
|
|
185
|
+
multi_json (~> 1.0, >= 1.0.2)
|
|
190
186
|
view_marker (1.0.0)
|
|
191
187
|
rails
|
|
192
188
|
xpath (0.1.4)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*jslint vars: true, white: true */
|
|
2
|
+
/*global jQuery, IQVOC */
|
|
3
|
+
|
|
4
|
+
IQVOC.extractConcepts = function(html) {
|
|
5
|
+
"use strict";
|
|
6
|
+
var $ = jQuery;
|
|
7
|
+
|
|
8
|
+
// disable scripts (adapted from jQuery's `load`)
|
|
9
|
+
var rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
|
|
10
|
+
html = html.replace(rscript, "");
|
|
11
|
+
|
|
12
|
+
var concepts = $("<div />").append(html).find("ul.concepts li");
|
|
13
|
+
concepts = concepts.map(function(i, node) {
|
|
14
|
+
var el = $("a", node);
|
|
15
|
+
return { value: el.attr("href"), label: $.trim(el.text()) };
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return concepts.length ? Array.prototype.slice.call(concepts, 0) : [];
|
|
19
|
+
};
|
|
@@ -26,18 +26,18 @@ var createNote = function(ev) {
|
|
|
26
26
|
|
|
27
27
|
clone.find("label").each(function(index, element) {
|
|
28
28
|
var el = $(element);
|
|
29
|
-
if
|
|
29
|
+
if(el.attr("for")) {
|
|
30
30
|
el.attr("for", el.attr("for").replace(/_\d+_/, newIdCount));
|
|
31
31
|
}
|
|
32
|
-
})
|
|
32
|
+
});
|
|
33
33
|
|
|
34
34
|
clone.find(inputSelector).each(function(index, element) {
|
|
35
35
|
var el = $(element);
|
|
36
36
|
el.val("");
|
|
37
|
-
if
|
|
37
|
+
if(el.attr("id")) {
|
|
38
38
|
el.attr("id", el.attr("id").replace(/_\d+_/, newIdCount));
|
|
39
39
|
}
|
|
40
|
-
if
|
|
40
|
+
if(el.attr("name")) {
|
|
41
41
|
el.attr("name", el.attr("name").replace(/\[\d+\]/, newNameCount));
|
|
42
42
|
}
|
|
43
43
|
});
|
|
@@ -67,15 +67,9 @@ return {
|
|
|
67
67
|
jQuery(document).ready(function($) {
|
|
68
68
|
"use strict";
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
IQVOC.quicksearch(".quicksearch");
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
IQVOC.visualization.init("infovis", function(container) {
|
|
74
|
-
if(IQVOC.Storage.getItem("visualization") === "enlarged") {
|
|
75
|
-
container.data("widget").toggleSize(true);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
72
|
+
var locale = document.documentElement.getAttribute("lang");
|
|
79
73
|
|
|
80
74
|
// language selection
|
|
81
75
|
$("#language_selection .dropdown-toggle").click(function(ev) { // use Bootstrap's Dropwdown, but without the side-effects
|
|
@@ -202,4 +196,6 @@ jQuery(document).ready(function($) {
|
|
|
202
196
|
}
|
|
203
197
|
});
|
|
204
198
|
});
|
|
199
|
+
|
|
200
|
+
IQVOC.onebox(".onebox");
|
|
205
201
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*jslint vars: true, browser: true, white: true */
|
|
2
|
+
/*global jQuery, IQVOC */
|
|
3
|
+
|
|
4
|
+
IQVOC.onebox = (function($) {
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var renderResults = function(concepts, container) {
|
|
9
|
+
container.empty();
|
|
10
|
+
$.each(concepts, function(i, concept) {
|
|
11
|
+
var link = $("<a />").attr("href", concept.value).text(concept.label);
|
|
12
|
+
$("<li />").append(link).appendTo(container);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var getConcepts = function(input, container) {
|
|
17
|
+
var form = input.closest("form");
|
|
18
|
+
$.ajax({
|
|
19
|
+
type: form.attr("method"),
|
|
20
|
+
url: form.attr("action"),
|
|
21
|
+
data: form.serialize(),
|
|
22
|
+
success: function(data, status, xhr) {
|
|
23
|
+
renderResults(IQVOC.extractConcepts(data), container);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return function(selector, options) {
|
|
29
|
+
var container = $(selector);
|
|
30
|
+
var input = container.find("input[type=search]");
|
|
31
|
+
var initialValue = input.val();
|
|
32
|
+
var resultList = $("<ul />").addClass("results").appendTo(container);
|
|
33
|
+
|
|
34
|
+
input.keyup(function() {
|
|
35
|
+
if (input.val().length == 0) {
|
|
36
|
+
resultList.empty();
|
|
37
|
+
}
|
|
38
|
+
else if (input.val().length > 0 && input.val() != initialValue) {
|
|
39
|
+
setTimeout(function() { getConcepts(input, resultList) }, 200);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
}(jQuery));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*jslint vars: true, browser: true, white: true */
|
|
2
|
+
/*global jQuery, IQVOC */
|
|
3
|
+
|
|
4
|
+
IQVOC.quicksearch = (function($) {
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
var defaults = {
|
|
9
|
+
minLength: 3,
|
|
10
|
+
autoFocus: true,
|
|
11
|
+
source: getConcepts,
|
|
12
|
+
focus: function(ev, ui) { ev.preventDefault(); },
|
|
13
|
+
select: onSelect
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function onSelect(ev, ui) {
|
|
17
|
+
if(ui.item.value) {
|
|
18
|
+
$(ev.target).val(ui.item.label);
|
|
19
|
+
document.location = ui.item.value;
|
|
20
|
+
}
|
|
21
|
+
ev.preventDefault();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getConcepts(req, callback) {
|
|
25
|
+
var form = $(this.element).closest("form");
|
|
26
|
+
$.ajax({
|
|
27
|
+
type: form.attr("method"),
|
|
28
|
+
url: form.attr("action"),
|
|
29
|
+
data: form.serialize(),
|
|
30
|
+
success: function(data, status, xhr) {
|
|
31
|
+
callback(IQVOC.extractConcepts(data));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return function(selector, options) {
|
|
37
|
+
options = options ? $.extend(defaults, options) : defaults;
|
|
38
|
+
$(selector).autocomplete(options);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
}(jQuery));
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
.navbar {
|
|
2
|
+
.quicksearch {
|
|
3
|
+
}
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.onebox {
|
|
7
|
+
padding-top: 80px;
|
|
8
|
+
margin-top: 2em;
|
|
9
|
+
text-align: center;
|
|
10
|
+
|
|
11
|
+
background: asset-data-url("iqvoc_logo.png") top center no-repeat;
|
|
12
|
+
|
|
13
|
+
.logo {
|
|
14
|
+
margin: 2em 0 1em 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
input {
|
|
18
|
+
min-width: 60%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ul {
|
|
22
|
+
margin-left: 0;
|
|
23
|
+
list-style: none;
|
|
24
|
+
text-align: left;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
1
28
|
tr.highlightable {
|
|
2
29
|
cursor: pointer;
|
|
3
30
|
}
|
|
@@ -79,4 +106,3 @@ dt {
|
|
|
79
106
|
}
|
|
80
107
|
}
|
|
81
108
|
}
|
|
82
|
-
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
|
|
17
|
-
require
|
|
17
|
+
require 'iqvoc/controller_extensions'
|
|
18
18
|
|
|
19
19
|
class ApplicationController < ActionController::Base
|
|
20
20
|
include Iqvoc::ControllerExtensions
|
|
@@ -19,9 +19,13 @@ class Concepts::AlphabeticalController < ConceptsController
|
|
|
19
19
|
def index
|
|
20
20
|
authorize! :read, Concept::Base
|
|
21
21
|
|
|
22
|
+
params[:prefix] = params[:letter] if params[:prefix].nil? # legacy compatibility -- XXX: unnecessary!?
|
|
23
|
+
|
|
24
|
+
redirect_to(url_for :prefix => "a") unless params[:prefix]
|
|
25
|
+
|
|
22
26
|
@pref_labelings = Iqvoc::Concept.pref_labeling_class.
|
|
23
27
|
concept_published.
|
|
24
|
-
label_begins_with(params[:
|
|
28
|
+
label_begins_with(params[:prefix]).
|
|
25
29
|
by_label_language(I18n.locale).
|
|
26
30
|
includes(:target).
|
|
27
31
|
order("LOWER(#{Label::Base.table_name}.value)").
|
|
@@ -24,7 +24,7 @@ class Concepts::UntranslatedController < ConceptsController
|
|
|
24
24
|
authorize! :read, Concept::Base
|
|
25
25
|
|
|
26
26
|
scope = Iqvoc::Concept.pref_labeling_class.label_class.
|
|
27
|
-
begins_with(params[:
|
|
27
|
+
begins_with(params[:prefix]).
|
|
28
28
|
missing_translation(I18n.locale, Iqvoc::Concept.pref_labeling_languages.first)
|
|
29
29
|
|
|
30
30
|
if I18n.locale.to_s == Iqvoc::Concept.pref_labeling_languages.first # TODO: Should be 404!
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
class FrontpageController < ApplicationController
|
|
18
|
+
|
|
19
|
+
def index
|
|
20
|
+
@suppress_quicksearch = true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -67,7 +67,7 @@ class InstanceConfigurationController < ApplicationController
|
|
|
67
67
|
Iqvoc::InstanceConfiguration.validate_value(value)
|
|
68
68
|
if default_value.is_a?(Array)
|
|
69
69
|
return value.to_csv.strip
|
|
70
|
-
else # String, Fixnum / Float
|
|
70
|
+
else # boolean, String, Fixnum / Float
|
|
71
71
|
return value.to_s
|
|
72
72
|
end
|
|
73
73
|
end
|
|
@@ -89,7 +89,15 @@ class InstanceConfigurationController < ApplicationController
|
|
|
89
89
|
# converts string to given (non-complex) type
|
|
90
90
|
# raises TypeError on failure
|
|
91
91
|
def convert_value(str, type)
|
|
92
|
-
if type
|
|
92
|
+
if [TrueClass, FalseClass].include?(type)
|
|
93
|
+
if str == "true"
|
|
94
|
+
return true
|
|
95
|
+
elsif str == "false"
|
|
96
|
+
return false
|
|
97
|
+
else
|
|
98
|
+
raise TypeError, "expected boolean"
|
|
99
|
+
end
|
|
100
|
+
elsif type == String
|
|
93
101
|
return str
|
|
94
102
|
elsif type == Fixnum
|
|
95
103
|
raise TypeError, "expected integer" unless str =~ /^[-+]?[0-9]+$/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
class PagesController < ApplicationController
|
|
18
|
+
def help
|
|
19
|
+
authorize! :read, :help
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -27,25 +27,4 @@ class RdfController < ApplicationController
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def show
|
|
31
|
-
scope = if params[:published] == "0"
|
|
32
|
-
Iqvoc::Concept.base_class.unpublished
|
|
33
|
-
else
|
|
34
|
-
Iqvoc::Concept.base_class.published
|
|
35
|
-
end
|
|
36
|
-
if @concept = scope.by_origin(params[:id]).with_associations.last
|
|
37
|
-
respond_to do |format|
|
|
38
|
-
format.html do
|
|
39
|
-
redirect_to concept_url(:id => @concept.origin, :published => params[:published])
|
|
40
|
-
end
|
|
41
|
-
format.any do
|
|
42
|
-
authorize! :read, @concept
|
|
43
|
-
render :show_concept
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
else
|
|
47
|
-
raise ActiveRecord::RecordNotFound.new("Concept '#{params[:id]}' not found.")
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
30
|
end
|
|
@@ -30,7 +30,7 @@ module ConceptsHelper
|
|
|
30
30
|
content_tag :ul, :class => 'letter-selector unstyled' do
|
|
31
31
|
letters.map do |letter|
|
|
32
32
|
content_tag :li, link_to(letter, yield(letter)),
|
|
33
|
-
:class => ('active' if params[:
|
|
33
|
+
:class => ('active' if params[:prefix] == letter.to_s.downcase)
|
|
34
34
|
end.join("").html_safe
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -55,14 +55,4 @@ module NavigationHelper
|
|
|
55
55
|
content_tag :li, content, :class => css_class
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
def quick_search_class
|
|
59
|
-
klass = if Labeling.const_defined?(:SKOSXL)
|
|
60
|
-
Labeling::SKOSXL::Base
|
|
61
|
-
else
|
|
62
|
-
Labeling::SKOS::Base
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
klass.name.parameterize
|
|
66
|
-
end
|
|
67
|
-
|
|
68
58
|
end
|
data/app/helpers/rdf_helper.rb
CHANGED
|
@@ -25,7 +25,7 @@ module RdfHelper
|
|
|
25
25
|
hash[c.id] = c.origin
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
document << concept.build_rdf_subject(document,
|
|
28
|
+
document << concept.build_rdf_subject(document, nil) do |c|
|
|
29
29
|
|
|
30
30
|
concept.collection_members.each do |collection_member|
|
|
31
31
|
if @rdf_helper_cached_collections[collection_member.collection_id]
|
data/app/models/concept/base.rb
CHANGED
|
@@ -449,7 +449,7 @@ class Concept::Base < ActiveRecord::Base
|
|
|
449
449
|
def ensure_rooted_top_terms
|
|
450
450
|
if @full_validation
|
|
451
451
|
if narrower_relations.includes(:target). # XXX: inefficient?
|
|
452
|
-
select { |rel| rel.target.top_term? }.any?
|
|
452
|
+
select { |rel| rel.target && rel.target.top_term? }.any?
|
|
453
453
|
errors.add :base, I18n.t("txt.models.concept.top_term_rooted_error")
|
|
454
454
|
end
|
|
455
455
|
end
|
|
@@ -472,7 +472,7 @@ class Concept::Base < ActiveRecord::Base
|
|
|
472
472
|
send(Iqvoc::Concept.pref_labeling_class_name.to_relation_name).map(&:target) +
|
|
473
473
|
labelings.select{|l| l.is_a?(Iqvoc::Concept.pref_labeling_class)}.map(&:target)
|
|
474
474
|
languages = {}
|
|
475
|
-
pls.each do |pref_label|
|
|
475
|
+
pls.compact.each do |pref_label|
|
|
476
476
|
lang = pref_label.language.to_s
|
|
477
477
|
origin = (pref_label.origin || pref_label.id || pref_label.value).to_s
|
|
478
478
|
if (languages.keys.include?(lang) && languages[lang] != origin)
|
|
@@ -21,7 +21,7 @@ class Concept::SKOS::Base < Concept::Base
|
|
|
21
21
|
|
|
22
22
|
def build_rdf_subject(document, controller, &block)
|
|
23
23
|
ns = IqRdf::Namespace.find_namespace_class(self.rdf_namespace)
|
|
24
|
-
raise "Namespace '#{
|
|
24
|
+
raise "Namespace '#{self.rdf_namespace}' is not defined in IqRdf document." unless ns
|
|
25
25
|
subject = IqRdf.build_uri(self.origin, ns.build_uri(self.rdf_class), &block)
|
|
26
26
|
|
|
27
27
|
# ensure skos:Concept type is present
|
data/app/models/label/base.rb
CHANGED
|
@@ -42,8 +42,11 @@ class Label::Base < ActiveRecord::Base
|
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def self.begins_with(
|
|
46
|
-
|
|
45
|
+
def self.begins_with(prefix)
|
|
46
|
+
prefix = prefix.to_s
|
|
47
|
+
table = Label::Base.table_name
|
|
48
|
+
where("LOWER(SUBSTR(#{table}.value, 1, :length)) = :prefix",
|
|
49
|
+
:length => prefix.length, :prefix => prefix.downcase)
|
|
47
50
|
end
|
|
48
51
|
|
|
49
52
|
def self.missing_translation(lang, main_lang)
|
data/app/models/labeling/base.rb
CHANGED
|
@@ -45,8 +45,8 @@ class Labeling::Base < ActiveRecord::Base
|
|
|
45
45
|
includes(:target).merge(Label::Base.published)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
def self.label_begins_with(
|
|
49
|
-
includes(:target).merge(Label::Base.begins_with(
|
|
48
|
+
def self.label_begins_with(prefix)
|
|
49
|
+
includes(:target).merge(Label::Base.begins_with(prefix))
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def self.by_label_language(lang)
|
|
@@ -83,7 +83,7 @@ class Labeling::SKOS::Base < Labeling::Base
|
|
|
83
83
|
|
|
84
84
|
def self.build_from_rdf(subject, predicate, object)
|
|
85
85
|
raise "Labeling::SKOS::Base#build_from_rdf: Subject (#{subject}) must be a Concept." unless subject.is_a?(Concept::Base)
|
|
86
|
-
raise "Labeling::SKOS::Base#build_from_rdf: Object (#{object}) must be a string literal" unless object =~ /^"(.+)"(@(.+))
|
|
86
|
+
raise "Labeling::SKOS::Base#build_from_rdf: Object (#{object}) must be a string literal" unless object =~ /^"(.+)"(@(.+))?$/
|
|
87
87
|
|
|
88
88
|
lang = $3
|
|
89
89
|
value = JSON.parse(%Q{["#{$1}"]})[0].gsub("\\n", "\n") # Trick to decode \uHHHHH chars
|