[ckan-changes] commit/ckan: zephod: [ux][l]: Reworked groups section.

Bitbucket commits-noreply at bitbucket.org
Sat Oct 15 00:13:41 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/95376906bdeb/
changeset:   95376906bdeb
branch:      feature-1368-ux-fixes
user:        zephod
date:        2011-10-15 02:13:30
summary:     [ux][l]: Reworked groups section.
affected #:  22 files (-1 bytes)

--- a/ckan/config/routing.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/config/routing.py	Sat Oct 15 01:13:30 2011 +0100
@@ -155,7 +155,7 @@
 
     map.connect('/api/2/util/user/autocomplete', controller='api',
         action='user_autocomplete')
-    map.connect('/api/2/util/dataset/is_slug_valid', controller='api', action='is_slug_valid',
+    map.connect('/api/2/util/is_slug_valid', controller='api', action='is_slug_valid',
                 conditions=dict(method=['GET']))
     map.connect('/api/2/util/tag/autocomplete', controller='api', action='tag_autocomplete',
                 conditions=dict(method=['GET']))


--- a/ckan/controllers/api.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/controllers/api.py	Sat Oct 15 01:13:30 2011 +0100
@@ -13,7 +13,7 @@
 from ckan.logic import get_action, check_access
 from ckan.logic import NotFound, NotAuthorized, ValidationError
 from ckan.lib.jsonp import jsonpify
-from ckan.forms.common import package_exists
+from ckan.forms.common import package_exists, group_exists
 
 
 log = logging.getLogger(__name__)
@@ -563,9 +563,15 @@
 
     def is_slug_valid(self):
         slug = request.params.get('slug') or ''
-
-        response_data = dict(valid=not bool(package_exists(slug)))
-        return self._finish_ok(response_data)
+        slugtype = request.params.get('type') or ''
+        if slugtype==u'package':
+            response_data = dict(valid=not bool(package_exists(slug)))
+            return self._finish_ok(response_data)
+        if slugtype==u'group':
+            response_data = dict(valid=not bool(group_exists(slug)))
+            return self._finish_ok(response_data)
+        return self._finish_bad_request(gettext('Bad slug type: %s') % slugtype)
+            
 
     def tag_autocomplete(self):
         q = request.params.get('incomplete', '')


--- a/ckan/controllers/group.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/controllers/group.py	Sat Oct 15 01:13:30 2011 +0100
@@ -79,6 +79,12 @@
             abort(404, _('Group not found'))
         except NotAuthorized:
             abort(401, _('Unauthorized to read group %s') % id)
+        try:
+            description_formatted = ckan.misc.MarkdownFormat().to_html(group.get('description',''))
+            c.description_formatted = genshi.HTML(description_formatted)
+        except Exception, e:
+            error_msg = "<span class='inline-warning'>%s</span>" % _("Cannot render description")
+            c.description_formatted = genshi.HTML(error_msg)
         
         try:
  
@@ -140,13 +146,14 @@
                 old_data, errors = validate(old_data, schema, context=context)
 
             data = data or old_data
-
         except NotFound:
             abort(404, _('Group not found'))
         except NotAuthorized:
             abort(401, _('Unauthorized to read group %s') % '')
 
         group = context.get("group")
+        c.group = group
+
 
         try:
             check_access('group_update',context)
@@ -208,6 +215,7 @@
             context = {'model':model,'user':c.user or c.author, 'group':group}
             check_access('group_edit_permissions',context)
             c.authz_editable = True
+            c.group = context['group']
         except NotAuthorized:
             c.authz_editable = False
         if not c.authz_editable:


--- a/ckan/forms/common.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/forms/common.py	Sat Oct 15 01:13:30 2011 +0100
@@ -39,6 +39,11 @@
         if pkg != field.parent.model:
             raise formalchemy.ValidationError(_('Dataset name already exists in database'))
 
+def group_exists(val):
+    if model.Session.query(model.Group).autoflush(False).filter_by(name=val).count():
+        return True
+    return False
+
 def group_name_validator(val, field=None):
     name_validator(val, field)
     # we disable autoflush here since may get used in dataset preview


--- a/ckan/logic/validators.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/logic/validators.py	Sat Oct 15 01:13:30 2011 +0100
@@ -93,7 +93,7 @@
     if len(val) < 2:
         raise Invalid(_('Name must be at least %s characters long') % 2)
     if not name_match.match(val):
-        raise Invalid(_('Name must be purely lowercase alphanumeric '
+        raise Invalid(_('Url must be purely lowercase alphanumeric '
                         '(ascii) characters and these symbols: -_'))
     return val
 


--- a/ckan/public/css/style.css	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/public/css/style.css	Sat Oct 15 01:13:30 2011 +0100
@@ -183,10 +183,13 @@
 #minornavigation li.current-tab {
   background: #000;
   background-color: #fff;
-  border: 1px solid #aaa;
+  border: 1px solid #777;
+  border-bottom: 1px solid #ccc;
+  border-right: 1px solid #ccc;
      -moz-border-radius: 5px; 
   -webkit-border-radius: 5px; 
           border-radius: 5px; 
+          
 }
 #minornavigation li.current-tab a,
 #minornavigation li.current-tab a:hover,
@@ -889,19 +892,15 @@
   font-size: 10px;
 }
 
-body.package.new .url-suffix {
-  font-weight: bold;
-}
-
-body.package.new a.url-edit {
+a.url-edit {
   font-weight: normal;
   margin-left: 10px;
 }
-body.package.new .url-input {
-  width: 250px;
+dd.name-field {
+  padding-top: 0.2em;
 }
-body.package.new dd.name-field {
-  padding-top: 0.2em;
+dd.name-field p {
+  margin-bottom: 4px;
 }
 
 body.package.read #sidebar ul.tags, 
@@ -909,6 +908,10 @@
   margin-bottom: 10px;
 }
 
+input.url-input {
+  width: 250px;
+}
+
 
 .success .new-dataset {
   font-size: 150%;
@@ -917,6 +920,23 @@
   font-weight: bold;
 }
 
+
+/* ================== */
+/* = Add Group Page = */
+/* ================== */
+
+body.group.new fieldset#extras,
+body.group.new fieldset#datasets {
+  display: none;
+}
+body.group.new .description-label,
+body.group.new .description-field,
+body.group.new .state-label,
+body.group.new .state-field {
+  display: none;
+}
+
+
 /* ============= */
 /* = Mini-Tabs = */
 /* ============= */
@@ -1067,10 +1087,10 @@
 body.admin .actions input {
   margin: 0;
 }
-body.admin.authz form {
+body.authz form {
   margin-bottom: 30px;
 }
-body.admin.authz form button {
+body.authz form button {
   width: 120px;
   float: right;
 }


--- a/ckan/public/scripts/application.js	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/public/scripts/application.js	Sat Oct 15 01:13:30 2011 +0100
@@ -27,10 +27,17 @@
     var isDatasetNew = $('body.package.new').length > 0;
     if (isDatasetNew) {
       // Set up magic URL slug editor
-      CKAN.Utils.setupUrlEditor();
+      CKAN.Utils.setupUrlEditor('package');
       $('#save').val(CKAN.Strings.addDataset);
       $("#title").focus();
     }
+    var isGroupNew = $('body.group.new').length > 0;
+    if (isGroupNew) {
+      // Set up magic URL slug editor
+      CKAN.Utils.setupUrlEditor('group');
+      $('#save').val(CKAN.Strings.addGroup);
+      $("#title").focus();
+    }
 
     // Buttons with href-action should navigate when clicked
     $('input.href-action').click(function(e) {
@@ -40,6 +47,7 @@
     
     var isDatasetEdit = $('body.package.edit').length > 0;
     if (isDatasetEdit) {
+      CKAN.Utils.setupUrlEditor('package',readOnly=true);
       // Selectively enable the upload button
       var storageEnabled = $.inArray('storage',CKAN.plugins)>=0;
       if (storageEnabled) {
@@ -57,6 +65,10 @@
       });
       view.render();
     }
+    var isGroupEdit = $('body.group.edit').length > 0;
+    if (isGroupEdit) {
+      CKAN.Utils.setupUrlEditor('group',readOnly=true);
+    }
   });
 }(jQuery));
 
@@ -81,7 +93,7 @@
     input.change(callback);
   };
 
