allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: [#8256] Responsive screenshots admin page
Date Thu, 01 Nov 2018 17:34:16 GMT
Repository: allura
Updated Branches:
  refs/heads/kt/8256c [created] d26f63f64


[#8256] Responsive screenshots admin page


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

Branch: refs/heads/kt/8256c
Commit: d26f63f64080018dd761c38ea7c3aab8949dfb90
Parents: 01c5c4a
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Thu Nov 1 17:33:49 2018 +0000
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Thu Nov 1 17:33:49 2018 +0000

----------------------------------------------------------------------
 .../ext/admin/templates/project_groups.html     |  2 +-
 Allura/allura/ext/admin/widgets.py              |  2 +-
 Allura/allura/lib/widgets/forms.py              | 11 +++++
 .../widgets/admin_form.html                     | 45 ++++++++++++++++++++
 4 files changed, 58 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/d26f63f6/Allura/allura/ext/admin/templates/project_groups.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_groups.html b/Allura/allura/ext/admin/templates/project_groups.html
index 293e3f5..c203ea7 100644
--- a/Allura/allura/ext/admin/templates/project_groups.html
+++ b/Allura/allura/ext/admin/templates/project_groups.html
@@ -72,7 +72,7 @@
           {% for r in role.users_with_role() %}
           <li class="deleter" data-user="{{r.user.username}}">
             {{ g.icons['perm_delete'].render(
-                title='%s (%s)' % (r.user.display_name, r.user.username),
+                title=('<span>%s</span> (%s)' % (r.user.display_name | escape,
r.user.username | escape)) | safe,
                 show_title=True,
                 extra_css='deleter',
                 **{'data-user': r.user.username}) }}

http://git-wip-us.apache.org/repos/asf/allura/blob/d26f63f6/Allura/allura/ext/admin/widgets.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/widgets.py b/Allura/allura/ext/admin/widgets.py
index f9d4114..547092e 100644
--- a/Allura/allura/ext/admin/widgets.py
+++ b/Allura/allura/ext/admin/widgets.py
@@ -131,7 +131,7 @@ class GroupSettings(ff.CsrfForm):
         delete = ew.SubmitButton(label='Delete Group')
 
 
-class NewGroupSettings(ff.AdminForm):
+class NewGroupSettings(ff.AdminFormResponsive):
     submit_text = 'Save'
 
     class fields(ew_core.NameList):

http://git-wip-us.apache.org/repos/asf/allura/blob/d26f63f6/Allura/allura/lib/widgets/forms.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 96d6886..e3f8232 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -818,6 +818,17 @@ class AdminForm(ForgeForm):
     template = 'jinja:allura:templates/widgets/admin_form.html'
 
 
+class AdminFormResponsive(ForgeForm):
+    def __init__(self):
+        super(AdminFormResponsive, self).__init__()
+        # use alternate template if responsive overrides are on, but not actually using template
override for this
+        # since that would change all forms, and we want to just do individual ones right
now
+        for tmpl_override_ep in h.iter_entry_points('allura.theme.override'):
+            if tmpl_override_ep.name == 'responsive':
+                self.template = 'jinja:allura:templates_responsive/widgets/admin_form.html'
+                break
+
+
 class NeighborhoodOverviewForm(ForgeForm):
     template = 'jinja:allura:templates/widgets/neighborhood_overview_form.html'
 

http://git-wip-us.apache.org/repos/asf/allura/blob/d26f63f6/Allura/allura/templates_responsive/widgets/admin_form.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates_responsive/widgets/admin_form.html b/Allura/allura/templates_responsive/widgets/admin_form.html
new file mode 100644
index 0000000..edd24f0
--- /dev/null
+++ b/Allura/allura/templates_responsive/widgets/admin_form.html
@@ -0,0 +1,45 @@
+{#-
+       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.
+-#}
+{% import 'allura:templates/jinja_master/lib.html' as lib with context %}
+<form method="{{method}}"
+       {% if enctype %}enctype="{{enctype}}"{% endif %}
+      action="{{action}}" class="row">
+  {% for field in widget.fields %}
+    {% set ctx=widget.context_for(field) %}
+    {% if field.field_type != 'hidden' %}
+      {% if ctx.errors and field.show_errors -%}
+      <span {{widget.j2_attrs({'class':error_class})}}>{{ctx.errors}}<br>
+      {%- endif %}
+      {% if field.show_label and field.label %}
+      <label for="{{ctx.id}}" class="column small-12 large-3">{{field.label}}:</label>
+      {% endif %}
+      <div class="column small-12 large-8">{{field.display(**ctx)}}</div>
+    {% else %}
+      {{field.display(**ctx)}}
+    {% endif %}
+  {% endfor %}
+  <div class="hr-top column small-12">&nbsp;</div>
+  <div class="column">
+    {% for b in buttons %}
+      {{b.display()}}
+    {% endfor %}
+    <a href="#" class="close">Cancel</a>
+  </div>
+  {% if method.upper() == 'POST' %}{{lib.csrf_token()}}{% endif %}
+</form>


Mime
View raw message