Slightly better looking region selector

This commit is contained in:
echarp 2017-09-07 22:09:30 +02:00
parent 73d3aa248d
commit fc0abb0dc7
12 changed files with 93329 additions and 16 deletions

View File

@ -66,7 +66,7 @@ GEM
bundler (~> 1.2)
thor (~> 0.18)
byebug (9.1.0)
coderay (1.1.1)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
@ -145,7 +145,7 @@ GEM
guard-rubocop (1.3.0)
guard (~> 2.0)
rubocop (~> 0.20)
haml (5.0.2)
haml (5.0.3)
temple (>= 0.8.0)
tilt
haml-rails (1.0.0)
@ -232,7 +232,7 @@ GEM
mini_portile2 (2.2.0)
minitest (5.10.3)
modernizr-rails (2.7.1)
multi_json (1.12.1)
multi_json (1.12.2)
multipart-post (2.0.0)
mysql2 (0.4.9)
naught (1.1.0)

View File

@ -33,7 +33,6 @@
.radios
display: inline-block
text-align: left
margin-left: -0.5em
background-color: white
label
display: none

View File

@ -1,11 +1,8 @@
:ruby
selected = params[:region].to_i == filter_region.id
regions = Region.where(region: filter_region)
%li{ class: selected ? 'selected' : '' }
%li{ class: params[:region].to_i == filter_region.id ? 'selected' : '' }
- if filter_region.url.present?
= link_to filter_region.url do
= flag_icon filter_region.code.try :downcase
- if filter_region.code.present?
= flag_icon filter_region.code.try :downcase
= filter_region.name
%small
%em.fa.fa-external-link
@ -14,14 +11,14 @@
start_date: params[:start_date],
year: params[:year],
tag: params[:tag] do
- if filter_region.region.nil?
- if filter_region.code.present?
= flag_icon filter_region.code.try :downcase
- else
%em.fa.fa-shield
= filter_region.name
- if regions.present?
- if filter_region.regions.present?
%small
%em.fa.fa-chevron-down
%ul
= render partial: '/regions/filter_region',
collection: regions
collection: filter_region.regions

View File

@ -1,3 +1,3 @@
.radios= render partial: '/regions/selector_region',
collection: Region.where.not(code: nil),
collection: Region.where(region: nil, url: ''),
locals: { f: f }

View File

@ -1,5 +1,5 @@
- if selector_region.regions.present? || selector_region.url.blank?
%span.region
%span.region{ title: selector_region }
= f.radio_button :region_id, selector_region.id
= f.label "region_id_#{selector_region.id}" do
= flag_icon selector_region.code.try :downcase

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
(function() {
$(document).on('turbolinks:load', function() {
return tinyMCE.init({
schema: 'html5',
height: '40em',
menubar: false,
branding: false,
language: 'fr_FR',
selector: 'input.description',
content_css: '/assets/application-26ecba5fa6547e958c0e5723a2881e60515a876806ec20146885f0220767e808.css',
entity_encoding: 'raw',
add_unload_trigger: true,
browser_spellcheck: true,
toolbar: [' cut copy paste | undo redo | searchreplace | link image media charmap table | code visualblocks preview fullscreen', ' removeformat | bold italic strikethrough | superscript subscript | bullist numlist | alignleft aligncenter alignright alignjustify alignnone | outdent indent'],
plugins: 'lists, advlist, autolink, link, image, charmap, paste, print, preview, table, fullscreen, searchreplace, media, insertdatetime, visualblocks, wordcount, contextmenu, code'
});
});
$(document).on('turbolinks:before-cache', function() {
return tinymce.remove();
});
}).call(this);