A new Riff-radio.org site with a static approach.

gallery.tmpl.py 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. # -*- coding:utf-8 -*-
  2. from mako import runtime, filters, cache
  3. UNDEFINED = runtime.UNDEFINED
  4. STOP_RENDERING = runtime.STOP_RENDERING
  5. __M_dict_builtin = dict
  6. __M_locals_builtin = locals
  7. _magic_number = 10
  8. _modified_time = 1676236796.2348382
  9. _enable_loop = True
  10. _template_filename = 'themes/bootstrap3/templates/gallery.tmpl'
  11. _template_uri = 'gallery.tmpl'
  12. _source_encoding = 'utf-8'
  13. _exports = ['sourcelink', 'content', 'extra_head', 'extra_js']
  14. def _mako_get_namespace(context, name):
  15. try:
  16. return context.namespaces[(__name__, name)]
  17. except KeyError:
  18. _mako_generate_namespaces(context)
  19. return context.namespaces[(__name__, name)]
  20. def _mako_generate_namespaces(context):
  21. ns = runtime.TemplateNamespace('comments', context._clean_inheritance_tokens(), templateuri='comments_helper.tmpl', callables=None, calling_uri=_template_uri)
  22. context.namespaces[(__name__, 'comments')] = ns
  23. ns = runtime.TemplateNamespace('ui', context._clean_inheritance_tokens(), templateuri='crumbs.tmpl', callables=None, calling_uri=_template_uri)
  24. context.namespaces[(__name__, 'ui')] = ns
  25. def _mako_inherit(template, context):
  26. _mako_generate_namespaces(context)
  27. return runtime._inherit_from(context, 'base.tmpl', _template_uri)
  28. def render_body(context,**pageargs):
  29. __M_caller = context.caller_stack._push_frame()
  30. try:
  31. __M_locals = __M_dict_builtin(pageargs=pageargs)
  32. _import_ns = {}
  33. _mako_get_namespace(context, 'ui')._populate(_import_ns, ['bar'])
  34. def extra_js():
  35. return render_extra_js(context._locals(__M_locals))
  36. photo_array_json = _import_ns.get('photo_array_json', context.get('photo_array_json', UNDEFINED))
  37. thumbnail_size = _import_ns.get('thumbnail_size', context.get('thumbnail_size', UNDEFINED))
  38. enable_comments = _import_ns.get('enable_comments', context.get('enable_comments', UNDEFINED))
  39. gallery_path = _import_ns.get('gallery_path', context.get('gallery_path', UNDEFINED))
  40. comments = _mako_get_namespace(context, 'comments')
  41. def extra_head():
  42. return render_extra_head(context._locals(__M_locals))
  43. lang = _import_ns.get('lang', context.get('lang', UNDEFINED))
  44. translations = _import_ns.get('translations', context.get('translations', UNDEFINED))
  45. folders = _import_ns.get('folders', context.get('folders', UNDEFINED))
  46. title = _import_ns.get('title', context.get('title', UNDEFINED))
  47. permalink = _import_ns.get('permalink', context.get('permalink', UNDEFINED))
  48. len = _import_ns.get('len', context.get('len', UNDEFINED))
  49. parent = _import_ns.get('parent', context.get('parent', UNDEFINED))
  50. crumbs = _import_ns.get('crumbs', context.get('crumbs', UNDEFINED))
  51. post = _import_ns.get('post', context.get('post', UNDEFINED))
  52. photo_array = _import_ns.get('photo_array', context.get('photo_array', UNDEFINED))
  53. _link = _import_ns.get('_link', context.get('_link', UNDEFINED))
  54. site_has_comments = _import_ns.get('site_has_comments', context.get('site_has_comments', UNDEFINED))
  55. def content():
  56. return render_content(context._locals(__M_locals))
  57. ui = _mako_get_namespace(context, 'ui')
  58. def sourcelink():
  59. return render_sourcelink(context._locals(__M_locals))
  60. __M_writer = context.writer()
  61. __M_writer('\n')
  62. __M_writer('\n')
  63. __M_writer('\n')
  64. if 'parent' not in context._data or not hasattr(context._data['parent'], 'sourcelink'):
  65. context['self'].sourcelink(**pageargs)
  66. __M_writer('\n\n')
  67. if 'parent' not in context._data or not hasattr(context._data['parent'], 'content'):
  68. context['self'].content(**pageargs)
  69. __M_writer('\n\n')
  70. if 'parent' not in context._data or not hasattr(context._data['parent'], 'extra_head'):
  71. context['self'].extra_head(**pageargs)
  72. __M_writer('\n\n')
  73. if 'parent' not in context._data or not hasattr(context._data['parent'], 'extra_js'):
  74. context['self'].extra_js(**pageargs)
  75. __M_writer('\n')
  76. return ''
  77. finally:
  78. context.caller_stack._pop_frame()
  79. def render_sourcelink(context,**pageargs):
  80. __M_caller = context.caller_stack._push_frame()
  81. try:
  82. _import_ns = {}
  83. _mako_get_namespace(context, 'ui')._populate(_import_ns, ['bar'])
  84. def sourcelink():
  85. return render_sourcelink(context)
  86. __M_writer = context.writer()
  87. return ''
  88. finally:
  89. context.caller_stack._pop_frame()
  90. def render_content(context,**pageargs):
  91. __M_caller = context.caller_stack._push_frame()
  92. try:
  93. _import_ns = {}
  94. _mako_get_namespace(context, 'ui')._populate(_import_ns, ['bar'])
  95. title = _import_ns.get('title', context.get('title', UNDEFINED))
  96. permalink = _import_ns.get('permalink', context.get('permalink', UNDEFINED))
  97. enable_comments = _import_ns.get('enable_comments', context.get('enable_comments', UNDEFINED))
  98. crumbs = _import_ns.get('crumbs', context.get('crumbs', UNDEFINED))
  99. comments = _mako_get_namespace(context, 'comments')
  100. post = _import_ns.get('post', context.get('post', UNDEFINED))
  101. photo_array = _import_ns.get('photo_array', context.get('photo_array', UNDEFINED))
  102. site_has_comments = _import_ns.get('site_has_comments', context.get('site_has_comments', UNDEFINED))
  103. def content():
  104. return render_content(context)
  105. ui = _mako_get_namespace(context, 'ui')
  106. folders = _import_ns.get('folders', context.get('folders', UNDEFINED))
  107. __M_writer = context.writer()
  108. __M_writer('\n ')
  109. __M_writer(str(ui.bar(crumbs)))
  110. __M_writer('\n')
  111. if title:
  112. __M_writer(' <h1>')
  113. __M_writer(filters.html_escape(str(title)))
  114. __M_writer('</h1>\n')
  115. if post:
  116. __M_writer(' <p>\n ')
  117. __M_writer(str(post.text()))
  118. __M_writer('\n </p>\n')
  119. if folders:
  120. __M_writer(' <ul>\n')
  121. for folder, ftitle in folders:
  122. __M_writer(' <li><a href="')
  123. __M_writer(str(folder))
  124. __M_writer('"><i class="glyphicon glyphicon-folder-open"></i>&nbsp;')
  125. __M_writer(filters.html_escape(str(ftitle)))
  126. __M_writer('</a></li>\n')
  127. __M_writer(' </ul>\n')
  128. __M_writer('\n<div id="gallery_container"></div>\n')
  129. if photo_array:
  130. __M_writer('<noscript>\n<ul class="thumbnails">\n')
  131. for image in photo_array:
  132. __M_writer(' <li><a href="')
  133. __M_writer(str(image['url']))
  134. __M_writer('" class="thumbnail image-reference" title="')
  135. __M_writer(filters.html_escape(str(image['title'])))
  136. __M_writer('">\n <img src="')
  137. __M_writer(str(image['url_thumb']))
  138. __M_writer('" alt="')
  139. __M_writer(filters.html_escape(str(image['title'])))
  140. __M_writer('" /></a>\n')
  141. __M_writer('</ul>\n</noscript>\n')
  142. if site_has_comments and enable_comments:
  143. __M_writer(str(comments.comment_form(None, permalink, title)))
  144. __M_writer('\n')
  145. return ''
  146. finally:
  147. context.caller_stack._pop_frame()
  148. def render_extra_head(context,**pageargs):
  149. __M_caller = context.caller_stack._push_frame()
  150. try:
  151. _import_ns = {}
  152. _mako_get_namespace(context, 'ui')._populate(_import_ns, ['bar'])
  153. len = _import_ns.get('len', context.get('len', UNDEFINED))
  154. parent = _import_ns.get('parent', context.get('parent', UNDEFINED))
  155. gallery_path = _import_ns.get('gallery_path', context.get('gallery_path', UNDEFINED))
  156. def extra_head():
  157. return render_extra_head(context)
  158. lang = _import_ns.get('lang', context.get('lang', UNDEFINED))
  159. _link = _import_ns.get('_link', context.get('_link', UNDEFINED))
  160. translations = _import_ns.get('translations', context.get('translations', UNDEFINED))
  161. __M_writer = context.writer()
  162. __M_writer('\n')
  163. __M_writer(str(parent.extra_head()))
  164. __M_writer('\n<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">\n<style type="text/css">\n #gallery_container {\n position: relative;\n }\n .image-block {\n position: absolute;\n }\n</style>\n')
  165. if len(translations) > 1:
  166. for langname in translations.keys():
  167. if langname != lang:
  168. __M_writer(' <link rel="alternate" hreflang="')
  169. __M_writer(str(langname))
  170. __M_writer('" href="')
  171. __M_writer(str(_link('gallery', gallery_path, langname)))
  172. __M_writer('">\n')
  173. return ''
  174. finally:
  175. context.caller_stack._pop_frame()
  176. def render_extra_js(context,**pageargs):
  177. __M_caller = context.caller_stack._push_frame()
  178. try:
  179. _import_ns = {}
  180. _mako_get_namespace(context, 'ui')._populate(_import_ns, ['bar'])
  181. photo_array_json = _import_ns.get('photo_array_json', context.get('photo_array_json', UNDEFINED))
  182. thumbnail_size = _import_ns.get('thumbnail_size', context.get('thumbnail_size', UNDEFINED))
  183. def extra_js():
  184. return render_extra_js(context)
  185. __M_writer = context.writer()
  186. __M_writer('\n<script src="/assets/js/justified-layout.min.js"></script>\n<script src="/assets/js/gallery.min.js"></script>\n<script>\nvar jsonContent = ')
  187. __M_writer(str(photo_array_json))
  188. __M_writer(';\nvar thumbnailSize = ')
  189. __M_writer(str(thumbnail_size))
  190. __M_writer(";\nrenderGallery(jsonContent, thumbnailSize);\nwindow.addEventListener('resize', function(){renderGallery(jsonContent, thumbnailSize)});\n</script>\n")
  191. return ''
  192. finally:
  193. context.caller_stack._pop_frame()
  194. """
  195. __M_BEGIN_METADATA
  196. {"filename": "themes/bootstrap3/templates/gallery.tmpl", "uri": "gallery.tmpl", "source_encoding": "utf-8", "line_map": {"23": 3, "26": 4, "32": 0, "65": 2, "66": 3, "67": 4, "72": 5, "77": 39, "82": 59, "87": 70, "93": 5, "106": 7, "124": 7, "125": 8, "126": 8, "127": 9, "128": 10, "129": 10, "130": 10, "131": 12, "132": 13, "133": 14, "134": 14, "135": 17, "136": 18, "137": 19, "138": 20, "139": 20, "140": 20, "141": 20, "142": 20, "143": 22, "144": 24, "145": 26, "146": 27, "147": 29, "148": 30, "149": 30, "150": 30, "151": 30, "152": 30, "153": 31, "154": 31, "155": 31, "156": 31, "157": 33, "158": 36, "159": 37, "160": 37, "166": 41, "180": 41, "181": 42, "182": 42, "183": 52, "184": 53, "185": 54, "186": 55, "187": 55, "188": 55, "189": 55, "190": 55, "196": 61, "206": 61, "207": 65, "208": 65, "209": 66, "210": 66, "216": 210}}
  197. __M_END_METADATA
  198. """