diff options
| author | jpl | 2017-04-07 14:29:52 +0200 |
|---|---|---|
| committer | jpl | 2017-04-07 14:30:00 +0200 |
| commit | 9f1e47f9ece21b0a56b57f126ecb8ec60671af04 (patch) | |
| tree | f925e3d3dd719e602ff7977ab737ba94b1cdced5 /app | |
| parent | 5b888d05869f88d196bf53f229b6d3659b2305b4 (diff) | |
| download | chouette-core-9f1e47f9ece21b0a56b57f126ecb8ec60671af04.tar.bz2 | |
Refs #3076: updating styles && helper on calendars for tt#show
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/stylesheets/components/_calendar.sass | 7 | ||||
| -rw-r--r-- | app/helpers/time_tables_helper.rb | 8 | ||||
| -rw-r--r-- | app/views/time_tables/_show_time_table.html.slim | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/app/assets/stylesheets/components/_calendar.sass b/app/assets/stylesheets/components/_calendar.sass index 6b7525322..ba6e3b3c3 100644 --- a/app/assets/stylesheets/components/_calendar.sass +++ b/app/assets/stylesheets/components/_calendar.sass @@ -26,6 +26,9 @@ table.calendar tbody tr > td + &.weekNumber + border: none + &.outsideMonth color: rgba($darkgrey, 0.35) @@ -42,3 +45,7 @@ table.calendar color: $darkgrey background-color: $gold border-radius: 50% + + &:hover, &:focus + color: $darkgrey + text-decoration: none diff --git a/app/helpers/time_tables_helper.rb b/app/helpers/time_tables_helper.rb index 88dbda061..e4253c180 100644 --- a/app/helpers/time_tables_helper.rb +++ b/app/helpers/time_tables_helper.rb @@ -31,7 +31,7 @@ module TimeTablesHelper :next_month_text => nil, :month_header => true, :calendar_title => month_names[options[:month]], - :summary => "Calendar for #{month_names[options[:month]]} #{options[:year]}" + :summary => "Calendrier pour #{month_names[options[:month]]} #{options[:year]}" } options = defaults.merge options @@ -54,6 +54,7 @@ module TimeTablesHelper if (options[:month_header]) cal << %(<tr>) + cal << %(<th scope="col"></th>) if options[:previous_month_text] or options[:next_month_text] cal << %(<th colspan="2">#{options[:previous_month_text]}</th>) colspan=3 @@ -66,6 +67,7 @@ module TimeTablesHelper end cal << %(<tr class="#{options[:day_name_class]}">) + cal << %(<th scope="col"></th>) week_days.each do |wday| cal << %(<th id="#{th_id(Date::DAYNAMES[wday], options[:table_id])}" scope="col">) @@ -77,6 +79,7 @@ module TimeTablesHelper # previous month beginning_of_week(first, first_weekday).upto(first - 1) do |d| + cal << "<td class='weekNumber'>S#{d.strftime("%W").to_s}</td>" if d.wday == first_weekday cal << generate_other_month_cell(d, options) end unless first.wday == first_weekday @@ -90,6 +93,8 @@ module TimeTablesHelper today = (Time.respond_to?(:zone) && !(zone = Time.zone).nil? ? zone.now.to_date : Date.today) cell_attrs[:class] += " today" if (cur == today) and options[:show_today] + cal << "<td class='weekNumber'>S#{cur.strftime("%W").to_s}</td>" if cur.wday == first_weekday + cal << generate_cell(cell_text, cell_attrs) cal << "</tr><tr>" if cur.wday == last_weekday end @@ -140,6 +145,7 @@ module TimeTablesHelper cell_attrs[:headers] = th_id(date, options[:table_id]) cell_attrs[:class] = options[:other_month_class] cell_attrs[:class] += " weekend" if weekend?(date) + cell_attrs[:title] ||= date.strftime("%W").to_i if options[:first_day_of_week] == 1 cell_text = date.day if options[:accessible] diff --git a/app/views/time_tables/_show_time_table.html.slim b/app/views/time_tables/_show_time_table.html.slim index a3bcd6bfe..5fe1a9a49 100644 --- a/app/views/time_tables/_show_time_table.html.slim +++ b/app/views/time_tables/_show_time_table.html.slim @@ -1,7 +1,7 @@ .row - (1..12).each do |month| .col-lg-3.col-md-4.col-sm-4.col-xs-6 - = new_alt_calendar(year: @year, month: month, first_day_of_week: 1, calendar_title: "#{I18n.t("date.month_names")[month]} #{@year}") do |d| + = new_alt_calendar(year: @year, month: month, first_day_of_week: 1, calendar_title: "#{I18n.t("date.month_names")[month]} #{@year}", show_today: false) do |d| / - if @time_table.excluded_date?(d) / - [link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {class: "day excluded_date"}] - if @time_table.include_in_overlap_dates?(d) |
