diff options
Diffstat (limited to 'app/views/lines/show.html.slim')
| -rw-r--r-- | app/views/lines/show.html.slim | 171 |
1 files changed, 36 insertions, 135 deletions
diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim index 2b652754a..0589b1923 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -1,135 +1,36 @@ -- text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" -- bg_color = @line.color.blank? ? "white" : "##{@line.color}" - -= title_tag t('lines.show.title', line: @line.name) - -.line_show - .summary - - text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" - - bg_color = @line.color.blank? ? "white" : "##{@line.color}" - - - if colors?(@line) - p - label = "#{t('lines.index.color')} : " - label.color style="#{number_style(@line)}" - = line_sticker(@line) - - - if @line.deactivated - p - = t('lines.index.deactivated') - - p - label = "#{@line.human_attribute_name(:network)} : " - - - if @line.network.nil? - = t('lines.index.unset') - - else - = link_to @line.network.name, [@line_referential, @line.network] - p - label = "#{@line.human_attribute_name(:company)} : " - - if @line.company.nil? - = t('lines.index.unset') - - else - = link_to @line.company.name, [@line_referential, @line.company] - p - label = "#{@line.human_attribute_name(:secondary_companies)} : " - - @line.secondary_companies.each do |company| - = link_to @company.name, [@line_referential, @company] - p - label = "#{@line.human_attribute_name('number')} : " - = @line.number - - p - label = "#{@line.human_attribute_name('published_name')} : " - = @line.published_name - - p - label = "#{@line.human_attribute_name('registration_number')} : " - = @line.registration_number - - p - label = "#{@line.human_attribute_name('transport_mode')} : " - - if @line.transport_mode - = " " + t("enumerize.line.transport_mode.#{@line.transport_mode}") - - else - = " -" - - p - label = "#{@line.human_attribute_name('transport_submode')} : " - - if @line.transport_submode - = " " + t("enumerize.line.transport_submode.#{@line.transport_submode}") - - else - = " -" - - / p - / label = "#{@line.human_attribute_name('stable_id')} : " - / = @line.stable_id - - p - label = "#{@line.human_attribute_name('url')} : " - = @line.url - - / p - / label = "#{@line.human_attribute_name('mobility_restricted_suitability')} : " - / - / - if @line.mobility_restricted_suitability.nil? - / = @line.human_attribute_name("unspecified_mrs") - / - elsif @line.mobility_restricted_suitability? - / = @line.human_attribute_name("accessible") - / - else - / = @line.human_attribute_name("not_accessible") - / - / br - / = "#{@line.human_attribute_name('number_of_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', true).count}" - / br - / = "#{@line.human_attribute_name('number_of_non_mrs_vj')} : #{@line.vehicle_journeys.where('mobility_restricted_suitability = ?', false).count}" - / br - / = @line.human_attribute_name("number_of_null_mrs_vj") - / = " : " - / = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("mobility_restricted_suitability = ?", true).count + @line.vehicle_journeys.where("mobility_restricted_suitability = ?", false).count) - / - / p - / label = "#{@line.human_attribute_name('flexible_service')} : " - / - / - if @line.flexible_service.nil? - / = @line.human_attribute_name("unspecified_fs") - / - elsif @line.flexible_service? - / = @line.human_attribute_name("on_demaond_fs") - / - else - / = @line.human_attribute_name("regular_fs") - / - / br - / = "#{@line.human_attribute_name('number_of_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', true).count}" - / br - / = "#{@line.human_attribute_name('number_of_non_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', false).count}" - / br - / = @line.human_attribute_name("number_of_null_fs_vj") - / - / - if @line.flexible_service.nil? - / = "(#{@line.human_attribute_name('default_fs_msg')})" - / - / = " : " - / = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("flexible_service = ?", true).count + @line.vehicle_journeys.where("flexible_service = ?", false).count) - - / p - / label = "#{@line.human_attribute_name('comment')} : " - / = @line.comment - - / .row - / #mobility_restricted_suitability.col-md-6 - / #flexible_service.col-md-6 - -- content_for :sidebar do - ul.actions - - if policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation) - li - = link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'add' - / FIXME #2018 - - if false && policy(@line).update? - li - = link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), class: 'edit' - - if policy(@line).destroy? - li - = link_to t('lines.actions.destroy'), line_referential_line_path(@line_referential, @line), method: :delete, :data => {:confirm => t('lines.actions.destroy_confirm')}, class: 'remove' - - = creation_tag(@line) +/ PageHeader += pageheader 'map-marker', + @line.name, + 'Lorem ipsum dolor sit amet', + t('last_update', time: l(@line.updated_at, format: :short)) do + + / Below is secundary actions & optional contents + .row + .col-lg-12.text-right.mb-sm + = link_to t('lines.actions.show_network'), [@line_referential, @line.network], class: 'btn btn-primary' + = link_to t('lines.actions.show_company'), [@line_referential, @line.company], class: 'btn btn-primary' + + - if policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation) + = link_to t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'btn btn-primary' + - if false && policy(@line).update? + = link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), class: 'btn btn-primary' + - if policy(@line).destroy? + = link_to line_referential_line_path(@line_referential, @line), method: :delete, data: {confirm: t('lines.actions.destroy_confirm')}, class: 'btn btn-primary' do + span.fa.fa-trash + span = t('lines.actions.destroy') + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-6.col-md-6.col-sm-12.col-xs-12 + = definition_list t('metadatas'), + { 'Activé' => (@line.deactivated? ? t('false') : t('true')), + @line.human_attribute_name(:network) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name), + @line.human_attribute_name(:company) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name), + @line.human_attribute_name(:number) => @line.number, + @line.human_attribute_name(:published_name) => @line.published_name, + @line.human_attribute_name(:registration_number) => @line.registration_number, + @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.line.transport_mode.#{@line.transport_mode}") : '-'), + @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.line.transport_submode.#{@line.transport_submode}") : '-'), + @line.human_attribute_name(:url) => (@line.url ? @line.url : '-') } |
