iqvoc_skosxl 2.9.1 → 2.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +8 -10
  3. data/Gemfile.lock +475 -296
  4. data/README.md +1 -1
  5. data/app/assets/javascripts/iqvoc_skosxl/duplicate_check.js +104 -0
  6. data/app/assets/javascripts/iqvoc_skosxl/manifest.js +4 -0
  7. data/app/assets/javascripts/iqvoc_skosxl/new_label_modal.js +19 -0
  8. data/app/assets/javascripts/manifest.js +3 -3
  9. data/app/assets/stylesheets/manifest.scss +4 -0
  10. data/app/controllers/labels/versions_controller.rb +30 -50
  11. data/app/controllers/labels_controller.rb +71 -25
  12. data/app/controllers/rdf_controller.rb +8 -7
  13. data/app/controllers/xl_dashboard_controller.rb +43 -0
  14. data/app/helpers/iqvoc_skosxl_helper.rb +4 -0
  15. data/app/helpers/labels_helper.rb +8 -6
  16. data/app/models/application_record.rb +3 -0
  17. data/app/models/collection/skosxl/extension.rb +8 -0
  18. data/app/models/concept/skosxl/extension.rb +4 -2
  19. data/app/models/label/relation/base.rb +2 -2
  20. data/app/models/label/skosxl/base.rb +166 -29
  21. data/app/models/label/skosxl/properties/literal_form.rb +1 -1
  22. data/app/models/labeling/skosxl/alt_label.rb +12 -0
  23. data/app/models/labeling/skosxl/base.rb +65 -10
  24. data/app/models/labeling/skosxl/hidden_label.rb +2 -2
  25. data/app/models/labeling/skosxl/pref_label.rb +4 -0
  26. data/app/views/concepts/_form.html.erb +115 -0
  27. data/app/views/labels/_form.html.erb +11 -3
  28. data/app/views/labels/_language.html.erb +4 -0
  29. data/app/views/labels/_sidebar.html.erb +13 -7
  30. data/app/views/labels/duplicate.html.erb +4 -0
  31. data/app/views/labels/new.html.erb +1 -0
  32. data/app/views/labels/new_from_concept.html.erb +28 -0
  33. data/app/views/labels/notifications/_referenced_labels.html.erb +0 -1
  34. data/app/views/{rdf/show_label.iqrdf → labels/show.iqrdf} +1 -1
  35. data/app/views/labels/show_published.html.erb +5 -3
  36. data/app/views/labels/show_unpublished.html.erb +19 -22
  37. data/app/views/layouts/_label_in_concept_modal.html.erb +2 -0
  38. data/app/views/layouts/application.html.erb +51 -0
  39. data/app/views/partials/_modal.html.erb +17 -0
  40. data/app/views/partials/label/skosxl/_inline_base.html.erb +1 -0
  41. data/app/views/partials/label/skosxl/_new_link_base.html.erb +1 -1
  42. data/app/views/partials/labeling/skosxl/_base.html.erb +20 -13
  43. data/app/views/partials/labeling/skosxl/_edit_base.html.erb +3 -2
  44. data/config/application.rb +26 -14
  45. data/config/boot.rb +3 -3
  46. data/config/cable.yml +10 -0
  47. data/config/database.yml +21 -15
  48. data/config/database.yml.postgresql +12 -9
  49. data/config/environment.rb +1 -1
  50. data/config/initializers/content_security_policy.rb +25 -0
  51. data/config/initializers/filter_parameter_logging.rb +6 -2
  52. data/config/initializers/inflections.rb +4 -4
  53. data/config/initializers/iqvoc.rb +2 -0
  54. data/config/initializers/permissions_policy.rb +11 -0
  55. data/config/initializers/wrap_parameters.rb +2 -2
  56. data/config/initializers/zeitwerk.rb +7 -0
  57. data/config/locales/activerecord.de.yml +5 -2
  58. data/config/locales/activerecord.en.yml +3 -0
  59. data/config/locales/de.yml +13 -0
  60. data/config/locales/en.yml +13 -0
  61. data/config/routes.rb +8 -12
  62. data/config/storage.yml +34 -0
  63. data/db/migrate/20110408121540_extend_label.rb +3 -3
  64. data/db/migrate/20110408123644_add_label_relations.rb +1 -1
  65. data/db/migrate/20150108154312_add_fk_contraints_iqvoc_skosxl.rb +1 -1
  66. data/db/migrate/20150414083600_remove_fk_constraints_iqvoc_skosxl.rb +1 -1
  67. data/db/migrate/20231012174634_remove_locked_by_for_label.rb +5 -0
  68. data/db/schema.rb +173 -182
  69. data/iqvoc_skosxl.gemspec +2 -2
  70. data/lib/iqvoc/skosxl/version.rb +1 -1
  71. data/lib/iqvoc_skosxl.rb +8 -1
  72. data/public/assets/fonts/FiraMono-Regular-0b6138c5b386dc9125473fd851926f29.ttf +0 -0
  73. data/public/assets/fonts/FiraMono-Regular-690950e8d89c92cba41eeeb13f1de93e.woff +0 -0
  74. data/public/assets/fonts/FiraMono-Regular-98f97ed2dbf9d94d4fa5df048434b88d.eot +0 -0
  75. data/public/assets/fonts/FiraMono-Regular.eot +0 -0
  76. data/public/assets/fonts/FiraMono-Regular.ttf +0 -0
  77. data/public/assets/fonts/FiraMono-Regular.woff +0 -0
  78. data/public/assets/fonts/FiraSans-Bold-0de5f536bd0dc370449c0c67a49a6fe7.eot +0 -0
  79. data/public/assets/fonts/FiraSans-Bold-25037ef8d155e38b5df0c242a4c6cf2d.ttf +0 -0
  80. data/public/assets/fonts/FiraSans-Bold-494219a9639084eb9528ff47f79fcda1.woff +0 -0
  81. data/public/assets/fonts/FiraSans-Bold.eot +0 -0
  82. data/public/assets/fonts/FiraSans-Bold.ttf +0 -0
  83. data/public/assets/fonts/FiraSans-Bold.woff +0 -0
  84. data/public/assets/fonts/FiraSans-BoldItalic-5b3b812df9e1cb2b1f34baad65a2bdfb.ttf +0 -0
  85. data/public/assets/fonts/FiraSans-BoldItalic-90b8087c48feff2e828f658c49de5399.eot +0 -0
  86. data/public/assets/fonts/FiraSans-BoldItalic-b10e46158d50bf9b78968112acf87310.woff +0 -0
  87. data/public/assets/fonts/FiraSans-BoldItalic.eot +0 -0
  88. data/public/assets/fonts/FiraSans-BoldItalic.ttf +0 -0
  89. data/public/assets/fonts/FiraSans-BoldItalic.woff +0 -0
  90. data/public/assets/fonts/FiraSans-Book-659d252627051e785260ba445da8930f.woff +0 -0
  91. data/public/assets/fonts/FiraSans-Book-abc65ceb7bfaed729bff7a9d1367b7d4.eot +0 -0
  92. data/public/assets/fonts/FiraSans-Book-f0410501d5ecc5fe66bcdbc02b482c81.ttf +0 -0
  93. data/public/assets/fonts/FiraSans-Book.eot +0 -0
  94. data/public/assets/fonts/FiraSans-Book.ttf +0 -0
  95. data/public/assets/fonts/FiraSans-Book.woff +0 -0
  96. data/public/assets/fonts/FiraSans-ExtraLight-140f15ee97cb2099ff01c2b57dcd1a24.woff +0 -0
  97. data/public/assets/fonts/FiraSans-ExtraLight-28e5c2679df66406ebd117fbdded6753.eot +0 -0
  98. data/public/assets/fonts/FiraSans-ExtraLight-c15de70ebceffce178cbd2e82aa2c373.ttf +0 -0
  99. data/public/assets/fonts/FiraSans-ExtraLight.eot +0 -0
  100. data/public/assets/fonts/FiraSans-ExtraLight.ttf +0 -0
  101. data/public/assets/fonts/FiraSans-ExtraLight.woff +0 -0
  102. data/public/assets/fonts/FiraSans-Italic-ac4cb18fe14a7c90f29cdd2ce499ba59.woff +0 -0
  103. data/public/assets/fonts/FiraSans-Italic-bdea00fee0da5ca9176061e00c26a0da.eot +0 -0
  104. data/public/assets/fonts/FiraSans-Italic-e7e76a0ee170fd29b5d8100753eff569.ttf +0 -0
  105. data/public/assets/fonts/FiraSans-Italic.eot +0 -0
  106. data/public/assets/fonts/FiraSans-Italic.ttf +0 -0
  107. data/public/assets/fonts/FiraSans-Italic.woff +0 -0
  108. data/public/assets/fonts/FiraSans-Light-20adaf630b690c3e3184daaeae585f22.woff +0 -0
  109. data/public/assets/fonts/FiraSans-Light-3689e18b38d335ec0c43823adb6a2984.eot +0 -0
  110. data/public/assets/fonts/FiraSans-Light-55b04531e7a9ecdf58090d70b94b68e2.ttf +0 -0
  111. data/public/assets/fonts/FiraSans-Light-SC-098407a72b7ad46f7c2480d7ac11baf2.eot +0 -0
  112. data/public/assets/fonts/FiraSans-Light-SC-82763fe2ce9e6b897556c6f3c2aceb29.woff2 +0 -0
  113. data/public/assets/fonts/FiraSans-Light-SC-c73985985f0501c1845a5185b180fe6b.woff +0 -0
  114. data/public/assets/fonts/FiraSans-Light-SC-c9563f48d9cccd91f07e46801c27130f.ttf +0 -0
  115. data/public/assets/fonts/FiraSans-Light-SC.eot +0 -0
  116. data/public/assets/fonts/FiraSans-Light-SC.ttf +0 -0
  117. data/public/assets/fonts/FiraSans-Light-SC.woff +0 -0
  118. data/public/assets/fonts/FiraSans-Light-SC.woff2 +0 -0
  119. data/public/assets/fonts/FiraSans-Light.eot +0 -0
  120. data/public/assets/fonts/FiraSans-Light.ttf +0 -0
  121. data/public/assets/fonts/FiraSans-Light.woff +0 -0
  122. data/public/assets/fonts/FiraSans-Medium-082fab59048189168006bf2e914ba8b7.woff +0 -0
  123. data/public/assets/fonts/FiraSans-Medium-11706edfe8651c355b413bd24b4b5e10.eot +0 -0
  124. data/public/assets/fonts/FiraSans-Medium-3a0dacdeaba1b4c054f2d6cb5061965d.ttf +0 -0
  125. data/public/assets/fonts/FiraSans-Medium.eot +0 -0
  126. data/public/assets/fonts/FiraSans-Medium.ttf +0 -0
  127. data/public/assets/fonts/FiraSans-Medium.woff +0 -0
  128. data/public/assets/fonts/FiraSans-MediumItalic-6c8a2646d72641226527d574a8485b66.woff +0 -0
  129. data/public/assets/fonts/FiraSans-MediumItalic-b81e92794a6878b6c578d97b3ad5e6d7.ttf +0 -0
  130. data/public/assets/fonts/FiraSans-MediumItalic-eae7f4a3c4db9fe83025909ebfae5ad9.eot +0 -0
  131. data/public/assets/fonts/FiraSans-MediumItalic.eot +0 -0
  132. data/public/assets/fonts/FiraSans-MediumItalic.ttf +0 -0
  133. data/public/assets/fonts/FiraSans-MediumItalic.woff +0 -0
  134. data/public/assets/fonts/FiraSans-Regular-537188a19aeebdd74a92e114af7a02cb.ttf +0 -0
  135. data/public/assets/fonts/FiraSans-Regular-5d6a923de9be80ff5c2995cc03d93127.woff +0 -0
  136. data/public/assets/fonts/FiraSans-Regular-db689e5fea21ed4b7890811151968dc6.eot +0 -0
  137. data/public/assets/fonts/FiraSans-Regular.eot +0 -0
  138. data/public/assets/fonts/FiraSans-Regular.ttf +0 -0
  139. data/public/assets/fonts/FiraSans-Regular.woff +0 -0
  140. data/public/assets/fonts/FiraSans-UltraLight-3baefce4c224a0f0b26cdafe37dfa55d.eot +0 -0
  141. data/public/assets/fonts/FiraSans-UltraLight-e3909a352b87f853bb464836adfd602a.ttf +0 -0
  142. data/public/assets/fonts/FiraSans-UltraLight-f7289beeaa2353caf487553ee8b8ef03.woff +0 -0
  143. data/public/assets/fonts/FiraSans-UltraLight.eot +0 -0
  144. data/public/assets/fonts/FiraSans-UltraLight.ttf +0 -0
  145. data/public/assets/fonts/FiraSans-UltraLight.woff +0 -0
  146. data/public/assets/fonts/FontAwesome.otf +0 -0
  147. data/public/assets/fonts/fontawesome-webfont.eot +0 -0
  148. data/public/assets/fonts/fontawesome-webfont.svg +2671 -0
  149. data/public/assets/fonts/fontawesome-webfont.ttf +0 -0
  150. data/public/assets/fonts/fontawesome-webfont.woff +0 -0
  151. data/public/assets/fonts/fontawesome-webfont.woff2 +0 -0
  152. data/public/assets/images/ajax-loader-30d8e72bfdae694b1938658e1b087df0.gif +0 -0
  153. data/public/assets/images/ajax-loader.gif +0 -0
  154. data/public/assets/images/iqvoc_logo-165f17a46cf0a1bf9464db9d136fb843.svg +41 -0
  155. data/public/assets/images/iqvoc_logo.svg +41 -0
  156. data/public/assets/images/treeview-default-line-5e3c0e0c48f48c23c45aef7b72c739c0.gif +0 -0
  157. data/public/assets/images/treeview-default-line.gif +0 -0
  158. data/public/assets/javascripts/bootstrap.bundle.min-3e959f3b878396c38e4ca7787278131b.js +6 -0
  159. data/public/assets/javascripts/bootstrap.bundle.min-68b3c2f1c1f636f947fff1229d3ffbf5.js +7 -0
  160. data/public/assets/javascripts/bootstrap.bundle.min.js +31 -0
  161. data/public/assets/javascripts/jquery-d52dc3a9171f1fc89dd0f8e35e42c9d2.js +26 -0
  162. data/public/assets/javascripts/jquery.js +10701 -0
  163. data/public/assets/javascripts/manifest-d95423d4873e576e7ae0b6a57cf18ec5.js +5486 -0
  164. data/public/assets/javascripts/manifest.js +6981 -0
  165. data/public/assets/manifest.json +1 -0
  166. data/public/assets/stylesheets/manifest-bbb2857850990f13f777f3dec120a018.css +13 -0
  167. data/public/assets/stylesheets/manifest-c82b7dfb6cbb9f6284de38abacbf7d49.css +13 -0
  168. data/public/assets/stylesheets/manifest.css +13620 -0
  169. data/public/favicon.ico +0 -0
  170. data/test/controllers/rdf_rendering_test.rb +19 -0
  171. data/test/controllers/routing_test.rb +5 -1
  172. data/test/integration/concept_label_language_test.rb +1 -3
  173. data/test/integration/dashboard_test.rb +1 -1
  174. data/test/integration/duplicate_label_test.rb +52 -0
  175. data/test/integration/edit_labels_test.rb +2 -2
  176. data/test/integration/label_creation_test.rb +8 -0
  177. data/test/integration/label_relation_test.rb +2 -2
  178. data/test/integration/labels_order_test.rb +6 -6
  179. data/test/integration/search_test.rb +117 -0
  180. data/test/integration_test_helper.rb +2 -2
  181. data/test/models/concept_test.rb +12 -0
  182. data/test/models/skos_importer_test.rb +1 -1
  183. data/test/models/zeitwerk_compliance_test.rb +7 -0
  184. metadata +139 -26
  185. data/app/assets/stylesheets/manifest.css.scss +0 -4
  186. data/app/views/labels/_value_and_language.html.erb +0 -9
  187. data/config/initializers/backtrace_silencers.rb +0 -7
  188. data/config/initializers/cookies_serializer.rb +0 -3
  189. data/config/initializers/mime_types.rb +0 -4
  190. data/public/export/iqvoc_dump-2017-06-07_13-08.ttl +0 -70
