iqvoc 4.13.2 → 4.14.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -8
  3. data/Gemfile.lock +381 -331
  4. data/app/aides/inline_data_helper.rb +3 -3
  5. data/app/aides/skos_exporter.rb +1 -1
  6. data/app/assets/javascripts/iqvoc/iqvoc.js +0 -20
  7. data/app/assets/stylesheets/iqvoc/_manifest.scss +1 -0
  8. data/app/assets/stylesheets/iqvoc/_search_results.scss +14 -0
  9. data/app/controllers/collections/versions_controller.rb +12 -47
  10. data/app/controllers/collections_controller.rb +15 -8
  11. data/app/controllers/concepts/alphabetical_controller.rb +1 -1
  12. data/app/controllers/concepts/hierarchical_controller.rb +9 -13
  13. data/app/controllers/concepts/versions_controller.rb +13 -48
  14. data/app/controllers/concepts_controller.rb +19 -15
  15. data/app/controllers/concepts_movement_controller.rb +1 -1
  16. data/app/controllers/dashboard_controller.rb +5 -5
  17. data/app/controllers/imports_controller.rb +9 -6
  18. data/app/controllers/reverse_matches_controller.rb +2 -4
  19. data/app/controllers/search_results_controller.rb +13 -19
  20. data/app/helpers/application_helper.rb +0 -8
  21. data/app/helpers/link_helper.rb +13 -9
  22. data/app/helpers/rdf_helper.rb +9 -5
  23. data/app/jobs/reverse_match_job.rb +8 -4
  24. data/app/models/ability.rb +7 -7
  25. data/app/models/collection/base.rb +17 -8
  26. data/app/models/concept/base.rb +17 -7
  27. data/app/models/concept/relation/base.rb +1 -1
  28. data/app/models/concept/relation/reverse_relation_extension.rb +9 -5
  29. data/app/models/concerns/search_extension.rb +0 -17
  30. data/app/models/concerns/versioning.rb +1 -31
  31. data/app/models/dataset/adaptors/iqvoc/alphabetical_search_adaptor.rb +2 -2
  32. data/app/models/dataset/adaptors/iqvoc/http_adaptor.rb +2 -2
  33. data/app/models/dataset/adaptors/iqvoc/search_adaptor.rb +2 -2
  34. data/app/models/export.rb +1 -1
  35. data/app/models/label/base.rb +5 -5
  36. data/app/models/note/base.rb +1 -1
  37. data/app/models/user.rb +2 -0
  38. data/app/uploaders/rdf_uploader.rb +1 -1
  39. data/app/views/collections/_data.html.erb +2 -2
  40. data/app/views/collections/show_unpublished.html.erb +3 -11
  41. data/app/views/concepts/notifications/_referenced_concepts.html.erb +0 -1
  42. data/app/views/concepts/show_published.html.erb +2 -0
  43. data/app/views/concepts/show_unpublished.html.erb +5 -11
  44. data/app/views/dashboard/_table.html.erb +0 -8
  45. data/app/views/pages/version.html.erb +1 -1
  46. data/app/views/partials/concept/_edit_link_base.html.erb +2 -2
  47. data/app/views/partials/concept/relation/_edit_base.html.erb +13 -10
  48. data/app/views/search_results/_detailed_search.html.erb +27 -0
  49. data/app/views/search_results/_form.html.erb +21 -9
  50. data/app/views/search_results/index.html.erb +4 -4
  51. data/app/views/search_results/sections/_change_note.html.erb +28 -25
  52. data/app/views/search_results/sections/_collection.html.erb +5 -5
  53. data/app/views/search_results/sections/_datasets.html.erb +8 -20
  54. data/app/views/search_results/sections/_klass.html.erb +7 -9
  55. data/app/views/search_results/sections/_languages.html.erb +4 -14
  56. data/app/views/search_results/sections/_mode.html.erb +8 -10
  57. data/app/views/search_results/sections/_options.html.erb +6 -8
  58. data/app/views/search_results/sections/_terms.html.erb +13 -10
  59. data/app/views/search_results/sections/_type.html.erb +13 -13
  60. data/config/application.rb +1 -1
  61. data/config/boot.rb +1 -1
  62. data/config/database.yml +21 -15
  63. data/config/database.yml.postgresql +1 -1
  64. data/config/engine.rb +1 -0
  65. data/config/initializers/active_record.rb +2 -0
  66. data/config/initializers/content_security_policy.rb +21 -26
  67. data/config/initializers/filter_parameter_logging.rb +4 -2
  68. data/config/initializers/inflections.rb +4 -4
  69. data/config/initializers/iqvoc.rb +1 -0
  70. data/config/locales/de.yml +13 -18
  71. data/config/locales/en.yml +13 -18
  72. data/config/locales/pt.yml +0 -7
  73. data/config/routes.rb +0 -4
  74. data/db/migrate/20231012135837_remove_locked_by.rb +6 -0
  75. data/db/schema.rb +31 -34
  76. data/iqvoc.gemspec +7 -5
  77. data/lib/iqvoc/configuration/concept.rb +2 -0
  78. data/lib/iqvoc/configuration/core.rb +4 -0
  79. data/lib/iqvoc/configuration/instance_configuration.rb +2 -2
  80. data/lib/iqvoc/environments/development.rb +5 -2
  81. data/lib/iqvoc/environments/production.rb +7 -28
  82. data/lib/iqvoc/environments/test.rb +1 -1
  83. data/lib/iqvoc/version.rb +1 -1
  84. data/test/controllers/concepts_movement_controller_test.rb +0 -2
  85. data/test/controllers/reverse_match_test.rb +1 -1
  86. data/test/integration/collection_browsing_test.rb +45 -0
  87. data/test/integration/collection_circularity_test.rb +3 -3
  88. data/test/integration/concept_collection_assignment_test.rb +1 -1
  89. data/test/integration/create_concept_test.rb +15 -0
  90. data/test/integration/reverse_match_job_test.rb +39 -7
  91. data/test/integration/search_test.rb +9 -9
  92. data/test/integration/version_page_test.rb +26 -0
  93. data/test/models/concept_test.rb +37 -0
  94. data/test/models/deep_cloning_test.rb +9 -7
  95. data/test/test_helper.rb +3 -0
  96. metadata +81 -67
  97. data/app/views/search_results/sections/_note.html.erb +0 -6
  98. data/bin/bundle +0 -3
  99. data/bin/delayed_job +0 -5
  100. data/bin/rails +0 -4
  101. data/bin/rake +0 -4
  102. data/bin/setup +0 -36
  103. data/bin/update +0 -31
  104. data/bin/yarn +0 -17
