af83/chouette-core

View on GitHub
app/views/time_tables/show.html.slim

Summary

Maintainability
Test Coverage
- require 'calendar_helper'
- breadcrumb :time_table, @workbench, @referential, @time_table
- page_header_content_for @time_table

- content_for :page_header_title, t('time_tables.show.title', name: @time_table.comment), flush: true

.page_content
  .container-fluid
    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = definition_list t('metadatas'),
          { Chouette::TimeTable.tmf(:bounding_dates) => (@time_table.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(@time_table.bounding_dates.min), end: l(@time_table.bounding_dates.max))),
            Chouette::TimeTable.tmf(:color)  => (@time_table.color.nil? ? '-' : content_tag(:span, '', class: 'fa fa-circle', style: "color:#{@time_table.try(:color)}")),
            Chouette::TimeTable.tmf(:calendar)  => (@calendar ? link_to(@calendar.name, workbench_calendar_path(@calendar.workbench, @calendar)) : '-'),
            Chouette::TimeTable.tmf(:day_types) => %w(monday tuesday wednesday thursday friday saturday sunday).collect{ |d| content_tag(:span, t("calendars.days.#{d}"), class: "label label-default #{@time_table.send(d) ? '' : 'disabled'}") }.join.html_safe,
            Chouette::TimeTable.tmf(:checksum) => @time_table.checksum}

    .row
      .col-lg-12.mb-sm
        .pagination.pull-right
          = @year
          .page_links
            = link_to '', workbench_referential_time_table_path(@workbench, @referential, @time_table, year: (@year - 1)), class: 'previous_page'
            = link_to '', workbench_referential_time_table_path(@workbench, @referential, @time_table, year: (@year + 1)), class: 'next_page'

    = render 'show_time_table', time_table: @time_table, edit_url: [:edit, @referential, @time_table], disabled: !resource_policy.update?