-  my.setupUrlEditor = function() {
+  my.setupUrlEditor = function(slugType,readOnly) {
     // Page elements to hook onto
     var titleInput = $('.js-title');
     var urlText = $('.js-url-text');
@@ -89,8 +101,7 @@
     var urlInput = $('.js-url-input');
     var validMsg = $('.js-url-is-valid');
 
-    // Title api verifies package name availability
-    var api_url = '/api/2/util/dataset/is_slug_valid';
+    var api_url = '/api/2/util/is_slug_valid';
     // (make length less than max, in case we need a few for '_' chars to de-clash slugs.)
     var MAX_SLUG_LENGTH = 90;
 
@@ -132,15 +143,15 @@
       var checkSlugValid = function(slug) {
         $.ajax({
           url: api_url,
-          data: 'slug=' + slug,
+          data: 'type='+slugType+'&slug=' + slug,
           dataType: 'jsonp',
           type: 'get',
           jsonpCallback: 'callback',
           success: function (data) {
             if (data.valid) {
-              validMsg.html('<span style="font-weight: bold; color: #0c0">'+CKAN.Strings.datasetNameAvailable+'</span>');
+              validMsg.html('<span style="font-weight: bold; color: #0c0">'+CKAN.Strings.urlIsAvailable+'</span>');
             } else {
-              validMsg.html('<span style="font-weight: bold; color: #c00">'+CKAN.Strings.datasetNameNotAvailable+'</span>');
+              validMsg.html('<span style="font-weight: bold; color: #c00">'+CKAN.Strings.urlIsNotAvailable+'</span>');
             }
           }
         });
@@ -157,19 +168,27 @@
       };
     }();
 
-    // Hook title changes to the input box
-    my.bindInputChanges(titleInput, titleChanged);
-    my.bindInputChanges(urlInput, urlChanged);
-    // Set up the form
-    urlChanged();
+    if (readOnly) {
+      slug = urlInput.val();
+      urlSuffix.html('<span>'+slug+'</span>');
+    }
+    else {
+      var editLink = $('.js-url-editlink');
+      editLink.show();
+      // Hook title changes to the input box
+      my.bindInputChanges(titleInput, titleChanged);
+      my.bindInputChanges(urlInput, urlChanged);
+      // Set up the form
+      urlChanged();
 
-    $('.js-url-editlink').live('click',function(e) {
-      e.preventDefault();
-      $('.js-url-viewmode').hide();
-      $('.js-url-editmode').show();
-      urlInput.select();
-      urlInput.focus();
-    });
+      editLink.live('click',function(e) {
+        e.preventDefault();
+        $('.js-url-viewmode').hide();
+        $('.js-url-editmode').show();
+        urlInput.select();
+        urlInput.focus();
+      });
+    }
   }
 
   // Attach dataset autocompletion to provided elements
