iqvoc_skosxl 2.3.1 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +17 -7
  3. data/Gemfile.lock +200 -156
  4. data/README.md +8 -0
  5. data/app/assets/stylesheets/iqvoc_skosxl/{entity_select.css → entity_select.css.scss} +1 -1
  6. data/app/assets/stylesheets/iqvoc_skosxl/manifest.css.scss +1 -0
  7. data/app/assets/stylesheets/manifest.css.scss +3 -0
  8. data/app/controllers/labels/versions_controller.rb +33 -37
  9. data/app/controllers/labels_controller.rb +32 -31
  10. data/app/controllers/rdf_controller.rb +6 -7
  11. data/app/helpers/iqvoc_skosxl_helper.rb +2 -9
  12. data/app/helpers/labels_helper.rb +7 -9
  13. data/app/models/concept/skosxl/extension.rb +2 -4
  14. data/app/models/label/relation/base.rb +10 -12
  15. data/app/models/label/relation/skosxl/base.rb +5 -3
  16. data/app/models/label/skosxl/base.rb +44 -70
  17. data/app/models/label/skosxl/properties/literal_form.rb +23 -0
  18. data/app/models/label/skosxl/validations.rb +28 -0
  19. data/app/models/labeling/skosxl/alt_label.rb +0 -2
  20. data/app/models/labeling/skosxl/base.rb +22 -16
  21. data/app/models/labeling/skosxl/hidden_label.rb +1 -3
  22. data/app/models/labeling/skosxl/pref_label.rb +0 -2
  23. data/app/views/labels/_form.html.erb +12 -10
  24. data/app/views/labels/_sidebar.html.erb +1 -0
  25. data/app/views/labels/show_published.html.erb +2 -2
  26. data/app/views/labels/show_unpublished.html.erb +6 -6
  27. data/app/views/partials/label/relation/_edit_base.html.erb +1 -1
  28. data/app/views/partials/label/skosxl/_new_link_base.html.erb +5 -5
  29. data/app/views/partials/labeling/skosxl/_edit_base.html.erb +13 -13
  30. data/app/views/rdf/show_label.iqrdf +2 -2
  31. data/config/application.rb +4 -34
  32. data/config/boot.rb +3 -12
  33. data/config/engine.rb +2 -4
  34. data/config/environment.rb +3 -3
  35. data/config/initializers/backtrace_silencers.rb +7 -0
  36. data/config/initializers/cookies_serializer.rb +3 -0
  37. data/config/initializers/filter_parameter_logging.rb +4 -0
  38. data/config/initializers/inflections.rb +16 -0
  39. data/config/initializers/iqvoc.rb +49 -3
  40. data/config/initializers/mime_types.rb +4 -0
  41. data/config/initializers/session_store.rb +1 -1
  42. data/config/initializers/wrap_parameters.rb +14 -0
  43. data/config/routes.rb +16 -8
  44. data/config/secrets.yml +11 -0
  45. data/db/migrate/20110408121540_extend_label.rb +9 -12
  46. data/db/migrate/20110408123644_add_label_relations.rb +11 -13
  47. data/iqvoc_skosxl.gemspec +15 -14
  48. data/lib/iqvoc/skosxl/version.rb +1 -1
  49. data/lib/iqvoc/xllabel.rb +1 -5
  50. data/lib/iqvoc_skosxl.rb +13 -12
  51. data/test/{functional → controllers}/routing_test.rb +4 -6
  52. data/test/fixtures/hobbies.nt +11 -0
  53. data/test/integration/concept_label_language_test.rb +44 -45
  54. data/test/integration/dashboard_test.rb +10 -12
  55. data/test/integration/edit_labels_test.rb +12 -14
  56. data/test/integration/label_creation_test.rb +43 -0
  57. data/test/integration/labels_order_test.rb +17 -17
  58. data/test/integration_test_helper.rb +29 -0
  59. data/test/models/label_test.rb +54 -0
  60. data/test/models/skos_importer_test.rb +55 -0
  61. data/test/test_helper.rb +6 -12
  62. metadata +45 -24
  63. data/app/assets/stylesheets/iqvoc_skosxl/manifest.css +0 -3
  64. data/app/assets/stylesheets/manifest.css +0 -5
  65. data/config/initializers/secret_token.rb +0 -10
  66. data/config/initializers/secret_token.rb.template +0 -9
  67. data/test/factories.rb +0 -22
  68. data/test/unit/label_test.rb +0 -41
