Skip to content
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

Megumi brt ground truth #469

Open
wants to merge 7 commits into
base: megumi-brt-ground-truth
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ emulator is just as snappy, and the debugger is better since chrome saves logs
from startup, so you don't have to use tricks like adding alerts to see errors
in startup.

**Note:** Sometimes, the last command (`$ cordova prepare`) fails because of errors while cloning plugins (`Failed to restore plugin "..." from config.xml.`). A workaround is at https://github.com/e-mission/e-mission-docs/blob/master/docs/overview/high_level_faq.md#i-get-an-error-while-adding-plugins

Troubleshooting
---

Expand Down
6 changes: 5 additions & 1 deletion www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1900,4 +1900,8 @@ span.rz-bar-wrapper {
#diary-item {
padding: 0;
border-width: 0;
}
}
.action-sheet-group{
overflow: scroll;
max-height: 400px;
}
3 changes: 2 additions & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<script src="js/diary/current.js"></script>
<script src="js/diary/detail.js"></script>
<script src="js/diary/services.js"></script>
<script src="js/diary/edit-mode.js"></script>
<script src="js/common.js"></script>
<script src="js/common/map.js"></script>
<script src="js/common/trip-list.js"></script>
Expand All @@ -90,7 +91,7 @@
<script src="js/heatmap.js"></script>
<script src="js/metrics.js"></script>
<script src="js/goals.js"></script>
<script src="js/survey.js"></script>
<script src="js/survey.js"></script>
<script src="js/control/general-settings.js"></script>
<script src="js/control/collect-settings.js"></script>
<script src="js/control/sync-settings.js"></script>
Expand Down
15 changes: 13 additions & 2 deletions www/js/diary.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
angular.module('emission.main.diary',['emission.main.diary.list',
'emission.main.diary.detail',
'emission.main.diary.services',
'emission.main.diary.current',])
'emission.main.diary.current',
'emission.main.diary.editMode',])

.config(function($stateProvider) {
$stateProvider
Expand Down Expand Up @@ -33,6 +34,16 @@ angular.module('emission.main.diary',['emission.main.diary.list',
controller: 'CurrMapCtrl'
},
}

})

