You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/11/05 23:37:46 UTC

git commit: updated refs/heads/4.2 to 5721cfd

Updated Branches:
  refs/heads/4.2 0a1012817 -> 5721cfdc6


multiEdit: extend field hide/show functionality

-Support passing isHidden option as closure, for conditional hide/show
 based on context

-Adds new option format for isHidden option:

return false == show field and all columns (default)
return true == hide only header and form column
return 2 == hide header and form, as well as returned item column -- these
item columns will be skipped over entirely, not just hidden


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5721cfdc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5721cfdc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5721cfdc

Branch: refs/heads/4.2
Commit: 5721cfdc6b66557e8403fee7bc5a36fb6c6cae2c
Parents: 0a10128
Author: Brian Federle <br...@citrix.com>
Authored: Tue Nov 5 14:35:05 2013 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Tue Nov 5 14:37:31 2013 -0800

----------------------------------------------------------------------
 ui/scripts/network.js              |  6 ++++++
 ui/scripts/ui/widgets/multiEdit.js | 19 +++++++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5721cfdc/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index e5bd39b..9a343e1 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -3374,6 +3374,12 @@
                                                     requireValidation: true,
                                                     buttonLabel: 'label.configure',
                                                     action: cloudStack.uiCustom.autoscaler(cloudStack.autoscaler)
+                                                },
+                                                isHidden: function(args) {
+                                                    // return 2 == hide header and form, as well as returned item column
+                                                    // return 2;
+
+                                                    return false;
                                                 }
                                             },
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5721cfdc/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 5d973aa..79bb0d4 100755
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -85,6 +85,12 @@
                     return true;
                 }
 
+                var isHidden = $multi.find('th.' + fieldName).hasClass('always-hide');
+
+                if (isHidden) {
+                    return true;
+                }
+                
                 var $td = $('<td>').addClass(fieldName).appendTo($tr);
                 var $input, val;
                 var $addButton = $multi.find('form .button.add-vm:not(.custom-action)').clone();
@@ -264,7 +270,7 @@
 
                 // Align width to main header
                 _medit.refreshItemWidths($multi);
-
+                
                 if (data._hideFields &&
                     $.inArray(fieldName, data._hideFields) > -1) {
                     $td.addClass('disabled');
@@ -891,7 +897,16 @@
             $td.attr('rel', fieldName);
             $td.appendTo($inputForm);
 
-            if (field.isHidden) {
+            var isHidden = $.isFunction(field.isHidden) ?
+                    field.isHidden({ context: context }) : field.isHidden;
+
+            if (isHidden) {
+                // return true == hide only header and form column
+                // return 2 == hide header and form, as well as returned item column
+                if (isHidden === 2) {
+                    $th.addClass('always-hide');
+                }
+
                 $th.hide();
                 $td.hide();
             }