Skip to content

Commit 3665ab0

Browse files
committed
New filter template
1 parent a7d335e commit 3665ab0

File tree

6 files changed

+57
-15
lines changed

6 files changed

+57
-15
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ group :assets do
2020
gem "rails-backbone"
2121
gem 'compass-rails'
2222
gem 'haml_coffee_assets'
23+
gem 'chosen-rails'
2324
end
2425

2526
gem 'jquery-rails'

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ GEM
4646
bson (~> 1.6.1)
4747
builder (3.0.0)
4848
cancan (1.6.7)
49+
chosen-rails (0.9.8)
50+
railties (~> 3.0)
51+
thor (~> 0.14)
4952
chunky_png (1.2.5)
5053
coderay (1.0.5)
5154
coffee-rails (3.2.2)
@@ -230,6 +233,7 @@ PLATFORMS
230233
DEPENDENCIES
231234
bson_ext (~> 1.6)
232235
cancan
236+
chosen-rails
233237
coffee-rails (~> 3.2.1)
234238
compass-rails
235239
database_cleaner

app/assets/javascripts/application.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
//= require backbone_rails_sync
1818
//= require backbone_datalink
1919
//= require hamlcoffee
20+
//= require chosen-jquery
2021
//= require backbone/iaato

app/assets/stylesheets/application.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
* compiled file, but it's generally better to create a new file per style scope.
1010
*
1111
*= require_self
12+
*= require chosen
1213
*= require_tree .
1314
*/

app/assets/stylesheets/layout.css.sass

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,49 @@ nav
3030
color: white
3131
text-decoration: none
3232

33+
@mixin cf
34+
display: block
35+
content: "."
36+
height: 0
37+
visibility: hidden
38+
clear: both
3339
@mixin resource_layout
3440
position: relative
3541
margin-left: 10px
3642
$map_width: 50%
3743

38-
section#filter
44+
form
3945
color: black
4046
background: rgba(255,255,255, 0.5)
4147
+border-radius(10px)
4248
box-shadow: -1px 2px 5px 1px rgba(255, 255, 255, 0.7)
43-
input[type='text']
49+
margin-bottom: 10px
50+
margin-right: $map_width
51+
padding: 10px
52+
font-weight: normal
53+
$label_width: 20%
54+
label
55+
float: left
56+
width: $label_width
57+
padding-right: 30px
58+
input[type='search']
59+
display: block
60+
width: 100%
61+
font-size: 40pt
62+
select
63+
//margin-left: 20%
64+
width: 50%
65+
margin-top: 10px
66+
&:after
67+
+cf
68+
input[type='range']
69+
//margin-left: 20%
70+
width: 50%
71+
&:after
72+
//+cf
4473
input[type='submit']
4574
display: inline-block
4675
height: 1em
47-
margin-bottom: 10px
48-
margin-right: $map_width
49-
padding-right: 40px
5076

5177
ul.ships
5278
margin-right: $map_width
@@ -71,11 +97,7 @@ nav
7197
font-weight: bold
7298
.operator
7399
&:before
74-
display: block
75-
content: "."
76-
height: 0
77-
visibility: hidden
78-
clear: both
100+
+cf
79101
.hidden
80102
display: none
81103

app/views/templates/ships.html.haml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@
55
#ships
66
#map
77
#canvas
8-
%section#filter
9-
%h2 Filters
10-
%form{action: '#'}
11-
%label Ship name
12-
%input{type: 'text', name: 'name', placeholder: 'nom'}
8+
%form{action: '#'}
9+
%input{type: 'search', name: 'name', placeholder: 'nom'}
10+
.fields
11+
%label Operator
12+
%select{name: 'operator', 'data-placeholder' => 'Operator'}
13+
%option
14+
%option{value: '1'} Cunard Line
15+
%option{value: '2'} Costa Croisière
16+
.fields
17+
%label Classe
18+
%select{name: 'operator', 'data-placeholder' => 'Classe'}
19+
%option
20+
%option{value: '1'} Paquebot
21+
%option{value: '2'} Plaisance
22+
.fields
23+
%label Capacité
24+
%input{type: 'range', min: 0, max: 3000}
1325
%ul.ships
1426
%li
1527
%h2 Queen Mary 2
@@ -66,3 +78,4 @@
6678
})
6779
new google.maps.Marker({map: map, position: point1})
6880
}
81+
$('select[name="operator"]').chosen()

0 commit comments

Comments
 (0)