Skip to content

Commit

Permalink
Acronymize APIS
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfb committed Mar 17, 2023
1 parent e028c70 commit 8cdb43d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/apis-mapping.js
Expand Up @@ -14,7 +14,7 @@ var apis_map = {
tpl: "<idno type=\"invNo\">$apis_identifier_inventoryNo</idno>"},
{name: "apisId",
xpath: "/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='apisid']",
children: [["text()","getApisCollection"],["text()","getApisId"]],
children: [["text()","getAPISCollection"],["text()","getAPISId"]],
tpl: "<idno type=\"apisid\">$apis_identifier_apisCollection.apis.$apis_identifier_apisId</idno>",
required: true},
{xpath: "/t:TEI/t:teiHeader/t:fileDesc/t:publicationStmt/t:idno[@type='TM']",
Expand Down Expand Up @@ -104,10 +104,10 @@ var apis_map = {
}
},
functions: {
getApisCollection: function(apisId) {
getAPISCollection: function(apisId) {
return apisId.substring(0,apisId.indexOf("."));
},
getApisId: function(apisId) {
getAPISId: function(apisId) {
return apisId.substring(apisId.lastIndexOf(".") + 1);
},
getDate: function(date) {
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/apis_identifiers_controller.rb
@@ -1,4 +1,4 @@
class ApisIdentifiersController < IdentifiersController
class APISIdentifiersController < IdentifiersController
before_action :authorize
before_action :ownership_guard, only: %i[update updatexml]
require 'pp'
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/apis_identifier_helper.rb
@@ -1,5 +1,5 @@
module ApisIdentifierHelper
module ApisDate
module APISIdentifierHelper
module APISDate
def self.getYear; end
end
end
6 changes: 3 additions & 3 deletions app/models/apis_identifier.rb
Expand Up @@ -23,10 +23,10 @@ def preview(parameters = {}, xsl = nil)
end

after_initialize :post_initialization_configuration
# Loads +ApisConfiguration+ object (APIS xpath for EpiDoc and options for the editor) and presets valid EpiDoc attributes
# Loads +APISConfiguration+ object (APIS xpath for EpiDoc and options for the editor) and presets valid EpiDoc attributes
# Side effect on +@configuration+ and + @valid_epidoc_attributes+
def post_initialization_configuration
@configuration = ApisConfiguration.new # YAML::load_file(File.join(Rails.root, %w{config apis.yml}))[:apis][:metadata]
@configuration = APISConfiguration.new # YAML::load_file(File.join(Rails.root, %w{config apis.yml}))[:apis][:metadata]
@valid_epidoc_attributes = @configuration.keys
end

Expand Down Expand Up @@ -117,7 +117,7 @@ def xml_title_text
'Description of document'
end

class ApisConfiguration
class APISConfiguration
attr_reader :scheme, :keys

def initialize
Expand Down
1 change: 1 addition & 0 deletions config/initializers/inflections.rb
Expand Up @@ -14,4 +14,5 @@
inflect.acronym 'DDB'
inflect.acronym 'HGV'
inflect.acronym 'DCLP'
inflect.acronym 'APIS'
end
2 changes: 2 additions & 0 deletions config/initializers/zeitwerk.rb
Expand Up @@ -6,12 +6,14 @@
"ddb" => "DDB",
"hgv" => "HGV",
"dclp" => "DCLP",
"apis" => "APIS",
"ddb_identifier" => "DDBIdentifier",
"hgv_meta_identifier" => "HGVMetaIdentifier",
"hgv_meta_identifier_helper" => "HGVMetaIdentifierHelper",
"dclp_meta_identifier" => "DCLPMetaIdentifier",
"dclp_meta_identifier_helper" => "DCLPMetaIdentifierHelper",
"dclp_text_identifier" => "DCLPTextIdentifier",
"dclp_text_identifier_helper" => "DCLPTextIdentifierHelper"
"apis_identifier" => "APISIdentifier"
)
end
4 changes: 2 additions & 2 deletions test/integration/apis_workflow_test.rb
@@ -1,7 +1,7 @@
require 'test_helper'
require 'ddiff'

class ApisWorkflowTest < ActionDispatch::IntegrationTest
class APISWorkflowTest < ActionDispatch::IntegrationTest
def generate_board_vote_for_decree(_board, decree, identifier, user)
FactoryBot.create(:vote,
publication_id: identifier.publication.id,
Expand Down Expand Up @@ -77,7 +77,7 @@ def log_diffs(a, b)
end
end

class ApisWorkflowTest < ActionDispatch::IntegrationTest
class APISWorkflowTest < ActionDispatch::IntegrationTest
context 'for idp3' do
context 'apis testing' do
setup do
Expand Down

0 comments on commit 8cdb43d

Please sign in to comment.