@@ -1,28 +1,20 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  class Label::SKOSXL::Base < Label::Base
4
-
5
- include Iqvoc::Versioning
4
+ include Versioning
5
+ include FirstLevelObjectValidations
6
+ include Label::SKOSXL::Validations
6
7
 
7
8
  class_attribute :rdf_namespace, :rdf_class
8
- self.rdf_namespace = "skosxl"
9
- self.rdf_class = "Label"
10
-
11
- attr_protected :origin
12
-
13
- # ********** Validations
14
-
15
- validate :two_versions_exist, :on => :create
16
- validate :origin_has_to_be_escaped
9
+ self.rdf_namespace = 'skosxl'
10
+ self.rdf_class = 'Label'
17
11
 
18
12
  # ********** Hooks
19
13
 
20
- after_initialize do
21
- @full_validation = false
22
- end
23
-
24
14
  before_validation do |label|
25
- label.origin = Iqvoc::Origin.new("#{value}-#{language}").to_s if label.origin.blank?
15
+ if label.origin.blank?
16
+ label.origin = Iqvoc::Origin.new("#{value}-#{language}").to_s
17
+ end
26
18
  end
27
19
 
28
20
  after_save do |label|
@@ -33,7 +25,7 @@ class Label::SKOSXL::Base < Label::Base
33
25
 
34
26
  # Recreate relations reflecting the widget's parameters
35
27
  Iqvoc::XLLabel.base_class.by_origin(origins).each do |l|
36
- label.send(relation_class_name.to_relation_name).create(:range => l)
28
+ label.send(relation_class_name.to_relation_name).create(range: l)
37
29
  end
38
30
  end
39
31
  end
@@ -42,31 +34,31 @@ class Label::SKOSXL::Base < Label::Base
42
34
 
43
35
  @nested_relations = [] # Will be marked as nested attributes later
44
36
 
45
- has_many :labelings, :class_name => 'Labeling::Base', :foreign_key => 'target_id', :dependent => :destroy
46
- has_many :concepts, :through => :labelings, :source => :owner
37
+ has_many :labelings, class_name: 'Labeling::Base', foreign_key: 'target_id', dependent: :destroy
38
+ has_many :concepts, through: :labelings, source: :owner
47
39
  include_to_deep_cloning(:labelings)
48
40
 
49
- has_many :relations, :foreign_key => 'domain_id', :class_name => 'Label::Relation::Base', :dependent => :destroy
41
+ has_many :relations, foreign_key: 'domain_id', class_name: 'Label::Relation::Base', dependent: :destroy
50
42
  # Which references are pointing to this label?
51
- has_many :referenced_by_relations, :foreign_key => 'range_id', :class_name => 'Label::Relation::Base', :dependent => :destroy
43
+ has_many :referenced_by_relations, foreign_key: 'range_id', class_name: 'Label::Relation::Base', dependent: :destroy
52
44
  include_to_deep_cloning(:relations, :referenced_by_relations)
53
45
 
54
- has_many :notes, :as => :owner, :class_name => 'Note::Base', :dependent => :destroy
55
- has_many :annotations, :through => :notes, :source => :annotations
56
- include_to_deep_cloning(:notes => :annotations)
46
+ has_many :notes, as: :owner, class_name: 'Note::Base', dependent: :destroy
47
+ has_many :annotations, through: :notes, source: :annotations
48
+ include_to_deep_cloning(notes: :annotations)
57
49
 
58
50
  # ************** "Dynamic"/configureable relations
59
51
 
60
52
  Iqvoc::XLLabel.note_class_names.each do |note_class_name|
61
- has_many note_class_name.to_relation_name, :as => :owner, :class_name => note_class_name, :dependent => :destroy
53
+ has_many note_class_name.to_relation_name, as: :owner, class_name: note_class_name, dependent: :destroy
62
54
  @nested_relations << note_class_name.to_relation_name
63
55
  end
64
56
 
65
57
  Iqvoc::XLLabel.relation_class_names.each do |relation_class_name|
66
58
  has_many relation_class_name.to_relation_name,
67
- :foreign_key => 'domain_id',
68
- :class_name => relation_class_name,
69
- :dependent => :destroy
59
+ foreign_key: 'domain_id',
60
+ class_name: relation_class_name,
61
+ dependent: :destroy
70
62
 
