diff options
| author | Marc Florisson | 2014-09-22 18:20:09 +0200 |
|---|---|---|
| committer | Marc Florisson | 2014-09-22 18:20:09 +0200 |
| commit | c69442da623e504c3d31944829b94ce0b55038aa (patch) | |
| tree | 09f02d944bcb81bbb0790dbab6ca5ed8a2a7e0ed /app/controllers | |
| parent | 80c862d0e0806772abf3449778ba93bb91ff9161 (diff) | |
| parent | e48a2f0e59f96648b04910b42afc7fcef31e93c6 (diff) | |
| download | chouette-core-c69442da623e504c3d31944829b94ce0b55038aa.tar.bz2 | |
Merge branch 'sismo' of github.com:afimb/chouette2 into sismo
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/breadcrumb_controller.rb | 41 | ||||
| -rw-r--r-- | app/controllers/chouette_controller.rb | 38 | ||||
| -rw-r--r-- | app/controllers/exports_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/import_tasks_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/organisations_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/referentials_controller.rb | 7 | ||||
| -rw-r--r-- | app/controllers/rule_parameter_sets_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/stop_area_copies_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/users_controller.rb | 4 | ||||
| -rw-r--r-- | app/controllers/vehicle_journey_imports_controller.rb | 2 |
11 files changed, 61 insertions, 47 deletions
diff --git a/app/controllers/breadcrumb_controller.rb b/app/controllers/breadcrumb_controller.rb new file mode 100644 index 000000000..143651b52 --- /dev/null +++ b/app/controllers/breadcrumb_controller.rb @@ -0,0 +1,41 @@ +class BreadcrumbController < InheritedResources::Base + + include BreadcrumbHelper + + def show + show! do + build_breadcrumb :show + end + end + + def index + index! do + build_breadcrumb :index + end + end + + def edit + edit! do + build_breadcrumb :edit + end + end + + def update + update! do |success, failure| + build_breadcrumb :edit + end + end + + def new + new! do + build_breadcrumb :new + end + end + + def create + create! do |success, failure| + build_breadcrumb :new + end + end + +end diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb index 6e87a4bf6..753fbd2fc 100644 --- a/app/controllers/chouette_controller.rb +++ b/app/controllers/chouette_controller.rb @@ -1,4 +1,4 @@ -class ChouetteController < InheritedResources::Base +class ChouetteController < BreadcrumbController include ApplicationHelper include BreadcrumbHelper @@ -15,40 +15,4 @@ class ChouetteController < InheritedResources::Base @referential ||= current_organisation.referentials.find params[:referential_id] end - def show - show! do - build_breadcrumb :show - end - end - - def index - index! do - build_breadcrumb :index - end - end - - def edit - edit! do - build_breadcrumb :edit - end - end - - def update - update! do |success, failure| - build_breadcrumb :edit - end - end - - def new - new! do - build_breadcrumb :show - end - end - - def create - create! do |success, failure| - build_breadcrumb :show - end - end - end diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index 8de7e4f1f..cb555a3dd 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -8,7 +8,7 @@ class ExportsController < ChouetteController def new new! do - build_breadcrumb :show + build_breadcrumb :new available_exports end end diff --git a/app/controllers/import_tasks_controller.rb b/app/controllers/import_tasks_controller.rb index a0d17d4d7..bee70d196 100644 --- a/app/controllers/import_tasks_controller.rb +++ b/app/controllers/import_tasks_controller.rb @@ -6,7 +6,7 @@ class ImportTasksController < ChouetteController def new new! do - build_breadcrumb :show + build_breadcrumb :new available_imports end end diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 7e2edb220..9faea18a5 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -1,4 +1,6 @@ -class OrganisationsController < InheritedResources::Base +class OrganisationsController < BreadcrumbController + + defaults :resource_class => Organisation respond_to :html def update diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index de0b209ca..bf8a2f1ef 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -1,4 +1,7 @@ -class ReferentialsController < InheritedResources::Base +class ReferentialsController < BreadcrumbController + + defaults :resource_class => Referential + respond_to :html respond_to :json, :only => :show respond_to :js, :only => :show @@ -13,6 +16,8 @@ class ReferentialsController < InheritedResources::Base :time_tables_count => resource.time_tables.count, :referential_id => resource.id} } + format.html { build_breadcrumb :show} + end end diff --git a/app/controllers/rule_parameter_sets_controller.rb b/app/controllers/rule_parameter_sets_controller.rb index 63265bced..a422bed15 100644 --- a/app/controllers/rule_parameter_sets_controller.rb +++ b/app/controllers/rule_parameter_sets_controller.rb @@ -8,7 +8,7 @@ class RuleParameterSetsController < ChouetteController def new @rule_parameter_set = RuleParameterSet.default( @referential) new! do - build_breadcrumb :show + build_breadcrumb :new end end diff --git a/app/controllers/stop_area_copies_controller.rb b/app/controllers/stop_area_copies_controller.rb index 642932acd..7c1fac8d9 100644 --- a/app/controllers/stop_area_copies_controller.rb +++ b/app/controllers/stop_area_copies_controller.rb @@ -1,4 +1,5 @@ class StopAreaCopiesController < ChouetteController + defaults :resource_class => StopAreaCopy belongs_to :referential do belongs_to :stop_area, :parent_class => Chouette::StopArea end @@ -9,8 +10,7 @@ class StopAreaCopiesController < ChouetteController def new @stop_area_copy = StopAreaCopy.new(:hierarchy => params[:hierarchy], :source => parent) new! do - add_breadcrumb Referential.human_attribute_name("stop_areas"), referential_stop_areas_path(@referential) - add_breadcrumb @stop_area.name, referential_stop_area_path(@referential, @stop_area) + build_breadcrumb :new end end diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 620bc98c0..54b0a3bac 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -20,7 +20,7 @@ class TimeTablesController < ChouetteController def new @autocomplete_items = ActsAsTaggableOn::Tag.all new! do - build_breadcrumb :show + build_breadcrumb :new end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b57b9d54a..2b1c2bd14 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,4 +1,6 @@ -class UsersController < InheritedResources::Base +class UsersController < BreadcrumbController + + defaults :resource_class => User def create @user = current_organisation.users.build(params[:user]) diff --git a/app/controllers/vehicle_journey_imports_controller.rb b/app/controllers/vehicle_journey_imports_controller.rb index ce164c51e..7ce0aca23 100644 --- a/app/controllers/vehicle_journey_imports_controller.rb +++ b/app/controllers/vehicle_journey_imports_controller.rb @@ -13,7 +13,7 @@ class VehicleJourneyImportsController < ChouetteController def new @vehicle_journey_import = VehicleJourneyImport.new(:route => route) new! do - build_breadcrumb :show + build_breadcrumb :new end end |
