Sha256: 0b652f66dc7bb937027da21868cf0dd920ba2bea8537292c4478693aa7e7b8fd

Contents?: true

Size: 715 Bytes

Versions: 9

Compression:

Stored size: 715 Bytes

Contents

class Sidebar < ActiveRecord::Base
#  acts_as_list
  serialize :config

  def self.find_all_visible
    find :all, :conditions => 'active_position is not null', :order => 'active_position'
  end

  def self.find_all_staged
    find :all, :conditions => 'staged_position is not null', :order => 'staged_position'
  end

  def self.purge
    delete_all('active_position is null and staged_position is null')
  end

  def publish
    self.active_position=self.staged_position
  end

  def sidebar_controller
    @sidebar_controller ||= SidebarController.available_sidebars.find { |s| s.short_name == self.controller }
  end

  def config
    self[:config]||{}
  end

  def html_id
    controller+'-'+id.to_s
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
typo-3.99.0 app/models/sidebar.rb
typo-3.99.1 app/models/sidebar.rb
typo-3.99.2 app/models/sidebar.rb
typo-3.99.3 app/models/sidebar.rb
typo-4.0.1 app/models/sidebar.rb
typo-4.0.2 app/models/sidebar.rb
typo-3.99.4 app/models/sidebar.rb
typo-4.0.0 app/models/sidebar.rb
typo-4.0.3 app/models/sidebar.rb