-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/mobile sidebar #726
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
152106f
add the new _Sidebar mixin.
tmcgee 67014f3
move positioning of mapOverlay divs to css file easier configuration.
tmcgee 5d6ebd5
detect touch devices before the config is loaded.
tmcgee 6d792b6
Add nls for Search widget.
tmcgee 5269f53
document the options for mobile sidebar
tmcgee c2e6085
remove dynamic requires.
tmcgee bf96ff8
return this.inherited
tmcgee 836ab88
CSS refinements
tmcgee 1f18a31
revert to dynamic require so sidebar css doesn't imact non-sidebar co…
tmcgee 0ff16c1
change mixin order
tmcgee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
define([ | ||
'dojo/_base/declare', | ||
'dojo/_base/lang', | ||
'dojo/dom', | ||
'dojo/sniff', | ||
'dojo/Deferred', | ||
'module', | ||
|
||
'put-selector' | ||
|
||
], function ( | ||
declare, | ||
lang, | ||
dom, | ||
has, | ||
Deferred, | ||
module, | ||
|
||
put, | ||
|
||
Sidebar | ||
) { | ||
|
||
return declare(null, { | ||
|
||
postConfig: function () { | ||
this.config.layout = this.config.layout || {}; | ||
this._checkForSidebarLayout(); | ||
|
||
if (this.config.layout.sidebar) { | ||
this.inherited(arguments); | ||
this.config.panes = this.mixinDeep(this.config.panes || {}, { | ||
left: { | ||
collapsible: false, | ||
style: 'display:none !important' | ||
} | ||
}); | ||
var deferred = new Deferred(); | ||
require([ | ||
module.uri.substring(0, module.uri.lastIndexOf('/')) + '/sidebar/Sidebar.js' | ||
], lang.hitch(this, function (sidebar) { | ||
Sidebar = sidebar; | ||
this.mapDeferred.then(lang.hitch(this, '_createSidebar')); | ||
deferred.resolve(); | ||
})); | ||
return deferred; | ||
} | ||
return this.inherited(arguments); | ||
}, | ||
|
||
_checkForSidebarLayout: function () { | ||
var sidebar = this.config.layout.sidebar; | ||
|
||
switch (sidebar) { | ||
// all devices | ||
case true: | ||
break; | ||
|
||
// no devices | ||
case false: | ||
break; | ||
|
||
// tablets and phones | ||
case 'mobile': | ||
if (has('mobile')) { | ||
sidebar = true; | ||
} | ||
break; | ||
|
||
// phones | ||
case 'phone': | ||
if (has('phone')) { | ||
sidebar = true; | ||
} | ||
break; | ||
default: | ||
// perhaps they've configured something we don't expect | ||
if (typeof(sidebar) === 'string') { | ||
if (has(sidebar)) { | ||
sidebar = true; | ||
} | ||
// default is just for phones | ||
} else if (has('phone')) { | ||
sidebar = true; | ||
} | ||
break; | ||
} | ||
this.config.layout.sidebar = sidebar; | ||
}, | ||
|
||
_createSidebar: function () { | ||
var mapContainer = dom.byId(this.map.id); | ||
//create controls div | ||
var mapControlsNode = put(this.map.root, 'div.sidebar-map'); | ||
//move the slider into the controls div | ||
put(mapControlsNode, '>', this.map._slider); | ||
//create sidebar | ||
this.sidebar = new Sidebar({ | ||
map: this.map, | ||
mapContainer: mapContainer, | ||
collapseSyncNode: mapControlsNode | ||
}, put(this.map.root, 'div')); | ||
this.sidebar.startup(); | ||
|
||
this._createTitlePaneWidget = this._createTabPaneWidget; | ||
}, | ||
|
||
_createTabPaneWidget: function (parentId, widgetConfig) { | ||
var tabOptions = widgetConfig.tabOptions || { | ||
id: parentId, | ||
title: widgetConfig.title, | ||
iconClass: widgetConfig.iconClass | ||
}; | ||
|
||
var tab = this.sidebar.createTab(tabOptions); | ||
tab.contentNode = put(tab.containerNode, 'div.sidebar-widget div.sidebar-widget-content'); | ||
|
||
var node = put(tab.contentNode, 'div'); | ||
widgetConfig.type = 'domNode'; | ||
widgetConfig.srcNodeRef = node; | ||
this.createWidgets([ | ||
{ | ||
options: widgetConfig | ||
} | ||
]); | ||
} | ||
|
||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized, this doesn't but should call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does on line 89. Is that not correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! yes, I just couldn't see it. I'm still figuring out how this review tool works...