Class: Lurker::RenderingController

Inherits:
AbstractController::Base
  • Object
show all
Includes:
AbstractController::AssetPaths, AbstractController::Helpers, AbstractController::Layouts, AbstractController::Logger, AbstractController::Rendering, ActionView::Context, ActionView::Layouts, ActionView::Rendering
Defined in:
lib/lurker/rendering_controller.rb

Direct Known Subclasses

FormBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#endpoint_presenter=(value) ⇒ Object (writeonly)

Sets the attribute endpoint_presenter

Parameters:

  • value

    the value to set the attribute endpoint_presenter to.



19
20
21
# File 'lib/lurker/rendering_controller.rb', line 19

def endpoint_presenter=(value)
  @endpoint_presenter = value
end

#service_presenter=(value) ⇒ Object (writeonly)

Sets the attribute service_presenter

Parameters:

  • value

    the value to set the attribute service_presenter to.



19
20
21
# File 'lib/lurker/rendering_controller.rb', line 19

def service_presenter=(value)
  @service_presenter = value
end

Instance Method Details

#cookiesObject

so that your cookies calls still work



63
64
65
# File 'lib/lurker/rendering_controller.rb', line 63

def cookies
  {}
end

#flashObject

so that your flash calls still work



48
49
50
# File 'lib/lurker/rendering_controller.rb', line 48

def flash
  {}
end

#paramsObject

and params will be accessible



58
59
60
# File 'lib/lurker/rendering_controller.rb', line 58

def params
  {}
end

#protect_against_forgery?Boolean

we are not in a browser, no need for this

Returns:

  • (Boolean)


43
44
45
# File 'lib/lurker/rendering_controller.rb', line 43

def protect_against_forgery?
  false
end

#requestObject

and nil request to differentiate between live and offline



53
54
55
# File 'lib/lurker/rendering_controller.rb', line 53

def request
  OpenStruct.new
end

#tag_with_anchor(tag, content, anchor_slug = nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
# File 'lib/lurker/rendering_controller.rb', line 31

def tag_with_anchor(tag, content, anchor_slug = nil)
  anchor_slug ||= content.downcase.gsub(' ', '_')
  <<-EOS
  <#{tag} id="#{anchor_slug}">
    <a href="##{anchor_slug}" class="anchor">
      #{content}
    </a>
  </#{tag}>
  EOS
end

#titleObject



27
28
29
# File 'lib/lurker/rendering_controller.rb', line 27

def title
  [@service_presenter.try(:title), @endpoint_presenter.try(:title)].compact.join ' | '
end