Skip to content

Commit

Permalink
Merge pull request #621 from krico/gui-patch
Browse files Browse the repository at this point in the history
Gui patch
  • Loading branch information
wszarmach committed Jul 25, 2015
2 parents 948eae2 + 61a91c1 commit e40727e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
1 change: 0 additions & 1 deletion schedule/schedule-appengine/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ function staticHtml() {
}

function i18n() {
console.log(paths.i18n);
return gulp.src(paths.i18n)
.pipe(gulp.dest(paths.build + '/i18n'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
angular.forEach(this.activityPackages, function (activityPackage) {
ActivityPackage.getActivities(activityPackage.id).then(function (result) {
vm.activityPackageActivities[activityPackage.id] = result;
activityPackageExistsCheck(activityPackage.id);
updateSelectAllFlags();
});
});
Expand All @@ -56,6 +57,8 @@
this.disableActivityPackageActivitySelection = disableActivityPackageActivitySelection;
this.confirmRemoveActivity = confirmRemoveActivity;
this.confirmRemoveActivityPackage = confirmRemoveActivityPackage;
this.confirmClearActivitySelection = confirmClearActivitySelection;
this.confirmClearPackageSelection = confirmClearPackageSelection;
this.hasCompletedActivityPackages = hasCompletedActivityPackages;
this.packageSelectionIncomplete = packageSelectionIncomplete;
this.packageSelectionComplete = packageSelectionComplete;
Expand Down Expand Up @@ -116,6 +119,23 @@
});
}

function confirmClearPackageSelection() {
var translation = $translate('CLEAR_PACKAGE_SELECTION_PROMPT');
jasDialogs.ruSure(translation, function () {
$rootScope.$apply(function () {
vm.activityPackageSelection = {};
});
});
}
function confirmClearActivitySelection() {
var translation = $translate('CLEAR_ACTIVITY_SELECTION_PROMPT');
jasDialogs.ruSure(translation, function () {
$rootScope.$apply(function () {
vm.activitySelection = [];
});
});
}

function confirmRemoveActivityPackage(activityPackage) {
var translation = $translate('REMOVE_ACTIVITY_PACKAGE');
jasDialogs.ruSure(translation, function () {
Expand Down Expand Up @@ -206,6 +226,27 @@

vm.activityPackageSelection = localStorageService.get(sessionStorageKeys.activityPackageSelection) || {};
vm.activitySelection = localStorageService.get(sessionStorageKeys.activitySelection) || [];

activityExistsCheck(vm.activities);
}

function activityPackageExistsCheck(activityPackageId) {

var activityPackageSelection = vm.activityPackageSelection[activityPackageId] || [];

_.remove(activityPackageSelection, function(activityPackageSelectedActivity) {
return !_.find(vm.activityPackageActivities[activityPackageId], { 'id': activityPackageSelectedActivity.id });
});

if (activityPackageSelection.length === 0) {
delete vm.activityPackageSelection[activityPackageId];
}
}

function activityExistsCheck(activities) {
_.remove(vm.activitySelection, function(selectedActivity) {
return !_.find(activities, { 'id': selectedActivity.id });
});
}

function canSelectAllForActivityPackage(activityPackage) {
Expand Down Expand Up @@ -305,4 +346,4 @@
}
}
}
}(window.angular, _));
}(window.angular, _));
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ <h2>{{ 'NO_ITEMS_SELECTED' | translate }}
class="activity-listview listview lv-bordered lv-lg">
<div class="lv-header-alt">
<h2 class="lvh-label">{{ 'SELECTED_ACTIVITY_PACKAGES' | translate }}</h2>
<button ng-click="vm.confirmClearPackageSelection ()"
class="btn btn-warning pull-right">
{{ 'CLEAR_PACKAGE_SELECTION' | translate }}
</button>
</div>
<div class="lv-body">
<div class="lv-item media"
Expand Down Expand Up @@ -64,6 +68,10 @@ <h2 class="lvh-label">{{ 'SELECTED_ACTIVITY_PACKAGES' | translate }}</h2>
class="activity-listview listview lv-bordered lv-lg">
<div class="lv-header-alt">
<h2 class="lvh-label">{{ 'SELECTED_ACTIVITIES' | translate }}</h2>
<button ng-click="vm.confirmClearActivitySelection ()"
class="btn btn-warning pull-right">
{{ 'CLEAR_ACTIVITY_SELECTION' | translate }}
</button>
</div>
<div class="lv-body">
<div class="lv-item media" ng-repeat="activity in vm.activitySelection">
Expand Down
4 changes: 4 additions & 0 deletions schedule/schedule-appengine/src/main/i18n/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@
"PROCEED_TO_BOOKING_VIA_JASIFY": "Booking is done via Jasify. A new window will be opened where you will be able to Sign In or Create an account and proceed to your checkout",
"PROFILE_SETTINGS": "Profile Settings",
"REMOVE": "Remove",
"CLEAR_PACKAGE_SELECTION": "Clear Package Selection",
"CLEAR_PACKAGE_SELECTION_PROMPT": "Do you want to remove all Packages?",
"CLEAR_ACTIVITY_SELECTION": "Clear Activity Selection",
"CLEAR_ACTIVITY_SELECTION_PROMPT": "Do you want to remove all Activities?",
"REMOVE_ACTIVITY": "Do you want to remove this Activity?",
"REMOVE_ACTIVITY_PACKAGE": "Do you want to remove this Activity Package?",
"REPEAT_DAILY": "Repeat daily",
Expand Down

0 comments on commit e40727e

Please sign in to comment.