diff options
| author | Alban Peignier | 2012-03-23 16:05:07 +0100 |
|---|---|---|
| committer | Alban Peignier | 2012-03-23 16:05:07 +0100 |
| commit | 2b518115133a8a0ebebcd751bed7b1185134621c (patch) | |
| tree | eccb58751f69135eddc18f9b64ecb2a20a910bf3 | |
| parent | 64fd52a1ba9a29c19409cd9778eed44e6e14fb33 (diff) | |
| download | chouette-core-2b518115133a8a0ebebcd751bed7b1185134621c.tar.bz2 | |
First draft for multi selection support. Refs #3
| -rw-r--r-- | Gemfile | 2 | ||||
| -rw-r--r-- | Gemfile.lock | 2 | ||||
| -rw-r--r-- | app/assets/javascripts/multiple_selection.js.coffee | 37 | ||||
| -rw-r--r-- | app/assets/stylesheets/multiple_selection.scss | 18 | ||||
| -rw-r--r-- | app/views/lines/_line.erb | 1 | ||||
| -rw-r--r-- | app/views/lines/index.html.erb | 18 |
6 files changed, 76 insertions, 2 deletions
@@ -5,7 +5,7 @@ gem 'rails', '3.1.3' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' -gem 'user_interface', :git => 'git://sim.dryade.priv/user_interface'#, :path => '~/projects/user_interface' +gem 'user_interface', :git => 'git://sim.dryade.priv/user_interface' gem 'apartment', :git => 'git://github.com/dryade/apartment.git' diff --git a/Gemfile.lock b/Gemfile.lock index 946965170..94725d796 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,7 +48,7 @@ GIT GIT remote: git://sim.dryade.priv/user_interface - revision: 724621255c1ea243c433f6fb5e6dd726690f84b8 + revision: 0d22ebf5bb92d2c0ce27f1e395f6b3c82ce17628 specs: user_interface (0.0.1) rails (~> 3.1.0) diff --git a/app/assets/javascripts/multiple_selection.js.coffee b/app/assets/javascripts/multiple_selection.js.coffee new file mode 100644 index 000000000..0353a2755 --- /dev/null +++ b/app/assets/javascripts/multiple_selection.js.coffee @@ -0,0 +1,37 @@ +jQuery -> + enable_multiple_selection = (event) -> + event.preventDefault() + $('#multiple_selection_menu div.enabled').show() + $('#multiple_selection_menu div.disabled').hide() + $('input[type=checkbox].multiple_selection').fadeIn() + + $('#multiple_selection_menu a.enable').click(enable_multiple_selection) + + disable_multiple_selection = (event) -> + event.preventDefault() + $('#multiple_selection_menu div.enabled').hide() + $('#multiple_selection_menu div.disabled').show() + $('input[type=checkbox].multiple_selection').fadeOut() + + $('#multiple_selection_menu a.disable').click(disable_multiple_selection) + + select_all = (event) -> + event.preventDefault() + $('input[type=checkbox].multiple_selection').prop("checked", true) + + $('#multiple_selection_menu a.select_all').click(select_all) + + deselect_all = (event) -> + event.preventDefault() + $('input[type=checkbox].multiple_selection').prop("checked", false) + + $('#multiple_selection_menu a.deselect_all').click(deselect_all) + + disabled_action = (event) -> + event.preventDefault() + alert("Fonction activee au prochain milestone") + + $('#multiple_selection_menu .actions a').click(disabled_action) + + + diff --git a/app/assets/stylesheets/multiple_selection.scss b/app/assets/stylesheets/multiple_selection.scss new file mode 100644 index 000000000..e7f64857f --- /dev/null +++ b/app/assets/stylesheets/multiple_selection.scss @@ -0,0 +1,18 @@ +input[type=checkbox].multiple_selection { + margin-left: 25px; +} + +#multiple_selection_menu { + h3 { + margin-top: 20px; + } + div { + padding: 6px 8px; + } + .actions { + margin-top: 20px; + } + .select_all, .deselect_all { + font-size: 0.8em; + } +}
\ No newline at end of file diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index 30f29b02d..5405bcbb5 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -4,6 +4,7 @@ <% if line.number and line.number.length <= 3 %> <div class="number"><%= line.number %></div> <% end %> + <%= check_box_tag "ids[]", line.id, false, :class => "multiple_selection", :style => "display: none;" %> </div> <% end %> <%= link_to truncate(line.name, :length => 30), [@referential, line], :title => "Ligne #{line.name}" %> diff --git a/app/views/lines/index.html.erb b/app/views/lines/index.html.erb index bd206ea4f..f987fe66b 100644 --- a/app/views/lines/index.html.erb +++ b/app/views/lines/index.html.erb @@ -54,4 +54,22 @@ <li><%= link_with_search t(".selection_all"), {"network_id_eq" => nil}, :class => "all" %></li> </ul> +<div id="multiple_selection_menu"> + <h3>Sélection multiple</h3> + <div class="disabled"> + <a class="enable" href="#">Activer la sélection multiple</a> + </div> + + <div class="enabled" style="display: none;"> + <a class="disable" href="#">Désactiver la sélection multiple</a> + + <ul class="actions"> + <li><a href="#" class="remove">Supprimer les lignes</a></li> + <li><a href="#" class="export">Exporter les lignes</a></li> + </ul> + + <a class="select_all" href="#">Tout sélectionner</a> | <a class="deselect_all" href="#">désélectionner</a> + </div> +</div> + <% end %> |