71
63
  # Serialized setters and getters (\r\n or , separated)
72
64
  define_method("inline_#{relation_class_name.to_relation_name}".to_sym) do
@@ -82,7 +74,7 @@ class Label::SKOSXL::Base < Label::Base
82
74
  end
83
75
 
84
76
  Iqvoc::XLLabel.additional_association_classes.each do |association_class, foreign_key|
85
- has_many association_class.name.to_relation_name, :class_name => association_class.name, :foreign_key => foreign_key, :dependent => :destroy
77
+ has_many association_class.name.to_relation_name, class_name: association_class.name, foreign_key: foreign_key, dependent: :destroy
86
78
  include_to_deep_cloning(association_class.deep_cloning_relations)
87
79
  association_class.referenced_by(self)
88
80
  end
@@ -90,17 +82,17 @@ class Label::SKOSXL::Base < Label::Base
90
82
  # ********** Relation Stuff
91
83
 
92
84
  @nested_relations.each do |relation|
93
- accepts_nested_attributes_for relation, :allow_destroy => true, :reject_if => Proc.new {|attrs| attrs[:value].blank? }
85
+ accepts_nested_attributes_for relation, allow_destroy: true, reject_if: Proc.new { |attrs| attrs[:value].blank? }
94
86
  end
95
87
 
96
88
  # ********** Scopes
97
89
 
98
90
  def self.by_origin(origin)
99
- where(:origin => origin)
91
+ where(origin: origin)
100
92
  end
101
93
 
102
94
  def self.with_associations
103
- includes(:labelings => :owner)
95
+ includes(labelings: :owner)
104
96
  end
105
97
 
106
98
  def self.for_dashboard
@@ -123,11 +115,26 @@ class Label::SKOSXL::Base < Label::Base
123
115
  # end
124
116
 
125
117
  def self.new_link_partial_name
126
- "partials/label/skosxl/new_link_base"
118
+ 'partials/label/skosxl/new_link_base'
127
119
  end
128
120
 
129
121
  def self.edit_link_partial_name
130
- "partials/label/skosxl/edit_link_base"
122
+ 'partials/label/skosxl/edit_link_base'
123
+ end
124
+
125
+ def notes_for_class(note_class)
126
+ note_class = note_class.name if note_class < ActiveRecord::Base # Use the class name string
127
+ notes.select{ |note| note.class.name == note_class }
128
+ end
129
+
130
+ def relations_for_class(relation_class)
131
+ relation_class = relation_class.name if relation_class < ActiveRecord::Base # Use the class name string
132
+ relations.select{ |rel| rel.class.name == relation_class }
133
+ end
134
+
135
+ def origin=(val)
136
+ # escape origin in any case
137
+ write_attribute :origin, Iqvoc::Origin.new(val).to_s
131
138
  end
132
139
 
133
140
  def build_rdf_subject(&block)
@@ -152,7 +159,7 @@ class Label::SKOSXL::Base < Label::Base
152
159
  end
153
160
 
154
161
  def from_rdf(str)
155
- raise "invalid rdf literal" unless str =~ /^"(.+)"(@(.+))$/
162
+ raise 'invalid rdf literal' unless str =~ /^"(.+)"(@(.+))$/
156
163
  self.value = $1
157
164
  self.language = $3
158
165
  self
@@ -160,7 +167,7 @@ class Label::SKOSXL::Base < Label::Base
160
167
 
161
168
  def from_rdf!(str)
162
169
  from_rdf(str)
163
- save(:validate => false)
170
+ save(validate: false)
164
171
  end
165
172
 
166
173
  def to_param
@@ -174,44 +181,11 @@ class Label::SKOSXL::Base < Label::Base
174
181
  end
175
182
  end
176
183
 
177
- def save_with_full_validation!
178
- @full_validation = true
179
- save!
180
- end
181
-
182
- # FIXME: should not @full_validation be set back to the value it had before??? This method changes the state!
183
- def valid_with_full_validation?
184
- @full_validation = true
185
- valid?
186
- end
187
-
188
- def invalid_with_full_validation?
189
- @full_validation = true
190
- invalid?
191
- end
192
-
193
184
  # Responsible for displaying a warning message about
