Class: Label::Relation::Base

Inherits:
ApplicationRecord show all
Defined in:
app/models/label/relation/base.rb

Direct Known Subclasses

SKOSXL::Base

Class Method Summary collapse

Class Method Details

.bidirectional?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'app/models/label/relation/base.rb', line 50

def self.bidirectional?
  false
end

.by_domain(domain) ⇒ Object



11
12
13
# File 'app/models/label/relation/base.rb', line 11

def self.by_domain(domain)
  where(domain_id: domain)
end

.by_range(range) ⇒ Object



15
16
17
# File 'app/models/label/relation/base.rb', line 15

def self.by_range(range)
  where(range_id: range)
end

.by_range_origin(origin) ⇒ Object



19
20
21
# File 'app/models/label/relation/base.rb', line 19

def self.by_range_origin(origin)
  includes(:range).references(:labels).merge(Label::Base.by_origin(origin))
end

.edit_partial_name(obj) ⇒ Object



46
47
48
# File 'app/models/label/relation/base.rb', line 46

def self.edit_partial_name(obj)
  'partials/label/relation/edit_base'
end

.partial_name(obj) ⇒ Object



42
43
44
# File 'app/models/label/relation/base.rb', line 42

def self.partial_name(obj)
  'partials/label/relation/base'
end

.range_editor_selectableObject



23
24
25
26
27
28
# File 'app/models/label/relation/base.rb', line 23

def self.range_editor_selectable
  # includes(:range) & Iqvoc::XLLabel.base_class.editor_selectable
  # Doesn't work correctly (kills label_relations.type condition :-( )
  includes(:range).
  where('labels.published_at IS NOT NULL OR (labels.published_at IS NULL AND labels.published_version_id IS NULL) ')
end

.range_in_edit_modeObject



30
31
32
# File 'app/models/label/relation/base.rb', line 30

def self.range_in_edit_mode
  joins(:range).references(:labels).merge(Iqvoc::XLLabel.base_class.unpublished)
end

.view_section(obj) ⇒ Object



34
35
36
# File 'app/models/label/relation/base.rb', line 34

def self.view_section(obj)
  'relations'
end

.view_section_sort_key(obj) ⇒ Object



38
39
40
# File 'app/models/label/relation/base.rb', line 38

def self.view_section_sort_key(obj)
  100
end