diff options
| author | Zog | 2017-12-20 12:58:20 +0100 | 
|---|---|---|
| committer | Alban Peignier | 2017-12-21 21:19:27 +0100 | 
| commit | 9a34cb48f49df574ae1e7c599713ed246e2938cf (patch) | |
| tree | 49c91cfdaa645f39363c3e8c492b86a0dde08c89 /app/policies | |
| parent | 8cd9b9ee5fc127b2f39a9c89c71327ab8d5e9cec (diff) | |
| download | chouette-core-9a34cb48f49df574ae1e7c599713ed246e2938cf.tar.bz2 | |
Refs #5430 @2h; Deactivate lines instead of destroying them
- Add `activate` and `deactivate` actions in `LinesController`, as well
as corresponding routes
- Add `activate!` and `deactivate!` methods in `Chouette::Line`, as well
as `activated?`
- Add `activate?` and `deactivate?` permissions in `LinePolicy`
- Add corresponding `action_links`in the Decorator
- Create helper for these actions
- Add an optional `'extra_class` to the Links
- Update styles for ".delete-action" to handle the case where there are
several
- Add I18n keys accordingly
Diffstat (limited to 'app/policies')
| -rw-r--r-- | app/policies/line_policy.rb | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/app/policies/line_policy.rb b/app/policies/line_policy.rb index 67ea0b611..e5674fbe2 100644 --- a/app/policies/line_policy.rb +++ b/app/policies/line_policy.rb @@ -14,6 +14,14 @@ class LinePolicy < ApplicationPolicy      user.has_permission?('lines.destroy')    end +  def deactivate? +    !record.deactivated? && user.has_permission?('lines.change_status') +  end + +  def activate? +    record.deactivated? && user.has_permission?('lines.change_status') +  end +    def update?      user.has_permission?('lines.update')    end | 