File without changes
@@ -0,0 +1,19 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
2
+
3
+ class RdfRenderingTest < ActionController::TestCase
4
+ setup do
5
+ @label = Iqvoc::XLLabel.base_class.create(
6
+ language: 'en', value: 'Forest', origin: 'forest', published_at: 3.days.ago)
7
+
8
+ end
9
+
10
+ test 'label representations' do
11
+ @controller = RdfController.new
12
+
13
+ get :show, params: { lang: 'en', id: @label.origin, format: 'ttl' }
14
+ assert_response 200
15
+ assert @response.body.include? '@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.'
16
+ assert @response.body.include? ':forest a skosxl:Label'
17
+ assert @response.body.include? 'skosxl:literalForm "Forest"@en'
18
+ end
19
+ end
@@ -10,7 +10,11 @@ class RoutingTest < ActionController::TestCase
10
10
  end
11
11
 
12
12
  test 'routing' do
13
- get :show, lang: 'en', format: 'html', id: @label.origin
13
+ get :show, params: {
14
+ lang: 'en',
15
+ format: 'html',
16
+ id: @label.origin
17
+ }
14
18
  assert_response :success
15
19
  end
16
20
  end
@@ -73,9 +73,7 @@ class ConceptLabelLanguageTest < ActionDispatch::IntegrationTest
73
73
  # create, then edit concept
