mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
* dummy * Renamed internationalized strings to more meaningful names * moved the new group creation state out to its own URL, so it can also be linked to by the static/plans page * Added redirect-through-login functionality from the static/plans page new-group button This includes a static non-modal login page (similar to how other sites have both a login page and login modal) The login body has been abstracted out from its modal-specific view into mixins to accomplish this * deleted bak files added by mistake * deleted scripts added by mistake * changed static/plans Create Group button text * Added form link (https://github.com/HabitRPG/habitica/issues/8674#issuecomment-303518039) Removed changes to non-EN locale files (https://github.com/HabitRPG/habitica/pull/8729#issuecomment-303555211) * reverted key name changes as per https://github.com/HabitRPG/habitica/pull/8729#issuecomment-304515534 * changed $rootScope to $scope https://github.com/HabitRPG/habitica/pull/8729#discussion_r120695874
This commit is contained in:
53
website/client-old/js/controllers/newGroupCtrl.js
Normal file
53
website/client-old/js/controllers/newGroupCtrl.js
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
A controller to manage the New Group page
|
||||
*/
|
||||
|
||||
angular.module('habitrpg')
|
||||
.controller("NewGroupCtrl", ['$scope', '$window', 'Groups', 'Payments',
|
||||
function ($scope, $window, Groups, Payments) {
|
||||
$scope.PAGES = {
|
||||
CREATE_GROUP: 'create-group',
|
||||
UPGRADE_GROUP: 'upgrade-group',
|
||||
};
|
||||
$scope.activePage = $scope.PAGES.CREATE_GROUP;
|
||||
$scope.changePage = function (page) {
|
||||
$scope.activePage = page;
|
||||
$window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
$scope.newGroup = {
|
||||
type: 'guild',
|
||||
privacy: 'private',
|
||||
};
|
||||
$scope.PAYMENTS = {
|
||||
AMAZON: 'amazon',
|
||||
STRIPE: 'stripe',
|
||||
};
|
||||
|
||||
$scope.newGroupIsReady = function () {
|
||||
return !!$scope.newGroup.name;
|
||||
};
|
||||
|
||||
$scope.createGroup = function () {
|
||||
$scope.changePage($scope.PAGES.UPGRADE_GROUP);
|
||||
};
|
||||
|
||||
$scope.upgradeGroup = function (paymentType) {
|
||||
var subscriptionKey = 'group_monthly'; // @TODO: Get from content API?
|
||||
if (paymentType === $scope.PAYMENTS.STRIPE) Payments.showStripe({
|
||||
subscription: subscriptionKey,
|
||||
coupon: null,
|
||||
groupToCreate: $scope.newGroup
|
||||
});
|
||||
if (paymentType === $scope.PAYMENTS.AMAZON) Payments.amazonPayments.init({
|
||||
type: 'subscription',
|
||||
subscription: subscriptionKey,
|
||||
coupon: null,
|
||||
groupToCreate: $scope.newGroup
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user