2b4c217 by Anon Ray at 2013-10-03 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>
4a1fae7 by Anon Ray at 2013-05-09 13
      </div>
2b4c217 by Anon Ray at 2013-10-03 14
      <div id="notifications"></div>
4a1fae7 by Anon Ray at 2013-05-09 15
    </div>
77b14a4 by Anon Ray at 2013-10-06 16
    <div id="content-container"></div>
17
    <div id="footer"></div>
2b4c217 by Anon Ray at 2013-10-03 18
  </div>
77b14a4 by Anon Ray at 2013-10-06 19
  <div id="editor-overlay"></div>
2b4c217 by Anon Ray at 2013-10-03 20
21
  <script>
22
    // initialize editor
23
    window.M = window.M || {};
4e1af81 by Anon Ray at 2013-10-07 24
    M.MenuURL = function() { return "{{ url_for('insertMenu') }}"; };
9fa0b56 by Anon Ray at 2014-01-16 25
    M.FooterURL = function() { return "{{ url_for('insertFooter') }}"; };
26
    M.HeaderURL = function() { return "{{ url_for('insertHeader') }}"; };
4e1af81 by Anon Ray at 2013-10-07 27
    M.PageURL = function() { return "{{ url_for('insertPage') }}"; };
28
    M.PluginUploadURL = function() { return "{{ url_for('uploadPlugin') }}"; };
1d59374 by Anon Ray at 2014-01-21 29
    M.UploadsURL = function() { return "{{ url_for('static', filename='uploads/') }}"; };
c092528 by Anon Ray at 2014-02-27 30
    M.lastUpdatedURL = function() { return "{{ url_for('updateLastUpdated') }}"; };
2b4c217 by Anon Ray at 2013-10-03 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>
505d72a by Anon Ray at 2013-10-06 41
  <script src="{{url_for('static', filename='js/lib/ace/ace.js')}}"></script>
2b4c217 by Anon Ray at 2013-10-03 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">
e24b879 by Anon Ray at 2014-01-20 54
        <h4> Configure Navigation Menu </h4>
2b4c217 by Anon Ray at 2013-10-03 55
e5d3482 by Anon Ray at 2013-10-06 56
        <div class="row">
e24b879 by Anon Ray at 2014-01-20 57
          <div class="form-group col-lg-6">
e5d3482 by Anon Ray at 2013-10-06 58
            <div class="input-group">
e24b879 by Anon Ray at 2014-01-20 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>
e5d3482 by Anon Ray at 2013-10-06 64
            </div>
65
            <span class="help-block">
e24b879 by Anon Ray at 2014-01-20 66
              <small>
67
                activate to write your own custom menu
e5d3482 by Anon Ray at 2013-10-06 68
              </small>
69
            </span>
66e3c71 by Anon Ray at 2013-08-30 70
          </div>
2b4c217 by Anon Ray at 2013-10-03 71
        </div>
66e3c71 by Anon Ray at 2013-08-30 72
e5d3482 by Anon Ray at 2013-10-06 73
        <div class="row">
e24b879 by Anon Ray at 2014-01-20 74
          <div class="form-group col-lg-12" id="menu-order-wrap">
e5d3482 by Anon Ray at 2013-10-06 75
            <div class="input-group">
e24b879 by Anon Ray at 2014-01-20 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 %>">
e5d3482 by Anon Ray at 2013-10-06 79
            </div>
80
            <span class="help-block">
e24b879 by Anon Ray at 2014-01-20 81
              <small>csv list of page slugs to come up in the navigation menu
82
                in that order
e5d3482 by Anon Ray at 2013-10-06 83
              </small>
84
            </span>
85
          </div>
2b4c217 by Anon Ray at 2013-10-03 86
        </div>
66e3c71 by Anon Ray at 2013-08-30 87
2b4c217 by Anon Ray at 2013-10-03 88
        <div class="menu-options" style="display: none;">
e5d3482 by Anon Ray at 2013-10-06 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>
63c7919 by Anon Ray at 2013-05-30 96
            </div>
3fd837c by Anon Ray at 2013-08-23 97
          </div>
e5d3482 by Anon Ray at 2013-10-06 98
          <div class="row">
99
            <label><strong> HTML for menu: </strong></label>
f4147df by Anon Ray at 2014-01-15 100
            <div class="ace-mouchak" id="menu"><%= M.escapeHtml(menu) %></div>
