{"version":3,"sources":["Config.js","ProfileApp.js","ProfileRouter.js","DataResponseModel.js","SelectorsModel.js","FacebookUrlView.js","NoTableDataView.js","PageTitleView.js","ProfileView.js","RawDataHrefView.js","SelectorsView.js"],"names":["window","nspace","Config","getCellWidth","cell","availableDataPrimitives","actualDataFormats","colSpan","primitiveId","_","any","dataFormat","each","value","key","actualDataFormat","keys","dataFormats","length","shouldShowTable","actualDataPrimitives","i","primitive","availablePrimitiveKeys","animationOptions","off","duration","on","featureSelectors",".notes-definitions-sources","id","$el","options","slideDown","slideUp",".change-table","fadeIn","hide","changeImages","arrowUrls","up","alt","Worse","Better","Neutral","down","noChange","url","$","ns","ProfileApp","self","this","locationTypeId","dispatcher","router","ProfileRouter","model","ccc","profileSelection","IndicatorSelectionModel","treeView","IndicatorSelectionTreeView","el","locationsButtonView","IndicatorSelectionButtonsView","indicatorCheckboxView","IndicatorSelectionCheckboxView","createProfileButtonView","IndicatorSelectionCreateProfileView","windowshadeView","viz","shared","views","WindowshadeView","initialRenderPromise","Deferred","once","resolve","prototype","start","Backbone","history","clone","Events","jQuery","sharedNs","routers","VizRouterBase","extend","initialize","bindAll","routes","",":locationId",":locationId/:locationSlug",":locationId/:locationSlug/:locationTypeId",":locationId/:locationSlug/:locationTypeId/:indicatorIds",":locationId/:locationSlug/:locationTypeId/:indicatorIds/:dataTypeIds",":locationId/:locationSlug/:locationTypeId/:indicatorIds/:dataTypeIds/:otherFeatureIds","initializeViews","locationId","locationSlug","indicatorIds","dataTypeIds","otherFeatureIds","actualLocationId","actualLocationSlug","actualIndicatorIds","getValue","raw","availableLocations","defaultLocationId","defaultLocationSlug","defaultIndicatorId","selectorsModel","models","SelectorsModel","getArrayFromModelProperty","dataModel","DataResponseModel","dataUrl","loadingSpinner","LoadingSpinnerView","selectorsView","SelectorsView","selectorUrl","selectorData","indicators","get","toString","profileView","ProfileView","rawDataHrefView","RawDataHrefView","pageTitleView","PageTitleView","noTableDataView","NoTableDataView","facebookUrlView","FacebookUrlView","completeRouterInitialization","getValueOrDefault","val","routeUrlParts","getStringFromArrayProperty","initializeModelListeners","updateUrl","getDataResponseOnChange","getDataResponse","getFilterString","params","filterStringNvc","util","UrlParams","velir","collections","NameValueCollection","add","indicator","location","toQueryString","getDataParams","filterString","propNames","View","render","urlParts","nvc","pageTitle","attr","split","fromQueryString","filter","selectorInfo","locations","locationItem","name","setValue","NoDataView","templateSelector","document","title","config","profile","featuresRenderPromise","toggleFeatures","events","click .top","scrollToTop","scrollTo","getInitialRenderPromise","getFeatureInitialRenderPromise","loadTemplate","template","$tmpl","html","renderPromise","areModelArraysValid","when","done","tableMarkup","getTable","features","selector","state","response","introduceDataFormatText","data","availableDataFormats","indicatorTables","formatKeys","formatValues","formatKey","map","splice","join","dataFormatText","indicatorGroupsIds","indicatorGroupId","uniq","selectorNs","initializeView","instances","updateDataSummary","initializeSelectors","headerSelectors","locationSelectorView","SingleLocationSelectorView","summarySelectors","dataTypeSelectorView","MultipleDataTypeSelectorView","otherFeaturesSelectorView","OtherFeaturesSelectorView","indicatorJumpSelectorView","IndicatorJumpSelectorView","summaryText","getIndicatorText","getDataSummaryText","getLocationTypeText","text","indicatorLength","parent","renderSelectors","locationInfo","dataTypeInfo","shapeLocations","shapeDataTypes","locationType","selectors","indicatorGroup","indicatorId","dataFormatName"],"mappings":"aAQOA,OAAOC,OAAO,0BAEhBC,OAAS,CAIVC,aAAc,SAASC,EAAMC,EAAyBC,GACpD,IAAIC,EAKJ,OAHAA,EAAU,EAGLH,EAAKI,YAiBmB,MAAzBF,EAAkB,GACb,EAGaG,EAAEC,IAAIJ,EAAmB,SAASK,GACtD,OAAQA,IAAgBP,EAAKI,cAKtB,EAGF,MA7BLC,EAAEG,KAAKP,EAAyB,SAASQ,EAAOC,GACjB,MAAzBR,EAAkB,GAKtBG,EAAEG,KAAKN,EAAmB,SAASS,IAC5BD,IAASC,IACZR,GAAWE,EAAEO,KAAKH,EAAMI,aAAaC,UANvCX,GAAWE,EAAEO,KAAKH,E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C7B,KACAjL,KAAK2L,sBACL,sBAEF/L,EAAE,+BAA+BgM,KAAKJ,IAGxCC,iBAAkB,WAChB,IAAII,EAGJ,OADAA,EAAkB7L,KAAK0H,aAAa9C,WAAW9G,QAG7C,cACqB,IAApB+N,EAAwB,IAAM,IAC/B,MAIJF,oBAAqB,WACnB,OAAO3L,KAAK0H,aAAaC,UAAU,GAAGmE,OAAOjE,KAAO,MAGtDkE,gBAAiB,SAASrE,GACxB,IAAIsE,EAAcC,EAElBD,EAAehM,KAAKkM,eAAexE,GACnC1H,KAAK+K,qBAAqB7D,OAAO8E,GAEjCC,EAAejM,KAAKmM,eAAezE,GACnC1H,KAAKkL,qBAAqBhE,OAAO+E,GAEjCjM,KAAKoL,0BAA0BlE,OAAO,CACpCqC,SAAU,CACR,CACE7K,GAAI,6BACJmJ,KAAM,4BAER,CACEnJ,GAAI,wBACJmJ,KAAM,4BAKZ7H,KAAKsL,0BAA0BpE,OAAOQ,IAGxCwE,eAAgB,SAASxE,GAKvB,MAAO,CACL0E,aAHa1E,EAAaC,UAAU,GAAGmE,OAIvCnE,UAAWD,EAAaC,YAI5BwE,eAAgB,SAASzE,GACvB,IAAI7J,EAoBJ,OAlBAA,EAAc,GAEdR,EAAEG,KAAKkK,EAAa2E,UAAW,SAASC,EAAgBC,GACtDlP,EAAEG,KAAK8O,EAAezO,YAAa,SAASN,GACtCM,EAAYN,EAAWsK,QAG3BhK,EAAYN,EAAWsK,MAAQtK,OAW5B,CAAEM,YAPgBR,EAAE6M,IAAIrM,EAAa,SAC1CN,EACAiP,GAEA,OAAOjP,QA9Hf,CAoIG0E,OAAQ5E","file":"profile-generated.js","sourcesContent":["/// \r\n/// \r\n\r\n(function() {\r\n \"use strict\";\r\n\r\n var ns;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.config\");\r\n\r\n ns.Config = {\r\n /**\r\n * Gets what the colSpan should be for various types of cells.\r\n */\r\n getCellWidth: function(cell, availableDataPrimitives, actualDataFormats) {\r\n var colSpan, primitiveIsSelected;\r\n\r\n colSpan = 0;\r\n\r\n // A non data cell.\r\n if (!cell.primitiveId) {\r\n _.each(availableDataPrimitives, function(value, key) {\r\n if (actualDataFormats[0] === \"a\") {\r\n colSpan += _.keys(value.dataFormats).length;\r\n return;\r\n }\r\n\r\n _.each(actualDataFormats, function(actualDataFormat) {\r\n if (+key === +actualDataFormat) {\r\n colSpan += _.keys(value.dataFormats).length;\r\n }\r\n });\r\n });\r\n return colSpan;\r\n }\r\n\r\n // All data formats are selected.\r\n if (actualDataFormats[0] === \"a\") {\r\n return 1;\r\n }\r\n\r\n primitiveIsSelected = _.any(actualDataFormats, function(dataFormat) {\r\n return +dataFormat === +cell.primitiveId;\r\n });\r\n\r\n // This cell's data format is selected.\r\n if (primitiveIsSelected) {\r\n return 1;\r\n }\r\n\r\n return null;\r\n },\r\n\r\n /**\r\n * Determines whether a given set of indicator tables should be shown given the available data types and what the user has selected.\r\n */\r\n shouldShowTable: function(availableDataPrimitives, actualDataPrimitives) {\r\n var i, primitive, availablePrimitiveKeys, primitiveInCollection;\r\n\r\n if (actualDataPrimitives[0] === \"a\") {\r\n return true;\r\n }\r\n\r\n availablePrimitiveKeys = _.keys(availableDataPrimitives);\r\n\r\n for (i = 0; i < actualDataPrimitives.length; i++) {\r\n primitive = +actualDataPrimitives[i];\r\n\r\n primitiveInCollection = _.any(availablePrimitiveKeys, function(key) {\r\n return +key === primitive;\r\n });\r\n\r\n if (primitiveInCollection) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n },\r\n\r\n /**\r\n * If the table hasn't been fully rendered yet, no need to animate the showing of the notes and definitions, so\r\n * when off, use a duration of 0 to trigger an immediate hide - otherwise, animate the display change.\r\n */\r\n animationOptions: {\r\n off: { duration: 0 },\r\n on: { duration: 400 }\r\n },\r\n\r\n /**\r\n * A mapping of features to animations.\r\n */\r\n featureSelectors: {\r\n \".notes-definitions-sources\": {\r\n id: 1,\r\n on: function($el, options) {\r\n $el.slideDown(options);\r\n },\r\n off: function($el, options) {\r\n $el.slideUp(options);\r\n }\r\n },\r\n \".change-table\": {\r\n id: 2,\r\n on: function($el, options) {\r\n $el.fadeIn(options);\r\n },\r\n off: function($el, options) {\r\n $el.hide();\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * A mapping of LargerValuesAre to images.\r\n * TODO: merge with mapping in SelectedRegionTableView?\r\n */\r\n changeImages: {\r\n arrowUrls: {\r\n up: {\r\n alt: \"Higher\",\r\n Worse: \"/images/change/change-red-up.png\",\r\n Better: \"/images/change/change-green-up.png\",\r\n Neutral: \"/images/change/change-gray-up.png\"\r\n },\r\n down: {\r\n alt: \"Lower\",\r\n Worse: \"/images/change/change-green-down.png\",\r\n Better: \"/images/change/change-red-down.png\",\r\n Neutral: \"/images/change/change-gray-down.png\"\r\n },\r\n noChange: {\r\n alt: \"No Change\",\r\n url: \"/images/change/no-change.png\"\r\n }\r\n }\r\n }\r\n };\r\n})();\r\n","/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function($, _) {\r\n \"use strict\";\r\n var ns;\r\n\r\n ns = window.nspace(\"ccc.viz.profile\");\r\n\r\n /**\r\n * The main visualization application class\r\n * @param options A configuration object.\r\n */\r\n ns.ProfileApp = function(options) {\r\n var self = this;\r\n\r\n if (!options) {\r\n throw \"A configuration object needs to be passed when constructing.\";\r\n }\r\n\r\n if (!options.locationTypeId) {\r\n throw \"A locationTypeId needs to be passed in the configuration object.\";\r\n }\r\n\r\n options.dispatcher = ns.ProfileApp.dispatcher;\r\n\r\n // Init the router\r\n this.router = new ns.ProfileRouter(options);\r\n\r\n this.model = new window.ccc.profileSelection.IndicatorSelectionModel();\r\n\r\n // Init the indictor selection view\r\n this.treeView = new window.ccc.profileSelection.IndicatorSelectionTreeView({\r\n model: this.model,\r\n el: \".location-profile-landing\"\r\n });\r\n this.locationsButtonView = new window.ccc.profileSelection.IndicatorSelectionButtonsView(\r\n {\r\n model: this.model,\r\n el: \".location-profile-landing\"\r\n }\r\n );\r\n this.indicatorCheckboxView = new window.ccc.profileSelection.IndicatorSelectionCheckboxView(\r\n {\r\n model: this.model,\r\n el: \".location-profile-landing\"\r\n }\r\n );\r\n this.createProfileButtonView = new window.ccc.profileSelection.IndicatorSelectionCreateProfileView(\r\n {\r\n model: this.model,\r\n el: \".location-profile-landing .customize-profile\"\r\n }\r\n );\r\n this.windowshadeView = new window.ccc.viz.shared.views.WindowshadeView({\r\n model: this.model\r\n });\r\n\r\n this.initialRenderPromise = $.Deferred();\r\n\r\n ns.ProfileApp.dispatcher.once(\"initial-render-complete\", function() {\r\n self.initialRenderPromise.resolve();\r\n });\r\n };\r\n\r\n /**\r\n * ProfileApp Prototype\r\n */\r\n (function(proto) {\r\n proto.start = function() {\r\n // Start Backbone's history tracking\r\n window.Backbone.history.start();\r\n };\r\n })(ns.ProfileApp.prototype);\r\n\r\n /**\r\n * Global \"static\" ProfileApp event dispatcher\r\n */\r\n ns.ProfileApp.dispatcher = _.clone(Backbone.Events);\r\n})(jQuery, _);\r\n","/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function(_) {\r\n var ns, sharedNs;\r\n\r\n ns = window.nspace(\"ccc.viz.profile\");\r\n sharedNs = window.nspace(\"ccc.viz.shared\");\r\n\r\n ns.ProfileRouter = sharedNs.routers.VizRouterBase.extend({\r\n initialize: function(options) {\r\n var self;\r\n\r\n self = this;\r\n\r\n _.each(options, function(value, key) {\r\n self[key] = value;\r\n });\r\n\r\n _.bindAll(this);\r\n },\r\n\r\n routes: {\r\n \"\": \"initializeViews\",\r\n \":locationId\": \"initializeViews\",\r\n \":locationId/:locationSlug\": \"initializeViews\",\r\n \":locationId/:locationSlug/:locationTypeId\": \"initializeViews\",\r\n \":locationId/:locationSlug/:locationTypeId/:indicatorIds\":\r\n \"initializeViews\",\r\n \":locationId/:locationSlug/:locationTypeId/:indicatorIds/:dataTypeIds\":\r\n \"initializeViews\",\r\n \":locationId/:locationSlug/:locationTypeId/:indicatorIds/:dataTypeIds/:otherFeatureIds\":\r\n \"initializeViews\"\r\n },\r\n\r\n /**\r\n * This method will only ever be invoked a single time, so use it to initialize\r\n * the model/view classes and trigger the initial rendering\r\n */\r\n initializeViews: function(\r\n locationId,\r\n locationSlug,\r\n locationTypeId,\r\n indicatorIds,\r\n dataTypeIds,\r\n otherFeatureIds\r\n ) {\r\n var actualLocationId, actualLocationSlug, actualIndicatorIds;\r\n\r\n //// MODELS ////\r\n\r\n // Location and Indicator have defaults set on the server, so we can\r\n // fall back to these in case the route is null when we generate our\r\n // initial data requests.\r\n actualLocationId = this.availableLocations[locationId]\r\n ? locationId\r\n : this.defaultLocationId;\r\n actualLocationSlug =\r\n this.availableLocations[locationId] || this.defaultLocationSlug;\r\n actualIndicatorIds = indicatorIds || this.defaultIndicatorId;\r\n\r\n function getValue(raw) {\r\n if (raw === \"a\") {\r\n return null;\r\n }\r\n return raw;\r\n }\r\n\r\n // Create the selectors model, which represents anything that is selectable by the user and tracked in the URL\r\n this.selectorsModel = new ns.models.SelectorsModel({\r\n locationId: getValue(actualLocationId),\r\n locationSlug: getValue(actualLocationSlug),\r\n locationTypeId: getValue(this.locationTypeId),\r\n indicatorIds: this.getArrayFromModelProperty(actualIndicatorIds),\r\n dataTypeIds: this.getArrayFromModelProperty(dataTypeIds),\r\n otherFeatureIds: !otherFeatureIds\r\n ? [\"a\"]\r\n : this.getArrayFromModelProperty(otherFeatureIds)\r\n });\r\n\r\n // Create the data response model, the model that is responsible for querying the server-side for data,\r\n // storing the response, and triggering updates to other views after the response has been retrieved\r\n this.dataModel = new ns.models.DataResponseModel({\r\n selectorsModel: this.selectorsModel,\r\n dispatcher: this.dispatcher,\r\n dataUrl: \"/api/ProfileData/GetProfileData\"\r\n });\r\n\r\n //// VIEWS ////\r\n\r\n this.views = {\r\n // Loading spinner (no model required)\r\n loadingSpinner: new sharedNs.views.LoadingSpinnerView({\r\n dispatcher: this.dispatcher\r\n }),\r\n\r\n // Selectors. These must be instantiated late, since these views are used to bootstrap\r\n // the selectors model values, and certain other views need to hear when the selectors model changes.\r\n selectorsView: new ns.views.SelectorsView({\r\n model: this.selectorsModel,\r\n locationTypeId: this.locationTypeId,\r\n dispatcher: this.dispatcher,\r\n selectorUrl: \"/api/selectors/GetSelectorInfoByIndicatorId\",\r\n selectorData: {\r\n indicators: this.selectorsModel.get(\"indicatorIds\").toString(),\r\n locationTypeId: this.selectorsModel.get(\"locationTypeId\")\r\n }\r\n }),\r\n\r\n profileView: new ns.views.ProfileView({\r\n selectorsModel: this.selectorsModel,\r\n model: this.dataModel,\r\n el: \"#data-table-container\"\r\n }),\r\n\r\n rawDataHrefView: new ns.views.RawDataHrefView({\r\n model: this.dataModel\r\n }),\r\n\r\n pageTitleView: new ns.views.PageTitleView({\r\n model: this.selectorsModel\r\n }),\r\n\r\n noTableDataView: new ns.views.NoTableDataView({\r\n selectorsModel: this.selectorsModel,\r\n model: this.dataModel\r\n }),\r\n\r\n facebookUrlView: new ns.views.FacebookUrlView({\r\n model: this.selectorsModel\r\n })\r\n };\r\n\r\n this.completeRouterInitialization();\r\n },\r\n\r\n getValueOrDefault: function(val) {\r\n if (!val) {\r\n return \"a\";\r\n }\r\n return val;\r\n },\r\n\r\n routeUrlParts: function() {\r\n return [\r\n this.selectorsModel.get(\"locationId\"),\r\n this.selectorsModel.get(\"locationSlug\"),\r\n this.selectorsModel.get(\"locationTypeId\"),\r\n this.getStringFromArrayProperty(\r\n this.selectorsModel.get(\"indicatorIds\")\r\n ),\r\n this.getStringFromArrayProperty(this.selectorsModel.get(\"dataTypeIds\")),\r\n this.getStringFromArrayProperty(\r\n this.selectorsModel.get(\"otherFeatureIds\")\r\n )\r\n ];\r\n },\r\n\r\n initializeModelListeners: function() {\r\n // Listen for changes to the selectors model and update our URL\r\n this.selectorsModel.on(\"change\", this.updateUrl);\r\n }\r\n });\r\n})(_);\r\n","/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function() {\r\n var ns, sharedNs;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.models\");\r\n sharedNs = window.nspace(\"ccc.viz.shared.models\");\r\n\r\n /**\r\n * Data response model is responsible for querying the server-side for data,\r\n * storing the response, and other views listen for the response to change\r\n * in order to be updated when new data is retrieved\r\n */\r\n ns.DataResponseModel = sharedNs.DataResponseModel.extend({\r\n getDataResponseOnChange: function() {\r\n this.getDataResponse();\r\n },\r\n\r\n getFilterString: function() {\r\n var params, filterStringNvc, filterString;\r\n\r\n params = window.ccc.viz.util.UrlParams;\r\n\r\n filterStringNvc = new window.velir.collections.NameValueCollection();\r\n filterStringNvc.add(\r\n params.indicator,\r\n this.selectorsModel.get(\"indicatorIds\")\r\n );\r\n filterStringNvc.add(\r\n params.location,\r\n this.selectorsModel.get(\"locationId\")\r\n );\r\n\r\n filterString = filterStringNvc.toQueryString();\r\n\r\n return filterString;\r\n },\r\n\r\n getDataParams: function(filterString) {\r\n return {\r\n filterString: filterString\r\n };\r\n }\r\n });\r\n})();\r\n","/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function($, Backbone) {\r\n \"use strict\";\r\n\r\n var ns;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.models\");\r\n\r\n /**\r\n * Records the data selector values representing the data set currently selected\r\n * by the user. The values in this model are represented in the URL.\r\n */\r\n ns.SelectorsModel = window.ccc.viz.shared.models.SelectorsModel.extend({\r\n propNames: [\"dataTypeIds\"]\r\n });\r\n})(jQuery, Backbone);\r\n","/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function(Backbone, _) {\r\n \"use strict\";\r\n\r\n var ns;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.views\");\r\n\r\n /**\r\n * Monitors the state of the location in the model and updates the Facebook share link accordingly.\r\n */\r\n ns.FacebookUrlView = Backbone.View.extend({\r\n initialize: function(options) {\r\n _.bindAll(this);\r\n\r\n this.model.on(\"change\", this.render);\r\n },\r\n\r\n el: \".icon-share\",\r\n\r\n render: function() {\r\n var urlParts, nvc, locationId, location, pageTitle, url;\r\n\r\n urlParts = this.$el.attr(\"href\").split(\"?\");\r\n nvc = new velir.collections.NameValueCollection();\r\n nvc.fromQueryString(urlParts[1]);\r\n\r\n locationId = this.model.get(\"locationId\");\r\n location = _.filter(this.model.selectorInfo.locations, function(\r\n locationItem\r\n ) {\r\n return +locationItem.id === +locationId;\r\n })[0];\r\n\r\n if (!location || !location.name) {\r\n return;\r\n }\r\n\r\n pageTitle = location.name + \" - Profiles of New York City's children\";\r\n\r\n nvc.setValue(\"p[title]\", pageTitle);\r\n\r\n url = urlParts[0] + \"?\" + nvc.toQueryString();\r\n\r\n this.$el.attr(\"href\", url);\r\n }\r\n });\r\n})(Backbone, _);\r\n","/// \r\n\r\n(function() {\r\n var ns;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.views\");\r\n\r\n /**\r\n * A friendly no data message view that appears if a user unselects all checkboxes.\r\n */\r\n ns.NoTableDataView = window.ccc.viz.shared.views.NoDataView.extend({\r\n el: \"#data-table-container\",\r\n name: \"No table data view\",\r\n templateSelector: \"#no-data-table-template\"\r\n });\r\n})();\r\n","/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function(Backbone, _) {\r\n \"use strict\";\r\n\r\n var ns;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.views\");\r\n\r\n /**\r\n * Monitors the state of the indicators in the model and updates the raw data link accordingly.\r\n */\r\n ns.PageTitleView = Backbone.View.extend({\r\n initialize: function(options) {\r\n _.bindAll(this);\r\n\r\n this.model.on(\"change\", this.render);\r\n },\r\n\r\n render: function() {\r\n var locationId, location, pageTitle;\r\n\r\n locationId = this.model.get(\"locationId\");\r\n location = _.filter(this.model.selectorInfo.locations, function(\r\n locationItem\r\n ) {\r\n return +locationItem.id === +locationId;\r\n })[0];\r\n\r\n if (!location || !location.name) {\r\n return;\r\n }\r\n\r\n pageTitle = location.name + \" - Profiles of New York City's children\";\r\n\r\n if (document.title === pageTitle) {\r\n return;\r\n }\r\n\r\n document.title = pageTitle;\r\n }\r\n });\r\n})(Backbone, _);\r\n","/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function(Backbone, _) {\r\n \"use strict\";\r\n\r\n var ns, config;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.views\");\r\n config = window.ccc.viz.profile.config.Config;\r\n\r\n ns.ProfileView = Backbone.View.extend({\r\n el: \"#data-table-container\",\r\n templateSelector: \"#profile-data-table-template\",\r\n name: \"ProfileDataTableView\",\r\n\r\n initialize: function(options) {\r\n _.bindAll(this);\r\n\r\n this.initialRenderPromise = $.Deferred();\r\n this.featuresRenderPromise = $.Deferred();\r\n\r\n this.selectorsModel = options.selectorsModel;\r\n\r\n this.model.on(\"change\", this.render);\r\n this.selectorsModel.on(\"change:dataTypeIds\", this.render);\r\n this.selectorsModel.on(\"change:otherFeatureIds\", this.toggleFeatures);\r\n },\r\n\r\n events: {\r\n \"click .top\": \"scrollToTop\"\r\n },\r\n\r\n scrollToTop: function() {\r\n window.scrollTo(0, 0);\r\n },\r\n\r\n getInitialRenderPromise: function() {\r\n return this.initialRenderPromise;\r\n },\r\n\r\n getFeatureInitialRenderPromise: function() {\r\n return this.featuresRenderPromise;\r\n },\r\n\r\n loadTemplate: function() {\r\n // Get the underscore template\r\n if (!this.template) {\r\n var $tmpl = $(this.templateSelector);\r\n if ($tmpl.length === 0) {\r\n throw \"Could not find the \" +\r\n this.name +\r\n \" template: \" +\r\n this.templateSelector;\r\n }\r\n\r\n // Pre-compile and cache the template\r\n this.template = _.template($tmpl.html());\r\n }\r\n },\r\n\r\n render: function() {\r\n var self;\r\n\r\n this.renderPromise = $.Deferred();\r\n\r\n if (!this.selectorsModel.areModelArraysValid()) {\r\n return;\r\n }\r\n\r\n self = this;\r\n this.loadTemplate();\r\n\r\n $.when(this.model.getDataResponse()).done(function() {\r\n var tableMarkup;\r\n\r\n tableMarkup = self.getTable();\r\n\r\n self.$el.hide().html(tableMarkup);\r\n\r\n self.toggleFeatures();\r\n self.$el.fadeIn();\r\n\r\n self.initialRenderPromise.resolve();\r\n self.renderPromise.resolve();\r\n });\r\n },\r\n\r\n /**\r\n * The other features selectors are represented in the model by arbitrary numbers: currently, 1 and 2.\r\n * We will key in on this when determining which table areas to hide/show.\r\n */\r\n toggleFeatures: function() {\r\n var self, features;\r\n\r\n self = this;\r\n features = this.selectorsModel.get(\"otherFeatureIds\");\r\n\r\n _.each(config.featureSelectors, function(selector, key) {\r\n var animationOptions, $el;\r\n\r\n $el = self.$(key);\r\n\r\n // Checking the state of the table rendering; if we're still rendering, don't animate the feature selection; otherwise, animate it.\r\n animationOptions =\r\n self.renderPromise.state() === \"resolved\"\r\n ? config.animationOptions.on\r\n : config.animationOptions.off;\r\n\r\n if (!features.length) {\r\n selector.off($el, animationOptions);\r\n return;\r\n }\r\n\r\n if (features[0] === \"a\") {\r\n selector.on($el, animationOptions);\r\n return;\r\n }\r\n\r\n if (+features === selector.id) {\r\n selector.on($el, animationOptions);\r\n return;\r\n }\r\n\r\n selector.off($el, animationOptions);\r\n });\r\n },\r\n\r\n getTable: function() {\r\n var response;\r\n\r\n // Gather the properties necessary to render the template\r\n response = _.extend(\r\n {},\r\n this.model.get(\"response\"),\r\n config.changeImages,\r\n { dataFormats: this.selectorsModel.get(\"dataTypeIds\") },\r\n { config: config }\r\n );\r\n this.introduceDataFormatText(response.data);\r\n return this.template(response);\r\n },\r\n\r\n /**\r\n * Formulating what the name of the data format should be for each indicator report.\r\n */\r\n introduceDataFormatText: function(response) {\r\n var availableDataFormats;\r\n\r\n availableDataFormats = this.selectorsModel.get(\"dataTypeIds\");\r\n\r\n _.each(response, function(indicatorTables) {\r\n var formatKeys, formatValues;\r\n\r\n formatKeys = _.filter(\r\n _.keys(indicatorTables.availableDataPrimitives),\r\n function(formatKey) {\r\n var primitiveInKeys;\r\n\r\n if (availableDataFormats[0] === \"a\") {\r\n return true;\r\n }\r\n\r\n primitiveInKeys = _.any(availableDataFormats, function(dataFormat) {\r\n return +formatKey === +dataFormat;\r\n });\r\n\r\n return primitiveInKeys;\r\n }\r\n );\r\n\r\n // No match between the data formats that are available and the data formats that are set, so let's use an empty string.\r\n if (!formatKeys.length) {\r\n indicatorTables.dataFormatText = \"\";\r\n return;\r\n }\r\n\r\n // Only one data format, so print that.\r\n if (formatKeys.length === 1) {\r\n indicatorTables.dataFormatText =\r\n indicatorTables.availableDataPrimitives[formatKeys[0]].name;\r\n return;\r\n }\r\n\r\n formatValues = _.map(indicatorTables.availableDataPrimitives, function(\r\n value,\r\n key\r\n ) {\r\n return value.name;\r\n });\r\n\r\n // Two data formats require a simple and separator.\r\n if (formatKeys.length === 2) {\r\n indicatorTables.dataFormatText = formatValues.join(\" and \");\r\n return;\r\n }\r\n\r\n // Multiple data formats require a comma/space separated list where the last value gets the \"and\" keyword as well.\r\n formatValues =\r\n formatValues.splice(0, formatKeys.length - 1).join(\",\") +\r\n \", and \" +\r\n formatValues[0];\r\n indicatorTables.dataFormatText = formatValues;\r\n });\r\n }\r\n });\r\n})(Backbone, _);\r\n","/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function(Backbone, _) {\r\n \"use strict\";\r\n\r\n var ns;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.views\");\r\n\r\n /**\r\n * Monitors the state of the indicators in the model and updates the raw data link accordingly.\r\n */\r\n ns.RawDataHrefView = Backbone.View.extend({\r\n el: \".option-icons-list .icon-raw-data\",\r\n\r\n initialize: function(options) {\r\n _.bindAll(this);\r\n\r\n this.model.on(\"change\", this.render);\r\n },\r\n\r\n render: function() {\r\n var response, indicatorGroupsIds;\r\n\r\n response = this.model.get(\"response\");\r\n\r\n indicatorGroupsIds = _(response.data)\r\n .map(function(indicatorTables) {\r\n return indicatorTables.indicatorGroupId;\r\n })\r\n .uniq()\r\n .value();\r\n\r\n this.$el.attr(\"href\", \"/data/download#0/\" + indicatorGroupsIds);\r\n }\r\n });\r\n})(Backbone, _);\r\n","/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\n(function($, _) {\r\n var ns, selectorNs, sharedNs;\r\n\r\n ns = window.nspace(\"ccc.viz.profile.views\");\r\n selectorNs = window.nspace(\"ccc.viz.selectors\");\r\n sharedNs = window.nspace(\"ccc.viz.shared\");\r\n\r\n ns.SelectorsView = sharedNs.views.SelectorsView.extend({\r\n initializeView: function() {\r\n // Expose this (presumably one-and-only) instance globally so that other components\r\n // can call \"public\" methods and get selector information, such as for building data summaries.\r\n // TODO: What's a better way to architect this?\r\n ns.instances = { SelectorsView: this };\r\n\r\n this.model.on(\"change\", this.updateDataSummary);\r\n },\r\n\r\n initializeSelectors: function() {\r\n this.headerSelectors = [\r\n (this.locationSelectorView = new selectorNs.SingleLocationSelectorView({\r\n model: this.model\r\n }))\r\n ];\r\n\r\n this.summarySelectors = [\r\n (this.dataTypeSelectorView = new selectorNs.MultipleDataTypeSelectorView(\r\n {\r\n model: this.model\r\n }\r\n )),\r\n (this.otherFeaturesSelectorView = new selectorNs.OtherFeaturesSelectorView(\r\n {\r\n model: this.model\r\n }\r\n )),\r\n (this.indicatorJumpSelectorView = new selectorNs.IndicatorJumpSelectorView(\r\n {\r\n model: this.model\r\n }\r\n ))\r\n ];\r\n },\r\n\r\n updateDataSummary: function() {\r\n var summaryText;\r\n\r\n summaryText =\r\n this.getIndicatorText() +\r\n this.getDataSummaryText(this.summarySelectors) +\r\n \"; \" +\r\n this.getLocationTypeText() +\r\n \"All Available Years\";\r\n\r\n $(\".tab-container .sub-heading\").text(summaryText);\r\n },\r\n\r\n getIndicatorText: function() {\r\n var indicatorLength;\r\n\r\n indicatorLength = this.selectorInfo.indicators.length;\r\n return (\r\n indicatorLength +\r\n \" Indicator\" +\r\n (indicatorLength !== 1 ? \"s\" : \"\") +\r\n \"; \"\r\n );\r\n },\r\n\r\n getLocationTypeText: function() {\r\n return this.selectorInfo.locations[0].parent.name + \"; \";\r\n },\r\n\r\n renderSelectors: function(selectorInfo) {\r\n var locationInfo, dataTypeInfo;\r\n\r\n locationInfo = this.shapeLocations(selectorInfo);\r\n this.locationSelectorView.render(locationInfo);\r\n\r\n dataTypeInfo = this.shapeDataTypes(selectorInfo);\r\n this.dataTypeSelectorView.render(dataTypeInfo);\r\n\r\n this.otherFeaturesSelectorView.render({\r\n features: [\r\n {\r\n id: \"show-notes-and-definitions\",\r\n name: \"Show Notes & Description\"\r\n },\r\n {\r\n id: \"show-change-over-time\",\r\n name: \"Show Change Over Time\"\r\n }\r\n ]\r\n });\r\n\r\n this.indicatorJumpSelectorView.render(selectorInfo);\r\n },\r\n\r\n shapeLocations: function(selectorInfo) {\r\n var locationType;\r\n\r\n locationType = selectorInfo.locations[0].parent;\r\n\r\n return {\r\n locationType: locationType,\r\n locations: selectorInfo.locations\r\n };\r\n },\r\n\r\n shapeDataTypes: function(selectorInfo) {\r\n var dataFormats, transformedDataFormats;\r\n\r\n dataFormats = {};\r\n\r\n _.each(selectorInfo.selectors, function(indicatorGroup, indicatorId) {\r\n _.each(indicatorGroup.dataFormats, function(dataFormat) {\r\n if (dataFormats[dataFormat.name]) {\r\n return;\r\n }\r\n dataFormats[dataFormat.name] = dataFormat;\r\n });\r\n });\r\n\r\n transformedDataFormats = _.map(dataFormats, function(\r\n dataFormat,\r\n dataFormatName\r\n ) {\r\n return dataFormat;\r\n });\r\n\r\n return { dataFormats: transformedDataFormats };\r\n }\r\n });\r\n})(jQuery, _);\r\n"]}