Files
habitica/website/client-old/js/static.js
yugensoft c502b1997b Updated new-groups / group-plans static page #8674 (#8729)
* 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
2017-07-06 14:08:02 -07:00

74 lines
2.2 KiB
JavaScript

"use strict";
window.habitrpg = angular.module('habitrpg', ['chieffancypants.loadingBar', 'ui.bootstrap'])
.constant("API_URL", "")
.constant("STORAGE_USER_ID", 'habitrpg-user')
.constant("STORAGE_SETTINGS_ID", 'habit-mobile-settings')
.constant("MOBILE_APP", false)
.controller("RootCtrl", ['$scope', '$location', '$modal', '$http', 'Stats', 'Members',
function($scope, $location, $modal, $http, Stats, Members) {
var memberId = $location.search()['memberId'];
if (memberId) {
Members.fetchMember(memberId)
.success(function(response) {
$scope.profile = response.data;
$scope.statCalc = Stats;
$scope.Content = window.habitrpgShared.content;
$modal.open({
templateUrl: 'modals/member.html',
scope: $scope
});
});
}
$http.defaults.headers.common['x-client'] = 'habitica-web';
}])
.controller("PlansCtrl", ['$rootScope','Analytics','$location','User','$scope',
function($rootScope,Analytics,$location,User,$scope) {
$rootScope.clickContact = function(){
Analytics.track({'hitType':'event','eventCategory':'button','eventAction':'click','eventLabel':'Contact Us (Plans)'})
};
$scope.goToNewGroupPage = function () {
if (User.authenticated()) {
window.location.href="/#/options/groups/new-group";
} else {
// There is no authenticated user, so redirect to the login page,
// taking the hash with it to effectively redirect after login.
window.location.href = "/static/login#/options/groups/new-group";
}
};
}
])
.controller('AboutCtrl',[function(){
$(document).ready(function(){
$('a.gallery').colorbox({
maxWidth: '90%',
maxHeight: '80%',
transition: 'none',
scalePhotos:true
//maxHeight: '70%'
});
});
}])
.controller('AccordionCtrl', function() {
function openHashAccordion() {
if (window.location.hash) {
var $target = $(window.location.hash.replace('/',''));
if ($target.hasClass('collapse')) {
$target.collapse('show');
$('html, body').animate({
scrollTop: $($target).offset().top - 100
});
}
}
}
$(document).ready(function(){
openHashAccordion();
});
})