You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/10/19 13:37:59 UTC

[34/50] [abbrv] allura git commit: [#7984] force location of user subscriptions form elements

[#7984] force location of user subscriptions form elements


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/151c63b6
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/151c63b6
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/151c63b6

Branch: refs/heads/ib/7924
Commit: 151c63b630a7373669cbd20ea8f8b37d7fed0439
Parents: 00110b1
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Oct 12 10:27:55 2015 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Tue Oct 13 16:19:05 2015 -0400

----------------------------------------------------------------------
 Allura/allura/lib/widgets/subscriptions.py      | 24 +++++---
 .../templates/widgets/user_subs_form.html       | 61 ++++++++++++++++++++
 2 files changed, 76 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/151c63b6/Allura/allura/lib/widgets/subscriptions.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/subscriptions.py b/Allura/allura/lib/widgets/subscriptions.py
index 4e3324a..5d1ebea 100644
--- a/Allura/allura/lib/widgets/subscriptions.py
+++ b/Allura/allura/lib/widgets/subscriptions.py
@@ -58,17 +58,23 @@ class _SubscriptionTable(ew.TableField):
 class SubscriptionForm(CsrfForm):
     defaults = dict(
         ew.SimpleForm.defaults,
+        id='user-subs-form',
         submit_text='Save')
 
-    class fields(ew_core.NameList):
-        subscriptions = _SubscriptionTable()
-        email_format = ew.SingleSelectField(
-            name='email_format',
-            label='Email Format',
-            options=[
-                ew.Option(py_value='plain', label='Plain Text'),
-                ew.Option(py_value='html', label='HTML'),
-                ew.Option(py_value='both', label='Combined')])
+    template = 'jinja:allura:templates/widgets/user_subs_form.html'
+
+    @property
+    def fields(self):
+        return [
+            _SubscriptionTable(name='subscriptions'),
+            ew.SingleSelectField(
+                name='email_format',
+                show_label=False,
+                options=[
+                    ew.Option(py_value='plain', label='Plain Text'),
+                    ew.Option(py_value='html', label='HTML'),
+                    ew.Option(py_value='both', label='Combined')]),
+        ]
 
 
 class SubscribeForm(ew.SimpleForm):

http://git-wip-us.apache.org/repos/asf/allura/blob/151c63b6/Allura/allura/templates/widgets/user_subs_form.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/user_subs_form.html b/Allura/allura/templates/widgets/user_subs_form.html
new file mode 100644
index 0000000..39aecbc
--- /dev/null
+++ b/Allura/allura/templates/widgets/user_subs_form.html
@@ -0,0 +1,61 @@
+{#-
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-#}
+
+<form {{widget.j2_attrs(dict(
+      name=rendered_name,
+      id=id,
+      method=method,
+      action=action,
+      enctype=enctype), attrs)}}>
+
+    {% set subs_table = widget.fields[0] %}
+    {{ subs_table.display(**widget.context_for(subs_table)) }}
+
+    {# use a table so it matches width and placement of big table above #}
+    <table class="user_subs_opts">
+    <tr><td>
+        <div class="user_sub_email_format">
+        Email Format:
+        {% set email_format = widget.fields[1] %}
+        {{ email_format.display(**widget.context_for(email_format)) }}
+        </div>
+        {% for hf in widget.hidden_fields %}
+            {{ hf.display(**widget.context_for(hf)) }}
+        {% endfor %}
+        {% for b in buttons %}
+            {{ b.display() }}
+        {% endfor %}
+    </td></tr>
+    </table>
+</form>
+
+<style type="text/css">
+    #user-subs-form table:first-child {
+        margin-bottom: 10px;
+    }
+    #user-subs-form table.user_subs_opts td {
+        border-bottom: none;
+    }
+    .user_sub_email_format {
+        float: left;
+    }
+    .user_subs_opts input[type=submit] {
+        float: right;
+    }
+</style>
\ No newline at end of file