diff options
| author | jpl | 2016-11-04 14:25:49 +0100 |
|---|---|---|
| committer | Thomas Haddad | 2016-11-08 18:15:11 +0100 |
| commit | 18ec196ddab33c5ebc27b0da30ca1fafc0535882 (patch) | |
| tree | 9227cdf34e0c122da5f58eb4f01777e54e71e581 | |
| parent | f77eba8b2d739c0f5df81d29d7d70024dd8862ee (diff) | |
| download | chouette-core-18ec196ddab33c5ebc27b0da30ca1fafc0535882.tar.bz2 | |
getting itinerary stop_points data in js
| -rw-r--r-- | app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js (renamed from app/assets/javascripts/es6_browserified/containers/visibleTodoList.js) | 0 | ||||
| -rw-r--r-- | app/assets/javascripts/es6_browserified/getJSON.js | 1 | ||||
| -rw-r--r-- | app/views/routes/_stop_point_fields.html.slim | 3 | ||||
| -rw-r--r-- | app/views/routes/edit.html.slim | 5 | ||||
| -rw-r--r-- | app/views/routes/new.html.slim | 2 |
5 files changed, 9 insertions, 2 deletions
diff --git a/app/assets/javascripts/es6_browserified/containers/visibleTodoList.js b/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js index 5a70582e0..5a70582e0 100644 --- a/app/assets/javascripts/es6_browserified/containers/visibleTodoList.js +++ b/app/assets/javascripts/es6_browserified/containers/VisibleTodoList.js diff --git a/app/assets/javascripts/es6_browserified/getJSON.js b/app/assets/javascripts/es6_browserified/getJSON.js new file mode 100644 index 000000000..e883522b0 --- /dev/null +++ b/app/assets/javascripts/es6_browserified/getJSON.js @@ -0,0 +1 @@ +console.log(window.itinerary_stop); diff --git a/app/views/routes/_stop_point_fields.html.slim b/app/views/routes/_stop_point_fields.html.slim index 38909f0f2..3b51e5e0d 100644 --- a/app/views/routes/_stop_point_fields.html.slim +++ b/app/views/routes/_stop_point_fields.html.slim @@ -1,7 +1,8 @@ .list-group-item div style="display:inline-block;vertical-align:middle;width:75%;" - if f.object.stop_area.nil? || f.object.new_record? - = f.input :stop_area_id, label: false + / = f.input :stop_area_id, label: false + = f.input :stop_area_id, :label => false, as: :search_stop_area, :json => referential_autocomplete_stop_areas_path(@referential, :format => :json)+"?filter=physical", :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :tokenLimit => 1, :input_html => { :class => "new_stop_point stop_area_id", :"data-pre" => Rabl::Renderer.new('autocomplete_stop_areas/index', [f.object.stop_area].compact, :view_path => 'app/views', :format => :json, :scope => self ).render } - else = "#{@route.stop_areas.find(f.object.stop_area_id).name} " diff --git a/app/views/routes/edit.html.slim b/app/views/routes/edit.html.slim index a0431dc32..abd32bbd9 100644 --- a/app/views/routes/edit.html.slim +++ b/app/views/routes/edit.html.slim @@ -3,3 +3,8 @@ .row .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2 == render 'form' + += javascript_tag do + | window.itinerary_stop = "#{@route.stop_areas.all.to_json}"; + += javascript_include_tag 'es6_browserified/getJSON.js' diff --git a/app/views/routes/new.html.slim b/app/views/routes/new.html.slim index 8cd0d2fb3..a09f2f3f4 100644 --- a/app/views/routes/new.html.slim +++ b/app/views/routes/new.html.slim @@ -2,5 +2,5 @@ == render 'form' -// TEST ES6 +/ TEST ES6 = javascript_include_tag 'es6_browserified/test.js' |
