Skip to content

Commit

Permalink
API Add action tabsets as a interface idiom.
Browse files Browse the repository at this point in the history
Introduces the concept of action tabsets - usage of TabSet and Tabs
in between the action buttons to allow richer set of capabilities that
can be offered to the user.

Goes along with c8d0cdec99c95dbed3b58ebcc098cc9d22c58206 that implements
a change to the CMS actions.
  • Loading branch information
mateusz authored and chillu committed Dec 13, 2012
1 parent 236e335 commit fe08236
Show file tree
Hide file tree
Showing 30 changed files with 924 additions and 278 deletions.
227 changes: 154 additions & 73 deletions admin/css/screen.css

Large diffs are not rendered by default.

Binary file removed admin/images/btn-icon-s37c6548b54.png
Binary file not shown.
Binary file added admin/images/btn-icon-s97372285ea.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/images/btn-icon/disk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/images/link_arrows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed admin/images/sprites-32x32-se93fc83bf9.png
Binary file not shown.
Binary file added admin/images/sprites-32x32-sf6890c994e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/images/sprites-32x32/arrow_down_darker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/images/sprites-32x32/arrow_down_lighter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/images/sprites-32x32/arrow_up_darker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added admin/images/sprites-32x32/arrow_up_lighter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions admin/javascript/LeftAndMain.Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@

// Force initialization of certain UI elements to avoid layout glitches
this.find('.cms-tabset').redrawTabs();
this.find('.ss-ui-tabs-nav').redraw();

this._super();

},

redraw: function() {
Expand Down
12 changes: 8 additions & 4 deletions admin/javascript/LeftAndMain.EditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,18 @@
});

/**
* Hide tabs when only one is available
* Hide tabs when only one is available.
* Special case is actiontabs - tabs between buttons, where we want to have
* extra options hidden within a tab (even if only one) by default.
*/
$('.cms-edit-form .ss-tabset').entwine({
onmatch: function() {
var tabs = this.find("> ul:first");
if (!this.hasClass('ss-ui-action-tabset')) {
var tabs = this.find("> ul:first");

if(tabs.children("li").length == 1) {
tabs.hide().parent().addClass("ss-tabset-tabshidden");
if(tabs.children("li").length == 1) {
tabs.hide().parent().addClass("ss-tabset-tabshidden");
}
}

this._super();
Expand Down
24 changes: 12 additions & 12 deletions admin/javascript/LeftAndMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ jQuery.noConflict();
* Can be hooked into an ajax 'success' callback.
*/
handleAjaxResponse: function(data, status, xhr) {
var self = this, url, activeTabs, guessFragment;
var self = this, url, selectedTabs, guessFragment;

// Pseudo-redirects via X-ControllerURL might return empty data, in which
// case we'll ignore the response
Expand Down Expand Up @@ -571,19 +571,19 @@ jQuery.noConflict();
saveTabState: function() {
if(typeof(window.sessionStorage)=="undefined" || window.sessionStorage == null) return;

var activeTabs = [], url = this._tabStateUrl();
var selectedTabs = [], url = this._tabStateUrl();
this.find('.cms-tabset,.ss-tabset').each(function(i, el) {
var id = $(el).attr('id');
if(!id) return; // we need a unique reference
if(!$(el).data('tabs')) return; // don't act on uninit'ed controls
if($(el).data('ignoreTabState')) return; // allow opt-out
activeTabs.push({id:id, active:$(el).tabs('option', 'active')});
selectedTabs.push({id:id, selected:$(el).tabs('option', 'selected')});
});

if(activeTabs) {
if(selectedTabs) {
var tabsUrl = 'tabs-' + url;
try {
window.sessionStorage.setItem(tabsUrl, JSON.stringify(activeTabs));
window.sessionStorage.setItem(tabsUrl, JSON.stringify(selectedTabs));
} catch(err) {
if (err.code === DOMException.QUOTA_EXCEEDED_ERR && window.sessionStorage.length === 0) {
// If this fails we ignore the error as the only issue is that it
Expand All @@ -606,12 +606,12 @@ jQuery.noConflict();

var self = this, url = this._tabStateUrl(),
data = window.sessionStorage.getItem('tabs-' + url),
activeTabs = data ? JSON.parse(data) : false;
if(activeTabs) {
$.each(activeTabs, function(i, activeTab) {
var el = self.find('#' + activeTab.id);
selectedTabs = data ? JSON.parse(data) : false;
if(selectedTabs) {
$.each(selectedTabs, function(i, selectedTab) {
var el = self.find('#' + selectedTab.id);
if(!el.data('tabs')) return; // don't act on uninit'ed controls
el.tabs('option', 'active', activeTab.active);
el.tabs('select', selectedTab.selected);
});
}
},
Expand Down Expand Up @@ -1012,7 +1012,7 @@ jQuery.noConflict();
},
redrawTabs: function() {
this.rewriteHashlinks();

var id = this.attr('id'), activeTab = this.find('ul:first .ui-tabs-active');

if(!this.data('uiTabs')) this.tabs({
Expand All @@ -1025,7 +1025,7 @@ jQuery.noConflict();
activate: function(e, ui) {
// Usability: Hide actions for "readonly" tabs (which don't contain any editable fields)
var actions = $(this).closest('form').find('.Actions');
if($(ui.tab).closest('li').hasClass('readonly')) {
if($(ui.newTab).closest('li').hasClass('readonly')) {
actions.fadeOut();
} else {
actions.show();
Expand Down
10 changes: 5 additions & 5 deletions admin/javascript/ssui.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@
}

// Create missing elements.
if (this.options.alternate.text) {
this.buttonElement.append(
"<span class='ui-button-text-alternate ui-button-text'>" + this.options.alternate.text + "</span>"
);
}
if (this.options.alternate.icon) {
this.buttonElement.append(
"<span class='ui-button-icon-alternate ui-button-icon-primary ui-icon btn-icon-"
+ this.options.alternate.icon + "'></span>"
);
}
if (this.options.alternate.text) {
this.buttonElement.append(
"<span class='ui-button-text-alternate ui-button-text'>" + this.options.alternate.text + "</span>"
);
}

this._refreshAlternate();
},
Expand Down
Loading

0 comments on commit fe08236

Please sign in to comment.