You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/07/02 17:09:17 UTC

[02/23] allura git commit: [#7884] ticket:799 Add new feature to the bottom

[#7884] ticket:799 Add new feature to the bottom


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

Branch: refs/heads/hs/7894
Commit: 3b97b254d42a778dea492f4c0196b29a1427ac5d
Parents: d91dd1d
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Jun 12 10:26:15 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Jun 29 18:04:51 2015 +0000

----------------------------------------------------------------------
 Allura/allura/ext/admin/widgets.py                            | 1 +
 Allura/allura/lib/widgets/form_fields.py                      | 2 ++
 .../lib/widgets/resources/js/sortable_repeated_field.js       | 7 ++++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3b97b254/Allura/allura/ext/admin/widgets.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/widgets.py b/Allura/allura/ext/admin/widgets.py
index 572db5d..9e6e39d 100644
--- a/Allura/allura/ext/admin/widgets.py
+++ b/Allura/allura/ext/admin/widgets.py
@@ -196,6 +196,7 @@ class MetadataAdmin(ff.AdminForm):
             empty_msg='No features yet',
             nonempty_msg='Drag and drop features to reorder. '
                          'Leave empty to delete a feature.',
+            append_to='bottom',
             button=ew.InputField(
                 css_class='add',
                 field_type='button',

http://git-wip-us.apache.org/repos/asf/allura/blob/3b97b254/Allura/allura/lib/widgets/form_fields.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/form_fields.py b/Allura/allura/lib/widgets/form_fields.py
index 7d94e47..be3fd1a 100644
--- a/Allura/allura/lib/widgets/form_fields.py
+++ b/Allura/allura/lib/widgets/form_fields.py
@@ -412,6 +412,7 @@ class SortableRepeatedMixin(JQueryMixin):
         'flist_cls',
         'stub_cls',
         'msg_cls',
+        'append_to',
     ]
     defaults = dict(
         container_cls='sortable-repeated-field',
@@ -419,6 +420,7 @@ class SortableRepeatedMixin(JQueryMixin):
         flist_cls='sortable-field-list',
         stub_cls='sortable-field-stub',
         msg_cls='sortable-field-message',
+        append_to='top',
         empty_msg='No fields have been defined',
         nonempty_msg='Drag and drop the fields to reorder',
         repetitions=0)

http://git-wip-us.apache.org/repos/asf/allura/blob/3b97b254/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js b/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
index 71006ad..ca78493 100644
--- a/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
+++ b/Allura/allura/lib/widgets/resources/js/sortable_repeated_field.js
@@ -25,6 +25,7 @@
         flist_cls:'sortable-field-list',
         stub_cls:'sortable-field-stub',
         msg_cls:'sortable-field-message',
+        append_to:'top',  // append new field to top by default. Also supports 'bottom'
     };
 
     $.fn.SortableRepeatedField = function(options) {
@@ -116,7 +117,11 @@
                         .replace(tpl_name, self.fld_name() + '-0'));
                 });
             $new_field.find('.hasDatepicker').removeClass('hasDatepicker');
-            self.data.$flist.prepend($new_field);
+            if (self.opts.append_to == 'top') {
+                self.data.$flist.prepend($new_field);
+            } else {
+                self.data.$flist.append($new_field);
+            }
             _renumberFields();
             _manageMessages();
             // Trigger event reattachment, etc.