@@ -332,7 +351,6 @@
     markdownEditor.find('button, div.markdown-preview').live('click', function(e) {
       e.preventDefault();
       var $target = $(e.target);
-      console.log('clicked');
       // Extract neighbouring elements
       var markdownEditor=$target.closest('.markdown-editor')
       markdownEditor.find('button').removeClass('depressed');


--- a/ckan/templates/group/authz.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/group/authz.html	Sat Oct 15 01:13:30 2011 +0100
@@ -2,24 +2,25 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip="">
   
-  <py:def function="page_title">${c.grouptitle or c.groupname} - Authorization - Groups</py:def>
-  <py:def function="page_heading">Authorization: ${c.grouptitle or c.groupname}</py:def>
-
+  <py:def function="page_title">Authorization: ${c.group.display_name}</py:def>
+  <py:def function="page_heading">Authorization: ${c.group.display_name}</py:def>
+  
   <div py:match="content"><h3>Update Existing Roles</h3><form id="theform" method="POST">
       ${authz_form_table('theform', c.roles, c.users, c.user_role_dict)}
-      <button type="submit" name="save">
-        Save
+      <button type="submit" name="save" class="pretty-button primary">
+        Save Changes
       </button>
+      <div class="clear"></div></form><h3>Add Roles for Any User</h3>
-
     <form id="addform" method="POST">
       ${authz_add_table(c.roles)}
-      <button type="submit" name="add"> Add </button>
+      <button type="submit" name="add" class="pretty-button primary">Add Role</button>
+      <div class="clear"></div></form><hr/>
@@ -28,16 +29,16 @@
 
     <form id="authzgroup_form" method="POST">
       ${authz_form_group_table('authzgroup_form', c.roles, c.authz_groups, c.authz_groups_role_dict)}
-      <button type="submit" name="authz_save">
-        Save
-      </button>
+      <button type="submit" name="authz_save" class="pretty-button primary">Save Changes</button>
+      <div class="clear"></div></form><h3>Add Roles for Any Authorization Group</h3><form id="authzgroup_addform" method="POST">
       ${authz_add_group_table(c.roles)}
-      <button type="submit" name="authz_add"> Add </button>
+      <button type="submit" name="authz_add" class="pretty-button primary">Add Role</button>
+      <div class="clear"></div></form></div>


--- a/ckan/templates/group/edit.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/group/edit.html	Sat Oct 15 01:13:30 2011 +0100
@@ -2,8 +2,8 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip="">
   
-  <py:def function="page_title">${c.grouptitle or c.groupname} - Edit - Groups</py:def>
-  <py:def function="page_heading">Edit: ${c.grouptitle or c.groupname}</py:def>
+  <py:def function="page_title">Edit: ${c.group.display_name}</py:def>
+  <py:def function="page_heading">Edit: ${c.group.display_name}</py:def><div py:match="content">


--- a/ckan/templates/group/history.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/group/history.html	Sat Oct 15 01:13:30 2011 +0100
@@ -2,13 +2,10 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip="">
   
-  <py:def function="page_title">${c.group_dict['display_name']} - Groups - History</py:def>
+  <py:def function="page_title">History: ${c.group.display_name}</py:def>
+  <py:def function="page_heading">History: ${c.group.display_name}</py:def><div py:match="content" class="group">
-    <h2 class="head">
-      ${c.group_dict['display_name']}
-    </h2>
-
     <h3>
       Revisions
       <!--p class="atom-feed-link group-history-link">
@@ -49,7 +46,7 @@
           </tr></py:for></table>
-      ${h.submit('diff', _('Compare »'))}
+      <input type="submit" name="diff" value="${_('Compare »')}" class="pretty-button primary" /></form></div><!-- content -->
 


--- a/ckan/templates/group/index.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/group/index.html	Sat Oct 15 01:13:30 2011 +0100
@@ -5,6 +5,14 @@
   
   <py:def function="page_title">Groups of Datasets</py:def><py:def function="page_heading">Groups of Datasets</py:def>
+
+  <py:match path="primarysidebar">
+    <li class="widget-container boxed widget_text">
+      <h3>What Are Groups?</h3>
+      <span i18n:msg="">Whilst tags are great at collecting datasets together, there are occasions when you want to restrict users from editing a collection. A <strong>group</strong> can be set-up to specify which users have permission to add or remove datasets from it.</span>
+    </li>
+  </py:match>
+
   
   <div py:match="content">
     ${c.page.pager()}


--- a/ckan/templates/group/layout.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/group/layout.html	Sat Oct 15 01:13:30 2011 +0100
@@ -6,13 +6,6 @@
   py:strip=""
   >
 
-  <py:match path="primarysidebar">
-    <li class="widget-container boxed widget_text">
-      <h3>What Are Groups?</h3>
-      <span i18n:msg="">Whilst tags are great at collecting datasets together, there are occasions when you want to restrict users from editing a collection. A <strong>group</strong> can be set-up to specify which users have permission to add or remove datasets from it.</span>
-    </li>
-  </py:match>
-
   <py:match path="minornavigation"><ul py:if="c.group" class="tabbed"><li py:attrs="{'class':'current-tab'} if c.action=='read' else {}">${h.subnav_link(c, h.icon('group') + _('View'), controller='group', action='read', id=c.group.name)}</li>


--- a/ckan/templates/group/new_group_form.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/group/new_group_form.html	Sat Oct 15 01:13:30 2011 +0100
@@ -12,22 +12,34 @@
 </ul></div>
 
-<fieldset>
+<fieldset id="basic-information"><dl>
-    <dt><label class="field_opt" for="name">Name *</label></dt>
-    <dd><input id="name" name="name" type="text" value="${data.get('name', '')}"/></dd>
-    <dd class="instructions basic"><br/><strong>Unique identifier</strong> for group.<br/>2+ chars, lowercase, using only 'a-z0-9' and '-_'</dd>
+    <dt><label class="field_opt" for="name">Title</label></dt>
+    <dd><input class="js-title" id="title" name="title" type="text" value="${data.get('title', '')}"/></dd>
+
+    <dt><label class="field_opt" for="title">Url</label></dt>
+    <dd class="name-field">
+      <span class="url-text">${g.site_url+h.url_for(controller='group',id=None)+'/'}<span class="js-url-viewmode js-url-suffix"> </span><a style="display: none;" href="#" class="url-edit js-url-editlink js-url-viewmode">(edit)</a></span>
+      <input style="display: none;" id="name" maxlength="100" name="name" type="text" class="url-input js-url-editmode js-url-input" value="${data.get('name', '')}" />
+      <p class="js-url-is-valid"> </p>
+    </dd>
+    <dd style="display: none;" class="js-url-editmode instructions basic">2+ chars, lowercase, using only 'a-z0-9' and '-_'</dd><dd class="field_error" py:if="errors.get('name', '')">${errors.get('name', '')}</dd>
 
-    <dt><label class="field_opt" for="title">Title</label></dt>
-    <dd><input id="title" name="title" type="text" value="${data.get('title', '')}"/></dd>
-    <dd class="field_error" py:if="errors.get('title', '')">${errors.get('title', '')}</dd>
+    <dt class="description-label"><label class="field_opt" for="title">Description</label></dt>
+    <dd class="description-field"><div class="markdown-editor">
+      <ul class="button-row">
+        <li><button class="pretty-button js-markdown-edit depressed">Edit</button></li>
+        <li><button class="pretty-button js-markdown-preview">Preview</button></li>
+      </ul>
+      <textarea class="markdown-input" name="description" id="notes" placeholder="${_('Start with a summary sentence ...')}">${data.get('description','')}</textarea>
+      <div class="markdown-preview" style="display: none;"></div>
+      <span class="hints">You can use <a href="http://daringfireball.net/projects/markdown/syntax" target="_blank">Markdown formatting</a> here.</span>
+    </div></dd>
 
-    <dt><label class="field_opt" for="title">Description</label></dt>
-    <dd><textarea cols="60" id="description" name="description" rows="15">${data.get('description', '')}</textarea></dd>
 
-    <dt py:if="c.is_sysadmin or c.auth_for_change_state"><label class="field_opt" for="state">State</label></dt>
-    <dd py:if="c.is_sysadmin or c.auth_for_change_state">
+    <dt class="state-label" py:if="c.is_sysadmin or c.auth_for_change_state"><label class="field_opt" for="state">State</label></dt>
+    <dd class="state-field" py:if="c.is_sysadmin or c.auth_for_change_state"><select id="state" name="state" ><option py:attrs="{'selected': 'selected' if data.get('state') == 'active' else None}" value="active">active</option><option py:attrs="{'selected': 'selected' if data.get('state') == 'deleted' else None}" value="deleted">deleted</option>
@@ -36,7 +48,7 @@
   </dl></fieldset>
   
-<fieldset>
+<fieldset id="extras"><h3>Extras</h3><dl><py:with vars="extras = data.get('extras', [])">
@@ -61,7 +73,7 @@
   </dl></fieldset>
 
-<fieldset>
+<fieldset id="datasets"><h3>Datasets</h3><dl py:if="data.get('packages')"><py:for each="num, package in enumerate(data.get('packages'))">
@@ -72,9 +84,7 @@
     </py:for></dl><p py:if="not data.get('packages')">There are no datasets currently in this group.</p>
-</fieldset>
 
-<fieldset><h3>Add datasets</h3><dl><dt><label class="field_opt" for="packages__${len(data.get('packages', []))}__name">Dataset</label></dt>
@@ -82,6 +92,10 @@
   </dl></fieldset>
 
-  <br />
-  <input id="save" name="save" type="submit" value="Save" />
+<div class="form-submit">
+  <input id="save" class="pretty-button primary" name="save" type="submit" value="${_('Save Changes')}" />
+  <py:if test="c.group">
+    <input id="cancel" class="pretty-button href-action" name="cancel" type="reset" value="${_('Cancel')}" action="${h.url_for(controller='group', action='read', id=c.group.name)}" />
+  </py:if>
+</div></form>


--- a/ckan/templates/group/read.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/group/read.html	Sat Oct 15 01:13:30 2011 +0100
@@ -3,21 +3,12 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip="">
   
-  <py:def function="page_title">${c.group.display_name} - Groups</py:def>
+  <py:def function="page_title">${c.group.display_name}</py:def>
+  <py:def function="page_heading">${c.group.display_name}</py:def>
 
-  <py:def function="page_heading">
-      <py:if test="not c.group.title">
-        <em>No Title</em>
-      </py:if>
-      ${c.group.title}
-  </py:def>
-  
   <py:match path="primarysidebar"><li class="widget-container widget_text">
-      <div class="description">
-        ${c.group_description_formatted}
-      </div><ul class="property-list"><py:if test="c.group_admins"><li>
@@ -32,6 +23,9 @@
   </py:match><py:match path="content">
+    <div class="notes" py:if="str(c.group_description_formatted).strip()">
+      ${c.group_description_formatted}
+    </div><h3>Datasets:</h3><p i18n:msg="item_count">There are ${c.page.item_count} datasets in this group.</p>
     ${c.page.pager()}


--- a/ckan/templates/js_strings.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/js_strings.html	Sat Oct 15 01:13:30 2011 +0100
@@ -15,11 +15,12 @@
    */
   CKAN.Strings.helloWorld = "${_('Hello there, world!')}";
   CKAN.Strings.checking = "${_('Checking...')}";
-  CKAN.Strings.datasetNameAvailable = "${_('This dataset name is available!')}";
-  CKAN.Strings.datasetNameNotAvailable = "${_('This dataset name is already used, please use a different name')}";
+  CKAN.Strings.urlIsAvailable = "${_('This URL is available!')}";
+  CKAN.Strings.urlIsNotAvailable = "${_('This URL is already used, please use a different one.')}";
   CKAN.Strings.bracketsNone = "${_('(none)')}";
   CKAN.Strings.failedToSave = "${_('Failed to save, possibly due to invalid data ')}";
   CKAN.Strings.addDataset = "${_('Add Dataset')}";
+  CKAN.Strings.addGroup = "${_('Add Group')}";
   CKAN.Strings.youHaveUnsavedChanges = "${_('You have unsaved changes. Hit Save Changes at the bottom of the page to submit them.')}";
   CKAN.Strings.loading = "${_('Loading...')}";
   CKAN.Strings.noNameBrackets = "${_('(no name)')}";


--- a/ckan/templates/package/authz.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/package/authz.html	Sat Oct 15 01:13:30 2011 +0100
@@ -2,7 +2,7 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip="">
   
-  <py:def function="page_title">${c.pkgtitle or c.pkgname} - Authorization - Datasets</py:def>
+  <py:def function="page_title">Authorization: ${c.pkgtitle or c.pkgname}</py:def><py:def function="page_heading">Authorization: ${c.pkgtitle or c.pkgname}</py:def><div py:match="content">
@@ -10,16 +10,17 @@
 
     <form id="theform" method="POST">
       ${authz_form_table('theform', c.roles, c.users, c.user_role_dict)}
-      <button type="submit" name="save">
-        Save
+      <button type="submit" name="save" class="pretty-button primary">
+        Save Changes
       </button>
+      <div class="clear"></div></form><h3>Add Roles for Any User</h3>
-
     <form id="addform" method="POST">
       ${authz_add_table(c.roles)}
-      <button type="submit" name="add"> Add </button>
+      <button type="submit" name="add" class="pretty-button primary">Add Role</button>
+      <div class="clear"></div></form><hr/>
@@ -28,16 +29,16 @@
 
     <form id="authzgroup_form" method="POST">
       ${authz_form_group_table('authzgroup_form', c.roles, c.authz_groups, c.authz_groups_role_dict)}
-      <button type="submit" name="authz_save">
-        Save
-      </button>
+      <button type="submit" name="authz_save" class="pretty-button primary">Save Changes</button>
+      <div class="clear"></div></form><h3>Add Roles for Any Authorization Group</h3><form id="authzgroup_addform" method="POST">
       ${authz_add_group_table(c.roles)}
-      <button type="submit" name="authz_add"> Add </button>
+      <button type="submit" name="authz_add" class="pretty-button primary">Add Role</button>
+      <div class="clear"></div></form></div>


--- a/ckan/templates/package/history.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/package/history.html	Sat Oct 15 01:13:30 2011 +0100
@@ -53,7 +53,7 @@
           </tr></py:for></table>
-      ${h.submit('diff', _('Compare »'))}
+      <input type="submit" name="diff" value="${_('Compare »')}" class="pretty-button primary" /></form></div><!-- content -->
 


--- a/ckan/templates/package/new_package_form.html	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Sat Oct 15 01:13:30 2011 +0100
@@ -41,13 +41,12 @@
 
     <dt class="name-label"><label class="field_req" for="name">Url</label></dt><dd class="name-field">
-      <span class="url-text">http://thedatahub.org/dataset/<span class="js-url-viewmode js-url-suffix"> </span><a href="#" class="url-edit js-url-editlink js-url-viewmode">(edit)</a></span>
+      <span class="url-text">${g.site_url+h.url_for(controller='package', id=None)+'/'}<span class="js-url-viewmode js-url-suffix"> </span><a href="#" style="display: none;" class="url-edit js-url-editlink js-url-viewmode">(edit)</a></span><input style="display: none;" id="name" maxlength="100" name="name" type="text" class="url-input js-url-editmode js-url-input" value="${data.get('name', '')}" /><p class="js-url-is-valid"> </p></dd>
-    <dd style="display: none;" class="js-url-editmode name-instructions instructions basic">A unique identifier used in urls. Renaming is possible but discouraged.</dd>
-    <dd style="display: none;" class="js-url-editmode name-instructions hints">2+ characters, lowercase, using only 'a-z0-9' and '-_'</dd>
-    <dd style="display: none;" class="js-url-editmode name-instructions field_error" py:if="errors.get('name', '')">${errors.get('name', '')}</dd>
+    <dd style="display: none;" class="js-url-editmode name-instructions basic">2+ characters, lowercase, using only 'a-z0-9' and '-_'</dd>
+    <dd class="js-url-editmode name-instructions field_error" py:if="errors.get('name', '')">${errors.get('name', '')}</dd><dt class="homepage-label"><label class="field_opt" for="url">Home Page</label></dt><dd class="homepage-field"><input id="url" name="url" type="text" value="${data.get('url', '')}"/></dd>


--- a/ckan/tests/functional/api/test_ajax.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/tests/functional/api/test_ajax.py	Sat Oct 15 01:13:30 2011 +0100
@@ -19,6 +19,7 @@
         response = self.app.get(
             url=url_for(controller='api', action='is_slug_valid'),
             params={
+               'type': u'package',
                'slug': u'A New Title * With & Funny CHARacters',
             },
             status=200,
@@ -29,6 +30,7 @@
         response = self.app.get(
             url=url_for(controller='api', action='is_slug_valid'),
             params={
+               'type': u'package',
                'slug': u'warandpeace',
             },
             status=200,


--- a/ckan/tests/functional/test_group.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/tests/functional/test_group.py	Sat Oct 15 01:13:30 2011 +0100
@@ -289,7 +289,6 @@
         res = fv.submit('save', status=302, extra_environ={'REMOTE_USER': 'russianfan'})
         res = res.follow()
         assert group_name in res, res
-        assert 'No Title' in res, res
         model.Session.remove()
 
         # Create duplicate group


--- a/ckan/tests/lib/test_dictization_schema.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/tests/lib/test_dictization_schema.py	Sat Oct 15 01:13:30 2011 +0100
@@ -118,7 +118,7 @@
         data['name'] = '????jfaiofjioafjij'
         converted_data, errors = validate(data, default_package_schema(), context)
         assert errors == {
-            'name': [u'Name must be purely lowercase alphanumeric (ascii) characters and these symbols: -_'],
+            'name': [u'Url must be purely lowercase alphanumeric (ascii) characters and these symbols: -_'],
             #'resources': [{}, {'url': [u'Missing value']}]
         },pformat(errors)
 


--- a/ckan/tests/lib/test_munge.py	Fri Oct 14 23:06:51 2011 +0100
+++ b/ckan/tests/lib/test_munge.py	Sat Oct 15 01:13:30 2011 +0100
@@ -1,6 +1,6 @@
 from nose.tools import assert_equal
 
-from ckan.lib.munge import munge_title_to_name, munge_name
+from ckan.lib.munge import munge_name
 
 class TestMunge:
     def test_munge_name(self):

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list