Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
44a9220f
Commit
44a9220f
authored
Jun 07, 2017
by
Kaspar Vollenweider
👻
Committed by
Kaspar
Jun 08, 2017
Browse files
simplify state selection
parent
e5d3e6aa
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/controllers/volunteers_controller.rb
View file @
44a9220f
...
...
@@ -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
...
...
app/views/volunteers/_state_select.slim
View file @
44a9220f
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
}
"
app/views/volunteers/index.html.slim
View file @
44a9220f
...
...
@@ -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
...
...
config/locales/de.yml
View file @
44a9220f
...
...
@@ -423,6 +423,7 @@ de:
registered
:
interessiert / angemeldet
rejected
:
Absage
reserved
:
kontaktiert / für Gespräch eingeladen
all
:
Alle
placeholders
:
required
:
mark
:
'
*'
...
...
config/locales/en.yml
View file @
44a9220f
...
...
@@ -281,6 +281,7 @@ en:
registered
:
intrested / registered
rejected
:
rejected
reserved
:
contacted / invited to meeting
all
:
All
placeholders
:
required
:
mark
:
'
*'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment