diff --git a/media/js/src/account.js b/media/js/src/account.js new file mode 100644 index 0000000..e661de3 --- /dev/null +++ b/media/js/src/account.js @@ -0,0 +1,96 @@ +(function() { + + if (typeof angular !== 'undefined') { + + // Globals. + var root = this; + var $ = root.jQuery; + + // App definition. + var app = angular.module('Account', [], function($routeProvider, $locationProvider) { + + $locationProvider.html5Mode(true); + + // Routes. + $routeProvider.when('/account/', { + templateUrl: '/media/js/src/modules/partials/profile.html', + controller: controllers.ProfileController + }); + $routeProvider.when('/account/billing/', { + templateUrl: '/media/js/src/modules/partials/billing.html', + controller: controllers.BillingController + }); + $routeProvider.when('/account/blogging/', { + templateUrl: '/media/js/src/modules/partials/blogging.html', + controller: controllers.BloggingController + }); + $routeProvider.when('/account/editor/', { + templateUrl: '/media/js/src/modules/partials/editor.html', + controller: controllers.EditorController + }); + + // I have absolutely no idea why I need to do this. Angular shouldn't touch URLs + // that don't match above. But for some reason, it does. So if you have a non-routed + // URL inside of your controller, your browser won't redirect. + // + // -10 points, Angular. + $routeProvider.otherwise({ + 'redirectTo': function(routeParams, locationPath) { + window.location = locationPath; + } + }); + + }); + + // Use non-Django-style interpolation. + app.config(function($interpolateProvider) { + $interpolateProvider.startSymbol('[['); + $interpolateProvider.endSymbol(']]'); + }); + + // Services. + app.factory('AccountStorage', function($http) { + return { + getAccount: function() { + + var promise = $http({ + method: 'GET', + url: '/api/account/', + headers: {} + }); + + return promise; + } + }; + }); + + // Controllers. + var controllers = {}; + + controllers.MainController = function($scope, $route, AccountStorage) { + $scope.route = $route; + + AccountStorage.getAccount().then(function(response) { + console.log(response); + }); + }; + + controllers.BillingController = function($scope) { + $scope.section = 'Billing'; + }; + controllers.BloggingController = function($scope) { + $scope.section = 'Blogging'; + }; + controllers.EditorController = function($scope) { + $scope.section = 'Editor'; + }; + controllers.ProfileController = function($scope) { + $scope.section = 'Profile'; + }; + + // Assign the controllers. + app.controller(controllers); + + } + +}).call(this); diff --git a/media/js/src/account.min.js b/media/js/src/account.min.js new file mode 100644 index 0000000..e71ef47 --- /dev/null +++ b/media/js/src/account.min.js @@ -0,0 +1,2 @@ + +(function(){if(typeof angular!=='undefined'){var root=this;var $=root.jQuery;var app=angular.module('Account',[],function($routeProvider,$locationProvider){$locationProvider.html5Mode(true);$routeProvider.when('/account/',{templateUrl:'/media/js/src/modules/partials/profile.html',controller:controllers.ProfileController});$routeProvider.when('/account/billing/',{templateUrl:'/media/js/src/modules/partials/billing.html',controller:controllers.BillingController});$routeProvider.when('/account/blogging/',{templateUrl:'/media/js/src/modules/partials/blogging.html',controller:controllers.BloggingController});$routeProvider.when('/account/editor/',{templateUrl:'/media/js/src/modules/partials/editor.html',controller:controllers.EditorController});$routeProvider.otherwise({'redirectTo':function(routeParams,locationPath){window.location=locationPath;}});});app.config(function($interpolateProvider){$interpolateProvider.startSymbol('[[');$interpolateProvider.endSymbol(']]');});app.factory('AccountStorage',function($http){return{getAccount:function(){var promise=$http({method:'GET',url:'/api/account/',headers:{}});return promise;}};});var controllers={};controllers.MainController=function($scope,$route,AccountStorage){$scope.route=$route;AccountStorage.getAccount().then(function(response){console.log(response);});};controllers.BillingController=function($scope){$scope.section='Billing';};controllers.BloggingController=function($scope){$scope.section='Blogging';};controllers.EditorController=function($scope){$scope.section='Editor';};controllers.ProfileController=function($scope){$scope.section='Profile';};app.controller(controllers);}}).call(this); \ No newline at end of file diff --git a/media/js/src/modules/partials/billing.html b/media/js/src/modules/partials/billing.html new file mode 100644 index 0000000..5277178 --- /dev/null +++ b/media/js/src/modules/partials/billing.html @@ -0,0 +1 @@ +Section: [[ section ]] diff --git a/media/js/src/modules/partials/blogging.html b/media/js/src/modules/partials/blogging.html new file mode 100644 index 0000000..45ffc4c --- /dev/null +++ b/media/js/src/modules/partials/blogging.html @@ -0,0 +1,73 @@ +
+ +
+ {{ form.blog_title }} +
+
+
+ +
+ {{ form.blog_theme }} +
+
+
+ +
+ {{ form.blog_domain }} + Like 'snipt.nicksergeant.com' or 'nicksergeant.com' (without quotes). Set your CNAME / A-record to point to 96.126.110.160 +
+
+
+ +
+ {{ form.gittip_username }} + Your Gittip username, if you have one. +
+
+
+ +
+ {{ form.disqus_shortname }} + If you have your own Disqus account that you'd like to use for your blog comments, enter your shortname here. +
+
+
+ +
+ {{ form.google_analytics_tracking_id }} + If you'd like to track visits to your blog site with Google Analytics, enter your tracking ID here. +
+
+
+ +
+ {{ form.gauges_site_id }} + If you'd like to track visits to your blog site with Gauges, enter your site ID here. +
+
+ +
+ +
+ {{ form.google_ad_client }} + If you'd like to run Google Ads in your blog's sidebar, enter your client ID here, as well as the following three fields. +
+
+
+ +
+ {{ form.google_ad_slot }} +
+
+
+ +
+ {{ form.google_ad_width }} +
+
+
+ +
+ {{ form.google_ad_height }} +
+
diff --git a/media/js/src/modules/partials/editor.html b/media/js/src/modules/partials/editor.html new file mode 100644 index 0000000..55b8c25 --- /dev/null +++ b/media/js/src/modules/partials/editor.html @@ -0,0 +1,12 @@ +
+ +
+ {{ form.default_editor }} +
+
+
+ +
+ {{ form.editor_theme }} +
+
diff --git a/media/js/src/modules/partials/profile.html b/media/js/src/modules/partials/profile.html new file mode 100644 index 0000000..6c67185 --- /dev/null +++ b/media/js/src/modules/partials/profile.html @@ -0,0 +1,3 @@ +Username: [[ user.username ]] +API key: [[ user.api_key ]] +API user ID: [[ user.id ]]