aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2014-07-01 11:13:47 +0200
committerLuc Donnet2014-07-01 11:13:47 +0200
commite2faf18654f7c0deba9841654a3f9880d73822f3 (patch)
tree7508e8b3d60a40b71bab08be986a25dcc32a32c8
parentc03bcfa9b0083cd5f45a70bcf395fc206d0e78df (diff)
parentcda0cdb65fe578759814494218b6864f7979b4ef (diff)
downloadchouette-core-e2faf18654f7c0deba9841654a3f9880d73822f3.tar.bz2
Merge branch 'sismo' of github.com:afimb/chouette2 into sismo
-rw-r--r--app/assets/javascripts/time_tables.js.coffee7
-rw-r--r--app/assets/stylesheets/main/calendar.css.scss12
-rw-r--r--app/assets/stylesheets/main/time_tables.css.scss74
-rw-r--r--app/views/time_tables/_dates.html.erb2
-rw-r--r--app/views/time_tables/_form.erb24
-rw-r--r--app/views/time_tables/show.html.erb15
-rw-r--r--config/locales/time_tables.yml14
7 files changed, 109 insertions, 39 deletions
diff --git a/app/assets/javascripts/time_tables.js.coffee b/app/assets/javascripts/time_tables.js.coffee
index 27bcd39f4..972747ee4 100644
--- a/app/assets/javascripts/time_tables.js.coffee
+++ b/app/assets/javascripts/time_tables.js.coffee
@@ -14,6 +14,13 @@ jQuery ->
$('.time_tables a.dates').click(switch_dates)
+ switch_excluded_dates = (event) ->
+ event.preventDefault()
+ $('.time_tables .excluded_dates.content').toggle('slow')
+ $('a.excluded_dates .switcher').toggle()
+
+ $('.time_tables a.excluded_dates').click(switch_excluded_dates)
+
switch_periods = (event) ->
event.preventDefault()
$('.time_tables .periods.content').toggle('slow')
diff --git a/app/assets/stylesheets/main/calendar.css.scss b/app/assets/stylesheets/main/calendar.css.scss
index 89aed512a..3d86dbfa1 100644
--- a/app/assets/stylesheets/main/calendar.css.scss
+++ b/app/assets/stylesheets/main/calendar.css.scss
@@ -85,18 +85,20 @@ th.monthName {
.selected_date { background-color: #8fc861 !important; }
-.overlap_date { background-color: #ffbd2b !important; }
+.excluded_date { background-color: #ff8f85 !important; }
-.specialDay, .selected_period, .selected_date, .overlap_date {
+.overlap_date { background-color: #c082f4 !important; }
+
+.specialDay, .selected_period, .selected_date, .overlap_date, .excluded_date {
a, a:visited, a:hover {
color: white;
text-decoration: none;
}
}
-.specialDay a:hover, selected_period a:hover, selected_date a:hover, overlap_date a:hover {
- color: black;
- }
+.specialDay a:hover, selected_period a:hover, selected_date a:hover, excluded_date a:hover, overlap_date a:hover {
+ color: black;
+}
.weekendDay {
background-color: #787888;
diff --git a/app/assets/stylesheets/main/time_tables.css.scss b/app/assets/stylesheets/main/time_tables.css.scss
index 5ea1f993f..09ab50283 100644
--- a/app/assets/stylesheets/main/time_tables.css.scss
+++ b/app/assets/stylesheets/main/time_tables.css.scss
@@ -95,32 +95,12 @@
.periods {
cursor: pointer;
}
+ .excluded_dates {
+ cursor: pointer;
+ }
}
- .day_type ol {
- float: left;
- margin: 0;
- padding: 0 0 0 0;
- width: 100%;
- list_style: none outside none;
- margin-top: 0.5em;
- margin-bottom: 1em;
- }
- .day_type ol li {
- float: left;
- margin: 0 O 0 0;
- width: auto;
- padding: 0;
- }
- .day_type_label {
- float: left;
- margin-top: 0;
- width: 25%;
- }
- .day_type ol li label {
- padding-left: 10%;
- }
.dates ol {
margin-top: -0.3em;
@@ -139,6 +119,23 @@
.dates ol li.fl1 label {width: 40%; margin-top: -0.3em; }
.dates ol li.fl1 input { width: 50%; }
+ .excluded_dates ol {
+ margin-top: -0.3em;
+ margin-bottom: 1em;
+ margin-left: 25%;
+ padding: 0;
+ width: 75%;
+ }
+ .excluded_dates ol li { padding : 0.3em 0; }
+
+ .excluded_dates ol li label {
+ width: 40%;
+ margin-top: -0.3em;
+ }
+ .excluded_dates ol li.fl1 {float: left; width: 30% ;}
+ .excluded_dates ol li.fl1 label {width: 40%; margin-top: -0.3em; }
+ .excluded_dates ol li.fl1 input { width: 50%; }
+
.periods ol {
margin-top: -0.3em;
@@ -160,16 +157,43 @@
.periods ol li.fl2 {float: left; width: 30% ;}
.periods ol li.fl2 label {width: 40%; margin-top: -0.3em;}
.periods ol li.fl2 input { width: 50%; }
+
+ .day_type ol {
+ float: left;
+ margin: 0;
+ padding: 0 0 0 0;
+ width: 100%;
+ list_style: none outside none;
+ margin-top: 1em;
+ margin-bottom: 1em;
+ }
+ .day_type ol li {
+ float: left;
+ margin: 0 O 0 0;
+ width: auto;
+ padding: 0;
+ }
+ .day_type_label {
+ float: left;
+ margin-top: 0;
+ width: 25%;
+ }
+ .day_type ol li label {
+ padding-left: 10%;
+ margin-top: 0;
+ }
+
+
a.add_fields {
margin-left: 25%;
color: #666;
padding-left: 18px;
- background: url(image-path('user_interface/ui/add.png')) no-repeat 0% 50%;
+ background: url(image-path('icons/add.png')) no-repeat 0% 50%;
}
a.remove_fields {
color: #666;
padding-left: 18px;
- background: url(image-path('user_interface/ui/remove.png')) no-repeat 0% 50%;
+ background: url(image-path('icons/remove.png')) no-repeat 0% 50%;
}
}
diff --git a/app/views/time_tables/_dates.html.erb b/app/views/time_tables/_dates.html.erb
index 663efec58..c6af6ee8c 100644
--- a/app/views/time_tables/_dates.html.erb
+++ b/app/views/time_tables/_dates.html.erb
@@ -1,5 +1,5 @@
<ul class='dates'>
- <% @time_table.dates.each do |tmd| %>
+ <% @time_table.dates.where("in_out = true").to_a.each do |tmd| %>
<li class="<%= (tmd.position%2==0) ? 'odd' : 'even' %>"><%= l tmd.date %>
</li>
<% end %>
diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb
index da303a5bc..7933b2f7c 100644
--- a/app/views/time_tables/_form.erb
+++ b/app/views/time_tables/_form.erb
@@ -49,14 +49,34 @@
<div class="dates content" id="dates_content">
<div id="dates">
- <%= form.semantic_fields_for :dates do |p| %>
- <%= render "date_fields", :f => p %>
+ <%= form.semantic_fields_for :dates, @time_table.dates.where("in_out = true").to_a do |p| %>
+ <%= render "date_fields", :f => p %>
<% end %>
</div>
<%= link_to_add_association t("time_tables.actions.add_date"), form, :dates ,
:"data-association-insertion-method" => "append",
+ :"partial" => "date_fields",
:"data-association-insertion-node" => "div#dates" %>
</div>
+
+ <h3 class="time_table_dates">
+ <a class="excluded_dates"><%= @time_table.human_attribute_name("excluded_dates") %>
+ <%= image_tag("icons/plus.png" , :class => "switcher", :style => "display: none;") %>
+ <%= image_tag("icons/minus.png" , :class => "switcher" ) %>
+ </a>
+ </h3>
+
+ <div class="excluded_dates content" id="dates_content">
+ <div id="excluded">
+ <%= form.semantic_fields_for :dates, @time_table.dates.where("in_out = false").to_a do |p| %>
+ <%= render "excluded_date_fields", :f => p %>
+ <% end %>
+ </div>
+ <%= link_to_add_association t("time_tables.actions.add_excluded_date"), form, :dates ,
+ :"data-association-insertion-method" => "append",
+ :"partial" => "excluded_date_fields",
+ :"data-association-insertion-node" => "div#excluded" %>
+ </div>
<p/>
<%= form.actions do %>
diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb
index 2f2bda244..0997c9d06 100644
--- a/app/views/time_tables/show.html.erb
+++ b/app/views/time_tables/show.html.erb
@@ -61,7 +61,9 @@
<%= cal = ""
(1..12).each do |month|
cal << calendar(:year => @year, :month => month, :first_day_of_week => 1) do |d|
- if @time_table.include_in_overlap_dates?(d)
+ if @time_table.excluded_date?(d)
+ [link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "excluded_date"}]
+ elsif @time_table.include_in_overlap_dates?(d)
[link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "overlap_date"}]
elsif @time_table.include_in_dates?(d)
[link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "selected_date"}]
@@ -99,6 +101,17 @@
<%= render "dates" %>
</div>
+ <h3 class="time_table_dates">
+ <a class="excluded_dates"><%= @time_table.human_attribute_name("excluded_dates") %>
+ <%= image_tag("icons/plus.png" , :class => "switcher", :style => "display: none;") %>
+ <%= image_tag("icons/minus.png" , :class => "switcher" ) %>
+ </a>
+ </h3>
+
+ <div class="excluded_dates content">
+ <%= render "excluded_dates" %>
+ </div>
+
</div>
<% content_for :sidebar do %>
diff --git a/config/locales/time_tables.yml b/config/locales/time_tables.yml
index 7ce94359a..ede789bc9 100644
--- a/config/locales/time_tables.yml
+++ b/config/locales/time_tables.yml
@@ -14,7 +14,8 @@ en:
destroy_date_confirm: "Are you sure you want destroy this date ?"
destroy_period_confirm: "Are you sure you want destroy this period ?"
add_period: "Add a period"
- add_date: "Add a date"
+ add_date: "Add a peculiar date"
+ add_excluded_date: "Add an excluded date"
new:
title: "Add a new timetable"
edit:
@@ -61,8 +62,9 @@ en:
creation_time: "Created on"
creator_id: "Created by "
calendars: "Calendar view"
- dates: "Application dates"
+ dates: "Peculiar dates"
date: "On"
+ excluded_dates: "Excluded dates"
periods: "Application periods"
period_start: "From"
period_end: "to"
@@ -88,7 +90,8 @@ fr:
destroy_date_confirm: "Etes vous sûr de supprimer cette date ?"
destroy_period_confirm: "Etes vous sûr de supprimer cette période ?"
add_period: "Ajouter une période"
- add_date: "Ajouter une date"
+ add_date: "Ajouter une date particulière"
+ add_excluded_date: "Ajouter une date exclue"
new:
title: "Ajouter un calendrier"
edit:
@@ -135,8 +138,9 @@ fr:
creation_time: "Créé le"
creator_id: "Créé par"
calendars: "Présentation calendaire"
- dates: "Dates d'application"
- date: "Date"
+ dates: "Dates particulières"
+ date: "Le"
+ excluded_dates: "Dates exclues"
periods: "Périodes d'application"
period_start: "Du"
period_end: "au"