194
185
  # associated objects which are currently edited y another user.
195
186
  def associated_objects_in_editing_mode
196
187
  {
197
- :label_relations => Label::Relation::Base.by_domain(id).range_in_edit_mode
188
+ label_relations: Label::Relation::Base.by_domain(id).range_in_edit_mode
198
189
  }
199
190
  end
200
-
201
- protected
202
-
203
- # Validations
204
-
205
- def origin_has_to_be_escaped
206
- if origin != Iqvoc::Origin.new(origin).to_s
207
- errors.add :origin, I18n.t("txt.models.label.origin_invalid")
208
- end
209
- end
210
-
211
- def two_versions_exist
212
- if Label::SKOSXL::Base.by_origin(origin).count >= 2
213
- errors.add :base, I18n.t("txt.models.label.version_error")
214
- end
215
- end
216
-
217
191
  end
@@ -0,0 +1,23 @@
1
+ require 'iqvoc/rdfapi'
2
+
3
+ class Label::SKOSXL::Properties::LiteralForm
4
+ class_attribute :rdf_namespace, :rdf_predicate
5
+ self.rdf_namespace = 'skosxl'
6
+ self.rdf_predicate = 'literalForm'
7
+
8
+ def self.build_from_rdf(rdf_subject, rdf_predicate, rdf_object)
9
+ unless rdf_object =~ Iqvoc::RDFAPI::LITERAL_REGEXP
10
+ raise InvalidStringLiteralError,
11
+ "#{self.name}#build_from_rdf: Object (#{rdf_object}) must be a string literal"
12
+ end
13
+
14
+ lang = $3
15
+ value = begin
16
+ JSON.parse(%Q{["#{$1}"]})[0].gsub('\\n', "\n") # Trick to decode \uHHHHH chars
17
+ rescue JSON::ParserError
18
+ $1
19
+ end
20
+
21
+ rdf_subject.update_attributes(value: value, language: lang)
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ module Label
2
+ module SKOSXL
3
+ module Validations
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ validates :origin, presence: true
8
+
9
+ validate :origin_has_to_be_escaped
10
+ validate :value_must_be_given
11
+ end
12
+
13
+ def origin_has_to_be_escaped
14
+ if origin != Iqvoc::Origin.new(origin).to_s
15
+ errors.add :origin, I18n.t('txt.models.label.origin_invalid')
16
+ end
17
+ end
18
+
19
+ def value_must_be_given
20
+ if validatable_for_publishing?
21
+ if value.blank?
22
+ errors.add :origin, I18n.t('txt.models.label.value_error')
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,6 +1,4 @@
1
1
  class Labeling::SKOSXL::AltLabel < Labeling::SKOSXL::Base
2
-
3
2
  self.rdf_namespace = 'skosxl'
4
3
  self.rdf_predicate = 'altLabel'
5
-
6
4
  end
@@ -1,27 +1,26 @@
1
1
  class Labeling::SKOSXL::Base < Labeling::Base
2
-
3
2
  class_attribute :rdf_namespace, :rdf_predicate
4
3
  self.rdf_namespace = nil
5
4
  self.rdf_predicate = nil
6
5
 
7
6
  def self.target_in_edit_mode
8
- includes(:target).merge(Iqvoc::XLLabel.base_class.in_edit_mode)
7
+ includes(:target).references(:labels).merge(Iqvoc::XLLabel.base_class.in_edit_mode)
9
8
  end
10
9
 
11
10
  def self.by_label_origin(origin)
12
- includes(:target).merge(self.label_class.by_origin(origin))
11
+ includes(:target).references(:labels).merge(self.label_class.by_origin(origin))
13
12
  end
14
13
 
15
14
  def self.by_label_language(language)
16
- includes(:target).merge(self.label_class.by_language(language))
15
+ includes(:target).references(:labels).merge(self.label_class.by_language(language))
17
16
  end
18
17
 
19
18
  def self.label_editor_selectable
20
- includes(:target).merge(self.label_class.editor_selectable)
19
+ includes(:target).references(:labels).merge(self.label_class.editor_selectable)
21
20
  end
22
21
 
23
22
  def self.create_for(o, t)
24
- find_or_create_by_owner_id_and_target_id(o.id, t.id)
23
+ find_or_create_by(owner_id: o.id, target_id: t.id)
25
24
  end
26
25
 
