[ckan-changes] commit/ckan: 13 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Sep 7 14:02:53 UTC 2011


13 new changesets in ckan:

http://bitbucket.org/okfn/ckan/changeset/905a7384b2fb/
changeset:   905a7384b2fb
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-06 13:50:23
summary:     [ux][s]: Aesthetic pages to dataset edit.
affected #:  3 files (249 bytes)

--- a/ckan/public/css/style.css	Tue Sep 06 12:12:42 2011 +0100
+++ b/ckan/public/css/style.css	Tue Sep 06 12:50:23 2011 +0100
@@ -685,6 +685,9 @@
 /**************************************
  * Edit Dataset Page
  *************************************/
+div.dataset form fieldset {
+  border-bottom: none;
+}
 ul.edit-form-navigation {
   list-style-type: none;
   padding-left: 0;


--- a/ckan/templates/package/edit.html	Tue Sep 06 12:12:42 2011 +0100
+++ b/ckan/templates/package/edit.html	Tue Sep 06 12:50:23 2011 +0100
@@ -18,11 +18,11 @@
     <li class="widget-container widget_text"><ul class="edit-form-navigation"><!-- One button for each fieldset -->
-        <li><a class="active" href="#basic-information">Basic Information</a></li>
-        <li><a class="" href="#resources">Resources</a></li>
-        <li><a class="" href="#groups">Groups</a></li>
-        <li><a class="" href="#detail">Details</a></li>
-        <li><a class="" href="#extras">Extras</a></li>
+        <li><a href="#basic-information">Basic Information</a></li>
+        <li><a href="#resources">Resources</a></li>
+        <li><a href="#groups">Groups</a></li>
+        <li><a href="#detail">Details</a></li>
+        <li><a href="#extras">Extras</a></li></ul></li></py:match>


--- a/ckan/templates/package/new_package_form.html	Tue Sep 06 12:12:42 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 06 12:50:23 2011 +0100
@@ -14,7 +14,6 @@
 </div><fieldset id="basic-information">
-  <legend> Basic information</legend><dl><dt><label class="field_opt" for="title">Title</label></dt><dd><input id="title" name="title" type="text" value="${data.get('title', '')}"/></dd>
@@ -63,7 +62,6 @@
 </fieldset><fieldset id="resources">
-  <legend>Resources</legend><table class="flexitable"><thead><tr>
@@ -103,7 +101,6 @@
 </fieldset><fieldset id="groups">
-  <legend>Groups</legend><dl><py:for each="num, group in enumerate(data.get('groups', []))"><?python
@@ -131,7 +128,6 @@
   </dl></fieldset><fieldset id='detail'>
-  <legend>Detail</legend><dl><dt><label class="field_opt" for="author">Author</label></dt><dd><input id="author" name="author" type="text" value="${data.get('author', '')}" /></dd>
@@ -164,7 +160,6 @@
 </fieldset><fieldset id='extras'>
-  <legend>Extras</legend><dl><py:with vars="extras = data.get('extras', [])"><py:for each="num, extra in enumerate(data.get('extras', []))">


http://bitbucket.org/okfn/ckan/changeset/c735d98db95b/
changeset:   c735d98db95b
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-06 14:23:56
summary:     [ux,package/new][s]: (Refs 1295) Only show the basic information on dataset create form.
affected #:  4 files (255 bytes)

--- a/ckan/public/css/style.css	Tue Sep 06 12:50:23 2011 +0100
+++ b/ckan/public/css/style.css	Tue Sep 06 13:23:56 2011 +0100
@@ -685,9 +685,6 @@
 /**************************************
  * Edit Dataset Page
  *************************************/
-div.dataset form fieldset {
-  border-bottom: none;
-}
 ul.edit-form-navigation {
   list-style-type: none;
   padding-left: 0;


--- a/ckan/public/scripts/application.js	Tue Sep 06 12:50:23 2011 +0100
+++ b/ckan/public/scripts/application.js	Tue Sep 06 13:23:56 2011 +0100
@@ -7,6 +7,13 @@
     CKAN.Utils.setupFormatAutocomplete($('input.autocomplete-format'));
     CKAN.Utils.setupDatasetEditNavigation();
 
+    var isDatasetNew = $('body.package.new').length > 0;
+    if (isDatasetNew) {
+      $('#content fieldset').hide();
+      $('#content fieldset#basic-information').show();
+      
+    }
+
     var isPackageRead = $('body.package.read').length > 0;
     var config = {
       endpoint: '/'
@@ -207,7 +214,6 @@
       showSection(showMe);
       return false;
     });  
-
   };
 
   // Name slug generator for $name element using $title element


--- a/ckan/templates/package/new.html	Tue Sep 06 12:50:23 2011 +0100
+++ b/ckan/templates/package/new.html	Tue Sep 06 13:23:56 2011 +0100
@@ -3,8 +3,8 @@
   xmlns:xi="http://www.w3.org/2001/XInclude"
   py:strip="">
   
-  <py:def function="page_title">New - Datasets</py:def>
-  <py:def function="page_heading">Register a New Dataset</py:def>
+  <py:def function="page_title">Add - Datasets</py:def>
+  <py:def function="page_heading">Add a Dataset</py:def><py:def function="body_class">hide-sidebar</py:def>
 


--- a/ckan/templates/package/new_package_form.html	Tue Sep 06 12:50:23 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 06 13:23:56 2011 +0100
@@ -182,7 +182,6 @@
     </py:with></dl></fieldset>
-<hr /><label for="log_message">Edit summary (briefly describe the changes you have made)</label><textarea id="log_message" name="log_message" class="short wide">${data.get('log_message', '')}</textarea>


http://bitbucket.org/okfn/ckan/changeset/51420aae718b/
changeset:   51420aae718b
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-06 18:57:51
summary:     [ux,package/new,package/edit][m]: Integrated an inline markdown editor. Preview no longer required.
affected #:  3 files (2.3 KB)

--- a/ckan/public/css/style.css	Tue Sep 06 13:23:56 2011 +0100
+++ b/ckan/public/css/style.css	Tue Sep 06 17:57:51 2011 +0100
@@ -715,5 +715,61 @@
   -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; 
 }
 
+div.markdown-editor {
+  background: #EEE;
+  border-radius: 5px 5px;
+  -webkit-border-radius: 5px;
+  -moz-border-radius: 5px;
+  border: 1px solid #CCC;
+  padding: 0 5px 5px 10px;
+}
 
+div.markdown-preview {
+  background: white;
+  border: 1px solid #CCC;
+  padding: 5px;
+  margin-bottom: 5px;
+  overflow: auto;
+}
 
