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/21 23:11:34 UTC
[65/69] [abbrv] git commit: updated refs/heads/ui-restyle to c05482b
List view: Support passing custom ID to detail view context
For section select list views, if 'id' is specied under section: {},
then use that ID instead of the section's key ID. This allows sections
to use i.e. the same ID as each other for a consistent context ID.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/285c0686
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/285c0686
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/285c0686
Branch: refs/heads/ui-restyle
Commit: 285c06865c92c5964b0e181c32bc390615172dce
Parents: b689e61
Author: Brian Federle <bf...@gmail.com>
Authored: Thu Nov 21 13:53:11 2013 -0800
Committer: Brian Federle <bf...@gmail.com>
Committed: Thu Nov 21 13:56:29 2013 -0800
----------------------------------------------------------------------
ui/scripts/ui/widgets/listView.js | 36 +++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/285c0686/ui/scripts/ui/widgets/listView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index 3fa8f54..53b37f1 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -1330,9 +1330,24 @@
var itemID = $tr.data('list-view-item-id');
var jsonObj = $tr.data('json-obj');
var $loading = $('<div>').addClass('loading-overlay').appendTo($detailsContainer);
+ var listViewArgs = $listView.data('view-args');
+ var listViewActiveSection = activeSection;
+ var targetSection;
if ($tr.hasClass('loading')) return;
+ if (listViewActiveSection != '_zone') {
+ if (listViewArgs.sections &&
+ listViewArgs.sections[listViewActiveSection] &&
+ listViewArgs.sections[listViewActiveSection].id) {
+ targetSection = listViewArgs.sections[listViewActiveSection].id;
+ } else {
+ targetSection = listViewActiveSection;
+ }
+ } else {
+ targetSection = detailViewArgs.section;
+ }
+
// Title
$title.append(
$('<span>').html(_l('label.quickview') + ': '),
@@ -1352,7 +1367,7 @@
if (!$quickViewTooltip.is(':visible')) return;
// Init detail view
- context[activeSection] = [jsonObj];
+ context[targetSection] = [jsonObj];
createDetailView({
data: $.extend(true, {}, detailView, {
onLoad: function($detailView) {
@@ -1998,13 +2013,24 @@
var listViewArgs = $listView.data('view-args');
+ var targetSection;
+
detailViewArgs.section = listViewArgs.activeSection ?
listViewArgs.activeSection : listViewArgs.id;
- detailViewArgs.context[
- listViewActiveSection != '_zone' ?
- listViewActiveSection : detailViewArgs.section
- ] = [jsonObj];
+ if (listViewActiveSection != '_zone') {
+ if (listViewArgs.sections &&
+ listViewArgs.sections[listViewActiveSection] &&
+ listViewArgs.sections[listViewActiveSection].id) {
+ targetSection = listViewArgs.sections[listViewActiveSection].id;
+ } else {
+ targetSection = listViewActiveSection;
+ }
+ } else {
+ targetSection = detailViewArgs.section;
+ }
+
+ detailViewArgs.context[targetSection] = [jsonObj];
if ($.isFunction(detailViewArgs.data)) {
detailViewArgs.data = detailViewArgs.data({