@@ -46,7 +46,7 @@ module RdfHelper
46
46
  end
47
47
 
48
48
  c.Schema::expires(concept.expired_at.to_s) if concept.expired_at
49
- c.Owl::deprecated(true) if concept.expired_at and concept.expired_at <= Date.new
49
+ c.Owl::deprecated(true) if concept.expired?
50
50
 
51
51
  c.Skos::topConceptOf IqRdf.build_uri(Iqvoc::Concept.root_class.instance.origin) if concept.top_term?
52
52
  c.Skos::inScheme IqRdf.build_uri(Iqvoc::Concept.root_class.instance.origin)
@@ -59,8 +59,10 @@ module RdfHelper
59
59
  relation.build_rdf(document, c, suppress_extra_labels)
60
60
  end
61
61
 
62
- concept.notes.each do |note|
63
- note.build_rdf(document, c)
62
+ if Iqvoc::rdf_show_change_notes
63
+ concept.notes.each do |note|
64
+ note.build_rdf(document, c)
65
+ end
64
66
  end
65
67
 
66
68
  concept.matches.each do |match|
@@ -93,8 +95,10 @@ module RdfHelper
93
95
  labeling.build_rdf(document, c)
94
96
  end
95
97
 
96
- collection.note_skos_definitions.each do |note|
97
- note.build_rdf(document, c)
98
+ if Iqvoc::rdf_show_change_notes
99
+ collection.note_skos_definitions.each do |note|
100
+ note.build_rdf(document, c)
101
+ end
98
102
  end
99
103
 
100
104
  collection.concepts.each do |concept|
