Sha256: 81d8072f23eff442eace139622f0cefa751edc4c39c59962e0728c4826d90b53

Contents?: true

Size: 1.73 KB

Versions: 2

Compression:

Stored size: 1.73 KB

Contents

module Iqvoc

  module XLLabel # These are the settings when using SKOS-XL

    Iqvoc.first_level_class_configuration_modules << self

    mattr_accessor :base_class_name,
      :note_class_names,
      :relation_class_names,
      :additional_association_class_names,
      :view_sections,
      :has_additional_base_data,
      :searchable_class_names

    self.base_class_name = 'Label::SKOSXL::Base'

    self.relation_class_names = []

    self.note_class_names = Iqvoc::Concept.note_class_names

    self.additional_association_class_names = {}

    self.view_sections = ["main", "concepts", "relations", "notes"]

    # Set this to true if you're having a migration which extends the labels table
    # and you want to be able to edit these fields.
    # This is done by:
    #    render :partial => 'partials/label/additional_base_data'
    # You'll have to define this partial
    # FIXME: This wouldn't be necessary if there would be an empty partial in
    # iqvoc and the view loading sequence would be correct.
    self.has_additional_base_data = false

    # Do not use the following method in models. This will propably cause a
    # loading loop (something like "expected file xyz to load ...")
    def self.base_class
      base_class_name.constantize
    end

    def self.relation_classes
      relation_class_names.map(&:constantize)
    end

    def self.note_classes
      note_class_names.map(&:constantize)
    end

    def self.change_note_class
      change_note_class_name.constantize
    end

    def self.additional_association_classes
      additional_association_class_names.keys.each_with_object({}) do |class_name, hash|
        hash[class_name.constantize] = additional_association_class_names[class_name]
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iqvoc_skosxl-2.3.1 lib/iqvoc/xllabel.rb
iqvoc_skosxl-2.3.0 lib/iqvoc/xllabel.rb