Sha256: 04e47d0f102b6d7294a69a69a22d1df3897920d6b065717199deb0a768fa5284

Contents?: true

Size: 969 Bytes

Versions: 25

Compression:

Stored size: 969 Bytes

Contents

module Roroacms  
  module CommentsHelper

    # returns the html for the error display for the comments form
    # Params:
    # +content+:: is the Comment ActiveRecord object with the errors

    def comments_error_display(content = nil)

      html = ''

      if content.errors.any?
        html = "<div id='error-explanation'>
  			<h2>Invalid:</h2><ul>"
        content.errors.full_messages.each do |msg|
          html += "<li>#{msg}</li>"
        end
        html += "</ul>
  			</div>"
      end

      html
    end


    # returns a success message if the comment has been saved successfully

    def comments_success_message
      html = '<div class="success">' + I18n.t("helpers.comments_helper.comments_success_message") + '</div>'.html_safe
    end


    # returns true or false as to wether the admin has comments turned on

    def comments_on
      Setting.get('article_comments') == 'Y' && Setting.get('article_comment_type') == 'R'
    end

  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
roroacms-1.0.0 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6.7 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6.6 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6.5 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6.4 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6.3 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6.2 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6.1 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.6 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.5 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.4 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.3 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.2 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8.1 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.8 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.7.10 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.7.8 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.7.7 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.7.6 app/helpers/roroacms/comments_helper.rb
roroacms-0.0.7.5 app/helpers/roroacms/comments_helper.rb