e5d3482 by Anon Ray at 2013-10-06 101
          </div>
63c7919 by Anon Ray at 2013-05-30 102
        </div>
103
4a1fae7 by Anon Ray at 2013-05-09 104
      </div>
e5d3482 by Anon Ray at 2013-10-06 105
      <div class="clearfix"></div>
106
      <div class="row">
9fa0b56 by Anon Ray at 2014-01-16 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">
e24b879 by Anon Ray at 2014-01-20 115
      <div><h4> Write HTML for your header here </h4></div>
9fa0b56 by Anon Ray at 2014-01-16 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">
e24b879 by Anon Ray at 2014-01-20 128
      <div><h4> Write HTML for your footer here </h4></div>
9fa0b56 by Anon Ray at 2014-01-16 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>
e5d3482 by Anon Ray at 2013-10-06 134
      </div>
2b4c217 by Anon Ray at 2013-10-03 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>
e24b879 by Anon Ray at 2014-01-20 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>
1d59374 by Anon Ray at 2014-01-21 148
      <p> <a href="#" id="uploads"> Uploads </a> </p>
c092528 by Anon Ray at 2014-02-27 149
      <p> <a href="#" class="btn btn-default" id="last-updated">
150
        Content updated
151
      </a> </p>
2b4c217 by Anon Ray at 2013-10-03 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">
bf40f62 by Anon Ray at 2013-10-06 170
      <div class="row">
aaba218 by Anon Ray at 2013-10-06 171
        <h4> <strong><%= name %></strong> : Page Details </h4>
bf40f62 by Anon Ray at 2013-10-06 172
      </div>
173
      <hr/>
2b4c217 by Anon Ray at 2013-10-03 174
      <form class="form-horizontal">
175
        <div class="form-group">
176
          <div class="input-group">
e5d3482 by Anon Ray at 2013-10-06 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 %>">
4a1fae7 by Anon Ray at 2013-05-09 180
          </div>
e5d3482 by Anon Ray at 2013-10-06 181
          <span class="help-block">
182
            <small>The URL part of the page, as it will appear in the URL</small>
183
          </span>
2b4c217 by Anon Ray at 2013-10-03 184
        </div>
185
        <div class="form-group">
bf40f62 by Anon Ray at 2013-10-06 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">
2b4c217 by Anon Ray at 2013-10-03 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 %>">
4a1fae7 by Anon Ray at 2013-05-09 198
          </div>
e5d3482 by Anon Ray at 2013-10-06 199
          <span class="help-block">
200
            <small>title of the page</small>
201
          </span>
2b4c217 by Anon Ray at 2013-10-03 202
        </div>
1d59374 by Anon Ray at 2014-01-21 203
        <!--div class="form-group">
2b4c217 by Anon Ray at 2013-10-03 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 %>">
4a1fae7 by Anon Ray at 2013-05-09 208
          </div>
e5d3482 by Anon Ray at 2013-10-06 209
          <span class="help-block">
210
            <small> leave this blank for now</small>
211
          </span>
1d59374 by Anon Ray at 2014-01-21 212
        </div-->
2b4c217 by Anon Ray at 2013-10-03 213
        <div class="form-group">
505d72a by Anon Ray at 2013-10-06 214
          <div class="input-group">
215
              <span class="input-group-addon">
216
                <input id="showNav" type="checkbox" <%= checked %> >
217
              </span>
e5d3482 by Anon Ray at 2013-10-06 218
              <input class="form-control" type="text" value="Show Navigation" disabled>
4a1fae7 by Anon Ray at 2013-05-09 219
          </div>
e5d3482 by Anon Ray at 2013-10-06 220
          <span class="help-block">
221
            <small>Show navigation menu in this page? </small>
222
          </span>
2b4c217 by Anon Ray at 2013-10-03 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> ]
4a1fae7 by Anon Ray at 2013-05-09 236
        </span>
2b4c217 by Anon Ray at 2013-10-03 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>
4a1fae7 by Anon Ray at 2013-05-09 246
2b4c217 by Anon Ray at 2013-10-03 247
  <script type="text/template" id="content-template">
248
    <div class="contentview">
249
      <form class="form-horizontal">
505d72a by Anon Ray at 2013-10-06 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>
4a1fae7 by Anon Ray at 2013-05-09 259
        </div>
