Sha256: f33f4fa4c25290e1491047f0210cd5c25873d783917d63e4dcfab88ce5a2424d

Contents?: true

Size: 1.87 KB

Versions: 10

Compression:

Stored size: 1.87 KB

Contents

module CamaleonCms
  module Admin
    module ApplicationHelper
      # include CamaleonCms::Admin::ApiHelper
      include CamaleonCms::Admin::MenusHelper
      include CamaleonCms::Admin::PostTypeHelper
      include CamaleonCms::Admin::CategoryHelper
      include CamaleonCms::Admin::CustomFieldsHelper

      # render pagination for current items
      # items is a will pagination object
      # sample: <%= raw cama_do_pagination(@posts) %>
      def cama_do_pagination(items, *will_paginate_options)
        will_paginate_options = will_paginate_options.extract_options!
        custom_class = will_paginate_options[:panel_class]
        will_paginate_options.delete(:panel_class)
        "<div class='row #{custom_class} pagination_panel cama_ajax_request'>
        <div class='col-md-10'>
          #{begin
            will_paginate(items, will_paginate_options)
          rescue StandardError
            ''
          end}
        </div>
        <div class='col-md-2 text-right total-items'>
          <strong>#{I18n.t('camaleon_cms.admin.table.total', default: 'Total')}: #{begin
            items.total_entries
          rescue StandardError
            items.count
          end} </strong>
        </div>
    </div>"
      end

      # return the locale for frontend translations initialized in admin controller
      # used by models like posts, categories, ..., sample: my_post.the_url
      # fix for https://github.com/owen2345/camaleon-cms/issues/233#issuecomment-215385432
      def cama_get_i18n_frontend
        @cama_i18n_frontend
      end

      # print code with auto copy
      def cama_shortcode_print(code)
        "<input onmousedown=\"this.clicked = 1;\" readonly onfocus=\"if (!this.clicked) this.select(); else this.clicked = 2;\" onclick=\"if (this.clicked == 2) this.select(); this.clicked = 0;\" class='code_style' tabindex='-1' value=\"#{code}\">"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
camaleon_cms-2.8.3 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.8.2 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.8.1 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.8.0 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.7.5 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.7.4 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.7.3 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.7.2 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.7.1 app/helpers/camaleon_cms/admin/application_helper.rb
camaleon_cms-2.7.0 app/helpers/camaleon_cms/admin/application_helper.rb