@@ -38,11 +38,15 @@ class ReverseMatchJob < Struct.new(:type, :concept, :match_class, :subject, :ob
38
38
  error_type = nil
39
39
 
40
40
  case exception
41
- when Faraday::Error::ConnectionFailed
42
- error_type = 'connection_failed'
43
- when Faraday::Error::TimeoutError
41
+ when Faraday::ConnectionFailed
42
+ if exception&.wrapped_exception.class == Net::OpenTimeout
43
+ error_type = 'timeout_error'
44
+ else
45
+ error_type = 'connection_failed'
46
+ end
47
+ when Faraday::TimeoutError
44
48
  error_type = 'timeout_error'
45
- when Faraday::Error::ResourceNotFound
49
+ when Faraday::ResourceNotFound
46
50
  error_type = 'resource_not_found'
47
51
  when Faraday::ClientError
48
52
  body = exception.response[:body] || {}
@@ -6,6 +6,7 @@ class Ability
6
6
  def initialize(user = nil)
7
7
  can :read, Iqvoc::Concept.root_class.instance
8
8
  can :read, [::Concept::Base, ::Collection::Base, ::Label::Base], &@@if_published
9
+ can :read, ::Note::Base
9
10
 
10
11
  # static pages
11
12
  can :read, :help
@@ -23,11 +24,10 @@ class Ability
23
24
  if user.owns_role?(:editor) || user.owns_role?(:publisher) || user.owns_role?(:administrator) # Editors and above ...
24
25
  can :read, [::Concept::Base, ::Collection::Base, ::Label::Base]
25
26
  can :create, [::Concept::Base, ::Collection::Base, ::Label::Base]
26
- can [:update, :destroy, :unlock], [::Concept::Base, ::Collection::Base, ::Label::Base], locked_by: user.id, published_at: nil
27
- can :lock, [::Concept::Base, ::Collection::Base, ::Label::Base], locked_by: nil, published_at: nil
27
+ can [:update, :destroy], [::Concept::Base, ::Collection::Base, ::Label::Base], published_at: nil
28
28
  can :check_consistency, [::Concept::Base, ::Collection::Base, ::Label::Base], published_at: nil
29
29
  can :send_to_review, [::Concept::Base, ::Collection::Base, ::Label::Base] do |object|
30
- !object.in_review? && object.locked_by == user.id
30
+ !object.in_review?
31
31
  end
32
32
  can :branch, [::Concept::Base, ::Collection::Base, ::Label::Base], &@@if_published
33
33
  end
@@ -35,19 +35,19 @@ class Ability
35
35
  if user.owns_role?(:match_editor)
36
36
  can :read, ::Concept::Base
37
37
  can :create, ::Concept::Base
38
- can [:update, :lock], ::Concept::Base, locked_by: user.id, published_at: nil
39
- can :lock, ::Concept::Base, locked_by: nil, published_at: nil
38
+ can :update, ::Concept::Base, published_at: nil
39
+ can :lock, ::Concept::Base, published_at: nil
40
40
  can :branch, ::Concept::Base, &@@if_published
41
41
  end
42
42
 
43
43
  if user.owns_role?(:publisher) || user.owns_role?(:administrator) # Publishers and above ...
44
44
  can :merge, [::Concept::Base, ::Collection::Base, ::Label::Base] do |object|
45
- !object.published? && (!object.locked? || object.locked_by == user.id)
45
+ !object.published?
46
46
  end
47
47
  end
48
48
 
49
49
  if user.owns_role?(:administrator)
50
- can [:update, :destroy, :unlock], [::Concept::Base, ::Label::Base], published_at: nil # Mustn't be locked by myself
50
+ can [:update, :destroy], [::Concept::Base, ::Label::Base], published_at: nil
51
51
 
52
52
  can :manage, User
53
53
  can :manage, Iqvoc.config
@@ -42,6 +42,16 @@ class Collection::Base < Concept::Base
42
42
  through: :parent_collection_members,
43
43
  source: 'collection'
44
44
 
45
+ has_many :concepts,
46
+ -> { where("concepts.type = ?", Iqvoc::Concept.base_class) },
47
+ through: :members,
48
+ source: :target
49
+
50
+ has_many :subcollections,
51
+ -> { where("concepts.type = ?", Iqvoc::Collection.base_class) },
52
+ through: :members,
53
+ source: :target
54
+
45
55
  include_to_deep_cloning(:members)
46
56
 
47
57
  # ********** Hooks
@@ -57,6 +67,13 @@ class Collection::Base < Concept::Base
57
67
 
58
68
  validate :circular_subcollections
59
69
 
70
+ def self.with_pref_labels
71
+ preload(:pref_labels)
72
+ .joins(:pref_labels)
73
+ .references(:collection_members)
74
+ .distinct
75
+ end
76
+
60
77
  def self.by_origin(origin)
61
78
  where(origin: origin)
62
79
  end
@@ -91,14 +108,6 @@ class Collection::Base < Concept::Base
91
108
  'collection_path'
92
109
  end
93
110
 
94
- def subcollections
95
- members.map(&:target).compact.select { |m| m.is_a?(::Collection::Base) }
96
- end
97
-
98
- def concepts
99
- members.map(&:target).compact.reject { |m| m.is_a?(::Collection::Base) }
100
- end
101
-
102
111
  def to_param
103
112
  origin
104
113
  end
@@ -289,6 +289,16 @@ class Concept::Base < ApplicationRecord
289
289
  through: :alt_labelings,
290
290
  source: :target
291
291
 
292
+ has_many :hidden_labelings,
293
+ foreign_key: 'owner_id',
294
+ class_name: Iqvoc::Concept.hidden_labeling_class_name,
295
+ inverse_of: :owner
296
+
297
+ has_many :hidden_labels,
298
+ -> { order(:value) },
299
+ through: :hidden_labelings,
300
+ source: :target
301
+
292
302
  Iqvoc::Concept.labeling_class_names.each do |labeling_class_name, languages|
293
303
  has_many labeling_class_name.to_relation_name,
294
304
  foreign_key: 'owner_id',
@@ -359,12 +369,12 @@ class Concept::Base < ApplicationRecord
359
369
  # ********** Scopes
360
370
 
361
371
  def self.expired(time = Time.now)
362
- where(arel_table[:expired_at].lt(time))
372
+ where(arel_table[:expired_at].lteq(time))
363
373
  end
364
374
 
365
375
  def self.not_expired(time = Time.now)
366
376
  col = arel_table[:expired_at]
367
- where((col.eq(nil)).or(col.gteq(time)))
377
+ where((col.eq(nil)).or(col.gt(time)))
368
378
  end
369
379
 
370
380
  def self.tops
@@ -385,13 +395,13 @@ class Concept::Base < ApplicationRecord
385
395
  end
386
396
 
387
397
  def self.with_pref_labels
388
- includes(:pref_labels).
389
- order(Arel.sql("LOWER(#{Label::Base.table_name}.value)")).
390
- where(labelings: { type: Iqvoc::Concept.pref_labeling_class_name }) # This line is just a workaround for a Rails Bug. TODO: Delete it when the Bug is fixed
398
+ preload(:pref_labels)
399
+ .joins(:pref_labels)
400
+ .order(Arel.sql("LOWER(#{Label::Base.table_name}.value)"))
391
401
  end
392
402
 
393
403
  def self.for_dashboard
394
- unpublished_or_follow_up.includes(:pref_labels, :locking_user)
404
+ unpublished_or_follow_up.includes(:pref_labels)
395
405
  end
396
406
 
397
407
  def self.parentless
@@ -565,7 +575,7 @@ class Concept::Base < ApplicationRecord
565
575
  end
566
576
 
567
577
  def expired?
568
- self.expired_at && self.expired_at < Date.today
578
+ self.expired_at && self.expired_at <= Date.today
569
579
  end
570
580
 
571
581
  private
@@ -73,7 +73,7 @@ class Concept::Relation::Base < ApplicationRecord
73
73
  end
74
74
 
75
75
  def self.target_in_edit_mode
76
- joins(:target).merge(Concept::Base.in_edit_mode).references(:concepts)
76
+ joins(:target).merge(Concept::Base.unpublished).references(:concepts)
77
77
  end
78
78
 
79
79
  # ********* Methods
@@ -25,9 +25,11 @@ module Concept
25
25
  attributes = attributes.except(:rank) unless relation_class.rankable?
26
26
  scope.any? || scope.create!(attributes)
27
27
 
28
- # The reverse direction
29
- scope = relation_class.reverse_relation_class.where(owner_id: target_concept.id, target_id: proxy_association.owner.id)
30
- scope.any? || scope.create!(attributes)
28
+ if relation_class.bidirectional?
29
+ # The reverse direction
30
+ scope = relation_class.reverse_relation_class.where(owner_id: target_concept.id, target_id: proxy_association.owner.id)
31
+ scope.any? || scope.create!(attributes)
32
+ end
31
33
  end
32
34
  end
33
35
 
@@ -38,8 +40,10 @@ module Concept
38
40
  relation.destroy
39
41
  end
40
42
 
41
- relation_class.reverse_relation_class.where(owner_id: target_concept.id, target_id: proxy_association.owner.id).load.each do |relation|
42
- relation.destroy
43
+ if relation_class.bidirectional?
44
+ relation_class.reverse_relation_class.where(owner_id: target_concept.id, target_id: proxy_association.owner.id).load.each do |relation|
45
+ relation.destroy
46
+ end
43
47
  end
44
48
  end
45
49
  end
@@ -22,27 +22,10 @@ module SearchExtension
22
22
  end
23
23
 
24
24
  module ClassMethods
25
- def multi_query(params = {})
26
- query_terms = params[:query].split(/\r\n/)
27
- results = []
28
- query_terms.each do |term|
29
- results << { query: term, result: single_query(params.merge({ query: term })) }
30
- end
31
- results
32
- end
33
-
34
25
  def single_query(params = {})
35
26
  raise NotImplementedError.new("Implement self.single_query in your specific class (#{self.name}) that should be searchable!")
36
27
  end
37
28
 
38
- def supports_multi_query?
39
- false
40
- end
41
-
42
- def forces_multi_query?
43
- false
44
- end
45
-
46
29
  def build_query_string(params = {})
47
30
  query_str = params[:query].strip
48
31
  query_str = "%#{query_str}" if ['contains', 'ends_with'].include?(params[:query_type].to_s)
@@ -25,11 +25,6 @@ module Versioning
25
25
  class_name: name,
26
26
  optional: true
27
27
 
28
- belongs_to :locking_user,
29
- foreign_key: 'locked_by',
30
- class_name: 'AbstractUser',
31
- optional: true
32
-
33
28
  after_initialize do
34
29
  disable_validations_for_publishing
35
30
  end
@@ -48,10 +43,6 @@ module Versioning
48
43
  where(published_at: nil)
49
44
  end
50
45
 
51
- def locked
52
- where(arel_table[:locked_by].not_eq(nil))
53
- end
54
-
55
46
  def published_with_newer_versions
56
47
  # published objects without objects which have a new one in editing
57
48
  published_objects = arel_table[:published_at].not_eq(nil).and(arel_table[:origin].not_in(unpublished.map(&:origin)))
@@ -70,10 +61,6 @@ module Versioning
70
61
  )
