Account buildout: files

master
Nick Sergeant 2013-02-10 22:17:05 -05:00
parent d1fcb2834d
commit 8c4b7b3bf0
6 changed files with 187 additions and 0 deletions

96
media/js/src/account.js Normal file
View File

@ -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);

2
media/js/src/account.min.js vendored Normal file
View File

@ -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);

View File

@ -0,0 +1 @@
Section: [[ section ]]

View File

@ -0,0 +1,73 @@
<div class="control-group {% if form.errors.blog_title %}error{% endif %}">
<label class="control-label" for="id_blog_title">Blog title:</label>
<div class="controls">
{{ form.blog_title }}
</div>
</div>
<div class="control-group {% if form.errors.blog_theme %}error{% endif %}">
<label class="control-label" for="id_blog_theme">Blog theme:</label>
<div class="controls">
{{ form.blog_theme }}
</div>
</div>
<div class="control-group {% if form.errors.blog_domain %}error{% endif %}">
<label class="control-label" for="id_blog_domain">Blog domain:</label>
<div class="controls">
{{ form.blog_domain }}
<span class="help-block">Like 'snipt.nicksergeant.com' or 'nicksergeant.com' (without quotes). Set your CNAME / A-record to point to 96.126.110.160</span>
</div>
</div>
<div class="control-group {% if form.errors.gittip_username %}error{% endif %}">
<label class="control-label" for="id_gittip_username">Gittip username:</label>
<div class="controls">
{{ form.gittip_username }}
<span class="help-block">Your <a href="https://www.gittip.com/">Gittip</a> username, if you have one.</span>
</div>
</div>
<div class="control-group {% if form.errors.disqus_shortname %}error{% endif %}">
<label class="control-label" for="id_disqus_shortname">Disqus shortname:</label>
<div class="controls">
{{ form.disqus_shortname }}
<span class="help-block">If you have your own <a href="http://disqus.com/">Disqus</a> account that you'd like to use for your blog comments, enter your shortname here.</span>
</div>
</div>
<div class="control-group {% if form.errors.google_analytics_tracking_id %}error{% endif %}">
<label class="control-label" for="id_google_analytics_tracking_id">Google Analytics tracking ID:</label>
<div class="controls">
{{ form.google_analytics_tracking_id }}
<span class="help-block">If you'd like to track visits to your blog site with <a href="http://analytics.google.com">Google Analytics</a>, enter your tracking ID here.</span>
</div>
</div>
<div class="control-group {% if form.errors.gauges_site_id %}error{% endif %}">
<label class="control-label" for="id_gauges_site_id">Gauges site ID:</label>
<div class="controls">
{{ form.gauges_site_id }}
<span class="help-block">If you'd like to track visits to your blog site with <a href="http://get.gaug.es/">Gauges</a>, enter your site ID here.</span>
</div>
</div>
<div class="control-group {% if form.errors.google_ad_client %}error{% endif %}">
<label class="control-label" for="id_google_ad_client">Google Ads: "google_ad_client"</label>
<div class="controls">
{{ form.google_ad_client }}
<span class="help-block">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.</span>
</div>
</div>
<div class="control-group {% if form.errors.google_ad_slot %}error{% endif %}">
<label class="control-label" for="id_google_ad_slot">Google Ads: "google_ad_slot"</label>
<div class="controls">
{{ form.google_ad_slot }}
</div>
</div>
<div class="control-group {% if form.errors.google_ad_width %}error{% endif %}">
<label class="control-label" for="id_google_ad_width">Google Ads: "google_ad_width"</label>
<div class="controls">
{{ form.google_ad_width }}
</div>
</div>
<div class="control-group {% if form.errors.google_ad_height %}error{% endif %}">
<label class="control-label" for="id_google_ad_height">Google Ads: "google_ad_height"</label>
<div class="controls">
{{ form.google_ad_height }}
</div>
</div>

View File

@ -0,0 +1,12 @@
<div class="control-group {% if form.errors.default_editor %}error{% endif %}">
<label class="control-label" for="id_default_editor">Default editor:</label>
<div class="controls">
{{ form.default_editor }}
</div>
</div>
<div class="control-group {% if form.errors.editor_theme %}error{% endif %}">
<label class="control-label" for="id_editor_theme">Default editor theme:</label>
<div class="controls">
{{ form.editor_theme }}
</div>
</div>

View File

@ -0,0 +1,3 @@
Username: [[ user.username ]]
<a href="/api/">API</a> key: [[ user.api_key ]]
<a href="/api/">API</a> user ID: [[ user.id ]]