iqvoc_skosxl 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/app/controllers/labels_controller.rb +2 -3
- data/app/models/concept/skosxl/extension.rb +1 -1
- data/app/models/label/relation/base.rb +4 -4
- data/app/models/label/skosxl/base.rb +9 -3
- data/app/models/labeling/skosxl/base.rb +3 -3
- data/config/application.rb +1 -1
- data/config/initializers/iqvoc.rb +3 -1
- data/config/locales/activerecord.de.yml +2 -2
- data/config/locales/activerecord.en.yml +2 -2
- data/config/locales/de.yml +1 -1
- data/config/locales/en.yml +1 -1
- data/lib/iqvoc/skosxl/version.rb +1 -1
- data/test/factories.rb +0 -1
- data/test/unit/hygiene_test.rb +4 -0
- data/test/unit/label_test.rb +16 -5
- metadata +8 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -136,6 +136,7 @@ GEM
|
|
136
136
|
rack (~> 1.0)
|
137
137
|
tilt (~> 1.1, != 1.3.0)
|
138
138
|
sqlite3 (1.3.5)
|
139
|
+
test-unit (2.4.7)
|
139
140
|
thor (0.14.6)
|
140
141
|
tilt (1.3.3)
|
141
142
|
treetop (1.4.10)
|
@@ -165,4 +166,5 @@ DEPENDENCIES
|
|
165
166
|
nokogiri (~> 1.5.0)
|
166
167
|
rails (= 3.2.1)
|
167
168
|
sqlite3
|
169
|
+
test-unit
|
168
170
|
uglifier (>= 1.0.3)
|
@@ -59,7 +59,6 @@ class LabelsController < ApplicationController
|
|
59
59
|
def create
|
60
60
|
authorize! :create, Iqvoc::XLLabel.base_class
|
61
61
|
@label = Iqvoc::XLLabel.base_class.new(params[:label])
|
62
|
-
@label.origin = OriginMapping.merge(@label.value)
|
63
62
|
if @label.valid?
|
64
63
|
if @label.save
|
65
64
|
flash[:notice] = I18n.t("txt.controllers.versioned_label.success")
|
@@ -85,11 +84,11 @@ class LabelsController < ApplicationController
|
|
85
84
|
|
86
85
|
# @pref_labelings = PrefLabeling.by_label(@label).all(:include => {:owner => :pref_labels}).sort
|
87
86
|
# @alt_labelings = AltLabeling.by_label(@label).all(:include => {:owner => :pref_labels}).sort
|
88
|
-
|
87
|
+
|
89
88
|
if params[:full_consistency_check]
|
90
89
|
@label.valid_with_full_validation?
|
91
90
|
end
|
92
|
-
|
91
|
+
|
93
92
|
Iqvoc::XLLabel.note_class_names.each do |note_class_name|
|
94
93
|
@label.send(note_class_name.to_relation_name).build if @label.send(note_class_name.to_relation_name).empty?
|
95
94
|
end
|
@@ -36,7 +36,7 @@ module Concept
|
|
36
36
|
self.send(relation_name).by_label_language(language).
|
37
37
|
map { |l| l.target.origin }.join(Iqvoc::InlineDataHelper::Joiner)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def valid_label_language
|
41
41
|
(@labelings_by_id || {}).each { |labeling_class_name, origin_mappings|
|
42
42
|
origin_mappings.each { |language, new_origins|
|
@@ -12,17 +12,17 @@ class Label::Relation::Base < ActiveRecord::Base
|
|
12
12
|
def self.by_domain(domain)
|
13
13
|
where(:domain_id => domain)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def self.by_range(range)
|
17
17
|
where(:range_id => range)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def self.by_range_origin(origin)
|
21
21
|
includes(:range).merge(Label::Base.by_origin(origin))
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def self.range_editor_selectable
|
25
|
-
# includes(:range) & Iqvoc::XLLabel.base_class.editor_selectable
|
25
|
+
# includes(:range) & Iqvoc::XLLabel.base_class.editor_selectable
|
26
26
|
# Doesn't work correctly (kills label_relations.type condition :-( )
|
27
27
|
includes(:range).
|
28
28
|
where("labels.published_at IS NOT NULL OR (labels.published_at IS NULL AND labels.published_version_id IS NULL) ")
|
@@ -8,17 +8,23 @@ class Label::SKOSXL::Base < Label::Base
|
|
8
8
|
self.rdf_namespace = "skosxl"
|
9
9
|
self.rdf_class = "Label"
|
10
10
|
|
11
|
+
attr_protected :origin
|
12
|
+
|
11
13
|
# ********** Validations
|
12
14
|
|
13
15
|
validate :two_versions_exist, :on => :create
|
14
16
|
validate :origin_has_to_be_escaped
|
15
17
|
|
16
18
|
# ********** Hooks
|
17
|
-
|
19
|
+
|
18
20
|
after_initialize do
|
19
21
|
@full_validation = false
|
20
22
|
end
|
21
23
|
|
24
|
+
before_validation do |label|
|
25
|
+
label.origin = Iqvoc::Origin.new("#{value}-#{language}").to_s if label.origin.blank?
|
26
|
+
end
|
27
|
+
|
22
28
|
after_save do |label|
|
23
29
|
# Handle save or destruction of inline relations for use with widgets
|
24
30
|
(@inline_assigned_relations ||= {}).each do |relation_class_name, origins|
|
@@ -96,7 +102,7 @@ class Label::SKOSXL::Base < Label::Base
|
|
96
102
|
def self.with_associations
|
97
103
|
includes(:labelings => :owner)
|
98
104
|
end
|
99
|
-
|
105
|
+
|
100
106
|
def self.for_dashboard
|
101
107
|
unpublished_or_follow_up.includes(:locking_user)
|
102
108
|
end
|
@@ -206,7 +212,7 @@ class Label::SKOSXL::Base < Label::Base
|
|
206
212
|
# Validations
|
207
213
|
|
208
214
|
def origin_has_to_be_escaped
|
209
|
-
if origin !=
|
215
|
+
if origin != Iqvoc::Origin.new(origin).to_s
|
210
216
|
errors.add :origin, I18n.t("txt.models.label.origin_invalid")
|
211
217
|
end
|
212
218
|
end
|
@@ -7,11 +7,11 @@ class Labeling::SKOSXL::Base < Labeling::Base
|
|
7
7
|
def self.by_label_origin(origin)
|
8
8
|
includes(:target).merge(self.label_class.by_origin(origin))
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def self.by_label_language(language)
|
12
12
|
includes(:target).merge(self.label_class.by_language(language))
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def self.label_editor_selectable
|
16
16
|
includes(:target).merge(self.label_class.editor_selectable)
|
17
17
|
end
|
@@ -66,7 +66,7 @@ class Labeling::SKOSXL::Base < Labeling::Base
|
|
66
66
|
def self.edit_partial_name(obj)
|
67
67
|
"partials/labeling/skosxl/edit_base"
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
# def by_label_language(language)
|
71
71
|
# includes(:target).merge(self.label_class.by_language(language))
|
72
72
|
# end
|
data/config/application.rb
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/lib/iqvoc/skosxl/version.rb
CHANGED
data/test/factories.rb
CHANGED
data/test/unit/label_test.rb
CHANGED
@@ -4,26 +4,37 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
class LabelTest < ActiveSupport::TestCase
|
6
6
|
|
7
|
-
|
7
|
+
setup do
|
8
8
|
@current_label = FactoryGirl.create(:xllabel_with_association)
|
9
9
|
@user = FactoryGirl.create(:user)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
test "should not create two similar labels" do
|
13
13
|
first_new_label = Label::SKOSXL::Base.new(@current_label.attributes)
|
14
14
|
second_new_label = Label::SKOSXL::Base.new(@current_label.attributes)
|
15
15
|
assert first_new_label.save
|
16
|
-
assert_equal second_new_label.save
|
16
|
+
assert_equal false, second_new_label.save
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
test "language interpolation for label origin" do
|
20
|
+
assert_equal "Forest-en", @current_label.origin
|
21
|
+
end
|
22
|
+
|
23
|
+
test "should create two labels with equal values but different languages" do
|
24
|
+
l1 = FactoryGirl.create(:xllabel, :language => "de")
|
25
|
+
l2 = FactoryGirl.build(:xllabel, :language => "en")
|
26
|
+
assert_equal true, l2.save
|
27
|
+
assert_equal "Forest-en", l2.origin
|
28
|
+
end
|
29
|
+
|
30
|
+
test "should validate origin for escaping" do
|
20
31
|
label = FactoryGirl.build(:xllabel)
|
21
32
|
assert label.valid_with_full_validation?
|
22
33
|
|
23
34
|
label.origin = "FoÖ/Bär"
|
24
35
|
assert label.invalid_with_full_validation?
|
25
36
|
|
26
|
-
label.origin =
|
37
|
+
label.origin = Iqvoc::Origin.new("FoÖ/Bär").to_s
|
27
38
|
assert label.valid_with_full_validation?
|
28
39
|
end
|
29
40
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iqvoc_skosxl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-03-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: iqvoc
|
18
|
-
requirement: &
|
18
|
+
requirement: &70213534282900 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 3.5.1
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70213534282900
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
|
-
requirement: &
|
29
|
+
requirement: &70213534297700 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70213534297700
|
38
38
|
description: ''
|
39
39
|
email:
|
40
40
|
- till.schulte-coerne@innoq.com
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- test/integration/labels_order_test.rb
|
120
120
|
- test/integration_test_helper.rb
|
121
121
|
- test/test_helper.rb
|
122
|
+
- test/unit/hygiene_test.rb
|
122
123
|
- test/unit/label_test.rb
|
123
124
|
homepage: http://innoq.com
|
124
125
|
licenses: []
|
@@ -152,4 +153,5 @@ test_files:
|
|
152
153
|
- test/integration/labels_order_test.rb
|
153
154
|
- test/integration_test_helper.rb
|
154
155
|
- test/test_helper.rb
|
156
|
+
- test/unit/hygiene_test.rb
|
155
157
|
- test/unit/label_test.rb
|