def render_page(user_id, isin, user, days=None, token_type_id=None): _TMPL = template_lib.get_template('pages/wordle.mustache.html') if days == None: days = -1 #all days = int(days) #set selected for item in _DAYCOUNTS: item['sel'] = True if item['days'] == days else False _DAYCOUNTS[-1]['islast'] = True cur = message_data.get_token_histogram(user_id, days, token_type_id) biggest = 0 #calc proportional font size words = [] isfirstrow = True for row in cur: if isfirstrow: biggest = row['total'] isfirstrow = False words.append({ 'word':row['value'], 'size': int(round(float(row['total'])/float(biggest) * _MAXFONTSIZE)) } ) data = {'words':words} data['divclass'] = global_atoms.MESSAGE_DIV_CLASS data['divid'] = global_atoms.MESSAGE_DIV_ID_OUTER data['daycounts'] = _DAYCOUNTS data['url'] = urls.TOKENS__URL data['opt_id'] = wordle_atom.Form.OPT_ID data['x'] = 'x.mustache' return common.sp(pystache.render(_TMPL, data), isin, user)
import pystache import urls import lib.db as db import lib.html as html import lib.loc as loc import data.location_data as loc_data import pages.common as common import pages.template_lib as template_lib import pages.location_atom as loc_atom import pages.global_atoms as global_atoms _TMPL = template_lib.get_template('pages/place.mustache.html') def render_known_places(isin, sn, u_id, p_id=None): #print 'places:render_known_places' print "places:render_known_places:p_id", str(p_id) if not isin: yield common.sp('You are not logged in.', isin, sn) else: data = loc_data.do_get_places(u_id, p_id) for page in common.yp(_get_place_gen(u_id, p_id, data), isin, sn): yield page def render_unknown_place(isin, sn, u_id, descr, lat, lon, prox):
# Copyright 2014 The Moore Collective, LLC, All Rights Reserved import pystache from pages.global_atoms import MESSAGE_DIV_CLASS, \ MESSAGE_HEADER_DIV_CLASS, MESSAGE_DIV_ID_OUTER from pages.invite_div_atom import TO_UID, FROM_UID, PROFILE_SWITCH, \ ACTION, ACCEPT_ACTION, REJECT_ACTION, MSG_HEAD_ID from pages.profile_atom import U_ID from pages.template_lib import get_template _TMPL = get_template('pages/invite_div_tmpl.mustache.html') def render_html(data): return pystache.render(_TMPL, data) def do_test_render_html(): return render_html(do_test_get_data()) def do_test_get_data(): data = { 'u_id_atom': U_ID, 'header_class_atom': MESSAGE_HEADER_DIV_CLASS, 'class_atom': MESSAGE_DIV_CLASS, 'id_atom': MESSAGE_DIV_ID_OUTER, 'msg_head_id_atom': MSG_HEAD_ID, 'action_atom': ACTION, 'accept_action': ACCEPT_ACTION,
# Copyright 2014 The Moore Collective, LLC, All Rights Reserved import pystache import pages.template_lib as template_lib _TMPL = template_lib.get_template('pages/messages_tmpl.mustache.html') def do_render_html(data): return pystache.render(_TMPL, data) def do_test_render_html(): return pystache.render(_TMPL, do_test_get_data()) def do_test_get_data(): data = {} data['url'] = 'messages' message_types = [{ 'id': 1, 'descr': 'mood' }, { 'id': 2, 'descr': 'invite' }, { 'id': 3, 'descr': 'yo'
# Copyright 2014 The Moore Collective, LLC, All Rights Reserved import pystache import pages.profile_atom as profile_atom import pages.template_lib as template_lib _TMPL = template_lib.get_template('pages/profile_tmpl.mustache.html') def do_render_html(data): return pystache.render(_TMPL, data) def do_test_get_data(): sharing_levels = [{ 'value': 0, 'descr': 'private', 'sel': False }, { 'value': 1, 'descr': 'intimate', 'sel': False }, { 'value': 2, 'descr': 'trusted', 'sel': True }, { 'value': 3, 'descr': 'known', 'sel': False
# Copyright 2014 The Moore Collective, LLC, All Rights Reserved import pystache from pages.relationships_atom import OTHER_U_ID import pages.template_lib as template_lib _TMPL = template_lib.get_template('pages/relationships_tmpl.mustache.html') def do_render_html(data): return pystache.render(_TMPL, data) def do_test_render_html(): return pystache.render(_TMPL, do_test_get_data()) def do_test_get_data(): data = {} data['other_u_id_atom'] = OTHER_U_ID data['relationships_url'] = '/relationships' data['user_search_url'] = '/search' data['profile_url'] = '/profile' data['sharing_level_url'] = '/relationships/sharinglevel' athena = { 'screen_name': 'athena', 'u_id':
import copy import pystache import urls import lib.html as html import data.location_data as location_data import pages.template_lib as template_lib import pages.location_atom as loc_atom from pages.common import yp, sp _TMPL = template_lib.get_template('pages/visit_history_rollup.mustache.html') def render_html(data): return pystache.render(_TMPL, data) def render_page(isin, screen_name, u_id): loc_hist = location_data.do_get_visit_history_rollup(u_id) top_places = [dict(x) for x in list(location_data.do_get_top_places(u_id))] for place in top_places: url_data = \ {loc_atom.PLACE_ID:place[loc_atom.PLACE_ID], loc_atom.PROXIMITY:0} url = html.urlencode(urls.PLACE__URL, url_data) place['place_url'] = html.hyperlink(url, place[loc_atom.DESCR])
# Copyright 2014 The Moore Collective, LLC, All Rights Reserved import pystache from pages.global_atoms import MESSAGE_DIV_CLASS, \ MESSAGE_HEADER_DIV_CLASS, MESSAGE_DIV_ID_OUTER import pages.template_lib as template_lib _TMPL = template_lib.get_template('pages/yo_div_tmpl.mustache.html') def render_html(data): return pystache.render(_TMPL, data) def do_test_render_html(): return render_html(do_test_get_data()) def do_test_get_data(): ret = { 'class_atom': MESSAGE_DIV_CLASS + ' ' + MESSAGE_HEADER_DIV_CLASS, 'id_atom':MESSAGE_DIV_ID_OUTER, 'img':"linkup.png", 'from_id':"ixk3kj65j5-a-u-id-guid", 'from_sn':"abe", 'to_id':"alkjlkj65j5-a-u-id-guid", 'to_sn':"ben", 'msg_id':"x12345-a-message-id-guid", 'msg_time':"2013-10-11 13:34", 'msg_body':"hey, let's connect on Spriggle!", 'profile_url':"/profile", 'invitation_response_url':"/linkupresponse",
# Copyright 2014 The Moore Collective, LLC, All Rights Reserved import pystache import pages.template_lib as template_lib _TMPL = template_lib.get_template('pages/mood_form_tmpl.mustache.html') def render_html(data): return pystache.render(_TMPL, data)
# Copyright 2014 The Moore Collective, LLC, All Rights Reserved import pystache import pages.user_search_atom as user_search_atom import pages.template_lib as template_lib _TMPL = template_lib.get_template('pages/user_search_tmpl.mustache.html') def render_html(data): return pystache.render(_TMPL, data) def do_test_render_html(): return pystache.render(_TMPL, do_test_get_data()) def do_test_get_data(): data = {} data['url'] = '/search' data['invite_url'] = '/message/invite' data['profile_url'] = '/profile' data['action_atom'] = user_search_atom.ACTION data['input_atom'] = user_search_atom.INPUT data['u_id_atom'] = user_search_atom.UID data['u_sn_atom'] = user_search_atom.USN data['search_text'] = 'zeus' athena = {'screen_name':'athena', 'u_id':'a-uuid-0000-34-aldsf'} eros = {'screen_name':'eros', 'u_id':'a-uuid-1111-34-aldsf'} zeus = {'screen_name':'zeus', 'u_id':'a-uuid-2222-34-aldsf'} hephaestus = {'screen_name':'hephaestus', 'u_id':'a-uuid-3333-34-aldsf'}
import copy import pystache import urls import lib.html as html import data.location_data as location_data import pages.template_lib as template_lib import pages.location_atom as loc_atom from pages.common import yp, sp _TMPL = template_lib.get_template('pages/visit_history_detail.mustache.html') def _render_html(data): return pystache.render(_TMPL, data) def render_page(isin, screen_name, u_id, visit_date=None): clust_hist = \ location_data.do_get_visit_history_detail(u_id, visit_date, visit_date) data = {} clusters = [] last_entry_date = None temp_dict = None for row in clust_hist: entry_date = row['entry_date']