74
74
  visit new_concept_path(lang: 'de', format: 'html')
75
75
  click_button 'Speichern'
76
- visit dashboard_path(lang: 'de', format: 'html')
77
- page.find('td a').click
78
- page.click_link_or_button 'Bearbeitung fortsetzen'
76
+ page.click_link_or_button 'Bearbeiten'
79
77
 
80
78
  # NB: label languages do not match relation languages
81
79
  fill_in 'labeling_skosxl_pref_labels_en',
@@ -26,7 +26,7 @@ class DashboardTest < ActionDispatch::IntegrationTest
26
26
  assert !@label.published?
27
27
  login('administrator')
28
28
 
29
- visit dashboard_path(lang: 'de', format: 'html')
29
+ visit label_dashboard_path(lang: 'de', format: 'html')
30
30
  assert page.has_link?(@label.value.to_s), "Couldn't find Label link '#{@label.value.to_s}' in dashboards concepts + labels list"
31
31
  click_link_or_button(@label.value.to_s)
32
32
  assert_equal label_path(@label, lang: 'de', format: 'html'), current_path
@@ -0,0 +1,52 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2011-2017 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
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
+
19
+ class DuplicateLabelTest < ActionDispatch::IntegrationTest
20
+ setup do
21
+ @label = Iqvoc::XLLabel.base_class.create(
22
+ language: 'de', value: 'Wald', published_at: 3.days.ago)
23
+ end
24
+
25
+ test 'Duplicate a label' do
26
+ assert @label.published?
27
+ login('administrator')
28
+
29
+ visit label_path(@label, lang: 'de', format: 'html')
30
+ assert page.has_link?('Duplizieren')
31
+ click_link_or_button('Duplizieren')
32
+ assert_equal label_duplicate_path(@label, lang: 'de', format: 'html'), current_path
33
+
34
+ click_link_or_button('Speichern')
35
+
36
+ assert !page.has_button?('Neue Version erstellen')
37
+ assert !page.has_link?('Duplizieren')
38
+ assert page.has_button?('Veröffentlichen')
39
+ assert page.has_content? 'Das Label wurde aktualisiert.'
40
+ assert page.has_content? 'Wald [Kopie]'
41
+
42
+ # check initial created-ChangeNote
43
+ change_note_relation_name = Iqvoc::change_note_class_name.to_relation_name
44
+ within("\##{change_note_relation_name}") do
45
+ assert page.has_css?('.translation', count: 1)
46
+ assert page.has_content? 'Initiale Version'
47
+ assert page.has_content? 'dct:created'
48
+ end
49
+
50
+ end
51
+
52
+ end
@@ -16,13 +16,13 @@
16
16
 
