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

Merge branch '0.3.1-wip'

Conflicts:
	core/server/controllers/admin.js
This commit is contained in:
Hannah Wolfe 2013-09-27 17:22:55 +01:00
commit 32a0c2e7da
15 changed files with 79 additions and 75 deletions

View file

@ -23,8 +23,6 @@
complete: function (result) {
var self = this;
$dropzone.trigger("uploadsuccess", [result, $dropzone.attr('id')]);
function showImage(width, height) {
$dropzone.find('img.js-upload-target').attr({"width": width, "height": height}).css({"display": "block"});
$dropzone.find('.fileupload-loading').remove();
@ -137,7 +135,7 @@
var self = this;
//This is the start point if no image exists
$dropzone.find('img.js-upload-target').css({"display": "none"});
$dropzone.removeClass('pre-image-uploader').addClass('image-uploader');
$dropzone.removeClass('pre-image-uploader image-uploader-url').addClass('image-uploader');
this.removeExtras();
this.buildExtras();
this.bindFileUpload();
@ -148,6 +146,7 @@
initUrl: function () {
var self = this, val;
this.removeExtras();
$dropzone.addClass('image-uploader-url').removeClass('pre-image-uploader');
$dropzone.find('.js-fileupload').addClass('right');
$dropzone.append($cancel);
$dropzone.find('.js-cancel').on('click', function () {
@ -163,6 +162,7 @@
$dropzone.find('div.description').before($url);
$dropzone.find('.js-button-accept').on('click', function () {
$dropzone.trigger('uploadstart', [$dropzone.attr('id')]);
$dropzone.find('div.description').hide();
val = $('#uploadurl').val();
$dropzone.find('.js-fileupload').removeClass('right');
@ -175,7 +175,7 @@
var self = this;
// This is the start point if an image already exists
source = $dropzone.find('img.js-upload-target').attr('src');
$dropzone.removeClass('image-uploader').addClass('pre-image-uploader');
$dropzone.removeClass('image-uploader image-uploader-url').addClass('pre-image-uploader');
$dropzone.find('div.description').hide();
$dropzone.append($cancel);
$dropzone.find('.js-cancel').on('click', function () {

View file

@ -1277,7 +1277,8 @@ main {
.centre{
position: relative;
top: 50px;
margin-bottom: -6px;
display: block;
margin: 0 auto -6px auto;
}
.media {
@include icon($i-image, 60px, darken($lightbrown, 3%)) {
@ -1408,6 +1409,7 @@ main {
color: $brown;
background: rgba(0,0,0,0.1);
border-radius: 2px;
min-height: 46px;
input {
position: absolute;

View file

@ -1,9 +1,9 @@
/*globals Handlebars, moment
*/
(function () {
"use strict";
'use strict';
Handlebars.registerHelper('date', function (context, block) {
var f = block.hash.format || "MMM Do, YYYY",
var f = block.hash.format || 'MMM Do, YYYY',
timeago = block.hash.timeago,
date;
if (timeago) {

View file

@ -1,6 +1,6 @@
/*globals window, $, _, Backbone, Validator */
(function () {
"use strict";
'use strict';
var Ghost = {
Layout : {},

View file

@ -2,7 +2,7 @@
/*global $, window, CodeMirror, Showdown, moment */
(function () {
"use strict";
'use strict';
var Markdown = {
init : function (options, elem) {
var self = this;
@ -17,59 +17,59 @@
replace: function () {
var text = this.elem.getSelection(), pass = true, md, cursor, line, word, letterCount, converter;
switch (this.style) {
case "h1":
case 'h1':
cursor = this.elem.getCursor();
line = this.elem.getLine(cursor.line);
this.elem.setLine(cursor.line, "# " + line);
this.elem.setLine(cursor.line, '# ' + line);
this.elem.setCursor(cursor.line, cursor.ch + 2);
pass = false;
break;
case "h2":
case 'h2':
cursor = this.elem.getCursor();
line = this.elem.getLine(cursor.line);
this.elem.setLine(cursor.line, "## " + line);
this.elem.setLine(cursor.line, '## ' + line);
this.elem.setCursor(cursor.line, cursor.ch + 3);
pass = false;
break;
case "h3":
case 'h3':
cursor = this.elem.getCursor();
line = this.elem.getLine(cursor.line);
this.elem.setLine(cursor.line, "### " + line);
this.elem.setLine(cursor.line, '### ' + line);
this.elem.setCursor(cursor.line, cursor.ch + 4);
pass = false;
break;
case "h4":
case 'h4':
cursor = this.elem.getCursor();
line = this.elem.getLine(cursor.line);
this.elem.setLine(cursor.line, "#### " + line);
this.elem.setLine(cursor.line, '#### ' + line);
this.elem.setCursor(cursor.line, cursor.ch + 5);
pass = false;
break;
case "h5":
case 'h5':
cursor = this.elem.getCursor();
line = this.elem.getLine(cursor.line);
this.elem.setLine(cursor.line, "##### " + line);
this.elem.setLine(cursor.line, '##### ' + line);
this.elem.setCursor(cursor.line, cursor.ch + 6);
pass = false;
break;
case "h6":
case 'h6':
cursor = this.elem.getCursor();
line = this.elem.getLine(cursor.line);
this.elem.setLine(cursor.line, "###### " + line);
this.elem.setLine(cursor.line, '###### ' + line);
this.elem.setCursor(cursor.line, cursor.ch + 7);
pass = false;
break;
case "link":
case 'link':
md = this.options.syntax.link.replace('$1', text);
this.elem.replaceSelection(md, "end");
this.elem.replaceSelection(md, 'end');
cursor = this.elem.getCursor();
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
pass = false;
break;
case "image":
case 'image':
cursor = this.elem.getCursor();
md = this.options.syntax.image.replace('$1', text);
if (this.elem.getLine(cursor.line) !== "") {
if (this.elem.getLine(cursor.line) !== '') {
md = "\n\n" + md;
}
this.elem.replaceSelection(md, "end");
@ -77,16 +77,16 @@
this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});
pass = false;
break;
case "uppercase":
case 'uppercase':
md = text.toLocaleUpperCase();
break;
case "lowercase":
case 'lowercase':
md = text.toLocaleLowerCase();
break;
case "titlecase":
case 'titlecase':
md = text.toTitleCase();
break;
case "selectword":
case 'selectword':
cursor = this.elem.getCursor();
word = this.elem.getTokenAt(cursor);
if (!/\w$/g.test(word.string)) {
@ -95,7 +95,7 @@
this.elem.setSelection({line: cursor.line, ch: word.start}, {line: cursor.line, ch: word.end});
}
break;
case "copyHTML":
case 'copyHTML':
converter = new Showdown.converter();
if (text) {
md = converter.makeHtml(text);
@ -106,13 +106,15 @@
$(".modal-copyToHTML-content").text(md).selectText();
pass = false;
break;
case "list":
md = text.replace(/^(\s*)(\w\W*)/gm, "$1* $2");
this.elem.replaceSelection(md, "end");
case 'list':
md = text.replace(/^(\s*)(\w\W*)/gm, '$1* $2');
this.elem.replaceSelection(md, 'end');
pass = false;
break;
case "currentDate":
md = moment(new Date()).format("D MMMM YYYY");
case 'currentDate':
md = moment(new Date()).format('D MMMM YYYY');
this.elem.replaceSelection(md, 'end');
pass = false;
break;
default:
if (this.options.syntax[this.style]) {
@ -120,7 +122,7 @@
}
}
if (pass && md) {
this.elem.replaceSelection(md, "end");
this.elem.replaceSelection(md, 'end');
if (!text) {
letterCount = md.length;
cursor = this.elem.getCursor();

View file

@ -3,49 +3,49 @@
/*global window, document, $, FastClick */
(function () {
"use strict";
'use strict';
FastClick.attach(document.body);
// ### Show content preview when swiping left on content list
$(".manage").on("click", ".content-list ol li", function (event) {
$('.manage').on('click', '.content-list ol li', function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.preventDefault();
event.stopPropagation();
$(".content-list").animate({right: "100%", left: "-100%", 'margin-right': "15px"}, 300);
$(".content-preview").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
$('.content-list').animate({right: '100%', left: '-100%', 'margin-right': '15px'}, 300);
$('.content-preview').animate({right: '0', left: '0', 'margin-left': '0'}, 300);
}
});
// ### Hide content preview
$(".manage").on("click", ".content-preview .button-back", function (event) {
$('.manage').on('click', '.content-preview .button-back', function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.preventDefault();
event.stopPropagation();
$(".content-list").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
$(".content-preview").animate({right: "-100%", left: "100%", 'margin-left': "15px"}, 300);
$('.content-list').animate({right: '0', left: '0', 'margin-right': '0'}, 300);
$('.content-preview').animate({right: '-100%', left: '100%', 'margin-left': '15px'}, 300);
}
});
// ### Show settings options page when swiping left on settings menu link
$(".settings").on("click", ".settings-menu li", function (event) {
$('.settings').on('click', '.settings-menu li', function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.preventDefault();
event.stopPropagation();
$(".settings-sidebar").animate({right: "100%", left: "-102%", 'margin-right': "15px"}, 300);
$(".settings-content").animate({right: "0", left: "0", 'margin-left': "0"}, 300);
$(".settings-content .button-back, .settings-content .button-save").css("display", "inline-block");
$('.settings-sidebar').animate({right: '100%', left: '-102%', 'margin-right': '15px'}, 300);
$('.settings-content').animate({right: '0', left: '0', 'margin-left': '0'}, 300);
$('.settings-content .button-back, .settings-content .button-save').css('display', 'inline-block');
}
});
// ### Hide settings options page
$(".settings").on("click", ".settings-content .button-back", function (event) {
$('.settings').on('click', '.settings-content .button-back', function (event) {
if (window.matchMedia('(max-width: 800px)').matches) {
event.preventDefault();
event.stopPropagation();
$(".settings-sidebar").animate({right: "0", left: "0", 'margin-right': "0"}, 300);
$(".settings-content").animate({right: "-100%", left: "100%", 'margin-left': "15"}, 300);
$(".settings-content .button-back, .settings-content .button-save").css("display", "none");
$('.settings-sidebar').animate({right: '0', left: '0', 'margin-right': '0'}, 300);
$('.settings-content').animate({right: '-100%', left: '100%', 'margin-left': '15'}, 300);
$('.settings-content .button-back, .settings-content .button-save').css('display', 'none');
}
});

View file

@ -1,6 +1,6 @@
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
'use strict';
Ghost.Models.Post = Backbone.Model.extend({
@ -12,8 +12,8 @@
parse: function (resp) {
if (resp.status) {
resp.published = !!(resp.status === "published");
resp.draft = !!(resp.status === "draft");
resp.published = !!(resp.status === 'published');
resp.draft = !!(resp.status === 'draft');
}
if (resp.tags) {
// TODO: parse tags into it's own collection on the model (this.tags)

View file

@ -1,10 +1,10 @@
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
'use strict';
//id:0 is used to issue PUT requests
Ghost.Models.Settings = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/settings/?type=blog,theme',
id: "0"
id: '0'
});
}());

View file

@ -1,6 +1,6 @@
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
'use strict';
Ghost.Collections.Tags = Backbone.Collection.extend({
url: Ghost.settings.apiRoot + '/tags/'

View file

@ -1,6 +1,6 @@
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
'use strict';
Ghost.Models.Themes = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/themes'

View file

@ -1,11 +1,11 @@
/*global Ghost, Backbone */
(function () {
"use strict";
'use strict';
Ghost.Models.uploadModal = Backbone.Model.extend({
options: {
close: true,
type: "action",
type: 'action',
style: ["wide"],
animation: 'fade',
afterRender: function () {

View file

@ -1,6 +1,6 @@
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
'use strict';
Ghost.Models.User = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/users/me/'

View file

@ -1,15 +1,15 @@
/*global window, document, Ghost, $, _, Backbone */
(function () {
"use strict";
'use strict';
Ghost.Models.Widget = Backbone.Model.extend({
defaults: {
title: "",
name: "",
author: "",
applicationID: "",
size: "",
title: '',
name: '',
author: '',
applicationID: '',
size: '',
content: {
template: '',
data: {
@ -17,9 +17,9 @@
count: 0,
sub: {
value: 0,
dir: "", // "up" or "down"
item: "",
period: ""
dir: '', // "up" or "down"
item: '',
period: ''
}
}
}
@ -28,8 +28,8 @@
settingsPane: false,
enabled: false,
options: [{
title: "ERROR",
value: "Widget options not set"
title: 'ERROR',
value: 'Widget options not set'
}]
}
}

View file

@ -2,7 +2,7 @@
/*global document, $, Ghost */
(function () {
"use strict";
'use strict';
Ghost.temporary.hideToggles = function () {
$('[data-toggle]').each(function () {
@ -11,7 +11,7 @@
});
// Toggle active classes on menu headers
$("[data-toggle].active").removeClass("active");
$('[data-toggle].active').removeClass('active');
};
Ghost.temporary.initToggles = function ($el) {

View file

@ -281,7 +281,7 @@
this.addSubview(new PublishBar({el: "#publish-bar", model: this.model})).render();
this.$('#entry-title').val(this.model.get('title')).focus();
this.$('#entry-markdown').html(this.model.get('markdown'));
this.$('#entry-markdown').text(this.model.get('markdown'));
this.initMarkdown();
this.renderPreview();