27
26
  # FIXME: Hmm... Why should I sort labelings (not necessarily pref_labelings) by pref_label???
@@ -36,7 +35,7 @@ class Labeling::SKOSXL::Base < Labeling::Base
36
35
  def self.single_query(params = {})
37
36
  query_str = build_query_string(params)
38
37
 
39
- scope = includes(:target).order("LOWER(#{Label::Base.table_name}.value)").references(:labels)
38
+ scope = includes(:target).order("LOWER(#{Label::Base.table_name}.value)").references(:labels, :concepts)
40
39
 
41
40
  if params[:query].present?
42
41
  scope = scope.merge(Label::Base.by_query_value(query_str).by_language(params[:languages].to_a).published)
@@ -45,8 +44,8 @@ class Labeling::SKOSXL::Base < Labeling::Base
45
44
  end
46
45
 
47
46
  if params[:collection_origin].present?
48
- scope = scope.includes(:owner => { :collection_members => :collection })
49
- scope = scope.merge(Collection::Base.where(:origin => params[:collection_origin]))
47
+ scope = scope.includes(owner: { collection_members: :collection })
48
+ scope = scope.merge(Collection::Base.where(origin: params[:collection_origin]))
50
49
  end
51
50
 
52
51
  # Check that the included concept is in published state:
@@ -64,25 +63,32 @@ class Labeling::SKOSXL::Base < Labeling::Base
64
63
  end
65
64
 
66
65
  def self.partial_name(obj)
67
- "partials/labeling/skosxl/base"
66
+ 'partials/labeling/skosxl/base'
68
67
  end
69
68
 
70
69
  def self.edit_partial_name(obj)
71
- "partials/labeling/skosxl/edit_base"
70
+ 'partials/labeling/skosxl/edit_base'
72
71
  end
73
72
 
74
- # def by_label_language(language)
75
- # includes(:target).merge(self.label_class.by_language(language))
76
- # end
73
+ def self.build_from_rdf(rdf_subject, rdf_predicate, rdf_object)
74
+ unless rdf_subject.is_a?(Concept::Base)
75
+ raise "#{self.name}#build_from_rdf: Subject (#{rdf_subject}) must be a Concept."
76
+ end
77
+
78
+ predicate_class = Iqvoc::RDFAPI::PREDICATE_DICTIONARY[rdf_predicate] || self
79
+ predicate_class.create do |klass|
80
+ klass.owner = rdf_subject
81
+ klass.target = rdf_object
82
+ end
83
+ end
77
84
 
78
85
  def build_rdf(document, subject)
79
86
  subject.send(self.rdf_namespace.camelcase).send(self.rdf_predicate, IqRdf.build_uri(target.origin))
80
- subject.Skos.send(self.rdf_predicate, target.value.to_s, :lang => target.language)
87
+ subject.Skos.send(self.rdf_predicate, target.value.to_s, lang: target.language)
81
88
  end
82
89
 
83
90
  def build_search_result_rdf(document, result)
84
91
  result.Sdc::link(IqRdf.build_uri(owner.origin))
85
92
  build_rdf(document, result)
86
93
  end
87
-
88
94
  end
@@ -1,10 +1,8 @@
1
1
  class Labeling::SKOSXL::HiddenLabel < Labeling::SKOSXL::Base
2
-
3
2
  self.rdf_namespace = 'skosxl'
4
3
  self.rdf_predicate = 'hiddenLabel'
5
4
 
6
5
  def self.view_section(obj)
7
- "hidden"
6
+ 'hidden'
8
7
  end
9
-
10
8
  end
@@ -1,10 +1,8 @@
1
1
  class Labeling::SKOSXL::PrefLabel < Labeling::SKOSXL::Base
2
-
3
2
  self.rdf_namespace = 'skosxl'
4
3
  self.rdf_predicate = 'prefLabel'
5
4
 
6
5
  def self.only_one_allowed?
7
6
  true
8
7
  end
9
-
10
8
  end
@@ -1,22 +1,22 @@
1
- <%= simple_form_for label,
1
+ <%= bootstrap_form_for label,
2
2
  :as => :label,
3
3
  :url => label.new_record? ? labels_path : label_path(:id => label, :published => 0),
4
- :html => { :class => "form-horizontal" } do |f| %>
4
+ :layout => :horizontal do |f| %>
5
5
 
