2014-12-30 11:52:45 +00:00
|
|
|
class RegisteredModule
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include OrbitCategory::Categorizable
|
|
|
|
include OrbitTag::Taggable
|
|
|
|
include Slug
|
|
|
|
|
|
|
|
field :module_key
|
|
|
|
field :git_path
|
2018-02-05 09:47:52 +00:00
|
|
|
field :icon_class
|
2014-12-30 11:52:45 +00:00
|
|
|
field :name, as: :slug_title, localize: true
|
2018-01-30 18:43:31 +00:00
|
|
|
field :description, localize: true
|
2014-12-30 11:52:45 +00:00
|
|
|
field :create_user_id, type: BSON::ObjectId
|
|
|
|
field :update_user_id, type: BSON::ObjectId
|
|
|
|
field :approved, type: Boolean, :default => false
|
|
|
|
field :completed, type: Boolean, :default => false
|
|
|
|
field :module_type, type: BSON::ObjectId
|
|
|
|
field :step_number, type: Integer
|
2018-02-05 09:47:52 +00:00
|
|
|
field :display_in_frontend, type: Boolean, :default => false
|
|
|
|
|
|
|
|
scope :can_display, ->{where(:display_in_frontend => true)}
|
2014-12-30 11:52:45 +00:00
|
|
|
|
|
|
|
mount_uploader :template, TemplateUploader
|
|
|
|
|
2018-01-30 18:43:31 +00:00
|
|
|
has_many :module_show_files, :dependent => :destroy
|
2014-12-30 11:52:45 +00:00
|
|
|
|
|
|
|
def reject
|
|
|
|
self.completed = false
|
|
|
|
self.step_number = 3
|
|
|
|
self.approved = false
|
|
|
|
self.save
|
|
|
|
end
|
|
|
|
|
2018-02-05 09:47:52 +00:00
|
|
|
def get_colour_class
|
|
|
|
self.category.title == "Default" ? "default" : "optional"
|
|
|
|
end
|
|
|
|
|
2014-12-30 11:52:45 +00:00
|
|
|
end
|