Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/templates/_helpers.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/_helpers.html')
-rw-r--r--templates/_helpers.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/templates/_helpers.html b/templates/_helpers.html
new file mode 100644
index 0000000..f541437
--- /dev/null
+++ b/templates/_helpers.html
@@ -0,0 +1,51 @@
+{% macro link_to(text, endpoint) -%}
+ <a href="{{ url_for(endpoint, **kwargs) }}">{{ text }}</a>
+{%- endmacro %}
+
+{% macro options(_, name, option_list, current, action) -%}
+ <div class='{{ name }}'>
+ <h1>{{ _(name) }}</h1>
+ <form name='{{ name }}' action='{{ action }}' method="post">
+ {% for opt in option_list %}
+ <input type='radio' name='{{ name }}' value='{{ opt }}' {% if opt == current %}checked{% endif %} />{{ _(opt) }}<br />
+ {% endfor %}
+ </form>
+ <script>
+ <!--
+ $(document).ready(function() {
+ $(".{{ name }} input[type='radio']").change( function() {
+ $(".{{ name }} form").submit();
+ });
+ });
+ -->
+ </script>
+ </div>
+{%- endmacro %}
+
+{% macro options_ajax(_, name, option_list, current, action) -%}
+ <div class='{{ name }}'>
+ <h1>{{ _(name) }}</h1>
+ <form name='{{ name }}'>
+ {% for opt in option_list %}
+ <input type='radio' name='{{ name }}' value='{{ opt }}' {% if opt == current %}checked{% endif %} />{{ _(opt) }}<br />
+ {% endfor %}
+ </form>
+ <script>
+ <!--
+ $(document).ready(function() {
+ $(".{{ name }} input[type='radio']").change( function() {
+ $.ajax({
+ url: '{{ action }}',
+ type: 'POST',
+ data: ({ '{{ name }}' : $(this).val()}),
+ success: function(data) {
+ var _el = $('#result');
+ _el.html(data.word);
+ }
+ });
+ });
+ });
+ -->
+ </script>
+ </div>
+{%- endmacro %}