Sha256: b86ca151ed6f1740f4cfe4d24d903b84d9c688b0bd8574ff53d36c5db18c29fa

Contents?: true

Size: 1.48 KB

Versions: 11

Compression:

Stored size: 1.48 KB

Contents

module Spotlight
  ##
  # Sir-trevor helpers methods
  module PagesHelper
    ##
    # Override the default #sir_trevor_markdown so we can use
    # a more complete markdown rendered
    def sir_trevor_markdown(text)
      GitHub::Markup.render('.md', text.gsub('<br>', "\n").gsub('<p>', '').gsub('</p>', "\n\n")).html_safe
    end

    def available_index_fields
      fields = blacklight_config.index_fields.map { |k, _v| { key: k, label: index_field_label(nil, k) } }
      fields.unshift(key: document_show_link_field, label: t(:'spotlight.pages.form.title_placeholder')) unless index_fields.include? document_show_link_field

      fields
    end

    def disable_save_pages_button?
      page_collection_name == 'about_pages' && @pages.empty?
    end

    def get_search_widget_search_results(block)
      if block.searches?
        search_results(block.query_params.with_indifferent_access.merge(params))
      else
        []
      end
    end

    def nestable_data_attributes(type)
      nestable_data_attributes_hash(type).map do |attr, val|
        "#{attr}='#{val}'"
      end.join(' ')
    end

    def nestable_data_attributes_hash(type)
      case type
      when 'feature_pages'
        { 'data-max-depth' => '2',
          'data-expand-btn-HTML' => '',
          'data-collapse-btn-HTML' => '' }
      when 'about_pages'
        { 'data-max-depth' => '1' }
      else
        {}
      end
    end

    def render_contact_email_address(address)
      mail_to address, address
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blacklight-spotlight-0.23.0 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.22.0 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.21.0 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.20.3 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.20.2 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.20.1 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.20.0 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.19.2 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.19.1 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.19.0 app/helpers/spotlight/pages_helper.rb
blacklight-spotlight-0.18.0 app/helpers/spotlight/pages_helper.rb