diff --git a/Dashboard/app/css/main.scss b/Dashboard/app/css/main.scss index 4f31442fbe..c65d527d19 100644 --- a/Dashboard/app/css/main.scss +++ b/Dashboard/app/css/main.scss @@ -267,13 +267,13 @@ a, a:link, a:visited { &.AddBtn { display: inline-block !important; padding: 1em 1% 0.8em 1.5em; - background: url(../images/addbtfullWidthn.png) left center no-repeat; + background: url(../images/addbtn.png) left center no-repeat; color: rgb(0, 123, 182); text-align: left; font-size: 1.1em; &:hover {} } - &.clodeDialog { + &.closeDialog { position: absolute; top: 10px; right: 10px; @@ -838,10 +838,6 @@ table.dataTable thead tr th a:visited { display: block; } -#statisticsDataTable { - width: 400px; -} - /* end addition MTW */ table.dataTable thead tr th a.helpIcon { @@ -3300,6 +3296,8 @@ table.dataTable.notificationTable thead tr th { table.dataTable.notificationTable thead tr th.noArrows { background: #3A3A3A; + text-align: left; + font-weight: bold; } table.dataTable.notificationTable thead tr th a, @@ -3392,6 +3390,11 @@ label.collectedTo { } } +#monitoringData div.noResults { + color: red; + text-align: center; + } + div.chooseLocationData { position: relative; display: block; diff --git a/Dashboard/app/js/lib/controllers/controllers.js b/Dashboard/app/js/lib/controllers/controllers.js index 4ef4a11bc9..537521111a 100644 --- a/Dashboard/app/js/lib/controllers/controllers.js +++ b/Dashboard/app/js/lib/controllers/controllers.js @@ -59,7 +59,6 @@ FLOW.NavReportsController = Ember.Controller.extend(); FLOW.ReportsSubnavController = Em.Controller.extend(); FLOW.ExportReportsController = Ember.ArrayController.extend(); FLOW.ChartReportsController = Ember.Controller.extend(); -FLOW.StatisticsController = Ember.Controller.extend(); FLOW.NavMapsController = Ember.Controller.extend(); FLOW.NavUsersController = Ember.Controller.extend(); diff --git a/Dashboard/app/js/lib/controllers/data-controllers.js b/Dashboard/app/js/lib/controllers/data-controllers.js index 03d5fd7f19..119cfee5f2 100644 --- a/Dashboard/app/js/lib/controllers/data-controllers.js +++ b/Dashboard/app/js/lib/controllers/data-controllers.js @@ -4,45 +4,6 @@ function capitaliseFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } -FLOW.attributeTypeControl = Ember.Object.create({ - content: [ - Ember.Object.create({ - label: "text", - value: "String" - }), Ember.Object.create({ - label: "number", - value: "Double" - }) - ] -}); - -FLOW.attributeControl = Ember.ArrayController.create({ - sortProperties: null, - sortAscending: true, - content: null, - - setFilteredContent: function () { - this.set('content', FLOW.store.filter(FLOW.Metric, function (item) { - return true; - })); - }, - - // load all Survey Groups - populate: function () { - if (FLOW.Env.showStatisticsFeature) { - FLOW.store.find(FLOW.Metric); - } - this.setFilteredContent(); - this.set('sortProperties', ['name']); - this.set('sortAscending', true); - }, - - getSortInfo: function () { - this.set('sortProperties', FLOW.tableColumnControl.get('sortProperties')); - this.set('sortAscending', FLOW.tableColumnControl.get('sortAscending')); - } -}); - FLOW.cascadeResourceControl = Ember.ArrayController.create({ content:null, published:null, @@ -290,7 +251,7 @@ FLOW.SurveyedLocaleController = Ember.ArrayController.extend({ }); this.set('currentContents', mutableContents); - }, + }.observes('content', 'content.isLoaded'), removeLocale: function(locale) { this.get('currentContents').forEach(function(item, i, currentContents) { diff --git a/Dashboard/app/js/lib/controllers/maps-controllers-common.js b/Dashboard/app/js/lib/controllers/maps-controllers-common.js index cc178a2ac2..01baf3ebc7 100644 --- a/Dashboard/app/js/lib/controllers/maps-controllers-common.js +++ b/Dashboard/app/js/lib/controllers/maps-controllers-common.js @@ -6,7 +6,7 @@ a placemark counterpart. **/ -FLOW.mapsController = Ember.ArrayController.create({ +FLOW.MapsController = Ember.ArrayController.extend({ content: null, map: null, marker: null, @@ -134,13 +134,13 @@ FLOW.mapsController = Ember.ArrayController.create({ function onMarkerClick(marker){ // first deselect others - if (!Ember.none(FLOW.mapsController.get('selectedMarker'))) { - if (FLOW.mapsController.selectedMarker.target.options.placemarkId != marker.target.options.placemarkId) { - FLOW.mapsController.selectedMarker.target.options.selected = false; - FLOW.mapsController.selectedMarker.target.setStyle({ + if (!Ember.none(FLOW.router.mapsController.get('selectedMarker'))) { + if (FLOW.router.mapsController.selectedMarker.target.options.placemarkId != marker.target.options.placemarkId) { + FLOW.router.mapsController.selectedMarker.target.options.selected = false; + FLOW.router.mapsController.selectedMarker.target.setStyle({ color:'#d46f12', fillColor:'#edb660'}); - FLOW.mapsController.set('selectedMarker',null); + FLOW.router.mapsController.set('selectedMarker',null); } } @@ -150,13 +150,13 @@ FLOW.mapsController = Ember.ArrayController.create({ color:'#d46f12', fillColor:'#edb660'}); marker.target.options.selected = false; - FLOW.mapsController.set('selectedMarker',null); + FLOW.router.mapsController.set('selectedMarker',null); } else { marker.target.setStyle({ color:'#d46f12', fillColor:'#433ec9'}); marker.target.options.selected = true; - FLOW.mapsController.set('selectedMarker',marker); + FLOW.router.mapsController.set('selectedMarker',marker); } } }, @@ -268,7 +268,7 @@ FLOW.mapsController = Ember.ArrayController.create({ dataLayer.setInteraction(true); dataLayer.on('featureClick', function(e, latlng, pos, data) { - FLOW.mapsController.set('markerCoordinates', [data.lat, data.lon]); + self.set('markerCoordinates', [data.lat, data.lon]); //get survey instance FLOW.placemarkDetailController.set( 'si', FLOW.store.find(FLOW.SurveyInstance, data.id)); @@ -351,11 +351,14 @@ FLOW.placemarkDetailController = Ember.ArrayController.create({ handlePlacemarkSelection: function () { var selectedPlacemarkId = null; - if (!Ember.none(FLOW.mapsController.get('selectedMarker'))) { - selectedPlacemarkId = FLOW.mapsController.selectedMarker.target.options.placemarkId; - this.set('collectionDate',FLOW.mapsController.selectedMarker.target.options.collectionDate); + if (!Ember.none(FLOW.router.get('mapsController'))) { + var mapsController = FLOW.router.get('mapsController'); + if (!Ember.none(mapsController.get('selectedMarker'))) { + selectedPlacemarkId = mapsController.selectedMarker.target.options.placemarkId; + this.set('collectionDate',mapsController.selectedMarker.target.options.collectionDate); + } + this.populate(selectedPlacemarkId); } - this.populate(selectedPlacemarkId); - }.observes('FLOW.mapsController.selectedMarker') + }.observes('FLOW.router.mapsController.selectedMarker') }); diff --git a/Dashboard/app/js/lib/controllers/permissions.js b/Dashboard/app/js/lib/controllers/permissions.js index b07e3e9ac8..346c02443a 100644 --- a/Dashboard/app/js/lib/controllers/permissions.js +++ b/Dashboard/app/js/lib/controllers/permissions.js @@ -267,7 +267,6 @@ FLOW.dialogControl = Ember.Object.create({ delQG: "delQG", delQ: "delQ", delUser: "delUser", - delAttr: "delAttr", delAssignment: "delAssignment", delDeviceGroup: "delDeviceGroup", delSI: "delSI", @@ -314,12 +313,6 @@ FLOW.dialogControl = Ember.Object.create({ this.set('showDialog', true); break; - case "delAttr": - this.set('header', Ember.String.loc('_attr_delete_header')); - this.set('message', Ember.String.loc('_this_cant_be_undo')); - this.set('showDialog', true); - break; - case "delAssignment": this.set('header', Ember.String.loc('_assignment_delete_header')); this.set('message', Ember.String.loc('_this_cant_be_undo')); @@ -390,11 +383,6 @@ FLOW.dialogControl = Ember.Object.create({ view.deleteUser.apply(view, arguments); break; - case "delAttr": - this.set('showDialog', false); - view.deleteAttribute.apply(view, arguments); - break; - case "delAssignment": this.set('showDialog', false); view.deleteSurveyAssignment.apply(view, arguments); diff --git a/Dashboard/app/js/lib/controllers/reports-controllers.js b/Dashboard/app/js/lib/controllers/reports-controllers.js index caf105d1f2..ee826e7808 100644 --- a/Dashboard/app/js/lib/controllers/reports-controllers.js +++ b/Dashboard/app/js/lib/controllers/reports-controllers.js @@ -31,51 +31,3 @@ FLOW.chartTypeControl = Ember.Object.create({ }) ] }); - -FLOW.statisticsControl = Ember.ArrayController.create({ - selectedSurvey: null, - allreadyTriggered: false, - content:null, - QAcontent:null, - sortProperties: ['name'], - sortAscending: true, - totalsSurveys:[], - total:null, - - computeTotal: function(){ - this.set('total',Math.max.apply(Math, this.get('totalsSurveys'))); - }, - - getMetrics: function(){ - if (!Ember.none(this.get('selectedSurvey'))){ - this.set('totalsSurveys',[]); - this.set('total',null); - this.set('alreadyTriggered',false); - this.set('content',FLOW.store.findQuery(FLOW.Metric,{ - surveyId: this.selectedSurvey.get('keyId') - })); - } - }.observes('this.selectedSurvey'), - - resetSurvey: function(){ - this.set('selectedSurvey',null); - this.set('totalsSurveys',[]); - this.set('total',null); - this.set('content',null); - }.observes('FLOW.selectedControl.selectedSurveyGroup'), - - getQA: function(){ - if (!Ember.none(this.get('content') && !this.get('allreadyTriggered'))){ - this.set('totalsSurveys',[]); - this.set('total',null); - // for each metric, get all the QuestionAnswerSummery objects of the questions - // this could be a single call: give me all he QA summ for questions with a metric. - this.set('QAcontent',FLOW.store.findQuery(FLOW.SurveyQuestionSummary,{ - surveyId:this.selectedSurvey.get('keyId'), - metricOnly:"true" - })); - allreadyTriggered = true; - } - }.observes('this.content.isLoaded') - -}); \ No newline at end of file diff --git a/Dashboard/app/js/lib/controllers/survey-controllers.js b/Dashboard/app/js/lib/controllers/survey-controllers.js index 467de15ded..3a2117a504 100644 --- a/Dashboard/app/js/lib/controllers/survey-controllers.js +++ b/Dashboard/app/js/lib/controllers/survey-controllers.js @@ -567,6 +567,28 @@ FLOW.projectControl = Ember.ArrayController.create({ var groups = FLOW.router.approvalGroupListController.get('content'); return groups && groups.filterProperty('keyId', approvalGroupId).get('firstObject'); }.property('this.currentProject.dataApprovalGroupId'), + + saveProject: function() { + var currentProject = this.get('currentProject'); + var currentForm = FLOW.selectedControl.get('selectedSurvey'); + + if (currentProject && currentProject.get('isDirty')) { + var name = currentProject.get('name').trim(); + currentProject.set('name', name); + currentProject.set('code', name); + currentProject.set('path', this.get('currentProjectPath')); + } + + if (currentForm && currentForm.get('isDirty')) { + var name = currentForm.get('name').trim(); + currentForm.set('name', name); + currentForm.set('code', name); + var path = this.get('currentProjectPath') + "/" + name; + currentForm.set('path', path); + } + + FLOW.store.commit(); + } }); diff --git a/Dashboard/app/js/lib/models/fixtures.js b/Dashboard/app/js/lib/models/fixtures.js index 6ff436a556..2c3e19f782 100644 --- a/Dashboard/app/js/lib/models/fixtures.js +++ b/Dashboard/app/js/lib/models/fixtures.js @@ -1192,24 +1192,6 @@ FLOW.SurveyInstance.FIXTURES = [{ }]; -FLOW.Metric.FIXTURES = [{ - name:'metric 1', - questionId: 1, - id:1, - keyId:1 -},{ - name:'metric 2', - questionId: 1, - id:2, - keyId:2 -},{ - name:'metric 2', - questionId: 1, - id:1, - keyId:1 -}]; - - FLOW.SurveyQuestionSummary.FIXTURES = [{ id: 1, keyId: 1, diff --git a/Dashboard/app/js/lib/models/models.js b/Dashboard/app/js/lib/models/models.js index fb3efbaa67..0007e60a37 100644 --- a/Dashboard/app/js/lib/models/models.js +++ b/Dashboard/app/js/lib/models/models.js @@ -448,15 +448,6 @@ FLOW.UserConfig = FLOW.BaseModel.extend({ userId: DS.attr('number') }); -// this is called attribute in the dashboard, but metric in the backend, for historic reasons. -FLOW.Metric = FLOW.BaseModel.extend({ - organization: DS.attr('string'), - name: DS.attr('string'), - group: DS.attr('string'), - valueType: DS.attr('string'), - questionId: DS.attr('number') -}); - FLOW.Message = FLOW.BaseModel.extend({ objectId: DS.attr('number'), lastUpdateDateTime: DS.attr('number'), diff --git a/Dashboard/app/js/lib/router/router.js b/Dashboard/app/js/lib/router/router.js index 14b5b2efc9..9de3b31d04 100644 --- a/Dashboard/app/js/lib/router/router.js +++ b/Dashboard/app/js/lib/router/router.js @@ -105,7 +105,6 @@ FLOW.Router = Ember.Router.extend({ FLOW.selectedControl.set('selectedSurvey', null); FLOW.selectedControl.set('selectedQuestion', null); FLOW.questionControl.set('OPTIONcontent', null); - FLOW.attributeControl.populate(); } }), @@ -257,9 +256,6 @@ FLOW.Router = Ember.Router.extend({ doInspectData: function (router, event) { router.transitionTo('navData.inspectData'); }, - doManageAttributes: function (router, event) { - router.transitionTo('navData.manageAttributes'); - }, doBulkUpload: function (router, event) { router.transitionTo('navData.bulkUpload'); }, @@ -291,15 +287,6 @@ FLOW.Router = Ember.Router.extend({ } }), - manageAttributes: Ember.Route.extend({ - route: '/manageattributes', - connectOutlets: function (router, context) { - router.get('navDataController').connectOutlet('manageAttributes'); - router.set('datasubnavController.selected', 'manageAttributes'); - FLOW.attributeControl.populate(); - } - }), - bulkUpload: Ember.Route.extend({ route: '/bulkupload', connectOutlets: function (router, context) { @@ -415,10 +402,6 @@ FLOW.Router = Ember.Router.extend({ router.transitionTo('navReports.chartReports'); }, - doStatistics: function(router, event) { - router.transitionTo('navReports.statistics'); - }, - index: Ember.Route.extend({ route: '/', redirectsTo: 'exportReports' @@ -440,15 +423,6 @@ FLOW.Router = Ember.Router.extend({ router.get('navReportsController').connectOutlet('chartReports'); router.set('reportsSubnavController.selected', 'chartReports'); } - }), - statistics: Ember.Route.extend({ - route: '/statistics', - connectOutlets: function(router, context) { - router.resetState(); - router.get('navReportsController').connectOutlet('statistics'); - router.set('reportsSubnavController.selected', 'statistics'); - FLOW.surveyGroupControl.populate(); - } }) }), diff --git a/Dashboard/app/js/lib/views/data/data-attribute-views.js b/Dashboard/app/js/lib/views/data/data-attribute-views.js deleted file mode 100644 index 995bd3f8bc..0000000000 --- a/Dashboard/app/js/lib/views/data/data-attribute-views.js +++ /dev/null @@ -1,74 +0,0 @@ -FLOW.ManageAttributesTableView = FLOW.View.extend({ - showAddAttributeDialogBool: false, - showEditAttributeDialogBool: false, - newAttributeName: null, - newAttributeGroup: null, - newAttributeType: null, - - showAddAttributeDialog: function () { - this.set('showAddAttributeDialogBool', true); - }, - - doAddAttribute: function () { - if (this.get('newAttributeName') !== null && this.get('newAttributeType') !== null) { - FLOW.store.createRecord(FLOW.Metric, { - "name": this.get('newAttributeName'), - "group": this.get('newAttributeGroup'), - "valueType": this.newAttributeType.get('value') - }); - FLOW.store.commit(); - } - this.set('showAddAttributeDialogBool', false); - }, - - cancelAddAttribute: function () { - this.set('showAddAttributeDialogBool', false); - }, - - showEditAttributeDialog: function (event) { - var attrType = null; - - FLOW.editControl.set('editAttributeName', event.context.get('name')); - FLOW.editControl.set('editAttributeGroup', event.context.get('group')); - FLOW.editControl.set('editAttributeId', event.context.get('keyId')); - - FLOW.attributeTypeControl.get('content').forEach(function (item) { - if (item.get('value') == event.context.get('valueType')) { - attrType = item; - } - }); - - FLOW.editControl.set('editAttributeType', attrType); - this.set('showEditAttributeDialogBool', true); - }, - - doEditAttribute: function () { - var attribute; - attribute = FLOW.store.find(FLOW.Metric, FLOW.editControl.get('editAttributeId')); - attribute.set('name', FLOW.editControl.get('editAttributeName')); - attribute.set('group', FLOW.editControl.get('editAttributeGroup')); - - if (FLOW.editControl.editAttributeType !== null) { - attribute.set('valueType', FLOW.editControl.editAttributeType.get('value')); - } - - FLOW.store.commit(); - this.set('showEditAttributeDialogBool', false); - }, - - cancelEditAttribute: function () { - this.set('showEditAttributeDialogBool', false); - } -}); - -FLOW.AttributeView = FLOW.View.extend({ - tagName: 'span', - - deleteAttribute: function () { - var attrDeleteId, attribute; - attrDeleteId = this.content.get('keyId'); - attribute = FLOW.store.find(FLOW.Metric, attrDeleteId); - attribute.deleteRecord(); - FLOW.store.commit(); - } -}); diff --git a/Dashboard/app/js/lib/views/data/inspect-data-table-views.js b/Dashboard/app/js/lib/views/data/inspect-data-table-views.js index e872c1ae41..adb6313abc 100644 --- a/Dashboard/app/js/lib/views/data/inspect-data-table-views.js +++ b/Dashboard/app/js/lib/views/data/inspect-data-table-views.js @@ -311,8 +311,7 @@ FLOW.DataNumView = FLOW.View.extend({ tagName: 'span', pageNumber: 0, content: null, - rownum: function() { - return this.get("_parentView.contentIndex") + 1 + 20 * this.get('pageNumber'); - }.property() - + rownum: function () { + return this.get("_parentView.contentIndex") + 1 + 20 * this.get('pageNumber'); + }.property(), }); diff --git a/Dashboard/app/js/lib/views/data/monitoring-data-table-view.js b/Dashboard/app/js/lib/views/data/monitoring-data-table-view.js index c2183fdea7..4adc269c80 100644 --- a/Dashboard/app/js/lib/views/data/monitoring-data-table-view.js +++ b/Dashboard/app/js/lib/views/data/monitoring-data-table-view.js @@ -65,6 +65,13 @@ FLOW.MonitoringDataTableView = FLOW.View.extend({ FLOW.router.userListController.set('content', FLOW.User.find()); } }, + + noResults: function () { + var content = FLOW.router.surveyedLocaleController.get('content'); + if (content && content.get('isLoaded')) { + return content.get('length') === 0; + } + }.property('FLOW.router.surveyedLocaleController.content','FLOW.router.surveyedLocaleController.content.isLoaded'), doNextPage: function () { var cursorArray, cursorStart; @@ -179,6 +186,11 @@ FLOW.DataPointView = FLOW.View.extend({ toggleShowDataApprovalBlock: function () { this.toggleProperty('showDataApprovalBlock'); }, + + dataPointRowNumber: function () { + var pageNumber = FLOW.router.surveyedLocaleController.get('pageNumber'); + return this.get('_parentView.contentIndex') + 1 + 20 * pageNumber; + }.property() }); /** diff --git a/Dashboard/app/js/lib/views/maps/map-views-common-public.js b/Dashboard/app/js/lib/views/maps/map-views-common-public.js index 84e7763541..2963594885 100644 --- a/Dashboard/app/js/lib/views/maps/map-views-common-public.js +++ b/Dashboard/app/js/lib/views/maps/map-views-common-public.js @@ -39,7 +39,7 @@ FLOW.NavMapsView = FLOW.View.extend({ var bestBB = this.geoModel.best_bbox_search_cells(bb); // adapt the points shown on the map - FLOW.mapsController.adaptMap(bestBB, this.map.getZoom()); + FLOW.router.mapsController.adaptMap(bestBB, this.map.getZoom()); }, /** @@ -83,7 +83,7 @@ FLOW.NavMapsView = FLOW.View.extend({ self.redoMap(); }); - FLOW.mapsController.set('map', this.map); + FLOW.router.mapsController.set('map', this.map); this.geoModel = create_geomodel(); //load points for the visible map diff --git a/Dashboard/app/js/lib/views/maps/map-views-common.js b/Dashboard/app/js/lib/views/maps/map-views-common.js index fc0facfb82..6e6f71312a 100644 --- a/Dashboard/app/js/lib/views/maps/map-views-common.js +++ b/Dashboard/app/js/lib/views/maps/map-views-common.js @@ -46,7 +46,7 @@ FLOW.NavMapsView = FLOW.View.extend({ var bestBB = this.geoModel.best_bbox_search_cells(bb); // adapt the points shown on the map - FLOW.mapsController.adaptMap(bestBB, this.map.getZoom()); + FLOW.router.mapsController.adaptMap(bestBB, this.map.getZoom()); }, /** @@ -67,7 +67,7 @@ FLOW.NavMapsView = FLOW.View.extend({ this.map.on('moveend', function (e) { self.redoMap(); }); - FLOW.mapsController.set('map', this.map); + FLOW.router.mapsController.set('map', this.map); this.geoModel = create_geomodel(); //load points for the visible map this.redoMap(); @@ -172,7 +172,7 @@ FLOW.NavMapsView = FLOW.View.extend({ L.control.layers(baseLayers).addTo(this.map); - FLOW.mapsController.set('map', this.map); + FLOW.router.mapsController.set('map', this.map); this.map.on('click', function(e) { self.clearMap(); //remove any previously loaded point data @@ -260,15 +260,15 @@ FLOW.NavMapsView = FLOW.View.extend({ surveySelection: function () { this.clearMap(); - FLOW.mapsController.clearSurveyDataLayer(); + FLOW.router.mapsController.clearSurveyDataLayer(); if (!Ember.none(this.get('selectedSurvey'))) { - FLOW.mapsController.loadNamedMap(this.selectedSurvey.get('keyId')); + FLOW.router.mapsController.loadNamedMap(this.selectedSurvey.get('keyId')); } }.observes('this.selectedSurvey'), surveyGroupSelection: function () { this.clearMap(); - FLOW.mapsController.clearSurveyDataLayer(); + FLOW.router.mapsController.clearSurveyDataLayer(); }.observes('FLOW.selectedControl.selectedSurveyGroup'), /** @@ -370,11 +370,11 @@ FLOW.NavMapsView = FLOW.View.extend({ iconUrl: 'images/marker.svg', iconSize: [10, 10] }); - this.marker = new L.marker(FLOW.mapsController.get('markerCoordinates'), {icon: markerIcon}); + this.marker = new L.marker(FLOW.router.mapsController.get('markerCoordinates'), {icon: markerIcon}); this.map.addLayer(this.marker); this.showDetailsPane(); - }.observes('FLOW.mapsController.markerCoordinates'), + }.observes('FLOW.router.mapsController.markerCoordinates'), detailsPaneShowHide: function(){ var button = this.$('#mapDetailsHideShow'); diff --git a/Dashboard/app/js/lib/views/reports/report-views.js b/Dashboard/app/js/lib/views/reports/report-views.js index d2ceedcb62..35d1cabe98 100644 --- a/Dashboard/app/js/lib/views/reports/report-views.js +++ b/Dashboard/app/js/lib/views/reports/report-views.js @@ -1,30 +1,6 @@ /*global deleteChart, createDoughnutChart, createHBarChart, createVBarChart*/ -FLOW.StatisticsMetricView = FLOW.View.extend({ - answers: null, - - fillAnswers: function(){ - var qId, total, percentage; - qId = this.content.get('questionId'); - SQS = FLOW.store.filter(FLOW.SurveyQuestionSummary,function(item){ - return (item.get('questionId') == qId); - }); - this.set('answers',SQS); - total = 0; - SQS.forEach(function(item){ - total += item.get('count'); - }); - SQS.forEach(function(item){ - percentage = 100 * item.get('count')/total - item.set('percentage',percentage.toFixed(1)); - }); - FLOW.statisticsControl.get('totalsSurveys').push(total); - FLOW.statisticsControl.computeTotal(); - }.observes('FLOW.statisticsControl.QAcontent.content.isLoaded') -}), - - FLOW.chartView = FLOW.View.extend({ noChoiceBool: false, noDataBool: false, diff --git a/Dashboard/app/js/lib/views/surveys/question-view.js b/Dashboard/app/js/lib/views/surveys/question-view.js index 425cc228af..95b67b3818 100644 --- a/Dashboard/app/js/lib/views/surveys/question-view.js +++ b/Dashboard/app/js/lib/views/surveys/question-view.js @@ -24,10 +24,6 @@ FLOW.QuestionView = FLOW.View.extend({ dependentFlag: false, dependentQuestion: null, includeInMap: null, - showAddAttributeDialogBool: false, - newAttributeName: null, - newAttributeGroup: null, - newAttributeType: null, allowPoints: true, allowLine: true, allowPolygon: true, @@ -168,7 +164,6 @@ FLOW.QuestionView = FLOW.View.extend({ // TODO options doQuestionEdit: function () { var questionType = null, - attribute = null, dependentQuestion, dependentAnswer, dependentAnswerArray,cascadeResource; if (this.content && (this.content.get('isDirty') || this.content.get('isSaving'))) { this.showMessageDialog(Ember.String.loc('_question_is_being_saved'), @@ -239,14 +234,6 @@ FLOW.QuestionView = FLOW.View.extend({ } } - // set the attribute to the original choice - FLOW.attributeControl.get('content').forEach(function (item) { - if (item.get('keyId') == FLOW.selectedControl.selectedQuestion.get('metricId')) { - attribute = item; - } - }); - this.set('attribute', attribute); - // set the type to the original choice FLOW.questionTypeControl.get('content').forEach(function (item) { if (item.get('value') == FLOW.selectedControl.selectedQuestion.get('type')) { @@ -420,10 +407,6 @@ FLOW.QuestionView = FLOW.View.extend({ FLOW.selectedControl.selectedQuestion.set('dependentQuestionAnswer', null); } - if (this.get('attribute')) { - FLOW.selectedControl.selectedQuestion.set('metricId', this.attribute.get('keyId')); - } - if (this.get('type')) { FLOW.selectedControl.selectedQuestion.set('type', this.type.get('value')); } @@ -839,25 +822,6 @@ FLOW.QuestionView = FLOW.View.extend({ doQuestionMoveCancel: function () { FLOW.selectedControl.set('selectedForMoveQuestion', null); }, - showAddAttributeDialog: function () { - this.set('showAddAttributeDialogBool', true); - }, - - doAddAttribute: function () { - if ((this.get('newAttributeName') !== null) && (this.get('newAttributeType') !== null)) { - FLOW.store.createRecord(FLOW.Metric, { - "name": this.get('newAttributeName'), - "group": this.get('newAttributeGroup'), - "valueType": this.newAttributeType.get('value') - }); - FLOW.store.commit(); - } - this.set('showAddAttributeDialogBool', false); - }, - - cancelAddAttribute: function () { - this.set('showAddAttributeDialogBool', false); - }, validateQuestionObserver: function () { this.set('questionValidationFailure', (this.text != null && this.text.length > 500)); diff --git a/Dashboard/app/js/lib/views/surveys/survey-group-views.js b/Dashboard/app/js/lib/views/surveys/survey-group-views.js index 1061717169..2fdaa5039f 100644 --- a/Dashboard/app/js/lib/views/surveys/survey-group-views.js +++ b/Dashboard/app/js/lib/views/surveys/survey-group-views.js @@ -197,29 +197,6 @@ FLOW.ApprovalResponsibleUserView = FLOW.View.extend({ }); FLOW.ProjectMainView = FLOW.View.extend({ - - doSave: function() { - var currentProject = FLOW.projectControl.get('currentProject'); - var currentForm = FLOW.selectedControl.get('selectedSurvey'); - - if (currentProject && currentProject.get('isDirty')) { - var name = currentProject.get('name').trim(); - currentProject.set('name', name); - currentProject.set('code', name); - currentProject.set('path', FLOW.projectControl.get('currentProjectPath')); - } - - if (currentForm && currentForm.get('isDirty')) { - var name = currentForm.get('name').trim(); - currentForm.set('name', name); - currentForm.set('code', name); - var path = FLOW.projectControl.get('currentProjectPath') + "/" + name; - currentForm.set('path', path); - } - - FLOW.store.commit(); - }, - hasUnsavedChanges: function() { var selectedProject = FLOW.projectControl.get('currentProject'); var isProjectDirty = selectedProject ? selectedProject.get('isDirty') : false; diff --git a/Dashboard/app/js/lib/views/views.js b/Dashboard/app/js/lib/views/views.js index 23e6d0cc5a..bae33936c4 100644 --- a/Dashboard/app/js/lib/views/views.js +++ b/Dashboard/app/js/lib/views/views.js @@ -11,7 +11,6 @@ require('akvo-flow/views/surveys/survey-group-views'); require('akvo-flow/views/surveys/survey-details-views'); require('akvo-flow/views/surveys/form-view'); require('akvo-flow/views/data/inspect-data-table-views'); -require('akvo-flow/views/data/data-attribute-views'); require('akvo-flow/views/data/bulk-upload-view'); require('akvo-flow/views/data/monitoring-data-table-view'); require('akvo-flow/views/data/cascade-resources-view'); @@ -122,7 +121,7 @@ Ember.Handlebars.registerHelper('placemarkDetail', function () { questionType, imageSrcAttr, signatureJson, photoJson, cartoQuestionType, self=this; if (FLOW.Env.mapsProvider === 'cartodb') { - FLOW.mapsController.questions.forEach(function(qItem){ + FLOW.router.mapsController.questions.forEach(function(qItem){ if (qItem.get("keyId") == Ember.get(self, 'questionID')) { cartoQuestionType = qItem.get("type"); } @@ -215,7 +214,7 @@ Ember.Handlebars.registerHelper('placemarkDetail', function () { Ember.Handlebars.registerHelper('drawGeoshapes', function () { var cartoQuestionType, questionType, self=this; if (FLOW.Env.mapsProvider === 'cartodb') { - FLOW.mapsController.questions.forEach(function(qItem){ + FLOW.router.mapsController.questions.forEach(function(qItem){ if (qItem.get("keyId") == Ember.get(self, 'questionID')) { cartoQuestionType = qItem.get("type"); } @@ -292,21 +291,6 @@ Ember.Handlebars.registerHelper('toPointType', function (value) { return label; }); -// translates values to labels for attributeTypes -Ember.Handlebars.registerHelper('toAttributeType', function (value) { - var label, valueLoc; - label = ""; - valueLoc = Ember.get(this, value); - - FLOW.attributeTypeControl.get('content').forEach(function (item) { - if (item.get('value') == valueLoc) { - label = item.get('label'); - } - }); - return label; -}); - - // add space to vertical bar helper Ember.Handlebars.registerHelper('addSpace', function (property) { return Ember.get(this, property).replace(/\|/g, ' | '); @@ -741,10 +725,6 @@ FLOW.InspectDataView = Ember.View.extend({ templateName: 'navData/inspect-data' }); -FLOW.ManageAttributesView = Ember.View.extend({ - templateName: 'navData/manage-attributes' -}); - FLOW.BulkUploadView = Ember.View.extend({ templateName: 'navData/bulk-upload' }); @@ -773,11 +753,6 @@ FLOW.ChartReportsView = Ember.View.extend({ templateName: 'navReports/chart-reports' }); -FLOW.StatisticsView = Ember.View.extend({ - templateName: 'navReports/statistics' -}); - - // applets FLOW.BootstrapApplet = Ember.View.extend({ templateName: 'navDevices/bootstrap-tab/applets/bootstrap-applet' @@ -921,8 +896,6 @@ FLOW.ColumnView = Ember.View.extend({ FLOW.deviceControl.getSortInfo(); } else if (this.get('type') === 'assignment') { FLOW.surveyAssignmentControl.getSortInfo(); - } else if (this.get('type') === 'attribute') { - FLOW.attributeControl.getSortInfo(); } else if (this.get('type') === 'message') { FLOW.messageControl.getSortInfo(); } diff --git a/Dashboard/app/js/templates/application/footer-public.handlebars b/Dashboard/app/js/templates/application/footer-public.handlebars index 68609a5b10..1ddcb36828 100644 --- a/Dashboard/app/js/templates/application/footer-public.handlebars +++ b/Dashboard/app/js/templates/application/footer-public.handlebars @@ -8,5 +8,5 @@ -
{{t _copyright}} © 2012-2017 akvo.org
+
{{t _copyright}} © 2012-2018 akvo.org
diff --git a/Dashboard/app/js/templates/application/footer.handlebars b/Dashboard/app/js/templates/application/footer.handlebars index 2938b874df..29cf08ae72 100644 --- a/Dashboard/app/js/templates/application/footer.handlebars +++ b/Dashboard/app/js/templates/application/footer.handlebars @@ -22,5 +22,5 @@ -
__VERSION__ - {{t _copyright}} © 2012-2017 akvo.org
+
__VERSION__ - {{t _copyright}} © 2012-2018 akvo.org