Sha256: db425893c5ec04a0f79aca5e569fe7639e2ac8895be3951cb2f86aa7f2047a77

Contents?: true

Size: 1.11 KB

Versions: 32

Compression:

Stored size: 1.11 KB

Contents

module Cms
  module Behaviors
    module Hiding
      def self.included(model_class)
        model_class.extend(MacroMethods)
      end
      module MacroMethods
        def hideable?
          !!@is_hideable
        end
        def is_hideable(options={})
          @is_hideable = true
          extend ClassMethods
          include InstanceMethods
        
          named_scope :hidden, :conditions => {:hidden => true}
          named_scope :not_hidden, :conditions => {:hidden => false}        
        end
      end
      module ClassMethods
      end
      module InstanceMethods
        def hide
          self.hidden = true
          self.version_comment = "Hidden"         
          self.save
        end
        def hide!
          self.hidden = true
          self.version_comment = "Hidden"
          self.save!
        end
        def unhide
          self.hidden = false
          self.version_comment = "Unhidden"          
          self.save
        end
        def unhide!
          self.hidden = false
          self.version_comment = "Unhidden"          
          self.save!
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 10 rubygems

Version Path
SFEley-browsercms-3.0.2 lib/cms/behaviors/hiding.rb
buzzware-browsercms-3.0.2 lib/cms/behaviors/hiding.rb
coredumplings-browsercms-3.0.0 lib/cms/behaviors/hiding.rb
nate-browsercms-3.0.210 lib/cms/behaviors/hiding.rb
nate-browsercms-3.0.211 lib/cms/behaviors/hiding.rb
we5-browsercms-3.0.1.1 lib/cms/behaviors/hiding.rb
webficient-browsercms-3.0.1 lib/cms/behaviors/hiding.rb
webficient-browsercms-3.0.2 lib/cms/behaviors/hiding.rb
webficient-browsercms-3.0.3 lib/cms/behaviors/hiding.rb
webficient-browsercms-3.0.4 lib/cms/behaviors/hiding.rb
browsercms-3.1.5 lib/cms/behaviors/hiding.rb
browsercms-3.1.4 lib/cms/behaviors/hiding.rb
browsercms-3.1.3 lib/cms/behaviors/hiding.rb
bf4-browsercms-3.1.0 lib/cms/behaviors/hiding.rb
drujensen-browsercms-3.2.0 lib/cms/behaviors/hiding.rb
browsercms-3.1.2 lib/cms/behaviors/hiding.rb
browsercms-3.1.1 lib/cms/behaviors/hiding.rb
browsercms-3.1.0 lib/cms/behaviors/hiding.rb
we5-browsercms-3.1.0 lib/cms/behaviors/hiding.rb
browsercms-3.0.6 lib/cms/behaviors/hiding.rb