diff options
| author | Guillaume | 2017-11-23 17:13:09 +0100 | 
|---|---|---|
| committer | Guillaume | 2017-11-23 17:13:19 +0100 | 
| commit | c83002d8f281384244dc9c11432e2eb648b99b3b (patch) | |
| tree | efae0f2b8e40ae53c3688a3dc84082425fbd7ffc /app/views/lines | |
| parent | 21382e70b654215325a045627c563224943fdd83 (diff) | |
| download | chouette-core-c83002d8f281384244dc9c11432e2eb648b99b3b.tar.bz2 | |
Refs #4824, #4825 update old form views to new layout with simple_form, add permissions for create an edit in line and network controller
Diffstat (limited to 'app/views/lines')
| -rw-r--r-- | app/views/lines/_form.html.slim | 63 | ||||
| -rw-r--r-- | app/views/lines/edit.html.slim | 11 | ||||
| -rw-r--r-- | app/views/lines/new.html.slim | 11 | 
3 files changed, 38 insertions, 47 deletions
diff --git a/app/views/lines/_form.html.slim b/app/views/lines/_form.html.slim index d7b5a65ed..4952b72ff 100644 --- a/app/views/lines/_form.html.slim +++ b/app/views/lines/_form.html.slim @@ -1,45 +1,22 @@ -= semantic_form_for [@line_referential, @line] do |form| -  = form.inputs do -   / = form.input :network, as: :select, :collection => Chouette::Network.all, include_blank: false -    / = form.input :company, as: :select, :collection => Chouette::Company.all, include_blank: false -    / = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.name") } -    / = form.input :published_name -    / = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.registration_number")} -    / = form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.number") } -    / = form.input :transport_mode, include_blank: false -    / = form.input :color, as: :string -    / = form.input :text_color -    / = form.input :stable_id -    / = form.input :url -    / = form.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true -    / = form.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true -    / = form.input :comment -    / = form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.objectid")} -    / = form.input :group_of_line_tokens, :label => t('.group_of_lines'), as: :text,  :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json } += simple_form_for [@line_referential, @line], html: {class: 'form-horizontal', id: 'lines_form'}, wrapper: :horizontal_form do |f| +  .row +    .col-lg-12 +      = f.input :name +      = f.input :network_id, as: :select, :collection => @line_referential.networks, include_blank: false +      = f.input :company_id, as: :select, :collection => @line_referential.companies, include_blank: false +      = f.input :published_name +      = f.input :registration_number +      = f.input :number +      = f.input :transport_mode, as: :select, collection: Chouette::Line.sorted_transport_modes, label: t('activerecord.attributes.compliance_control_blocks.transport_mode'), label_method: lambda {|t| ("<span>" + t("enumerize.transport_mode.#{t}") + "</span>").html_safe}, required: true, :include_blank => false +      = f.input :transport_submode, as: :select, collection: Chouette::Line.sorted_transport_submodes, label: t('activerecord.attributes.compliance_control_blocks.transport_submode'), label_method: lambda {|t| ("<span>" + t("enumerize.transport_submode.#{t}") + "</span>").html_safe}, :include_blank => true +      = f.input :color, as: :string +      = f.input :text_color +      = f.input :stable_id +      = f.input :url +      = f.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true +      = f.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true +      = f.input :comment +  .separator -    .footnotes_block -      h3 = t("footnotes.index.title") +  = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'lines_form' -      #footnotes -        = form.semantic_fields_for :footnotes do |f| -          = render "footnotes/footnote_fields",  :f => f - -      .add_footnote -        = link_to_add_association t("footnotes.actions.add_footnote"), form, :footnotes , :partial => "footnotes/footnote_fields", :"data-association-insertion-method" => "append", :"data-association-insertion-node" => "div#footnotes", class: 'add' - -  = form.actions do -    = form.action :submit, as: :button -    = form.action :cancel, as: :link - -javascript: -  $(function() { -    $("#line_group_of_line_tokens").tokenInput("#{name_filter_referential_group_of_lines_path(@line_referential, format: :json)}", { -      crossDomain: false, -      prePopulate: $('#group_of_line_tokens').data('pre'), -      minChars: 3, -      preventDuplicates: true, -      hintText: "#{I18n.t('search_hint')}", -      noResultsText: "#{I18n.t('no_result_text')}", -      searchingText: "#{I18n.t('searching_term')}" -    }); -  }); diff --git a/app/views/lines/edit.html.slim b/app/views/lines/edit.html.slim index 3c2eee03f..4a904d16a 100644 --- a/app/views/lines/edit.html.slim +++ b/app/views/lines/edit.html.slim @@ -1,5 +1,12 @@  - breadcrumb :line, @line -= title_tag t('lines.edit.title', line: @line.name) +/ PageHeader += pageheader 'jeux-de-controle', +        t('lines.edit.title', line: @line.name) -= render 'form' +/ PageContent +.page_content +  .container-fluid +    .row +      .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 +        = render 'form' diff --git a/app/views/lines/new.html.slim b/app/views/lines/new.html.slim index f09a4b4aa..00872dcfb 100644 --- a/app/views/lines/new.html.slim +++ b/app/views/lines/new.html.slim @@ -1,5 +1,12 @@  - breadcrumb :lines, @line_referential +/ PageHeader += pageheader 'jeux-de-controle', +        t('lines.new.title') -= title_tag t('lines.new.title') -= render 'form' +/ PageContent +.page_content +  .container-fluid +    .row +      .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 +        = render 'form'
\ No newline at end of file  | 
