From e4728a4cc84f91bc2aa6bb82c38c1b87ff629ba2 Mon Sep 17 00:00:00 2001 From: Michel Etienne Date: Mon, 12 Nov 2012 15:12:24 +0100 Subject: manage generic access_links and hide/show datas on several views --- Gemfile.lock | 2 +- app/assets/images/icons/disabled_left_arrow.png | Bin 823 -> 958 bytes app/assets/images/icons/disabled_right_arrow.png | Bin 815 -> 920 bytes app/assets/images/map/access_in.png | Bin 666 -> 840 bytes app/assets/images/map/access_in_out.png | Bin 666 -> 847 bytes app/assets/images/map/access_out.png | Bin 666 -> 829 bytes app/assets/javascripts/access_points.js.coffee | 16 +++++ app/assets/javascripts/stop_areas.js.coffee | 15 +++++ app/assets/javascripts/time_tables.js.coffee | 7 +++ app/controllers/access_points_controller.rb | 3 +- app/controllers/file_validations_controller.rb | 13 ++++ app/controllers/stop_areas_controller.rb | 3 +- app/views/access_links/_form.html.erb | 2 + app/views/access_points/show.html.erb | 33 +++++++++- app/views/help/access_links.textile | 66 ++++++++++++++++++++ app/views/help/access_points.textile | 74 +++++++++++++++++++++++ app/views/help/stop_areas.textile | 2 +- app/views/help/toc.textile | 2 + app/views/stop_areas/access_links.html.erb | 27 ++++++++- app/views/time_tables/_form.erb | 36 +++++------ app/views/time_tables/show.html.erb | 30 ++++++--- config/environments/production.rb | 2 +- config/locales/access_points.yml | 14 +++-- config/locales/stop_areas.yml | 12 ++-- config/locales/time_tables.yml | 2 + public/help/access_in.png | Bin 0 -> 840 bytes public/help/access_in_out.png | Bin 0 -> 847 bytes public/help/access_out.png | Bin 0 -> 829 bytes public/help/disabled_left_arrow.png | Bin 0 -> 958 bytes public/help/disabled_right_arrow.png | Bin 0 -> 920 bytes public/help/gray_left_arrow.png | Bin 0 -> 567 bytes public/help/gray_right_arrow.png | Bin 0 -> 556 bytes public/help/green_left_arrow.png | Bin 0 -> 422 bytes public/help/green_right_arrow.png | Bin 0 -> 423 bytes 34 files changed, 315 insertions(+), 46 deletions(-) create mode 100644 app/views/help/access_links.textile create mode 100644 app/views/help/access_points.textile create mode 100644 public/help/access_in.png create mode 100644 public/help/access_in_out.png create mode 100644 public/help/access_out.png create mode 100644 public/help/disabled_left_arrow.png create mode 100644 public/help/disabled_right_arrow.png create mode 100644 public/help/gray_left_arrow.png create mode 100644 public/help/gray_right_arrow.png create mode 100644 public/help/green_left_arrow.png create mode 100644 public/help/green_right_arrow.png diff --git a/Gemfile.lock b/Gemfile.lock index 1c583f2c7..602aa7eaf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://chouette.dryade.priv/ninoxe - revision: 7485cd03aee6e44165cf70c1902f7dbfcc272d3c + revision: 7b462c077e40a907ff351a859531fbb6fb97a491 specs: ninoxe (0.0.8) GeoRuby diff --git a/app/assets/images/icons/disabled_left_arrow.png b/app/assets/images/icons/disabled_left_arrow.png index d919ca52e..3e11b9c71 100644 Binary files a/app/assets/images/icons/disabled_left_arrow.png and b/app/assets/images/icons/disabled_left_arrow.png differ diff --git a/app/assets/images/icons/disabled_right_arrow.png b/app/assets/images/icons/disabled_right_arrow.png index 57793256b..be6fcdf65 100644 Binary files a/app/assets/images/icons/disabled_right_arrow.png and b/app/assets/images/icons/disabled_right_arrow.png differ diff --git a/app/assets/images/map/access_in.png b/app/assets/images/map/access_in.png index 82ea29382..6d341c517 100644 Binary files a/app/assets/images/map/access_in.png and b/app/assets/images/map/access_in.png differ diff --git a/app/assets/images/map/access_in_out.png b/app/assets/images/map/access_in_out.png index 82ea29382..5c9b066c5 100644 Binary files a/app/assets/images/map/access_in_out.png and b/app/assets/images/map/access_in_out.png differ diff --git a/app/assets/images/map/access_out.png b/app/assets/images/map/access_out.png index 82ea29382..bd366b7fc 100644 Binary files a/app/assets/images/map/access_out.png and b/app/assets/images/map/access_out.png differ diff --git a/app/assets/javascripts/access_points.js.coffee b/app/assets/javascripts/access_points.js.coffee index c0f49ebd5..74c5e926f 100644 --- a/app/assets/javascripts/access_points.js.coffee +++ b/app/assets/javascripts/access_points.js.coffee @@ -28,3 +28,19 @@ jQuery -> $('input#access_point_x').change(lon_lat_change) $('input#access_point_y').change(lon_lat_change) + + + # switch visibility of access_links + switch_generics = (event) -> + event.preventDefault() + $('.access_points .generics.content').toggle('slow') + $('a.generics .switcher').toggle() + + $('.access_points a.generics').click(switch_generics) + + switch_details = (event) -> + event.preventDefault() + $('.access_points .details.content').toggle('slow') + $('a.details .switcher').toggle() + + $('.access_points a.details').click(switch_details) diff --git a/app/assets/javascripts/stop_areas.js.coffee b/app/assets/javascripts/stop_areas.js.coffee index cab862d46..aae8d4885 100644 --- a/app/assets/javascripts/stop_areas.js.coffee +++ b/app/assets/javascripts/stop_areas.js.coffee @@ -28,3 +28,18 @@ jQuery -> $('input#stop_area_x').change(lon_lat_change) $('input#stop_area_y').change(lon_lat_change) + + # switch visibility of access_links + switch_generics = (event) -> + event.preventDefault() + $('.stop_areas .generics.content').toggle('slow') + $('a.generics .switcher').toggle() + + $('.stop_areas a.generics').click(switch_generics) + + switch_details = (event) -> + event.preventDefault() + $('.stop_areas .details.content').toggle('slow') + $('a.details .switcher').toggle() + + $('.stop_areas a.details').click(switch_details) diff --git a/app/assets/javascripts/time_tables.js.coffee b/app/assets/javascripts/time_tables.js.coffee index b85376edb..d347ddc67 100644 --- a/app/assets/javascripts/time_tables.js.coffee +++ b/app/assets/javascripts/time_tables.js.coffee @@ -1,5 +1,12 @@ jQuery -> # add trigger to hide/show application dates and periods + switch_calendars = (event) -> + event.preventDefault() + $('.time_tables .calendars.content').toggle('slow') + $('a.calendars .switcher').toggle() + + $('.time_tables a.calendars').click(switch_calendars) + switch_dates = (event) -> event.preventDefault() $('.time_tables .dates.content').toggle('slow') diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb index 4f3c0d717..d26595a85 100644 --- a/app/controllers/access_points_controller.rb +++ b/app/controllers/access_points_controller.rb @@ -15,7 +15,8 @@ class AccessPointsController < ChouetteController def show map.editable = false - @access_links = @access_point.access_link_matrix + @generic_access_links = @access_point.generic_access_link_matrix + @detail_access_links = @access_point.detail_access_link_matrix show! do |format| unless access_point.position or params[:default] format.kml { diff --git a/app/controllers/file_validations_controller.rb b/app/controllers/file_validations_controller.rb index cc50a7499..274d11f9f 100644 --- a/app/controllers/file_validations_controller.rb +++ b/app/controllers/file_validations_controller.rb @@ -1,23 +1,36 @@ class FileValidationsController < InheritedResources::Base respond_to :html, :xml, :json + def index + no_referential + index! + end + def show + no_referential @toc = TestSheetPage.find("toc") show! end def new + no_referential @toc = TestSheetPage.find("toc") new! end def create + no_referential create! do |success, failure| success.html { redirect_to file_validations_path } end end + protected + def no_referential + Apartment::Database.switch("public") + end + def resource @file_validation ||= current_organisation.file_validations.find_by_id(params[:id]) end diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index dfd756d9b..d08ed1803 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -36,7 +36,8 @@ class StopAreasController < ChouetteController def access_links @stop_area = stop_area - @access_links = stop_area.access_link_matrix + @generic_access_links = stop_area.generic_access_link_matrix + @detail_access_links = stop_area.detail_access_link_matrix end def index diff --git a/app/views/access_links/_form.html.erb b/app/views/access_links/_form.html.erb index e07de415f..147686930 100644 --- a/app/views/access_links/_form.html.erb +++ b/app/views/access_links/_form.html.erb @@ -5,6 +5,8 @@ <%= form.input :link_orientation_type , :as => :hidden%> <%= form.input :name %> <%= form.input :access_link_type, :as => :select, :collection => Chouette::AccessLink.access_link_types, :include_blank => false, :member_label => Proc.new { |type| t("connection_link_types.label.#{type}") } %> + <%= form.input :comment %> + <%= form.input :link_distance %> <%= form.inputs :name => t('access_links.show.durations') do %> <%= form.input "default_duration(1i)", :as => :hidden ,:input_html => { :value => "2000" } %> <%= form.input "default_duration(2i)", :as => :hidden ,:input_html => { :value => "1" } %> diff --git a/app/views/access_points/show.html.erb b/app/views/access_points/show.html.erb index fb46c27c8..97bd961d6 100644 --- a/app/views/access_points/show.html.erb +++ b/app/views/access_points/show.html.erb @@ -103,14 +103,43 @@
<%= t('.access_link_legend_1') %>
<%= t('.access_link_legend_2') %>
+ +<%= t('.access_link_legend_1') %>
<%= t('.access_link_legend_2') %>
+