Commit b56891b4a69560b5aa53d687c7f38d6b61a340ae

Add JS config for model URLs
  • Diff rendering mode:
  • inline
  • side by side

mouchak/static/js/editor.js

9191
92 var Pages = Backbone.Collection.extend({92 var Pages = Backbone.Collection.extend({
93 model: M.types.model.Page,93 model: M.types.model.Page,
94 url: '/page'
94 url: M.PageURL()
95 });95 });
9696
97 /* view to manage each page and their properties - change page properties,97 /* view to manage each page and their properties - change page properties,

mouchak/static/js/models.js

117 customMenu: false117 customMenu: false
118 },118 },
119 url: function() {119 url: function() {
120 return '/menu/' + this.id;
120 return M.MenuURL() + this.id;
121 },121 },
122 initialize: function() {122 initialize: function() {
123 this.id = this.get('id');123 this.id = this.get('id');

mouchak/templates/index.html

34 <script>34 <script>
35 //Code to initialize the framework35 //Code to initialize the framework
36 window.M = window.M || {};36 window.M = window.M || {};
37 M.MenuURL = function() { return "{{ url_for('insertPage') }}"};
38 M.PageURL = function() { return "{{ url_for('updateMenu') }}"; };
37 M.site_content = {{ content|tojson|safe }};39 M.site_content = {{ content|tojson|safe }};
38 window.onload = function() {40 window.onload = function() {
39 M.init();41 M.init();