6
6
  <fieldset id="label_base_data">
7
7
  <legend><%= t("txt.common.attributes") %></legend>
8
- <%= f.input :value %>
9
- <%= f.input :language do %>
10
- <%= @label.language %>
11
- <span><%= f.hidden_field :language %></span>
8
+ <%= f.text_field :value %>
9
+ <%= f.form_group :language, :label => { :text => label.class.human_attribute_name(:language) } do %>
10
+ <span><%= label.language %></span>
11
+ <%= f.hidden_field :language %>
12
12
  <% end %>
13
13
 
14
14
  <% if Iqvoc::XLLabel.has_additional_base_data %>
15
15
  <%= render 'partials/label/additional_base_data', :f => f %>
16
16
  <% end %>
17
17
 
18
- <%= f.input :follow_up, :as => :string, :input_html => { :class => 'datepicker' } %>
19
- <%= f.input :expired_at, :as => :string, :input_html => { :class => 'datepicker' } %>
18
+ <%= f.text_field :follow_up, :class => 'datepicker' %>
19
+ <%= f.text_field :expired_at, :class => 'datepicker' %>
20
20
  </fieldset>
21
21
 
22
22
  <fieldset>
@@ -40,7 +40,9 @@
40
40
  <% end %>
41
41
  <% end %>
42
42
 
43
- <div class="form-actions">
43
+ <hr />
44
+
45
+ <div class="well">
44
46
  <%= f.submit t("txt.common.save"), :class => 'btn btn-primary' %>
45
47
  </div>
46
- <% end # form %>
48
+ <% end %>
@@ -5,6 +5,7 @@
5
5
  <%= sidebar_item :icon => 'share', :text => 'HTML', :path => rdf_url(label.origin, :format => :html, :published => published_param, :lang => nil) %>
6
6
  <%= sidebar_item :icon => 'share', :text => 'RDF/XML', :path => rdf_url(label.origin, :format => :rdf, :published => published_param, :lang => nil), :id => 'rdf_link_xml' %>
7
7
  <%= sidebar_item :icon => 'share', :text => 'RDF/Turtle', :path => rdf_url(label.origin, :format => :ttl, :published => published_param, :lang => nil), :id => 'rdf_link_ttl' %>
8
+ <%= sidebar_item :icon => 'share', :text => 'RDF/NTriples', :path => rdf_url(label.origin, :format => :nt, :published => published_param, :lang => nil), :id => 'rdf_link_nt' %>
8
9
  <%= sidebar_header 'Links' %>
9
10
  <%#= sidebar_item :icon => 'zoom-in', :text => 'Visualization', :path => '#visualization', :'data-toggle' => 'modal' %>
10
11
  <%= render Iqvoc::XLLabel.base_class.new_link_partial_name %>
@@ -5,10 +5,10 @@
5
5
  <div class="editing_versioning_toolbar well">
6
6
  <% if @new_label_version.blank? && can?(:branch, @label) %>
7
7
  <%= button_to t("txt.views.versioning.versioning_mode"),
8
- label_versions_branch_path(:origin => @label.origin), :class => 'btn' %>
8
+ label_versions_branch_path(:origin => @label.origin), :class => 'btn btn-default' %>
9
9
  <% elsif can?(:read, @new_label_version) %>
10
10
  <%= link_to t("txt.views.versioning.preview_new_version"),
11
- label_path(:published => 0, :id => @new_label_version), :class => 'btn' %>
11
+ label_path(:published => 0, :id => @new_label_version), :class => 'btn btn-default' %>
12
12
  <% end %>
13
13
  </div>
14
14
  <% end %>
@@ -15,29 +15,29 @@
15
15
  <% end %>
16
16
  <%= button_to t("txt.views.versioning.consistency_check"),
17
17
  label_versions_consistency_check_path(:origin => @label.origin),
18
- :method => :get, :class => 'btn' %>
18
+ :method => :get, :class => 'btn btn-default' %>
19
19
 
20
20
  <% if (not @label.in_review?) && @label.locked_by == @current_user.id %>
21
21
  <%= button_to t("txt.common.to_review"),
22
22
  label_versions_to_review_path(:origin => @label.origin),
23
- :class => 'btn' %>
23
+ :class => 'btn btn-default' %>
24
24
  <% end %>
25
25
 