+textarea.markdown-input {
+  margin-bottom: 5px;
+  padding: 5px;
+  display: block;
+}
+
+/****************************************
+  * Mini Tabs
+  ***************************************/
+
+ul.tabs {
+  margin-bottom: 5px;
+}
+
+ul.tabs li {
+  display: inline;
+}
+
+ul.tabs li a {
+  display: inline-block;
+  padding: 2px 8px;
+  font-size: 10px;
+  font-weight: bold;
+  text-decoration: none;
+  color: #666;
+  border: 1px solid transparent;
+  -webkit-border-radius: 10px;
+  -moz-border-radius: 10px;
+  border-top-left-radius: 10px 10px;
+  border-top-right-radius: 10px 10px;
+  border-bottom-right-radius: 10px 10px;
+  border-bottom-left-radius: 10px 10px;
+}
+
+ul.tabs li a.selected {
+  color: #333;
+  background: white;
+  border-color: #BBB;
+  border-right-color: #DDD;
+  border-bottom-color: #DDD;
+}


--- a/ckan/public/scripts/application.js	Tue Sep 06 13:23:56 2011 +0100
+++ b/ckan/public/scripts/application.js	Tue Sep 06 17:57:51 2011 +0100
@@ -11,9 +11,35 @@
     if (isDatasetNew) {
       $('#content fieldset').hide();
       $('#content fieldset#basic-information').show();
-      
     }
 
+    // Markdown editor hooks
+    var converter=new Showdown.converter();
+    $('.markdown-editor a, .markdown-preview').live('click', function(e) {
+      e.preventDefault();
+      var $el = $(e.target);
+      var action = $el.attr('action') || 'write';
+      // Extract neighbouring elements
+      var div=$el.closest('.markdown-editor')
+      div.find('.tabs a').removeClass('selected');
+      div.find('.tabs a[action='+action+']').addClass('selected');
+      var textarea = div.find('.markdown-input');
+      var preview = div.find('.markdown-preview');
+      // Toggle the preview
+      if (action=='preview') {
+        preview.html(converter.makeHtml(textarea.val()));
+        preview.width(textarea.width())
+        preview.height(textarea.height())
+        textarea.hide();
+        preview.show();
+      } else {
+        textarea.show();
+        preview.hide();
+        textarea.focus();
+      }
+      return false;
+    });
+
     var isPackageRead = $('body.package.read').length > 0;
     var config = {
       endpoint: '/'
@@ -194,6 +220,7 @@
   };
 
   my.setupDatasetEditNavigation = function() {
+
     function showSection(sectionToShowId) {
       $('.dataset fieldset').hide();
       $('.dataset fieldset#'+sectionToShowId).show();
@@ -433,3 +460,6 @@
       });
     }
   });
+
+
+


--- a/ckan/templates/package/new_package_form.html	Tue Sep 06 13:23:56 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 06 17:57:51 2011 +0100
@@ -34,11 +34,20 @@
     <dd class="hints">e.g. http://www.example.com/growth-figures.html</dd><dd class="field_error" py:if="errors.get('url', '')">${errors.get('url', '')}</dd>
 
-    <dt><label class="field_opt" for="notes">Notes</label></dt>
-    <dd><textarea cols="60" id="notes" name="notes" rows="15">${data.get('notes', '')}</textarea></dd>
-    <dd class="instructions basic">The main description of the dataset</dd>
-    <dd class="instructions further">It is often displayed with the dataset title. In particular, it should start with a short sentence that describes the dataset succinctly, because the first few words alone may be used in some views of the datasets.</dd>
-    <dd class="hints">You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown formatting</a> here.</dd>
+    <dt><label class="field_opt" for="notes">Description</label></dt>
+    <dd><div class="markdown-editor">
+      <ul class="tabs">
+        <li><a href="#" action="write" class="selected">Write</a></li>
+        <li><a href="#" action="preview">Preview</a></li>
+      </ul>
+      <textarea class="markdown-input" name="notes" id="notes" placeholder="Start with a summary sentence ...">${data.get('notes','')}</textarea>
+      <div class="markdown-preview" style="display: none;"></div>
+      <span class="hints">You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown formatting</a> here.</span>
+      <!--
+      <dd class="instructions basic">The main description of the dataset</dd>
+      <dd class="instructions further">It is often displayed with the dataset title. In particular, it should start with a short sentence that describes the dataset succinctly, because the first few words alone may be used in some views of the datasets.</dd>
+      -->
+    </div></dd><dt><label class="field_opt" for="license_id">Licence</label></dt><dd>


http://bitbucket.org/okfn/ckan/changeset/8901e722b158/
changeset:   8901e722b158
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-06 20:00:43
summary:     [ux,package/new,package/edit][m]: Integrated javascript markdown editor. Various code tidying & presentational fixes. Got all tests passing.
affected #:  7 files (11.1 KB)