17
17
  require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
18
 
19
- class EditConceptsTest < ActionDispatch::IntegrationTest
19
+ class EditLabelsTest < ActionDispatch::IntegrationTest
20
20
  setup do
21
21
  @label = Iqvoc::XLLabel.base_class.create(
22
22
  language: 'en', value: 'Forest', published_at: 3.days.ago)
23
23
  end
24
24
 
25
- test 'Create a new concept version' do
25
+ test 'Create a new label version' do
26
26
  assert @label.published?
27
27
  login('administrator')
28
28
 
@@ -68,4 +68,12 @@ class LabelCreationTest < ActionDispatch::IntegrationTest
68
68
  click_link_or_button 'Konsistenz prüfen'
69
69
  assert page.has_content? 'Instanz ist inkonsistent.'
70
70
  end
71
+
72
+ test 'inconsistent label that is sent for review' do
73
+ visit new_label_path(lang: 'de', language: 'de')
74
+ fill_in 'Vorlageform', with: ''
75
+ click_link_or_button 'Speichern'
76
+ click_link_or_button 'Zur Freigabe vorlegen'
77
+ assert page.has_content? 'Instanz ist inkonsistent.'
78
+ end
71
79
  end
@@ -61,7 +61,7 @@ class LabelsRelationTest < ActionDispatch::IntegrationTest
61
61
  visit label_path(@dog_en, lang: 'en', format: 'html')