.state('root.main.diary-edit-mode', {
url: '/diary/:tripId/:tripId2',
views: {
'main-diary': {
templateUrl: 'templates/diary/edit-mode.html',
controller: 'EditModeCtrl'
}
}

});
});
23 changes: 20 additions & 3 deletions www/js/diary/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ angular.module('emission.main.diary.detail',['ui-leaflet', 'ng-walkthrough',
.controller("DiaryDetailCtrl", function($scope, $rootScope, $window, $stateParams, $ionicActionSheet,
leafletData, leafletMapEvents, nzTour, storage,
Logger, Timeline, DiaryHelper, Config,
CommHelper, PostTripManualMarker) {
CommHelper, PostTripManualMarker, $state, EditModeFactory) {
console.log("controller DiaryDetailCtrl called with params = "+
JSON.stringify($stateParams));

Expand Down Expand Up @@ -64,7 +64,10 @@ angular.module('emission.main.diary.detail',['ui-leaflet', 'ng-walkthrough',
$scope.getFormattedTimeRange = DiaryHelper.getFormattedTimeRange;
$scope.getFormattedDuration = DiaryHelper.getFormattedDuration;
$scope.getTripDetails = DiaryHelper.getTripDetails
$scope.tripgj = DiaryHelper.directiveForTrip($scope.trip);
$scope.tripgj = DiaryHelper.directiveForTrip($scope.trip, false);

console.log("TRIP");
console.log(JSON.stringify($scope.trip));

$scope.getTripBackground = function() {
var ret_val = DiaryHelper.getTripBackground($rootScope.dark_theme, $scope.tripgj);
Expand Down Expand Up @@ -162,8 +165,22 @@ angular.module('emission.main.diary.detail',['ui-leaflet', 'ng-walkthrough',
startWalkthrough();
}

$scope.editMode = function(param) {
$state.go('root.main.diary-edit-mode', {tripId: param});
}

$scope.userEdit = function(trip) {
var edited = false
trip.sections.forEach(function(section) {
if(section.id.split('_')[0] == 'edited') {
edited = true
}
})
return edited
}

$scope.$on('$ionicView.afterEnter', function(ev) {
// Workaround from
// Workaround from
// https://github.com/driftyco/ionic/issues/3433#issuecomment-195775629
if(ev.targetScope !== $scope)
return;
Expand Down
77 changes: 77 additions & 0 deletions www/js/diary/edit-mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
'use strict';
angular.module('emission.main.diary.editMode',['ui-leaflet', 'ng-walkthrough',
'ionic-datepicker', 'nvd3', 'angularLocalStorage',
'emission.services', 'emission.plugin.logger',
'emission.incident.posttrip.manual'])

.controller("EditModeCtrl", function($scope, $rootScope, $window, $stateParams, $ionicActionSheet,
leafletData, leafletMapEvents, nzTour, storage,
Logger, Timeline, DiaryHelper, Config,
CommHelper, PostTripManualMarker, EditModeFactory, $ionicHistory) {
console.log("controller editMode called with params = "+
JSON.stringify($stateParams));

$scope.mapCtrl = {};
angular.extend($scope.mapCtrl, {
defaults : {
}
});

angular.extend($scope.mapCtrl.defaults, Config.getMapTiles())

$scope.$on('leafletDirectiveMap.detail.resize', function(event, data) {
console.log("diary/editMode received resize event, invalidating map size");
data.leafletObject.invalidateSize();
});

$scope.refreshTiles = function() {
$scope.$broadcast('invalidateSize');
};

$scope.getFormattedDate = DiaryHelper.getFormattedDate;
$scope.arrowColor = DiaryHelper.arrowColor;
$scope.parseEarlierOrLater = DiaryHelper.parseEarlierOrLater;
$scope.getEarlierOrLater = DiaryHelper.getEarlierOrLater;
$scope.getLongerOrShorter = DiaryHelper.getLongerOrShorter;
$scope.getIcon = DiaryHelper.getIcon;
$scope.getHumanReadable = DiaryHelper.getHumanReadable;
$scope.getPercentages = DiaryHelper.getPercentages;
$scope.allModes = DiaryHelper.allModes;
$scope.trip = Timeline.getTrip($stateParams.tripId);
$scope.getKmph = DiaryHelper.getKmph;
$scope.getFormattedDistance = DiaryHelper.getFormattedDistance;
$scope.getSectionDetails = DiaryHelper.getSectionDetails;
$scope.getFormattedTime = DiaryHelper.getFormattedTime;
$scope.getFormattedTimeRange = DiaryHelper.getFormattedTimeRange;
$scope.getFormattedDuration = DiaryHelper.getFormattedDuration;
$scope.getTripDetails = DiaryHelper.getTripDetails
$scope.tripgj = DiaryHelper.directiveForTrip($scope.trip, true);
console.log($scope.tripgj);
console.log($scope.trip);

$scope.save = function() {
EditModeFactory.save($scope.trip)
$ionicHistory.goBack()
}

$scope.cancel = function() {
EditModeFactory.clear()
$ionicHistory.goBack()
}

$scope.getTripBackground = function() {
var ret_val = DiaryHelper.getTripBackground($rootScope.dark_theme, $scope.tripgj);
return ret_val;
}

console.log("trip.start_place = " + JSON.stringify($scope.trip.start_place));

// leafletData.getMap('detail').then(function(map) {
// map.on('click', PostTripManualMarker.startAddingIncidentToTrip($scope.trip, map));
// });


$scope.editMode = function(param) {
$state.go('root.main.diary-edit-mode', {tripId: param});
}
})
Loading