71
62
  end
72
63
 
73
- def in_edit_mode
74
- where(arel_table[:locked_by].not_eq(nil))
75
- end
76
-
77
64
  def unpublished_or_follow_up
78
65
  where(
79
66
  arel_table[:published_at].eq(nil).or(
@@ -99,9 +86,8 @@ module Versioning
99
86
  end
100
87
  end # module ClassMethods
101
88
 
102
- def branch(user)
89
+ def branch
103
90
  new_version = self.deep_clone(include: self.class.includes_to_deep_cloning)
104
- new_version.lock_by_user(user.id)
105
91
  new_version.increment(:rev)
106
92
  new_version.published_version_id = self.id
107
93
  new_version.unpublish
@@ -114,20 +100,10 @@ module Versioning
114
100
  published? || read_attribute(:published_version_id).blank?
115
101
  end
116
102
 
117
- def lock_by_user(user_id)
118
- tap do
119
- write_attribute(:locked_by, user_id)
120
- end
121
- end
122
-
123
103
  def never_published?
124
104
  unpublished? && rev == 1
125
105
  end
126
106
 
127
- def locked?
128
- locked_by?
129
- end
130
-
131
107
  def state
132
108
  if published?
133
109
  I18n.t('txt.common.state.published')
@@ -138,12 +114,6 @@ module Versioning
138
114
  end
139
115
  end
140
116
 
141
- def unlock
142
- tap do
143
- write_attribute(:locked_by, nil)
144
- end
145
- end
146
-
147
117
  def in_review?
148
118
  read_attribute(:to_review).present?
149
119
  end
@@ -12,8 +12,8 @@ class Dataset::Adaptors::Iqvoc::AlphabeticalSearchAdaptor < Dataset::Adaptors::I
12
12
  while more = @doc.at_css('a[rel=next]')
13
13
  fetch_results(more[:href], {})
14
14
  end
15
- rescue Faraday::Error::ConnectionFailed,
16
- Faraday::Error::ResourceNotFound => e
15
+ rescue Faraday::ConnectionFailed,
16
+ Faraday::ResourceNotFound => e
17
17
  Rails.logger.warn("HTTP error while querying remote source #{url}: #{e.message}")
18
18
  return nil
19
19
  end
@@ -15,8 +15,8 @@ class Dataset::Adaptors::Iqvoc::HttpAdaptor
15
15
  def http_get(path, redirect_count = 0)
16
16
  begin
17
17
  response = @conn.get(path)
18
- rescue Faraday::Error::ConnectionFailed,
19
- Faraday::Error::ResourceNotFound => e
18
+ rescue Faraday::ConnectionFailed,
19
+ Faraday::ResourceNotFound => e
20
20
  return failed_request(path)
21
21
  end
22
22
 
@@ -24,8 +24,8 @@ class Dataset::Adaptors::Iqvoc::SearchAdaptor < Dataset::Adaptors::Iqvoc::HttpAd
24
24
  while more = @doc.at_css('a[rel=next]')
25
25
  fetch_results(more[:href], {})
26
26
  end
27
- rescue Faraday::Error::ConnectionFailed,
28
- Faraday::Error::ResourceNotFound => e
27
+ rescue Faraday::ConnectionFailed,
28
+ Faraday::ResourceNotFound => e
29
29
  Rails.logger.warn("HTTP error while querying remote source #{path}: #{e.message}")
30
30
  return nil
31
31
  end
data/app/models/export.rb CHANGED
@@ -27,6 +27,6 @@ class Export < ApplicationRecord
27
27
  private
28
28
 
29
29
  def delete_dump_file
30
- File.delete(build_filename) if File.exists?(build_filename)
30
+ File.delete(build_filename) if File.exist?(build_filename)
31
31
  end
32
32
  end
@@ -82,7 +82,7 @@ class Label::Base < ApplicationRecord
82
82
  end
83
83
 
84
84
  def self.by_query_value(query)
85
- where(["LOWER(#{table_name}.value) LIKE ?", query.mb_chars.downcase.to_s])
85
+ where(["#{table_name}.value ILIKE ?", query.mb_chars.downcase.to_s])
86
86
  end
87
87
 
88
88
  # Attention: This means that even label classes without version controll will also
@@ -101,6 +101,10 @@ class Label::Base < ApplicationRecord
101
101
  true
102
102
  end
103
103
 
104
+ def expired?
105
+ self.expired_at && self.expired_at < Date.today
106
+ end
107
+
104
108
  def <=>(other)
105
109
  self.to_s.downcase <=> other.to_s.downcase
106
110
  end
@@ -122,10 +126,6 @@ class Label::Base < ApplicationRecord
122
126
  end
123
127
 
124
128
  def to_s
125
- if (language.presence || 'none') != I18n.locale.to_s
126
- value.to_s + " [#{I18n.t('txt.common.translation_missing_for')} '#{I18n.locale}']"
127
- else
128
129
  value.to_s
129
- end
130
130
  end
131
131
  end
@@ -73,7 +73,7 @@ class Note::Base < ApplicationRecord
73
73
  end
74
74
 
75
75
  def self.by_query_value(query)
76
- where(["LOWER(#{table_name}.value) LIKE ?", query.mb_chars.downcase.to_s])
76
+ where(["#{table_name}.value ILIKE ?", query.mb_chars.downcase.to_s])
77
77
  end
78
78
 
79
79
  def self.by_owner_type(klass)
data/app/models/user.rb CHANGED
@@ -3,6 +3,8 @@ class User < AbstractUser
3
3
 
4
4
  validates_inclusion_of :role, in: ROLES
5
5
  validates_length_of :forename, :surname, within: 2..255
6
+ validates_presence_of :email
7
+ validates_format_of :email, with: URI::MailTo::EMAIL_REGEXP
6
8
 
7
9
  def name
8
10
  "#{forename} #{surname}"
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class RdfUploader < Base
4
- def extension_white_list
4
+ def extension_allowlist
5
5
  %w(nt)
6
6
  end
7
7
  end
@@ -28,7 +28,7 @@
28
28
  </h2>
29
29
  <div class="relation-body">
30
30
  <ul>
31
- <%- collection.concepts.sort {|a, b| a.pref_label.to_s <=> b.pref_label.to_s }.each do |concept| -%>
31
+ <%- collection.concepts.with_pref_labels.each do |concept| -%>
32
32
  <%- if concept.published? || (!concept.published_version_id && can?(:update, concept)) -%>
33
33
  <li><%= render concept.class.inline_partial_name, :concept => concept %></li>
34
34
  <%- end -%>
@@ -47,6 +47,6 @@
47
47
  <% end %>
48
48
  </h2>
49
49
  <ul class="hybrid-treeview" data-url="<%= collections_path(:format => :json) %>">
50
- <%= render :partial => 'collection', :collection => collection.subcollections.sort {|a, b| a.pref_label <=> b.pref_label } %>
50
+ <%= render :partial => 'collection', :collection => collection.subcollections.with_pref_labels %>
51
51
  </ul>
52
52
  </div>
@@ -3,9 +3,6 @@
3
3
 
4
4
  <%= alert :info, :header => t('txt.common.unpublished_version') + "." do %>
5
5
  <%= t("txt.views.versioning.current_revision", :rev => @collection.rev) %>
6
- <% if @collection.locked? %>
7
- <%= t("txt.views.versioning.in_ongoing_editing_by", :user => @collection.locking_user.name) %>
8
- <% end %>
9
6
  <% end %>
10
7
 
11
8
  <div class="editing_versioning_toolbar">
@@ -24,15 +21,10 @@
24
21
  collection_versions_to_review_path(:origin => @collection.origin), :class => 'btn btn-outline-secondary' %>
25
22
  <% end %>
26
23
 
27
- <% if @collection.locked? %>
28
- <%= button_to t("txt.views.versioning.unlock"),
29
- collection_versions_unlock_path(:origin => @collection.origin), :class => 'btn btn-outline-secondary' if can?(:unlock, @collection) %>
24
+ <% if can?(:update, @collection) %>
30
25
  <%= link_to t("txt.views.versioning.edit_mode"),
31
- edit_collection_path(:published => 0, :id => @collection.origin),
32
- :class => 'btn btn-outline-secondary' if can?(:update, @collection) %>
33
- <% else %>
34
- <%= button_to t("txt.views.versioning.to_edit_mode"),
35
- collection_versions_lock_path(:origin => @collection.origin), :class => 'btn btn-outline-secondary' if can?(:lock, @collection) %>
26
+ edit_collection_path(:published => 0, :id => @collection.origin),
27
+ :class => 'btn btn-outline-secondary' %>
36
28
  <% end %>
37
29
 
38
30
  <% if can?(:destroy, @collection) %>
@@ -6,7 +6,6 @@
6
6
  <%= concept_relation.class.model_name.human %>
7
7
  <%= link_to(concept_relation.target.pref_label.to_s,
8
8
  concept_path(:published => 0, :id => concept_relation.target)) %>
9
- <%= t("txt.common.editor") %> <%= user_details(concept_relation.target.locking_user) %>
10
9
  </li>
11
10
  <% end %>
12
11
  </ul>
@@ -1,6 +1,8 @@
1
1
  <%= render 'header', :concept => @concept %>
2
2
  <%= render 'concepts/sidebars/singular', :concept => @concept %>
3
3
 
4
+ <%= error_messages_for @concept %>
5
+
4
6
  <% if @new_concept_version.blank? && can?(:branch, @concept) %>
5
7
  <% if @jobs && @jobs.any? %>
6
8
  <%= render partial: 'partials/concept/reverse_match_notice', locals: {concept: @concept, jobs: @jobs} %>
@@ -1,11 +1,10 @@
1
1
  <%= render 'header', :concept => @concept %>
2
2
  <%= render 'concepts/sidebars/singular', :concept => @concept %>
3
3
 
4
+ <%= error_messages_for @concept %>
5
+
4
6
  <%= alert :info, :header => t('txt.common.unpublished_version') + "." do %>
5
7
  <%= t("txt.views.versioning.current_revision", :rev => @concept.rev) %>
6
- <% if @concept.locked? %>
7
- <%= t("txt.views.versioning.in_ongoing_editing_by", :user => @concept.locking_user.name) %>
8
- <% end %>
9
8
  <% end %>
10
9
 
11
10
  <% if @jobs && @jobs.any? %>
@@ -28,15 +27,10 @@
28
27
  concept_versions_to_review_path(:origin => @concept.origin), :class => 'btn btn-outline-secondary' %>
29
28
  <% end %>
30
29
 
31
- <% if @concept.locked? %>
32
- <%= button_to t("txt.views.versioning.unlock"),
33
- concept_versions_unlock_path(:origin => @concept.origin), :class => 'btn btn-outline-secondary' if can?(:unlock, @concept) %>
30
+ <% if can?(:update, @concept) %>
34
31
  <%= link_to t("txt.views.versioning.edit_mode"),
35
- edit_concept_path(:published => 0, :id => @concept.origin),
36
- :class => 'btn btn-outline-secondary' if can?(:update, @concept) %>
37
- <% elsif can?(:lock, @concept) %>
38
- <%= button_to t("txt.views.versioning.to_edit_mode"),
39
- concept_versions_lock_path(:origin => @concept.origin), :class => 'btn btn-outline-secondary' %>
32
+ edit_concept_path(:published => 0, :id => @concept.origin),
33
+ :class => 'btn btn-outline-secondary' if can?(:update, @concept) %>
40
34
  <% end %>
41
35
 
42
36
  <% if can?(:destroy, @concept) %>
@@ -2,7 +2,6 @@
2
2
  <thead>
3
3
  <tr>
4
4
  <th><%= t("txt.views.dashboard.value") %><%= sorting_controls_for(:value) %></th>
5
- <th><%= t("txt.views.dashboard.locking_user") %><%= sorting_controls_for(:locking_user) %></th>
6
5
  <% unless @items.first.class == Iqvoc::Collection.base_class %>
7
6
  <th><%= t("txt.views.dashboard.follow_up") %><%= sorting_controls_for(:follow_up) %></th>
8
7
  <% end %>
@@ -22,13 +21,6 @@
22
21
  <%= render item.class.edit_link_partial_name, :item => item %>
23
22
  <a href="<%= dashboard_glance_path(type: item.class, origin: item.origin, published: item.published? ? 1 : 0) %>" class="dashboard-glance-link"><i class="fa fa-search-plus"></i></a>
24
23
  </td>
25
- <td>
26
- <% if item.locking_user.present? %>
27
- <span class="badge badge-info" data-toggle="tooltip" data-placement="top" title="<%= item.locking_user.name %>">
28
- <%= item.locking_user.initials %>
29
- </span>
30
- <% end %>
31
- </td>
32
24
  <% unless item.class == Iqvoc::Collection.base_class %>
33
25
  <td class="<%= 'dashboard-activated-follow-up-column' if item.follow_up.present? %>">
34
26
  <%= l(item.follow_up) if item.follow_up.present? %>
@@ -6,7 +6,7 @@
6
6
  <dd class="col-md-10"><%= "#{Iqvoc.host_namespace} #{Iqvoc.host_version}" %></dd>
7
7
  <% end %>
8
8
 
9
- <% if File.exists?(Rails.root.join('headrev.txt')) %>
9
+ <% if File.exist?(Rails.root.join('headrev.txt')) %>
10
10
  <dt class="col-md-2">Revision</dt>
11
11
  <dd class="col-md-10"><%= File.read(Rails.root.join('headrev.txt')) %></dd>
12
12
  <% end %>
@@ -1,5 +1,5 @@
1
- <% label = item.pref_label.to_s.presence || ":#{item.origin} [#{t("txt.common.translation_missing_for")} #{[I18n.locale.to_s, Iqvoc::Concept.pref_labeling_languages.first.to_s].uniq.join(", ")}]" %>
1
+ <% label = item.pref_label.to_s.presence || ":#{item.origin}" %>
2
2
  <%= link_to truncate(label, :length => 45), (item.published? ? concept_path(:id => item.origin) : concept_path(:published => 0, :id => item.origin)) %>
3
- <%- if (item.additional_info) -%>
3
+ <%- if item.additional_info -%>
4
4
  (<%= item.additional_info %>)
5
5
  <%- end -%>
@@ -1,13 +1,16 @@
1
1
  <%- fieldname = "concept[concept_relations_by_id][#{klass.name.to_relation_name}]" -%>
2
- <%= f.form_group nil, :label => { :text => klass.model_name.human(:count => klass.singular? ? 1 : 2) } do %>
2
+ <%= f.form_group nil, label: { text: klass.model_name.human(count: klass.singular? ? 1 : 2) } do %>
3
3
  <%= text_field_tag fieldname, widget_values(concept, klass),
4
- :id => klass.name.to_relation_name,
5
- :class => "entity_select",
6
- :"data-query-url" => concepts_path(:format => :json,
7
- :exclude_top_terms => klass != Iqvoc::Concept.broader_relation_class || nil),
8
- :"data-entity-uri" => concept_path("{id}"),
9
- :"data-singular" => klass.singular? || nil,
10
- :"data-entities" => widget_entities(concept, klass),
11
- :'data-no-results-msg' => t('txt.views.search_results.no_results')
12
- %>
4
+ id: klass.name.to_relation_name,
5
+ class: "entity_select",
6
+ "data-query-url": concepts_path(
7
+ format: :json,
8
+ exclude_top_terms: klass != Iqvoc::Concept.broader_relation_class || nil,
9
+ language: params[:lang]
10
+ ),
11
+ "data-entity-uri": concept_path("{id}"),
12
+ "data-singular": klass.singular? || nil,
13
+ "data-entities": widget_entities(concept, klass),
14
+ 'data-no-results-msg': t('txt.views.search_results.no_results')
15
+ %>
13
16
  <% end %>
@@ -0,0 +1,27 @@
1
+ <div class="row">
2
+ <div class="col-md-6">
3
+ <%= render "search_results/sections/mode" %>
4
+ </div>
5
+ <div class="col-md-6">
6
+ <%= render "search_results/sections/klass" %>
7
+ </div>
8
+ </div>
9
+ <div class="row">
10
+ <div class="col-md-6">
11
+ <%= render "search_results/sections/type" %>
12
+ </div>
13
+ <div class="col-md-6">
14
+ <%= render "search_results/sections/collection" %>
15
+ </div>
16
+ </div>
17
+ <div class="row">
18
+ <%= render "search_results/sections/change_note" %>
19
+ </div>
20
+ <div class="row">
21
+ <div class="col-md-6">
22
+ <%= render "search_results/sections/datasets" %>
23
+ </div>
24
+ <div class="col-md-6">
25
+ <%= render "search_results/sections/options" %>
26
+ </div>
27
+ </div>