62
62
  click_link_or_button('Create new version')
63
63
  assert_equal edit_label_path(@dog_en, lang: 'en', format: 'html'), current_path
64
- assert page.has_content? 'Instance copy has been created and locked.'
64
+ assert page.has_content? 'Instance copy has been created.'
65
65
 
66
66
  # add translation dog_en => dog_de
67
67
  fill_in 'label_relation_skosxl_translations', with: 'dog_de'
@@ -101,7 +101,7 @@ class LabelsRelationTest < ActionDispatch::IntegrationTest
101
101
  visit label_path(@dog_en, lang: 'en', format: 'html')
102
102
  click_link_or_button('Create new version')
103
103
  assert_equal edit_label_path(@dog_en, lang: 'en', format: 'html'), current_path
104
- assert page.has_content? 'Instance copy has been created and locked.'
104
+ assert page.has_content? 'Instance copy has been created.'
105
105
 
106
106
  # add translation dog_en => dog_de
107
107
  fill_in 'label_relation_skosxl_unidirectional_relations', with: 'dog_de'
@@ -17,8 +17,8 @@
17
17
  require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
18
 
19
19
  class LabelsOrderTest < ActionDispatch::IntegrationTest
20
- test 'label order is not case-sensitive' do
21
- names = ['aaa', 'bbb', 'abc', 'ABC']
20
+ test 'label order' do
21
+ names = ['haltestelle', 'test12', 'test1', 'test']
22
22
  lang = 'en'
