class RegisteredModule include Mongoid::Document include Mongoid::Timestamps include OrbitCategory::Categorizable include OrbitTag::Taggable include Slug field :module_key field :git_path field :icon_class field :name, as: :slug_title, localize: true field :description, localize: true 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 field :display_in_frontend, type: Boolean, :default => false scope :can_display, ->{where(:display_in_frontend => true)} mount_uploader :template, TemplateUploader has_many :module_show_files, :dependent => :destroy def reject self.completed = false self.step_number = 3 self.approved = false self.save end def get_colour_class self.category.title == "Default" ? "default" : "optional" end end