diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/javascripts/timebands.js.coffee | 3 | ||||
| -rw-r--r-- | app/assets/stylesheets/application.css.scss.erb | 1 | ||||
| -rw-r--r-- | app/assets/stylesheets/main/timebands.css.scss | 0 | ||||
| -rw-r--r-- | app/assets/stylesheets/partials/base.scss | 23 | ||||
| -rw-r--r-- | app/controllers/timebands_controller.rb | 20 | ||||
| -rw-r--r-- | app/controllers/vehicle_journeys_controller.rb | 2 | ||||
| -rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
| -rw-r--r-- | app/helpers/breadcrumb_helper.rb | 8 | ||||
| -rw-r--r-- | app/helpers/timebands_helper.rb | 2 | ||||
| -rw-r--r-- | app/models/referential.rb | 4 | ||||
| -rw-r--r-- | app/views/help/timebands.textile | 0 | ||||
| -rw-r--r-- | app/views/shared/_header.erb | 4 | ||||
| -rw-r--r-- | app/views/timebands/_form.html.erb | 12 | ||||
| -rw-r--r-- | app/views/timebands/_sidebar.html.erb | 11 | ||||
| -rw-r--r-- | app/views/timebands/edit.html.erb | 3 | ||||
| -rw-r--r-- | app/views/timebands/index.html.erb | 29 | ||||
| -rw-r--r-- | app/views/timebands/new.html.erb | 3 | ||||
| -rw-r--r-- | app/views/timebands/show.html.erb | 12 |
18 files changed, 138 insertions, 1 deletions
diff --git a/app/assets/javascripts/timebands.js.coffee b/app/assets/javascripts/timebands.js.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/timebands.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/application.css.scss.erb b/app/assets/stylesheets/application.css.scss.erb index 52405c14c..770e3c82b 100644 --- a/app/assets/stylesheets/application.css.scss.erb +++ b/app/assets/stylesheets/application.css.scss.erb @@ -17,6 +17,7 @@ $body-bg: #eee; @import "modules/progress_bars"; // Partials +@import "partials/base"; @import "partials/header"; @import "partials/footer"; diff --git a/app/assets/stylesheets/main/timebands.css.scss b/app/assets/stylesheets/main/timebands.css.scss new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/assets/stylesheets/main/timebands.css.scss diff --git a/app/assets/stylesheets/partials/base.scss b/app/assets/stylesheets/partials/base.scss new file mode 100644 index 000000000..e4258c277 --- /dev/null +++ b/app/assets/stylesheets/partials/base.scss @@ -0,0 +1,23 @@ +.formtastic.timeband { + .time_select { + .fragments { + .fragments-group { + padding-left: 0; + } + legend.label { + position: relative; + width: auto; + display: block; + width: 25%; + float: left; + border: none; + label { + position: relative; + width: auto; + font-size: 125%; + padding: .2em .6em .3em; + } + } + } + } +} diff --git a/app/controllers/timebands_controller.rb b/app/controllers/timebands_controller.rb new file mode 100644 index 000000000..446255cac --- /dev/null +++ b/app/controllers/timebands_controller.rb @@ -0,0 +1,20 @@ +class TimebandsController < ChouetteController + + defaults :resource_class => Chouette::Timeband + + respond_to :html + + belongs_to :referential + + def new + new! do + build_breadcrumb :new + end + end + + private + + def timeband_params + params.require(:timeband).permit( :name, :start_time, :end_time ) + end +end diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index bac4166a5..2c2a533aa 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -97,7 +97,7 @@ class VehicleJourneysController < ChouetteController :stop_point_id, :departure_time, :is_frequency] }, - { frequencies_attributes: [ :scheduled_headway_interval, :first_departure_time, + { journey_frequencies_attributes: [ :scheduled_headway_interval, :first_departure_time, :last_departure_time, :exact_time ] } ) end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 058e30732..37b9d7a63 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -69,6 +69,8 @@ module ApplicationHelper "connection_links" when path.include?("/time_tables") "time_tables" + when path.include?("/timebands") + "timebands" when path.include?("/rule_parameter_set") "parametersets" when path.include?("/import_tasks") diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index fc5721452..cb259baf7 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -30,6 +30,8 @@ module BreadcrumbHelper connection_link_breadcrumb action when "Chouette::TimeTable" time_table_breadcrumb action + when "Chouette::Timeband" + timeband_breadcrumb action when "StopAreaCopy" stop_area_copy_breadcrumb action when "Import" @@ -104,6 +106,12 @@ module BreadcrumbHelper add_breadcrumb breadcrumb_label(@time_table), referential_time_table_path(@referential, @time_table),:title => breadcrumb_tooltip(@time_table) if action == :edit end + def timeband_breadcrumb(action) + referential_breadcrumb + add_breadcrumb Chouette::Timeband.model_name.human(:count => 2), referential_timebands_path(@referential) unless action == :index + add_breadcrumb breadcrumb_label(@timeband), referential_timeband_path(@referential, @timeband),:title => breadcrumb_tooltip(@timeband) if action == :edit + end + def line_breadcrumb(action) referential_breadcrumb add_breadcrumb Chouette::Line.model_name.human(:count => 2), referential_lines_path(@referential) unless action == :index diff --git a/app/helpers/timebands_helper.rb b/app/helpers/timebands_helper.rb new file mode 100644 index 000000000..51251e46f --- /dev/null +++ b/app/helpers/timebands_helper.rb @@ -0,0 +1,2 @@ +module TimebandsHelper +end diff --git a/app/models/referential.rb b/app/models/referential.rb index d50694c60..e32c956fb 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -79,6 +79,10 @@ class Referential < ActiveRecord::Base Chouette::TimeTable.all end + def timebands + Chouette::Timeband.all + end + def connection_links Chouette::ConnectionLink.all end diff --git a/app/views/help/timebands.textile b/app/views/help/timebands.textile new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/app/views/help/timebands.textile diff --git a/app/views/shared/_header.erb b/app/views/shared/_header.erb index d1e8dd2ce..1e8a63fba 100644 --- a/app/views/shared/_header.erb +++ b/app/views/shared/_header.erb @@ -65,6 +65,10 @@ <span class="badge pull-right"><%= @referential.time_tables.size %></span><%= Referential.human_attribute_name("time_tables") %> <% end %> </li> + <li><%= link_to referential_timebands_path(@referential) do %> + <span class="badge pull-right"><%= @referential.timebands.size %></span><%= Referential.human_attribute_name("timebands") %> + <% end %> + </li> </ul> </li> <li><%= link_to Referential.human_attribute_name("imports"), referential_imports_path(@referential) %></li> diff --git a/app/views/timebands/_form.html.erb b/app/views/timebands/_form.html.erb new file mode 100644 index 000000000..bfa32212e --- /dev/null +++ b/app/views/timebands/_form.html.erb @@ -0,0 +1,12 @@ +<%= semantic_form_for [@referential, @timeband] do |form| %> + <%= form.inputs do %> + <%= form.input :name %> + <%= form.input :start_time %> + <%= form.input :end_time %> + <% end %> + + <%= form.actions do %> + <%= form.action :submit, :as => :button %> + <%= form.action :cancel, :as => :link %> + <% end %> +<% end %> diff --git a/app/views/timebands/_sidebar.html.erb b/app/views/timebands/_sidebar.html.erb new file mode 100644 index 000000000..8ffa16dca --- /dev/null +++ b/app/views/timebands/_sidebar.html.erb @@ -0,0 +1,11 @@ +<% content_for :sidebar do %> + <ul class="actions"> + <li><%= link_to t('timebands.actions.new'), new_referential_timeband_path(@referential), :class => "add" %></li> + <% if @timeband %> + <li><%= link_to t('timebands.actions.edit'), edit_referential_timeband_path(@referential, @timeband), :class => "edit" %></li> + <li><%= link_to t('timebands.actions.destroy'), referential_timeband_path(@referential, @timeband), :method => :delete, :data => {:confirm => t('timebands.actions.destroy_confirm')}, :class => "remove" %></li> + <% end %> + </ul> +<% end %> + + diff --git a/app/views/timebands/edit.html.erb b/app/views/timebands/edit.html.erb new file mode 100644 index 000000000..bc2c73ace --- /dev/null +++ b/app/views/timebands/edit.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('timebands.edit.title', timeband: @timeband.name) %> + +<%= render "form" %> diff --git a/app/views/timebands/index.html.erb b/app/views/timebands/index.html.erb new file mode 100644 index 000000000..54be52675 --- /dev/null +++ b/app/views/timebands/index.html.erb @@ -0,0 +1,29 @@ +<%= title_tag t('timebands.index.title') %> + +<% if @timebands.any? %> + <table class="table table-striped table-condensed"> + <thead> + <tr> + <th><%= t('activerecord.attributes.timeband.name') %></th> + <th><%= t('activerecord.attributes.timeband.start_time') %></th> + <th><%= t('activerecord.attributes.timeband.end_time') %></th> + <th></th> + </tr> + </thead> + <tbody> + <% @timebands.each do |timeband| %> + <tr> + <td><%= link_to timeband.name, referential_timeband_path(@referential, timeband) %></td> + <td><%= l(timeband.start_time, format: :hour) %></td> + <td><%= l(timeband.end_time, format: :hour) %></td> + <td> + <%= link_to '', edit_referential_timeband_path(@referential, timeband), :class => "edit" %> + <%= link_to '', referential_timeband_path(@referential, timeband), :method => :delete, :data => {:confirm => t('timebands.actions.destroy_confirm')}, :class => "remove" %> + </td> + </tr> + <% end %> + </tbody> + </table> +<% end %> + +<%= render 'sidebar' %> diff --git a/app/views/timebands/new.html.erb b/app/views/timebands/new.html.erb new file mode 100644 index 000000000..c016325d0 --- /dev/null +++ b/app/views/timebands/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t('timebands.new.title') %> + +<%= render "form" %> diff --git a/app/views/timebands/show.html.erb b/app/views/timebands/show.html.erb new file mode 100644 index 000000000..1a6171712 --- /dev/null +++ b/app/views/timebands/show.html.erb @@ -0,0 +1,12 @@ +<%= title_tag t( 'timebands.show.title', timeband: @timeband.name )%> + +<div class="summary"> + <p> + <label><%= @timeband.name %>: </label> + <%= l(@timeband.start_time, format: :hour) %> + - + <%= l(@timeband.end_time, format: :hour) %> + </p> +</div> + +<%= render 'sidebar' %> |
