Sha256: e23a37b55be633f5b177686752908dbf0a5e8a832d25af7122eec6dfae18dc6f

Contents?: true

Size: 609 Bytes

Versions: 38

Compression:

Stored size: 609 Bytes

Contents

class PagePartial < DynamicView
  
  before_validation :prepend_underscore
  
  validates_format_of :name, :with => /\A_[a-z]+[a-z0-9_]*\Z/, :message => "can only contain lowercase letters, numbers and underscores and must begin with an underscore"  
  
  def file_path
    File.join(self.class.base_path, "partials", file_name)
  end  
  
  def self.display_name(file_name)
    name, format, handler = file_name.split('.')
    "#{name.sub(/^_/,'').titleize} (#{format}/#{handler})"
  end  
  
  def prepend_underscore
    if !name.blank? && name[0,1] != '_'
      self.name = "_#{name}"
    end
  end
  
end

Version data entries

38 entries across 38 versions & 10 rubygems

Version Path
SFEley-browsercms-3.0.2 app/models/page_partial.rb
buzzware-browsercms-3.0.2 app/models/page_partial.rb
coredumplings-browsercms-3.0.0 app/models/page_partial.rb
nate-browsercms-3.0.210 app/models/page_partial.rb
nate-browsercms-3.0.211 app/models/page_partial.rb
we5-browsercms-3.0.1.1 app/models/page_partial.rb
webficient-browsercms-3.0.1 app/models/page_partial.rb
webficient-browsercms-3.0.2 app/models/page_partial.rb
webficient-browsercms-3.0.3 app/models/page_partial.rb
webficient-browsercms-3.0.4 app/models/page_partial.rb
browsercms-3.3.4 app/models/page_partial.rb
browsercms-3.3.3 app/models/page_partial.rb
browsercms-3.1.5 app/models/page_partial.rb
browsercms-3.1.4 app/models/page_partial.rb
browsercms-3.3.2 app/models/page_partial.rb
browsercms-3.3.1 app/models/page_partial.rb
browsercms-3.3.0 app/models/page_partial.rb
browsercms-3.1.3 app/models/page_partial.rb
browsercms-3.3.0.beta app/models/page_partial.rb
bf4-browsercms-3.1.0 app/models/page_partial.rb