1
{% extends "base.html" %}
2
3
{% block head %}
4
  <link rel="stylesheet" href="{{url_for('static', filename='css/editor.css')}}">
5
  <title> Editing.. | {{ title }} </title>
6
{% endblock %}
7
8
{% block body %}
9
  <div class="container" id="container">
10
    <div id="header">
11
      <div id="hud">
12
        <span class="pull-right">Howdy! | <a href="{{ url_for('logout') }}">Logout</a></span>
13
      </div>
14
      <div id="notifications"></div>
15
    </div>
16
    <div id="content-container"></div>
17
    <div id="footer"></div>
18
  </div>
19
  <div id="editor-overlay"></div>
20
21
  <script>
22
    // initialize editor
23
    window.M = window.M || {};
24
    M.MenuURL = function() { return "{{ url_for('insertMenu') }}"; };
25
    M.FooterURL = function() { return "{{ url_for('insertFooter') }}"; };
26
    M.HeaderURL = function() { return "{{ url_for('insertHeader') }}"; };
27
    M.PageURL = function() { return "{{ url_for('insertPage') }}"; };
28
    M.PluginUploadURL = function() { return "{{ url_for('uploadPlugin') }}"; };
29
    M.UploadsURL = function() { return "{{ url_for('static', filename='uploads/') }}"; };
30
    M.lastUpdatedURL = function() { return "{{ url_for('updateLastUpdated') }}"; };
31
    M.site_content = {{ content|tojson|safe }};
32
    window.onload = function() {
33
      M.editor.init();
34
    };
35
  </script>
36
{% endblock %}
37
38
{% block scripts %}
39
  <script src="{{url_for('static', filename='js/lib/tinymce/tinymce.min.js')}}"></script>
40
  <script src="{{url_for('static', filename='js/lib/tinymce/jquery.tinymce.min.js')}}"></script>
41
  <script src="{{url_for('static', filename='js/lib/ace/ace.js')}}"></script>
42
  <script src="{{url_for('static', filename='js/mouchak.js')}}"></script>
43
  <script src="{{url_for('static', filename='js/models.js')}}"></script>
44
  <script src="{{url_for('static', filename='js/views.js')}}"></script>
45
  <script src="{{url_for('static', filename='js/editor.js')}}"></script>
46
{% endblock %}
47
48
{% block templates %}
49
50
  <!-- Underscore templates -->
51
  <script type="text/template" id="menu-config-template">
52
    <div class="page">
53
      <div class="menu-config">
54
        <h4> Configure Navigation Menu </h4>
55
56
        <div class="row">
57
          <div class="form-group col-lg-6">
58
            <div class="input-group">
59
              <span class="input-group-addon">
60
                <input id="custom-menu" type="checkbox">
61
              </span>
62
              <span class="input-group-addon"><strong>Custom Menu
63
              </strong></span>
64
            </div>
65
            <span class="help-block">
66
              <small>
67
                activate to write your own custom menu
68
              </small>
69
            </span>
70
          </div>
71
        </div>
72
73
        <div class="row">
74
          <div class="form-group col-lg-12" id="menu-order-wrap">
75
            <div class="input-group">
76
              <span class="input-group-addon"> <strong> Menu Order</strong></span>
77
              <input class="form-control" id="menu-order" type="text"
78
              placeholder="list,page,slugs,for,menu,order" value="<%= menu_order %>">
79
            </div>
80
            <span class="help-block">
81
              <small>csv list of page slugs to come up in the navigation menu
82
                in that order
83
              </small>
84
            </span>
85
          </div>
86
        </div>
87
88
        <div class="menu-options" style="display: none;">
89
          <div class="row">
90
            <div class="form-group col-lg-6">
91
              <div class="input-group">
92
                <span class="input-group-addon"> <strong> Position </strong></span>
93
                <input class="form-control"  id="pos" type="text" placeholder="[left, top]"
94
                value="<%= pos %>">
95
              </div>
96
            </div>
97
          </div>
98
          <div class="row">
99
            <label><strong> HTML for menu: </strong></label>
100
            <div class="ace-mouchak" id="menu"><%= M.escapeHtml(menu) %></div>
101
          </div>
102
        </div>
103
104
      </div>
105
      <div class="clearfix"></div>
106
      <div class="row">
