Sha256: 94d38fa938f824650f78c5bb9abac7369b1bcc74e12c6e997c02407f4e7bd347

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

- classes = 'btn'
- classes << ' btn-danger' if url_params.present? and (url_params.keys != ["f"] or url_params["f"].keys != ["s"]) # "f[s]" is OK
- link_data = { toggle: "ajax-modal", params: url_params, width: "600px", backdrop: "static", "modal-overflow" => true, tabindex: "-1" }

- if Basepack::Settings.filters.model_name and can?(:create, Basepack::Settings.filters.model_name.constantize)
  = link_to url, class: classes, data: link_data do
    %i.icon-search
    = I18n.t('basepack.query.filter')
  - filters = Basepack::Settings.filters.model_name.constantize.active.where(filter_type: resource_class.to_s).to_a
  - if filters.present?
    %button{type: "button", class: classes + ' dropdown-toggle', 'data-toggle' => "dropdown"}
      %span{class: "caret"}
    %ul.dropdown-menu.text-left{role: "menu", 'aria-labelledby' => "dropdownMenu"}
      %li.nav-header
        %small
          %a{href: polymorphic_path([:filters, association_chain, resource_class].flatten), tabindex: '-1'}
            %i.icon-folder-open-alt
            = I18n.t('basepack.query.filter_list')
      - filters.each do |filter|
        %li{class: (filter.filter == url_params['ql'] ? 'active' : '')}
          %a{href: polymorphic_path([association_chain, resource_class].flatten, ql: filter.filter), tabindex: '-1'}= filter.name
- else
  = link_to url, class: classes, data: link_data do
    %i.icon-search
    = I18n.t('basepack.query.filter')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
basepack-0.1.0 app/views/forms/buttons/_query.html.haml