--- a/ckan/controllers/package.py	Tue Sep 06 17:57:51 2011 +0100
+++ b/ckan/controllers/package.py	Tue Sep 06 19:00:43 2011 +0100
@@ -64,8 +64,7 @@
         spammers are submitting only part of the form'''
 
         surplus_keys_schema = ['__extras', '__junk', 'state', 'groups',
-                               'extras_validation', 'save', 'preview',
-                               'return_to']
+                               'extras_validation', 'save', 'return_to']
 
         schema_keys = package_form_schema().keys()
         keys_in_schema = set(schema_keys) - set(surplus_keys_schema)
@@ -330,17 +329,15 @@
     def new(self, data=None, errors=None, error_summary=None):
         context = {'model': model, 'session': model.Session,
                    'user': c.user or c.author, 'extras_as_string': True,
-                   'preview': 'preview' in request.params,
                    'save': 'save' in request.params,
                    'schema': self._form_to_db_schema()}
 
-        if not context['preview']:
-            try:
-                check_access('package_create',context)
-            except NotAuthorized:
-                abort(401, _('Unauthorized to create a package'))
+        try:
+            check_access('package_create',context)
+        except NotAuthorized:
+            abort(401, _('Unauthorized to create a package'))
 
-        if (context['save'] or context['preview']) and not data:
+        if context['save'] and not data:
             return self._save_new(context)
 
         data = data or dict(request.params) 
@@ -356,13 +353,12 @@
     def edit(self, id, data=None, errors=None, error_summary=None):
         context = {'model': model, 'session': model.Session,
                    'user': c.user or c.author, 'extras_as_string': True,
-                   'preview': 'preview' in request.params,
                    'save': 'save' in request.params,
                    'moderated': config.get('moderated'),
                    'pending': True,
                    'schema': self._form_to_db_schema()}
 
-        if (context['save'] or context['preview']) and not data:
+        if context['save'] and not data:
             return self._save_edit(id, context)
         try:
             old_data = get_action('package_show')(context, {'id':id})
@@ -454,14 +450,6 @@
             context['message'] = data_dict.get('log_message', '')
             pkg = get_action('package_create')(context, data_dict)
 
-            if context['preview']:
-                PackageSaver().render_package(pkg, context)
-                c.pkg = context['package']
-                c.pkg_dict = data_dict
-                c.is_preview = True
-                c.preview = render('package/read_core.html')
-                return self.new(data_dict)
-
             self._form_save_redirect(pkg['name'], 'new')
         except NotAuthorized:
             abort(401, _('Unauthorized to read package %s') % '')
@@ -489,12 +477,6 @@
             c.pkg = context['package']
             c.pkg_dict = pkg
 
-            if context['preview']:
-                c.is_preview = True
-                PackageSaver().render_package(pkg, context)
-                c.preview = render('package/read_core.html')
-                return self.edit(id, data_dict)
-
             self._form_save_redirect(pkg['name'], 'edit')
         except NotAuthorized:
             abort(401, _('Unauthorized to read package %s') % id)


--- a/ckan/controllers/package_formalchemy.py	Tue Sep 06 17:57:51 2011 +0100
+++ b/ckan/controllers/package_formalchemy.py	Tue Sep 06 19:00:43 2011 +0100
@@ -34,7 +34,7 @@
             fs = self._get_package_fieldset(is_admin=is_admin)
         except ValueError, e:
             abort(400, e)
-        if 'save' in request.params or 'preview' in request.params:
+        if 'save' in request.params:
             if not request.params.has_key('log_message'):
                 abort(400, ('Missing parameter: log_message'))
             log_message = request.params['log_message']
@@ -67,12 +67,7 @@
 
         # use request params even when starting to allow posting from "outside"
         # (e.g. bookmarklet)
-        if 'preview' in request.params or 'name' in request.params or 'url' in request.params:
-            if 'name' not in request.params and 'url' in request.params:
-                url = request.params.get('url')
-                domain = urlparse.urlparse(url)[1]
-                if domain.startswith('www.'):
-                    domain = domain[4:]
+        if 'name' in request.params or 'url' in request.params:
             # ensure all fields specified in params (formalchemy needs this on bind)
             from ckan.forms import add_to_package_dict,get_package_dict
 
@@ -81,21 +76,8 @@
 
         else:
             fs = fs.bind(session=model.Session)
-        #if 'preview' in request.params:
-        #    c.preview = ' '
+
         c.form = self._render_edit_form(fs, request.params, clear_session=True)
-        if 'preview' in request.params:
-            c.is_preview = True
-            try:
-                PackageSaver().render_preview(fs,
-                                              log_message=log_message,
-                                              author=c.author, client=c)
-                c.preview = h.literal(render('package/read_core.html'))
-            except ValidationException, error:
-                fs = error.args[0]
-                c.form = self._render_edit_form(fs, request.params,
-                        clear_session=True)
-                return render('package/new.html')
         return render('package/new.html')
 
     def edit(self, id=None): # allow id=None to allow posting
@@ -121,21 +103,11 @@
             fs = self._get_package_fieldset(is_admin=auth_for_change_state)
         except ValueError, e:
             abort(400, e)
-        if 'save' in request.params or 'preview' in request.params:
+        if 'save' in request.params:
             if not request.params.has_key('log_message'):
                 abort(400, ('Missing parameter: log_message'))
             log_message = request.params['log_message']
 
-        if not 'save' in request.params and not 'preview' in request.params:
-            # edit
-            c.pkgname = pkg.name
-            c.pkgtitle = pkg.title
-            if pkg.license_id:
-                self._adjust_license_id_options(pkg, fs)
-            fs = fs.bind(pkg)
-            c.form = self._render_edit_form(fs, request.params)
-            return render('package/edit.html')
-        elif request.params.has_key('save'):
             # id is the name (pre-edited state)
             pkgname = id
             params = dict(request.params) # needed because request is nested
@@ -155,25 +127,12 @@
                 return render('package/edit.html')
             except KeyError, error:
                 abort(400, 'Missing parameter: %s' % error.args)
-        else: # Must be preview
-            c.is_preview = True
+        else:
+            # edit
             c.pkgname = pkg.name
             c.pkgtitle = pkg.title
             if pkg.license_id:
                 self._adjust_license_id_options(pkg, fs)
-            fs = fs.bind(pkg, data=dict(request.params))
-            try:
-                PackageSaver().render_preview(fs,
-                                              log_message=log_message,
-                                              author=c.author, client=c)
-                c.pkgname = fs.name.value
-                c.pkgtitle = fs.title.value
-                read_core_html = render('package/read_core.html') #utf8 format
-                c.preview = h.literal(read_core_html)
-                c.form = self._render_edit_form(fs, request.params)
-            except ValidationException, error:
-                fs = error.args[0]
-                c.form = self._render_edit_form(fs, request.params,
-                        clear_session=True)
-                return render('package/edit.html')
-            return render('package/edit.html') # uses c.form and c.preview
+            fs = fs.bind(pkg)
+            c.form = self._render_edit_form(fs, request.params)
+            return render('package/edit.html')


--- a/ckan/logic/schema.py	Tue Sep 06 17:57:51 2011 +0100
+++ b/ckan/logic/schema.py	Tue Sep 06 19:00:43 2011 +0100
@@ -126,7 +126,6 @@
     schema['tag_string'] = [ignore_missing, tag_string_convert]
     schema['extras_validation'] = [duplicate_extras_key, ignore]
     schema['save'] = [ignore]
-    schema['preview'] = [ignore]
     schema['return_to'] = [ignore]
 
     ##changes


--- a/ckan/templates/package/edit.html	Tue Sep 06 17:57:51 2011 +0100
+++ b/ckan/templates/package/edit.html	Tue Sep 06 19:00:43 2011 +0100
@@ -28,16 +28,7 @@
   </py:match><div py:match="content" class="dataset">
-    <div id="preview" style="margin-left: 20px;" py:if="c.preview">
-      <hr />
-      <h2>Preview</h2>
-      <div style="border: 2px dashed red; padding: 5px;"> 
-        ${c.preview}
-      </div>
-    </div><!-- /preview -->
-
     ${c.form}
-
   </div><xi:include href="layout.html" />


--- a/ckan/templates/package/new.html	Tue Sep 06 17:57:51 2011 +0100
+++ b/ckan/templates/package/new.html	Tue Sep 06 19:00:43 2011 +0100
@@ -29,20 +29,10 @@
   </py:def><div py:match="content">
-    <div id="preview" style="margin-left: 20px;" py:if="c.preview">
-      <hr />
-      <h2>Preview</h2>
-      <div style="border: 2px dashed red; padding: 5px;"> 
-        ${c.preview}
-      </div>
-    </div>
-
     <h3 py:if="c.error" class="form-errors">
       Error: ${c.error}
     </h3>
-
     ${h.literal(c.form)}
-
   </div><xi:include href="layout.html" />


--- a/ckan/templates/package/new_package_form.html	Tue Sep 06 17:57:51 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 06 19:00:43 2011 +0100
@@ -207,7 +207,6 @@
 </div><div class="submit">
-  <input name="preview" type="submit" value="Preview" /><input id="save" name="save" type="submit" value="Save" /></div>
 


--- a/ckan/tests/functional/test_package.py	Tue Sep 06 17:57:51 2011 +0100
+++ b/ckan/tests/functional/test_package.py	Tue Sep 06 19:00:43 2011 +0100
@@ -107,37 +107,6 @@
                 self.check_named_element(main_div, 'tr', '!' + key)
                 self.check_named_element(main_div, 'tr', '!' + value)
 
-    def _check_preview(self, res, **params):
-        preview =  str(res)[str(res).find('<div id="preview"'):str(res).find('<div id="footer">')]
-        assert 'Preview' in preview, preview
-        assert str(params['name']) in preview, preview
-        assert str(params['title']) in preview, preview
-        assert str(params['version']) in preview, preview
-        self.check_named_element(preview, 'a', 'href="%s"' % params['url'])
-        for res_index, resource in enumerate(params['resources']):
-            if isinstance(resource, (str, unicode)):
-                resource = [resource]
-            self.check_named_element(preview, 'tr', resource[0], resource[1], resource[2], resource[3])
-        preview_ascii = repr(preview)
-        assert str(params['notes']) in preview_ascii, preview_ascii
-        license = model.Package.get_license_register()[params['license_id']]
-        assert license.title in preview_ascii, (license.title, preview_ascii)
-        tag_names = [str(tag.lower()) for tag in params['tags']]
-        #self.check_named_element(preview, 'ul', *tag_names) # commented out as tags need to move to sidebar for preview
-        if params.has_key('state'):
-            assert str(params['state']) in preview, preview
-        else:
-            assert 'state' not in preview
-        for key, value, deleted in params['extras']:
-            if not deleted:
-                key_html = self.escape_for_html_body(key)
-                value_html = self.escape_for_html_body(value)
-                self.check_named_element(preview, 'tr', key_html, value_html)
-            else:
-                key_html = self.escape_for_html_body(key)
-                value_html = self.escape_for_html_body(value)
-                self.check_named_element(preview, 'tr', '!' + key_html)
-                self.check_named_element(preview, 'tr', '!' + value_html)
 
     def _get_resource_values(self, resources, by_resource=False):
         assert isinstance(resources, (list, tuple))
@@ -238,9 +207,6 @@
             fv = res.forms['dataset-edit']
             prefix = ''
             fv[prefix + 'name'] = new_name
-            res = fv.submit('preview')
-            assert not 'Error' in res, res
-            fv = res.forms['dataset-edit']
             res = fv.submit('save', status=302)
             assert not 'Error' in res, res
             redirected_to = dict(res.headers).get('Location') or dict(res.headers)['location']
@@ -276,7 +242,7 @@
         offset = url_for(controller='package', action='search')
         res = self.app.get(offset)
         res = res.click('Register it now')
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
 
     def test_read(self):
         name = u'annakarenina'
@@ -747,29 +713,6 @@
         assert rev.author == 'Unknown IP Address'
         assert rev.message == exp_log_message
 
-    def test_edit_preview(self):
-        newurl = 'www.editpkgnewurl.com'
-        newnotes = '''
-### A title
-
-Hello world.
-
-Arrow <
-
-u with umlaut \xc3\xbc
-
-'''
-        fv = self.res.forms['dataset-edit']
-        prefix = ''
-        fv[prefix + 'url'] =  newurl
-        fv[prefix + 'notes'] =  newnotes
-        res = fv.submit('preview')
-        assert 'Edit - Datasets' in res
-        assert 'Preview' in res
-        assert 'Hello world' in res
-        self.check_tag_and_data(res, 'umlaut', u'\xfc')
-        self.check_tag_and_data(res, 'Arrow', '<')
-
     def test_missing_fields(self):
         # User edits and a field is left out in the commit parameters.
         # (Spammers can cause this)
@@ -874,36 +817,12 @@
             fv[prefix+'extras__3__value'] = extra_new[1].encode('utf8')
             fv[prefix+'extras__2__deleted'] = True
             fv['log_message'] = log_message
-            res = fv.submit('preview', extra_environ={'REMOTE_USER':'testadmin'})
-            assert not 'Error' in res, res
 
-            # Check preview is correct
             extras = (('key2', extras['key2'], False),
                        extra_changed,
                        extra_new,
                        ('key3', extras['key3'], True))
 
-            # 2011-09-02: rgrp disabling preview checks as do not work now some
-            # stuff in sidebar. Also IMO preview is pretty pointless (only use
-            # is for notes and we can do that in a nice javascripty way).
-            # self._check_preview(res, name=name, title=title, version=version,
-            #                    url=url,
-            #                    download_url='',
-            #                    resources=resources, notes=notes, license_id=license_id,
-            #                    tags=tags, extras=extras,
-            #                    state=state)
-
-            # Check form is correctly filled
-            self.check_form_filled_correctly(res, id=pkg.id, name=name,
-                                             title=title, version=version,
-                                             url=url, resources=resources,
-                                             notes=notes, license_id=license_id,
-                                             tags=tags, extras=extras,
-                                             log_message=log_message,
-                                             state=state)
-
-            # Submit
-            fv = res.forms['dataset-edit']
             res = fv.submit('save', extra_environ={'REMOTE_USER':'testadmin'})
 
             # Check dataset page
@@ -946,11 +865,6 @@
         fv = self.res.forms['dataset-edit']
         prefix = ''
         fv['log_message'] = u'Free enlargements: http://drugs.com/' # spam
-        res = fv.submit('preview')
-        assert 'Error' in res, res
-        assert 'No links are allowed' in res, res
-        self.check_tag(res, '<form', 'class="has-errors"')
-        assert 'No links are allowed' in res, res
         res = fv.submit('save')
         assert 'Error' in res, res 
         self.check_tag(res, '<form', 'class="has-errors"')
@@ -960,12 +874,6 @@
         fv = self.res.forms['dataset-edit']
         prefix = ''
         fv[prefix + 'name'] = u'a' # invalid name
-        res = fv.submit('preview')
-        assert 'Error' in res, res
-        assert 'Name must be at least 2 characters long' in res, res
-        # Ensure there is an error at the top of the form and by the field
-        self._assert_form_errors(res)
-
         res = fv.submit('save')
         assert 'Error' in res, res
         assert 'Name must be at least 2 characters long' in res, res
@@ -1029,8 +937,6 @@
             assert field_name in res
             fv = res.forms['dataset-edit']
             fv[prefix + 'groups__0__id'] = grp.id
-            res = fv.submit('preview', extra_environ={'REMOTE_USER':'russianfan'})
-            assert not 'error' in res
             res = fv.submit('save', extra_environ={'REMOTE_USER':'russianfan'})
             res = res.follow()
             pkg = model.Package.by_name(u'editpkgtest')
@@ -1096,15 +1002,7 @@
         res = self.app.get(offset)
         fv = res.forms['dataset-edit']
         fv[prefix+'name'] = name
-        res = fv.submit('preview')
-        assert not 'Error' in res, res
-
-        # check preview has no resources
-        res1 = self.main_div(res).replace('</strong>', '')
-        assert '<td><a href="">' not in res1, res1
-
         # submit
-        fv = res.forms['dataset-edit']
         self.pkg_names.append(name)
         res = fv.submit('save')
 
@@ -1124,7 +1022,7 @@
         assert not model.Package.by_name(u'annakarenina')
         offset = url_for(controller='package', action='new')
         res = self.app.get(offset)
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
         fv = res.forms['dataset-edit']
         prefix = ''
         fv[prefix + 'name'] = 'annakarenina'
@@ -1135,15 +1033,10 @@
     def test_new_bad_name(self):
         offset = url_for(controller='package', action='new', id=None)
         res = self.app.get(offset)
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
         fv = res.forms['dataset-edit']
         prefix = ''
         fv[prefix + 'name'] = u'a' # invalid name
-        res = fv.submit('preview')
-        assert 'Error' in res, res
-        assert 'Name must be at least 2 characters long' in res, res
-        self._assert_form_errors(res)
-
         self.pkg_names.append('a')
         res = fv.submit('save')
         assert 'Error' in res, res
@@ -1179,7 +1072,7 @@
         assert not model.Package.by_name(name)
         offset = url_for(controller='package', action='new')
         res = self.app.get(offset)
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
         fv = res.forms['dataset-edit']
         prefix = ''
         fv[prefix+'name'] = name
@@ -1195,32 +1088,6 @@
             fv[prefix+'extras__%s__key' % i] = extra[0].encode('utf8')
             fv[prefix+'extras__%s__value' % i] = extra[1].encode('utf8')
         fv['log_message'] = log_message
-        res = fv.submit('preview')
-        assert not 'Error' in res, res
-
-        # Check preview is correct
-        resources = [[download_url, u'', u'description escape: & umlaut: \xfc quote "', u'']]
-        resources_escaped = [[download_url, u'', u'description escape: & umlaut: \xfc quote "', u'']]
-
-        extras_list = [(key, value, False) for key, value in sorted(extras.items())]
-
-        # see comment in edit test re disabling preview tests
-        # self._check_preview(res, name=name, title=title, version=version,
-        #                    url=url,
-        #                    resources=resources_escaped, notes=notes,
-        #                    license_id=license_id,
-        #                    tags=tags, extras=extras_list,
-        #                    )
-
-        # Check form is correctly filled
-        self.check_form_filled_correctly(res, id='', name=name,
-                                         title=title, version=version,
-                                         url=url, resources=[download_url],
-                                         notes=notes, license_id=license_id,
-                                         tags=[tag for tag in tags],
-                                         extras=extras,
-                                         log_message=log_message,
-                                         )
         # Submit
         fv = res.forms['dataset-edit']
         self.pkg_names.append(name)
@@ -1264,7 +1131,7 @@
         assert not model.Package.by_name(pkgname)
         offset = url_for(controller='package', action='new', id=None)
         res = self.app.get(offset)
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
         fv = res.forms['dataset-edit']
         prefix = ''
         fv[prefix + 'name'] = pkgname
@@ -1274,13 +1141,10 @@
         assert model.Package.by_name(pkgname)
         # create duplicate dataset
         res = self.app.get(offset)
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
         fv = res.forms['dataset-edit']
         fv[prefix+'name'] = pkgname
         fv[prefix+'title'] = pkgtitle
-        res = fv.submit('preview')
-        assert 'Preview' in res
-        fv = res.forms['dataset-edit']
         res = fv.submit('save')
         assert 'Error' in res, res
         assert 'Dataset name already exists in database' in res, res
@@ -1291,7 +1155,7 @@
         # (Spammers can cause this)
         offset = url_for(controller='package', action='new')
         res = self.app.get(offset)
-        assert 'New - Datasets' in res, res
+        assert 'Add - Datasets' in res, res
         prefix = ''
         fv = res.forms['dataset-edit']
         fv[prefix + 'name'] = 'anything'
@@ -1301,7 +1165,7 @@
 
         offset = url_for(controller='package', action='new')
         res = self.app.get(offset)
-        assert 'New - Datasets' in res
+        assert 'Add - Datasets' in res
         fv = res.forms['dataset-edit']
         fv[prefix + 'name'] = 'anything'
         prefix = ''
@@ -1311,22 +1175,6 @@
         # text field tested here.
         res = fv.submit('save', status=400)
 
-    def test_multi_resource_bug(self):
-        # ticket:276
-        offset = url_for(controller='package', action='new')
-        res = self.app.get(offset)
-        assert 'New - Datasets' in res
-        fv = res.forms['dataset-edit']
-        prefix = ''
-        fv[prefix + 'name'] = 'name276'
-        resformat = u'xls'    
-        fv[prefix + 'resources__0__format'] = resformat
-        res = fv.submit('preview')
-
-        res = self.main_div(res)
-        assert resformat in res, res
-        assert res.count(str(resformat)) == 1, res.count(str(resformat))
-        
     def test_new_plugin_hook(self):
         plugin = MockPackageControllerPlugin()
         plugins.load(plugin)
@@ -1356,27 +1204,6 @@
         self.purge_packages([self.pkgname])
         model.repo.rebuild_db()
 
-    def test_preview(self):
-        assert model.Session.query(model.Package).count() == 0, model.Session.query(model.Package).all()
-        
-        offset = url_for(controller='package', action='new')
-        res = self.app.get(offset)
-        assert 'New - Datasets' in res
-        fv = res.forms['dataset-edit']
-        prefix = ''
-        fv[prefix + 'name'] = self.pkgname
-        fv[prefix + 'title'] = self.pkgtitle
-        res = fv.submit('preview')
-        assert not 'Error' in res, res
-
-        # Check preview displays correctly
-        assert str(self.pkgname) in res, res
-        assert str(self.pkgtitle) in res, res
-
-        # Check no object is yet created
-        assert model.Session.query(model.Package).count() == 0, model.Session.query(model.Package).all()
-        
-
 class TestNonActivePackages(TestPackageBase):
 
 


http://bitbucket.org/okfn/ckan/changeset/c99d75d42753/
changeset:   c99d75d42753
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-06 20:11:32
summary:     [ux,package/new][s]: Users don't need to see the edit summary (controller needs to auto-create one).
affected #:  2 files (67 bytes)

--- a/ckan/public/scripts/application.js	Tue Sep 06 19:00:43 2011 +0100
+++ b/ckan/public/scripts/application.js	Tue Sep 06 19:11:32 2011 +0100
@@ -11,6 +11,7 @@
     if (isDatasetNew) {
       $('#content fieldset').hide();
       $('#content fieldset#basic-information').show();
+      $('.edit-summary').hide();
     }
 
     // Markdown editor hooks


--- a/ckan/templates/package/new_package_form.html	Tue Sep 06 19:00:43 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 06 19:11:32 2011 +0100
@@ -192,8 +192,8 @@
   </dl></fieldset>
 
-<label for="log_message">Edit summary (briefly describe the changes you have made)</label>
-<textarea id="log_message" name="log_message" class="short wide">${data.get('log_message', '')}</textarea>
+<label for="log_message" class="edit-summary">Edit summary (briefly describe the changes you have made)</label>
+<textarea id="log_message" name="log_message" class="edit-summary short wide">${data.get('log_message', '')}</textarea><div class="ckan-logged-in" style="display: none;"><p>Author: ${c.author}</p>


http://bitbucket.org/okfn/ckan/changeset/7d1408f8e071/
changeset:   7d1408f8e071
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-06 20:50:19
summary:     [ux,package/new,package/edit][s]: Playing around with styling up the form submission. Verbose css.
affected #:  3 files (2.1 KB)

--- a/ckan/public/css/style.css	Tue Sep 06 19:11:32 2011 +0100
+++ b/ckan/public/css/style.css	Tue Sep 06 19:50:19 2011 +0100
@@ -773,3 +773,65 @@
   border-right-color: #DDD;
   border-bottom-color: #DDD;
 }
+
+
+/**************************************
+ * Form Submit/Cancel
+ **************************************/
+div.form-submit {
+    background: #eee;
+    padding: 20px;
+    margin-bottom: 8px;
+    border: 1px solid #ccc;
+    border-left: none;
+    border-right: none;
+    height: 60px;
+}
+
+div.form-submit p.hints {
+    display: block;
+    width: 50%;
+    float: right;
+}
+
+/* Tugged this out of Twitter.Bootstrap css. Can we use a blueprint button plugin? */
+input.pretty {
+    font: -webkit-small-control;
+    -webkit-border-radius: 4px;
+    -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
+    -webkit-transition: 0.1s linear all;
+    -webkit-box-align: center;
+    -webkit-appearance: button;
+    box-sizing: border-box;
+    text-align: center;
+    margin: 0;
+    vertical-align: baseline;
+    cursor: pointer;
+    display: inline-block;
+    background-color: #E6E6E6;
+    background-repeat: no-repeat;
+    background-image: -webkit-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
+    background-image: -moz-linear-gradient(top, #ffffff, #ffffff 25%, #e6e6e6);
+    background-image: -ms-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
+    background-image: -o-linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
+    background-image: linear-gradient(#ffffff, #ffffff 25%, #e6e6e6);
+    padding: 5px 14px 6px;
+    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
+    color: #333;
+    font-size: 13px;
+    border: 1px solid #CCC;
+    border-bottom-color: #BBB;
+    border-radius: 4px;
+    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
+}
+
+input.pretty.primary {
+    color: white;
+    background-color: #0064CD;
+    background-repeat: repeat-x;
+    background-image: -webkit-linear-gradient(top, #049cdb, #0064cd);
+    background-image: -o-linear-gradient(top, #049cdb, #0064cd);
+    background-image: linear-gradient(top, #049cdb, #0064cd);
+    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+}


--- a/ckan/public/scripts/application.js	Tue Sep 06 19:11:32 2011 +0100
+++ b/ckan/public/scripts/application.js	Tue Sep 06 19:50:19 2011 +0100
@@ -12,6 +12,7 @@
       $('#content fieldset').hide();
       $('#content fieldset#basic-information').show();
       $('.edit-summary').hide();
+      $('#save').val("Add Dataset")
     }
 
     // Markdown editor hooks


--- a/ckan/templates/package/new_package_form.html	Tue Sep 06 19:11:32 2011 +0100
+++ b/ckan/templates/package/new_package_form.html	Tue Sep 06 19:50:19 2011 +0100
@@ -206,14 +206,15 @@
   </p></div>
 
-<div class="submit">
-  <input id="save" name="save" type="submit" value="Save" />
+<div class="form-submit">
+  <p class="hints">
+  <strong>Important:</strong> By submitting content, you agree to release your contributions
+    under the <a href="http://opendatacommons.org/licenses/odbl/1.0/">Open Database License</a>. Please <strong>refrain</strong> from editing this page if you are <strong>not</strong> happy to do this.
+  </p>
+  <input id="save" class="pretty primary" name="save" type="submit" value="Save Changes" />
+  <input id="cancel" class="pretty" name="cancel" type="reset" value="Cancel" /></div>
 
-<p class="hints">
-<strong>Important:</strong> By submitting content, you agree to release your contributions
-  under the <a href="http://opendatacommons.org/licenses/odbl/1.0/">Open Database License</a>. Please <strong>refrain</strong> from editing this page if you are <strong>not</strong> happy to do this.
-</p></form>


http://bitbucket.org/okfn/ckan/changeset/9766b2e3bf3d/
changeset:   9766b2e3bf3d
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-07 11:49:00
summary:     [ux,package-new][m]: Flashing a notice on package create. Flash notices can now optionally contain HTML.
affected #:  4 files (754 bytes)

--- a/ckan/controllers/package.py	Tue Sep 06 19:50:19 2011 +0100
+++ b/ckan/controllers/package.py	Wed Sep 07 10:49:00 2011 +0100
@@ -347,6 +347,7 @@
 
         self._setup_template_variables(context, {'id': id})
         c.form = render(self.package_form, extra_vars=vars)
+
         return render('package/new.html')
 
 
@@ -497,6 +498,13 @@
         @param action - What the action of the edit was
         '''
         assert action in ('new', 'edit')
