def sheets_tags_list(request): """ View public sheets organized by tags. """ if request.flavour == "mobile": return s2_sheets(request) elif not request.COOKIES.get('s1'): return s2_sheets(request) tags_list = public_tag_list(sort_by="alpha-hebrew" if request.interfaceLang == "hebrew" else "alpha") return render_to_response('sheet_tags.html', {"tags_list": tags_list, }, RequestContext(request))
def sheets_tags_list(request): """ View public sheets organized by tags. """ if request.flavour == "mobile": return s2_sheets(request) elif not request.COOKIES.get('s1'): return s2_sheets(request) tags_list = make_tag_list() return render_to_response('sheet_tags.html', {"tags_list": tags_list, }, RequestContext(request))
def sheets_list(request, type=None): """ List of all public/your/all sheets either as a full page or as an HTML fragment """ if not type: # Sheet Splash page return s2_sheets(request) response = {"status": 0} if type == "public": return s2_sheets_by_tag(request, "All Sheets") elif type == "private" and request.user.is_authenticated(): return s2_sheets_by_tag(request, "My Sheets") elif type == "private" and not request.user.is_authenticated(): return redirect("/login?next=/sheets/private")
def sheets_list(request, type=None): """ List of all public/your/all sheets either as a full page or as an HTML fragment """ if not type: # Sheet Splash page if request.flavour == "mobile": return s2_sheets(request) query = {"status": "public"} public = db.sheets.find(query).sort([["dateModified", -1]]).limit(32) public_tags = recent_public_tags() if request.user.is_authenticated(): query = {"owner": request.user.id} your = db.sheets.find(query).sort([["dateModified", -1]]).limit(3) your_tags = sheet_tag_counts(query) your_tags = order_tags_for_user(your_tags, request.user.id) collapse = your.count() > 3 else: your = your_tags = collapse = None return render_to_response('sheets_splash.html', { "public_sheets": public, "public_tags": public_tags, "your_sheets": your, "your_tags": your_tags, "collapse_private": collapse, "groups": get_user_groups(request.user) }, RequestContext(request)) response = { "status": 0 } if type == "public": query = {"status": "public"} response["title"] = "Public Source Sheets" response["public"] = True tags = recent_public_tags() elif type == "private": query = {"owner": request.user.id or -1 } response["title"] = "Your Source Sheets" response["groups"] = get_user_groups(request.user) tags = sheet_tag_counts(query) tags = order_tags_for_user(tags, request.user.id) elif type == "allz": query = {} response["title"] = "All Source Sheets" response["public"] = True tags = [] sheets = db.sheets.find(query).sort([["dateModified", -1]]) if "fragment" in request.GET: return render_to_response('elements/sheet_table.html', {"sheets": sheets}) response["sheets"] = sheets response["tags"] = tags return render_to_response('sheets_list.html', response, RequestContext(request))
def sheets_list(request, type=None): """ List of all public/your/all sheets either as a full page or as an HTML fragment """ if not type: # Sheet Splash page if request.flavour == "mobile": return s2_sheets(request) query = {"status": "public"} public = db.sheets.find(query).sort([["dateModified", -1]]).limit(32) public_tags = recent_public_tags() if request.user.is_authenticated(): query = {"owner": request.user.id} your = db.sheets.find(query).sort([["dateModified", -1]]).limit(3) your_tags = sheet_tag_counts(query) your_tags = order_tags_for_user(your_tags, request.user.id) collapse = your.count() > 3 else: your = your_tags = collapse = None return render_to_response( 'sheets_splash.html', { "public_sheets": public, "public_tags": public_tags, "your_sheets": your, "your_tags": your_tags, "collapse_private": collapse, "groups": get_user_groups(request.user) }, RequestContext(request)) response = {"status": 0} if type == "public": query = {"status": "public"} response["title"] = "Public Source Sheets" response["public"] = True tags = recent_public_tags() elif type == "private": query = {"owner": request.user.id or -1} response["title"] = "Your Source Sheets" response["groups"] = get_user_groups(request.user) tags = sheet_tag_counts(query) tags = order_tags_for_user(tags, request.user.id) elif type == "allz": query = {} response["title"] = "All Source Sheets" response["public"] = True tags = [] sheets = db.sheets.find(query).sort([["dateModified", -1]]) if "fragment" in request.GET: return render_to_response('elements/sheet_table.html', {"sheets": sheets}) response["sheets"] = sheets response["tags"] = tags return render_to_response('sheets_list.html', response, RequestContext(request))
def sheets_tags_list(request): """ View public sheets organized by tags. """ return s2_sheets(request)