23
23
  # create a few labels
24
24
  names.each_with_index do |name, index|
@@ -35,9 +35,9 @@ class LabelsOrderTest < ActionDispatch::IntegrationTest
35
35
  data = JSON.parse(@response.body)
36
36
 
37
37
  assert_response :success
38
- assert_equal 'aaa (en)', data[0]['name'] # hacky test fix "(en)" will be injected by javascript widget
39
- assert_equal 'abc (en)', data[1]['name']
40
- assert_equal 'ABC (en)', data[2]['name'] # XXX: do we care about order of "ABC" vs. "abc"?
41
- assert_equal 'bbb (en)', data[3]['name']
38
+ assert_equal 'test (en)', data[0]['name'] # hacky test fix "(en)" will be injected by javascript widget
39
+ assert_equal 'test1 (en)', data[1]['name']
40
+ assert_equal 'test12 (en)', data[2]['name'] # XXX: do we care about order of "ABC" vs. "abc"?
41
+ assert_equal 'haltestelle (en)', data[3]['name']
42
42
  end
43
43
  end
@@ -0,0 +1,117 @@
1
+ # encoding: UTF-8
2
+
3
+ # Copyright 2011-2017 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
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../integration_test_helper')
18
+
19
+ class SearchTest < ActionDispatch::IntegrationTest
20
+
21
+ test 'filtering concepts by change note date' do
22
+ login 'administrator'
23
+
24
+ visit new_label_path(lang: 'en', format: 'html', published: 0)
25
+ fill_in 'label_value', with: 'Water'
26
+ click_button 'Save'
27
+ click_link_or_button 'Publish'
28
+
29
+ visit new_concept_path(lang: 'en', format: 'html', published: 0)
30
+ fill_in 'labeling_skosxl_pref_labels_en', with: Iqvoc::XLLabel.base_class.first.origin
31
+ click_button 'Save'
32
+ click_link_or_button 'Publish'
33
+
34
+ visit new_label_path(lang: 'en', format: 'html', published: 0)
35
+ fill_in 'label_value', with: 'Air'
36
+ click_button 'Save'
37
+ click_link_or_button 'Publish'
38
+
39
+ visit new_concept_path(lang: 'en', format: 'html', published: 0)
40
+ fill_in 'labeling_skosxl_pref_labels_en', with: Iqvoc::XLLabel.base_class.second.origin
41
+ click_button 'Save'
42
+ click_link_or_button 'Publish'
43
+
44
+ Note::Annotated::Base.where(predicate: "created").second.update(value: (DateTime.now - 10.days).to_s)
45
+
46
+ visit search_path(lang: 'en', format: 'html')
47
+ find('#t').select 'Labels'
48
+ find('#change_note_type').select 'creation date'
49
+ fill_in 'change_note_date_from', with: Date.today
50
+ click_button('Search')
51
+
52
+ refute page.find('.search-results').has_content?('Water')
53
+ assert page.find('.search-results').has_content?('Air')
54
+ end
55
+
56
+ test 'filtering xl-labels by change note date' do
57
+ apple_label = Iqvoc::XLLabel.base_class.create!(language: 'de', value: 'Apple', origin: 'apple', published_at: Time.now)
58
+ apple_label.note_skos_change_notes.create!(language: 'de').tap do |note|
59
+ note.annotations.create!(namespace: 'dct', predicate: 'creator', value: 'Arnulf Beckenbauer')
60
+ note.annotations.create!(namespace: 'dct', predicate: 'created', value: '2017-06-01')
61
+ end
62
+
63
+ banana_label = Iqvoc::XLLabel.base_class.create!(language: 'de', value: 'Banana', origin: 'banana', published_at: Time.now)
64
+ banana_label.note_skos_change_notes.create!(language: 'de').tap do |note|
65
+ note.annotations.create!(namespace: 'dct', predicate: 'creator', value: 'Arnulf Beckenbauer')
66
+ note.annotations.create!(namespace: 'dct', predicate: 'modified', value: '2017-06-10')
67
+ end
68
+
69
+ peach_label = Iqvoc::XLLabel.base_class.create!(language: 'de', value: 'Peach', origin: 'peach', published_at: Time.now)
70
+ peach_label.note_skos_change_notes.create!(language: 'de').tap do |note|
71
+ note.annotations.create!(namespace: 'dct', predicate: 'creator', value: 'Arnulf Beckenbauer')
72
+ note.annotations.create!(namespace: 'dct', predicate: 'created', value: '2017-06-11')
73
+ end
74
+
75
+ visit search_path(lang: 'en', format: 'html')
76
+ find('#t').select 'XL Labels'
77
+
78
+ # should find Apple and Banana labels
79
+ fill_in 'change_note_date_from', with: '2017-06-01'
80
+ fill_in 'change_note_date_to', with: '2017-06-10'
81
+ click_button('Search')
82
+ assert_equal 2, page.find('ul.search-results').all('li').count
83
+ assert page.find('.search-results').has_content?('Apple')
84
+ assert page.find('.search-results').has_content?('Banana')
85
+ refute page.find('.search-results').has_content?('Peach')
86
+
87
+ # should find Apple label
88
+ fill_in 'change_note_date_from', with: '2017-06-01'
89
+ fill_in 'change_note_date_to', with: '2017-06-02'
90
+ click_button('Search')
91
+ page.has_content? 'Search results (1)'
92
+ assert_equal 1, page.find('ul.search-results').all('li').count
93
+ assert page.find('.search-results').has_content?('Apple')
94
+ refute page.find('.search-results').has_content?('Banana')
95
+ refute page.find('.search-results').has_content?('Peach')
96
+
97
+ # should find Banana label
98
+ fill_in 'change_note_date_from', with: '2017-06-10'
99
+ fill_in 'change_note_date_to', with: '2017-06-10'
100
+ click_button('Search')
101
+ assert_equal 1, page.find('ul.search-results').all('li').count
102
+ assert page.find('.search-results').has_content?('Banana')
103
+ refute page.find('.search-results').has_content?('Apple')
104
+ refute page.find('.search-results').has_content?('Peach')
105
+
106
+ # should find Apple & Peach label (the only ones with created change note)
107
+ fill_in 'change_note_date_from', with: '2017-06-01'
108
+ fill_in 'change_note_date_to', with: '2017-07-01'
109
+ find('#change_note_type').select 'creation date'
110
+ click_button('Search')
111
+ assert_equal 2, page.find('ul.search-results').all('li').count
112
+ assert page.find('.search-results').has_content?('Apple')
113
+ assert page.find('.search-results').has_content?('Peach')
114
+ refute page.find('.search-results').has_content?('Banana')
115
+ end
116
+
117
+ end
@@ -16,10 +16,10 @@
16
16
  require File.expand_path('test_helper', File.dirname(__FILE__))
