-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into survey_menu
- Loading branch information
Showing
52 changed files
with
951 additions
and
147 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module.exports = DonationButtonDirective; | ||
|
||
DonationButtonDirective.$inject = []; | ||
function DonationButtonDirective() { | ||
return { | ||
restrict: 'E', | ||
replace: true, | ||
scope: { | ||
button: '=?' | ||
}, | ||
controller: DonationButtonController, | ||
template: require('./donation-button.html') | ||
}; | ||
} | ||
|
||
DonationButtonController.$inject = [ | ||
'$scope', | ||
'$window', | ||
'DonationService' | ||
]; | ||
function DonationButtonController( | ||
$scope, | ||
$window, | ||
DonationService | ||
) { | ||
$scope.loading = false; | ||
$scope.openDonationModal = DonationService.openDonationModal; | ||
$scope.isButton = isButton; | ||
|
||
function isButton() { | ||
return $scope.button; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<button type="button" class="button button-alpha button-plain" data-modal="donate" ng-click="openDonationModal()"> | ||
<div class="loading" ng-if="loading"> | ||
<div class="line"></div> | ||
<div class="line"></div> | ||
<div class="line"></div> | ||
</div> | ||
<svg class="iconic" role="img" ng-hide="loading"> | ||
<use xlink:href="/img/iconic-sprite.svg#heart"></use> | ||
</svg> | ||
<span translate="app.donate">Donate</span> | ||
</button> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const { config } = require('raven-js'); | ||
|
||
module.exports = DonationModalDirective; | ||
|
||
DonationModalDirective.$inject = []; | ||
function DonationModalDirective() { | ||
return { | ||
restrict: 'E', | ||
scope: {}, | ||
replace: true, | ||
controller: DonationModalController, | ||
template: require('./donation-modal.html') | ||
}; | ||
} | ||
|
||
DonationModalController.$inject = [ | ||
'$scope', | ||
'$rootScope' | ||
]; | ||
function DonationModalController( | ||
$scope, | ||
$rootScope | ||
) { | ||
$scope.donation = $rootScope.donation; | ||
$scope.donationClientEnabled = $rootScope.donationClientEnabled; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<div class="modal-body"> | ||
<!-- <h3 class="modal-title">{{ donation.title }}</h3> --> | ||
|
||
<p> {{ donation.description }} </p> | ||
|
||
<div class="modal-images"> | ||
<img ng-repeat="image in donation.images" ng-src="{{ image.original_file_url }}"> | ||
</div> | ||
|
||
<div class="divider"></div> | ||
|
||
<p class="soft-text" ng-show="donationClientEnabled"> | ||
<svg class="iconic"> | ||
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/img/iconic-sprite.svg#heart"></use> | ||
</svg> | ||
Web monetization is enabled on this website. | ||
Thank you for your donation. You have donated {{ donation.assetCode }} {{ donation.formattedAmount }} so far | ||
</p> | ||
|
||
<p class="soft-text" ng-show="!donationClientEnabled"> | ||
Ushahidi deployments are now web monetization enabled. | ||
Web monetization is a way of supporting the websites you love without playing advertisers game. | ||
All you need is to get your browser setup. Click the link below to learn how you can donate. | ||
</p> | ||
|
||
<div ng-show="!donationClientEnabled"> | ||
<a target="_blank" href="https://docs.ushahidi.com/ushahidi-platform-user-manual/7.-managing-your-donations/7.1-donations#7-1-3-how-to-support-deployments-with-donations" class="link-blue">How can I donate?</a> | ||
</div> | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
angular.module('ushahidi.donation', []) | ||
|
||
.directive('donation', require('./donation.directive.js')) | ||
|
||
.directive('donationButton', require('./donation-button.directive.js')) | ||
|
||
.directive('donationModal', require('./donation-modal.directive.js')) | ||
|
||
.directive('donationToolbar', require('./donation-toolbar.directive.js')) | ||
|
||
.service('DonationService', require('./donation.service.js')); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module.exports = DonationToolbarDirective; | ||
|
||
DonationToolbarDirective.$inject = []; | ||
function DonationToolbarDirective() { | ||
return { | ||
restrict: 'E', | ||
scope: {}, | ||
replace: true, | ||
controller: DonationToolbarController, | ||
template: require('./donation-toolbar.html') | ||
}; | ||
} | ||
|
||
DonationToolbarController.$inject = [ | ||
'$scope', | ||
'$rootScope', | ||
'DonationService' | ||
]; | ||
function DonationToolbarController( | ||
$scope, | ||
$rootScope, | ||
DonationService | ||
) { | ||
$scope.formattedAmount = 0.00; | ||
$scope.openDonationModal = DonationService.openDonationModal; | ||
|
||
$rootScope.$on('setDonatedAmount', function (event, value) { | ||
$scope.formattedAmount = value; | ||
$scope.$apply(); | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<button class="button button-transparent" data-modal="donation" ng-click="openDonationModal()"> | ||
<span class="toolbar-donating"> | ||
<span class="iconic"> | ||
<svg role="img" class="coins iconic"> | ||
<use xlink:href="/img/iconic-sprite.svg#coins"></use> | ||
</svg> | ||
</span> | ||
<span class="button-label">{{ formattedAmount }}</span> | ||
<span class="iconic"> | ||
<svg role="img" class="iconic"> | ||
<use xlink:href="/img/iconic-sprite.svg#info-circle"></use> | ||
</svg> | ||
</span> | ||
</span> | ||
</button> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
module.exports = DonationDirective; | ||
|
||
DonationDirective.$inject = []; | ||
function DonationDirective() { | ||
return { | ||
restrict: 'E', | ||
replace: true, | ||
scope: {}, | ||
controller: DonationController, | ||
template: require('./donation.html') | ||
}; | ||
} | ||
|
||
DonationController.$inject = [ | ||
'$scope', | ||
'$rootScope', | ||
'ConfigEndpoint', | ||
'DonationService', | ||
'Features' | ||
]; | ||
function DonationController( | ||
$scope, | ||
$rootScope, | ||
ConfigEndpoint, | ||
DonationService, | ||
Features | ||
) { | ||
$scope.loading = true; | ||
$scope.donationClientEnabled = $rootScope.donationClientEnabled || false; | ||
$scope.donationDeploymentEnabled = false; | ||
$scope.donationFeatureEnabled = false; | ||
|
||
$rootScope.$on('event:donation:started', function (event) { | ||
$rootScope.donationClientEnabled = true; | ||
$scope.donationClientEnabled = true; | ||
}); | ||
|
||
$rootScope.$on('event:donation:settings:update', function (event, value) { | ||
$rootScope.donation = value; | ||
}); | ||
|
||
Features.loadFeatures().then(function () { | ||
ConfigEndpoint.get({id: 'site'}).$promise.then(function (site) { | ||
$rootScope.donation = site.donation; | ||
$scope.donationDeploymentEnabled = site.donation.enabled; | ||
$scope.donationFeatureEnabled = Features.isFeatureEnabled('donation'); | ||
|
||
console.log($scope.donationClientEnabled); | ||
console.log($scope.donationFeatureEnabled); | ||
console.log($scope.donationDeploymentEnabled); | ||
|
||
if ($scope.donationFeatureEnabled && $scope.donationDeploymentEnabled) { | ||
$rootScope.$emit('setPaymentPointer', $rootScope.donation.wallet); | ||
|
||
DonationService.setupMonetization(); | ||
} | ||
|
||
$scope.loading = false; | ||
}); | ||
}); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<span ng-show="donationFeatureEnabled && donationDeploymentEnabled"> | ||
<donation-button ng-show="!donationClientEnabled"> </donation-button> | ||
<donation-toolbar ng-show="donationClientEnabled"> </donation-toolbar> | ||
</span> | ||
|
Oops, something went wrong.