iqvoc_skosxl 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/Gemfile +40 -0
  2. data/Gemfile.lock +154 -0
  3. data/README.md +26 -0
  4. data/Rakefile +11 -0
  5. data/app/assets/javascripts/iqvoc_skosxl/manifest.js +0 -0
  6. data/app/assets/javascripts/manifest.js +3 -0
  7. data/app/assets/stylesheets/iqvoc_skosxl/manifest.css +0 -0
  8. data/app/assets/stylesheets/manifest.css +5 -0
  9. data/app/controllers/labels/versions_controller.rb +109 -0
  10. data/app/controllers/labels_controller.rb +130 -0
  11. data/app/controllers/rdf_controller.rb +23 -0
  12. data/app/helpers/iqvoc_skosxl_helper.rb +18 -0
  13. data/app/helpers/labels_helper.rb +68 -0
  14. data/app/models/concept/skosxl/extension.rb +62 -0
  15. data/app/models/label/relation/base.rb +54 -0
  16. data/app/models/label/relation/skosxl/base.rb +12 -0
  17. data/app/models/label/skosxl/base.rb +219 -0
  18. data/app/models/labeling/skosxl/alt_label.rb +8 -0
  19. data/app/models/labeling/skosxl/base.rb +75 -0
  20. data/app/models/labeling/skosxl/hidden_label.rb +12 -0
  21. data/app/models/labeling/skosxl/pref_label.rb +12 -0
  22. data/app/views/labels/_base_data.html.erb +62 -0
  23. data/app/views/labels/_change_note.html.erb +46 -0
  24. data/app/views/labels/_details.html.erb +6 -0
  25. data/app/views/labels/_label_relation.html.erb +7 -0
  26. data/app/views/labels/_labeling.html.erb +3 -0
  27. data/app/views/labels/_note.html.erb +33 -0
  28. data/app/views/labels/_show_head.html.erb +22 -0
  29. data/app/views/labels/_value_and_language.html.erb +9 -0
  30. data/app/views/labels/edit.html.erb +22 -0
  31. data/app/views/labels/new.html.erb +3 -0
  32. data/app/views/labels/show.ttl.erb +1 -0
  33. data/app/views/labels/show_published.html.erb +13 -0
  34. data/app/views/labels/show_unpublished.html.erb +36 -0
  35. data/app/views/partials/label/relation/_base.html.erb +9 -0
  36. data/app/views/partials/label/relation/_edit_base.html.erb +13 -0
  37. data/app/views/partials/label/skosxl/_edit_link_base.html.erb +1 -0
  38. data/app/views/partials/label/skosxl/_new_link_base.html.erb +7 -0
  39. data/app/views/partials/labeling/skosxl/_base.html.erb +19 -0
  40. data/app/views/partials/labeling/skosxl/_edit_base.html.erb +15 -0
  41. data/app/views/partials/labeling/skosxl/_search_result.html.erb +9 -0
  42. data/app/views/rdf/show_label.iqrdf +5 -0
  43. data/config/application.rb +56 -0
  44. data/config/boot.rb +13 -0
  45. data/config/database.template.yml +38 -0
  46. data/config/database.yml +36 -0
  47. data/config/engine.rb +13 -0
  48. data/config/environment.rb +5 -0
  49. data/config/environments/development.rb +55 -0
  50. data/config/environments/production.rb +64 -0
  51. data/config/environments/test.rb +44 -0
  52. data/config/initializers/iqvoc.rb +4 -0
  53. data/config/initializers/iqvoc_skosxl.rb +1 -0
  54. data/config/initializers/secret_token.rb.template +9 -0
  55. data/config/initializers/session_store.rb +8 -0
  56. data/config/locales/activerecord.de.yml +18 -0
  57. data/config/locales/activerecord.en.yml +18 -0
  58. data/config/locales/de.yml +5 -0
  59. data/config/locales/en.yml +5 -0
  60. data/config/routes.rb +15 -0
  61. data/db/migrate/20110408121540_extend_label.rb +37 -0
  62. data/db/migrate/20110408123644_add_label_relations.rb +24 -0
  63. data/db/schema.rb +146 -0
  64. data/db/seeds.rb +0 -0
  65. data/iqvoc_skosxl.gemspec +22 -0
  66. data/lib/engine_tasks/db.rake +19 -0
  67. data/lib/iqvoc/skosxl/version.rb +5 -0
  68. data/lib/iqvoc/xllabel.rb +60 -0
  69. data/lib/iqvoc_skosxl.rb +22 -0
  70. data/test/factories.rb +23 -0
  71. data/test/integration/concept_label_language_test.rb +95 -0
  72. data/test/integration/dashboard_test.rb +29 -0
  73. data/test/integration/edit_labels_test.rb +26 -0
  74. data/test/integration/labels_order_test.rb +27 -0
  75. data/test/integration_test_helper.rb +27 -0
  76. data/test/test_helper.rb +15 -0
  77. data/test/unit/label_test.rb +30 -0
  78. metadata +154 -0