17
17
  require 'capybara/rails'
18
18
  require 'capybara/dsl'
19
- require 'capybara/poltergeist'
19
+ require 'capybara/cuprite'
20
20
  require Iqvoc.root.join('test', 'authentication')
21
21
 
22
- Capybara.javascript_driver = :poltergeist
22
+ Capybara.javascript_driver = :cuprite
23
23
 
24
24
  module ActionDispatch
25
25
  class IntegrationTest
@@ -58,6 +58,18 @@ class ConceptTest < ActiveSupport::TestCase
58
58
  assert alt_label.publishable?
59
59
  end
60
60
 
61
+ test 'additional unpublished label revision do not prevent published' do
62
+ dog = RDFAPI.devour 'Dog', 'a', 'skos:Concept'
63
+ dog.pref_labels << Iqvoc::XLLabel.base_class.create(
64
+ language: 'en', value: 'Dog', published_at: 3.days.ago)
65
+ dog.alt_labels << Iqvoc::XLLabel.base_class.create(
66
+ language: 'en', value: 'Hound', published_at: nil)
67
+
68
+ assert dog.save
69
+ assert dog.publishable?
70
+ assert dog.publish
71
+ end
72
+
61
73
  test 'concepts pref label language change' do
62
74
  dog = RDFAPI.devour 'Dog', 'a', 'skos:Concept'
63
75
  refute dog.publishable?
@@ -6,7 +6,7 @@ class SkosImporterTest < ActiveSupport::TestCase
6
6
  TEST_DATA = File.open(File.expand_path('../../fixtures/hobbies.nt', __FILE__))
7
7
 
8
8
  setup do
9
- Iqvoc.rdf_namespaces['test'] = 'http://foo.bar/xl#'
9
+ Iqvoc.rdf_namespaces[:test] = 'http://foo.bar/xl#'
10
10
 
11
11
  class TestRelation < Label::Relation::SKOSXL::Base
12
12
  self.rdf_namespace = 'test'
@@ -0,0 +1,7 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
2
+
3
+ class ZeitwerkComplianceTest < ActiveSupport::TestCase
4
+ test "eager loads all files without errors" do
5
+ assert_nothing_raised { Rails.application.eager_load! }
6
+ end
7
+ end