aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Etienne2014-08-12 16:59:23 +0200
committerMichel Etienne2014-08-12 16:59:23 +0200
commit6fa03cfc0be70dfb5dc2566d1613027063cdfeb3 (patch)
treec1281b7f4316984a670fd20a06e1521f6a78d23f
parent2a5190da6ae7608041e6adec970fb1190d866b5c (diff)
downloadchouette-core-6fa03cfc0be70dfb5dc2566d1613027063cdfeb3.tar.bz2
combine time_table in modal form
-rw-r--r--app/assets/javascripts/application.js2
-rw-r--r--app/controllers/time_tables_controller.rb2
-rw-r--r--app/views/time_tables/_combine.html.erb34
-rw-r--r--app/views/time_tables/_form.erb5
-rw-r--r--app/views/time_tables/show.html.erb18
-rw-r--r--config/locales/time_table_combinations.yml6
-rw-r--r--config/locales/time_tables.yml21
7 files changed, 38 insertions, 50 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index d1f7d4361..fc3b1fecb 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -12,7 +12,7 @@
//= require raphael
//= require morris
//= require bootstrap
-//= require typeahead.min
+//= require twitter/typeahead.min
//= require tagmanager
//= require_directory ./plugins
//= require_directory .
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index e1d070f94..ea08bb487 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -73,7 +73,7 @@ class TimeTablesController < ChouetteController
tag_search = ransack_params["tag_search"].split(",").collect(&:strip) if ransack_params.present? && ransack_params["tag_search"].present?
ransack_params.delete("tag_search") if ransack_params.present?
- select_time_tables = tag_search ? referential.time_tables.tagged_with(tag_search, :match_all => true) : referential.time_tables
+ select_time_tables = tag_search ? referential.time_tables.tagged_with(tag_search) : referential.time_tables
@q = select_time_tables.search(ransack_params)
@time_tables ||= @q.result(:distinct => true).order(:comment).paginate(:page => params[:page])
end
diff --git a/app/views/time_tables/_combine.html.erb b/app/views/time_tables/_combine.html.erb
index 0e40ec88e..8e375a10b 100644
--- a/app/views/time_tables/_combine.html.erb
+++ b/app/views/time_tables/_combine.html.erb
@@ -1,15 +1,25 @@
-<div id="compact_form" >
-
-<%= semantic_form_for [@referential, @time_table, TimeTableCombination.new] do |form| %>
- <%= form.inputs do %>
- <%= form.input :operation, :as => :radio, :collection => Hash[TimeTableCombination.operations.map {|b| [t( b, :scope => "time_table_combinations.operations"),b]}] %>
- <%= form.input :combined_id, :as => :text %>
- <% end %>
-
- <%= form.actions do %>
- <%= form.action :submit, :as => :button , :label => t('time_tables.show.combine')%>
- <% end %>
-<% end %>
+<div id="combine_form" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+<div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="myModalLabel"><%= t('time_tables.show.combine_form') %></h4>
+ </div>
+ <%= semantic_form_for [@referential, @time_table, TimeTableCombination.new] do |form| %>
+ <div class="modal-body">
+ <%= form.inputs do %>
+ <%= form.input :operation, :as => :radio, :collection => Hash[TimeTableCombination.operations.map {|b| [t( b, :scope => "time_table_combinations.operations"),b]}] %>
+ <%= form.input :combined_id, :as => :text %>
+ <% end %>
+ </div>
+ <div class="modal-footer">
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button , :label => t('time_tables.show.combine')%>
+ <% end %>
+ </div>
+ <% end %>
+ </div>
+ </div>
</div>
<script>
diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb
index 6a50e9edb..71718995d 100644
--- a/app/views/time_tables/_form.erb
+++ b/app/views/time_tables/_form.erb
@@ -8,11 +8,6 @@
<%= form.input :objectid, :required => !@time_table.new_record? %>
<% end %>
- <%= form.inputs :name => "Advanced" do %>
- <label class="label"><%= @time_table.human_attribute_name("peculiarities") %></label>
- <%= form.input :school_holliday, :as => :boolean, :class => "others" %>
- <%= form.input :public_holliday, :as => :boolean %>
- <% end %>
<h3 class="time_table_periods">
<a class="periods"><%= @time_table.human_attribute_name("periods") %>
diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb
index 4f06c3677..0ecad52b1 100644
--- a/app/views/time_tables/show.html.erb
+++ b/app/views/time_tables/show.html.erb
@@ -5,10 +5,8 @@
<%= title_tag t('time_tables.show.title', :time_table => @time_table.comment )%>
-<h3><%= t('.combine_form') %></h3>
<%= render "combine" %>
-
<div class="time_table_show">
<div class="resume">
@@ -27,20 +25,6 @@
<label><%= @time_table.human_attribute_name("version") %>: </label>
<%= @time_table.version %>
</p>
- <% if @time_table.int_day_types & 1536 != 0 %>
- <p>
- <label><%= @time_table.human_attribute_name("peculiarities") %>:&nbsp;&nbsp;</label>
-
- <% if @time_table.school_holliday %>
- <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("school_holliday") %>&nbsp;</span>
- <% end %>
-
- <% if @time_table.public_holliday %>
- <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("public_holliday") %>&nbsp;</span>
- <% end %>
-
- </p>
- <% end %>
<p>
<label><%= @time_table.human_attribute_name("tag_list") %>: </label>
<%= @time_table.tag_list %>
@@ -156,7 +140,7 @@
<li><%= link_to t('time_tables.actions.edit'), edit_referential_time_table_path(@referential, @time_table), :class => "edit" %></li>
<li><%= link_to t('time_tables.actions.destroy'), referential_time_table_path(@referential, @time_table), :method => :delete, :data => {:confirm => t('time_tables.actions.destroy_confirm')}, :class => "remove" %></li>
<li><%= link_to t('time_tables.actions.duplicate'), duplicate_referential_time_table_path(@referential, @time_table), :class => "add" %></li>
- <br>
+ <li><%= link_to t('time_tables.actions.combine'), '#combine_form', :class => "import" ,'data-toggle' => 'modal'%></li>
</ul>
diff --git a/config/locales/time_table_combinations.yml b/config/locales/time_table_combinations.yml
index 14d0cbe8c..b224a7e12 100644
--- a/config/locales/time_table_combinations.yml
+++ b/config/locales/time_table_combinations.yml
@@ -16,9 +16,9 @@ fr:
success: "opération appliquée sur le calendrier"
failure: "opération échouée"
operations:
- union: "fusion"
- intersection: "intersection"
- disjunction: "exclusion"
+ union: "ajouter les dates"
+ intersection: "conserver les dates communes"
+ disjunction: "soustraire les dates"
activemodel:
attributes:
time_table_combination:
diff --git a/config/locales/time_tables.yml b/config/locales/time_tables.yml
index e9f1bce3d..cb8b834fc 100644
--- a/config/locales/time_tables.yml
+++ b/config/locales/time_tables.yml
@@ -53,9 +53,6 @@ en:
time_table:
comment: "Name"
version: "Short name"
- peculiarities: "Peculiarities"
- school_holliday: "School hollidays"
- public_holliday: "Public hollidays"
day_types: "Period day types"
none: "none"
monday: "Monday"
@@ -81,6 +78,9 @@ en:
hints:
time_table:
objectid: "[prefix]:Timetable:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
+ placeholders:
+ time_table:
+ tag_search: "ex: Public hollidays,School holidays"
fr:
time_tables:
@@ -96,6 +96,7 @@ fr:
edit: "Modifier ce calendrier"
destroy: "Supprimer ce calendrier"
duplicate: "Dupliquer ce calendrier"
+ combine: "Combiner ce calendrier"
destroy_confirm: "Etes vous sûr de supprimer ce calendrier ?"
destroy_date_confirm: "Etes vous sûr de supprimer cette date ?"
destroy_period_confirm: "Etes vous sûr de supprimer cette période ?"
@@ -116,15 +117,15 @@ fr:
to: "au"
add_period: "Ajouter une période"
add_date: "Ajouter une date"
- combine_form: "Combinatoire"
+ combine_form: "Combinaison de calendriers"
combine: "Appliquer"
index:
comment: "Recherche par nom"
tag_search: "Tags : vacances,jour fériés"
from: "De : "
to: " à : "
- start_date: "12/01/2014"
- end_date: "15/06/2014"
+ start_date: "jj/mm/aaaa"
+ end_date: "jj/mm/aaaa"
title: "calendriers"
selection: "Sélection"
selection_all: "Tous"
@@ -139,9 +140,6 @@ fr:
time_table:
comment: "Nom"
version: "Abréviation"
- peculiarities: "Particularités"
- school_holliday: "Vacances scolaires"
- public_holliday: "Jours fériés"
day_types: "Jours d'application des périodes"
none: "aucun"
monday: "Lundi"
@@ -162,14 +160,15 @@ fr:
periods: "Périodes d'application"
period_start: "Du"
period_end: "au"
- tag_search: "Tags"
+ tag_search: "Etiquettes"
+ tag_list: "Etiquettes"
formtastic:
hints:
time_table:
objectid: "[prefixe]:Timetable:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
placeholders:
time_table:
- tag_search: "vacances"
+ tag_search: "ex: Jours fériés,Vacances scolaires"