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