Class: Orange::Carton

Inherits:
Object
  • Object
show all
Defined in:
lib/orange-sparkles/sparkles_app_resource.rb

Class Method Summary collapse

Class Method Details

.as_sparkle_resourceObject



21
22
23
# File 'lib/orange-sparkles/sparkles_app_resource.rb', line 21

def self.as_sparkle_resource
  as_sparkles_resource
end

.as_sparkles_resourceObject

Declares a SparklesResource subclass that scaffolds this carton The Subclass will have the name of the carton followed by “Resource”



12
13
14
15
16
17
18
19
20
# File 'lib/orange-sparkles/sparkles_app_resource.rb', line 12

def self.as_sparkles_resource
  name = self.to_s
  eval <<-HEREDOC
  class ::#{name}Resource < Orange::SparklesResource
    use #{name}
    call_me :#{name.downcase}
  end
  HEREDOC
end

.markdown(name, opts = {}) ⇒ Object

Define a helper for input type=“text” type database stuff Show in a context if wrapped in one of the helpers



6
7
8
# File 'lib/orange-sparkles/sparkles_app_resource.rb', line 6

def self.markdown(name, opts = {})
  add_scaffold(name, :markdown, DataMapper::Property::Text, opts.with_defaults(:lazy => true))
end