Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit 573e1f68f7af0c732c95cf0436284fde7bf6135b

favorites filter and launch functionality
app/app.py
(23 / 6)
  
5353 session['toolbar']=False
5454 return redirect(url_for('context_grid'))
5555
56@app.route('/launch/<context>')
57def launch(context):
58 c=client.Context.find(guid=context)
59 client.launch(c[0]['guid'])
60 return redirect(url_for('context_grid'))
61
62@app.route('/favorites')
63def favorites():
64 if session.get('favorites-filter'):
65 session['favorites-filter']=False
66 else:
67 session['favorites-filter']=True
68 return redirect(url_for('context_grid'))
69
5670@app.route('/toolbar')
5771def enable_toolbar():
5872 session['toolbar']=True
110110 if context and vote:
111111 context = context[5:] #remove "stars-" from id
112112 c=client.Context.find(guid=context)
113 c[0].vote = vote
113 c[0]['vote'] = vote
114114 c[0].post()
115115 return jsonify(vote=vote)
116116
151151 terms = []
152152 if query:
153153 terms.append(query)
154
155 if session.get('favorites-filter'):
156 terms.append('vote=True')
154157
155158 full_query = join(terms, " AND ")
156
159
157160 _PAGE_SIZE = 6
158161 r = []
159162 page = int(request.args.get('page', 1))
228228 server.data_root.value = 'tmp/db'
229229 server.stats_root.value = 'tmp/stats'
230230 server.logdir.value = 'tmp/log'
231 server_pid = restful_document.fork(server.resources())
231 server_pid = restful_document.fork(server.resources)
232232
233 client.api_url.value = \
234 'http://%s:%s' % (server.host.value, server.port.value)
233 #client.api_url.value = \
234 # 'http://%s:%s' % (server.host.value, server.port.value)
235235
236236
237237 #client.api_url.value = \
238238 # 'http://api.network.sugarlabs.org:8000'
239 #client.api_url.value = 'http://18.85.44.120:8000'
239 client.api_url.value = 'http://18.85.44.120:8000'
240240 #client.api_url.value = \
241241 # 'http://localhost:8000'
242242 host = '127.0.0.1' #'0.0.0.0' for all
  
175175 padding: 3%;
176176 float:left;
177177 text-align:center;
178 position:relative;
178179 }
179180
180181div.iconbox {
192192 color: white;
193193 background-color: #808080;
194194 border-radius: 15px;
195 z-index: 100;
195196}
196197
198.launch-icon {
199 top:122px;
200 left:172px;
201 position:absolute;
202 background-color: #fff;
203 border-radius: 15px;
204 z-index: 110;
205}
197206
198207
199208/*** Resource browser (Context view) ***/
  
33 <ul class="resource-grid">
44 {%- for item in result %}
55 <li class="grid-item">
6 <a href="/launch/{{item.guid}}">
7 <img class="launch-icon" src="/static/icons/activity-start.png" />
8 </a>
69 <div class="iconbox">
710 <a href="/context/view/{{item.guid}}">
811 <img width="100%" height="100%" class="grid-icon" src="/static/icons/document-generic.png" />
2626 }, function() {
2727 $(this).css('background-color','#fff');
2828 }); */
29 $('.grid-icon').hover( function() {
30 $(this).parent().parent().parent().find('img:first').css('background-color', '#c5c5c5');
31 }, function() {
32 $(this).parent().parent().parent().find('img:first').css('background-color', '#fff');
33 });
34 $('.launch-icon').hover( function() {
35 $(this).css('background-color', '#808080');
36 }, function() {
37 $(this).css('background-color', '#fff');
38 });
39
40
2941 $('.star-emblem').click( function() {
3042 if ( $(this).data('vote') == true) {
3143 $(this).css('background-color','#fff');