Module: Entity::ClassMethods

Defined in:
app/models/entity.rb

Instance Method Summary collapse

Instance Method Details

#entity_absolute_urlObject



65
66
67
# File 'app/models/entity.rb', line 65

def entity_absolute_url
  "http://#{Setting[:domain]}#{entity_relative_url}" if entity_relative_url
end

#entity_description(&block) ⇒ Object



89
90
91
92
93
94
95
# File 'app/models/entity.rb', line 89

def entity_description(&block)
  if block
    @entity_description = block
  else
    @entity_description
  end
end

#entity_edit_url(&block) ⇒ Object



121
122
123
124
125
126
127
# File 'app/models/entity.rb', line 121

def entity_edit_url(&block)
  if block
    @entity_edit_url = block
  else
    @entity_edit_url
  end
end

#entity_global_url(value = nil) ⇒ Object



97
98
99
100
101
102
103
# File 'app/models/entity.rb', line 97

def entity_global_url(value = nil)
  if value
    @entity_global_url = value
  else
    @entity_global_url
  end
end

#entity_label(value = nil) ⇒ Object



77
78
79
80
81
82
83
# File 'app/models/entity.rb', line 77

def entity_label(value = nil)
  if value
    @entity_label = value
  else
    @entity_label || "cartoonist.entity.#{entity_type}"
  end
end

#entity_localized_labelObject



85
86
87
# File 'app/models/entity.rb', line 85

def entity_localized_label
  I18n.t entity_label
end

#entity_preview_url(&block) ⇒ Object



113
114
115
116
117
118
119
# File 'app/models/entity.rb', line 113

def entity_preview_url(&block)
  if block
    @entity_preview_url = block
  else
    @entity_preview_url
  end
end

#entity_relative_urlObject



61
62
63
# File 'app/models/entity.rb', line 61

def entity_relative_url
  entity_global_url
end

#entity_type(value = nil) ⇒ Object



69
70
71
72
73
74
75
# File 'app/models/entity.rb', line 69

def entity_type(value = nil)
  if value
    @entity_type = value
  else
    @entity_type || raise(EntityTypeNotSpecifiedError.new("entity_type was not defined for #{self.name}"))
  end
end

#entity_url(&block) ⇒ Object



105
106
107
108
109
110
111
# File 'app/models/entity.rb', line 105

def entity_url(&block)
  if block
    @entity_url = block
  else
    @entity_url
  end
end