@@ -0,0 +1,29 @@
1
+ $: << File.join(File.dirname(__FILE__), '..')
2
+ require 'test_helper'
3
+ require 'integration_test_helper'
4
+
5
+ class DashboardTest < ActionDispatch::IntegrationTest
6
+
7
+ setup do
8
+ @label = Factory(:xllabel, :published_at => nil)
9
+ end
10
+
11
+ test "labels appearing in dashboard" do
12
+ assert !@label.published?
13
+ login('administrator')
14
+
15
+ visit dashboard_path(:lang => 'de', :format => 'html')
16
+ assert page.has_link?(@label.value.to_s), "Couldn't find Label link '#{@label.value.to_s}' in dashboards concepts + labels list"
17
+ click_link_or_button(@label.value.to_s)
18
+ assert_equal label_path(@label, :lang => 'de', :format => 'html'), current_path
19
+ end
20
+
21
+ test "new label link in dashboard" do
22
+ login('administrator')
23
+
24
+ visit dashboard_path(:lang => 'de', :format => 'html')
25
+ click_link_or_button("de")
26
+ assert_equal new_label_path(:lang => 'de', :format => 'html'), current_path
27
+ end
28
+
29
+ end
@@ -0,0 +1,26 @@
1
+ $: << File.join(File.dirname(__FILE__), '..')
2
+ require 'test_helper'
3
+ require 'integration_test_helper'
4
+
5
+ class EditConceptsTest < ActionDispatch::IntegrationTest
6
+
7
+ setup do
8
+ @label = Factory(:xllabel)
9
+ end
10
+
11
+ test "Create a new concept version" do
12
+ assert @label.published?
13
+ login('administrator')
14
+
15
+ visit label_path(@label, :lang => 'de', :format => 'html')
16
+ assert page.has_button?("Neue Version erstellen"), "Button 'Neue Version erstellen' is missing on labels#show"
17
+ click_link_or_button("Neue Version erstellen")
18
+ assert_equal edit_label_path(@label, :lang => 'de', :format => 'html'), current_path
19
+
20
+ visit label_path(@label, :lang => 'de', :format => 'html')
21
+ assert !page.has_button?("Neue Version erstellen"), "Button 'Neue Version erstellen' although there already is a new version"
22
+ assert page.has_link?("Vorschau der Version in Bearbeitung"), "Link 'Vorschau der Version in Bearbeitung' is missing"
23
+ click_link_or_button("Vorschau der Version in Bearbeitung")
24
+ end
25
+
26
+ end
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+
3
+ class LabelsOrderTest < ActionDispatch::IntegrationTest
4
+
5
+ test "label order is not case-sensitive" do
6
+ names = ["aaa", "bbb", "abc", "ABC"]
7
+ lang = "en"
8
+ # create a few labels
9
+ label_class = Iqvoc::Concept.labeling_classes.first.first.label_class
10
+ names.each { |name|
11
+ label = label_class.new(:origin => "_%s" % name, :value => name,
12
+ :language => lang, :published_at => Time.now)
13
+ label.save
14
+ }
15
+ assert_equal names.length, Label::Base.all.count # just to avoid confusion
16
+
17
+ get labels_path(:lang => lang, :format => "json")
18
+ data = JSON.parse(@response.body)
19
+
20
+ assert_response :success
21
+ assert_equal "aaa", data[0]["name"]
22
+ assert_equal "abc", data[1]["name"]
23
+ assert_equal "ABC", data[2]["name"] # XXX: do we care about order of "ABC" vs. "abc"?
24
+ assert_equal "bbb", data[3]["name"]
25
+ end
26
+
27
+ end
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+ require 'capybara/rails'
3
+
4
+ module ActionController
5
+ class IntegrationTest
6
+ include Capybara::DSL
7
+
8
+ def login(role = nil)
9
+ logout
10
+ user(role)
11
+ visit new_user_session_path(:lang => :de)
12
+ fill_in "E-Mail", :with => user.email
13
+ fill_in "Passwort", :with => user.password
14
+ click_button "Anmelden"
15
+ end
16
+
17
+ def logout
18
+ visit dashboard_path(:lang => :de)
19
+ click_link_or_button "Abmelden" if page.has_link?("Abmelden")
20
+ end
21
+
22
+ def user(role = nil)
23
+ @user ||= FactoryGirl.create(:user, :role => (role || User.default_role))
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,15 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ require Rails.root.join("test/factories")
6
+
7
+ class ActiveSupport::TestCase
8
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
9
+ #
10
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
11
+ # -- they do not yet inherit this setting
12
+ # fixtures :all
13
+
14
+ # Add more helper methods to be used by all tests here...
15
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'test_helper'
4
+
5
+ class LabelTest < ActiveSupport::TestCase
6
+
7
+ def setup
8
+ @current_label = FactoryGirl.create(:xllabel_with_association)
9
+ @user = FactoryGirl.create(:user)
10
+ end
11
+
12
+ def test_should_not_create_more_than_two_versions_of_a_label
13
+ first_new_label = Label::SKOSXL::Base.new(@current_label.attributes)
14
+ second_new_label = Label::SKOSXL::Base.new(@current_label.attributes)
15
+ assert first_new_label.save
16
+ assert_equal second_new_label.save, false
17
+ end
18
+
19
+ def test_should_validate_origin_for_escaping
20
+ label = FactoryGirl.build(:xllabel)
21
+ assert label.valid_with_full_validation?
22
+
23
+ label.origin = "FoÖ/Bär"
24
+ assert label.invalid_with_full_validation?
25
+
26
+ label.origin = OriginMapping.merge("FoÖ/Bär")
27
+ assert label.valid_with_full_validation?
28
+ end
29
+
30
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: iqvoc_skosxl
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Robert Glaser
9
+ - Till Schulte-Coerne
10
+ - Frederik Dohr
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2012-01-16 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: iqvoc
18
+ requirement: &70275424138860 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *70275424138860
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: &70275424137520 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: *70275424137520
38
+ description: ''
39
+ email:
40
+ - till.schulte-coerne@innoq.com
41
+ executables: []
42
+ extensions: []
43
+ extra_rdoc_files: []
44
+ files:
45
+ - README.md
46
+ - Gemfile
47
+ - Gemfile.lock
48
+ - Rakefile
49
+ - iqvoc_skosxl.gemspec
50
+ - app/assets/javascripts/iqvoc_skosxl/manifest.js
51
+ - app/assets/javascripts/manifest.js
52
+ - app/assets/stylesheets/iqvoc_skosxl/manifest.css
53
+ - app/assets/stylesheets/manifest.css
54
+ - app/controllers/labels/versions_controller.rb
55
+ - app/controllers/labels_controller.rb
56
+ - app/controllers/rdf_controller.rb
57
+ - app/helpers/iqvoc_skosxl_helper.rb
58
+ - app/helpers/labels_helper.rb
59
+ - app/models/concept/skosxl/extension.rb
60
+ - app/models/label/relation/base.rb
61
+ - app/models/label/relation/skosxl/base.rb
62
+ - app/models/label/skosxl/base.rb
63
+ - app/models/labeling/skosxl/alt_label.rb
64
+ - app/models/labeling/skosxl/base.rb
65
+ - app/models/labeling/skosxl/hidden_label.rb
66
+ - app/models/labeling/skosxl/pref_label.rb
67
+ - app/views/labels/_base_data.html.erb
68
+ - app/views/labels/_change_note.html.erb
69
+ - app/views/labels/_details.html.erb
70
+ - app/views/labels/_label_relation.html.erb
71
+ - app/views/labels/_labeling.html.erb
72
+ - app/views/labels/_note.html.erb
73
+ - app/views/labels/_show_head.html.erb
74
+ - app/views/labels/_value_and_language.html.erb
75
+ - app/views/labels/edit.html.erb
76
+ - app/views/labels/new.html.erb
77
+ - app/views/labels/show.ttl.erb
78
+ - app/views/labels/show_published.html.erb
79
+ - app/views/labels/show_unpublished.html.erb
80
+ - app/views/partials/label/relation/_base.html.erb
81
+ - app/views/partials/label/relation/_edit_base.html.erb
82
+ - app/views/partials/label/skosxl/_edit_link_base.html.erb
83
+ - app/views/partials/label/skosxl/_new_link_base.html.erb
84
+ - app/views/partials/labeling/skosxl/_base.html.erb
85
+ - app/views/partials/labeling/skosxl/_edit_base.html.erb
86
+ - app/views/partials/labeling/skosxl/_search_result.html.erb
87
+ - app/views/rdf/show_label.iqrdf
88
+ - config/application.rb
89
+ - config/boot.rb
90
+ - config/database.template.yml
91
+ - config/database.yml
92
+ - config/engine.rb
93
+ - config/environment.rb
94
+ - config/environments/development.rb
95
+ - config/environments/production.rb
96
+ - config/environments/test.rb
97
+ - config/initializers/iqvoc.rb
98
+ - config/initializers/iqvoc_skosxl.rb
99
+ - config/initializers/secret_token.rb.template
100
+ - config/initializers/session_store.rb
101
+ - config/locales/activerecord.de.yml
102
+ - config/locales/activerecord.en.yml
103
+ - config/locales/de.yml
104
+ - config/locales/en.yml
105
+ - config/routes.rb
106
+ - db/migrate/20110408121540_extend_label.rb
107
+ - db/migrate/20110408123644_add_label_relations.rb
108
+ - db/schema.rb
109
+ - db/seeds.rb
110
+ - lib/engine_tasks/db.rake
111
+ - lib/iqvoc/skosxl/version.rb
112
+ - lib/iqvoc/xllabel.rb
113
+ - lib/iqvoc_skosxl.rb
114
+ - test/factories.rb
115
+ - test/integration/concept_label_language_test.rb
116
+ - test/integration/dashboard_test.rb
117
+ - test/integration/edit_labels_test.rb
118
+ - test/integration/labels_order_test.rb
119
+ - test/integration_test_helper.rb
120
+ - test/test_helper.rb
121
+ - test/unit/label_test.rb
122
+ homepage: http://innoq.com
123
+ licenses: []
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 1.8.10
143
+ signing_key:
144
+ specification_version: 3
145
+ summary: iQvoc SKOS-XL extension
146
+ test_files:
147
+ - test/factories.rb
148
+ - test/integration/concept_label_language_test.rb
149
+ - test/integration/dashboard_test.rb
150
+ - test/integration/edit_labels_test.rb
151
+ - test/integration/labels_order_test.rb
152
+ - test/integration_test_helper.rb
153
+ - test/test_helper.rb
154
+ - test/unit/label_test.rb