diff options
| author | cedricnjanga | 2017-12-20 09:10:28 +0100 |
|---|---|---|
| committer | Luc Donnet | 2017-12-21 13:57:03 +0100 |
| commit | e3f7317345555584464c93ce81423d3defd82d57 (patch) | |
| tree | a73fd52eb9aa253c0a5e3633f90f9c273ff7d507 | |
| parent | 43f8c76522288a0328d520dfc753ed173fc84964 (diff) | |
| download | chouette-core-e3f7317345555584464c93ce81423d3defd82d57.tar.bz2 | |
Take review into account
| -rw-r--r-- | app/assets/stylesheets/typography/_sboiv.sass | 2 | ||||
| -rw-r--r-- | app/decorators/purchase_window_decorator.rb | 7 | ||||
| -rw-r--r-- | app/helpers/business_calendar_helper.rb | 5 | ||||
| -rw-r--r-- | app/models/chouette/purchase_window.rb | 16 | ||||
| -rw-r--r-- | app/models/organisation.rb | 1 | ||||
| -rw-r--r-- | app/views/business_calendars/edit.html.slim | 7 | ||||
| -rw-r--r-- | app/views/business_calendars/show.html.slim | 21 | ||||
| -rw-r--r-- | app/views/dashboards/_dashboard.html.slim | 20 | ||||
| -rw-r--r-- | app/views/purchase_windows/_filters.html.slim | 6 | ||||
| -rw-r--r-- | config/locales/dashboard.en.yml | 16 | ||||
| -rw-r--r-- | config/locales/dashboard.fr.yml | 12 | ||||
| -rw-r--r-- | config/locales/purchase_windows.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/purchase_windows.fr.yml | 1 | ||||
| -rw-r--r-- | spec/factories/business_calendars.rb | 8 |
14 files changed, 53 insertions, 70 deletions
diff --git a/app/assets/stylesheets/typography/_sboiv.sass b/app/assets/stylesheets/typography/_sboiv.sass index 37f393167..0ed2890fa 100644 --- a/app/assets/stylesheets/typography/_sboiv.sass +++ b/app/assets/stylesheets/typography/_sboiv.sass @@ -89,7 +89,7 @@ .sb-OAS:before content: '\e90f' -.sb-calendar:before, .sb-purchase_windows:before +.sb-calendar:before, .sb-purchase_window:before content: '\e910' .sb-journey_pattern:before diff --git a/app/decorators/purchase_window_decorator.rb b/app/decorators/purchase_window_decorator.rb index 4ad5a7589..a2060623e 100644 --- a/app/decorators/purchase_window_decorator.rb +++ b/app/decorators/purchase_window_decorator.rb @@ -24,4 +24,11 @@ class PurchaseWindowDecorator < Draper::Decorator links end + + def bounding_dates + unless object.date_ranges.empty? + object.date_ranges.min.begin..object.date_ranges.max.end + end + end + end
\ No newline at end of file diff --git a/app/helpers/business_calendar_helper.rb b/app/helpers/business_calendar_helper.rb deleted file mode 100644 index d99fe3bc4..000000000 --- a/app/helpers/business_calendar_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -module BusinessCalendarHelper - def color_diplsay(color) - content_tag(:span, '', class: 'fa fa-circle', style: "color:#{color}") - end -end
\ No newline at end of file diff --git a/app/models/chouette/purchase_window.rb b/app/models/chouette/purchase_window.rb index a9bbe2003..ab5514ee6 100644 --- a/app/models/chouette/purchase_window.rb +++ b/app/models/chouette/purchase_window.rb @@ -15,26 +15,12 @@ module Chouette validates_presence_of :name, :referential scope :overlapping, -> (period_range) do - where("(periods.begin <= :end AND periods.end >= :begin) OR (dates BETWEEN :begin AND :end)", {begin: period_range.begin, end: period_range.end}) + where("(date_ranges.begin <= :end AND date_ranges.end >= :begin)", {begin: period_range.begin, end: period_range.end}) end def local_id "IBOO-#{self.referential.id}-#{self.id}" end - - def bounding_dates - periods_min_date..periods_max_date if periods_min_date && periods_max_date - end - - def periods_max_date - return nil if self.periods.empty? - self.periods.max.end - end - - def periods_min_date - return nil if self.periods.empty? - self.periods.min.begin - end # def checksum_attributes # end diff --git a/app/models/organisation.rb b/app/models/organisation.rb index ea13b327c..4343c87af 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -13,7 +13,6 @@ class Organisation < ActiveRecord::Base has_many :workbenches has_many :calendars - has_many :business_calendars has_many :api_keys, class_name: 'Api::V1::ApiKey' validates_presence_of :name diff --git a/app/views/business_calendars/edit.html.slim b/app/views/business_calendars/edit.html.slim deleted file mode 100644 index 6d63b3489..000000000 --- a/app/views/business_calendars/edit.html.slim +++ /dev/null @@ -1,7 +0,0 @@ -- breadcrumb :business_calendar, @business_calendar -- page_header_content_for @business_calendar -.page_content - .container-fluid - .row - .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 - = render 'form' diff --git a/app/views/business_calendars/show.html.slim b/app/views/business_calendars/show.html.slim deleted file mode 100644 index 7c0b2ca41..000000000 --- a/app/views/business_calendars/show.html.slim +++ /dev/null @@ -1,21 +0,0 @@ -- breadcrumb :business_calendar, @business_calendar -- page_header_content_for @business_calendar -- content_for :page_header_content do - .row.mb-sm - .col-lg-12.text-right - - @business_calendar.action_links.each do |link| - = link_to link.href, - method: link.method, - data: link.data, - class: 'btn btn-primary' do - = link.content - -.page_content - .container-fluid - .row - .col-lg-6.col-md-6.col-sm-12.col-xs-12 - = definition_list t('metadatas'), - { 'Nom court' => @business_calendar.try(:short_name), - 'Organisation' => @business_calendar.organisation.name, - BusinessCalendar.human_attribute_name(:dates) => @business_calendar.dates.collect{|d| l(d, format: :short)}.join(', ').html_safe, - BusinessCalendar.human_attribute_name(:date_ranges) => @business_calendar.periods.map{|d| t('validity_range', debut: l(d.begin, format: :short), end: l(d.end, format: :short))}.join('<br>').html_safe } diff --git a/app/views/dashboards/_dashboard.html.slim b/app/views/dashboards/_dashboard.html.slim index 27d23cfc1..b468fed27 100644 --- a/app/views/dashboards/_dashboard.html.slim +++ b/app/views/dashboards/_dashboard.html.slim @@ -31,27 +31,29 @@ = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' - else .panel-body - em.small.text-muted Aucun modèle de calendrier défini + em.small.text-muted + = t('dasboard.calendars.none') .panel.panel-default .panel-heading h3.panel-title.with_actions - = "Calendriers commerciaux" + = t('dasboard.purchase_windows.title') div - = link_to '', business_calendars_path, class: ' fa fa-chevron-right pull-right' - - if @dashboard.current_organisation.business_calendars.present? + = link_to '', purchase_windows_path, class: ' fa fa-chevron-right pull-right' + - if @dashboard.current_organisation.purchase_windows.present? .list-group - - @dashboard.current_organisation.business_calendars.order("updated_at desc").limit(5).each do |business_calendar| - = link_to business_calendar.name, business_calendar_path(business_calendar), class: 'list-group-item' + - @dashboard.current_organisation.purchase_windows.order("updated_at desc").limit(5).each do |purchase_window| + = link_to purchase_window.name, referential_purchase_window_path(purchase_window.referential, purchase_window), class: 'list-group-item' - else .panel-body - em.small.text-muted Aucun calendrier commercial défini + em.small.text-muted + = t('dasboard.purchase_windows.none') .col-lg-6.col-md-6.col-sm-6.col-xs-12 .panel.panel-default .panel-heading h3.panel-title - = "Référentiels d'arrêts" + = t('dashboard.stop_area_referentials.title') .list-group - @dashboard.current_organisation.stop_area_referentials.each do |referential| = link_to referential.name, stop_area_referential_stop_areas_path(referential), class: 'list-group-item' @@ -59,7 +61,7 @@ .panel.panel-default .panel-heading h3.panel-title - = "Référentiels de lignes" + = t('dashboard.line_referentials.title') .list-group - @dashboard.current_organisation.line_referentials.all.each do |referential| = link_to referential.name, line_referential_lines_path(referential), class: 'list-group-item' diff --git a/app/views/purchase_windows/_filters.html.slim b/app/views/purchase_windows/_filters.html.slim index e086af4b5..8540920cd 100644 --- a/app/views/purchase_windows/_filters.html.slim +++ b/app/views/purchase_windows/_filters.html.slim @@ -1,7 +1,7 @@ = search_form_for @q, url: referential_purchase_windows_path, builder: SimpleForm::FormBuilder, html: { method: :get, 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 calendrier commercial...' + = f.search_field :name_cont, class: 'form-control', placeholder: t('purchase_windows.index.filter_placeholder') span.input-group-btn button.btn.btn-default#search_btn type='submit' span.fa.fa-search @@ -14,5 +14,5 @@ = p.input :end_date, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true .actions - = link_to 'Effacer', referential_purchase_windows_path, class: 'btn btn-link' - = f.submit 'Filtrer', id: 'purchase_window_filter_btn', class: 'btn btn-default' + = link_to t('actions.erase'), referential_purchase_windows_path, class: 'btn btn-link' + = f.submit t('actions.filter'), id: 'purchase_window_filter_btn', class: 'btn btn-default' diff --git a/config/locales/dashboard.en.yml b/config/locales/dashboard.en.yml new file mode 100644 index 000000000..8d46ff7aa --- /dev/null +++ b/config/locales/dashboard.en.yml @@ -0,0 +1,16 @@ +en: + dashboards: + show: + title: "Dashboard %{organisation}" + calendars: + title: Calendars + none: No calendar created + purchase_windows: + title: Purchase windows + none: No purchase window created + line_referentials: + title: Line referential + none: No line referential created + stop_area_referentials: + title: Stop area referential + none: No stop area referential created diff --git a/config/locales/dashboard.fr.yml b/config/locales/dashboard.fr.yml index fffb36cd1..d0aa36d61 100644 --- a/config/locales/dashboard.fr.yml +++ b/config/locales/dashboard.fr.yml @@ -2,3 +2,15 @@ fr: dashboards: show: title: "Tableau de bord %{organisation}" + calendars: + title: Modèles de calendrier + none: Aucun calendrier défini + purchase_windows: + title: Calendriers commerciaux + none: Aucun calendrier commercial défini + line_referentials: + title: Référentiels de lignes + none: Aucun référentiels de lignes défini + stop_area_referentials: + title: Référentiels d'arrêts + none: Aucun référentiels d'arrêts défini diff --git a/config/locales/purchase_windows.en.yml b/config/locales/purchase_windows.en.yml index eddc0de35..5fa98f08f 100644 --- a/config/locales/purchase_windows.en.yml +++ b/config/locales/purchase_windows.en.yml @@ -37,6 +37,7 @@ en: not_shared: Not shared search_no_results: No purchase window matching your query date: Date + filter_placeholder: Put the name of a purchase window... create: title: Add a new purchase window new: diff --git a/config/locales/purchase_windows.fr.yml b/config/locales/purchase_windows.fr.yml index 9e00b0b9c..a7db04432 100644 --- a/config/locales/purchase_windows.fr.yml +++ b/config/locales/purchase_windows.fr.yml @@ -37,6 +37,7 @@ fr: not_shared: Non partagées search_no_results: Aucun calendrier commercial ne correspond à votre recherche date: Date + filter_placeholder: Indiquez un nom de calendrier commercial... new: title: Ajouter un calendrier commercial create: diff --git a/spec/factories/business_calendars.rb b/spec/factories/business_calendars.rb deleted file mode 100644 index 309cc18f4..000000000 --- a/spec/factories/business_calendars.rb +++ /dev/null @@ -1,8 +0,0 @@ -FactoryGirl.define do - factory :business_calendar do - name "MyString" - color "MyString" - dates "2017-12-14" - periods "" - end -end |
