diff options
| author | Bruno Perles | 2015-12-07 15:40:07 +0100 |
|---|---|---|
| committer | Bruno Perles | 2015-12-16 10:02:41 +0100 |
| commit | 39dccecdda931e73959ff7f5cdb96980aab512aa (patch) | |
| tree | 676cf6feb524deeb28536a8b4332c73e2cdd6a8f | |
| parent | e2602ff09070e8d752a3c3ddf90ea1d26487af27 (diff) | |
| download | chouette-core-39dccecdda931e73959ff7f5cdb96980aab512aa.tar.bz2 | |
Add control to journey_pattern_secion
| -rw-r--r-- | app/assets/stylesheets/main/journey_patterns.scss | 8 | ||||
| -rw-r--r-- | app/controllers/route_sections_selectors_controller.rb | 5 | ||||
| -rw-r--r-- | app/views/journey_patterns/show.html.erb | 7 | ||||
| -rw-r--r-- | app/views/route_sections/index.html.erb | 2 | ||||
| -rw-r--r-- | db/migrate/20151204102348_add_section_status_to_journey_pattern.ninoxe_engine.rb | 6 | ||||
| -rw-r--r-- | db/schema.rb | 5 |
6 files changed, 26 insertions, 7 deletions
diff --git a/app/assets/stylesheets/main/journey_patterns.scss b/app/assets/stylesheets/main/journey_patterns.scss index 07ed52b9e..51547b05d 100644 --- a/app/assets/stylesheets/main/journey_patterns.scss +++ b/app/assets/stylesheets/main/journey_patterns.scss @@ -49,7 +49,7 @@ padding-left: 4px; } } - -} - - +} +#middle #sidebar a.control-shape { + color: orange; +} diff --git a/app/controllers/route_sections_selectors_controller.rb b/app/controllers/route_sections_selectors_controller.rb index 05a399ae8..b5b5ebd48 100644 --- a/app/controllers/route_sections_selectors_controller.rb +++ b/app/controllers/route_sections_selectors_controller.rb @@ -18,6 +18,11 @@ class RouteSectionsSelectorsController < ChouetteController @map = RouteSectionSelectorMap.new(resource).with_helpers(self) end + def update + update! + parent.control_route_sections + end + def selection parent diff --git a/app/views/journey_patterns/show.html.erb b/app/views/journey_patterns/show.html.erb index 3a2b18ea1..6bd6022f7 100644 --- a/app/views/journey_patterns/show.html.erb +++ b/app/views/journey_patterns/show.html.erb @@ -35,7 +35,12 @@ <li><%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %></li> <li><%= link_to t('journey_patterns.actions.edit'), edit_referential_line_route_journey_pattern_path(@referential, @line, @route, @journey_pattern), :class => "edit" %></li> <li><%= link_to t('journey_patterns.actions.destroy'), referential_line_route_journey_pattern_path(@referential, @line, @route, @journey_pattern), :method => :delete, :data => {:confirm => t('journey_patterns.actions.destroy_confirm')}, :class => "remove" %></li> - <li><%= link_to t('journey_patterns.actions.edit_route_sections'), edit_referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern), class: 'edit' %></li> + <li> + <%= link_to edit_referential_line_route_journey_pattern_route_sections_selector_path(@referential, @line, @route, @journey_pattern), class: "edit#{' control-shape' if @journey_pattern.control?}" do %> + <%= t('journey_patterns.actions.edit_route_sections') %> + <% if @journey_pattern.control? %><i class="fa fa-exclamation-triangle"></i><% end %> + <% end %> + </li> <li><%= link_to t('journey_patterns.journey_pattern.vehicle_journey_at_stops'), referential_line_route_vehicle_journeys_path(@referential, @line, @route, :q => {:journey_pattern_id_eq => @journey_pattern.id}), :class => "clock" %></li> </ul> <%= creation_tag(@journey_pattern) %> diff --git a/app/views/route_sections/index.html.erb b/app/views/route_sections/index.html.erb index 5d7bef989..763ea360e 100644 --- a/app/views/route_sections/index.html.erb +++ b/app/views/route_sections/index.html.erb @@ -30,6 +30,7 @@ <th><%= Chouette::RouteSection.human_attribute_name :arrival %></th> <th class="distance"><%= Chouette::RouteSection.human_attribute_name :distance %></th> <th class="points"><%= Chouette::RouteSection.human_attribute_name :points %></th> + <th class="points"><%= Chouette::RouteSection.human_attribute_name :quantity %></th> <th class="actions"></th> </tr> </thead> @@ -40,6 +41,7 @@ <td><%= route_section.arrival.name %> <%= link_to content_tag(:i, "", class: "fa fa-external-link"), referential_stop_area_path(@referential, route_section.arrival) %></td> <td class="distance"><%= route_section.distance.to_i if route_section.distance %></td> <td class="points"><%= route_section.via_count if route_section.via_count > 0 %></td> + <td class="journey_patterns"><%= route_section.journey_pattern_sections.count(:journey_pattern_id, distinct: true) %></td> <td class="actions"> <%= link_to t('.actions.show'), referential_route_section_path(@referential, route_section), class: "view" %> <%= link_to t('.actions.edit'), edit_referential_route_section_path(@referential, route_section), class: "edit" %> diff --git a/db/migrate/20151204102348_add_section_status_to_journey_pattern.ninoxe_engine.rb b/db/migrate/20151204102348_add_section_status_to_journey_pattern.ninoxe_engine.rb new file mode 100644 index 000000000..946705928 --- /dev/null +++ b/db/migrate/20151204102348_add_section_status_to_journey_pattern.ninoxe_engine.rb @@ -0,0 +1,6 @@ +# This migration comes from ninoxe_engine (originally 20151204102248) +class AddSectionStatusToJourneyPattern < ActiveRecord::Migration + def change + add_column :journey_patterns, :section_status, :integer, null: false, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index ac3a1dd2e..551af645a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20151203132113) do +ActiveRecord::Schema.define(version: 20151204102348) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -237,7 +237,7 @@ ActiveRecord::Schema.define(version: 20151203132113) do create_table "journey_patterns", force: true do |t| t.integer "route_id", limit: 8 - t.string "objectid", null: false + t.string "objectid", null: false t.integer "object_version" t.datetime "creation_time" t.string "creator_id" @@ -247,6 +247,7 @@ ActiveRecord::Schema.define(version: 20151203132113) do t.string "published_name" t.integer "departure_stop_point_id", limit: 8 t.integer "arrival_stop_point_id", limit: 8 + t.integer "section_status", default: 0, null: false end add_index "journey_patterns", ["objectid"], :name => "journey_patterns_objectid_key", :unique => true |
