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">
17
    </div>
18
    <div id="footer">
19
    </div>
20
  </div>
21
22
  <script>
23
    // initialize editor
24
    window.M = window.M || {};
25
    M.MenuURL = function() { return "{{ url_for('insertMenu') }}"};
26
    M.PageURL = function() { return "{{ url_for('insertPage') }}"};
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/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="form-group" id="menu-order-wrap">
52
          <div class="input-group">
53
            <span class="input-group-addon"> <strong> Menu Order</strong></span>
54
            <input class="form-control"  id="menu-order" type="text" class="col-md-4"
55
            placeholder="list,page,names,for,menu,order" value="<%= menu_order %>">
56
          </div>
57
        </div>
58
59
        <div class="form-group">
60
          <input class="form-control"  id="custom-menu" type="checkbox">
61
          <span class=""><strong> Custom Menu </strong></span>
62
        </div>
63
64
        <div class="menu-options" style="display: none;">
65
          <div class="form-group">
66
            <div class="input-group">
67
              <span class="input-group-addon"> <strong> Position </strong></span>
68
              <input class="form-control"  id="pos" type="text" placeholder="[left, top]"
69
              value="<%= pos %>">
70
            </div>
71
          </div>
72
          <label><strong> HTML for menu: </strong></label>
73
          <textarea cols="25" rows="8" id="menu"><%= menu %></textarea>
74
        </div>
75
76
      </div>
77
      <button id="updateMenu" class="btn btn-primary pull-right"> Update </button>
78
      <div class="clearfix"></div>
79
    </div>
80
  </script>
81
82
  <script type="text/template" id="page-list-template">
83
    <div id="pagelistview">
84
      <h4> List of Pages </h4>
85
      <div id="pagelist"></div>
86
      <button class="btn btn-primary" id="addPage">Add Page</button>
87
      <hr>
88
      <p> <a href="javascript:void(0);" id="menu-config"> Site Menu </a> </p>
89
      <p><a href="{{ url_for('index') }}"> Go to site </a></p>
90
    </div>
91
  </script>
92
93
  <script type="text/template" id="page-list-item-template">
94
    <div class="pagename">
95
      <a class="disp" id="<%= id %>" href="javascript:void(0);"><%= name %></a>
96
      <span class="pull-right">
97
        <a href="javascript:void(0);" class="remove" for="<%= id %>">
98
          <span class="glyphicon glyphicon-trash"></span>
99
        </a>
100
      </span>
101
      <span class="clearfix"></span>
102
    </div>
103
  </script>
104
105
  <script type="text/template" id="page-template">
106
    <div class="page">
107
      <h4> Page Details </h4>
108
      <form class="form-horizontal">
109
        <div class="form-group">
110
          <div class="input-group">
111
            <span class="input-group-addon"> <strong> Name </strong></span>
112
            <input class="form-control"  id="name" type="text" placeholder="name of the page" value="<%= name %>">
113
          </div>
114
        </div>
115
        <div class="form-group">
116
          <div class="input-group">
117
            <span class="input-group-addon"> <strong>Title</strong> </span>
118
            <input class="form-control"  id="title" type="text" placeholder="title of the page"
119
             value="<%= title %>">
120
          </div>
121
        </div>
122
        <div class="form-group">
123
          <div class="input-group">
124
            <span class="input-group-addon"> <strong>Children</strong> </span>
125
            <input class="form-control"  id="children" type="text" placeholder="csv of child pages"
126
            value="<%= children %>">
127
          </div>
128
        </div>
129
        <div class="form-group">
130
          <div class="checkbox">
131
            <label>
132
              <input id="showNav" type="checkbox" <%=checked%>>
133
              <strong> Show Navigation </strong>
134
            </label>
135
          </div>
136
        </div>
137
        <label><strong> Content </strong></label>
138
        <div id="content" class="content well">
139
          <%= content %>
140
          <p></p>
141
          <button class="addContent btn btn-sm btn-primary">Add Content</button>
142
        </div>
143
        <button id="updatePage" type="submit" class="btn btn-primary pull-right"> Update </button>
144
        <div class="clearfix"></div>
145
      </form>
146
    </div>