107
        <button id="updateMenu" class="btn btn-primary pull-right update-btn"> Update </button>
108
      </div>
109
      <div class="clearfix"></div>
110
    </div>
111
  </script>
112
113
  <script type="text/template" id="header-config-template">
114
    <div class="page">
115
      <div><h4> Write HTML for your header here </h4></div>
116
      <div id="header-input" class="ace-mouchak">
117
        <%= M.escapeHtml(header) %>
118
      </div>
119
      <div class="row">
120
        <button id="updateHeader" class="btn btn-primary pull-right update-btn"> Update </button>
121
      </div>
122
      <div class="clearfix"></div>
123
    </div>
124
  </script>
125
126
  <script type="text/template" id="footer-config-template">
127
    <div class="page">
128
      <div><h4> Write HTML for your footer here </h4></div>
129
      <div id="footer-input" class="ace-mouchak">
130
        <%= M.escapeHtml(footer) %>
131
      </div>
132
      <div class="row">
133
        <button id="updateFooter" class="btn btn-primary pull-right update-btn"> Update </button>
134
      </div>
135
      <div class="clearfix"></div>
136
    </div>
137
  </script>
138
139
  <script type="text/template" id="page-list-template">
140
    <div id="pagelistview">
141
      <h4> List of Pages </h4>
142
      <div id="pagelist"></div>
143
      <button class="btn btn-primary" id="addPage">Add Page</button>
144
      <hr>
145
      <p> <a href="#" id="header-config"> Header </a> </p>
146
      <p> <a href="#" id="footer-config"> Footer </a> </p>
147
      <p> <a href="#" id="menu-config"> Navigation Menu </a> </p>
148
      <p> <a href="#" id="uploads"> Uploads </a> </p>
149
      <p> <a href="#" class="btn btn-default" id="last-updated">
150
        Content updated
151
      </a> </p>
152
      <p><a href="{{ url_for('index') }}"> Go to site </a></p>
153
    </div>
154
  </script>
155
156
  <script type="text/template" id="page-list-item-template">
157
    <div class="pagename">
158
      <a class="disp" id="<%= id %>" href="javascript:void(0);"><%= name %></a>
159
      <span class="pull-right">
160
        <a href="javascript:void(0);" class="remove" for="<%= id %>">
161
          <span class="glyphicon glyphicon-trash"></span>
162
        </a>
163
      </span>
164
      <span class="clearfix"></span>
165
    </div>
166
  </script>
167
168
  <script type="text/template" id="page-template">
169
    <div class="page">
170
      <div class="row">
171
        <h4> <strong><%= name %></strong> : Page Details </h4>
172
      </div>
173
      <hr/>
174
      <form class="form-horizontal">
175
        <div class="form-group">
176
          <div class="input-group">
177
            <span class="input-group-addon"> <strong> Slug </strong></span>
178
            <input class="form-control"  id="name" type="text"
179
            placeholder="slug of the page" value="<%= name %>">
180
          </div>
181
          <span class="help-block">
182
            <small>The URL part of the page, as it will appear in the URL</small>
183
          </span>
184
        </div>
185
        <div class="form-group">
186
          <strong> Content </strong>
187
          <div id="content" class="content well">
188
            <%= content %>
189
            <p></p>
190
            <button class="addContent btn btn-sm btn-primary">Add Content</button>
191
          </div>
192
        </div>
193
        <div class="form-group">
194
          <div class="input-group">
195
            <span class="input-group-addon"> <strong>Title</strong> </span>
196
            <input class="form-control"  id="title" type="text" placeholder="title of the page"
197
             value="<%= title %>">
198
          </div>
199
          <span class="help-block">
200
            <small>title of the page</small>
201
          </span>
202
        </div>
203
        <!--div class="form-group">
204
          <div class="input-group">
205
            <span class="input-group-addon"> <strong>Children</strong> </span>
206
            <input class="form-control"  id="children" type="text" placeholder="csv of child pages"
207
            value="<%= children %>">
208
          </div>
209
          <span class="help-block">
210
            <small> leave this blank for now</small>
211
          </span>
212
        </div-->
213
        <div class="form-group">
214
          <div class="input-group">
215
              <span class="input-group-addon">
216
                <input id="showNav" type="checkbox" <%= checked %> >
