Skip to content

Commit

Permalink
new BasemapGallery widget
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcgee committed Oct 31, 2016
1 parent d5801ca commit c426979
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ This JavaScript web app can be easily configured or used as a boilerplate/starti
![screen shot 2014-08-20 at 9 59 48 pm](https://cloud.githubusercontent.com/assets/661156/3991302/5aa2e0f2-28df-11e4-94d0-9c813937d933.png)

## Widgets Included:
- Base Maps
- Basemaps
- Basemaps Gallery
- Bookmarks
- Directions
- Draw
Expand Down
65 changes: 65 additions & 0 deletions viewer/js/gis/dijit/BasemapGallery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'dijit/_WidgetsInTemplateMixin',

'dojo/_base/lang',
'dojo/topic',

'esri/dijit/BasemapGallery',

'dojo/text!./BasemapGallery/templates/BasemapGallery.html',
'dojo/i18n!./BasemapGallery/nls/resource',

'dijit/layout/ContentPane',
'dijit/TitlePane',

'xstyle/css!./BasemapGallery/css/BasemapGallery.css'

], function (
declare,
_WidgetBase,
_TemplatedMixin,
_WidgetsInTemplateMixin,

lang,
topic,

BasemapGallery,

template,
i18n
) {

return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
widgetsInTemplate: true,
templateString: template,
i18n: i18n,
baseClass: 'cmvBasemapGalleryWidget',

galleryOptions: {
showArcGISBasemaps: true
},

postCreate: function () {
this.inherited(arguments);

var opts = lang.mixin({
map: this.map
}, this.galleryOptions || {});
this.basemapGallery = new BasemapGallery(opts, 'basemapGallery');
this.basemapGallery.startup();

this.basemapGallery.on('selection-change', lang.hitch(this, 'basemapSelected'));

this.basemapGallery.on('error', function (msg) {
topic.publish('viewer/handleError', 'basemap gallery error: ' + msg);
});
},

basemapSelected: function (/* basemap */) {
this.basemapGalleryTitlePane.set('open', false);
}
});
});
41 changes: 41 additions & 0 deletions viewer/js/gis/dijit/BasemapGallery/css/BasemapGallery.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.cmvBasemapGalleryWidget .dijitTitlePane {
border-radius: 4px;
}

.cmvBasemapGalleryWidget .dijitTitlePaneTitle {
border-color: #BBB;
padding: 4px;
}

.cmvBasemapGalleryWidget .dijitTitlePane .dijitArrowNode {
float: right;
padding-top: 3px;
}

.cmvBasemapGalleryWidget .dijitTitlePaneTextNode:before {
content: '\f009';
font-family: FontAwesome;
}

.cmvBasemapGalleryWidget .dijitTitlePaneContentOuter {
border-color: #BBB;
}

.cmvBasemapGalleryWidget .dijitTitlePaneContentInner {
padding: 0;
}

.cmvBasemapGalleryWidget .basemapGalleryContent {
height: 280px;
overflow:auto;
width: 410px;
}
.cmvBasemapGalleryWidget .esriBasemapGalleryNode {
margin: 5px 15px;
}

@media screen and (max-width: 767px) {
.cmvBasemapGalleryWidget .basemapGalleryContent {
width: 140px;
}
}
3 changes: 3 additions & 0 deletions viewer/js/gis/dijit/BasemapGallery/nls/es/resource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define ({
title: 'Mapas base'
});
3 changes: 3 additions & 0 deletions viewer/js/gis/dijit/BasemapGallery/nls/fr/resource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define ({
title: 'Fond de carte'
});
3 changes: 3 additions & 0 deletions viewer/js/gis/dijit/BasemapGallery/nls/pt-br/resource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define ({
title: 'Mapas base'
});
3 changes: 3 additions & 0 deletions viewer/js/gis/dijit/BasemapGallery/nls/pt-pt/resource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
define({
title: 'Mapas base'
});
9 changes: 9 additions & 0 deletions viewer/js/gis/dijit/BasemapGallery/nls/resource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
define ({
root: {
title: 'Basemaps'
},
'es': true,
'fr': true,
'pt-br': true,
'pt-pt': true
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div>
<div data-dojo-type="dijit/TitlePane" data-dojo-attach-point="basemapGalleryTitlePane" data-dojo-props="title:'${i18n.title}', open:false">
<div data-dojo-type="dijit/layout/ContentPane" class="basemapGalleryContent">
<div id="basemapGallery"></div>
</div>
</div>
</div>

0 comments on commit c426979

Please sign in to comment.