Skip to content

Commit f25f25d

Browse files
committed
drop custom inflections and stick to rails zeitwerk defaults
1 parent 43674ba commit f25f25d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+188
-195
lines changed

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/innoq/iqvoc.git
3-
revision: 269477c116ead593fe4105e003177b4991ea5919
3+
revision: 14c077c70f0054cbb74a5f0c38dc74a9d4f8e38b
44
branch: rails-7
55
specs:
66
iqvoc (4.14.5)

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
![CI](https://github.com/innoq/iqvoc_skosxl/workflows/CI/badge.svg?branch=main)
22

3-
# Iqvoc::SKOSXL
3+
# Iqvoc::Skosxl
44

55
This is the iQvoc SKOS-XL extension. Use this in your Gemfile to add SKOS-XL features to iQvoc.
66

7-
Iqvoc::SKOSXL may run in two different modes: Standalone as Application and embedded into another Application as Engine.
7+
Iqvoc::Skosxl may run in two different modes: Standalone as Application and embedded into another Application as Engine.
88

99
## Standalone Application
1010

11-
Operate Iqvoc::SKOSXL like a common iQvoc-based Application.
11+
Operate Iqvoc::Skosxl like a common iQvoc-based Application.
1212

1313
1. Run database migrations:
1414
`rake iqvoc:db:migrate_all`
@@ -19,7 +19,7 @@ Operate Iqvoc::SKOSXL like a common iQvoc-based Application.
1919

2020
## Engine
2121

22-
Operate Iqvoc::SKOSXL and Iqvoc as Engines running in a custom App.
22+
Operate Iqvoc::Skosxl and Iqvoc as Engines running in a custom App.
2323

2424
1. Add iqvoc_skosxl to your Gemfile (beneath iqvoc)
2525
2. Run Iqvoc migrations:

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require File.expand_path('../config/application', __FILE__)
55
require 'rake'
66

7-
Iqvoc::SKOSXL::Application.load_tasks
7+
Iqvoc::Skosxl::Application.load_tasks
88

99
require 'bundler'
1010
Bundler::GemHelper.install_tasks

app/controllers/labels/versions_controller.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Labels::VersionsController < ApplicationController
22
def merge
3-
current_label = Iqvoc::XLLabel.base_class.by_origin(params[:origin]).published.last
4-
new_version = Iqvoc::XLLabel.base_class.by_origin(params[:origin]).unpublished.last!
3+
current_label = Iqvoc::Xllabel.base_class.by_origin(params[:origin]).published.last
4+
new_version = Iqvoc::Xllabel.base_class.by_origin(params[:origin]).unpublished.last!
55

66
authorize! :merge, new_version
77

@@ -39,9 +39,9 @@ def merge
3939
end
4040

4141
def branch
42-
current_label = Iqvoc::XLLabel.base_class.by_origin(params[:origin]).published.last!
42+
current_label = Iqvoc::Xllabel.base_class.by_origin(params[:origin]).published.last!
4343

44-
if draft_label = Iqvoc::XLLabel.base_class.by_origin(params[:origin]).unpublished.last
44+
if draft_label = Iqvoc::Xllabel.base_class.by_origin(params[:origin]).unpublished.last
4545
flash[:info] = t('txt.controllers.versioning.branch_error')
4646
redirect_to label_path(published: 0, id: draft_label)
4747
else
@@ -66,7 +66,7 @@ def branch
6666
end
6767

6868
def consistency_check
69-
label = Iqvoc::XLLabel.base_class.by_origin(params[:origin]).unpublished.last!
69+
label = Iqvoc::Xllabel.base_class.by_origin(params[:origin]).unpublished.last!
7070

7171
authorize! :check_consistency, label
7272

@@ -80,7 +80,7 @@ def consistency_check
8080
end
8181

8282
def to_review
83-
label = Iqvoc::XLLabel.base_class.by_origin(params[:origin]).unpublished.last!
83+
label = Iqvoc::Xllabel.base_class.by_origin(params[:origin]).unpublished.last!
8484

8585
authorize! :send_to_review, label
8686

app/controllers/labels_controller.rb

+20-20
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ class LabelsController < ApplicationController
22
before_action proc { |ctrl| (ctrl.action_has_layout = false) if ctrl.request.xhr? }
33

44
def index
5-
authorize! :read, Iqvoc::XLLabel.base_class
5+
authorize! :read, Iqvoc::Xllabel.base_class
66

77
search_string = search_string(params[:query], params[:mode])
8-
scope = Iqvoc::XLLabel.base_class
8+
scope = Iqvoc::Xllabel.base_class
99
.editor_selectable
1010
.by_query_value(search_string)
1111

1212
if params[:language] # NB: this is not the same as :lang, which is supplied via route
1313
scope = scope.by_language(params[:language])
1414
end
15-
@labels = scope.order(Arel.sql("LENGTH(#{Iqvoc::XLLabel.base_class.table_name}.value)")).all
15+
@labels = scope.order(Arel.sql("LENGTH(#{Iqvoc::Xllabel.base_class.table_name}.value)")).all
1616

1717
respond_to do |format|
1818
format.html do
@@ -36,12 +36,12 @@ def index
3636
end
3737

3838
def show
39-
scope = Iqvoc::XLLabel.base_class.by_origin(params[:id]).with_associations
39+
scope = Iqvoc::Xllabel.base_class.by_origin(params[:id]).with_associations
4040

4141
@published = params[:published] == '1' || !params[:published]
4242
if @published
4343
scope = scope.published
44-
@new_label_version = Iqvoc::XLLabel.base_class.by_origin(params[:id]).unpublished.last
44+
@new_label_version = Iqvoc::Xllabel.base_class.by_origin(params[:id]).unpublished.last
4545
else
4646
scope = scope.unpublished
4747
end
@@ -59,16 +59,16 @@ def show
5959
end
6060

6161
def new
62-
authorize! :create, Iqvoc::XLLabel.base_class
63-
@label = Iqvoc::XLLabel.base_class.new
62+
authorize! :create, Iqvoc::Xllabel.base_class
63+
@label = Iqvoc::Xllabel.base_class.new
6464
@label.build_initial_change_note(current_user)
6565
@label.build_notes
6666
end
6767

6868
def create
69-
authorize! :create, Iqvoc::XLLabel.base_class
69+
authorize! :create, Iqvoc::Xllabel.base_class
7070

71-
@label = Iqvoc::XLLabel.base_class.new(label_params)
71+
@label = Iqvoc::Xllabel.base_class.new(label_params)
7272

7373
if @label.valid?
7474
if @label.save
@@ -85,7 +85,7 @@ def create
8585
end
8686

8787
def edit
88-
@label = Iqvoc::XLLabel.base_class.by_origin(params[:id]).unpublished.last!
88+
@label = Iqvoc::Xllabel.base_class.by_origin(params[:id]).unpublished.last!
8989
authorize! :update, @label
9090

9191
if params[:check_associations_in_editing_mode]
@@ -103,7 +103,7 @@ def edit
103103
end
104104

105105
def update
106-
@label = Iqvoc::XLLabel.base_class.by_origin(params[:id]).unpublished.last!
106+
@label = Iqvoc::Xllabel.base_class.by_origin(params[:id]).unpublished.last!
107107
authorize! :update, @label
108108

109109
# set to_review to false if someone edits a label
@@ -123,11 +123,11 @@ def update
123123
end
124124

125125
def destroy
126-
@new_label = Iqvoc::XLLabel.base_class.by_origin(params[:id]).unpublished.last!
126+
@new_label = Iqvoc::Xllabel.base_class.by_origin(params[:id]).unpublished.last!
127127
authorize! :destroy, @new_label
128128

129129
if @new_label.destroy
130-
published_label = Iqvoc::XLLabel.base_class.published.by_origin(@new_label.origin).first
130+
published_label = Iqvoc::Xllabel.base_class.published.by_origin(@new_label.origin).first
131131
flash[:success] = I18n.t('txt.controllers.label_versions.delete')
132132
redirect_to published_label.present? ? label_path(id: published_label.origin) : dashboard_path
133133
else
@@ -137,9 +137,9 @@ def destroy
137137
end
138138

139139
def duplicate
140-
authorize! :create, Iqvoc::XLLabel.base_class
141-
label = Iqvoc::XLLabel.base_class.by_origin(params[:origin]).published.first
142-
if Iqvoc::XLLabel.base_class.by_origin(params[:origin]).unpublished.last
140+
authorize! :create, Iqvoc::Xllabel.base_class
141+
label = Iqvoc::Xllabel.base_class.by_origin(params[:origin]).published.first
142+
if Iqvoc::Xllabel.base_class.by_origin(params[:origin]).unpublished.last
143143
flash[:error] = t('txt.controllers.label.duplicate_error')
144144
redirect_to label_path(published: 1, id: label)
145145
end
@@ -149,8 +149,8 @@ def duplicate
149149
end
150150

151151
def new_from_concept
152-
authorize! :create, Iqvoc::XLLabel.base_class
153-
@label = Iqvoc::XLLabel.base_class.new
152+
authorize! :create, Iqvoc::Xllabel.base_class
153+
@label = Iqvoc::Xllabel.base_class.new
154154

155155
respond_to do |format|
156156
format.html do
@@ -160,9 +160,9 @@ def new_from_concept
160160
end
161161

162162
def create_from_concept
163-
authorize! :create, Iqvoc::XLLabel.base_class
163+
authorize! :create, Iqvoc::Xllabel.base_class
164164

165-
@label = Iqvoc::XLLabel.base_class.new(label_params)
165+
@label = Iqvoc::Xllabel.base_class.new(label_params)
166166
@label.build_initial_change_note(current_user)
167167

168168
if @label.save

app/controllers/rdf_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# TODO: move out of /controllers
44
module RdfControllerLabelExtension
55
def show
6-
scope = params[:published] == '0' ? Iqvoc::XLLabel.base_class.unpublished : Iqvoc::XLLabel.base_class.published
6+
scope = params[:published] == '0' ? Iqvoc::Xllabel.base_class.unpublished : Iqvoc::Xllabel.base_class.published
77
if @label = scope.by_origin(params[:id]).with_associations.last
88
respond_to do |format|
99
format.html {
@@ -20,4 +20,4 @@ def show
2020
end
2121
end
2222

23-
RdfController.prepend(RdfControllerLabelExtension)
23+
RdfController.prepend(RdfControllerLabelExtension)

app/controllers/xl_dashboard_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class XlDashboardController < DashboardController
1919
def label_index
2020
authorize! :use, :dashboard
2121

22-
labels = Iqvoc::XLLabel.base_class.for_dashboard.load
22+
labels = Iqvoc::Xllabel.base_class.for_dashboard.load
2323

2424
if params[:sort] && params[:sort].include?('state ')
2525
sort = params[:sort].split(',').select { |s| s.include? 'state ' }.last.gsub('state ', '')
@@ -37,7 +37,7 @@ def label_index
3737

3838
@items = Kaminari.paginate_array(labels).page(params[:page])
3939

40-
render 'dashboard/index', locals: { active_class: Iqvoc::XLLabel.base_class }
40+
render 'dashboard/index', locals: { active_class: Iqvoc::Xllabel.base_class }
4141
end
4242

4343
end

app/helpers/iqvoc_skosxl_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module IqvocSkosxlHelper
22
def render_label(label)
33
if label.new_record?
44
'-'
5-
elsif label.is_a?(Label::SKOSXL::Base)
5+
elsif label.is_a?(Label::Skosxl::Base)
66
link_to(label.to_s, label_path(id: label))
77
else
88
label.to_s

app/helpers/labels_helper.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def render_label_rdf(document, label)
1818
end
1919
end
2020

21-
Iqvoc::XLLabel.additional_association_class_names.keys.each do |class_name|
21+
Iqvoc::Xllabel.additional_association_class_names.keys.each do |class_name|
2222
label.send(class_name.to_relation_name).each do |additional_object|
2323
additional_object.build_rdf(document, c)
2424
end
@@ -43,15 +43,15 @@ def label_view_data(label)
4343
render_label_association(res, label, labeling_class)
4444
end
4545

46-
Iqvoc::XLLabel.relation_classes.each do |relation_class|
46+
Iqvoc::Xllabel.relation_classes.each do |relation_class|
4747
render_label_association(res, label, relation_class)
4848
end
4949

50-
Iqvoc::XLLabel.note_classes.each do |note_class|
50+
Iqvoc::Xllabel.note_classes.each do |note_class|
5151
render_label_association(res, label, note_class)
5252
end
5353

54-
Iqvoc::XLLabel.additional_association_classes.keys.each do |assoc_class|
54+
Iqvoc::Xllabel.additional_association_classes.keys.each do |assoc_class|
5555
render_label_association(res, label, assoc_class)
5656
end
5757

app/models/collection/skosxl/extension.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Collection
2-
module SKOSXL
2+
module Skosxl
33
module Extension
44
extend ActiveSupport::Concern
55

app/models/concept/skosxl/extension.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Concept
2-
module SKOSXL
2+
module Skosxl
33
module Extension
44
extend ActiveSupport::Concern
55

@@ -22,7 +22,7 @@ module Extension
2222
split(InlineDataHelper::SPLITTER).map(&:squish)
2323

2424
# Iterate over all labels to be added and create them
25-
Iqvoc::XLLabel.base_class.by_origin(new_origins).each do |l|
25+
Iqvoc::Xllabel.base_class.by_origin(new_origins).each do |l|
2626
concept.send(labeling_relation_name).create!(target: l)
2727
end
2828
end
@@ -46,7 +46,7 @@ def valid_label_language
4646
(@labelings_by_id || {}).each { |labeling_class_name, origin_mappings|
4747
origin_mappings.each { |language, new_origins|
4848
new_origins = new_origins.split(InlineDataHelper::SPLITTER)
49-
Iqvoc::XLLabel.base_class.by_origin(new_origins).published.each do |label|
49+
Iqvoc::Xllabel.base_class.by_origin(new_origins).published.each do |label|
5050
if label.language != language.to_s
5151
errors.add(:base,
5252
I18n.t('txt.controllers.versioned_concept.label_error') % label)

app/models/label/relation/base.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ def self.by_range_origin(origin)
2121
end
2222

2323
def self.range_editor_selectable
24-
# includes(:range) & Iqvoc::XLLabel.base_class.editor_selectable
24+
# includes(:range) & Iqvoc::Xllabel.base_class.editor_selectable
2525
# Doesn't work correctly (kills label_relations.type condition :-( )
2626
includes(:range).
2727
where('labels.published_at IS NOT NULL OR (labels.published_at IS NULL AND labels.published_version_id IS NULL) ')
2828
end
2929

3030
def self.range_in_edit_mode
31-
joins(:range).references(:labels).merge(Iqvoc::XLLabel.base_class.unpublished)
31+
joins(:range).references(:labels).merge(Iqvoc::Xllabel.base_class.unpublished)
3232
end
3333

3434
def self.view_section(obj)

app/models/label/relation/skosxl/base.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
class Label::Relation::SKOSXL::Base < Label::Relation::Base
1+
class Label::Relation::Skosxl::Base < Label::Relation::Base
22
self.rdf_namespace = 'skosxl'
33

44
def self.build_from_rdf(subject, predicate, object)
55
create(domain: subject, range: object)
66
end
77

88
def build_rdf(document, subject)
9-
pred = self.class == Label::Relation::SKOSXL::Base ? :labelRelation : self.rdf_predicate
10-
raise "Match::SKOS::Base#build_rdf: Class #{self.class.name} needs to define self.rdf_namespace and self.rdf_predicate." unless pred
9+
pred = self.class == Label::Relation::Skosxl::Base ? :labelRelation : self.rdf_predicate
10+
raise "Match::Skos::Base#build_rdf: Class #{self.class.name} needs to define self.rdf_namespace and self.rdf_predicate." unless pred
1111

1212
subject.send(self.rdf_namespace.camelcase).send(pred, IqRdf.build_uri(range.origin))
1313
end

0 commit comments

Comments
 (0)