217
              </span>
218
              <input class="form-control" type="text" value="Show Navigation" disabled>
219
          </div>
220
          <span class="help-block">
221
            <small>Show navigation menu in this page? </small>
222
          </span>
223
        </div>
224
        <button id="updatePage" type="submit" class="btn btn-primary pull-right"> Update </button>
225
        <div class="clearfix"></div>
226
      </form>
227
    </div>
228
  </script>
229
230
  <script type="text/template" id="content-list-template">
231
    <div class="content-item-wrapper">
232
      <span class="content-item" id="content-<%= no %>">
233
        <span class="label label-default"> <%= type %> </span>
234
        <span class="content-snippet">
235
          [ <small> <%= title %>  <%= more %> </small> ]
236
        </span>
237
      </span>
238
      <span class="pull-right">
239
        <a href="javascript:void(0);" class="remove" for="<%=no%>">
240
          <span class="glyphicon glyphicon-trash"></span>
241
        </a>
242
      </span>
243
      <span class="clearfix"></span>
244
    </div>
245
  </script>
246
247
  <script type="text/template" id="content-template">
248
    <div class="contentview">
249
      <form class="form-horizontal">
250
        <div class="row">
251
          <div class="form-group col-lg-6">
252
            <label><b>Type</b></label>
253
            <select class="form-control">
254
              <% _.each(M.contentTypes, function(type) { %>
255
                <option><%= type %></option>
256
                <%  }); %>
257
            </select>
258
          </div>
259
        </div>
260
        <div class="row">
261
          <div class="form-group col-lg-6">
262
            <div class="input-group">
263
              <span class="input-group-addon"> <b>Title</b> </span>
264
              <input class="form-control"  type="text" placeholder="title of the content" value="<%=
265
              title %>" m-data-target="title">
266
            </div>
267
          </div>
268
        </div>
269
        <div class="row">
270
          <div class="form-group col-lg-6">
271
            <div class="input-group">
272
              <span class="input-group-addon"> <strong>Tags</strong> </span>
273
              <input class="form-control"  type="text" placeholder="csv of tags for this content"
274
              value="<%= tags %>" m-data-target="tags">
275
            </div>
276
          </div>
277
        </div>
278
      </form>
279
      <div class="row">
280
        <div id="specific-content"></div>
281
      </div>
282
      <div class="row">
283
        <button class="btn btn-primary" id="done">Done</button>
284
        <button class="btn btn-default" id="back">Back</button>
285
        <!--button class="btn btn-primary" id="updateContent">Update</button-->
286
      </div>
287
    </div>
288
  </script>
289
290
  <script type="text/template" id="map-template">
291
    <div class="data">
292
      <div class="row">
293
        <div class="form-group col-lg-6">
294
          <div class="input-group">
295
            <span class="input-group-addon"><strong>Tile Provider URL</strong></span>
296
            <input class="form-control" type="text" placeholder="http://{s}.tile.cloudmade.com/<API_KEY>/997/256/{z}/{x}/{y}.png" value="<%= tileLayer %>"
297
            m-data-target="tileLayer">
298
          </div>
299
        </div>
300
      </div>
301
      <div class="row">
302
        <div class="form-group col-lg-6">
303
          <div class="input-group">
304
            <span class="input-group-addon"><strong>Shapefile</strong></span>
305
            <input class="form-control" type="text" placeholder="" value="<%= shp %>"
306
            m-data-target="shp">
307
          </div>
308
        </div>
309
      </div>
310
      <div class="preview"></div>
311
    </div>
312
  </script>
313
314
315
  <script type="text/template" id="media-template">
316
    <div class="data">
317
      <div class="form-group col-lg-6">
318
        <div class="input-group">
319
          <span class="input-group-addon"><strong>path to file</strong></span>
320
          <input class="form-control" type="text" placeholder="src" value="<%= src %>"
321
          m-data-target="src">
322
        </div>
323
      </div>
324
      <div class="preview"></div>
325
    </div>
326
  </script>
327
328
  <script type="text/template" id="plugin-template">
329
    <div class="data">
330
      <!--div class="row">
331
        <div class="form-group col-lg-6">
332
          <div class="input-group">
333
            <span class="input-group-addon"><strong>path to file</strong></span>
