allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [4/7] allura git commit: [#7884] ticket:799 Add new feature to the bottom
Date Mon, 29 Jun 2015 18:07:57 GMT
[#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/master
Commit: 3b97b254d42a778dea492f4c0196b29a1427ac5d
Parents: d91dd1d
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Fri Jun 12 10:26:15 2015 +0000
Committer: Dave Brondsema <dbrondsema@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.


Mime
View raw message