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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="MapService Layer as Feature Layer w/ min/max scale hack" /> | |
<title>Create a Map</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> | |
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css"> | |
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> | |
<style> |
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
require(["esri/map", | |
"esri/layers/FeatureLayer", | |
"dojo/domReady!"], | |
function(Map, FeatureLayer) { | |
map = new Map("mapDiv", { | |
center: [-111.8, 40.7], | |
zoom: 3, | |
basemap: "gray" | |
}); |
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
{ | |
"data": [ | |
{ | |
"id": "fc3c6495a3734e41b176562deae87319_0", | |
"item_id": "fc3c6495a3734e41b176562deae87319", | |
"name": "Agences_Sites", | |
"description": "Agences Esri France (secteurs g??ographiques et localisation des agences)", | |
"url": "http://services.arcgis.com/d3voDfTFbHOCRwVR/arcgis/rest/services/Agences_ESRI_France_WM/FeatureServer/0", | |
"fields": [ | |
{ |
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
describe('loads itself from json', function () { | |
var model, fisherJson, json; | |
beforeEach(function() { | |
json = getJSONFixture('entities/Dataset/dataset.json'); | |
model = new Composer.Models.Dataset({id:'a0818dca49bf4d5badd7d2b0fcbb51c9_5'}); | |
model.loadFromJson(json); | |
}); | |
it('sets the version', function() { | |
expect(model.get('current_version')).toEqual(json.data.current_version); |
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
describe('loads itself from the service', function () { | |
beforeEach(function() { | |
json = getJSONFixture('entities/Dataset/dataset.json'); | |
var response = { | |
status: 200, | |
responseText: JSON.stringify(json) | |
}; | |
jasmine.Ajax.useMock(); | |
model = new Composer.Models.Dataset({id:json.data.id}); | |
model.fetch(); |
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
describe('constructor', function () { | |
it('throws without an id', function() { | |
//this is sligtly obtuse formatting, but expect() requires a function | |
//and new Something is not a function, so we wrap it. | |
expect(function(){var m = new Composer.Models.Dataset();}).toThrow(); | |
}); | |
it('does not throw with an id', function() { | |
var f = function(){ |
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
/** | |
* Wrapper that allows us to log pageviews | |
* in our SPA | |
*/ | |
logPageView: function(route){ | |
//check if google analytics is loaded | |
if(window.ga){ | |
//send the pageview details | |
ga('send','pageview', route); | |
} |
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
/** | |
* Wrapper to send Events to Google Analytics | |
* @param {string} action Action we are logging. lower-case | |
* @param {string} category standardized event categories | |
* @param {string} label optional description | |
*/ | |
logUiEvent: function(action, category, label){ | |
var lb = label || ''; | |
//check for google analytics | |
if(window.ga){ |
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
Composer.module('MapBarModule.Controls', function (Controls, App, Backbone, Marionette, $, _) { | |
//Controls item view | |
Controls.View = Backbone.Marionette.ItemView.extend({ | |
model: Controls.Model, | |
template: 'mapbar/controls/controls_view', | |
className: 'mapbar-controls', | |
events: { | |
"click .type": "_changeBasemap" | |
}, |