1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Merge branch 'new-data-model'

This commit is contained in:
Hannah Wolfe 2013-09-15 00:36:54 +01:00
commit a6feb9ad4e
4 changed files with 23 additions and 23 deletions

View file

@ -5,7 +5,7 @@
{{! TODO: JavaScript toggle featured/unfeatured}}
<span class="status">{{#if published}}Published{{else}}Written{{/if}}</span>
<span class="normal">by</span>
<span class="author">{{#if author.name}}{{author.name}}{{else}}{{author.email_address}}{{/if}}</span>
<span class="author">{{#if author.name}}{{author.name}}{{else}}{{author.email}}{{/if}}</span>
<section class="post-controls">
<a class="post-edit" href="#"><span class="hidden">Edit Post</span></a>
<a class="post-settings" href="#" data-toggle=".menu-drop-right"><span class="hidden">Post Settings</span></a>
@ -31,5 +31,5 @@
</section>
</header>
<section class="content-preview-content">
<div class="wrapper"><h1>{{{title}}}</h1>{{{content}}}</div>
<div class="wrapper"><h1>{{{title}}}</h1>{{{html}}}</div>
</section>

View file

@ -7,25 +7,25 @@
<section class="content no-padding">
<header class="user-profile-header">
<figure class="cover-image">
<img id="user-cover-picture" src="{{#if cover_picture}}{{cover_picture}}{{else}}/shared/img/default-user-cover-picture.jpg{{/if}}" title="{{full_name}} Cover Image"/>
<button class="button-change-cover js-modal-cover-picture">Change Cover</button>
<img id="user-cover" src="{{#if cover}}{{cover}}{{else}}/shared/img/default-user-cover-picture.jpg{{/if}}" title="{{name}} Cover Image"/>
<button class="button-change-cover js-modal-cover">Change Cover</button>
</figure>
</header>
<form class="user-details-container" novalidate="novalidate">
<fieldset class="user-details-top">
<figure class="user-avatar-image">
<img id="user-profile-picture" src="{{#if profile_picture}}{{profile_picture}}{{else}}/shared/img/default-user-profile-picture.jpg{{/if}}" title="{{full_name}}"/>
<button class="button-change-avatar js-modal-profile-picture">Edit Picture</button>
<img id="user-image" src="{{#if image}}{{image}}{{else}}/shared/img/default-user-profile-picture.jpg{{/if}}" title="{{name}}"/>
<button class="button-change-avatar js-modal-image">Edit Picture</button>
</figure>
<label>
<input type="url" value="{{full_name}}" id="user-name" placeholder="Joe Bloggs" autocapitalize="off" autocorrect="off">
<input type="url" value="{{name}}" id="user-name" placeholder="Joe Bloggs" autocapitalize="off" autocorrect="off">
<p>Use your real name so people can recognise you.</p>
</label>
</fieldset>
<fieldset class="user-details-bottom">
<div class="form-group">
<label><strong>Email</strong></label>
<input type="email" value="{{email_address}}" id="user-email" placeholder="Email Address" autocapitalize="off" autocorrect="off">
<input type="email" value="{{email}}" id="user-email" placeholder="Email Address" autocapitalize="off" autocorrect="off">
<p>Email will not be publicly displayed. <a class="highlight" href="#" >Learn more</a>.</p>
</div>
@ -37,7 +37,7 @@
<div class="form-group">
<label><strong>Website</strong></label>
<input type="text" value="{{url}}" id="user-website">
<input type="text" value="{{website}}" id="user-website">
<p>Have a website or blog other than this one? Link it.</p>
</div>

View file

@ -199,14 +199,14 @@
},
savePost: function (data) {
// TODO: The content_raw getter here isn't great, shouldn't rely on currentView.
// TODO: The markdown getter here isn't great, shouldn't rely on currentView.
_.each(this.model.blacklist, function (item) {
this.model.unset(item);
}, this);
var saved = this.model.save(_.extend({
title: $('#entry-title').val(),
content_raw: Ghost.currentView.editor.getValue()
markdown: Ghost.currentView.editor.getValue()
}, data));
// TODO: Take this out if #2489 gets merged in Backbone. Or patch Backbone
@ -255,7 +255,7 @@
this.addSubview(new PublishBar({el: "#publish-bar", model: this.model})).render();
this.$('#entry-title').val(this.model.get('title'));
this.$('#entry-markdown').html(this.model.get('content_raw'));
this.$('#entry-markdown').html(this.model.get('markdown'));
this.initMarkdown();
this.renderPreview();

View file

@ -248,17 +248,17 @@
events: {
'click .button-save': 'saveUser',
'click .button-change-password': 'changePassword',
'click .js-modal-cover-picture': 'showCoverPicture',
'click .js-modal-profile-picture': 'showProfilePicture'
'click .js-modal-cover': 'showCover',
'click .js-modal-image': 'showImage'
},
showCoverPicture: function () {
showCover: function () {
var user = this.model.toJSON();
this.showUpload('#user-cover-picture', 'cover_picture', user.cover_picture);
this.showUpload('#user-cover', 'cover', user.cover);
},
showProfilePicture: function (e) {
showImage: function (e) {
e.preventDefault();
var user = this.model.toJSON();
this.showUpload('#user-profile-picture', 'profile_picture', user.profile_picture);
this.showUpload('#user-image', 'image', user.image);
},
showUpload: function (id, key, src) {
var self = this, upload = new Ghost.Models.uploadModal({'id': id, 'key': key, 'src': src, 'accept': {
@ -314,13 +314,13 @@
} else {
this.model.save({
'full_name': userName,
'email_address': userEmail,
'name': userName,
'email': userEmail,
'location': userLocation,
'url': userWebsite,
'website': userWebsite,
'bio': userBio,
'profile_picture': this.$('#user-profile-picture').attr('src'),
'cover_picture': this.$('#user-cover-picture').attr('src')
'image': this.$('#user-image').attr('src'),
'cover': this.$('#user-cover').attr('src')
}, {
success: this.saveSuccess,
error: this.saveError