Class: Effective::StyleGuideController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/effective/style_guide_controller.rb

Instance Method Summary collapse

Instance Method Details

#bootstrap3Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/effective/style_guide_controller.rb', line 25

def bootstrap3
  @partials = view_paths.map { |path| Dir["#{path}/effective/style_guide_bootstrap3/_**"] }.flatten.map do |path|
    name = File.basename(path)
    name[1...name.index('.') || name.length] # remove the _ and .html.haml
  end.uniq.sort

  @partials = @partials.reject { |p| p.start_with?('_') } # Remove any double __ partials

  @page_title ||= 'Style Guide'

  EffectiveStyleGuide.authorize!(self, :show, Effective::StyleGuide.new())

  render 'effective/style_guide_bootstrap3/show'
end

#showObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/effective/style_guide_controller.rb', line 5

def show
  @partials = if defined?(EffectiveFormInputs)
    view_paths.map { |path| Dir["#{path}/effective/style_guide_bootstrap3/_**"] }.flatten.map do |path|
      name = File.basename(path)
      name[1...name.index('.') || name.length] # remove the _ and .html.haml
    end.uniq.sort
  else
    view_paths.map { |path| Dir["#{path}/effective/style_guide/_**"] }.flatten.map do |path|
      name = File.basename(path)
      name[1...name.index('.') || name.length] # remove the _ and .html.haml
    end.uniq.sort
  end.reject { |p| p.start_with?('_') } # Remove any double __ partials

  @page_title ||= 'Style Guide'

  EffectiveStyleGuide.authorize!(self, :show, Effective::StyleGuide.new())

  render "effective/style_guide#{'_bootstrap3' if defined?(EffectiveFormInputs)}/show"
end