aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Donnet2017-03-22 13:33:45 +0100
committerLuc Donnet2017-03-22 13:33:45 +0100
commit2180ec2f1f4cb69bf5d3ba9f3c757d0141cab755 (patch)
treee008f8f0f7c63bb7ff94791225af3c77d4d96d3a
parent78e0ef962354b9cd3e6dfb51a2ccf8ed6fe5afaf (diff)
parent840241c12211a5e46e5c38cc2007339d9e00c02f (diff)
downloadchouette-core-2180ec2f1f4cb69bf5d3ba9f3c757d0141cab755.tar.bz2
Merge branch 'master' into staging
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock3
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js17
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js15
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js28
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/index.js2
-rw-r--r--app/assets/stylesheets/components/_alerts.sass7
-rw-r--r--app/assets/stylesheets/components/_forms.sass16
-rw-r--r--app/assets/stylesheets/components/_select2.sass13
-rw-r--r--app/controllers/concerns/referential_support.rb14
-rw-r--r--app/controllers/imports_controller.rb16
-rw-r--r--app/controllers/journey_patterns_collections_controller.rb1
-rw-r--r--app/controllers/referentials_controller.rb2
-rw-r--r--app/controllers/workbenches_controller.rb71
-rw-r--r--app/models/netex_import.rb18
-rw-r--r--app/models/organisation.rb13
-rw-r--r--app/models/referential.rb1
-rw-r--r--app/views/errors/not_found.html.slim50
-rw-r--r--app/views/errors/server_error.html.slim52
-rw-r--r--app/views/imports/_form.html.slim5
-rw-r--r--app/views/imports/index.html.slim2
-rw-r--r--app/views/layouts/navigation/_nav_panel_profile.html.slim4
-rw-r--r--app/views/referentials/show.html.slim21
-rw-r--r--app/views/routes/_form.html.slim2
-rw-r--r--app/views/vehicle_journeys/index.html.slim2
-rw-r--r--app/views/workbenches/_filters.html.slim6
-rw-r--r--config/initializers/locale.rb13
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/fr.yml1
-rw-r--r--db/migrate/20170317114614_remove_stop_points_route_fk.rb2
-rw-r--r--db/migrate/20170321141620_add_type_to_imports.rb10
-rw-r--r--db/migrate/20170322075010_delete_translations.rb5
-rw-r--r--db/schema.rb31
-rw-r--r--lib/stif/reflex_synchronization.rb11
-rw-r--r--public/403.html65
-rw-r--r--public/404.html47
-rw-r--r--public/422.html47
-rw-r--r--public/500.html44
38 files changed, 222 insertions, 437 deletions
diff --git a/Gemfile b/Gemfile
index b9dd01f90..2c3d56385 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,6 @@ source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.1.10'
-gem 'i18n-active_record', :require => 'i18n/active_record'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
diff --git a/Gemfile.lock b/Gemfile.lock
index 35dc39edd..67aa8c87c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -257,8 +257,6 @@ GEM
httparty (0.14.0)
multi_xml (>= 0.5.2)
i18n (0.7.0)
- i18n-active_record (0.1.2)
- i18n (>= 0.5.0)
i18n-tasks (0.8.6)
activesupport
easy_translate (>= 0.5.0)
@@ -621,7 +619,6 @@ DEPENDENCIES
guard
guard-rspec
has_array_of!
- i18n-active_record
i18n-tasks
inherited_resources
jbuilder (~> 2.0)
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js b/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js
index 67310c6b6..81bf2dcbe 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js
+++ b/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js
@@ -87,30 +87,19 @@ class BSelect2 extends React.Component{
item => Object.assign(
{},
item,
- { text: item.name + ", " + item.zip_code + " " + item.short_city_name }
+ { text: item.name + ", " + item.zip_code + " " + item.short_city_name + " <small><em>(" + item.user_objectid + ")</em></small>" }
)
)
};
},
cache: true
},
- minimumInputLength: 3,
- templateResult: formatRepo
+ escapeMarkup: function (markup) { return markup; },
+ minimumInputLength: 3
}}
/>
)
}
}
-const formatRepo = (props) => {
- if(props.text) return props.text
- // console.log(props)
- // return (
- // <div>
- // {props.short_name}
- // <small><em>{props.zip_code} {props.short_city_name}</em></small>
- // </div>
- // )
-}
-
module.exports = BSelect3
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js b/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js
index c880631f6..76142b0e1 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js
+++ b/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js
@@ -112,8 +112,7 @@ class OlMap extends Component{
<div className='map_container'>
<div className='map_metas'>
<p>
- <strong>Nom de l'arrêt : </strong>
- {this.props.value.olMap.json.name}
+ <strong>{this.props.value.olMap.json.name}</strong>
</p>
<p>
<strong>Type d'arrêt : </strong>
@@ -124,15 +123,15 @@ class OlMap extends Component{
{this.props.value.olMap.json.short_name}
</p>
<p>
- <strong>Code Reflex : </strong>
+ <strong>ID Reflex : </strong>
{this.props.value.olMap.json.user_objectid}
</p>
- <p>
- <strong>Coordonnées : </strong>
- WSG84
- {this.props.value.olMap.json.latitude}
- {this.props.value.olMap.json.longitude}
+ <p><strong>Coordonnées : </strong></p>
+ <p style={{paddingLeft: 10, marginTop: 0}}>
+ <em>Proj.: </em>WSG84<br/>
+ <em>Lat.: </em>{this.props.value.olMap.json.latitude} <br/>
+ <em>Lon.: </em>{this.props.value.olMap.json.longitude}
</p>
<p>
<strong>Code Postal : </strong>
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js
index c88dda5f4..dc0621f76 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js
@@ -54,22 +54,24 @@ class VehicleJourney extends Component {
<div key={i}>{this.timeTableURL(tt.id)}</div>
)}
- <div className={(this.props.value.deletable ? 'disabled ' : '') + 'checkbox'}>
- <input
- id={this.props.index}
- name={this.props.index}
- onChange={(e) => this.props.onSelectVehicleJourney(this.props.index)}
- type='checkbox'
- disabled={this.props.value.deletable}
- checked={this.props.value.selected}
- ></input>
- <label htmlFor={this.props.index}></label>
- </div>
- </div>
+ {this.isDisabled(this.props.filters.policy['vehicle_journeys.edit'], this.props.filters.policy['vehicle_journeys.destroy']) &&
+ <div className={(this.props.value.deletable ? 'disabled ' : '') + 'checkbox'}>
+ <input
+ id={this.props.index}
+ name={this.props.index}
+ onChange={(e) => this.props.onSelectVehicleJourney(this.props.index)}
+ type='checkbox'
+ disabled={this.props.value.deletable}
+ checked={this.props.value.selected}
+ ></input>
+ <label htmlFor={this.props.index}></label>
+ </div>
+ }
+ </div>
{this.props.value.vehicle_journey_at_stops.map((vj, i) =>
<div key={i} className='td text-center'>
- <div className={'cellwrap' + (this.cityNameChecker(vj) ? ' headlined' : '')}>
+ <div className={'cellwrap' + (vj.dummy ? ' headlined' : '') + (this.cityNameChecker(vj) ? ' headlined' : '')}>
{this.props.filters.toggleArrivals &&
<div data-headline='Départ à'>
<span className={((this.props.value.deletable && (!vj.dummy)) ? 'disabled ' : '') + 'input-group time'}>
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js
index bf6930215..1b9ff8f41 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js
@@ -21,7 +21,7 @@ if (window.journeyPatternId)
var initialState = {
filters: {
selectedJourneyPatterns : selectedJP,
- policy: window.perms,
+ policy: perms,
toggleArrivals: false,
queryString: '',
query: {
diff --git a/app/assets/stylesheets/components/_alerts.sass b/app/assets/stylesheets/components/_alerts.sass
index f05a4f39f..923b67cbc 100644
--- a/app/assets/stylesheets/components/_alerts.sass
+++ b/app/assets/stylesheets/components/_alerts.sass
@@ -14,6 +14,13 @@
.fa + span
margin-left: 10px
+ p a
+ border-color: inherit
+
+ &:hover
+ color: inherit
+ border-color: inherit
+
&.alert-dismissible
padding-right: 70px
diff --git a/app/assets/stylesheets/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass
index 9ee7e85ce..95d699c71 100644
--- a/app/assets/stylesheets/components/_forms.sass
+++ b/app/assets/stylesheets/components/_forms.sass
@@ -373,21 +373,25 @@ table, .table
vertical-align: top
border-right: 1px solid #fff
margin: 0
- min-height: 44px
+ min-height: 41px
padding: 5px 15px
.control-label
font-weight: 700
color: $darkgrey
- line-height: 34px
+ line-height: 31px
margin: 0
padding: 0 10px 0 0
vertical-align: middle
- > .form-control, > .form-group.date
+ > .form-control, > .form-group.date, > .form-group.select2ed
display: inline-block
width: auto
vertical-align: top
+ margin-bottom: 0
+
+ > .form-group.select2ed
+ width: 300px
> .actions
position: absolute
@@ -422,7 +426,7 @@ table, .table
position: relative
&.togglable
- padding: 7px 44px 7px 15px
+ padding: 5px 44px 6px 15px
cursor: pointer
> .control-label
@@ -451,11 +455,11 @@ table, .table
position: absolute
right: 15px
top: 0
- height: 44px
+ height: 41px
width: 15px
color: $blue
text-align: center
- line-height: 44px
+ line-height: 41px
&.open:before
content: '\f077'
diff --git a/app/assets/stylesheets/components/_select2.sass b/app/assets/stylesheets/components/_select2.sass
index 1eb6d01a8..5e3741bf0 100644
--- a/app/assets/stylesheets/components/_select2.sass
+++ b/app/assets/stylesheets/components/_select2.sass
@@ -2,6 +2,10 @@
// Select2 Customisation //
//-----------------------//
+.select2-selection__placeholder
+ color: rgba($grey, 0.65)
+ font-style: italic
+
// With Font Awesome adjusts.
.select2-selection__rendered
position: relative
@@ -43,3 +47,12 @@
&:hover
color: #fff
+
+.form-filter
+ .form-group.select2ed
+ .select2-container--bootstrap .select2-selection--single
+ height: 31px
+ padding: 4px 24px 5px 12px
+
+ .select2-container--bootstrap .select2-selection
+ border-color: rgba($grey, 0.3)
diff --git a/app/controllers/concerns/referential_support.rb b/app/controllers/concerns/referential_support.rb
index 34080d991..fe75e3579 100644
--- a/app/controllers/concerns/referential_support.rb
+++ b/app/controllers/concerns/referential_support.rb
@@ -16,17 +16,7 @@ module ReferentialSupport
end
def find_referential
- organisation_referential = current_organisation.referentials.find_by id: params[:referential_id]
- return organisation_referential if organisation_referential
-
- current_organisation.workbenches.each do |workbench|
- workbench_referential = workbench.all_referentials.find_by id: params[:referential_id]
- return workbench_referential if workbench_referential
- end
-
- raise ActiveRecord::RecordNotFound
+ current_organisation.find_referential params[:referential_id]
end
-end
-
-
+end
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 9b2101584..70c5c1a0d 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -1,5 +1,6 @@
class ImportsController < BreadcrumbController
- defaults :resource_class => Import
+ skip_before_action :authenticate_user!, only: [:download]
+ defaults resource_class: Import, collection_name: 'imports', instance_name: 'import'
respond_to :html
belongs_to :workbench
@@ -21,6 +22,10 @@ class ImportsController < BreadcrumbController
end
end
+ def create
+ create! { workbench_import_path(parent, resource) }
+ end
+
def download
if params[:token] == resource.token_download
send_file resource.file.path
@@ -31,7 +36,14 @@ class ImportsController < BreadcrumbController
private
+ def build_resource
+ # Manage only NetexImports for the moment
+ @import ||= NetexImport.new(*resource_params) do |import|
+ import.workbench = parent
+ end
+ end
+
def import_params
- params.require(:import).permit(:name, :file, :referential_id)
+ params.require(:import).permit(:name, :file, :type, :referential_id)
end
end
diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb
index 4d1a06fd3..51cc48c2a 100644
--- a/app/controllers/journey_patterns_collections_controller.rb
+++ b/app/controllers/journey_patterns_collections_controller.rb
@@ -38,6 +38,7 @@ class JourneyPatternsCollectionsController < ChouetteController
:street_name => sp.stop_area.try(:street_name)
}
end
+ @stop_points_list = @stop_points_list.sort_by {|a| a[:position] }
end
def update
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index 9a9e9b151..ed20a6d17 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -73,7 +73,7 @@ class ReferentialsController < BreadcrumbController
def resource
- @referential ||= current_organisation.referentials.find_by_id(params[:id])
+ @referential ||= current_organisation.find_referential(params[:id])
end
def collection
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index cbbf1b058..7f108b266 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -1,27 +1,16 @@
class WorkbenchesController < BreadcrumbController
- defaults :resource_class => Workbench
- respond_to :html, :only => [:show]
+ before_action :query_params, only: [:show]
+
+ defaults resource_class: Workbench
+ respond_to :html, only: [:show]
def show
- scope = Workbench.find(params[:id])
- scope = params[:q] ? scope.all_referentials : scope.referentials.ready
- periode = ransack_periode
- scope = scope.in_periode(periode) if periode
- @q = scope.ransack(params[:q])
+ scope = params[:q] ? resource.all_referentials : resource.referentials.ready
+ scope = ransack_associated_lines(scope)
+ @q = ransack_periode(scope).ransack(params[:q])
@q.organisation_name_eq_any ||= current_organisation.name unless params[:q]
- @wbench_refs = @q.result
- # @wbench_refs = Workbench.find(params[:id]).referentials
-
- case sort_column
- when "lines"
- @wbench_refs = @wbench_refs.joins(:metadatas).group("referentials.id").order("sum(array_length(referential_metadata.line_ids,1)) #{sort_direction}")
- else
- @wbench_refs = @wbench_refs.order("#{sort_column} #{sort_direction}")
- end
-
- @wbench_refs = @wbench_refs.paginate(page: params[:page], per_page: 30)
-
+ @wbench_refs = sort_result(@q.result).paginate(page: params[:page], per_page: 30)
show! do
build_breadcrumb :show
end
@@ -38,27 +27,49 @@ class WorkbenchesController < BreadcrumbController
end
private
- def sort_column
- (Workbench.find(params[:id]).referentials.column_names + %w{lines}).include?(params[:sort]) ? params[:sort] : 'name'
+ def resource
+ @workbench = Workbench.find params[:id]
+ end
+
+ def sort_result collection
+ col = (Workbench.find(params[:id]).referentials.column_names + %w{lines}).include?(params[:sort]) ? params[:sort] : 'name'
+ dir = %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
+ if col == "lines"
+ collection.joins(:metadatas).group("referentials.id").order("sum(array_length(referential_metadata.line_ids,1)) #{dir}")
+ else
+ collection.order("#{col} #{dir}")
+ end
end
- def sort_direction
- %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
+ def query_params
+ if params[:q].present?
+ params[:q].delete_if { |query, value| value.blank? }
+ end
+ end
+
+ # Fake ransack filter
+ def ransack_associated_lines scope
+ if params[:q] && params[:q]['associated_lines_id_eq']
+ scope = scope.include_metadatas_lines([params[:q]['associated_lines_id_eq']])
+ params[:q].delete('associated_lines_id_eq')
+ end
+ scope
end
- def ransack_periode
- return false unless params[:q] && params[:q]['validity_period']
+ # Fake ransack filter
+ def ransack_periode scope
+ return scope unless params[:q] && params[:q]['validity_period']
periode = params[:q]['validity_period']
- return false if periode['end_lteq(1i)'].empty? || periode['begin_gteq(1i)'].empty?
+ return scope if periode['end_lteq(1i)'].empty? || periode['begin_gteq(1i)'].empty?
- start_range = Date.civil(periode["begin_gteq(1i)"].to_i, periode["begin_gteq(2i)"].to_i, periode["begin_gteq(3i)"].to_i)
+ begin_range = Date.civil(periode["begin_gteq(1i)"].to_i, periode["begin_gteq(2i)"].to_i, periode["begin_gteq(3i)"].to_i)
end_range = Date.civil(periode["end_lteq(1i)"].to_i, periode["end_lteq(2i)"].to_i, periode["end_lteq(3i)"].to_i)
- if start_range > end_range
+ if begin_range > end_range
flash.now[:error] = t('referentials.errors.validity_period')
- false
else
- start_range..end_range
+ scope = scope.in_periode(begin_range..end_range)
end
+ scope
end
end
diff --git a/app/models/netex_import.rb b/app/models/netex_import.rb
index 53cbb7903..27f5846af 100644
--- a/app/models/netex_import.rb
+++ b/app/models/netex_import.rb
@@ -1,19 +1,3 @@
-class NetexImport < ImportTask
-
- def action_params
- {
- "netex-import" => {
- "no_save" => no_save,
- "user_name" => user_name,
- "name" => name,
- "organisation_name" => organisation.name,
- "referential_name" => referential.name,
- }
- }
- end
-
- def data_format
- "netex"
- end
+class NetexImport < Import
end
diff --git a/app/models/organisation.rb b/app/models/organisation.rb
index 8547ce5e1..d0742bda6 100644
--- a/app/models/organisation.rb
+++ b/app/models/organisation.rb
@@ -63,4 +63,17 @@ class Organisation < ActiveRecord::Base
puts "✓ Organisation #{org.name} has been updated" unless Rails.env.test?
end
end
+
+ def find_referential(referential_id)
+ organisation_referential = referentials.find_by id: referential_id
+ return organisation_referential if organisation_referential
+
+ workbenches.each do |workbench|
+ workbench_referential = workbench.all_referentials.find_by id: referential_id
+ return workbench_referential if workbench_referential
+ end
+
+ raise ActiveRecord::RecordNotFound
+ end
+
end
diff --git a/app/models/referential.rb b/app/models/referential.rb
index 85d581c33..1b02bdd7a 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -44,6 +44,7 @@ class Referential < ActiveRecord::Base
scope :ready, -> { where(ready: true) }
scope :in_periode, ->(periode) { where(id: referential_ids_in_periode(periode)) }
+ scope :include_metadatas_lines, ->(line_ids) { where('referential_metadata.line_ids && ARRAY[?]::bigint[]', line_ids) }
def lines
if metadatas.blank?
diff --git a/app/views/errors/not_found.html.slim b/app/views/errors/not_found.html.slim
index 913362251..6348ea1be 100644
--- a/app/views/errors/not_found.html.slim
+++ b/app/views/errors/not_found.html.slim
@@ -1,31 +1,21 @@
-.error
- h2 = "Désolé, la page demandée n'existe pas"
+/ PageHeader
+= pageheader 'bug',
+ 'Erreur 404',
+ ''
- a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank"
- = "N'hésitez pas à nous décrire le problème"
- = ", nous essaierons de le résoudre."
- br
- = "Merci d'avance"
- br
-
- = "Vous pouvez néanmoins continuer à utiliser l'application CHOUETTE"
- br
- br
- br
- br
- br
-
- h2 = "The page you were looking for doesn't exist."
-
- = "You may have mistyped the address or the page may have moved."
- br
-
- a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank"
- = "Please describe us what happened"
- = ", we'll try to come back with an answer."
- br
- = "Thank you."
- br
- br
- = "You can still continue the use the CHOUETTE application."
- br \ No newline at end of file
+.page_content
+ .container-fluid
+ .row
+ .col-lg-12
+ .alert.alert-danger
+ - if I18n.locale == :fr
+ p
+ strong = "Désolé, la page demandée n'existe pas."
+
+ p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO."
+
+ - else
+ p
+ strong = "The page you were looking for doesn't exist."
+
+ p = "You can still continue the use the IBOO application. Thank you for understanding."
diff --git a/app/views/errors/server_error.html.slim b/app/views/errors/server_error.html.slim
index b11176421..09884dc29 100644
--- a/app/views/errors/server_error.html.slim
+++ b/app/views/errors/server_error.html.slim
@@ -1,33 +1,21 @@
-.error
- h2 = "Désolé, une erreur est survenue"
+/ PageHeader
+= pageheader 'bug',
+ 'Erreur serveur',
+ ''
- a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank"
- = "N'hésitez pas à nous décrire le problème"
- = ", nous essaierons de le résoudre."
- br
- = "Merci d'avance"
- br
- br
-
- = "Vous pouvez néanmoins continuer à utiliser l'application CHOUETTE"
- br
- br
- br
- br
- br
-
- h2 = "We're sorry, but something went wrong."
-
- = "You may have mistyped the address or the page may have moved."
- br
-
- a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank"
- = "Please describe us what happened"
- = ", we'll try to come back with an answer."
- br
- = "Thank you."
- br
- br
-
- = "You can still continue the use the CHOUETTE application."
- br \ No newline at end of file
+.page_content
+ .container-fluid
+ .row
+ .col-lg-12
+ .alert.alert-danger
+ - if I18n.locale == :fr
+ p
+ strong = "Désolé, une erreur est survenue."
+
+ p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO."
+
+ - else
+ p
+ strong = "We're sorry, but something went wrong."
+
+ p = "You can still continue the use the IBOO application. Thank you for understanding."
diff --git a/app/views/imports/_form.html.slim b/app/views/imports/_form.html.slim
index 693ce6fc4..b795e908f 100644
--- a/app/views/imports/_form.html.slim
+++ b/app/views/imports/_form.html.slim
@@ -1,5 +1,6 @@
-= simple_form_for [workbench, import] do |f|
+= simple_form_for import, as: :import, url: workbench_imports_path(workbench) do |f|
= f.input :name
= f.input :file
- = f.association :referential
+ = f.association :referential, collection: workbench.referentials
+ = f.input :type, as: :hidden
= f.button :submit
diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim
index fd87de90f..6e2d49f73 100644
--- a/app/views/imports/index.html.slim
+++ b/app/views/imports/index.html.slim
@@ -2,7 +2,7 @@
- @imports.each do |import|
.import
li = link_to import.name, workbench_import_path(@workbench, import)
- li = import.referential.name
+ li = import.referential.name if import.referential
li = link_to import.file.file.filename, import.file.url, target: :_blank
hr
diff --git a/app/views/layouts/navigation/_nav_panel_profile.html.slim b/app/views/layouts/navigation/_nav_panel_profile.html.slim
index 82e8dda76..bcbf89e67 100644
--- a/app/views/layouts/navigation/_nav_panel_profile.html.slim
+++ b/app/views/layouts/navigation/_nav_panel_profile.html.slim
@@ -4,5 +4,5 @@
.panel-body
p = current_user.name
p = current_organisation.name
- p
- = mail_to current_user.email, current_user.email
+ p = mail_to current_user.email, current_user.email
+ p = t('last_sync', time: l(current_user.synced_at, format: :short)) if current_user.synced_at
diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim
index f12f47aa4..62a17ea1e 100644
--- a/app/views/referentials/show.html.slim
+++ b/app/views/referentials/show.html.slim
@@ -9,18 +9,21 @@
.row.mb-sm
.col-lg-12.text-right
/ Actions are: controler, rapport de controle, dupliquer, purger, conserver, supprimer
- = link_to t('actions.clone'), new_referential_path(from: @referential.id), class: 'btn btn-primary'
+ - if policy(@referential).new?
+ = link_to t('actions.clone'), new_referential_path(from: @referential.id), class: 'btn btn-primary'
- button.btn.btn-primary type='button' data-toggle='modal' data-target='#purgeModal' Purger
+ - if policy(@referential).edit?
+ button.btn.btn-primary type='button' data-toggle='modal' data-target='#purgeModal' Purger
- - if @referential.archived?
- = link_to t('actions.unarchive'), unarchive_referential_path(@referential.id), method: :put, class: 'btn btn-primary'
- - else
- = link_to t('actions.archive'), archive_referential_path(@referential.id), method: :put, class: 'btn btn-primary'
+ - if @referential.archived?
+ = link_to t('actions.unarchive'), unarchive_referential_path(@referential.id), method: :put, class: 'btn btn-primary'
+ - else
+ = link_to t('actions.archive'), archive_referential_path(@referential.id), method: :put, class: 'btn btn-primary'
- = link_to referential_path(@referential), method: :delete, data: {confirm: t('referentials.actions.destroy_confirm')}, class: 'btn btn-primary' do
- span.fa.fa-trash
- span = t('actions.destroy')
+ - if policy(@referential).destroy?
+ = link_to referential_path(@referential), method: :delete, data: {confirm: t('referentials.actions.destroy_confirm')}, class: 'btn btn-primary' do
+ span.fa.fa-trash
+ span = t('actions.destroy')
/ PageContent
.page_content
diff --git a/app/views/routes/_form.html.slim b/app/views/routes/_form.html.slim
index 64c4f5730..2603f64cb 100644
--- a/app/views/routes/_form.html.slim
+++ b/app/views/routes/_form.html.slim
@@ -17,7 +17,7 @@
.col-lg-12
#stop_points
- = f.button :submit, class: 'btn btn-default formSubmitr', form: 'route_form'
+ = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'route_form'
// Get JSON data for route stop points
diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim
index 6cdf1d7d5..a5cc43b69 100644
--- a/app/views/vehicle_journeys/index.html.slim
+++ b/app/views/vehicle_journeys/index.html.slim
@@ -2,7 +2,7 @@
= pageheader 'map-marker',
t('vehicle_journeys.index.title', route: @route.name ),
'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@vehicle_journeys.last.updated_at, format: :short)) do
+ (@vehicle_journeys.any? ? t('last_update', time: l(@vehicle_journeys.last.updated_at, format: :short)) : '') do
/ PageContent
.page_content
diff --git a/app/views/workbenches/_filters.html.slim b/app/views/workbenches/_filters.html.slim
index 9584a566d..7a962f927 100644
--- a/app/views/workbenches/_filters.html.slim
+++ b/app/views/workbenches/_filters.html.slim
@@ -1,12 +1,16 @@
= search_form_for @q, url: workbench_path(@workbench.id), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f|
.ffg-row
.input-group.search_bar
- = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de référentiel'
+ = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de référentiel...'
span.input-group-btn
button.btn.btn-default type='submit'
span.fa.fa-search
.ffg-row
+ .form-group
+ = f.label 'Ligne', required: false, class: 'control-label'
+ = f.input :associated_lines_id_eq, as: :select, collection: @workbench.lines.includes(:company).order(:name), input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez une ligne...' }, label: false, label_method: :display_name, wrapper_html: { class: 'select2ed'}
+
.form-group.togglable
= f.label @wbench_refs.human_attribute_name(:status), required: false, class: 'control-label'
= f.input :archived_at_not_null, label: ("<span>Conservé<span class='fa fa-archive'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox_list' }, input_html: { class: 'check_boxes' }
diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb
deleted file mode 100644
index c7262b8a0..000000000
--- a/config/initializers/locale.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'i18n/backend/active_record'
-Translation = I18n::Backend::ActiveRecord::Translation
-
-if Translation.table_exists?
- I18n.backend = I18n::Backend::ActiveRecord.new
-
- I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Memoize)
- I18n::Backend::ActiveRecord.send(:include, I18n::Backend::Flatten)
- I18n::Backend::Simple.send(:include, I18n::Backend::Memoize)
- I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
-
- I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
-end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 4fdb04cff..7c8e58505 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -14,5 +14,6 @@ en:
short: "%Y/%m/%d"
last_update: 'Last update on<br>%{time}'
+ last_sync: 'Last sync on %{time}'
validity_range: '%{debut} > %{end}'
metadatas: 'Metadatas'
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 77ea26326..c48ba8835 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -14,5 +14,6 @@ fr:
short: "%d/%m/%Y"
last_update: 'Dernière mise à jour<br>le %{time}'
+ last_sync: 'Dernière mise à jour le %{time}'
validity_range: '%{debut} > %{end}'
metadatas: 'Métadonnées'
diff --git a/db/migrate/20170317114614_remove_stop_points_route_fk.rb b/db/migrate/20170317114614_remove_stop_points_route_fk.rb
index ff191445a..b02516328 100644
--- a/db/migrate/20170317114614_remove_stop_points_route_fk.rb
+++ b/db/migrate/20170317114614_remove_stop_points_route_fk.rb
@@ -1,6 +1,6 @@
class RemoveStopPointsRouteFk < ActiveRecord::Migration
def change
- if foreign_keys(:stop_points).include?(:stoppoint_route_fkey)
+ if foreign_keys(:stop_points).any? { |f| f.options[:name] = :stoppoint_route_fkey }
remove_foreign_key :stop_points, name: :stoppoint_route_fkey
end
end
diff --git a/db/migrate/20170321141620_add_type_to_imports.rb b/db/migrate/20170321141620_add_type_to_imports.rb
new file mode 100644
index 000000000..fc4619969
--- /dev/null
+++ b/db/migrate/20170321141620_add_type_to_imports.rb
@@ -0,0 +1,10 @@
+class AddTypeToImports < ActiveRecord::Migration
+ def up
+ add_column :imports, :type, :string
+ execute "update imports set type = 'NetexImport' where type is null"
+ end
+
+ def down
+ remove_column :imports, :type, :string
+ end
+end
diff --git a/db/migrate/20170322075010_delete_translations.rb b/db/migrate/20170322075010_delete_translations.rb
new file mode 100644
index 000000000..76976f6b8
--- /dev/null
+++ b/db/migrate/20170322075010_delete_translations.rb
@@ -0,0 +1,5 @@
+class DeleteTranslations < ActiveRecord::Migration
+ def change
+ drop_table :translations
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 33d99ee9e..027079611 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170320125813) do
+ActiveRecord::Schema.define(version: 20170322075010) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -165,22 +165,6 @@ ActiveRecord::Schema.define(version: 20170320125813) do
add_index "connection_links", ["objectid"], :name => "connection_links_objectid_key", :unique => true
- create_table "delayed_jobs", force: true do |t|
- t.integer "priority", default: 0
- t.integer "attempts", default: 0
- t.text "handler"
- t.text "last_error"
- t.datetime "run_at"
- t.datetime "locked_at"
- t.datetime "failed_at"
- t.string "locked_by"
- t.string "queue"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
-
create_table "exports", force: true do |t|
t.integer "referential_id", limit: 8
t.string "status"
@@ -299,6 +283,7 @@ ActiveRecord::Schema.define(version: 20170320125813) do
t.datetime "started_at"
t.datetime "ended_at"
t.string "token_download"
+ t.string "type"
end
add_index "imports", ["referential_id"], :name => "index_imports_on_referential_id"
@@ -747,16 +732,6 @@ ActiveRecord::Schema.define(version: 20170320125813) do
t.datetime "updated_at"
end
- create_table "translations", force: true do |t|
- t.string "locale"
- t.string "key"
- t.text "value"
- t.text "interpolations"
- t.boolean "is_proc", default: false
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: ""
@@ -850,8 +825,6 @@ ActiveRecord::Schema.define(version: 20170320125813) do
add_index "workbenches", ["stop_area_referential_id"], :name => "index_workbenches_on_stop_area_referential_id"
Foreigner.load
- add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey", dependent: :delete
-
add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", dependent: :delete
add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", dependent: :nullify
diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb
index 68f7fc621..fee54f4c1 100644
--- a/lib/stif/reflex_synchronization.rb
+++ b/lib/stif/reflex_synchronization.rb
@@ -71,12 +71,15 @@ module Stif
end
def stop_area_area_type entry, method
+ from = method.last
+ from = 'r' if entry['OBJECT_STATUS'] == 'REFERENCE_OBJECT'
+ from = 'p' if entry['OBJECT_STATUS'] == 'LOCAL_OBJECT'
+ type = entry['TypeOfPlaceRef']
+
if entry['type'] == 'Quay'
- type = 'zder' if entry['OBJECT_STATUS'] == 'REFERENCE_OBJECT'
- type = 'zdep' if entry['OBJECT_STATUS'] == 'LOCAL_OBJECT'
+ type = "zde#{from}"
else
- type = entry['TypeOfPlaceRef']
- type = "#{type.to_s}#{method.last}" unless type == 'LDA'
+ type = "zdl#{from}" if type != 'LDA'
end
type.downcase
end
diff --git a/public/403.html b/public/403.html
deleted file mode 100644
index 34d6e6bad..000000000
--- a/public/403.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>The page you were looking is forbidden (403)</title>
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <style>
- body {
- background-color: #EFEFEF;
- color: #2E2F30;
- text-align: center;
- font-family: arial, sans-serif;
- margin: 0;
- }
-
- div.dialog {
- width: 95%;
- max-width: 33em;
- margin: 4em auto 0;
- }
-
- div.dialog > div {
- border: 1px solid #CCC;
- border-right-color: #999;
- border-left-color: #999;
- border-bottom-color: #BBB;
- border-top: #B00100 solid 4px;
- border-top-left-radius: 9px;
- border-top-right-radius: 9px;
- background-color: white;
- padding: 7px 12% 0;
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
- }
-
- h1 {
- font-size: 100%;
- color: #730E15;
- line-height: 1.5em;
- }
-
- div.dialog > p {
- margin: 0 0 1em;
- padding: 1em;
- background-color: #F7F7F7;
- border: 1px solid #CCC;
- border-right-color: #999;
- border-left-color: #999;
- border-bottom-color: #999;
- border-bottom-left-radius: 4px;
- border-bottom-right-radius: 4px;
- border-top-color: #DADADA;
- color: #666;
- box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
- }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/403.html -->
- <div class="dialog">
- <div>
- <h1>The page you were looking is forbidden.</h1>
- </div>
- </div>
-</body>
-</html>
diff --git a/public/404.html b/public/404.html
deleted file mode 100644
index 72bd4129d..000000000
--- a/public/404.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <!-- <link href="assets/application.css" media="screen" rel="stylesheet" type="text/css" /> -->
- <title>The page you were looking for doesn't exist (404)</title>
- <style type="text/css">
- body { background-color: #fff; text-align: center; }
- div.dialog {
- width: 45em;
- padding:1em;
- margin: 2em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; font-weight: bold}
- a,a:visited { text-decoration: underline; color: blue}
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/404.html
- <div id="header">
- <div class="infos">
- <div class="logo">
- <a href="referentials">
- <img src="assets/logo_chouette.png" alt="Logo_chouette">
- </a>
- </div>
- </div>
- </div>-->
- <div class="dialog">
- <h1>D&eacute;sol&eacute;, la page demand&eacute;e n'existe pas</h1>
- <a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank">N'h&eacute;sitez pas &agrave; nous d&eacute;crire le probl&egrave;me</a>, nous essaierons de le r&eacute;soudre.<br/>Merci d'avance<br/> <br/>
- Vous pouvez n&eacute;anmoins continuer &agrave; utiliser l'application CHOUETTE<br/>
- <a href="javascript:history.back()" >Retour</a><br/>
- <!-- <a href="referentials" >Accueil</a> -->
- <br/> <br/><br/> <br/>
- <h1>The page you were looking for doesn't exist.</h1>
- You may have mistyped the address or the page may have moved. <br/>
- <a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank">Please describe us what happened</a>, we'll try to come back with an answer. <br/>Thank you. <br/> <br/>
- You can still continue the use the CHOUETTE application. <br/>
- <a href="javascript:history.back()" >Back</a><br/>
- <!-- <a href="referentials" >Home</a> -->
- </div>
-</body>
-</html>
diff --git a/public/422.html b/public/422.html
deleted file mode 100644
index ea857f263..000000000
--- a/public/422.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <!-- <link href="assets/application.css" media="screen" rel="stylesheet" type="text/css" /> -->
- <title>The change you wanted was rejected (422)</title>
- <style type="text/css">
- body { background-color: #fff; text-align: center; }
- div.dialog {
- width: 45em;
- padding:1em;
- margin: 2em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; font-weight: bold}
- a,a:visited { text-decoration: underline; color: blue}
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/422.html
- <div id="header">
- <div class="infos">
- <div class="logo">
- <a href="referentials">
- <img src="assets/logo_chouette.png" alt="Logo_chouette">
- </a>
- </div>
- </div>
- </div>-->
- <div class="dialog">
- <h1>La modification demand&eacute;e a &eacute;t&eacute; refus&eacute;e</h1>
- <a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank">N'h&eacute;sitez pas &agrave; nous d&eacute;crire le probl&egrave;me</a>, nous essaierons de le r&eacute;soudre.<br/>Merci d'avance<br/> <br/>
- Vous pouvez n&eacute;anmoins continuer &agrave; utiliser l'application CHOUETTE<br/>
- <a href="javascript:history.back()" >Retour</a><br/>
- <!-- <a href="referentials" >Accueil</a> -->
- <br/> <br/><br/> <br/>
- <h1>The change you wanted was rejected.</h1>
- Maybe you tried to change something you didn't have access to. <br/>
- <a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank">Please describe us what happened</a>, we'll try to come back with an answer. <br/>Thank you. <br/> <br/>
- You can still continue the use the CHOUETTE application. <br/>
- <a href="javascript:history.back()" >Back</a><br/>
- <!-- <a href="referentials" >Home</a> -->
- </div>
-</body>
-</html>
diff --git a/public/500.html b/public/500.html
deleted file mode 100644
index 22a514e37..000000000
--- a/public/500.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<html><head>
- <title>We're sorry, but something went wrong (500)</title>
- <style type="text/css">
- body { background-color: #fff; text-align: center; }
- div.dialog {
- width: 45em;
- padding:1em;
- margin: 2em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; font-weight: bold}
- a,a:visited { text-decoration: underline; color: blue}
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/500.html
- <div id="header">
- <div class="infos">
- <div class="logo">
- <a href="referentials">
- <img src="assets/logo_chouette.png" alt="Logo_chouette">
- </a>
- </div>
- </div>
- </div>-->
- <div class="dialog">
- <h1>D&eacute;sol&eacute;, une erreur est survenue</h1>
- <a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank">N'h&eacute;sitez pas &agrave; nous d&eacute;crire le probl&egrave;me</a>, nous essaierons de le r&eacute;soudre.<br/>Merci d'avance<br/> <br/>
- Vous pouvez n&eacute;anmoins continuer &agrave; utiliser l'application CHOUETTE<br/>
- <a href="javascript:history.back()" >Retour</a><br/>
- <!-- <a href="referentials" >Accueil</a> -->
- <br/> <br/><br/> <br/>
- <h1>We're sorry, but something went wrong.</h1>
- <a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank">Please describe us what happened</a>, we'll try to come back with an answer. <br/>Thank you. <br/> <br/>
- You can still continue the use the CHOUETTE application. <br/>
- <a href="javascript:history.back()" >Back</a><br/>
- <!-- <a href="referentials" >Home</a> -->
- </div>
-</body>
-</html> \ No newline at end of file