26
26
  <% unless @label.locked? %>
27
27
  <%= button_to t("txt.views.versioning.to_edit_mode"),
28
- label_versions_lock_path(:origin => @label.origin), :class => 'btn' %>
28
+ label_versions_lock_path(:origin => @label.origin), :class => 'btn btn-default' %>
29
29
  <%= button_to t("txt.views.versioning.delete"),
30
30
  label_path(:published => 0, :id => @label.origin),
31
31
  :method => :delete,
32
32
  :confirm => I18n.t("txt.views.versioning.delete_confirm"),
33
- :class => 'btn' %>
33
+ :class => 'btn btn-default' %>
34
34
  <% else %>
35
35
  <%= button_to t("txt.views.versioning.unlock"),
36
36
  label_versions_unlock_path(:origin => @label.origin),
37
- :class => 'btn' if can?(:unlock, @label) %>
37
+ :class => 'btn btn-default' if can?(:unlock, @label) %>
38
38
  <%= link_to t("txt.views.versioning.edit_mode"),
39
39
  edit_label_path(:published => 0, :id => @label.origin),
40
- :class => 'btn' if can?(:update, @label) %>
40
+ :class => 'btn btn-default' if can?(:update, @label) %>
41
41
  <% end %>
42
42
  </div>
43
43
 
@@ -1,5 +1,5 @@
1
1
  <% fieldname = "label[inline_#{klass.name.to_relation_name}]" %>
2
- <%= f.input fieldname, :label => klass.model_name.human(:count => 2) do %>
2
+ <%= f.form_group nil, :label => { :text => klass.model_name.human(:count => 2) } do %>
3
3
  <%= text_field_tag fieldname, label.send("inline_#{klass.name.to_relation_name}"),
4
4
  :id => klass.name.to_relation_name,
5
5
  :class => "entity_select",
@@ -1,5 +1,5 @@
1
- <%= sidebar_item :path => new_label_path, :perms => [:create, Iqvoc::XLLabel.base_class], :active => params[:action] == 'new' do %>
2
- <%= icon(:edit) + " " + t('txt.views.labels.new') %> (<% Iqvoc::Concept::labeling_class_names.values.flatten.map(&:to_s).uniq.each do |language| %>
3
- <%= link_to language.to_s, new_label_path(:published => 0, :language => language), :class => 'inline-language-selector' %>
4
- <% end %>)
5
- <% end %>
1
+ <span class="list-group-item">
2
+ <%= icon(:edit) %> <%= t("txt.views.labels.new") %> (<% Iqvoc::Concept::labeling_class_names.values.flatten.map(&:to_s).uniq.each do |language| %>
3
+ <%= link_to language.to_s, new_label_path(:published => 0, :language => language), :class => 'inline-language-selector' %>
4
+ <% end %>)
5
+ </span>
@@ -2,18 +2,18 @@
2
2
  <%- fieldname = "concept[labelings_by_id][#{klass.name.to_relation_name}][#{language}]" -%>
3
3
  <%- label = klass.model_name.human(:count => 2) -%>
4
4
 
5
- <%= f.label label %>
6
- <%= f.input fieldname, :wrapper => :prepend, :label => false do %>
7
- <span class="add-on"><%= language %></span><%= text_field_tag "concept[labelings_by_id][#{klass.name.to_relation_name}][#{language}]",
8
- concept.labelings_by_id(klass.name.to_relation_name, language),
9
- :id => "#{klass.name.to_relation_name}_#{language}",
10
- :class => "entity_select",
11
- :"data-query-url" => labels_path(:format => :json, :language => language),
12
- :"data-entity-uri" => label_path("{id}"),
13
- :"data-entities" => Iqvoc::XLLabel.base_class.editor_selectable.
14
- by_language(language).by_origin(concept.labelings_by_id(
15
- klass.name.to_relation_name, language).
16
- split(Iqvoc::InlineDataHelper::SPLITTER)).
17
- map { |l| label_widget_data(l) }.to_json %>
5
+ <%= f.form_group nil, :label => { :text => label } do %>
6
+ <%= text_field_tag fieldname,
7
+ concept.labelings_by_id(klass.name.to_relation_name, language),
8
+ :id => "#{klass.name.to_relation_name}_#{language}",
9
+ :class => "entity_select form-control",
10
+ :"data-language" => language,
11
+ :"data-query-url" => labels_path(:format => :json, :language => language),
12
+ :"data-entity-uri" => label_path("{id}"),
13
+ :"data-entities" => Iqvoc::XLLabel.base_class.editor_selectable.
14
+ by_language(language).by_origin(concept.labelings_by_id(
15
+ klass.name.to_relation_name, language).
16
+ split(Iqvoc::InlineDataHelper::SPLITTER)).
17
+ map { |l| label_widget_data(l) }.to_json %>
18
18
  <% end %>
