Class: RailsFancies::FancyFaqHelper::FancyFaq
- Inherits:
-
Struct
- Object
- Struct
- RailsFancies::FancyFaqHelper::FancyFaq
- Defined in:
- lib/rails_fancies/fancy_faq_helper.rb
Instance Attribute Summary collapse
-
#question_list ⇒ Object
Returns the value of attribute question_list.
-
#view ⇒ Object
Returns the value of attribute view.
Instance Method Summary collapse
Instance Attribute Details
#question_list ⇒ Object
Returns the value of attribute question_list
8 9 10 |
# File 'lib/rails_fancies/fancy_faq_helper.rb', line 8 def question_list @question_list end |
#view ⇒ Object
Returns the value of attribute view
8 9 10 |
# File 'lib/rails_fancies/fancy_faq_helper.rb', line 8 def view @view end |
Instance Method Details
#answer(name, text) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rails_fancies/fancy_faq_helper.rb', line 19 def answer(name, text) if question_list[name.to_sym].present? content_tag :div, class: 'faq_answer' do content_tag(:a, '', name: "#{name}") + content_tag(:div, question_list[name.to_sym], class: 'faq_answer_heading') + content_tag(:p, "#{text}", class: 'faq_answers') end else raise "No question was found with a name of :#{name}" end end |
#question(name, text) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/rails_fancies/fancy_faq_helper.rb', line 10 def question(name, text) add_to_list question_list, name, text content_tag :div, class: 'faq_question' do content_tag :a, href: "##{name}" do "#{text}" end end end |