diff options
| author | cedricnjanga | 2017-12-15 11:54:12 +0100 | 
|---|---|---|
| committer | Luc Donnet | 2017-12-21 13:54:07 +0100 | 
| commit | 70e46cba80443fb615e1f7182422c8de6d96e7c3 (patch) | |
| tree | 080d965835b3fcb1cbba8612da4dfbe8354a53be | |
| parent | 0cf1d52d1dfc83fe304c7f3b7f7e1114ade28c11 (diff) | |
| download | chouette-core-70e46cba80443fb615e1f7182422c8de6d96e7c3.tar.bz2 | |
Handle page title error display
attempt to add select tag for model color
| -rw-r--r-- | app/helpers/business_calendar_helper.rb | 5 | ||||
| -rw-r--r-- | app/models/business_calendar.rb | 2 | ||||
| -rw-r--r-- | app/views/business_calendars/_form.html.slim | 2 | ||||
| -rw-r--r-- | app/views/business_calendars/index.html.slim | 2 | ||||
| -rw-r--r-- | config/locales/business_calendars.en.yml (renamed from config/locales/businnes_calendars.en.yml) | 2 | ||||
| -rw-r--r-- | config/locales/business_calendars.fr.yml | 2 | ||||
| -rw-r--r-- | config/locales/calendars.en.yml | 2 | ||||
| -rw-r--r-- | config/locales/calendars.fr.yml | 2 | ||||
| -rw-r--r-- | db/schema.rb | 2 | 
9 files changed, 18 insertions, 3 deletions
| diff --git a/app/helpers/business_calendar_helper.rb b/app/helpers/business_calendar_helper.rb new file mode 100644 index 000000000..d99fe3bc4 --- /dev/null +++ b/app/helpers/business_calendar_helper.rb @@ -0,0 +1,5 @@ +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/business_calendar.rb b/app/models/business_calendar.rb index 0064b4537..45fbdb6ac 100644 --- a/app/models/business_calendar.rb +++ b/app/models/business_calendar.rb @@ -4,6 +4,8 @@ require_relative 'calendar/period'  class BusinessCalendar < ActiveRecord::Base    include CalendarSupport +  extend Enumerize +  enumerize :color, in: %w(#9B9B9B #FFA070 #C67300 #7F551B #41CCE3 #09B09C #3655D7 #6321A0 #E796C6 #DD2DAA)    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}) diff --git a/app/views/business_calendars/_form.html.slim b/app/views/business_calendars/_form.html.slim index a7c0d8c4a..0fd504e51 100644 --- a/app/views/business_calendars/_form.html.slim +++ b/app/views/business_calendars/_form.html.slim @@ -3,7 +3,7 @@      .col-lg-12        = f.input :name        = f.input :short_name -      = f.input :color +      = f.input :color, as: :select, collection: BusinessCalendar.color.values, label_method: lambda { |c| color_diplsay(c) }    .separator diff --git a/app/views/business_calendars/index.html.slim b/app/views/business_calendars/index.html.slim index ce7f2343b..0cb81f0ac 100644 --- a/app/views/business_calendars/index.html.slim +++ b/app/views/business_calendars/index.html.slim @@ -24,7 +24,7 @@                ), \                TableBuilderHelper::Column.new( \                  key: :color, \ -                attribute: 'color'\ +                attribute: Proc.new { |tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }\                ), \                TableBuilderHelper::Column.new( \                  key: :created_at, \ diff --git a/config/locales/businnes_calendars.en.yml b/config/locales/business_calendars.en.yml index 6232adc43..19ac3a8f5 100644 --- a/config/locales/businnes_calendars.en.yml +++ b/config/locales/business_calendars.en.yml @@ -39,6 +39,8 @@ en:        not_shared: Not shared        search_no_results: No business calendar matching your query        date: Date +    create: +      title: Add a new business calendar      new:        title: Add a new business calendar      edit: diff --git a/config/locales/business_calendars.fr.yml b/config/locales/business_calendars.fr.yml index a67864384..2c15fb9e7 100644 --- a/config/locales/business_calendars.fr.yml +++ b/config/locales/business_calendars.fr.yml @@ -41,6 +41,8 @@ fr:        date: Date      new:        title: Ajouter un calendrier commercial +    create: +      title: Ajouter un calendrier commercial      edit:        title: Editer le calendrier comercial %{name}      show: diff --git a/config/locales/calendars.en.yml b/config/locales/calendars.en.yml index d3cc57677..a2110d053 100644 --- a/config/locales/calendars.en.yml +++ b/config/locales/calendars.en.yml @@ -41,6 +41,8 @@ en:        date: Date      new:        title: Add a new calendar +    create: +      title: Add a new calendar      edit:        title: Update calendar %{name}      show: diff --git a/config/locales/calendars.fr.yml b/config/locales/calendars.fr.yml index fc895bf89..bd3051730 100644 --- a/config/locales/calendars.fr.yml +++ b/config/locales/calendars.fr.yml @@ -41,6 +41,8 @@ fr:        date: Date      new:        title: Ajouter un calendrier +    create: +      title: Ajouter un calendrier      edit:        title: Editer le calendrier %{name}      show: diff --git a/db/schema.rb b/db/schema.rb index 36128807a..faf7f3a1e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -416,9 +416,9 @@ ActiveRecord::Schema.define(version: 20171214130636) do      t.string   "type"      t.integer  "parent_id",             limit: 8      t.string   "parent_type" -    t.datetime "notified_parent_at"      t.integer  "current_step",                    default: 0      t.integer  "total_steps",                     default: 0 +    t.datetime "notified_parent_at"      t.string   "creator"    end | 
