changeset 2425:4153b0117969

initial version of user settings view with Bootstrap
author sharky93 <rishabhr123@gmail.com>
date Tue, 27 Aug 2013 22:16:59 +0530
parents 8bf6121e6366
children eca842df2ec4
files MoinMoin/templates/basic.js MoinMoin/themes/basic/templates/usersettings.html MoinMoin/themes/basic/templates/usersettings_forms.html
diffstat 3 files changed, 192 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/basic.js	Mon Aug 26 02:48:05 2013 +0530
+++ b/MoinMoin/templates/basic.js	Tue Aug 27 22:16:59 2013 +0530
@@ -2,6 +2,7 @@
     // this depends on the id's used for different tab-panes in modify.html (Basic Theme)
     var edit = false;
     $('#meta, #help').removeClass('active');
+    $('#password, #notification, #ui, #navigation, #options').removeClass('active');
     $('textarea').autosize();
     window.onbeforeunload = function(e) {
         // checks if the URL is of the form http://host/+modify/page
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/themes/basic/templates/usersettings.html	Tue Aug 27 22:16:59 2013 +0530
@@ -0,0 +1,15 @@
+{% extends theme("layout.html") %}
+{% import theme("usersettings_forms.html") as user_forms %}
+
+{% block content %}
+<h2>{{ _("User Settings") }}</h2>
+<ul class="moin-nav nav-tabs moin-shadow">
+    <li class="active"><a href="#personal" data-toggle="tab">{{ _("Personal Settings") }}</a></li>
+    <li><a href="#password" data-toggle="tab">{{ _("Change Password") }}</a></li>
+    <li><a href="#notification" data-toggle="tab">{{ _("Notification Settings") }}</a></li>
+    <li><a href="#ui" data-toggle="tab">{{ _("Wiki Appearance Settings") }}</a></li>
+    <li><a href="#navigation" data-toggle="tab">{{ _("Navigation Settings") }}</a></li>
+    <li><a href="#options" data-toggle="tab">{{ _("Options") }}</a></li>
+</ul>
+{{ user_forms.all_usersettings_forms(form_objs) }}
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/themes/basic/templates/usersettings_forms.html	Tue Aug 27 22:16:59 2013 +0530
@@ -0,0 +1,176 @@
+{% import "forms.html" as forms %}
+
+{% macro personal(form) %}
+{{ gen.form.open(form, method="post", action=url_for('frontend.usersettings'), role="form") }}
+{{ forms.render_errors(form) }}
+    {% for e in [
+        'name',
+        'display_name',
+        'openid',
+        ] %}
+        <div class="form-group">
+            {{ gen.label(form[e]) }}
+            {{ gen.input(form[e], type="text", class="form-control") }}
+        </div>
+    {% endfor %}
+
+    {% for e in [
+        'timezone',
+        'locale',
+        ] %}
+        <div class="form-group">
+            <dt>
+            {{ gen.label(form[e]) }}
+            </dt>
+            {{ gen.select.open(form[e], class="btn") }}
+            {% for value, label in form[e].properties['choice_specs'] %}
+              {{ gen.option(form[e], value=value, contents=label or value) }}
+            {% endfor %}
+            {{ gen.select.close() }}
+        </div>
+    {% endfor %}
+{{ forms.render_hidden('part', 'personal') }}
+<div class="form-group">
+    {{ forms.render_submit(form, class='btn btn-primary') }}
+</div>
+{{ gen.form.close() }}
+{% endmacro %}
+
+
+{% macro password(form) %}
+{{ gen.form.open(form, method="post", action=url_for('frontend.usersettings')) }}
+{{ forms.render_errors(form) }}
+    {% for e in [
+        'password_current',
+        'password1',
+        'password2',
+        ] %}
+        <div class="form-group">
+            <dt>
+                {{ gen.label(form[e]) }}
+            </dt>
+            {{ gen.input(form[e], type="password") }}
+        </div>
+    {% endfor %}
+{{ forms.render_hidden('part', 'password') }}
+<div class="form-group">
+    {{ forms.render_submit(form, class='btn btn-primary') }}
+</div>
+{{ gen.form.close() }}
+{% endmacro %}
+
+{% macro notification(form) %}
+{{ gen.form.open(form, method="post", action=url_for('frontend.usersettings')) }}
+{% if cfg.user_email_verification %}
+<p>{{ _("Changing your email address requires you to verify it. A link will be sent to you.") }}</p>
+{% endif %}
+{{ forms.render_errors(form) }}
+<div class="form-group">
+    <dt>
+        {{ gen.label(form['email']) }}
+    </dt>
+    {{ gen.input(form['email'], type="email") }}
+</div>
+{{ forms.render_hidden('part', 'notification') }}
+<div class="form-group">
+    {{ forms.render_submit(form, class='btn btn-primary') }}
+</div>
+{{ gen.form.close() }}
+{% endmacro %}
+
+{% macro ui(form) %}
+{{ gen.form.open(form, method="post", action=url_for('frontend.usersettings')) }}
+{{ forms.render_errors(form) }}
+    <div class="form-group">
+        <dt>
+        {{ gen.label(form['theme_name']) }}
+        </dt>
+        {{ gen.select.open(form['theme_name'], class="btn") }}
+        {% for value, label in form['theme_name'].properties['choice_specs'] %}
+          {{ gen.option(form['theme_name'], value=value, contents=label or value) }}
+        {% endfor %}
+        {{ gen.select.close() }}
+    </div>
+    {% for e in [
+        'css_url',
+        'edit_rows',
+        'results_per_page'
+        ] %}
+        <div class="form-group">
+            {{ gen.label(form[e]) }}
+            {{ gen.input(form[e], type="text", class="form-control") }}
+        </div>
+    {% endfor %}
+{{ forms.render_hidden('part', 'ui') }}
+<div class="form-group">
+    {{ forms.render_submit(form, class='btn btn-primary') }}
+</div>
+{{ gen.form.close() }}
+{% endmacro %}
+
+{% macro navigation(form) %}
+{{ gen.form.open(form, method="post", action=url_for('frontend.usersettings')) }}
+{{ forms.render_errors(form) }}
+<dl>
+    {# TODO: find a good way to handle quicklinks #}
+</dl>
+{{ forms.render_hidden('part', 'navigation') }}
+<div class="form-group">
+    {{ forms.render_submit(form, class='btn btn-primary') }}
+</div>
+{{ gen.form.close() }}
+{% endmacro %}
+
+{% macro options(form) %}
+{{ gen.form.open(form, method="post", action=url_for('frontend.usersettings')) }}
+{{ forms.render_errors(form) }}
+    {% for e in [
+        'mailto_author',
+        'edit_on_doubleclick',
+        'scroll_page_after_edit',
+        'show_comments',
+        'disabled'
+        ] %}
+        <div class="form-group">
+            <label>
+                {{ gen.input(form[e], type="checkbox") }}
+                {{ form[e].label }}
+            </label>
+        </div>
+    {% endfor %}
+{{ forms.render_hidden('part', 'options') }}
+<div class="form-group">
+    {{ forms.render_submit(form, class='btn btn-primary') }}
+</div>
+{{ gen.form.close() }}
+{% endmacro %}
+
+{# javascript functions within basic.js are dependent upon the structure, classes and ids defined here #}
+{% macro all_usersettings_forms(form_objs) %}
+<div id="moin-usersettings">
+    <div class="row">
+        <div class="col-lg-6">
+            <div class="tab-content">
+                <div id="personal" class="tab-pane active">
+                    {{ personal(form_objs.personal) }}
+                </div>
+                <div id="password" class="tab-pane active">
+                    {{ password(form_objs.password) }}
+                </div>
+                <div id="notification" class="tab-pane active">
+                    {{ notification(form_objs.notification) }}
+                </div>
+                <div id="ui" class="tab-pane active">
+                    {{ ui(form_objs.ui) }}
+                </div>
+                <div id="navigation" class="tab-pane active">
+                    {{ navigation(form_objs.navigation) }}
+                </div>
+                <div id="options" class="tab-pane active">
+                    {{ options(form_objs.options) }}
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+{% endmacro %}