19
19
  <% end %>
@@ -1,5 +1,5 @@
1
- Iqvoc.default_rdf_namespace_helper_methods.each do |meth|
1
+ RdfNamespacesHelper.instance_methods.each do |meth|
2
2
  document.namespaces(self.send(meth))
3
3
  end
4
4
 
5
- render_label_rdf(document, @label)
5
+ render_label_rdf(document, @label)
@@ -2,16 +2,12 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
- if defined?(Bundler)
6
- # If you precompile assets before deploying to production, use this line
7
- Bundler.require *Rails.groups(:assets => %w(development test))
8
- # If you want your assets lazily compiled in production, use this line
9
- # Bundler.require(:default, :assets, Rails.env)
10
- end
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
11
8
 
12
9
  module Iqvoc::SKOSXL
13
10
  class Application < Rails::Application
14
-
15
11
  # This has to be here because iqvoc_skosxl.rb needs to know if it runs as app or as engine
16
12
  require 'iqvoc_skosxl'
17
13
 
@@ -19,38 +15,12 @@ module Iqvoc::SKOSXL
19
15
  # Application configuration should go into files in config/initializers
20
16
  # -- all .rb files in that directory are automatically loaded.
21
17
 
22
- # Custom directories with classes and modules you want to be autoloadable.
23
- # config.autoload_paths += %W(#{config.root}/extras)
24
-
25
- # Only load the plugins named here, in the order given (default is alphabetical).
26
- # :all can be used as a placeholder for all plugins not explicitly named.
27
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
28
-
29
- # Activate observers that should always be running.
30
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
31
-
32
18
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
33
19
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
34
20
  # config.time_zone = 'Central Time (US & Canada)'
35
21
 
36
22
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
37
23
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
38
- config.i18n.default_locale = :de
39
- # config.i18n.available_locales = [:de, :en]
40
-
41
- # JavaScript files you want as :defaults (application.js is always included).
42
- # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
43
-
44
- # Configure the default encoding used in templates for Ruby 1.9.
45
- config.encoding = "utf-8"
46
-
47
- # Configure sensitive parameters which will be filtered from the log file.
48
- config.filter_parameters += [:password, :password_confirmation]
49
-
50
- # Enable the asset pipeline
51
- config.assets.enabled = true
52
-
53
- # Version of your assets, change this if you want to expire all your assets
54
- config.assets.version = '1.0'
24
+ # config.i18n.default_locale = :de
55
25
  end
56
26
  end
data/config/boot.rb CHANGED
@@ -1,13 +1,4 @@
1
- require 'rubygems'
2
-
3
1
  # Set up gems listed in the Gemfile.
4
- gemfile = File.expand_path('../../Gemfile', __FILE__)
5
- begin
6
- ENV['BUNDLE_GEMFILE'] = gemfile
7
- require 'bundler'
8
- Bundler.setup
9
- rescue Bundler::GemNotFound => e
10
- STDERR.puts e.message
11
- STDERR.puts "Try running `bundle install`."
12
- exit!
13
- end if File.exist?(gemfile)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
data/config/engine.rb CHANGED
@@ -2,14 +2,12 @@ require 'rails'
2
2
 
3
3
  module Iqvoc
4
4
  module SKOSXL
5
-
6
5
  class Engine < Rails::Engine
7
- paths["lib/tasks"] << "lib/engine_tasks"
6
+ paths['lib/tasks'] << 'lib/engine_tasks'
8
7
 
9
- initializer "iqvoc_skosxl.load_migrations" do |app|
8
+ initializer 'iqvoc_skosxl.load_migrations' do |app|
10
9
  app.config.paths['db/migrate'].concat(Iqvoc::SKOSXL::Engine.paths['db/migrate'].existent)
11
10
  end
12
11
  end
13
-
14
12
  end
15
13
  end