aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-07-18 04:38:16 +0200
committerRobert2017-07-18 04:38:16 +0200
commit3ac2b93e295c1c3d6b875fc717094657c228d060 (patch)
tree38b88ea5849c06a697da5a053bfe2ae9faa09c52
parent5e29ed6cf1447a13178ed5011a7daecd479526dc (diff)
parentd7274985e4f986cea6694b9f2d3f3a3daba8afc6 (diff)
downloadchouette-core-3ac2b93e295c1c3d6b875fc717094657c228d060.tar.bz2
Merge branch 'master' of github.com:af83/stif-boiv
-rw-r--r--app/assets/stylesheets/_layout.sass10
-rw-r--r--app/assets/stylesheets/components/_panels.sass22
-rw-r--r--app/assets/stylesheets/old_application.sass.erb62
-rw-r--r--app/controllers/workbenches_controller.rb8
-rw-r--r--app/models/chouette/vehicle_journey.rb2
-rw-r--r--app/views/layouts/navigation/_main_nav_left.html.slim2
-rw-r--r--app/views/workbenches/index.html.slim69
-rw-r--r--config/locales/workbenches.en.yml12
-rw-r--r--config/locales/workbenches.fr.yml12
-rw-r--r--config/routes.rb9
-rw-r--r--config/sidekiq.yml5
-rw-r--r--spec/models/chouette/vehicle_journey_spec.rb4
12 files changed, 146 insertions, 71 deletions
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/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/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index 22a71863a..171db6a07 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -2,7 +2,13 @@ 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")
+ @calendars = Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true)
+ end
def show
scope = resource.all_referentials
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index 71c339780..19299d098 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -142,7 +142,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/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/workbenches/index.html.slim b/app/views/workbenches/index.html.slim
new file mode 100644
index 000000000..0ce1085d0
--- /dev/null
+++ b/app/views/workbenches/index.html.slim
@@ -0,0 +1,69 @@
+/ 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 = @workbench.referentials.count if @workbench.referentials.any?
+
+ - if @workbench.referentials.any?
+ div
+ = link_to '', workbench_path(@workbench), class: ' fa fa-chevron-right pull-right', title: t('.offers.see')
+
+ - if @workbench.referentials.any?
+ .list-group
+ - @workbench.referentials.each do |referential|
+ = link_to referential.name, referential_path(referential), class: 'list-group-item'
+
+ - 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?
+
+ - 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 do |calendar|
+ = link_to calendar.name, calendar_path(calendar), class: 'list-group-item'
+
+ - else
+ .panel-body
+ em.small.text-muted = t('.offers.no_content')
diff --git a/config/locales/workbenches.en.yml b/config/locales/workbenches.en.yml
new file mode 100644
index 000000000..8525a4b9f
--- /dev/null
+++ b/config/locales/workbenches.en.yml
@@ -0,0 +1,12 @@
+en:
+ workbenches:
+ index:
+ title: "%{organisation} dashboard"
+ offers:
+ title: "Transport offers"
+ organisation: "Organisation offers"
+ idf: "IDF offers"
+ referentials: "Referentials"
+ calendars: "Calendars"
+ see: "See the list"
+ no_content: "No content yet."
diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml
new file mode 100644
index 000000000..1cdc19a13
--- /dev/null
+++ b/config/locales/workbenches.fr.yml
@@ -0,0 +1,12 @@
+fr:
+ workbenches:
+ index:
+ title: "Tableau de bord %{organisation}"
+ offers:
+ title: "Offres de transport"
+ organisation: "Offres de mon organisation"
+ idf: "Offres IDF"
+ referentials: "Jeux de données"
+ calendars: "Calendriers"
+ see: "Voir la liste"
+ no_content: "Aucun contenu pour le moment"
diff --git a/config/routes.rb b/config/routes.rb
index aa6713857..28c092e6a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,7 +1,7 @@
require 'sidekiq/web'
ChouetteIhm::Application.routes.draw do
- resources :workbenches, :only => [:show] do
+ resources :workbenches, only: [:show, :index] do
delete :referentials, on: :member, action: :delete_referentials
resources :imports do
get :download, on: :member
@@ -14,7 +14,7 @@ ChouetteIhm::Application.routes.draw do
devise_scope :user do
authenticated :user do
- root :to => 'referentials#index', as: :authenticated_root
+ root :to => 'workbenches#index', as: :authenticated_root
end
unauthenticated :user do
@@ -76,7 +76,7 @@ ChouetteIhm::Application.routes.draw do
get :autocomplete, on: :collection, controller: 'autocomplete_calendars'
end
- resources :referentials do
+ resources :referentials, except: :index do
resources :api_keys
resources :autocomplete_stop_areas, only: [:show, :index] do
get 'around', on: :member
@@ -213,7 +213,8 @@ ChouetteIhm::Application.routes.draw do
end
end
end
- root :to => "referentials#index"
+
+ root :to => "workbenches#index"
get '/help/(*slug)' => 'help#show'
diff --git a/config/sidekiq.yml b/config/sidekiq.yml
new file mode 100644
index 000000000..60d6d2803
--- /dev/null
+++ b/config/sidekiq.yml
@@ -0,0 +1,5 @@
+:concurrency: 5
+:pidfile: tmp/pids/sidekiq.pid
+:queues:
+ - default
+ - mail
diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb
index c78ef5b33..c495becac 100644
--- a/spec/models/chouette/vehicle_journey_spec.rb
+++ b/spec/models/chouette/vehicle_journey_spec.rb
@@ -10,7 +10,7 @@ describe Chouette::VehicleJourney, :type => :model do
vehicle_journey.validate
expect(vjas[0].errors[:departure_time]).not_to be_blank
- expect(vehicle_journey.errors[:vehicle_journey_at_stops].count).to eq(1)
+ expect(vehicle_journey.errors.count).to eq(1)
expect(vehicle_journey).not_to be_valid
end
@@ -19,7 +19,7 @@ describe Chouette::VehicleJourney, :type => :model do
vehicle_journey.validate
expect(vjas[0].errors[:departure_time]).to be_blank
- expect(vehicle_journey.errors[:vehicle_journey_at_stops]).to be_empty
+ expect(vehicle_journey.errors).to be_empty
expect(vehicle_journey).to be_valid
end