register_modules/app/models/registered_module.rb

38 lines
1019 B
Ruby
Raw Normal View History

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
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
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