Class: Cmsimple::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/cmsimple/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cmsimple/configuration.rb', line 3

def initialize
  # the parent controller for the front controller
  self.parent_front_controller = 'ApplicationController'
  # the parent controller for all CRUD controllers
  self.parent_controller = 'ApplicationController'
  # where the templates are located in the project
  self.template_path = 'cmsimple/templates'
  # set a template strategy (i.e. if you wanted to build a db backed template system)
  self.template_strategy = :basic
  # the path carrierwave will use to store image assets
  self.asset_path = 'uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}'
  # the library to use for processing images in carrierwave (rmagick or mini_magick)
  self.image_processor = :mini_magick
  # stylesheets to be included in the editor layout page
  self.editor_stylesheets = ['cmsimple']
  # javascripts to be included in the editor layout page
  self.editor_javascripts = ['cmsimple']
  # set this to change layouts or pass other params into rendering a template
  self.template_render_options = {}
end

Instance Attribute Details

#asset_pathObject

Returns the value of attribute asset_path.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def asset_path
  @asset_path
end

#editor_javascriptsObject

Returns the value of attribute editor_javascripts.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def editor_javascripts
  @editor_javascripts
end

#editor_stylesheetsObject

Returns the value of attribute editor_stylesheets.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def editor_stylesheets
  @editor_stylesheets
end

#image_processorObject

Returns the value of attribute image_processor.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def image_processor
  @image_processor
end

#parent_controllerObject

Returns the value of attribute parent_controller.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def parent_controller
  @parent_controller
end

#parent_front_controllerObject

Returns the value of attribute parent_front_controller.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def parent_front_controller
  @parent_front_controller
end

#template_pathObject

Returns the value of attribute template_path.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def template_path
  @template_path
end

#template_render_optionsObject

Returns the value of attribute template_render_options.



24
25
26
# File 'lib/cmsimple/configuration.rb', line 24

def template_render_options
  @template_render_options
end

#template_strategyObject



35
36
37
38
39
40
41
42
# File 'lib/cmsimple/configuration.rb', line 35

def template_strategy
  case @template_strategy
  when :basic
    Cmsimple::TemplateResponder
  else
    @template_strategy.constantize
  end
end

Instance Method Details

#image_processor_mixinObject



44
45
46
47
48
49
50
51
# File 'lib/cmsimple/configuration.rb', line 44

def image_processor_mixin
  case @image_processor
  when :rmagick
    CarrierWave::RMagick
  else
    CarrierWave::MiniMagick
  end
end