+        if action == 'new':
+            msg = _('Congratulations, your dataset has been created. ' \
+                    'You\'ll probably want to <a href="%s">upload or link ' \
+                    'some data</a> now.')
+            msg = msg % h.url_for(controller='package', action='edit',
+                    id=pkgname, anchor='resources')
+            h.flash_notice(msg,allow_html=True)
         url = request.params.get('return_to') or \
               config.get('package_%s_return_url' % action)
         if url:


--- a/ckan/lib/helpers.py	Tue Sep 06 19:50:19 2011 +0100
+++ b/ckan/lib/helpers.py	Wed Sep 07 10:49:00 2011 +0100
@@ -44,9 +44,10 @@
     * ``category``: the category specified when the message was created.
     """
 
-    def __init__(self, category, message):
+    def __init__(self, category, message, allow_html):
         self.category=category
         self.message=message
+        self.allow_html=allow_html
 
     def __str__(self):
         return self.message
@@ -54,7 +55,10 @@
     __unicode__ = __str__
 
     def __html__(self):
-        return escape(self.message)
+        if self.allow_html: 
+            return self.message
+        else:
+            return escape(self.message)
 
 class _Flash(object):
     
@@ -73,14 +77,14 @@
         if self.categories and self.default_category not in self.categories:
             raise ValueError("unrecognized default category %r" % (self.default_category,))
 
-    def __call__(self, message, category=None, ignore_duplicate=False):
+    def __call__(self, message, category=None, ignore_duplicate=False, allow_html=False):
         if not category:
             category = self.default_category
         elif self.categories and category not in self.categories:
             raise ValueError("unrecognized category %r" % (category,))
         # Don't store Message objects in the session, to avoid unpickling
         # errors in edge cases.
-        new_message_tuple = (category, message)
+        new_message_tuple = (category, message, allow_html)
         from pylons import session
         messages = session.setdefault(self.session_key, [])
         # ``messages`` is a mutable list, so changes to the local variable are
@@ -103,14 +107,14 @@
 
 _flash = _Flash()
 
-def flash_notice(message): 
-    _flash(message, category='notice')
+def flash_notice(message, allow_html=False): 
+    _flash(message, category='notice', allow_html=allow_html)
 
-def flash_error(message): 
-    _flash(message, category='error')
+def flash_error(message, allow_html=False): 
+    _flash(message, category='error', allow_html=allow_html)
 
-def flash_success(message): 
-    _flash(message, category='success')
+def flash_success(message, allow_html=False): 
+    _flash(message, category='success', allow_html=allow_html)
 
 # FIXME: shouldn't have to pass the c object in to this.
 def nav_link(c, text, controller, **kwargs):


--- a/ckan/public/css/style.css	Tue Sep 06 19:50:19 2011 +0100
+++ b/ckan/public/css/style.css	Wed Sep 07 10:49:00 2011 +0100
@@ -198,6 +198,12 @@
           border-radius: 15px; 
 }
 
+/* Notices */
+
+.notice a, .notice a:visited {
+  text-decoration: underline;
+}
+
 /* Hints */
 
 .hint {


--- a/ckan/templates/layout_base.html	Tue Sep 06 19:50:19 2011 +0100
+++ b/ckan/templates/layout_base.html	Wed Sep 07 10:49:00 2011 +0100
@@ -115,7 +115,7 @@
     <py:with vars="messages = list(h._flash.pop_messages())"><div class="class container flash-banner-box" py:if="len(messages)"><div class="flash-banner ${m.category}" py:for="m in messages">
-        ${m.message}
+        ${h.literal(m)}
       </div></div></py:with>


http://bitbucket.org/okfn/ckan/changeset/eae9db2878d4/
changeset:   eae9db2878d4
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-07 12:15:34
summary:     [ux,package-edit][s]: Glitchfix to #anchor urls on the edit page sometimes scrolling viewport. Lost some noscript degredation though.
affected #:  3 files (198 bytes)

--- a/ckan/controllers/package.py	Wed Sep 07 10:49:00 2011 +0100
+++ b/ckan/controllers/package.py	Wed Sep 07 11:15:34 2011 +0100
@@ -503,7 +503,7 @@
                     'You\'ll probably want to <a href="%s">upload or link ' \
                     'some data</a> now.')
             msg = msg % h.url_for(controller='package', action='edit',
-                    id=pkgname, anchor='resources')
+                    id=pkgname, anchor='section-resources')
             h.flash_notice(msg,allow_html=True)
         url = request.params.get('return_to') or \
               config.get('package_%s_return_url' % action)


--- a/ckan/public/scripts/application.js	Wed Sep 07 10:49:00 2011 +0100
+++ b/ckan/public/scripts/application.js	Wed Sep 07 11:15:34 2011 +0100
@@ -221,25 +221,29 @@
     });
   };
 
+  // Show/hide fieldset sections from the edit dataset form. 
   my.setupDatasetEditNavigation = function() {
 
     function showSection(sectionToShowId) {
       $('.dataset fieldset').hide();
       $('.dataset fieldset#'+sectionToShowId).show();
       $('.edit-form-navigation li a').removeClass('active');
-      $('.edit-form-navigation li a[href=#'+sectionToShowId+']').addClass('active');
+      $('.edit-form-navigation li a[href=#section-'+sectionToShowId+']').addClass('active');
       // Unfortunately, scrolls page (which we don't want). Would be a nice extra but not vital.
       // window.location.hash = sectionToShowId;
+      window.scroll(0,0);
     }
 
     // Set up initial form state
-    var initialSection = window.location.hash.slice(1) || 'basic-information';
+    // Prefix="#section-"
+    var initialSection = window.location.hash.slice(9) || 'basic-information';
     showSection(initialSection);
     
     // Adjust form state on click
     $('.edit-form-navigation li a').live('click', function(e) {
       var $el = $(e.target);
-      var showMe = $el.attr('href').slice(1);
+      // Prefix="#section-"
+      var showMe = $el.attr('href').slice(9);
       showSection(showMe);
       return false;
     });  


--- a/ckan/templates/package/edit.html	Wed Sep 07 10:49:00 2011 +0100
+++ b/ckan/templates/package/edit.html	Wed Sep 07 11:15:34 2011 +0100
@@ -18,11 +18,11 @@
     <li class="widget-container widget_text"><ul class="edit-form-navigation"><!-- One button for each fieldset -->
-        <li><a href="#basic-information">Basic Information</a></li>
-        <li><a href="#resources">Resources</a></li>
-        <li><a href="#groups">Groups</a></li>
-        <li><a href="#detail">Details</a></li>
-        <li><a href="#extras">Extras</a></li>
+        <li><a href="#section-basic-information">Basic Information</a></li>
+        <li><a href="#section-resources">Resources</a></li>
+        <li><a href="#section-groups">Groups</a></li>
+        <li><a href="#section-detail">Details</a></li>
+        <li><a href="#section-extras">Extras</a></li></ul></li></py:match>


http://bitbucket.org/okfn/ckan/changeset/6639d45967db/
changeset:   6639d45967db
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-07 12:19:47
summary:     [ux,tidy,css][s]: Homogeneous headers in style.css.
affected #:  1 file (67 bytes)

--- a/ckan/public/css/style.css	Wed Sep 07 11:15:34 2011 +0100
+++ b/ckan/public/css/style.css	Wed Sep 07 11:19:47 2011 +0100
@@ -688,9 +688,10 @@
   margin-right: 10px;
 }
 
-/**************************************
- * Edit Dataset Page
- *************************************/
+/* ===================== */
+/* = Edit Dataset Page = */
+/* ===================== */
+
 ul.edit-form-navigation {
   list-style-type: none;
   padding-left: 0;
@@ -744,9 +745,9 @@
   display: block;
 }
 
-/****************************************
-  * Mini Tabs
-  ***************************************/
+/* =============================== */
+/* = Mini-Tabs [Markdown Editor] = */
+/* =============================== */
 
 ul.tabs {
   margin-bottom: 5px;
@@ -781,9 +782,9 @@
 }
 
 
-/**************************************
- * Form Submit/Cancel
- **************************************/
+/* ================================== */
+/* = Twitter.Bootstrap Form Buttons = */
+/* ================================== */
 div.form-submit {
     background: #eee;
     padding: 20px;
@@ -800,7 +801,6 @@
     float: right;
 }
 
-/* Tugged this out of Twitter.Bootstrap css. Can we use a blueprint button plugin? */
 input.pretty {
     font: -webkit-small-control;
     -webkit-border-radius: 4px;


http://bitbucket.org/okfn/ckan/changeset/cf48e521e22a/
changeset:   cf48e521e22a
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-07 12:41:45
summary:     [ux,unit-tests][s]: Fixed unit tests to respect escaped HTML characters.
affected #:  1 file (12 bytes)

--- a/ckan/tests/functional/test_user.py	Wed Sep 07 11:19:47 2011 +0100
+++ b/ckan/tests/functional/test_user.py	Wed Sep 07 11:41:45 2011 +0100
@@ -534,7 +534,7 @@
         # comes back as a params like this:
         # e.g. /user/login?error=Error%20in%20discovery:%20Error%20fetching%20XRDS%20document:%20(6,%20%22Couldn't%20resolve%20host%20'mysite.myopenid.com'%22)
         res = self.app.get("/user/login?error=Error%20in%20discovery:%20Error%20fetching%20XRDS%20document:%20(6,%20%22Couldn't%20resolve%20host%20'mysite.myopenid.com'%22")
-        assert "Couldn't resolve host" in res, res
+        assert "Couldn't resolve host" in res, res
 
     ############
     # Disabled
@@ -609,7 +609,7 @@
         fv = res.forms['user-password-reset']
         fv['user'] = 'kittens'
         res = fv.submit()
-        assert '"kittens" matched several users' in res, res
+        assert '"kittens" matched several users' in res, res
         assert 'larry1' not in res, res
         assert 'larry2' not in res, res
 


http://bitbucket.org/okfn/ckan/changeset/e0e098e5ebaa/
changeset:   e0e098e5ebaa
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-07 12:58:54
summary:     [ux,package/view][s]: Stripping edit links from package/view.
affected #:  3 files (535 bytes)

--- a/ckan/public/css/style.css	Wed Sep 07 11:41:45 2011 +0100
+++ b/ckan/public/css/style.css	Wed Sep 07 11:58:54 2011 +0100
@@ -236,6 +236,14 @@
   background-color: #fff7c0;
 }
 
+tbody tr td.table-empty {
+  background: #f8f8f8;
+  border: 1px solid #eee;
+  font-style: italic;
+  color: #333;
+  font-size: 90%;
+}
+
 /* ============== */
 /* = Navigation = */
 /* ============== */


--- a/ckan/templates/layout_base.html	Wed Sep 07 11:41:45 2011 +0100
+++ b/ckan/templates/layout_base.html	Wed Sep 07 11:58:54 2011 +0100
@@ -113,8 +113,8 @@
       </header></div><py:with vars="messages = list(h._flash.pop_messages())">
-    <div class="class container flash-banner-box" py:if="len(messages)">
-      <div class="flash-banner ${m.category}" py:for="m in messages">
+    <div class="class container" py:if="len(messages)">
+      <div class="${m.category}" py:for="m in messages">
         ${h.literal(m)}
       </div></div>


--- a/ckan/templates/package/read_core.html	Wed Sep 07 11:41:45 2011 +0100
+++ b/ckan/templates/package/read_core.html	Wed Sep 07 11:58:54 2011 +0100
@@ -35,14 +35,9 @@
               <td property="dc:format">${res.get('format', '')}</td></tr></py:for>
-        <caption i18n:msg="">
-            If you know of another resource to add to this dataset such as a
-            CSV file, SPARQL end-point etc then please
-            <a href="${h.url_for(controller='package', action='edit', id=c.pkg.name)}"
-              class="action-resource-add"
-              >
-              add it to the list</a>.
-        </caption>
+        <py:if test="not len(c.pkg_dict.get('resources', []))">
+          <tr><td colspan="2" class="table-empty">(none)</td></tr>
+        </py:if></table></div>
 
@@ -74,10 +69,10 @@
           <td class="dataset-label" property="rdfs:label">${_(key)}</td><td class="dataset-details" property="rdf:value">${value}</td></tr>
+        <py:if test="not len(c.pkg_extras)">
+          <tr><td colspan="2" class="table-empty">(none)</td></tr>
+        </py:if></tbody>
-          <caption py:if="not c.is_preview and h.check_access('package_update',{'id':c.pkg.id})">
-              Something missing? ${h.subnav_link(c, 'Please help improve this page by adding more information', controller='package', action='edit', id=c.pkg.name)}.
-          </caption></table></div>
     


http://bitbucket.org/okfn/ckan/changeset/9069ed761923/
changeset:   9069ed761923
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-07 15:04:22
summary:     [ux,tidy,js][s]: Using locally-hosted fallback JS libraries in case internet connection fails (for jquery & ckanjs).
affected #:  2 files (242 bytes)

--- a/.hgignore	Wed Sep 07 11:58:54 2011 +0100
+++ b/.hgignore	Wed Sep 07 14:04:22 2011 +0100
@@ -27,6 +27,9 @@
 .noseids
 *~
 
+# local symlinks
+ckan/public/scripts/ckanjs.js
+
 # nosetest coverage output
 .coverage
 htmlcov/*


--- a/ckan/templates/layout_base.html	Wed Sep 07 11:58:54 2011 +0100
+++ b/ckan/templates/layout_base.html	Wed Sep 07 14:04:22 2011 +0100
@@ -40,8 +40,8 @@
   <link rel="stylesheet" href="${g.site_url}/css/forms.css" type="text/css" media="screen, print" /><script type="text/javascript" src="${g.site_url}/language.js"></script>
-  <script type="text/javascript" src="${g.site_url}/language.js"></script>
-  <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery/1.5.2/jquery.min.js"></script>
+  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
+  <!--script><![CDATA[window.jQuery || document.write("<script src='${g.site_url}/scripts/vendor/jquery/1.5.2/jquery.min.js'>\x3C/script>")]]></script--><script type="text/javascript" src="${g.site_url}/scripts/vendor/json2.js"></script><script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.tmpl/beta1/jquery.tmpl.js"></script><script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.cookie/jquery.cookie.min.js"></script>
@@ -54,6 +54,7 @@
   <script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.iframe-transport.js"></script><script type="text/javascript" src="${g.site_url}/scripts/vendor/jquery.fileupload/20110801/jquery.fileupload.js"></script><script type="text/javascript" src="https://raw.github.com/okfn/ckanjs/master/pkg/ckanjs.js"></script>
+  <!--script><![CDATA[window.CKAN.Client || document.write("<script src='${g.site_url}/scripts/ckanjs.js'>\x3C/script>")]]></script--><!-- finally our application js that sets everything up--><script type="text/javascript" src="${g.site_url}/scripts/application.js?lang=${c.locale}"></script>
 


http://bitbucket.org/okfn/ckan/changeset/185f342dd1bb/
changeset:   185f342dd1bb
branch:      feature-1294-ux-improvements-dataset
user:        zephod
date:        2011-09-07 15:12:33
summary:     [ux,package/edit][xs]: Enabled window.location.hash updating.
affected #:  1 file (115 bytes)

--- a/ckan/public/scripts/application.js	Wed Sep 07 14:04:22 2011 +0100
+++ b/ckan/public/scripts/application.js	Wed Sep 07 14:12:33 2011 +0100
@@ -229,9 +229,7 @@
       $('.dataset fieldset#'+sectionToShowId).show();
       $('.edit-form-navigation li a').removeClass('active');
       $('.edit-form-navigation li a[href=#section-'+sectionToShowId+']').addClass('active');
-      // Unfortunately, scrolls page (which we don't want). Would be a nice extra but not vital.
-      // window.location.hash = sectionToShowId;
-      window.scroll(0,0);
+      window.location.hash = 'section-'+sectionToShowId;
     }
 
     // Set up initial form state

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