diff options
| author | Robert | 2017-09-11 09:41:03 +0200 | 
|---|---|---|
| committer | Robert | 2017-09-11 17:15:49 +0200 | 
| commit | f7bc874de79ff9a68aa03523cf653407663e7c55 (patch) | |
| tree | 1716586822ad9b9912e44f658193e5c1aea04e88 /app/decorators | |
| parent | 003c4689248673fbc8922a107475caa9e059bcab (diff) | |
| download | chouette-core-f7bc874de79ff9a68aa03523cf653407663e7c55.tar.bz2 | |
Fixes #4189@4h Route Duplication
* Duplication of Route is triggered by link and UI forwarded to edit of duplicatee
     - Changing route, only POST duplicate_referential_line_route --> RoutesController#duplicate
     - Removing route       GET  duplicate_referential_line_route --> RoutesController#duplicate
     - Removing controller action RoutesController#post_duplicate
* Link in Route Decorator depends on new policy RoutePolicy#decorate?
* Adapting specs
Diffstat (limited to 'app/decorators')
| -rw-r--r-- | app/decorators/route_decorator.rb | 12 | 
1 files changed, 12 insertions, 0 deletions
diff --git a/app/decorators/route_decorator.rb b/app/decorators/route_decorator.rb index 484c3db04..46cb6cd5f 100644 --- a/app/decorators/route_decorator.rb +++ b/app/decorators/route_decorator.rb @@ -58,6 +58,18 @@ class RouteDecorator < Draper::Decorator        )      end +    if h.policy(object).duplicate? +      links << Link.new( +        content: h.t('routes.duplicate.title'), +        href: h.duplicate_referential_line_route_path( +          context[:referential], +          context[:line], +          object +        ), +        method: :post +      ) +    end +      links    end  end  | 
