aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorLuc Donnet2017-07-25 22:15:35 +0200
committerLuc Donnet2017-07-25 22:15:35 +0200
commitcbfe9501f2d2cfc38cbe6ac12180e372dd78eca7 (patch)
treedbe70647c87af0d779dbba06e20d0f0c2b4a294a /app
parentea3ad8d1f9db76e3d2dfc5f96c930af8db074690 (diff)
parentcada0f02d732dce25492d7f7eb6d6232d56188dd (diff)
downloadchouette-core-cbfe9501f2d2cfc38cbe6ac12180e372dd78eca7.tar.bz2
Merge branch 'master' into staging
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/cleanup.coffee11
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js2
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js4
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js7
-rw-r--r--app/assets/stylesheets/_layout.sass10
-rw-r--r--app/assets/stylesheets/components/_panels.sass22
-rw-r--r--app/assets/stylesheets/components/_select2.sass4
-rw-r--r--app/assets/stylesheets/old_application.sass.erb62
-rw-r--r--app/controllers/companies_controller.rb23
-rw-r--r--app/controllers/networks_controller.rb23
-rw-r--r--app/controllers/referential_companies_controller.rb23
-rw-r--r--app/controllers/referential_networks_controller.rb23
-rw-r--r--app/controllers/referentials_controller.rb4
-rw-r--r--app/controllers/time_tables_controller.rb29
-rw-r--r--app/controllers/workbenches_controller.rb9
-rw-r--r--app/helpers/breadcrumb_helper.rb8
-rw-r--r--app/jobs/mailer_job.rb2
-rw-r--r--app/mailers/calendar_mailer.rb10
-rw-r--r--app/models/calendar_observer.rb4
-rw-r--r--app/models/chouette/line.rb2
-rw-r--r--app/models/chouette/stif_codifligne_objectid.rb18
-rw-r--r--app/models/chouette/stif_reflex_objectid.rb18
-rw-r--r--app/models/chouette/stop_area.rb17
-rw-r--r--app/models/chouette/stop_point.rb4
-rw-r--r--app/models/chouette/time_table.rb90
-rw-r--r--app/models/chouette/vehicle_journey.rb13
-rw-r--r--app/models/chouette/vehicle_journey_at_stop.rb37
-rw-r--r--app/models/clean_up.rb2
-rw-r--r--app/models/concerns/default_attributes_support.rb3
-rw-r--r--app/models/concerns/stif_codifligne_attributes_support.rb21
-rw-r--r--app/models/concerns/stif_reflex_attributes_support.rb21
-rw-r--r--app/models/referential.rb6
-rw-r--r--app/models/user.rb27
-rw-r--r--app/policies/login_policy.rb2
-rw-r--r--app/policies/referential_policy.rb6
-rw-r--r--app/views/compliance_checks/detailed_errors_index.csv.slim2
-rw-r--r--app/views/compliance_checks/summary_errors_index.csv.slim2
-rw-r--r--app/views/layouts/navigation/_main_nav_left.html.slim2
-rw-r--r--app/views/referential_stop_areas/index.html.slim2
-rw-r--r--app/views/referentials/show.html.slim8
-rw-r--r--app/views/stop_area_copies/new.html.slim2
-rw-r--r--app/views/time_tables/_filter.html.slim4
-rw-r--r--app/views/time_tables/time_tables.json.rabl2
-rw-r--r--app/views/workbenches/index.html.slim67
-rw-r--r--app/views/workbenches/show.html.slim2
45 files changed, 452 insertions, 208 deletions
diff --git a/app/assets/javascripts/cleanup.coffee b/app/assets/javascripts/cleanup.coffee
index 7e291aa9e..41aa1ff15 100644
--- a/app/assets/javascripts/cleanup.coffee
+++ b/app/assets/javascripts/cleanup.coffee
@@ -4,11 +4,16 @@ $(document).on("change", 'input[name="clean_up[date_type]"]', (e) ->
if type == 'before'
end_date.hide()
- $("label[for='clean_up_begin_date_3i']").html("Date de fin de la purge");
+ $('label.begin_date').addClass 'hidden'
+ $('label.end_date').removeClass 'hidden'
+
else if type == 'after'
end_date.hide()
- $("label[for='clean_up_begin_date_3i']").html("Date de début de la purge");
+ $('label.begin_date').removeClass 'hidden'
+ $('label.end_date').addClass 'hidden'
+
else
- $("label[for='clean_up_begin_date_3i']").html("Date de début de la purge");
+ $('label.begin_date').removeClass 'hidden'
+ $('label.end_date').addClass 'hidden'
end_date.show()
)
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js
index a6b8dcfa1..d277be003 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js
@@ -51,7 +51,7 @@ class BSelect4 extends React.Component{
},
cache: true
},
- minimumInputLength: 3,
+ minimumInputLength: 1,
templateResult: formatRepo
}}
/>
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js
index b3df767ab..c04a1d642 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js
@@ -43,14 +43,14 @@ class BSelect4 extends React.Component{
item => _.assign(
{},
item,
- { text: '<small><em>Nom: </em></small>' + item.published_name + '<br/><small><em>Code: </em></small>' + item.registration_number + '<br/><small><em>ID: </em></small>' + _.last(_.split(item.object_id, ':')) }
+ { text: "<strong>" + item.published_name + _.last(_.split(item.object_id, ':')) + "</strong><br/><small>" + item.registration_number + "</small>" }
)
)
};
},
cache: true
},
- minimumInputLength: 0,
+ minimumInputLength: 1,
escapeMarkup: function (markup) { return markup; },
templateResult: formatRepo
}}
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
index b236e7d94..3e81290f5 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
@@ -2,6 +2,7 @@ var _ = require('lodash')
var React = require('react')
var PropTypes = require('react').PropTypes
var Select2 = require('react-select2')
+var actions = require('../../../actions')
// get JSON full path
var origin = window.location.origin
@@ -37,20 +38,20 @@ class BSelect4 extends React.Component{
};
},
processResults: function(data, params) {
-
return {
results: data.map(
item => _.assign(
{},
item,
- {text: item.comment}
+ {text: '<strong>' + (item.color ? "<span class='fa fa-circle' style='color:" + item.color + "'></span> " : '') + item.comment + ' - ' + item.short_id + '</strong><br/><small>' + item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') + '</small>'}
)
)
};
},
cache: true
},
- minimumInputLength: 3,
+ minimumInputLength: 1,
+ escapeMarkup: function (markup) { return markup; },
templateResult: formatRepo
}}
/>
diff --git a/app/assets/stylesheets/_layout.sass b/app/assets/stylesheets/_layout.sass
index c19d9b054..b6b91b2a5 100644
--- a/app/assets/stylesheets/_layout.sass
+++ b/app/assets/stylesheets/_layout.sass
@@ -28,3 +28,13 @@ body
// width: 75%
border-bottom: 1px solid rgba($blue, 0.5)
margin: 30px auto 45px auto
+
+.content_header
+ font-size: 2.2rem
+ font-weight: normal
+ margin: 40px 0
+ padding: 0px 15px 9px 15px
+ border-bottom: 1px solid #eee
+
+ &:first-child
+ margin-top: 0
diff --git a/app/assets/stylesheets/components/_panels.sass b/app/assets/stylesheets/components/_panels.sass
index ff384faf9..e9f615081 100644
--- a/app/assets/stylesheets/components/_panels.sass
+++ b/app/assets/stylesheets/components/_panels.sass
@@ -17,9 +17,31 @@
border-bottom: 2px solid $darkgrey
padding: 5px 15px
+ .badge
+ color: #fff
+ background-color: $grey
+
> h3, > h4
margin: 0
+ > .panel-title.with_actions
+ display: table
+ width: 100%
+
+ .badge
+ vertical-align: top
+
+ a
+ text-decoration: none
+ color: $blue
+
+ &:hover, &:focus
+ color: $darkblue
+
+ > div
+ display: table-cell
+ vertical-align: middle
+
.panel-footer
padding: 5px 15px
background-color: transparent
diff --git a/app/assets/stylesheets/components/_select2.sass b/app/assets/stylesheets/components/_select2.sass
index 960e8b10b..332af16cd 100644
--- a/app/assets/stylesheets/components/_select2.sass
+++ b/app/assets/stylesheets/components/_select2.sass
@@ -7,6 +7,10 @@
// .select2-results__message, .loading-results
// display: none
+.select2-container, .select2-container--bootstrap
+ .select2-selection--single .select2-selection__rendered
+ height: 100%
+
.select2-selection__placeholder
color: rgba($grey, 0.65)
font-style: italic
diff --git a/app/assets/stylesheets/old_application.sass.erb b/app/assets/stylesheets/old_application.sass.erb
deleted file mode 100644
index 3443a035d..000000000
--- a/app/assets/stylesheets/old_application.sass.erb
+++ /dev/null
@@ -1,62 +0,0 @@
-// First import journal variables
-$brand-primary: <%= ChouetteIhm::Application.config.company_theme %>
-$navbar-default-bg: $brand-primary
-$navbar-default-link-color: white
-$body-bg: #eee
-
-// Then bootstrap itself
-@import 'bootstrap-sass-official/_bootstrap-sprockets.scss'
-@import 'bootstrap-sass-official'
-
-// Whatever application styles you have go last
-// Modules and Variables
-@import 'modules/search'
-@import 'modules/index_item'
-@import 'modules/icons'
-@import 'modules/devise'
-@import 'modules/progress_bars'
-
-// Partials
-@import 'partials/base'
-@import 'partials/header'
-@import 'partials/footer'
-
-// Third-party
-@import 'tagmanager/tagmanager'
-@import 'font-awesome-sprockets'
-@import 'font-awesome'
-@import 'jquery-ui'
-@import 'formtastic'
-@import 'eonasdan-bootstrap-datetimepicker'
-@import 'footable'
-@import 'OpenLayers/ol'
-@import 'OpenLayers/custom'
-
-// Select2, themed w. Bootstrap
-@import 'select2'
-@import 'select2-bootstrap'
-
-@import 'vendor/openlayers_style'
-@import 'vendor/openlayers_ie6-style'
-@import 'vendor/openlayers_google'
-@import 'vendor/openlayers_framedCloud'
-@import 'vendor/formtastic_changes'
-@import 'vendor/pagination'
-@import 'vendor/map_layers'
-@import 'vendor/token-input'
-@import 'vendor/typeahead'
-@import 'vendor/bootstrap_changes'
-@import 'vendor/simple_form'
-// Select2
-@import 'vendor/select2'
-@import 'vendor/select2-bootstrap'
-
-// Main css
-@import 'main/*'
-
-// Components
-@import 'components/*'
-
-// Hack to make li simple
-li
- list-style: none
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index 07a732fc9..cf27c39cf 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -16,14 +16,13 @@ class CompaniesController < BreadcrumbController
redirect_to params.merge(:page => 1)
end
- @companies = ModelDecorator.decorate(
- @companies,
- with: CompanyDecorator,
- context: {
- referential: line_referential
- }
- )
+ @companies = decorate_companies(@companies)
}
+
+ format.json {
+ @companies = decorate_companies(@companies)
+ }
+
build_breadcrumb :index
end
end
@@ -77,4 +76,14 @@ class CompaniesController < BreadcrumbController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_companies(companies)
+ ModelDecorator.decorate(
+ companies,
+ with: CompanyDecorator,
+ context: {
+ referential: line_referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb
index d1f83340e..5dae1ba3f 100644
--- a/app/controllers/networks_controller.rb
+++ b/app/controllers/networks_controller.rb
@@ -37,14 +37,13 @@ class NetworksController < BreadcrumbController
redirect_to params.merge(:page => 1)
end
- @networks = ModelDecorator.decorate(
- @networks,
- with: NetworkDecorator,
- context: {
- line_referential: line_referential
- }
- )
+ @networks = decorate_networks(@networks)
}
+
+ format.js {
+ @networks = decorate_networks(@networks)
+ }
+
build_breadcrumb :index
end
end
@@ -87,4 +86,14 @@ class NetworksController < BreadcrumbController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_networks(networks)
+ ModelDecorator.decorate(
+ networks,
+ with: NetworkDecorator,
+ context: {
+ line_referential: line_referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb
index 53dde93bb..482f74ea0 100644
--- a/app/controllers/referential_companies_controller.rb
+++ b/app/controllers/referential_companies_controller.rb
@@ -14,14 +14,13 @@ class ReferentialCompaniesController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @companies = ModelDecorator.decorate(
- @companies,
- with: CompanyDecorator,
- context: {
- referential: referential
- }
- )
+ @companies = decorate_companies(@companies)
}
+
+ format.js {
+ @companies = decorate_companies(@companies)
+ }
+
build_breadcrumb :index
end
end
@@ -70,4 +69,14 @@ class ReferentialCompaniesController < ChouetteController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_companies(companies)
+ ModelDecorator.decorate(
+ companies,
+ with: CompanyDecorator,
+ context: {
+ referential: referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/referential_networks_controller.rb b/app/controllers/referential_networks_controller.rb
index e0ce71ce4..ee2db8008 100644
--- a/app/controllers/referential_networks_controller.rb
+++ b/app/controllers/referential_networks_controller.rb
@@ -30,14 +30,13 @@ class ReferentialNetworksController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @networks = ModelDecorator.decorate(
- @networks,
- with: ReferentialNetworkDecorator,
- context: {
- referential: referential
- }
- )
+ @networks = decorate_networks(@networks)
}
+
+ format.js {
+ @networks = decorate_networks(@networks)
+ }
+
build_breadcrumb :index
end
end
@@ -81,4 +80,14 @@ class ReferentialNetworksController < ChouetteController
%w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
end
+ def decorate_networks(networks)
+ ModelDecorator.decorate(
+ networks,
+ with: ReferentialNetworkDecorator,
+ context: {
+ referential: referential
+ }
+ )
+ end
+
end
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 838c46168..afd376092 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -9,7 +9,7 @@ class ReferentialsController < BreadcrumbController
def new
if params[:from]
source_referential = Referential.find(params[:from])
- @referential = Referential.new_from(source_referential, organisation: current_organisation)
+ @referential = Referential.new_from(source_referential)
end
new! do
@@ -118,7 +118,7 @@ class ReferentialsController < BreadcrumbController
end
def create_resource(referential)
- referential.organisation = current_organisation unless referential.created_from
+ referential.organisation = current_organisation
referential.ready = true
super
end
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index 20d500ea9..0054963c9 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -35,9 +35,9 @@ class TimeTablesController < ChouetteController
def create
tt_params = time_table_params
- if tt_params[:calendar_id]
+ if tt_params[:calendar_id] && tt_params[:calendar_id] != ""
%i(monday tuesday wednesday thursday friday saturday sunday).map { |d| tt_params[d] = true }
- calendar = current_organisation.calendars.find_by_id(tt_params[:calendar_id])
+ calendar = Calendar.find(tt_params[:calendar_id])
tt_params[:calendar_id] = nil if tt_params.has_key?(:dates_attributes) || tt_params.has_key?(:periods_attributes)
end
@@ -86,16 +86,14 @@ class TimeTablesController < ChouetteController
redirect_to params.merge(:page => 1)
end
- @time_tables = ModelDecorator.decorate(
- @time_tables,
- with: TimeTableDecorator,
- context: {
- referential: @referential
- }
- )
+ @time_tables = decorate_time_tables(@time_tables)
build_breadcrumb :index
}
+
+ format.js {
+ @time_tables = decorate_time_tables(@time_tables)
+ }
end
end
@@ -117,7 +115,8 @@ class TimeTablesController < ChouetteController
end
def tags
- @tags = ActsAsTaggableOn::Tag.where("tags.name = ?", "%#{params[:tag]}%")
+ # @tags = ActsAsTaggableOn::Tag.where("tags.name = ?", "%#{params[:tag]}%")
+ @tags = Chouette::TimeTable.tags_on(:tags)
respond_to do |format|
format.json { render :json => @tags.map{|t| {:id => t.id, :name => t.name }} }
end
@@ -195,6 +194,16 @@ class TimeTablesController < ChouetteController
Chouette::TimeTable.find(from_id) if from_id
end
+ def decorate_time_tables(time_tables)
+ ModelDecorator.decorate(
+ time_tables,
+ with: TimeTableDecorator,
+ context: {
+ referential: @referential
+ }
+ )
+ end
+
def time_table_params
params.require(:time_table).permit(
:objectid,
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index 22a71863a..19af28a98 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -2,7 +2,14 @@ class WorkbenchesController < BreadcrumbController
before_action :query_params, only: [:show]
defaults resource_class: Workbench
- respond_to :html, only: [:show]
+ respond_to :html, only: [:show, :index]
+
+ def index
+ # Only display Wb with selected name, according to #4108
+ @workbench = current_organisation.workbenches.find_by(name: "Gestion de l'offre")
+ @referentials = @workbench.all_referentials
+ @calendars = Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true)
+ end
def show
scope = resource.all_referentials
diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb
index 1f8690f38..55031d4f3 100644
--- a/app/helpers/breadcrumb_helper.rb
+++ b/app/helpers/breadcrumb_helper.rb
@@ -73,13 +73,13 @@ module BreadcrumbHelper
end
def calendar_breadcrumb(action)
- add_breadcrumb I18n.t('breadcrumbs.referentials'), referentials_path
+ add_breadcrumb I18n.t('breadcrumbs.referentials'), workbenches_path
add_breadcrumb I18n.t('calendars.index.title'), calendars_path
add_breadcrumb @calendar.name if %i(show edit).include? action
end
def workbench_breadcrumb(action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path
+ add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
end
@@ -215,7 +215,7 @@ module BreadcrumbHelper
end
def import_breadcrumb (action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path
+ add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
add_breadcrumb I18n.t("breadcrumbs.imports"), workbench_imports_path(@workbench)
@@ -257,7 +257,7 @@ module BreadcrumbHelper
end
def organisation_breadcrumb (action = :index)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path
+ add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
add_breadcrumb breadcrumb_label(@organisation), organisation_path,:title => breadcrumb_tooltip(@organisation) unless action == :index
end
diff --git a/app/jobs/mailer_job.rb b/app/jobs/mailer_job.rb
index 761a29cd6..3918745b8 100644
--- a/app/jobs/mailer_job.rb
+++ b/app/jobs/mailer_job.rb
@@ -1,5 +1,5 @@
class MailerJob < ActiveJob::Base
- queue_as :mail
+ # No need to specify queue it's already used mailers queue
def perform klass, action, params
klass.constantize.public_send(action, *params).deliver_later
diff --git a/app/mailers/calendar_mailer.rb b/app/mailers/calendar_mailer.rb
index cc8175a07..e2a368c6c 100644
--- a/app/mailers/calendar_mailer.rb
+++ b/app/mailers/calendar_mailer.rb
@@ -1,11 +1,13 @@
class CalendarMailer < ApplicationMailer
- def updated calendar, user
- @calendar = calendar
+ def updated calendar_id, user_id
+ @calendar = Calendar.find(calendar_id)
+ user = User.find(user_id)
mail to: user.email, subject: t('mailers.calendar_mailer.updated.subject')
end
- def created calendar, user
- @calendar = calendar
+ def created calendar_id, user_id
+ @calendar = Calendar.find(calendar_id)
+ user = User.find(user_id)
mail to: user.email, subject: t('mailers.calendar_mailer.created.subject')
end
end
diff --git a/app/models/calendar_observer.rb b/app/models/calendar_observer.rb
index 789805356..c81addff4 100644
--- a/app/models/calendar_observer.rb
+++ b/app/models/calendar_observer.rb
@@ -4,7 +4,7 @@ class CalendarObserver < ActiveRecord::Observer
return unless calendar.shared
User.with_organisation.each do |user|
- MailerJob.perform_later('CalendarMailer', 'updated', [calendar, user])
+ MailerJob.perform_later('CalendarMailer', 'updated', [calendar.id, user.id])
end
end
@@ -12,7 +12,7 @@ class CalendarObserver < ActiveRecord::Observer
return unless calendar.shared
User.with_organisation.each do |user|
- MailerJob.perform_later('CalendarMailer', 'created', [calendar, user])
+ MailerJob.perform_later('CalendarMailer', 'created', [calendar.id, user.id])
end
end
end
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb
index 33a2fbb00..63d2d1606 100644
--- a/app/models/chouette/line.rb
+++ b/app/models/chouette/line.rb
@@ -1,5 +1,5 @@
class Chouette::Line < Chouette::ActiveRecord
- include DefaultNetexAttributesSupport
+ include StifCodifligneAttributesSupport
include LineRestrictions
include LineReferentialSupport
include StifTransportModeEnumerations
diff --git a/app/models/chouette/stif_codifligne_objectid.rb b/app/models/chouette/stif_codifligne_objectid.rb
new file mode 100644
index 000000000..46109e24f
--- /dev/null
+++ b/app/models/chouette/stif_codifligne_objectid.rb
@@ -0,0 +1,18 @@
+class Chouette::StifCodifligneObjectid < String
+
+ @@format = /^([A-Za-z_]+):([A-Za-z]+):([A-Za-z]+):([0-9A-Za-z_-]+)$/
+ cattr_reader :format
+
+ def parts
+ match(format).try(:captures)
+ end
+
+ def object_type
+ parts.try(:third)
+ end
+
+ def local_id
+ parts.try(:fourth)
+ end
+
+end
diff --git a/app/models/chouette/stif_reflex_objectid.rb b/app/models/chouette/stif_reflex_objectid.rb
new file mode 100644
index 000000000..c41a9325a
--- /dev/null
+++ b/app/models/chouette/stif_reflex_objectid.rb
@@ -0,0 +1,18 @@
+class Chouette::StifReflexObjectid < String
+
+ @@format = /^([A-Za-z_]+):([0-9A-Za-z_-]+):([A-Za-z]+):([0-9A-Za-z_-]+):([A-Za-z]+)$/
+ cattr_reader :format
+
+ def parts
+ match(format).try(:captures)
+ end
+
+ def object_type
+ parts.try(:third)
+ end
+
+ def local_id
+ parts.try(:fourth)
+ end
+
+end
diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb
index 4d98027d6..43bc82f7f 100644
--- a/app/models/chouette/stop_area.rb
+++ b/app/models/chouette/stop_area.rb
@@ -4,20 +4,16 @@ require 'geo_ruby'
class Chouette::StopArea < Chouette::ActiveRecord
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
+
include Geokit::Mappable
+ include StifReflexAttributesSupport
include ProjectionFields
include StopAreaRestrictions
+ include StopAreaReferentialSupport
extend Enumerize
enumerize :area_type, in: %i(zdep zder zdlp zdlr lda)
- def self.model_name
- ActiveModel::Name.new self, Chouette, self.name.demodulize
- end
- # Refs #1627
- # include DefaultAttributesSupport
- include StopAreaReferentialSupport
-
with_options dependent: :destroy do |assoc|
assoc.has_many :stop_points
assoc.has_many :access_points
@@ -57,13 +53,6 @@ class Chouette::StopArea < Chouette::ActiveRecord
after_update :clean_invalid_access_links
before_save :coordinates_to_lat_lng
- # Refs #1627
- before_validation :prepare_auto_columns
- def prepare_auto_columns
- self.object_version = 1
- self.creator_id = 'chouette'
- end
-
def combine_lat_lng
if self.latitude.nil? || self.longitude.nil?
""
diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb
index 3dbf6be0d..8fe79dc0c 100644
--- a/app/models/chouette/stop_point.rb
+++ b/app/models/chouette/stop_point.rb
@@ -36,12 +36,12 @@ module Chouette
def stop_area_id_validation
if stop_area_id.nil?
- errors.add(:stop_area_id, I18n.t("errors.messages.empty"))
+ errors.add(:stop_area_id, I18n.t("stop_areas.errors.empty"))
end
end
def self.area_candidates
- Chouette::StopArea.where( :area_type => ['Quay', 'BoardingPosition'])
+ Chouette::StopArea.where(:area_type => ['Quay', 'BoardingPosition'])
end
end
diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb
index d907d797e..713ce0b21 100644
--- a/app/models/chouette/time_table.rb
+++ b/app/models/chouette/time_table.rb
@@ -38,26 +38,26 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
validates_associated :periods
def continuous_dates
+ in_days = self.dates.where(in_out: true).sort_by(&:date)
chunk = {}
group = nil
- self.dates.where(in_out: true).each_with_index do |date, index|
+ in_days.each_with_index do |date, index|
group ||= index
- group = (date.date == dates[index - 1].date + 1.day) ? group : group + 1
+ group = (date.date == in_days[index - 1].date + 1.day) ? group : group + 1
chunk[group] ||= []
chunk[group] << date
end
- chunk.values
+ # Remove less than 2 continuous day chunk
+ chunk.values.delete_if {|dates| dates.count < 2}
end
def convert_continuous_dates_to_periods
chunks = self.continuous_dates
- # Remove less than 3 continuous day chunk
- chunks.delete_if {|chunk| chunk.count < 3}
transaction do
chunks.each do |chunk|
self.periods.create!(period_start: chunk.first.date, period_end: chunk.last.date)
- chunk.map(&:destroy)
+ self.dates.delete(chunk)
end
end
end
@@ -415,7 +415,7 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
def clone_periods
periods = []
self.periods.each { |p| periods << p.copy}
- periods
+ periods.sort_by(&:period_start)
end
def included_days
@@ -436,7 +436,7 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
# produce a copy of periods without anyone overlapping or including another
- def optimize_periods
+ def optimize_overlapping_periods
periods = self.clone_periods
optimized = []
i=0
@@ -461,6 +461,59 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
optimized.sort { |a,b| a.period_start <=> b.period_start}
end
+ def continuous_periods
+ periods = self.periods.sort_by(&:period_start)
+ chunk = {}
+ group = nil
+ periods.each_with_index do |period, index|
+ group ||= index
+ group = (period.period_start - 1.day == periods[index - 1].period_end) ? group : group + 1
+ chunk[group] ||= []
+ chunk[group] << period
+ end
+ chunk.values.delete_if {|periods| periods.count < 2}
+ end
+
+ def convert_continuous_periods_into_one
+ chunks = self.continuous_periods
+
+ transaction do
+ chunks.each do |chunk|
+ self.periods.create!(period_start: chunk.first.period_start, period_end: chunk.last.period_end)
+ self.periods.delete chunk
+ end
+ end
+ end
+
+ #update a period if a in_day is just before or after
+ def optimize_continuous_dates_and_periods
+ return self.periods if self.included_days.empty? || periods.empty?
+
+ periods = self.clone_periods
+ optimized = []
+
+ i = 0
+ while i < periods.length
+ period = periods[i]
+ j = 0
+ in_days = self.reload.dates.where(in_out: true).sort_by(&:date)
+ while j < in_days.length
+ day = in_days[j]
+ if period.period_start - 1.day === day.date
+ period.period_start = day.date
+ self.dates.delete day
+ elsif period.period_end + 1.day === day.date
+ period.period_end = day.date
+ self.dates.delete day
+ end
+ j += 1
+ end
+ i += 1
+ optimized << period
+ end
+ optimized
+ end
+
# add a peculiar day or switch it from excluded to included
def add_included_day(d)
if self.excluded_date?(d)
@@ -478,22 +531,27 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
def merge!(another_tt)
transaction do
self.periods = another_tt.clone_periods + self.periods
- self.periods = self.optimize_periods
# For included dates
another_tt.included_days.map{ |d| add_included_day(d) }
# For excluded dates
- existing_out_date = self.dates.where(in_out: false).map(&:date)
- another_tt.dates.where(in_out: false).each do |d|
- unless existing_out_date.include?(d.date)
- self.dates << Chouette::TimeTableDate.new(:date => d.date, :in_out => false)
+ self.dates.where(in_out: false).each do |d|
+ self.dates.delete d if another_tt.include_in_periods?(d.date) && !another_tt.excluded_date?(d.date)
+ end
+
+ another_tt.excluded_days.each do |d|
+ unless self.reload.excluded_date?(d)
+ self.dates << Chouette::TimeTableDate.new(date: d, in_out: false)
end
+ self.save!
end
- self.save!
- end
- self.convert_continuous_dates_to_periods
+ self.convert_continuous_dates_to_periods
+ self.periods = self.optimize_continuous_dates_and_periods
+ self.convert_continuous_periods_into_one
+ self.periods = self.optimize_overlapping_periods
+ end
end
def included_days_in_dates_and_periods
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index 71c339780..bc2713973 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -23,7 +23,10 @@ module Chouette
validates_presence_of :route
validates_presence_of :journey_pattern
- validates :vehicle_journey_at_stops, :vjas_departure_time_must_be_before_next_stop_arrival_time,
+ validates :vehicle_journey_at_stops,
+ # Validation temporarily removed for day offsets
+ # :vjas_departure_time_must_be_before_next_stop_arrival_time,
+
vehicle_journey_at_stops_are_in_increasing_time_order: true
validates_presence_of :number
@@ -34,6 +37,12 @@ module Chouette
before_validation :set_default_values,
:calculate_vehicle_journey_at_stop_day_offset
+ # TODO: Remove this validator
+ # We've eliminated this validation because it prevented vehicle journeys
+ # from being saved with at-stops having a day offset greater than 0,
+ # because these would have times that were "earlier" than the previous
+ # at-stop. TBD by Luc whether we're deleting this validation altogether or
+ # instead rejiggering it to work with day offsets.
def vjas_departure_time_must_be_before_next_stop_arrival_time
notice = 'departure time must be before next stop arrival time'
vehicle_journey_at_stops.each_with_index do |current_stop, index|
@@ -142,7 +151,7 @@ module Chouette
vj.update_attributes(state_permited_attributes(item))
vj.update_has_and_belongs_to_many_from_state(item)
- item['errors'] = vj.errors if vj.errors.any?
+ item['errors'] = vj.errors.full_messages.uniq if vj.errors.any?
end
# Delete ids of new object from state if we had to rollback
diff --git a/app/models/chouette/vehicle_journey_at_stop.rb b/app/models/chouette/vehicle_journey_at_stop.rb
index 5dfec8352..35d94aa75 100644
--- a/app/models/chouette/vehicle_journey_at_stop.rb
+++ b/app/models/chouette/vehicle_journey_at_stop.rb
@@ -3,6 +3,8 @@ module Chouette
include ForBoardingEnumerations
include ForAlightingEnumerations
+ DAY_OFFSET_MAX = 1
+
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
@@ -24,11 +26,46 @@ module Chouette
end
end
+ validate :day_offset_must_be_within_range
+
after_initialize :set_virtual_attributes
def set_virtual_attributes
@_destroy = false
@dummy = false
end
+ def day_offset_must_be_within_range
+ if day_offset_outside_range?(arrival_day_offset)
+ errors.add(
+ :arrival_day_offset,
+ I18n.t(
+ 'vehicle_journey_at_stops.errors.day_offset_must_not_exceed_max',
+ local_id: vehicle_journey.objectid.local_id,
+ max: DAY_OFFSET_MAX + 1
+ )
+ )
+ end
+
+ if day_offset_outside_range?(departure_day_offset)
+ errors.add(
+ :departure_day_offset,
+ I18n.t(
+ 'vehicle_journey_at_stops.errors.day_offset_must_not_exceed_max',
+ local_id: vehicle_journey.objectid.local_id,
+ max: DAY_OFFSET_MAX + 1
+ )
+ )
+ end
+ end
+
+ def day_offset_outside_range?(offset)
+ # At-stops that were created before the database-default of 0 will have
+ # nil offsets. Handle these gracefully by forcing them to a 0 offset.
+ offset ||= 0
+
+ offset < 0 || offset > DAY_OFFSET_MAX
+ end
+
+
end
end
diff --git a/app/models/clean_up.rb b/app/models/clean_up.rb
index cdbf6c00a..b1135a155 100644
--- a/app/models/clean_up.rb
+++ b/app/models/clean_up.rb
@@ -14,7 +14,7 @@ class CleanUp < ActiveRecord::Base
def end_date_must_be_greater_that_begin_date
if self.end_date && self.date_type == 'between' && self.begin_date >= self.end_date
- errors.add(:base, I18n.t('clean_ups.activerecord.errors.invalid_period'))
+ errors.add(:base, I18n.t('activerecord.errors.models.clean_up.invalid_period'))
end
end
diff --git a/app/models/concerns/default_attributes_support.rb b/app/models/concerns/default_attributes_support.rb
index 7928093e6..e85a59160 100644
--- a/app/models/concerns/default_attributes_support.rb
+++ b/app/models/concerns/default_attributes_support.rb
@@ -77,7 +77,8 @@ module DefaultAttributesSupport
def build_objectid
if objectid.include? ':__pending_id__'
fix_uniq_objectid
- update_attributes( :objectid => objectid, :object_version => (object_version - 1) )
+ self.object_version = object_version - 1
+ self.save(validate: false)
end
end
diff --git a/app/models/concerns/stif_codifligne_attributes_support.rb b/app/models/concerns/stif_codifligne_attributes_support.rb
new file mode 100644
index 000000000..d4370e505
--- /dev/null
+++ b/app/models/concerns/stif_codifligne_attributes_support.rb
@@ -0,0 +1,21 @@
+module StifCodifligneAttributesSupport
+ extend ActiveSupport::Concern
+
+ included do
+ validates_presence_of :objectid
+ end
+
+ module ClassMethods
+ def object_id_key
+ model_name
+ end
+
+ def model_name
+ ActiveModel::Name.new self, Chouette, self.name.demodulize
+ end
+ end
+
+ def objectid
+ Chouette::StifCodifligneObjectid.new read_attribute(:objectid).to_s
+ end
+end
diff --git a/app/models/concerns/stif_reflex_attributes_support.rb b/app/models/concerns/stif_reflex_attributes_support.rb
new file mode 100644
index 000000000..e6236a146
--- /dev/null
+++ b/app/models/concerns/stif_reflex_attributes_support.rb
@@ -0,0 +1,21 @@
+module StifReflexAttributesSupport
+ extend ActiveSupport::Concern
+
+ included do
+ validates_presence_of :objectid
+ end
+
+ module ClassMethods
+ def object_id_key
+ model_name
+ end
+
+ def model_name
+ ActiveModel::Name.new self, Chouette, self.name.demodulize
+ end
+ end
+
+ def objectid
+ Chouette::StifReflexObjectid.new read_attribute(:objectid).to_s
+ end
+end
diff --git a/app/models/referential.rb b/app/models/referential.rb
index ed23e2e51..cb2c7b23b 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -130,14 +130,13 @@ class Referential < ActiveRecord::Base
self
end
- def self.new_from(from, organisation:)
+ def self.new_from(from)
Referential.new(
name: I18n.t("activerecord.copy", :name => from.name),
slug: "#{from.slug}_clone",
prefix: from.prefix,
time_zone: from.time_zone,
bounds: from.bounds,
- organisation: organisation,
line_referential: from.line_referential,
stop_area_referential: from.stop_area_referential,
workbench: from.workbench,
@@ -186,7 +185,7 @@ class Referential < ActiveRecord::Base
before_validation :clone_associations, :on => :create, if: :created_from
before_validation :assign_slug, :on => :create
before_validation :assign_prefix, :on => :create
- before_create :create_schema, unless: :created_from
+ before_create :create_schema
after_create :clone_schema, if: :created_from
@@ -206,7 +205,6 @@ class Referential < ActiveRecord::Base
end
def clone_associations
- self.organisation = created_from.organisation
self.line_referential = created_from.line_referential
self.stop_area_referential = created_from.stop_area_referential
self.workbench = created_from.workbench
diff --git a/app/models/user.rb b/app/models/user.rb
index 64d66883f..c2aa14bda 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -29,29 +29,6 @@ class User < ActiveRecord::Base
scope :with_organisation, -> { where.not(organisation_id: nil) }
- def self.destructive_permissions_for(models)
- models.product( %w{create destroy update} ).map{ |model_action| model_action.join('.') }
- end
-
- @@edit_offer_permissions =
- destructive_permissions_for( %w[
- access_points
- connection_links
- calendars
- footnotes
- journey_patterns
- referentials
- routes
- routing_constraint_zones
- time_tables
- vehicle_journeys
- ]) << 'boiv:edit-offer'
-
- mattr_reader :edit_offer_permissions
-
- def self.all_permissions
- edit_offer_permissions
- end
# Callback invoked by DeviseCasAuthenticable::Model#authernticate_with_cas_ticket
def cas_extra_attributes=(extra_attributes)
@@ -59,7 +36,7 @@ class User < ActiveRecord::Base
self.name = extra[:full_name]
self.email = extra[:email]
self.organisation = Organisation.sync_update extra[:organisation_code], extra[:organisation_name], extra[:functional_scope]
- self.permissions = extra[:permissions].include?('boiv:edit-offer') ? @@edit_offer_permissions : []
+ self.permissions = Stif::PermissionTranslator.translate(extra[:permissions])
end
def self.portail_api_request
@@ -87,7 +64,7 @@ class User < ActiveRecord::Base
user.locked_at = el['locked_at']
user.organisation = Organisation.sync_update el['organization_code'], el['organization_name'], el['functional_scope']
user.synced_at = Time.now
- user.permissions = el['permissions'].include?('boiv:edit-offer') ? @@edit_offer_permissions : []
+ user.permissions = Stif::PermissionTranslator.translate(el['permissions'])
user.save
end
end
diff --git a/app/policies/login_policy.rb b/app/policies/login_policy.rb
index 3364c37ac..5b07b97f3 100644
--- a/app/policies/login_policy.rb
+++ b/app/policies/login_policy.rb
@@ -7,7 +7,7 @@ class LoginPolicy
end
def boiv?
- !(user.permissions || []).grep(%r{\Aboiv:.}).empty?
+ (user.permissions || []).include?('sessions:create')
end
end
diff --git a/app/policies/referential_policy.rb b/app/policies/referential_policy.rb
index 9d0a92093..fdc80516c 100644
--- a/app/policies/referential_policy.rb
+++ b/app/policies/referential_policy.rb
@@ -20,7 +20,7 @@ class ReferentialPolicy < ApplicationPolicy
def clone?
- !archived? && organisation_match? && create?
+ !archived? && create?
end
def archive?
@@ -37,7 +37,3 @@ class ReferentialPolicy < ApplicationPolicy
end
end
-
-
-
-
diff --git a/app/views/compliance_checks/detailed_errors_index.csv.slim b/app/views/compliance_checks/detailed_errors_index.csv.slim
index 0b2c3f24f..7fe20e282 100644
--- a/app/views/compliance_checks/detailed_errors_index.csv.slim
+++ b/app/views/compliance_checks/detailed_errors_index.csv.slim
@@ -29,7 +29,7 @@
= error["source"]["file"]["line_number"]
- else
- = I18n.t("activemodel.attributes.compliance_check_result."+r.test_id);
+ = I18n.t("activemodel.attributes.compliance_check_result.#{r.test_id}");
= I18n.t("compliance_check_result.details.detail_#{error['error_id']}", object_labels_hash(error) )
= "\n"
diff --git a/app/views/compliance_checks/summary_errors_index.csv.slim b/app/views/compliance_checks/summary_errors_index.csv.slim
index bbb2c8c88..8c88d5cf6 100644
--- a/app/views/compliance_checks/summary_errors_index.csv.slim
+++ b/app/views/compliance_checks/summary_errors_index.csv.slim
@@ -16,7 +16,7 @@
= r.result;
= r.test_id;
- = I18n.t("activemodel.attributes.compliance_check_result." + r.test_id);
+ = I18n.t("activemodel.attributes.compliance_check_result.#{r.test_id}");
= Rails.application.config.validation_spec + I18n.locale.to_s + "/" + r.test_id + ".html";
= r.error_count
diff --git a/app/views/layouts/navigation/_main_nav_left.html.slim b/app/views/layouts/navigation/_main_nav_left.html.slim
index 3cf6428af..9dfc828c0 100644
--- a/app/views/layouts/navigation/_main_nav_left.html.slim
+++ b/app/views/layouts/navigation/_main_nav_left.html.slim
@@ -16,7 +16,7 @@
#miOne.panel-collapse.collapse
.list-group
- = link_to root_path, class: "list-group-item #{(@localizationUrl == 'referentials#index') ? 'active' : ''}" do
+ = link_to root_path, class: "list-group-item #{(@localizationUrl == 'workbenches#index') ? 'active' : ''}" do
span Tableau de bord
= link_to '#', class: 'list-group-item' do
span Offre de mon organisation
diff --git a/app/views/referential_stop_areas/index.html.slim b/app/views/referential_stop_areas/index.html.slim
index 1cbe1945f..7bf39eabd 100644
--- a/app/views/referential_stop_areas/index.html.slim
+++ b/app/views/referential_stop_areas/index.html.slim
@@ -4,7 +4,7 @@
.panel.panel-default
.panel-heading
.input-group.col-md-9.col-sm-9
- = f.text_field :name_or_objectid_cont, placeholder: t('.name_or_objectid'), class: 'form-control'
+ = f.text_field :name_or_objectid_cont, placeholder: t('stop_areas.filters.name_or_objectid'), class: 'form-control'
.input-group-btn
button.btn.btn-primary#search-btn type="submit"
span.fa.fa-search
diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim
index d3687c3a7..425f8014a 100644
--- a/app/views/referentials/show.html.slim
+++ b/app/views/referentials/show.html.slim
@@ -91,9 +91,13 @@
.row
.col-lg-8.col-ld-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2.col-xs-12
= f.input :date_type, as: :radio_buttons, label: false
- = f.input :begin_date, as: :date, label: t('titles.clean_up.begin_date'),:wrapper_html => { class: 'date smart_date', title: t('titles.clean_up.begin_date') }
- = f.input :end_date, as: :date, label: t('titles.clean_up.end_date'), :wrapper_html => { class: 'date cleanup_end_date_wrapper smart_date', title: t('titles.clean_up.end_date'), id: "end_date" }
+ .col-lg-8.col-ld-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2.col-xs-12
+ label.control-label.begin_date = t('titles.clean_up.begin_date')
+ label.control-label.end_date.hidden = t('titles.clean_up.end_date')
+ = f.input :begin_date, as: :date, label: false, wrapper_html: { class: 'date smart_date' }
+
+ = f.input :end_date, as: :date, label: t('titles.clean_up.end_date'), wrapper_html: { class: 'date cleanup_end_date_wrapper smart_date', id: "end_date" }
.modal-footer
button.btn.btn-link type='button' data-dismiss='modal' Annuler
diff --git a/app/views/stop_area_copies/new.html.slim b/app/views/stop_area_copies/new.html.slim
index 1a8764cbc..b506d35f4 100644
--- a/app/views/stop_area_copies/new.html.slim
+++ b/app/views/stop_area_copies/new.html.slim
@@ -1,4 +1,4 @@
-= title_tag t("stop_area_copies.new.title."+@stop_area_copy.hierarchy)
+= title_tag t("stop_area_copies.new.title.#{@stop_area_copy.hierarchy}")
= semantic_form_for [@referential, @stop_area, @stop_area_copy] do |form|
br
diff --git a/app/views/time_tables/_filter.html.slim b/app/views/time_tables/_filter.html.slim
index 1015eca31..392dc4f50 100644
--- a/app/views/time_tables/_filter.html.slim
+++ b/app/views/time_tables/_filter.html.slim
@@ -7,10 +7,6 @@
span.fa.fa-search
.ffg-row
- / .form-group.togglable
- / = f.label Chouette::TimeTable.human_attribute_name(:color), required: false, class: 'control-label'
- / = f.input :color_cont_any, collection: ["#9B9B9B", "#FFA070", "#C67300", "#7F551B", "#41CCE3", "#09B09C", "#3655D7", "#6321A0", "#E796C6", "#DD2DAA"], as: :check_boxes, label: false, label_method: lambda{|tt| ("<span style='height:19px;'><span class='fa fa-circle' style='position:relative;top:0;margin-top:0;color:" + tt + "'></span></span>").html_safe }, required: false, wrapper_html: { class: 'checkbox_list' }
-
.form-group
= f.label Chouette::TimeTable.human_attribute_name(:tag_search), required: false, class: 'control-label'
= f.input :tag_search, as: :tags, collection: Chouette::TimeTable.tags_on(:tags).pluck(:name), label: false, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez une étiquette...' }, wrapper_html: { class: 'select2ed'}, include_blank: false
diff --git a/app/views/time_tables/time_tables.json.rabl b/app/views/time_tables/time_tables.json.rabl
index dec29cb69..b91ca9ae9 100644
--- a/app/views/time_tables/time_tables.json.rabl
+++ b/app/views/time_tables/time_tables.json.rabl
@@ -2,4 +2,4 @@ collection @time_tables, :object_root => false
node do |time_table|
{ :id => time_table.id, :comment => time_table.comment, :time_table_bounding => time_table_bounding( time_table), :composition_info => composition_info(time_table) }
-end
+end
diff --git a/app/views/workbenches/index.html.slim b/app/views/workbenches/index.html.slim
new file mode 100644
index 000000000..ca61d439d
--- /dev/null
+++ b/app/views/workbenches/index.html.slim
@@ -0,0 +1,67 @@
+/ PageHeader
+= pageheader 'map-marker',
+ t('.title', organisation: current_organisation.name)
+
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-12
+ h2.content_header = t('.offers.title')
+
+ .row
+ .col-lg-6.col-md-6.col-sm-6.col-xs-12
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.offers.organisation')
+
+ .panel-body
+ em.small.text-muted = t('.offers.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.offers.idf')
+
+ .panel-body
+ em.small.text-muted = t('.offers.no_content')
+
+ .col-lg-6.col-md-6.col-sm-6.col-xs-12
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title.with_actions
+ div
+ = t('.offers.referentials')
+ span.badge.ml-xs = @referentials.count if @referentials.any?
+
+ div
+ = link_to '', workbench_path(@workbench), class: ' fa fa-chevron-right pull-right', title: t('.offers.see')
+
+ - if @referentials.any?
+ .list-group
+ - @referentials.each_with_index do |referential, i|
+ = link_to referential.name, referential_path(referential), class: 'list-group-item' if i < 6
+
+ - else
+ .panel-body
+ em.small.text-muted = t('.offers.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title.with_actions
+ div
+ = t('.offers.calendars')
+ span.badge.ml-xs = @calendars.count if @calendars.any?
+
+ div
+ = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right', title: t('.offers.see')
+
+ - if @calendars.any?
+ .list-group
+ - @calendars.each_with_index do |calendar, i|
+ = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' if i < 6
+
+ - else
+ .panel-body
+ em.small.text-muted = t('.offers.no_content')
diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim
index bb8b71ab2..a9ce2f704 100644
--- a/app/views/workbenches/show.html.slim
+++ b/app/views/workbenches/show.html.slim
@@ -7,8 +7,8 @@
/ Below is secundary actions & optional contents (filters, ...)
.row.mb-sm
.col-lg-12.text-right
- = link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary'
- if policy(Referential).create?
+ = link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary'
= link_to t('actions.add'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary'
/ PageContent