147
  </script>
148
149
  <script type="text/template" id="content-list-template">
150
    <div class="content-item-wrapper">
151
      <span class="content-item" id="content-<%= no %>">
152
        <span class="label label-default"> <%= type %> </span>
153
        <span class="content-snippet">
154
          [ <small> <%= title %>  <%= more %> </small> ]
155
        </span>
156
      </span>
157
      <span class="pull-right">
158
        <a href="javascript:void(0);" class="remove" for="<%=no%>">
159
          <span class="glyphicon glyphicon-trash"></span>
160
        </a>
161
      </span>
162
      <span class="clearfix"></span>
163
    </div>
164
  </script>
165
166
  <script type="text/template" id="content-template">
167
    <div class="contentview">
168
      <form class="form-horizontal">
169
        <div class="form-group">
170
          <label><b>Type</b></label>
171
          <select class="form-control">
172
            <% _.each(M.contentTypes, function(type) { %>
173
              <option><%= type %></option>
174
            <%  }); %>
175
          </select>
176
        </div>
177
        <div class="form-group">
178
          <div class="input-group">
179
            <span class="input-group-addon"> <b>Title</b> </span>
180
            <input class="form-control"  type="text" placeholder="title of the content" value="<%=
181
            title %>" m-data-target="title">
182
          </div>
183
        </div>
184
        <div class="form-group">
185
          <div class="input-group">
186
            <span class="input-group-addon"> <strong>Tags</strong> </span>
187
            <input class="form-control"  type="text" placeholder="csv of tags for this content"
188
            value="<%= tags %>" m-data-target="tags">
189
          </div>
190
        </div>
191
      </form>
192
      <div id="specific-content"></div>
193
      <button class="btn btn-info" id="done">Done</button>
194
      <button class="btn btn-primary" id="updateContent">Update</button>
195
    </div>
196
  </script>
197
198
  <script type="text/template" id="map-template">
199
    <div class="data">
200
      <div class="form-group">
201
        <div class="input-group">
202
          <span class="input-group-addon"><strong>Tile Provider URL</strong></span>
203
          <input class="form-control"  type="text" placeholder="http://{s}.tile.cloudmade.com/<API_KEY>/997/256/{z}/{x}/{y}.png" value="<%= tileLayer %>"
204
          m-data-target="tileLayer">
205
        </div>
206
      </div>
207
      <div class="form-group">
208
        <div class="input-group">
209
          <span class="input-group-addon"><strong>Shapefile</strong></span>
210
          <input class="form-control"  type="text" placeholder="" value="<%= shp %>"
211
          m-data-target="shp">
212
        </div>
213
      </div>
214
      <div class="preview"></div>
215
    </div>
216
  </script>
217
218
219
  <script type="text/template" id="media-template">
220
    <div class="data">
221
      <div class="form-group">
222
        <div class="input-group">
223
          <span class="input-group-addon"><strong>path to file</strong></span>
224
          <input class="form-control"  type="text" placeholder="src" value="<%= src %>"
225
          m-data-target="src">
226
        </div>
227
      </div>
228
      <div class="preview"></div>
229
    </div>
230
  </script>
231
232
  <script type="text/template" id="text-template">
233
    <div class="data">
234
      <label><b> Content </b></label>
235
      <p>
236
      <span class="label label-info">Tip</span>
237
      <span><small> You can unleash your HTML power here </small></span>
238
      </p>
239
      <textarea id="edit" m-data-target="data">
240
        <%= data %>
241
      </textarea>
242
    </div>
243
  </script>
244
245
  <!-- notification templates -->
246
  <script type="text/template" id="success-notif">
247
    <div class="alert alert-success">
248
      <button type="button" class="close" data-dismiss="alert">&times;</button>
249
      <h4> <%= title %> </h4>
250
      <%= msg %>
251
    </div>
252
  </script>
253
254
  <script type="text/template" id="fail-notif">
255
    <div class="alert alert-danger">
256
      <button type="button" class="close" data-dismiss="alert">&times;</button>
257
      <h4> <%= title %> </h4>
258
      <%= msg %>
259
    </div>
260
  </script>
261
{% endblock %}