Merge pull request #649 from sebgie/issue#345

Clean up settings/general screen
This commit is contained in:
Hannah Wolfe 2013-09-09 01:32:35 -07:00
commit 2f8de8af5b
5 changed files with 19 additions and 78 deletions

View File

@ -2,15 +2,8 @@
(function () {
"use strict";
// Set the url manually and id to '0' to force PUT requests
Ghost.Models.Settings = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/settings',
id: "0",
defaults: {
title: 'My Blog',
description: '',
email: 'admin@tryghost.org'
}
url: Ghost.settings.apiRoot + '/settings'
});
}());

View File

@ -58,11 +58,6 @@
</div>
<div class="form-group">
<label for="blog-description"><strong>Home Page Description</strong></label>
<textarea id="blog-description">{{description}}</textarea>
</div>
</fieldset>
</form>

View File

@ -13,44 +13,32 @@
<p>How your blog name appears on the site</p>
</div>
<div class="form-group">
<label for="blog-description"><strong>Blog Description</strong></label>
<textarea id="blog-description">{{description}}</textarea>
<p>Display a short description below the blog title</p>
</div>
<div class="form-group">
<label><strong>Blog Logo</strong></label>
{{#if logo}}
<a class="js-modal-logo"><img src="{{logo}}" alt="logo"></a>
<a class="js-modal-logo"><img id="blog-logo" src="{{logo}}" alt="logo"></a>
{{else}}
<a class="button-add js-modal-logo" href="#">Upload Image</a>
{{/if}}
<p>Display a logo on your site in place of blog title</p>
</div>
<div class="form-group">
<label><strong>Blog Icon</strong></label>
{{#if icon}}
<a class="js-modal-icon"><img src="{{icon}}" alt="icon"></a>
{{else}}
<a class="button-add js-modal-icon" href="#">Upload Image</a>
{{/if}}
<p>The icon for your blog, used in your browser tab and elsewhere</p>
</div>
<div class="form-group">
<label for="email-address"><strong>Email Address</strong></label>
<input id="email-address" name="general[email-address]" type="email" value="{{email}}">
<p>Address to use for <a href="#">admin notifications</a></p>
<label class="checkbox">
<input type="checkbox" value="1" name="general[public-email]"> Show my email address on my public profile
</label>
</div>
<div class="form-group">
<label for="url-structure"><strong>URL Structure</strong></label>
<select id="url-structure" name="general[urlstructure]">
<option value="post-name">Simple Post Name</option>
<option value="date-based">Date Based</option>
<option value="number based">Number Based</option>
<option value="custom">Custom...</option>
</select>
<label for="postsPerPage"><strong>Posts per page</strong></label>
<input id="postsPerPage" name="general[postsPerPage]" type="number" value="{{postsPerPage}}">
<p>Number of posts per page displayed</p>
</div>
<div class="form-group">
@ -60,24 +48,10 @@
<option value="{{name}}" {{#if active}}selected{{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
<div class="form-group">
<label for="postsPerPage"><strong>Posts per page</strong></label>
<input id="postsPerPage" name="general[postsPerPage]" type="number" value="{{postsPerPage}}">
<p>Number of posts per page displayed</p>
<p>Select a theme for your blog</p>
</div>
</fieldset>
<hr />
<fieldset>
<div class="form-group">
<label for="timezone"><strong>Time Zone</strong></label>
<select id="timezone" name="general[timezone]">
<option value="1">Vienna (UTC+1)</option>
</select>
</div>
</fieldset>
</form>
</section>

View File

@ -4,7 +4,6 @@
<nav class="settings-menu">
<ul>
<li class="general"><a href="#general">General</a></li>
<li class="publishing"><a href="#content">Content</a></li>
<li class="users"><a href="#user">User</a></li>
</ul>
</nav>

View File

@ -160,12 +160,13 @@
var themes = this.model.get('availableThemes');
this.model.unset('availableThemes');
this.model.save({
id: 0, //workaround to use put
title: this.$('#blog-title').val(),
description: $('#blog-description').val(),
logo: this.$('#blog-logo').attr("src"),
email: this.$('#email-address').val(),
logo: this.$('#logo').attr("src"),
icon: this.$('#icon').attr("src"),
activeTheme: this.$('#activeTheme').val(),
postsPerPage: this.$('#postsPerPage').val()
postsPerPage: this.$('#postsPerPage').val(),
activeTheme: this.$('#activeTheme').val()
}, {
success: this.saveSuccess,
error: this.saveError
@ -202,12 +203,6 @@
},
templateName: 'settings/general',
beforeRender: function () {
var settings = this.model.toJSON();
this.$('#blog-title').val(settings.title);
this.$('#email-address').val(settings.email);
},
afterRender: function () {
this.$('.js-drop-zone').upload();
Settings.Pane.prototype.afterRender.call(this);
@ -232,12 +227,8 @@
this.model.set({availableThemes: themes});
},
templateName: 'settings/content',
templateName: 'settings/content'
beforeRender: function () {
var settings = this.model.toJSON();
this.$('#blog-description').val(settings.description);
}
});
// ### User profile
@ -347,17 +338,6 @@
templateName: 'settings/user-profile',
beforeRender: function () {
var user = this.model.toJSON();
this.$('#user-name').val(user.full_name);
this.$('#user-email').val(user.email_address);
this.$('#user-location').val(user.location);
this.$('#user-website').val(user.url);
this.$('#user-bio').val(user.bio);
this.$('#user-profile-picture').attr('src', user.profile_picture);
this.$('#user-cover-picture').attr('src', user.cover_picture);
},
afterRender: function () {
var self = this;
Countable.live(document.getElementById('user-bio'), function (counter) {