Commit 44a9220f authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻 Committed by Kaspar
Browse files

simplify state selection

parent e5d3e6aa
......@@ -5,7 +5,7 @@ class VolunteersController < ApplicationController
before_action :set_state, only: [:update]
def index
@q = Volunteer.ransack(params[:q] || { state_cont: 'registered' })
@q = Volunteer.ransack(params[:q])
@volunteers = @q.result
end
......
ruby:
scope = {scope: [:simple_form, :options, :volunteer, :state]}
size ||= 'xs'
descriptive ||= false
state_filter = @q.base.conditions.first.values.first.value if @q.base.conditions.first
label = "#{t_attr(:state)} "
label += ": #{t(state_filter, scope)} " if descriptive && state_filter.present?
- state_filter = request.GET[:q] && request.GET[:q][:state_cont].present? ? request.GET[:q][:state_cont] : 'all'
.btn-group
button.btn.btn-default.dropdown-toggle type='button' data-toggle='dropdown' aria-label="#{t_attr(:state)}" aria-haspopup='true' aria-expanded='false' class="btn-#{size}"
= label
button.btn.btn-default.dropdown-toggle type='button' data-toggle='dropdown' aria-label="#{t_attr(:state)}" aria-haspopup='true' aria-expanded='false' class="btn-md"
= "#{t_attr(:state)} : "
= t(state_filter, scope: [:simple_form, :options, :volunteer, :state]) + ' '
span.caret aria-hidden='true'
ul.dropdown-menu
li
= link_to t('all'), "#{volunteers_path}?q[state_cont]="
- Volunteer.state_collection.each do |s|
li= link_to t(s.to_s, scope), "#{volunteers_path}?q[state_cont]=#{s}"
li= link_to t(s.to_s, scope: [:simple_form, :options, :volunteer, :state]), "#{volunteers_path}?q[state_cont]=#{s}"
......@@ -2,7 +2,7 @@
.col-xs-12
h1= t('volunteers')
.row
.col-xs-12= render 'state_select', size: 'md', descriptive: true
.col-xs-12= render 'state_select'
.row
.col-xs-12
table.table.table-striped
......
......@@ -423,6 +423,7 @@ de:
registered: interessiert / angemeldet
rejected: Absage
reserved: kontaktiert / für Gespräch eingeladen
all: Alle
placeholders:
required:
mark: '*'
......
......@@ -281,6 +281,7 @@ en:
registered: intrested / registered
rejected: rejected
reserved: contacted / invited to meeting
all: All
placeholders:
required:
mark: '*'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment