Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added #9. Added slideButtonDefaults config option

  • Loading branch information...
commit 34b4e687bdc5a0552d24c0bb8c64b07c6a0c1f04 1 parent bd9be08
@wnielson authored
Showing with 34 additions and 12 deletions.
  1. +1 −0  CHANGES
  2. +25 −9 app/view/Main.js
  3. +8 −3 ux/slidenavigation/View.js
View
1  CHANGES
@@ -1,6 +1,7 @@
0.2.1 (Development)
===================
* #7: Stop auto-focus of elements beneath slideButton.
+ * #9: Added `slideButtonDefaults` config option.
0.2.0 (Dec 10, 2012)
====================
View
34 app/view/Main.js
@@ -31,6 +31,15 @@ Ext.define("SlideNavigationExample.view.Main", {
* @since 0.2.0
*/
itemMask: true,
+
+ /**
+ * Define the default slide button config. Any item that has
+ * a `slideButton` value that is either `true` or a button config
+ * will use these values at the default.
+ */
+ slideButtonDefaults: {
+ selector: 'toolbar'
+ },
/**
* This allows us to configure how the actual list container
@@ -88,15 +97,10 @@ Ext.define("SlideNavigationExample.view.Main", {
items: [{
title: 'Item 1',
group: 'Group 1',
-
- /**
- * Here's an example of how we can add a button into
- * particular location. In this case, it'll be added into the
- * item's toolbar.
- */
- slideButton: {
- selector: 'toolbar'
- },
+
+ // Enable the slide button using the defaults defined above in
+ // `slideButtonDefaults`.
+ slideButton: true,
items: [{
xtype: 'toolbar',
title: 'Item 1',
@@ -177,6 +181,10 @@ Ext.define("SlideNavigationExample.view.Main", {
},{
title: 'Item 7',
group: 'Group 3',
+
+ // Explicitly disable `slideButton` (this is the default)
+ slideButton: false,
+
items: [{
xtype: 'toolbar',
title: 'Item 7',
@@ -188,6 +196,14 @@ Ext.define("SlideNavigationExample.view.Main", {
title: 'Item 8',
group: 'Group 3',
order: 0,
+
+ // Extend `slideButtonDefaults`
+ slideButton: {
+ iconMask: false,
+ iconCls: null,
+ text: 'menu'
+ },
+
items: [{
xtype: 'toolbar',
title: 'Item 8',
View
11 ux/slidenavigation/View.js
@@ -170,7 +170,10 @@ Ext.define('Ext.ux.slidenavigation.View', {
* open. This should be a valid CSS 'box-shadow' argument. Set to false to disable
* it.
*/
- shadowStyle: '0 0 4px 1px #999'
+ shadowStyle: '0 0 4px 1px #999',
+
+
+ slideButtonDefaults: {}
},
initConfig: function() {
@@ -204,7 +207,7 @@ Ext.define('Ext.ux.slidenavigation.View', {
// Default config values used for creating a slideButton.
- me.slideButtonDefaults = {
+ me._slideButtonConfig = {
xtype: 'button',
iconMask: true,
iconCls: 'more',
@@ -309,10 +312,12 @@ Ext.define('Ext.ux.slidenavigation.View', {
*/
createSlideButton: function(el, config) {
var me = this,
+ config = Ext.merge(me.getSlideButtonDefaults(),
+ Ext.isObject(config) ? config : {}),
parent = el.down(config.selector);
if (parent) {
- return parent.add(Ext.merge(me.slideButtonDefaults, config));
+ return parent.add(Ext.merge(me._slideButtonConfig, config));
}
return false;
Please sign in to comment.
Something went wrong with that request. Please try again.