incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [3/5] git commit: [#5716] show URL validation errors on project metadata page
Date Wed, 29 May 2013 20:39:51 GMT
[#5716] show URL validation errors on project metadata page


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

Branch: refs/heads/master
Commit: 4c8116d2022ee6579f07935ff78e7de66a98b63a
Parents: 8fc7179
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Wed May 29 01:05:52 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed May 29 19:01:56 2013 +0000

----------------------------------------------------------------------
 .../templates/admin_widgets/metadata_admin.html    |   23 +++++++++------
 Allura/allura/ext/admin/widgets.py                 |   12 +++++--
 2 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4c8116d2/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index c21bce8..b37d638 100644
--- a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++ b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -21,11 +21,11 @@
     {{ widget.display_label(widget.fields.name) }}
     <br>
     {{widget.display_field(widget.fields.name) }}
-    {%if value.neighborhood.name != 'Users'%}
+    {%if c.project.neighborhood.name != 'Users'%}
     <label for="shortname">Unixname</label>
     <br>
     <input id="shortname" type="text" disabled="disabled"
-           value="{{value.shortname}}">
+           value="{{c.project.shortname}}">
 
     {{ widget.display_label(widget.fields.external_homepage) }}
     <br>
@@ -41,11 +41,13 @@
     {{widget.display_field(widget.fields.short_description) }}
 
     <div style="clear:both">&nbsp;</div>
-    Preferred Support Page (for users of your project):
-    <br>
+    Preferred Support Page (for users of your project):<br>
+    {% if c.form_errors.get('support_page_url') %}
+        <div class="error">{{c.form_errors.get('support_page_url')}}</div>
+    {% endif %}
     <input name="support_page" type="radio" value=""{% if value.support_page == '' %}
checked{% endif %} id="support_page_none">
     <label for="support_page_none">None</label><br>
-    {% for ac in value.app_configs %}
+    {% for ac in c.project.app_configs %}
       {% if ac.tool_name.lower() in ['wiki', 'tickets', 'discussion'] %}
         <input name="support_page" type="radio" value="{{ac.options.mount_point}}" id="support_page_{{ac.options.mount_point}}"
                {% if value.support_page == ac.options.mount_point %} checked{% endif %}>
@@ -57,14 +59,14 @@
     <input name="support_page" type="radio" value="_url" id="support_page_url_cb"
            {% if value.support_page == '_url' %} checked{% endif %}>
     <label for="support_page_url_cb">URL: </label>
-    <input type="text" name="support_page_url" value="{{value.support_page_url}}" style="width:
70%">
+    <input type="text" name="support_page_url" value="{{value.support_page_url}}" style="width:
70%"><br>
     {{ widget.display_label(widget.fields.twitter_handle) }}
     <br>
     {{widget.display_field(widget.fields.twitter_handle) }}
     {{ widget.display_label(widget.fields.facebook_page) }}
     <br>
     {{widget.display_field(widget.fields.facebook_page) }}
-    {% if value.neighborhood.features['google_analytics'] %}
+    {% if c.project.neighborhood.features['google_analytics'] %}
     {{ widget.display_label(widget.fields.tracking_id) }}
     <br>
     {{widget.display_field(widget.fields.tracking_id) }}
@@ -94,7 +96,7 @@
           <input type="submit" value="Save" name="save" style="float: none" />
       </div>
     </div>
-    {%if value.neighborhood.name != 'Users'%}
+    {%if c.project.neighborhood.name != 'Users'%}
     <div style="clear:both">&nbsp;</div>
 
     <div id="project-status">
@@ -109,8 +111,11 @@
             Deleted
         {% endif %}
         <a href="#" title="Edit"><b data-icon="p" class="ico ico-pencil"></b></a>
-        <div id="project-status-edit" class="hidden">
+        <div id="project-status-edit" class="{% if not c.form_errors %}hidden{% endif
%}">
             <br>
+            {% if c.form_errors.get('moved_to_url') %}
+                <div class="error">{{c.form_errors.get('moved_to_url')}}</div>
+            {% endif %}
             <input name="removal" type="radio" value="" id="removal_active_cb"
                    {% if value.removal == '' %} checked{% endif %}>
             <label for="removal_active_cb">Active Project</label>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4c8116d2/Allura/allura/ext/admin/widgets.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/widgets.py b/Allura/allura/ext/admin/widgets.py
index 8719c65..e663687 100644
--- a/Allura/allura/ext/admin/widgets.py
+++ b/Allura/allura/ext/admin/widgets.py
@@ -168,11 +168,14 @@ class MetadataAdmin(ff.AdminForm):
                                             V.MaxBytesValidator(max=1000)),
                                         attrs=dict(title="Add a few paragraphs describing
your project to new users."))
         icon = ew.FileField(label='Icon')
-        external_homepage = ew.InputField(field_type="text", label='Homepage')
+        external_homepage = ew.InputField(field_type="text", label='Homepage',
+                                          validator=fev.URL(add_http=True))
         support_page = ew.InputField(field_type="text", label='Support Page')
-        support_page_url = ew.InputField(field_type="text", label='Support Page URL')
+        support_page_url = ew.InputField(field_type="text", label='Support Page URL',
+                                         validator=fev.URL(add_http=True, if_empty=''))
         removal = ew.InputField(field_type="text", label='Removal')
-        moved_to_url = ew.InputField(field_type="text", label='Moved Project to URL')
+        moved_to_url = ew.InputField(field_type="text", label='Moved Project to URL',
+                                     validator=fev.URL(add_http=True, if_empty=''))
         export_controlled = ew.InputField(field_type="text", label='Export Control')
         export_control_type = ew.InputField(field_type="text", label='Export Control Type')
         delete = ew.InputField(field_type="hidden", label='Delete')
@@ -180,7 +183,8 @@ class MetadataAdmin(ff.AdminForm):
         undelete = ew.InputField(field_type="hidden", label='Undelete')
         tracking_id = ew.InputField(field_type="text", label="Analytics Tracking ID")
         twitter_handle = ew.InputField(field_type="text", label='Twitter Handle')
-        facebook_page = ew.InputField(field_type="text", label='Facebook page')
+        facebook_page = ew.InputField(field_type="text", label='Facebook page',
+                                      validator=fev.URL(add_http=True))
 
 class AuditLog(ew_core.Widget):
     template='jinja:allura.ext.admin:templates/widgets/audit.html'


Mime
View raw message