incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#5596] use ew.LinkField instead of our own
Date Thu, 17 Jan 2013 16:23:32 GMT
Updated Branches:
  refs/heads/master e5ec62b3e -> dda5bc63a


[#5596] use ew.LinkField instead of our own


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

Branch: refs/heads/master
Commit: dda5bc63a88a9d2921cc7bef7d5c7c7a28db6493
Parents: e5ec62b
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Wed Jan 16 20:33:56 2013 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Thu Jan 17 16:21:42 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/widgets/form_fields.py   |   51 -----------------------
 Allura/allura/lib/widgets/forms.py         |    2 +-
 Allura/allura/lib/widgets/subscriptions.py |    2 +-
 requirements-common.txt                    |    2 +-
 4 files changed, 3 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dda5bc63/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index f536896..144c0ea 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -455,54 +455,3 @@ class DisplayOnlyField(ew.HiddenField):
         value=None,
         with_hidden_input=None)
 
-class LinkField(ew.LinkField):
-    '''
-    A safer jinja2 implementation of LinkField which allows a mapping value which
-    contains the href and text values separately, as well as a flag to render
-    the field as plaintext if no href value is specified.  Both the href and
-    text values will be escaped properly.
-
-    The HREF of the link will be first one of value['href'], attrs['href'],
-    href, or value (if value is not a mapping) that is set.
-
-    The text of the link will be first one of value['text'], text, label, or
-    value (if value is not a mapping) that is set.
-
-    If plaintext_if_no_href is True and none of value['href'], attrs['href'],
-    nor href are set, then the field will be rendered as plaintext using the
-    text of the link, above.
-
-    Examples:
-
-        This renders as: <a href="http://example.com/">http://example.com/</a>
-
-            LinkField().display(value="http://example.com/")
-
-        The following all render as: <a href="/foo">bar</a>
-
-            LinkField(href='/foo').display(value='bar')
-            LinkField(text='bar').display(value='/foo')
-            LinkField().display(value=dict(href='/foo', text='bar'))
-            LinkField(label='bar').display(value=dict(href='/foo'))
-            LinkField(href='/foo').display(value=dict(text='bar'))
-            LinkField(attrs={'href':'/foo'}).display(value='bar')
-            LinkField(plaintext_if_no_href=True).display(value=dict(href='/foo', text='bar'))
-            LinkField(plaintext_if_no_href=True).display(href='/foo', value='bar')
-
-        These render as the plaintext: bar
-
-            LinkField(plaintext_if_no_href=True).display(value=dict(text='bar'))
-            LinkField(plaintext_if_no_href=True, label='bar').display(value=dict())
-            LinkField(plaintext_if_no_href=True, label='foo').display(value='bar')
-    '''
-    template=ew.Snippet('''{% if plaintext_if_no_href and not (value['href'] or attrs['href']
or href) -%}
-            {{ (value['text'] or (value is not mapping and value or None) or text or label)|e
}}
-        {%- elif value is mapping -%}
-            <a {{ widget.j2_attrs({'href':value['href'] or href}, attrs) }}>{{ (value['text']
or text or label)|e }}</a>
-        {%- else -%}
-            <a {{ widget.j2_attrs({'href':href or value}, attrs) }}>{{ (text or label
or value)|e }}</a>
-        {%- endif %}''', 'jinja2')
-    defaults=dict(
-        ew.LinkField.defaults,
-        value=None,
-        plaintext_if_no_href=False)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dda5bc63/Allura/allura/lib/widgets/forms.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 0eeeeef..ee4311c 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -462,7 +462,7 @@ class RemoveTroveCategoryForm(ForgeForm):
                 show_errors=False,
                 show_label=False,
                 fields=[
-                    ffw.LinkField(
+                    ew.LinkField(
                         text=cat.fullname,
                         href="/categories/%s" % cat.shortname),
                     ew.SubmitButton(

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dda5bc63/Allura/allura/lib/widgets/subscriptions.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/subscriptions.py b/Allura/allura/lib/widgets/subscriptions.py
index 07352ba..0ab44b2 100644
--- a/Allura/allura/lib/widgets/subscriptions.py
+++ b/Allura/allura/lib/widgets/subscriptions.py
@@ -23,7 +23,7 @@ class _SubscriptionTable(ew.TableField):
         topic = ffw.DisplayOnlyField(label='Topic', show_label=True, with_hidden_input=False)
         type = ffw.DisplayOnlyField(label='Type', show_label=True, with_hidden_input=False)
         frequency = ffw.DisplayOnlyField(label='Frequency', show_label=True, with_hidden_input=False)
-        artifact_title = ffw.LinkField(label='Artifact', show_label=True, plaintext_if_no_href=True)
+        artifact_title = ew.LinkField(label='Artifact', show_label=True, plaintext_if_no_href=True)
         # unsubscribe = SubmitButton()
         subscribed = ew.Checkbox(suppress_label=True)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/dda5bc63/requirements-common.txt
----------------------------------------------------------------------
diff --git a/requirements-common.txt b/requirements-common.txt
index bd05a0b..2750ec0 100644
--- a/requirements-common.txt
+++ b/requirements-common.txt
@@ -10,7 +10,7 @@ Creoleparser==0.7.3
 decorator==3.3.2
 # dep of pypeline
 docutils==0.8.1
-EasyWidgets==0.2dev-20121022
+EasyWidgets==0.2dev-20130116
 faulthandler==2.1
 feedparser==5.0.1
 FormEncode==1.2.4


Mime
View raw message