diff options
| author | Michel Etienne | 2014-06-25 11:17:52 +0200 |
|---|---|---|
| committer | Michel Etienne | 2014-06-25 11:17:52 +0200 |
| commit | 828ca6d15b8d5d80f54b679172a306a2390f45c8 (patch) | |
| tree | 13931adc9294e33274c939577376c0d5d2ffc48f | |
| parent | 7909f7db83dbdeee280a7010bdf0a90d2b7e7e95 (diff) | |
| download | chouette-core-828ca6d15b8d5d80f54b679172a306a2390f45c8.tar.bz2 | |
add school and public hollidays on timetables, Mantis 26835
| -rw-r--r-- | Gemfile.lock | 7 | ||||
| -rw-r--r-- | app/views/time_tables/_form.erb | 21 | ||||
| -rw-r--r-- | app/views/time_tables/_periods.html.erb | 35 | ||||
| -rw-r--r-- | app/views/time_tables/show.html.erb | 31 | ||||
| -rw-r--r-- | config/locales/time_tables.yml | 18 |
5 files changed, 71 insertions, 41 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index a8df89521..39202d569 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,11 @@ GIT remote: https://github.com/afimb/ninoxe.git - revision: a0605b6d5430cf8e870f944ac2a34163a69a8e87 + revision: 8e51f48524cfbe4aea48e574a4ba11546cf0f722 specs: ninoxe (1.0.1) activerecord (>= 3.1.3, < 4.0) - acts_as_list (~> 0.1.6) + acts_as_list (>= 0.1.6) + acts_as_tree (>= 1.1.0) foreigner (= 1.6.0) georuby-ext (= 0.0.5) @@ -51,6 +52,8 @@ GEM i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) acts_as_list (0.1.6) + acts_as_tree (1.6.1) + activerecord (>= 3.0.0) acts_as_tree-1.8 (1.1.0) activerecord (>= 3.0.0) addressable (2.3.5) diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb index ddcd5742f..da303a5bc 100644 --- a/app/views/time_tables/_form.erb +++ b/app/views/time_tables/_form.erb @@ -4,14 +4,9 @@ <%= form.input :version %> <% end %> <%= form.inputs :class => 'day_type' do %> - <label class="day_type_label"><%= @time_table.human_attribute_name("day_types") %></label> - <%= form.input :monday, :as => :boolean, :class => "others" %> - <%= form.input :tuesday, :as => :boolean %> - <%= form.input :wednesday, :as => :boolean %> - <%= form.input :thursday, :as => :boolean %> - <%= form.input :friday, :as => :boolean %> - <%= form.input :saturday, :as => :boolean %> - <%= form.input :sunday, :as => :boolean %> + <label class="day_type_label"><%= @time_table.human_attribute_name("peculiarities") %></label> + <%= form.input :school_holliday, :as => :boolean, :class => "others" %> + <%= form.input :public_holliday, :as => :boolean %> <% end %> <%= form.inputs do %> <%= form.input :objectid, :required => !@time_table.new_record? %> @@ -25,6 +20,16 @@ </h3> <div class="periods content" id="periods_content"> + <%= form.inputs :class => 'day_type' do %> + <label class="day_type_label"><%= @time_table.human_attribute_name("day_types") %></label> + <%= form.input :monday, :as => :boolean, :class => "others" %> + <%= form.input :tuesday, :as => :boolean %> + <%= form.input :wednesday, :as => :boolean %> + <%= form.input :thursday, :as => :boolean %> + <%= form.input :friday, :as => :boolean %> + <%= form.input :saturday, :as => :boolean %> + <%= form.input :sunday, :as => :boolean %> + <% end %> <div id="periods"> <%= form.semantic_fields_for :periods do |p| %> <%= render "period_fields", :f => p %> diff --git a/app/views/time_tables/_periods.html.erb b/app/views/time_tables/_periods.html.erb index 1f0aea057..41bf9db2d 100644 --- a/app/views/time_tables/_periods.html.erb +++ b/app/views/time_tables/_periods.html.erb @@ -1,4 +1,39 @@ <ul class='periods'> + <p> + <label><%= @time_table.human_attribute_name("day_types") %>: </label> + <% if @time_table.int_day_types & 508 == 0 %> + <label><%= @time_table.human_attribute_name("none") %></label> + <% else %> + <% if @time_table.monday %> + <span class='day_type'> <%= @time_table.human_attribute_name("monday") %> </span> + <% end %> + + <% if @time_table.tuesday %> + <span class='day_type'> <%= @time_table.human_attribute_name("tuesday") %> </span> + <% end %> + + <% if @time_table.wednesday %> + <span class='day_type'> <%= @time_table.human_attribute_name("wednesday") %> </span> + <% end %> + + <% if @time_table.thursday %> + <span class='day_type'> <%= @time_table.human_attribute_name("thursday") %> </span> + <% end %> + + <% if @time_table.friday %> + <span class='day_type'> <%= @time_table.human_attribute_name("friday") %> </span> + <% end %> + + <% if @time_table.saturday %> + <span class='day_type'> <%= @time_table.human_attribute_name("saturday") %> </span> + <% end %> + + <% if @time_table.sunday %> + <span class='day_type'> <%= @time_table.human_attribute_name("sunday") %> </span> + <% end %> + <% end %> + + </p> <% @time_table.periods.each do |tmp| %> <li class='period'><%= t('time_tables.show.from')%> <%= l tmp.period_start %> <%= t('time_tables.show.to')%> <%= l tmp.period_end %> </li> diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb index c23ed912c..dbc9fe7ec 100644 --- a/app/views/time_tables/show.html.erb +++ b/app/views/time_tables/show.html.erb @@ -24,37 +24,18 @@ <%= @time_table.version %> </p> <p> - <label><%= @time_table.human_attribute_name("day_types") %>: </label> - <% if @time_table.int_day_types == 0 %> + <label><%= @time_table.human_attribute_name("peculiarities") %>: </label> + <% if @time_table.int_day_types & 1536 == 0 %> <label><%= @time_table.human_attribute_name("none") %></label> <% else %> - <% if @time_table.monday %> - <span class='day_type'> <%= @time_table.human_attribute_name("monday") %> </span> + <% if @time_table.school_holliday %> + <span class='day_type'> <%= @time_table.human_attribute_name("school_holliday") %> </span> <% end %> - <% if @time_table.tuesday %> - <span class='day_type'> <%= @time_table.human_attribute_name("tuesday") %> </span> + <% if @time_table.public_holliday %> + <span class='day_type'> <%= @time_table.human_attribute_name("public_holliday") %> </span> <% end %> - <% if @time_table.wednesday %> - <span class='day_type'> <%= @time_table.human_attribute_name("wednesday") %> </span> - <% end %> - - <% if @time_table.thursday %> - <span class='day_type'> <%= @time_table.human_attribute_name("thursday") %> </span> - <% end %> - - <% if @time_table.friday %> - <span class='day_type'> <%= @time_table.human_attribute_name("friday") %> </span> - <% end %> - - <% if @time_table.saturday %> - <span class='day_type'> <%= @time_table.human_attribute_name("saturday") %> </span> - <% end %> - - <% if @time_table.sunday %> - <span class='day_type'> <%= @time_table.human_attribute_name("sunday") %> </span> - <% end %> <% end %> </p> diff --git a/config/locales/time_tables.yml b/config/locales/time_tables.yml index 85d268daf..7ce94359a 100644 --- a/config/locales/time_tables.yml +++ b/config/locales/time_tables.yml @@ -31,7 +31,7 @@ en: add_date: "Add a date" index: title: "Timetables" - comment: "Comment" + comment: "Name" selection: "Selection" selection_all: "All" activerecord: @@ -42,8 +42,11 @@ en: other: "Timetables" attributes: time_table: - comment: "Comment" - version: "Version" + comment: "Name" + version: "Short name" + peculiarities: "Peculiarities" + school_holliday: "School hollidays" + public_holliday: "Public hollidays" day_types: "Day types" none: "none" monday: "Monday" @@ -101,7 +104,7 @@ fr: add_period: "Ajouter une période" add_date: "Ajouter une date" index: - comment: "Description" + comment: "Nom" title: "calendriers" selection: "Sélection" selection_all: "Tous" @@ -113,8 +116,11 @@ fr: other: "Calendriers" attributes: time_table: - comment: "Description" - version: "Version" + comment: "Nom" + version: "Abréviation" + peculiarities: "Particularités" + school_holliday: "Vacances scolaires" + public_holliday: "Jours fériés" day_types: "Jours d'application" none: "aucun" monday: "Lundi" |
