Commit 2998a3dbf63e3f61cae27745a7c1375951901a03
- Diff rendering mode:
- inline
- side by side
.gitignore
(5 / 1)
  | |||
1 | |||
2 | 1 | *.*~ | |
3 | 2 | *.pyc | |
3 | # For virtual-env | ||
4 | bin/ | ||
5 | lib/ | ||
6 | local/ | ||
7 | include/ |
static/js/editor.js
(12 / 5)
  | |||
257 | 257 | })); | |
258 | 258 | // init the wysiwig editor | |
259 | 259 | M.editor.wysiwig('#edit'); | |
260 | } | ||
260 | } | ||
261 | 261 | else if(type === 'image' || type === 'video' || type === 'audio') { | |
262 | 262 | var template = _.template($('#media-template').html()); | |
263 | 263 | $('#specific-content').html(template({ | |
264 | 264 | src: this.model.get('src') | |
265 | 265 | })); | |
266 | |||
266 | |||
267 | 267 | //provide the users a preview | |
268 | 268 | /*var view = new M.types.view[type]({model: this.model}); | |
269 | 269 | //$('#specific-content.preview').html(); | |
… | … | ||
359 | 359 | this.showMenuOptions(this.model.get('customMenu')); | |
360 | 360 | }, | |
361 | 361 | saveMenu: function() { | |
362 | //console.log('saving menu..'); | ||
362 | console.log('saving menu..'); | ||
363 | 363 | // var menuHTML = $('#menu').val().trim(); | |
364 | 364 | //this.model.set({'html': menuHTML}); | |
365 | 365 | //console.log(this.model.toJSON()); | |
366 | 366 | //alert('saveMenu called'); | |
367 | /*this.model.save({}, { | ||
367 | var bool; | ||
368 | if($("custom-menu").is(":checked")){ | ||
369 | bool = true; | ||
370 | } | ||
371 | else{ | ||
372 | bool = false; | ||
373 | } | ||
374 | this.model.save({customMenu: bool}, { | ||
368 | 375 | success: function(model, response) { | |
369 | 376 | console.log(model, response); | |
370 | 377 | }, | |
371 | 378 | error: function(xhr, response) { | |
372 | 379 | } | |
373 | });*/ | ||
380 | }); | ||
374 | 381 | //alert('end of save menu'); | |
375 | 382 | } | |
376 | 383 | }); |
templates/editor.html
(10 / 10)
  | |||
28 | 28 | <div id="footer"> | |
29 | 29 | </div> | |
30 | 30 | </div> | |
31 | |||
31 | |||
32 | 32 | <script> | |
33 | 33 | // initialize editor | |
34 | 34 | window.M = window.M || {}; | |
… | … | ||
54 | 54 | <div class="page"> | |
55 | 55 | <div class="menu-config"> | |
56 | 56 | <h4> Menu Config </h4> | |
57 | <form class="form-horizontal"> | ||
57 | <!-- <form class="form-horizontal"> --> | ||
58 | 58 | <div class="control-group"> | |
59 | 59 | <input id="custom-menu" type="checkbox"> | |
60 | 60 | <span class=""><strong> Custom Menu </strong></span> | |
61 | 61 | </div> | |
62 | <button id="updateMenu" type="submit" class="btn btn-primary pull-right"> Update </button> | ||
62 | <button id="updateMenu" class="btn btn-primary pull-right"> Update </button> | ||
63 | 63 | <div class="clearfix"></div> | |
64 | 64 | <div class="menu-options" style="display: none;"> | |
65 | 65 | <div class="control-group"> | |
… | … | ||
74 | 74 | <%= menu %> | |
75 | 75 | </div> | |
76 | 76 | </div> | |
77 | </form> | ||
77 | <!-- </form> --> | ||
78 | 78 | </div> | |
79 | 79 | </div> | |
80 | 80 | </script> | |
… | … | ||
124 | 124 | <span class="add-on"> <strong>Children</strong> </span> | |
125 | 125 | <input id="children" type="text" placeholder="csv of child pages" | |
126 | 126 | value="<%= children %>"> | |
127 | </div> | ||
127 | </div> | ||
128 | 128 | </div> | |
129 | 129 | <div class="control-group"> | |
130 | 130 | <div class="input-prepend"> | |
… | … | ||
146 | 146 | ||
147 | 147 | <script type="text/template" id="content-list-template"> | |
148 | 148 | <div class="content-item-wrapper"> | |
149 | <span class="content-item" id="content-<%= no %>"> | ||
150 | <span class="label label-info"> <%= type %> </span> | ||
151 | <span class=""> | ||
149 | <span class="content-item" id="content-<%= no %>"> | ||
150 | <span class="label label-info"> <%= type %> </span> | ||
151 | <span class=""> | ||
152 | 152 | [ <small> <%= title %> <%= more %> </small> ] | |
153 | 153 | </span> | |
154 | 154 | </span> | |
… | … | ||
173 | 173 | <span class="add-on"> <b>Title</b> </span> | |
174 | 174 | <input type="text" placeholder="title of the content" value="<%= | |
175 | 175 | title %>" m-data-target="title"> | |
176 | </div> | ||
176 | </div> | ||
177 | 177 | </div> | |
178 | 178 | <div class="control-group"> | |
179 | 179 | <div class="input-prepend"> | |
180 | 180 | <span class="add-on"> <strong>Tags</strong> </span> | |
181 | 181 | <input type="text" placeholder="csv of tags for this content" | |
182 | 182 | value="<%= tags %>" m-data-target="tags"> | |
183 | </div> | ||
183 | </div> | ||
184 | 184 | </div> | |
185 | 185 | </div> | |
186 | 186 | <div id="specific-content"></div> |