505d72a by Anon Ray at 2013-10-06 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>
748ffb6 by Arvind at 2013-09-30 267
          </div>
268
        </div>
505d72a by Anon Ray at 2013-10-06 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>
4a1fae7 by Anon Ray at 2013-05-09 276
          </div>
277
        </div>
2b4c217 by Anon Ray at 2013-10-03 278
      </form>
505d72a by Anon Ray at 2013-10-06 279
      <div class="row">
280
        <div id="specific-content"></div>
281
      </div>
282
      <div class="row">
bf40f62 by Anon Ray at 2013-10-06 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-->
505d72a by Anon Ray at 2013-10-06 286
      </div>
2b4c217 by Anon Ray at 2013-10-03 287
    </div>
288
  </script>
289
290
  <script type="text/template" id="map-template">
291
    <div class="data">
505d72a by Anon Ray at 2013-10-06 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>
2b4c217 by Anon Ray at 2013-10-03 299
        </div>
4a1fae7 by Anon Ray at 2013-05-09 300
      </div>
505d72a by Anon Ray at 2013-10-06 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>
8c2ed2e by Arvind at 2013-10-04 308
        </div>
309
      </div>
2b4c217 by Anon Ray at 2013-10-03 310
      <div class="preview"></div>
311
    </div>
312
  </script>
aeb1feb by Anon Ray at 2013-08-23 313
314
2b4c217 by Anon Ray at 2013-10-03 315
  <script type="text/template" id="media-template">
316
    <div class="data">
505d72a by Anon Ray at 2013-10-06 317
      <div class="form-group col-lg-6">
2b4c217 by Anon Ray at 2013-10-03 318
        <div class="input-group">
319
          <span class="input-group-addon"><strong>path to file</strong></span>
505d72a by Anon Ray at 2013-10-06 320
          <input class="form-control" type="text" placeholder="src" value="<%= src %>"
2b4c217 by Anon Ray at 2013-10-03 321
          m-data-target="src">
322
        </div>
aeb1feb by Anon Ray at 2013-08-23 323
      </div>
2b4c217 by Anon Ray at 2013-10-03 324
      <div class="preview"></div>
325
    </div>
326
  </script>
327
4f0c87d by Anon Ray at 2013-10-06 328
  <script type="text/template" id="plugin-template">
329
    <div class="data">
4e1af81 by Anon Ray at 2013-10-07 330
      <!--div class="row">
4f0c87d by Anon Ray at 2013-10-06 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>
4e1af81 by Anon Ray at 2013-10-07 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">
1d59374 by Anon Ray at 2014-01-21 343
              <input type="file" name="plugin-file" id="select-plugin">
4e1af81 by Anon Ray at 2013-10-07 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
      <% } %>
4f0c87d by Anon Ray at 2013-10-06 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>
4e1af81 by Anon Ray at 2013-10-07 364
      <% if(src) { %>
365
        <div class="ace-mouchak" id="plugin-edit"></div>
366
      <% } %>
4f0c87d by Anon Ray at 2013-10-06 367
      <div class="preview"></div>
368
    </div>
369
  </script>
370
2b4c217 by Anon Ray at 2013-10-03 371
  <script type="text/template" id="text-template">
372
    <div class="data">
505d72a by Anon Ray at 2013-10-06 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 { %>
4e1af81 by Anon Ray at 2013-10-07 397
        <div id="code-edit" class="ace-mouchak" m-data-target="data">
505d72a by Anon Ray at 2013-10-06 398
          <%= M.escapeHtml(data) %>
399
        </div>
400
        <% } %>
401
      </div>
2b4c217 by Anon Ray at 2013-10-03 402
    </div>
403
  </script>
404
405
  <!-- notification templates -->
529a151 by Anon Ray at 2013-11-27 406
  <script type="text/template" id="notif-template">
407
    <div class="alert alert-<%= type %>">
2b4c217 by Anon Ray at 2013-10-03 408
      <button type="button" class="close" data-dismiss="alert">&times;</button>
409
      <h4> <%= title %> </h4>
410
      <%= msg %>
411
    </div>
412
  </script>
aeb1feb by Anon Ray at 2013-08-23 413
1d59374 by Anon Ray at 2014-01-21 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
2b4c217 by Anon Ray at 2013-10-03 449
{% endblock %}