334
            <input class="form-control" type="text" placeholder="src" value="<%= src %>"
335
            m-data-target="src">
336
          </div>
337
        </div>
338
      </div-->
339
      <% if(!src) { %>
340
        <div class="row">
341
          <div class="form-group col-lg-6">
342
            <form id="plugin-upload-form" action="" method="post" enctype="multipart/form-data">
343
              <input type="file" name="plugin-file" id="select-plugin">
344
              <input type="button" id="upload-plugin" class="btn btn-info" value="Upload Plugin">
345
            </form>
346
          </div>
347
        </div>
348
        <div class="row">
349
          <div class="form-group col-lg-6">
350
            <button type="button" class="btn btn-info" id="create-plugin">Create a new plugin</button>
351
          </div>
352
        </div>
353
      <% } %>
354
      <div class="row">
355
        <div class="form-group col-lg-6">
356
          <div class="input-group">
357
            <span class="input-group-addon"><strong>callback</strong></span>
358
            <input class="form-control" type="text" placeholder=
359
            "callback function for js plugin" value="<%= callback %>"
360
            m-data-target="callback">
361
          </div>
362
        </div>
363
      </div>
364
      <% if(src) { %>
365
        <div class="ace-mouchak" id="plugin-edit"></div>
366
      <% } %>
367
      <div class="preview"></div>
368
    </div>
369
  </script>
370
371
  <script type="text/template" id="text-template">
372
    <div class="data">
373
      <div class="edit-type-wrap">
374
        <div class="row">
375
          <b> Content </b>
376
        </div>
377
        <div class="row">
378
          <div class="col-lg-4">
379
            <!-- code vs wysiwyg switch -->
380
            <div class="btn-group" id="edit-type">
381
              <button type="button" class="btn btn-default" value="wysiwyg">WYSIWYG</button>
382
              <button type="button" class="btn btn-default" value="code">Code</button>
383
            </div>
384
            <p class="help-block">
385
              <span class="label label-info">Heads Up!</span> 
386
              <span><small><b> Switch editing mode </b></small></span>
387
            </p>
388
          </div>
389
        </div>
390
      </div>
391
      <div class="row">
392
        <% if(wysiwyg === true) { %>
393
        <textarea id="edit" m-data-target="data">
394
          <%= data %>
395
        </textarea>
396
        <% } else { %>
397
        <div id="code-edit" class="ace-mouchak" m-data-target="data">
398
          <%= M.escapeHtml(data) %>
399
        </div>
400
        <% } %>
401
      </div>
402
    </div>
403
  </script>
404
405
  <!-- notification templates -->
406
  <script type="text/template" id="notif-template">
407
    <div class="alert alert-<%= type %>">
408
      <button type="button" class="close" data-dismiss="alert">&times;</button>
409
      <h4> <%= title %> </h4>
410
      <%= msg %>
411
    </div>
412
  </script>
413
414
  <script type="text/template" id="uploads-template">
415
    <div class="page">
416
      <div><h4> All your uploads </h4></div>
417
      <div id="uploads-list" class="well">
418
      </div>
419
      <hr>
420
      <div class="row">
421
        <div> <h4> New Upload </h4> </div>
422
        <form id="file-upload-form" action="" method="post" enctype="multipart/form-data">
423
          <input type="file" name="upload-file" id="select-file">
424
          <input type="button" id="upload-new-file" class="btn btn-sm btn-primary update-btn" value="Upload File">
425
        </form>
426
      </div>
427
      <div class="clearfix"></div>
428
    </div>
429
  </script>
430
431
  <script type="text/template" id="uploaded-item-template">
432
    <div class="uploaded-item row">
433
      <span> &lt;icon here&gt; </span>
434
      <!--span class="uploaded-item-name"> <%= filename %> </span-->
435
      <span class="uploaded-item-path">
436
        <a href="<%= M.UploadsURL() + filename %>">
437
          <%= M.UploadsURL() + filename %>
438
        </a>
439
      </span>
440
      <span class="pull-right">
441
        <a href="javascript:void(0);" class="remove" for="<%= filename %>">
442
          <span class="glyphicon glyphicon-trash"></span>
443
        </a>
444
      </span>
445
      <span class="clearfix"></span>
446
    </div>
447
  </script>
448
449
{% endblock %}