Skip to content

Commit 8978f8c

Browse files
committed
Browser widget: Modify behavior
-For better screen real-estate, make all browser panes open to full width of content area by default, unless partial: true is passed in options -Remove animation effect, for quicker browsing
1 parent c2151ee commit 8978f8c

2 files changed

Lines changed: 20 additions & 33 deletions

File tree

‎ui/scripts/ui/widgets/cloudBrowser.js‎

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
*/
9696
width: function($container, options) {
9797
options = options ? options : {};
98-
var width = $container.find('div.panel').size() < 1 || options.maximized == true ?
98+
var width = $container.find('div.panel').size() < 1 || !options.partial ?
9999
$container.width() : $container.width() - $container.width() / 4;
100100

101101
return width;
@@ -105,7 +105,7 @@
105105
* Get left position
106106
*/
107107
position: function($container, options) {
108-
return $container.find('div.panel').size() <= 1 || options.maximized == true ?
108+
return $container.find('div.panel').size() <= 1 || !options.partial ?
109109
0 : _panel.width($container, options) - _panel.width($container, options) / 1.5;
110110
},
111111

@@ -160,16 +160,14 @@
160160
var $panel = $('<div>').addClass('panel').css({
161161
position: 'absolute',
162162
width: _panel.width($container, {
163-
maximized: options.maximized
163+
partial: options.partial
164164
}),
165165
zIndex: _panel.topIndex($container)
166166
}).append(
167167
// Shadow
168168
$('<div>').addClass('shadow')
169169
).append(options.data);
170170

171-
if (options.maximized) $panel.addClass('always-maximized');
172-
173171
return $panel;
174172
}
175173
};
@@ -195,12 +193,10 @@
195193
var $toRemove = _panel.higher($container, $panel);
196194
var complete = args.complete;
197195

198-
if ($panel.hasClass('maximized')) return false;
199-
200196
_breadcrumb.filter($toRemove).remove();
201197
_breadcrumb.filter($panel.siblings()).removeClass('active');
202198
_breadcrumb.filter($panel).addClass('active');
203-
_breadcrumb.filter($('div.panel')).find('span').animate({
199+
_breadcrumb.filter($('div.panel')).find('span').css({
204200
opacity: 1
205201
});
206202
_breadcrumb.filter(
@@ -209,7 +205,7 @@
209205
.addClass('reduced')
210206
).removeClass('active maximized');
211207

212-
$toRemove.animate(
208+
$toRemove.css(
213209
_panel.initialState($container), {
214210
duration: 500,
215211
complete: function() {
@@ -220,7 +216,7 @@
220216
}
221217
);
222218
$toShow.show();
223-
$panel.animate({
219+
$panel.css({
224220
left: _panel.position($container, {
225221
maximized: $panel.hasClass('always-maximized')
226222
})
@@ -241,25 +237,18 @@
241237
_breadcrumb.filter($panel).removeClass('maximized');
242238
$panel.removeClass('maximized');
243239
$panel.addClass('reduced');
244-
_breadcrumb.filter($panel.siblings()).find('span').animate({
240+
_breadcrumb.filter($panel.siblings()).find('span').css({
245241
opacity: 1
246242
});
247-
$toHide.animate({
243+
$toHide.css({
248244
left: _panel.position($container, {})
249-
}, {
250-
duration: 500
251245
});
252246
$shadow.show();
253247
} else {
254248
_breadcrumb.filter($panel).addClass('maximized');
255249
$panel.removeClass('reduced');
256250
$panel.addClass('maximized');
257-
_breadcrumb.filter($panel.siblings()).find('span').animate({
258-
opacity: 0.5
259-
});
260-
$toHide.animate(_panel.initialState($container), {
261-
duration: 500
262-
});
251+
$toHide.css(_panel.initialState($container));
263252
$shadow.hide();
264253
}
265254
},
@@ -275,7 +264,7 @@
275264

276265
// Create panel
277266
$panel = _panel.create(this.element, {
278-
maximized: args.maximizeIfSelected,
267+
partial: args.partial,
279268
data: args.data
280269
});
281270

@@ -315,7 +304,8 @@
315304

316305
// Panel slide-in
317306
targetPosition = _panel.position($container, {
318-
maximized: args.maximizeIfSelected
307+
maximized: args.maximizeIfSelected,
308+
partial: args.partial
319309
});
320310
if (!$panel.index()) {
321311
// Just show immediately if this is the first panel
@@ -325,20 +315,16 @@
325315
if (args.complete) args.complete($panel, _breadcrumb.filter($panel));
326316
} else {
327317
// Animate slide-in
328-
$panel.animate({
318+
$panel.css({
329319
left: targetPosition
330-
}, {
331-
duration: duration,
332-
easing: 'easeOutCirc',
333-
complete: function() {
334-
// Hide panels
335-
$panel.siblings().filter(function() {
336-
return $(this).width() == $panel.width();
337-
});
320+
});
338321

339-
if ($panel.is(':visible') && args.complete) args.complete($panel);
340-
}
322+
// Hide panels
323+
$panel.siblings().filter(function() {
324+
return $(this).width() == $panel.width();
341325
});
326+
327+
if ($panel.is(':visible') && args.complete) args.complete($panel);
342328
};
343329

344330
return $panel;

‎ui/scripts/ui/widgets/treeView.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
$treeView.find('li .name').removeClass('selected');
111111
$target.addClass('selected');
112112
$browser.cloudBrowser('addPanel', {
113+
partial: true,
113114
title: $target.html(),
114115
data: '',
115116
parent: $treeView.closest('div.panel'),

0 commit comments

Comments
 (0)