Module: Blogit::ApplicationHelper
- Defined in:
- app/helpers/blogit/application_helper.rb
Instance Method Summary (collapse)
-
- (Object) actions(content_or_options = {}, options = {}, &block)
A helper method for creating a div tag with class 'actions'.
-
- (Object) errors_on(object, attribute)
The first error message for an ActiveRecord::Base model instance attribute.
-
- (Object) field(content_or_options = {}, options = {}, &block)
A helper method for creating a div tag with class 'field'.
-
- (Object) format_content(content = nil, &block)
Format content using the default_parser_class.
Instance Method Details
- (Object) actions(content_or_options = {}, options = {}, &block)
A helper method for creating a div tag with class 'actions'. Used as a wrapper for form actions.
71 72 73 74 75 76 77 78 79 80 |
# File 'app/helpers/blogit/application_helper.rb', line 71 def actions(={}, ={}, &block) if block_given? = content = capture(&block) else content = end [:class] = Array([:class]) + ["actions"] content_tag(:div, content, ) end |
- (Object) errors_on(object, attribute)
The first error message for an ActiveRecord::Base model instance attribute
37 38 39 40 |
# File 'app/helpers/blogit/application_helper.rb', line 37 def errors_on(object, attribute) = object.errors[attribute].first content_tag(:span, , class: "blogit_error_message") if end |
- (Object) field(content_or_options = {}, options = {}, &block)
A helper method for creating a div tag with class 'field'. Used for separating form fields.
51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/blogit/application_helper.rb', line 51 def field( = {}, ={}, &block) if block_given? = content = capture(&block) else content = end [:class] = Array([:class]) + ["field"] content_tag(:div, content, ) end |
- (Object) format_content(content = nil, &block)
Format content using the default_parser_class
20 21 22 23 24 |
# File 'app/helpers/blogit/application_helper.rb', line 20 def format_content(content = nil, &block) content = capture(&block) if block_given? parser = Blogit::configuration.default_parser_class.new(content) parser.parsed.to_s.html_safe end |