aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/calendars_controller.rb46
-rw-r--r--app/decorators/calendar_decorator.rb2
-rw-r--r--app/decorators/company_decorator.rb19
-rw-r--r--app/decorators/compliance_control_decorator.rb18
-rw-r--r--app/decorators/import_decorator.rb7
-rw-r--r--app/decorators/line_decorator.rb10
-rw-r--r--app/decorators/network_decorator.rb14
-rw-r--r--app/decorators/purchase_window_decorator.rb18
-rw-r--r--app/decorators/referential_line_decorator.rb10
-rw-r--r--app/decorators/referential_network_decorator.rb21
-rw-r--r--app/decorators/route_decorator.rb29
-rw-r--r--app/decorators/routing_constraint_zone_decorator.rb39
-rw-r--r--app/decorators/stop_area_decorator.rb22
-rw-r--r--app/helpers/table_builder_helper.rb9
-rw-r--r--app/helpers/table_builder_helper/custom_links.rb7
-rw-r--r--app/helpers/table_builder_helper/url.rb3
-rw-r--r--app/models/calendar.rb3
-rw-r--r--app/models/concerns/timetable_support.rb1
-rw-r--r--app/models/workgroup.rb1
-rw-r--r--app/views/calendar_mailer/created.html.slim4
-rw-r--r--app/views/calendar_mailer/updated.html.slim2
-rw-r--r--app/views/calendars/_filters.html.slim4
-rw-r--r--app/views/calendars/_form_simple.html.slim2
-rw-r--r--app/views/calendars/edit.html.slim2
-rw-r--r--app/views/calendars/index.html.slim4
-rw-r--r--app/views/calendars/new.html.slim2
-rw-r--r--app/views/calendars/show.html.slim2
-rw-r--r--app/views/dashboards/_dashboard.html.slim6
-rw-r--r--app/views/errors/forbidden.html.slim2
-rw-r--r--app/views/errors/server_error.html.slim2
-rw-r--r--app/views/layouts/navigation/_main_nav_left_content_stif.html.slim2
-rw-r--r--app/views/stif/dashboards/_dashboard.html.slim4
32 files changed, 109 insertions, 208 deletions
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb
index 5cc7912b7..75d4cbd09 100644
--- a/app/controllers/calendars_controller.rb
+++ b/app/controllers/calendars_controller.rb
@@ -8,14 +8,21 @@ class CalendarsController < ChouetteController
respond_to :json, only: :show
respond_to :js, only: :index
+ belongs_to :workgroup
+
def index
index! do
- @calendars = CalendarDecorator.decorate(@calendars)
+ @calendars = decorate_calendars(@calendars)
end
end
def show
- @year = params[:year] ? params[:year].to_i : Date.today.cwyear
+ show! do
+ @year = params[:year] ? params[:year].to_i : Date.today.cwyear
+ @calendar = @calendar.decorate(context: {
+ workgroup: workgroup
+ })
+ end
end
def month
@@ -45,6 +52,16 @@ class CalendarsController < ChouetteController
end
private
+
+ def decorate_calendars(calendars)
+ CalendarDecorator.decorate(
+ calendars,
+ context: {
+ workgroup: workgroup
+ }
+ )
+ end
+
def calendar_params
permitted_params = [:id, :name, :short_name, :shared, periods_attributes: [:id, :begin, :end, :_destroy], date_values_attributes: [:id, :value, :_destroy]]
permitted_params << :shared if policy(Calendar).share?
@@ -60,25 +77,30 @@ class CalendarsController < ChouetteController
end
protected
+
+ alias_method :workgroup, :parent
+ helper_method :workgroup
+
def resource
- @calendar = Calendar.where('organisation_id = ? OR shared = true', current_organisation.id).find_by_id(params[:id]).decorate
+ @calendar ||= workgroup.calendars.where('(organisation_id = ? OR shared = ?)', current_organisation.id, true).find_by_id(params[:id])
end
def build_resource
super.tap do |calendar|
+ calendar.workgroup = workgroup
calendar.organisation = current_organisation
end
end
def collection
- return @calendars if @calendars
- scope = Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true)
- scope = shared_scope(scope)
- @q = scope.ransack(params[:q])
-
- calendars = @q.result
- calendars = calendars.order(sort_column + ' ' + sort_direction) if sort_column && sort_direction
- @calendars = calendars.paginate(page: params[:page])
+ @calendars ||= begin
+ scope = workgroup.calendars.where('(organisation_id = ? OR shared = ?)', current_organisation.id, true)
+ scope = shared_scope(scope)
+ @q = scope.ransack(params[:q])
+ calendars = @q.result
+ calendars = calendars.order(sort_column + ' ' + sort_direction) if sort_column && sort_direction
+ calendars = calendars.paginate(page: params[:page])
+ end
end
def ransack_contains_date
@@ -103,4 +125,4 @@ class CalendarsController < ChouetteController
scope
end
-end
+end \ No newline at end of file
diff --git a/app/decorators/calendar_decorator.rb b/app/decorators/calendar_decorator.rb
index be1f9e3bf..4c6088e8e 100644
--- a/app/decorators/calendar_decorator.rb
+++ b/app/decorators/calendar_decorator.rb
@@ -1,6 +1,6 @@
class CalendarDecorator < AF83::Decorator
decorates Calendar
-
+ set_scope { context[:workgroup] }
create_action_link
with_instance_decorator do |instance_decorator|
diff --git a/app/decorators/company_decorator.rb b/app/decorators/company_decorator.rb
index aadce68bb..5580e0d4a 100644
--- a/app/decorators/company_decorator.rb
+++ b/app/decorators/company_decorator.rb
@@ -1,34 +1,21 @@
class CompanyDecorator < AF83::Decorator
decorates Chouette::Company
+ set_scope { context[:referential] }
+
create_action_link do |l|
l.content { h.t('companies.actions.new') }
- l.href { [:new, context[:referential], :company] }
end
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href { [context[:referential], object] }
- end
+ instance_decorator.show_action_link
instance_decorator.edit_action_link do |l|
l.content {|l| l.action == "show" ? h.t('actions.edit') : h.t('companies.actions.edit') }
- l.href {
- h.edit_line_referential_company_path(
- context[:referential],
- object
- )
- }
end
instance_decorator.destroy_action_link do |l|
l.content { h.destroy_link_content('companies.actions.destroy') }
- l.href {
- h.edit_line_referential_company_path(
- context[:referential],
- object
- )
- }
l.data {{ confirm: h.t('companies.actions.destroy_confirm') }}
end
end
diff --git a/app/decorators/compliance_control_decorator.rb b/app/decorators/compliance_control_decorator.rb
index c57a7ccc7..fd2dbd9ce 100644
--- a/app/decorators/compliance_control_decorator.rb
+++ b/app/decorators/compliance_control_decorator.rb
@@ -1,6 +1,8 @@
class ComplianceControlDecorator < AF83::Decorator
decorates ComplianceControl
+ set_scope { object.compliance_control_set }
+
with_instance_decorator do |instance_decorator|
instance_decorator.show_action_link do |l|
l.content h.t('compliance_control_sets.actions.show')
@@ -12,23 +14,9 @@ class ComplianceControlDecorator < AF83::Decorator
end
end
- instance_decorator.edit_action_link do |l|
- l.href do
- h.edit_compliance_control_set_compliance_control_path(
- object.compliance_control_set_id,
- object.id
- )
- end
- end
+ instance_decorator.edit_action_link
instance_decorator.destroy_action_link do |l|
- l.content h.destroy_link_content
- l.href do
- h.compliance_control_set_compliance_control_path(
- object.compliance_control_set.id,
- object.id
- )
- end
l.data confirm: h.t('compliance_controls.actions.destroy_confirm')
end
end
diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb
index c6b1f2349..1964365ae 100644
--- a/app/decorators/import_decorator.rb
+++ b/app/decorators/import_decorator.rb
@@ -1,6 +1,8 @@
class ImportDecorator < AF83::Decorator
decorates Import
+ set_scope { context[:workbench] }
+
define_instance_method :import_status_css_class do
cls =''
cls = 'overheaded-success' if object.status == 'successful'
@@ -11,13 +13,10 @@ class ImportDecorator < AF83::Decorator
create_action_link do |l|
l.content t('imports.actions.new')
- l.href { h.new_workbench_import_path(workbench_id: context[:workbench]) }
end
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href { h.workbench_import_path(context[:workbench], object) }
- end
+ instance_decorator.show_action_link
instance_decorator.action_link secondary: :show do |l|
l.content t('imports.actions.download')
diff --git a/app/decorators/line_decorator.rb b/app/decorators/line_decorator.rb
index adeb89f70..0e7b6b9ae 100644
--- a/app/decorators/line_decorator.rb
+++ b/app/decorators/line_decorator.rb
@@ -1,9 +1,10 @@
class LineDecorator < AF83::Decorator
decorates Chouette::Line
+ set_scope { context[:line_referential] }
+
create_action_link do |l|
l.content t('lines.actions.new')
- l.href { h.new_line_referential_line_path(context[:line_referential]) }
end
with_instance_decorator do |instance_decorator|
@@ -14,18 +15,17 @@ class LineDecorator < AF83::Decorator
instance_decorator.show_action_link do |l|
l.content t('lines.actions.show')
- l.href { [context[:line_referential], object] }
end
instance_decorator.action_link secondary: :show do |l|
l.content t('lines.actions.show_network')
- l.href { [context[:line_referential], object.network] }
+ l.href { [scope, object.network] }
l.disabled { object.network.nil? }
end
instance_decorator.action_link secondary: :show do |l|
l.content t('lines.actions.show_company')
- l.href { [context[:line_referential], object.company] }
+ l.href { [scope, object.company] }
l.disabled { object.company.nil? }
end
@@ -34,7 +34,6 @@ class LineDecorator < AF83::Decorator
instance_decorator.with_condition can_edit_line do
edit_action_link do |l|
l.content {|l| l.primary? ? h.t('actions.edit') : h.t('lines.actions.edit') }
- l.href { h.edit_line_referential_line_path(context[:line_referential], object.id) }
end
action_link on: :index, secondary: :index do |l|
@@ -64,7 +63,6 @@ class LineDecorator < AF83::Decorator
instance_decorator.destroy_action_link do |l|
l.content { h.destroy_link_content('lines.actions.destroy') }
- l.href { h.line_referential_line_path(context[:line_referential], object) }
l.data confirm: h.t('lines.actions.destroy_confirm')
l.add_class "delete-action"
end
diff --git a/app/decorators/network_decorator.rb b/app/decorators/network_decorator.rb
index 90f0d0e82..ea0f73dc2 100644
--- a/app/decorators/network_decorator.rb
+++ b/app/decorators/network_decorator.rb
@@ -1,6 +1,7 @@
class NetworkDecorator < AF83::Decorator
decorates Chouette::Network
+ set_scope { context[:line_referential] }
# Action links require:
# context: {
# line_referential: ,
@@ -8,15 +9,10 @@ class NetworkDecorator < AF83::Decorator
create_action_link do |l|
l.content t('networks.actions.new')
- l.href { h.new_line_referential_network_path(context[:line_referential]) }
end
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href do
- h.line_referential_network_path(context[:line_referential], object)
- end
- end
+ instance_decorator.show_action_link
instance_decorator.action_link secondary: true, policy: :edit do |l|
l.content t('networks.actions.edit')
@@ -30,12 +26,6 @@ class NetworkDecorator < AF83::Decorator
instance_decorator.destroy_action_link do |l|
l.content h.destroy_link_content('networks.actions.destroy')
- l.href do
- h.line_referential_network_path(
- context[:line_referential],
- object
- )
- end
l.data confirm: h.t('networks.actions.destroy_confirm')
end
end
diff --git a/app/decorators/purchase_window_decorator.rb b/app/decorators/purchase_window_decorator.rb
index 54b241173..9b58577b2 100644
--- a/app/decorators/purchase_window_decorator.rb
+++ b/app/decorators/purchase_window_decorator.rb
@@ -1,32 +1,20 @@
class PurchaseWindowDecorator < AF83::Decorator
decorates Chouette::PurchaseWindow
+ set_scope { context[:referential] }
+
create_action_link do |l|
l.content t('purchase_windows.actions.new')
- l.href { h.new_referential_purchase_window_path(context[:referential]) }
end
with_instance_decorator do |instance_decorator|
instance_decorator.show_action_link do |l|
l.content t('purchase_windows.actions.show')
- l.href do
- h.referential_purchase_window_path(
- context[:referential],
- object
- )
- end
end
- instance_decorator.edit_action_link do |l|
- l.href do
- h.edit_referential_purchase_window_path(context[:referential].id, object)
- end
- end
+ instance_decorator.edit_action_link
instance_decorator.destroy_action_link do |l|
- l.href do
- h.referential_purchase_window_path(context[:referential].id, object)
- end
l.data confirm: h.t('purchase_windows.actions.destroy_confirm')
end
end
diff --git a/app/decorators/referential_line_decorator.rb b/app/decorators/referential_line_decorator.rb
index 8f884a8e0..3ac846d76 100644
--- a/app/decorators/referential_line_decorator.rb
+++ b/app/decorators/referential_line_decorator.rb
@@ -1,6 +1,8 @@
class ReferentialLineDecorator < AF83::Decorator
decorates Chouette::Line
+ set_scope { context[:referential] }
+
# Action links require:
# context: {
# referential: ,
@@ -8,9 +10,7 @@ class ReferentialLineDecorator < AF83::Decorator
# }
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href { h.referential_line_path(context[:referential], object) }
- end
+ instance_decorator.show_action_link
instance_decorator.action_link secondary: true do |l|
l.content Chouette::Line.human_attribute_name(:footnotes)
@@ -21,7 +21,7 @@ class ReferentialLineDecorator < AF83::Decorator
l.content h.t('routing_constraint_zones.index.title')
l.href do
h.referential_line_routing_constraint_zones_path(
- context[:referential],
+ scope,
object
)
end
@@ -37,7 +37,7 @@ class ReferentialLineDecorator < AF83::Decorator
secondary: true
) do |l|
l.content h.t('routes.actions.new')
- l.href { h.new_referential_line_route_path(context[:referential], object) }
+ l.href { h.new_referential_line_route_path(scope, object) }
end
end
end
diff --git a/app/decorators/referential_network_decorator.rb b/app/decorators/referential_network_decorator.rb
index ff3467188..c508452c0 100644
--- a/app/decorators/referential_network_decorator.rb
+++ b/app/decorators/referential_network_decorator.rb
@@ -1,6 +1,8 @@
class ReferentialNetworkDecorator < AF83::Decorator
decorates Chouette::Network
+ set_scope { context[:referential] }
+
# Action links require:
# context: {
# referential: ,
@@ -8,33 +10,18 @@ class ReferentialNetworkDecorator < AF83::Decorator
create_action_link do |l|
l.content t('networks.actions.new')
- l.href { h.new_referential_network_path(context[:referential]) }
end
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href { h.referential_network_path(context[:referential], object) }
- end
+ instance_decorator.show_action_link
instance_decorator.edit_action_link do |l|
l.content t('networks.actions.edit')
- l.href do
- h.edit_referential_network_path(
- context[:referential],
- object
- )
- end
end
instance_decorator.destroy_action_link do |l|
l.content h.destroy_link_content('networks.actions.destroy')
- l.href do
- h.referential_network_path(
- context[:referential],
- object
- )
- end
l.data confirm: h.t('networks.actions.destroy_confirm')
end
end
-end \ No newline at end of file
+end
diff --git a/app/decorators/route_decorator.rb b/app/decorators/route_decorator.rb
index f9870fbbe..fa6367924 100644
--- a/app/decorators/route_decorator.rb
+++ b/app/decorators/route_decorator.rb
@@ -7,26 +7,12 @@ class RouteDecorator < AF83::Decorator
# line:
# }
+ set_scope { [context[:referential], context[:line]] }
+
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href do
- h.referential_line_route_path(
- context[:referential],
- context[:line],
- object
- )
- end
- end
+ instance_decorator.show_action_link
- instance_decorator.edit_action_link do |l|
- l.href do
- h.edit_referential_line_route_path(
- context[:referential],
- context[:line],
- object
- )
- end
- end
+ instance_decorator.edit_action_link
instance_decorator.action_link(
if: ->() { object.stop_points.any? },
@@ -86,13 +72,6 @@ class RouteDecorator < AF83::Decorator
end
instance_decorator.destroy_action_link do |l|
- l.href do
- h.referential_line_route_path(
- context[:referential],
- context[:line],
- object
- )
- end
l.data confirm: h.t('routes.actions.destroy_confirm')
end
end
diff --git a/app/decorators/routing_constraint_zone_decorator.rb b/app/decorators/routing_constraint_zone_decorator.rb
index 962625fa7..de73068be 100644
--- a/app/decorators/routing_constraint_zone_decorator.rb
+++ b/app/decorators/routing_constraint_zone_decorator.rb
@@ -1,6 +1,8 @@
class RoutingConstraintZoneDecorator < AF83::Decorator
decorates Chouette::RoutingConstraintZone
+ set_scope { [context[:referential], context[:line]] }
+
# Action links require:
# context: {
# referential: ,
@@ -12,44 +14,13 @@ class RoutingConstraintZoneDecorator < AF83::Decorator
h.policy(Chouette::RoutingConstraintZone).create? &&
context[:referential].organisation == h.current_organisation
}
- ) do |l|
- l.href do
- h.new_referential_line_routing_constraint_zone_path(
- context[:referential],
- context[:line]
- )
- end
- end
+ )
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href do
- h.referential_line_routing_constraint_zone_path(
- context[:referential],
- context[:line],
- object
- )
- end
- end
-
- instance_decorator.edit_action_link do |l|
- l.href do
- h.edit_referential_line_routing_constraint_zone_path(
- context[:referential],
- context[:line],
- object
- )
- end
- end
+ instance_decorator.show_action_link
+ instance_decorator.edit_action_link
instance_decorator.destroy_action_link do |l|
- l.href do
- h.referential_line_routing_constraint_zone_path(
- context[:referential],
- context[:line],
- object
- )
- end
l.data confirm: h.t('routing_constraint_zones.actions.destroy_confirm')
end
end
diff --git a/app/decorators/stop_area_decorator.rb b/app/decorators/stop_area_decorator.rb
index 2e57da0e4..525681971 100644
--- a/app/decorators/stop_area_decorator.rb
+++ b/app/decorators/stop_area_decorator.rb
@@ -7,23 +7,11 @@ class StopAreaDecorator < AF83::Decorator
end
with_instance_decorator do |instance_decorator|
- instance_decorator.show_action_link do |l|
- l.href do
- h.stop_area_referential_stop_area_path(
- object.stop_area_referential,
- object
- )
- end
- end
+ set_scope { object.stop_area_referential }
+ instance_decorator.show_action_link
instance_decorator.edit_action_link do |l|
l.content h.t('stop_areas.actions.edit')
- l.href do
- h.edit_stop_area_referential_stop_area_path(
- object.stop_area_referential,
- object
- )
- end
end
instance_decorator.action_link policy: :deactivate, secondary: true do |l|
@@ -54,12 +42,6 @@ class StopAreaDecorator < AF83::Decorator
instance_decorator.destroy_action_link do |l|
l.content h.destroy_link_content('stop_areas.actions.destroy')
- l.href do
- h.stop_area_referential_stop_area_path(
- object.stop_area_referential,
- object
- )
- end
l.data confirm: h.t('stop_areas.actions.destroy_confirm')
end
end
diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb
index 9a255e757..2068dd23c 100644
--- a/app/helpers/table_builder_helper.rb
+++ b/app/helpers/table_builder_helper.rb
@@ -330,7 +330,7 @@ module TableBuilderHelper
else
menu = content_tag :ul, class: 'dropdown-menu' do
(
- CustomLinks.new(item, pundit_user, links, referential).links +
+ CustomLinks.new(item, pundit_user, links, referential, workgroup).links +
action_links.select { |link| link.is_a?(Link) }
).map do |link|
gear_menu_link(link)
@@ -395,7 +395,6 @@ module TableBuilderHelper
klass << link.extra_class if link.extra_class
klass << 'delete-action' if link.method == :delete
klass << 'disabled' if link.disabled
-
content_tag(
:li,
link_to(
@@ -414,4 +413,10 @@ module TableBuilderHelper
# cases, avoid a `NoMethodError`.
@__referential__ ||= try(:current_referential)
end
+
+ def workgroup
+ # Certain controllers don't define a `#current_referential`. In these
+ # cases, avoid a `NoMethodError`.
+ @__workgroup__ ||= try(:current_workgroup)
+ end
end
diff --git a/app/helpers/table_builder_helper/custom_links.rb b/app/helpers/table_builder_helper/custom_links.rb
index b1bb11f10..e09078be0 100644
--- a/app/helpers/table_builder_helper/custom_links.rb
+++ b/app/helpers/table_builder_helper/custom_links.rb
@@ -8,13 +8,14 @@ module TableBuilderHelper
unarchive: :put
}
- attr_reader :actions, :object, :user_context, :referential
+ attr_reader :actions, :object, :user_context, :referential, :workgroup
- def initialize(object, user_context, actions, referential = nil)
+ def initialize(object, user_context, actions, referential = nil, workgroup = nil)
@object = object
@user_context = user_context
@actions = actions
@referential = referential
+ @workgroup = workgroup
end
def links
@@ -34,7 +35,7 @@ module TableBuilderHelper
polymorph_url << action
end
- polymorph_url += URL.polymorphic_url_parts(object, referential)
+ polymorph_url += URL.polymorphic_url_parts(object, referential, workgroup)
end
def method_for_action(action)
diff --git a/app/helpers/table_builder_helper/url.rb b/app/helpers/table_builder_helper/url.rb
index 28f1ade76..0e3dce0aa 100644
--- a/app/helpers/table_builder_helper/url.rb
+++ b/app/helpers/table_builder_helper/url.rb
@@ -1,6 +1,6 @@
module TableBuilderHelper
class URL
- def self.polymorphic_url_parts(item, referential)
+ def self.polymorphic_url_parts(item, referential, workgroup)
polymorph_url = []
unless item.is_a?(Calendar) || item.is_a?(Referential) || item.is_a?(ComplianceControlSet)
@@ -20,6 +20,7 @@ module TableBuilderHelper
end
end
else
+ polymorph_url << item.workgroup if item.respond_to? :workgroup
polymorph_url << item
end
diff --git a/app/models/calendar.rb b/app/models/calendar.rb
index 561a2e3f7..84b569ab4 100644
--- a/app/models/calendar.rb
+++ b/app/models/calendar.rb
@@ -10,8 +10,9 @@ class Calendar < ActiveRecord::Base
has_paper_trail class_name: 'PublicVersion'
belongs_to :organisation
+ belongs_to :workgroup
- validates_presence_of :name, :short_name, :organisation
+ validates_presence_of :name, :short_name, :organisation, :workgroup
validates_uniqueness_of :short_name
has_many :time_tables
diff --git a/app/models/concerns/timetable_support.rb b/app/models/concerns/timetable_support.rb
index d2bc99d51..5242abc33 100644
--- a/app/models/concerns/timetable_support.rb
+++ b/app/models/concerns/timetable_support.rb
@@ -100,6 +100,7 @@ module TimetableSupport
period.period_start = Date.parse(item['period_start'])
period.period_end = Date.parse(item['period_end'])
+
period.save if period.is_a?(ActiveRecord::Base) && period.changed?
item['id'] = period.id
diff --git a/app/models/workgroup.rb b/app/models/workgroup.rb
index 3d761e81f..3af20ae23 100644
--- a/app/models/workgroup.rb
+++ b/app/models/workgroup.rb
@@ -3,6 +3,7 @@ class Workgroup < ActiveRecord::Base
belongs_to :stop_area_referential
has_many :workbenches
+ has_many :calendars
has_many :organisations, through: :workbenches
has_many :referentials, through: :workbenches
diff --git a/app/views/calendar_mailer/created.html.slim b/app/views/calendar_mailer/created.html.slim
index 37b2a86ea..bee071150 100644
--- a/app/views/calendar_mailer/created.html.slim
+++ b/app/views/calendar_mailer/created.html.slim
@@ -1,4 +1,4 @@
-div = t('mailers.calendar_mailer.created.body', cal_name: @calendar.name, cal_index_url: calendars_url)
+div = t('mailers.calendar_mailer.created.body', cal_name: @calendar.name, cal_index_url: workgroup_calendars_url(@calendar.workgroup))
table style="border-collapse:collapse;font-family:'Open Sans', Arial, sans serif;width:550px;margin:0px auto;color:#333333;"
@@ -16,7 +16,7 @@ table style="border-collapse:collapse;font-family:'Open Sans', Arial, sans serif
= t('mailers.calendar_mailer.updated.subject')
p style="font-size:14px;margin:0px 0px 10px 0px;"
- = t('mailers.calendar_mailer.created.body', cal_name: @calendar.name, cal_index_url: calendars_url).html_safe
+ = t('mailers.calendar_mailer.created.body', cal_name: @calendar.name, cal_index_url: workgroup_calendars_url(@calendar.workgroup)).html_safe
tr
td style="text-align:center;padding:20px 0 0 0;border-top:1px solid #007fbb;"
diff --git a/app/views/calendar_mailer/updated.html.slim b/app/views/calendar_mailer/updated.html.slim
index bf128439a..0bdc2e7db 100644
--- a/app/views/calendar_mailer/updated.html.slim
+++ b/app/views/calendar_mailer/updated.html.slim
@@ -14,7 +14,7 @@ table style="border-collapse:collapse;font-family:'Open Sans', Arial, sans serif
= t('mailers.calendar_mailer.updated.subject')
p style="font-size:14px;margin:0px 0px 10px 0px;"
- = t('mailers.calendar_mailer.updated.body', cal_name: @calendar.name, cal_index_url: calendars_url).html_safe
+ = t('mailers.calendar_mailer.updated.body', cal_name: @calendar.name, cal_index_url: workgroup_calendars_url(@calendar.workgroup)).html_safe
tr
td style="text-align:center;padding:20px 0 0 0;border-top:1px solid #007fbb;"
diff --git a/app/views/calendars/_filters.html.slim b/app/views/calendars/_filters.html.slim
index d9c936b64..35441b053 100644
--- a/app/views/calendars/_filters.html.slim
+++ b/app/views/calendars/_filters.html.slim
@@ -1,4 +1,4 @@
-= search_form_for @q, url: calendars_path, builder: SimpleForm::FormBuilder, html: { method: :get, class: 'form form-filter' } do |f|
+= search_form_for @q, url: workgroup_calendars_path(current_workgroup), builder: SimpleForm::FormBuilder, html: { method: :get, class: 'form form-filter' } do |f|
.ffg-row
.input-group.search_bar class=filter_item_class(params[:q], :name_or_short_name_cont)
= f.search_field :name_or_short_name_cont, class: 'form-control', placeholder: 'Indiquez un nom/nom court de calendrier...'
@@ -18,5 +18,5 @@
= f.input :contains_date, as: :date, label: false, wrapper_html: { class: 'date smart_date' }, class: 'form-control', include_blank: true
.actions
- = link_to 'Effacer', calendars_path, class: 'btn btn-link'
+ = link_to 'Effacer', workgroup_calendars_path(current_workgroup), class: 'btn btn-link'
= f.submit 'Filtrer', id: 'calendar_filter_btn', class: 'btn btn-default'
diff --git a/app/views/calendars/_form_simple.html.slim b/app/views/calendars/_form_simple.html.slim
index 2f469ada7..ba18c765b 100644
--- a/app/views/calendars/_form_simple.html.slim
+++ b/app/views/calendars/_form_simple.html.slim
@@ -1,6 +1,6 @@
.row
.col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1
- = simple_form_for @calendar, html: { class: 'form-horizontal', id: 'calendar_form' }, wrapper: :horizontal_form do |f|
+ = simple_form_for [@workgroup, @calendar], html: { class: 'form-horizontal', id: 'calendar_form' }, wrapper: :horizontal_form do |f|
.row
.col-lg-12
= f.input :name
diff --git a/app/views/calendars/edit.html.slim b/app/views/calendars/edit.html.slim
index e64790daf..79ab1f5d0 100644
--- a/app/views/calendars/edit.html.slim
+++ b/app/views/calendars/edit.html.slim
@@ -1,4 +1,4 @@
-- breadcrumb :calendar, @calendar
+- breadcrumb :calendar, @workgroup, @calendar
- page_header_content_for @calendar
.page_content
.container-fluid
diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim
index 92c24be5b..0b58c0c72 100644
--- a/app/views/calendars/index.html.slim
+++ b/app/views/calendars/index.html.slim
@@ -1,4 +1,4 @@
-- breadcrumb :calendars
+- breadcrumb :calendars, workgroup
.page_content
.container-fluid
@@ -16,7 +16,7 @@
key: :name, \
attribute: 'name', \
link_to: lambda do |calendar| \
- calendar_path(calendar) \
+ workgroup_calendar_path(workgroup, calendar) \
end \
), \
TableBuilderHelper::Column.new( \
diff --git a/app/views/calendars/new.html.slim b/app/views/calendars/new.html.slim
index b3840b705..5657a0c55 100644
--- a/app/views/calendars/new.html.slim
+++ b/app/views/calendars/new.html.slim
@@ -1,4 +1,4 @@
-- breadcrumb :calendars
+- breadcrumb :calendars, @workgroup
.page_content
.container-fluid
= render 'form_simple'
diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim
index ec53be0ef..cec4f66a5 100644
--- a/app/views/calendars/show.html.slim
+++ b/app/views/calendars/show.html.slim
@@ -1,4 +1,4 @@
-- breadcrumb :calendar, @calendar
+- breadcrumb :calendar, @workgroup, @calendar
- page_header_content_for @calendar
.page_content
diff --git a/app/views/dashboards/_dashboard.html.slim b/app/views/dashboards/_dashboard.html.slim
index 075b94ddc..58cfcc542 100644
--- a/app/views/dashboards/_dashboard.html.slim
+++ b/app/views/dashboards/_dashboard.html.slim
@@ -22,13 +22,13 @@
.panel.panel-default
.panel-heading
h3.panel-title.with_actions
- = link_to I18n.t("activerecord.models.calendar", count: @dashboard.current_organisation.calendars.size), calendars_path
+ = link_to I18n.t("activerecord.models.calendar", count: @dashboard.current_organisation.calendars.size), workgroup_calendars_path(current_workgroup)
div
- = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right'
+ = link_to '', workgroup_calendars_path(current_workgroup), class: ' fa fa-chevron-right pull-right'
- if @dashboard.current_organisation.calendars.present?
.list-group
- @dashboard.current_organisation.calendars.order("updated_at desc").limit(5).each do |calendar|
- = link_to calendar.name, calendar_path(calendar), class: 'list-group-item'
+ = link_to calendar.name, workgroup_calendars_path(current_workgroup, calendar), class: 'list-group-item'
- else
.panel-body
em.small.text-muted
diff --git a/app/views/errors/forbidden.html.slim b/app/views/errors/forbidden.html.slim
index 23ea67eff..8c35b46a8 100644
--- a/app/views/errors/forbidden.html.slim
+++ b/app/views/errors/forbidden.html.slim
@@ -9,7 +9,7 @@
p
strong = "Désolé, la page demandée la page n'est pas accessible avec votre profil utilisateur."
- p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO."
+ p = "Vous pouvez néanmoins continuer à utiliser l'application."
- else
p
diff --git a/app/views/errors/server_error.html.slim b/app/views/errors/server_error.html.slim
index 189a48760..529ad73e8 100644
--- a/app/views/errors/server_error.html.slim
+++ b/app/views/errors/server_error.html.slim
@@ -9,7 +9,7 @@
p
strong = "Désolé, une erreur est survenue."
- p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO."
+ p = "Vous pouvez néanmoins continuer à utiliser l'application."
- else
p
diff --git a/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim b/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim
index 3963d4cd4..1b7293d21 100644
--- a/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim
+++ b/app/views/layouts/navigation/_main_nav_left_content_stif.html.slim
@@ -29,7 +29,7 @@
span Jeux de données
= link_to workbench_imports_path(current_offer_workbench), class: "list-group-item #{(params[:controller] == 'imports') ? 'active' : ''}" do
span Import
- = link_to calendars_path, class: 'list-group-item' do
+ = link_to workgroup_calendars_path(current_workgroup), class: 'list-group-item' do
span Modèles de calendrier
= link_to workbench_compliance_check_sets_path(current_offer_workbench), class: 'list-group-item' do
span Rapport de contrôle
diff --git a/app/views/stif/dashboards/_dashboard.html.slim b/app/views/stif/dashboards/_dashboard.html.slim
index 64e7d4f96..c28696a94 100644
--- a/app/views/stif/dashboards/_dashboard.html.slim
+++ b/app/views/stif/dashboards/_dashboard.html.slim
@@ -60,12 +60,12 @@
span.badge.ml-xs = @dashboard.calendars.count if @dashboard.calendars.present?
div
- = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right', title: t('.see')
+ = link_to '', workgroup_calendars_path(current_workgroup), class: ' fa fa-chevron-right pull-right', title: t('.see')
- if @dashboard.calendars.present?
.list-group
- @dashboard.calendars.first(5).each_with_index do |calendar, i|
- = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' if i < 6
+ = link_to calendar.name, workgroup_calendar_path(current_workgroup, calendar), class: 'list-group-item' if i < 6
- else
.panel-body