diff options
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 9 | ||||
| -rw-r--r-- | app/views/time_tables/_filter.html.slim | 6 | ||||
| -rw-r--r-- | app/views/time_tables/index.html.slim | 50 | 
3 files changed, 53 insertions, 12 deletions
| diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 0e0cade56..f23e4c201 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -85,6 +85,15 @@ class TimeTablesController < ChouetteController          if collection.out_of_bounds?            redirect_to params.merge(:page => 1)          end + +        @time_tables = ModelDecorator.decorate( +          @time_tables, +          with: TimeTableDecorator, +          context: { +            referential: @referential +          } +        ) +          build_breadcrumb :index        }      end diff --git a/app/views/time_tables/_filter.html.slim b/app/views/time_tables/_filter.html.slim index 10e46d884..1015eca31 100644 --- a/app/views/time_tables/_filter.html.slim +++ b/app/views/time_tables/_filter.html.slim @@ -8,15 +8,15 @@    .ffg-row      / .form-group.togglable -      / = f.label @time_tables.human_attribute_name(:color), required: false, class: 'control-label' +      / = f.label Chouette::TimeTable.human_attribute_name(:color), required: false, class: 'control-label'        / = f.input :color_cont_any, collection: ["#9B9B9B", "#FFA070", "#C67300", "#7F551B", "#41CCE3", "#09B09C", "#3655D7",   "#6321A0", "#E796C6", "#DD2DAA"], as: :check_boxes, label: false, label_method: lambda{|tt| ("<span style='height:19px;'><span class='fa fa-circle' style='position:relative;top:0;margin-top:0;color:" + tt + "'></span></span>").html_safe }, required: false, wrapper_html: { class: 'checkbox_list' }      .form-group -      = f.label @time_tables.human_attribute_name(:tag_search), required: false, class: 'control-label' +      = f.label Chouette::TimeTable.human_attribute_name(:tag_search), required: false, class: 'control-label'        = f.input :tag_search, as: :tags, collection: Chouette::TimeTable.tags_on(:tags).pluck(:name), label: false, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez une étiquette...' }, wrapper_html: { class: 'select2ed'}, include_blank: false      .form-group.togglable -      = f.label @time_tables.human_attribute_name(:bounding_dates), required: false, class: 'control-label' +      = f.label Chouette::TimeTable.human_attribute_name(:bounding_dates), required: false, class: 'control-label'        .filter_menu          = f.input :start_date_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true          = f.input :end_date_lteq, 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 diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index a0b9e4380..72c025bc1 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -14,15 +14,47 @@      - if @time_tables.any?        .row          .col-lg-12 -          = table_builder @time_tables, -            { 'ID' => Proc.new { |n| n.objectid.local_id }, :color => Proc.new{|tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }, :comment => 'comment',  -              "Période englobante" => Proc.new{ |tt| tt.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(tt.bounding_dates.min), end: l(tt.bounding_dates.max)) }, -              "Nombre de courses associées" => Proc.new{ |tt| tt.vehicle_journeys.count }, -              "Journées d'application" => Proc.new{ |tt| (%w(monday tuesday wednesday thursday friday saturday sunday).collect{|d| tt.send(d) ? t("calendars.days.#{d}") : '' }).reject{|a| a.empty?}.join(', ').html_safe }, -              :calendar => Proc.new{ |tt| tt.calendar ? tt.calendar.try(:name) : '-' }, :updated_at => Proc.new {|tt| l(tt.updated_at, format: :short)} }, -            [:show, :edit, :duplicate, :actualize, :delete], -            [], -            'table has-search' +          = table_builder_2 @time_tables, +            [ \ +              TableBuilderHelper::Column.new( \ +                name: 'ID', \ +                attribute: Proc.new { |n| n.objectid.local_id }, \ +                sortable: false \ +              ), \ +              TableBuilderHelper::Column.new( \ +                key: :color, \ +                attribute: Proc.new { |tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }, \ +              ), \ +              TableBuilderHelper::Column.new( \ +                key: :comment, \ +                attribute: 'comment' \ +              ), \ +              TableBuilderHelper::Column.new( \ +                name: "Période englobante", \ +                attribute: Proc.new { |tt| tt.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(tt.bounding_dates.min), end: l(tt.bounding_dates.max)) }, \ +                sortable: false \ +              ), \ +              TableBuilderHelper::Column.new( \ +                name: "Nombre de courses associées", \ +                attribute: Proc.new{ |tt| tt.vehicle_journeys.count }, \ +                sortable: false \ +              ), \ +              TableBuilderHelper::Column.new( \ +                name: "Journées d'application", \ +                attribute: Proc.new { |tt| (%w(monday tuesday wednesday thursday friday saturday sunday).collect{|d| tt.send(d) ? t("calendars.days.#{d}") : '' }).reject{|a| a.empty?}.join(', ').html_safe }, \ +                sortable: false \ +              ), \ +              TableBuilderHelper::Column.new( \ +                key: :calendar, \ +                attribute: Proc.new { |tt| tt.calendar ? tt.calendar.try(:name) : '-' } \ +              ), \ +              TableBuilderHelper::Column.new( \ +                key: :updated_at, \ +                attribute: Proc.new { |tt| l(tt.updated_at, format: :short) } \ +              ) \ +            ], +            links: [:show, :edit], +            cls: 'table has-search'            = new_pagination @time_tables, 'pull-right' | 
