app/views/labs/index.html.haml
- title "Labs"
.subnavbar.border-bottom
.container
.row
.col-md-3.py-4.border-right.list-map
= render "header"
.col-md-6.py-4.border-right
= search_form_for @q do |f|
.input-group.mb-2
= f.select(:country_code_eq, options_for_select(@countries.map { |a,b| [a, b]}, params[:q] ? params[:q][:country_code_eq] : '' ), { include_blank: 'Filter by Country' }, {class: 'form-control'})
.input-group.mb-2
= f.select(:activity_status_eq, options_for_select(Lab::ACTIVITY_STATUS.map { |a,b| [a.upcase, a]}, params[:q] ? params[:q][:activity_status_eq] : ''), { include_blank: 'Filter by activity status' }, {class: 'form-control'})
.input-group.mb-2
%label Filter by lab tags:
= f.select(:lab_tags_id_in, LabTag.pluck(:name, :id), { include_blank: 'Filter by Lab tags' }, {class: 'form-control', multiple: true})
.input-group.mb-2.align-items-center
%p.m-0.mr-1 Show:
.w-50
= select_tag :per, options_for_select(["25", "50", "100"], params[:per])
= f.submit class: 'btn btn-primary ml-auto', value: 'Filter'
%p.text-right.m-0 Showing <strong>#{@labs.count}</strong> Labs
.col-md-3.py-4
- if current_user
= link_to new_lab_path, class: "btn btn-primary" do
= icon "plus", t(".add_a_lab", default: "Add Lab")
- else
= link_to new_lab_path, class: "btn btn-primary", title: "You need to be signed in to add a Lab" do
= icon "plus", t(".add_a_lab", default: "Add Lab")
.container-fluid
.row
= paginate @labs, theme: 'twitter-bootstrap-4', nav_class: "m-auto"
.row.flex-column-reverse.flex-md-row
- cache ["v2-labsindex-#{I18n.locale}-#{Digest::MD5.hexdigest([params.to_s].to_s)}", Lab.last_updated_at] do
- if params[:query].present?
.search-results
= link_to "×", labs_path, class: 'close right'
#{pluralize @labs.size, "search result"} for
%strong= params[:query]
.labs.col-md-5= render @labs
.labs.col-md-7= render 'sidemap'
= paginate @labs, theme: 'twitter-bootstrap-4', nav_class: "m-auto pt-3"
.row
.heading.col-12
%strong Download
the Fab Labs list
%dl
%dt.col-6 Format:
%dd.col-6
= link_to "JSON", controller:'labs', action:'index', subdomain: 'api', format: :json, class: 'btn btn-primary'