diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/companies_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/journey_patterns_collections_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/lines_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/networks_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/referential_lines_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/routes_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/routing_constraint_zones_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/stop_areas_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/vehicle_journeys_controller.rb | 2 | ||||
| -rw-r--r-- | app/decorators/referential_network_decorator.rb | 62 | ||||
| -rw-r--r-- | app/models/chouette/stop_point.rb | 2 |
12 files changed, 41 insertions, 43 deletions
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index ec695bcbf..bc5bedd7f 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -77,7 +77,7 @@ class CompaniesController < InheritedResources::Base def decorate_companies(companies) ModelDecorator.decorate( companies, - with: Chouette::CompanyDecorator, + with: CompanyDecorator, context: { referential: line_referential } diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb index f217dccb3..546158fa8 100644 --- a/app/controllers/journey_patterns_collections_controller.rb +++ b/app/controllers/journey_patterns_collections_controller.rb @@ -48,7 +48,7 @@ class JourneyPatternsCollectionsController < ChouetteController end def user_permissions - policy = policy(:"chouette/journey_pattern") + policy = policy(:journey_pattern) @perms = %w{create destroy update}.inject({}) do | permissions, action | permissions.merge( "journey_patterns.#{action}" => policy.authorizes_action?(action) ) diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index 49a8ca2c5..cf2908500 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -15,7 +15,7 @@ class LinesController < InheritedResources::Base index! do |format| @lines = ModelDecorator.decorate( @lines, - with: Chouette::LineDecorator, + with: LineDecorator, context: { line_referential: @line_referential, current_organisation: current_organisation diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index d90af0ed8..98c840777 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -85,7 +85,7 @@ class NetworksController < InheritedResources::Base def decorate_networks(networks) ModelDecorator.decorate( networks, - with: Chouette::NetworkDecorator, + with: NetworkDecorator, context: { line_referential: line_referential } diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb index 75e574da3..b9f8c0050 100644 --- a/app/controllers/referential_lines_controller.rb +++ b/app/controllers/referential_lines_controller.rb @@ -29,7 +29,7 @@ class ReferentialLinesController < ChouetteController @routes = ModelDecorator.decorate( @routes, - with: Chouette::RouteDecorator, + with: RouteDecorator, context: { referential: referential, line: @line diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index c8813dbcb..1a6c82484 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -48,7 +48,7 @@ class RoutesController < ChouetteController @route_sp = ModelDecorator.decorate( @route_sp, - with: Chouette::StopPointDecorator + with: StopPointDecorator ) end end diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index 8261373a6..6c3da5980 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -14,7 +14,7 @@ class RoutingConstraintZonesController < ChouetteController index! do |format| @routing_constraint_zones = ModelDecorator.decorate( @routing_constraint_zones, - with: Chouette::RoutingConstraintZoneDecorator, + with: RoutingConstraintZoneDecorator, context: { referential: referential, line: parent diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 2732c5f99..1d6f88068 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -56,7 +56,7 @@ class StopAreasController < InheritedResources::Base @stop_areas = ModelDecorator.decorate( @stop_areas, - with: Chouette::StopAreaDecorator + with: StopAreaDecorator ) } end diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 34b1ca89d..0c1769ad7 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -168,7 +168,7 @@ class TimeTablesController < ChouetteController def decorate_time_tables(time_tables) ModelDecorator.decorate( time_tables, - with: Chouette::TimeTableDecorator, + with: TimeTableDecorator, context: { referential: @referential } diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb index e74957ffc..050f2f219 100644 --- a/app/controllers/vehicle_journeys_controller.rb +++ b/app/controllers/vehicle_journeys_controller.rb @@ -158,7 +158,7 @@ class VehicleJourneysController < ChouetteController end def user_permissions - policy = policy(:"chouette/vehicle_journey") + policy = policy(:vehicle_journey) @perms = %w{create destroy update}.inject({}) do | permissions, action | permissions.merge( "vehicle_journeys.#{action}" => policy.authorizes_action?(action) ) diff --git a/app/decorators/referential_network_decorator.rb b/app/decorators/referential_network_decorator.rb index 7b1c6ada9..1260a38cb 100644 --- a/app/decorators/referential_network_decorator.rb +++ b/app/decorators/referential_network_decorator.rb @@ -1,40 +1,38 @@ -module Chouette - class NetworkDecorator < Draper::Decorator - decorates Chouette::Network +class ReferentialNetworkDecorator < Draper::Decorator + decorates Chouette::Network - delegate_all + delegate_all - # Requires: - # context: { - # referential: , - # } - def action_links - links = [] +# Requires: +# context: { +# referential: , +# } +def action_links + links = [] - if h.policy(Chouette::Network).create? - links << Link.new( - content: h.t('networks.actions.new'), - href: h.new_referential_network_path(context[:referential]) - ) - end + if h.policy(Chouette::Network).create? + links << Link.new( + content: h.t('networks.actions.new'), + href: h.new_referential_network_path(context[:referential]) + ) + end - if h.policy(object).update? - links << Link.new( - content: h.t('networks.actions.edit'), - href: h.edit_referential_network_path(context[:referential], object) - ) - end + if h.policy(object).update? + links << Link.new( + content: h.t('networks.actions.edit'), + href: h.edit_referential_network_path(context[:referential], object) + ) + end - if h.policy(object).destroy? - links << Link.new( - content: h.destroy_link_content('networks.actions.destroy'), - href: h.referential_network_path(context[:referential], object), - method: :delete, - data: { confirm: t('networks.actions.destroy_confirm') } - ) - end + if h.policy(object).destroy? + links << Link.new( + content: h.destroy_link_content('networks.actions.destroy'), + href: h.referential_network_path(context[:referential], object), + method: :delete, + data: { confirm: t('networks.actions.destroy_confirm') } + ) + end - links - end + links end end
\ No newline at end of file diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb index 86be39d70..f4c9b3800 100644 --- a/app/models/chouette/stop_point.rb +++ b/app/models/chouette/stop_point.rb @@ -2,7 +2,7 @@ module Chouette class StopPoint < Chouette::TridentActiveRecord def self.policy_class - Chouette::RoutePolicy + RoutePolicy end include ForBoardingEnumerations |
