aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLuc Donnet2018-01-02 11:55:02 +0100
committerGitHub2018-01-02 11:55:02 +0100
commitab48fee5d8540e839a29abb9c196303ff7a2e9af (patch)
treecd024143cce12aa6b3e50eebdf00b2cb48407924 /app
parent7c6522fe4d0d4522a3d192fb0a0439eb92668b52 (diff)
parent25e039b3de2b45526b233c3ef4d95bb4c9f40a18 (diff)
downloadchouette-core-ab48fee5d8540e839a29abb9c196303ff7a2e9af.tar.bz2
Merge pull request #186 from af83/5102-begin_of_association_chain
5102 Use current_organisation as begin_of_association_chain
Diffstat (limited to 'app')
-rw-r--r--app/controllers/companies_controller.rb4
-rw-r--r--app/controllers/group_of_lines_controller.rb5
-rw-r--r--app/controllers/lines_controller.rb4
-rw-r--r--app/controllers/networks_controller.rb4
-rw-r--r--app/views/lines/index.html.slim2
5 files changed, 17 insertions, 2 deletions
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index 931d846c5..f84252920 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -61,6 +61,10 @@ class CompaniesController < ChouetteController
alias_method :current_referential, :line_referential
helper_method :current_referential
+ def begin_of_association_chain
+ current_organisation
+ end
+
def company_params
params.require(:company).permit( :objectid, :object_version, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone )
end
diff --git a/app/controllers/group_of_lines_controller.rb b/app/controllers/group_of_lines_controller.rb
index 5762108dc..46d9d077f 100644
--- a/app/controllers/group_of_lines_controller.rb
+++ b/app/controllers/group_of_lines_controller.rb
@@ -42,7 +42,6 @@ class GroupOfLinesController < ChouetteController
end
end
-
protected
def filtered_group_of_lines_maps
@@ -70,6 +69,10 @@ class GroupOfLinesController < ChouetteController
alias_method :line_referential, :parent
+ def begin_of_association_chain
+ current_organisation
+ end
+
private
def group_of_line_params
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb
index f446e1d37..7041a3a26 100644
--- a/app/controllers/lines_controller.rb
+++ b/app/controllers/lines_controller.rb
@@ -114,6 +114,10 @@ class LinesController < ChouetteController
alias_method :current_referential, :line_referential
helper_method :current_referential
+ def begin_of_association_chain
+ current_organisation
+ end
+
def line_params
params.require(:line).permit(
:transport_mode,
diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb
index 494d1e69f..79a5eb97b 100644
--- a/app/controllers/networks_controller.rb
+++ b/app/controllers/networks_controller.rb
@@ -71,6 +71,10 @@ class NetworksController < ChouetteController
alias_method :current_referential, :line_referential
helper_method :current_referential
+ def begin_of_association_chain
+ current_organisation
+ end
+
def network_params
params.require(:network).permit(:objectid, :object_version, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment )
end
diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim
index e94837ed5..b62263263 100644
--- a/app/views/lines/index.html.slim
+++ b/app/views/lines/index.html.slim
@@ -1,6 +1,6 @@
- breadcrumb :lines, @line_referential
- content_for :page_header_actions do
- - if (policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation))
+ - if policy(Chouette::Line).create?
= link_to(t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'btn btn-primary')
.page_content