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