forked from Botanical/BotanJS
Major bug fixes due to migration issue
This commit is contained in:
parent
f88643cead
commit
f1d20a82d4
@ -20,12 +20,20 @@
|
|||||||
/** @type {Astro.Blog.Components.Bubble} */
|
/** @type {Astro.Blog.Components.Bubble} */
|
||||||
var Bubble = __import( "Astro.Blog.Components.Bubble" );
|
var Bubble = __import( "Astro.Blog.Components.Bubble" );
|
||||||
|
|
||||||
var postData = __import( "System.Net.postData" );
|
var opostData = __import( "System.Net.postData" );
|
||||||
var prettyDate = __import( "Astro.utils.Date.pretty" );
|
var prettyDate = __import( "Astro.utils.Date.pretty" );
|
||||||
|
|
||||||
var Visualizer = ns[ NS_INVOKE ]( "Visualizer" );
|
var Visualizer = ns[ NS_INVOKE ]( "Visualizer" );
|
||||||
var Tag = ns[ NS_INVOKE ]( "Tag" );
|
var Tag = ns[ NS_INVOKE ]( "Tag" );
|
||||||
|
|
||||||
|
|
||||||
|
// Editor Override
|
||||||
|
var postData = function( processor, data, success, failed )
|
||||||
|
{
|
||||||
|
data[ "editor" ] = 1;
|
||||||
|
opostData( processor, data, success, failed );
|
||||||
|
};
|
||||||
|
|
||||||
var Article = function( processorSet )
|
var Article = function( processorSet )
|
||||||
{
|
{
|
||||||
var pBubble = new Bubble();
|
var pBubble = new Bubble();
|
||||||
@ -120,6 +128,16 @@
|
|||||||
ArticleModel.content = _content;
|
ArticleModel.content = _content;
|
||||||
ArticleModel.date_modified = obj.date_modified;
|
ArticleModel.date_modified = obj.date_modified;
|
||||||
|
|
||||||
|
// If this is a published article
|
||||||
|
// we need to set the ref_id for ArticleModel
|
||||||
|
// then set current id to draft's id
|
||||||
|
if( ArticleModel.article_id != obj.article_id )
|
||||||
|
{
|
||||||
|
ArticleModel.draft = true;
|
||||||
|
ArticleModel.ref_id = __article_id;
|
||||||
|
ArticleModel.article_id = obj.article_id;
|
||||||
|
}
|
||||||
|
|
||||||
// Set article id if this is a new document
|
// Set article id if this is a new document
|
||||||
if ( obj.article_id )
|
if ( obj.article_id )
|
||||||
ArticleModel.article_id = __article_id = obj.article_id;
|
ArticleModel.article_id = __article_id = obj.article_id;
|
||||||
@ -137,7 +155,12 @@
|
|||||||
|
|
||||||
this.contentUpdate && saveSuccess( obj );
|
this.contentUpdate && saveSuccess( obj );
|
||||||
|
|
||||||
new MessageBox("AstroEdit", "You have successfully published your article!", "Stay here", "Exit and goto article", publishAction).show();
|
new MessageBox(
|
||||||
|
"AstroEdit"
|
||||||
|
, "You have successfully published your article!"
|
||||||
|
, "Stay here", "Exit and goto article"
|
||||||
|
, publishAction
|
||||||
|
).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
, publishAction = function ( stay )
|
, publishAction = function ( stay )
|
||||||
@ -187,20 +210,17 @@
|
|||||||
if ( obj && obj.entry )
|
if ( obj && obj.entry )
|
||||||
{
|
{
|
||||||
debug.Info( "[Document] Article Loaded" );
|
debug.Info( "[Document] Article Loaded" );
|
||||||
if ( obj.backup )
|
if ( obj.entry.ref_id )
|
||||||
{
|
{
|
||||||
|
// This is a backup item
|
||||||
|
__article_id = obj.article_id;
|
||||||
|
|
||||||
pBubble.setColor( "royalblue" );
|
pBubble.setColor( "royalblue" );
|
||||||
pBubble.pop( "Using backup entry" );
|
pBubble.pop( "Using backup entry" );
|
||||||
Cycle.delay( function () { pBubble.blurp() }, 3000 );
|
Cycle.delay( function () { pBubble.blurp() }, 3000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
setArticle( obj.entry );
|
setArticle( obj.entry );
|
||||||
if ( !obj.entry.article_id )
|
|
||||||
{
|
|
||||||
// sever will not return article_id
|
|
||||||
// since it is an UPDATE
|
|
||||||
// Store the article_id manually
|
|
||||||
obj.entry.article_id = __article_id;
|
|
||||||
}
|
|
||||||
__statePusher( obj.entry, __article_id );
|
__statePusher( obj.entry, __article_id );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -251,15 +271,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
, deleteSuccess = function ()
|
, deleteSuccess = function ( obj )
|
||||||
{
|
{
|
||||||
location.reload(true);
|
var loc = window.location;
|
||||||
|
loc.replace(
|
||||||
|
loc.href.replace(
|
||||||
|
"/" + ArticleModel.article_id
|
||||||
|
, ArticleModel.ref_id ? ( "/" + ArticleModel.ref_id ) : ""
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
, serverFailed = function ( obj )
|
, serverFailed = function ( obj )
|
||||||
{
|
{
|
||||||
pBubble.setColor( "red" );
|
pBubble.setColor( "red" );
|
||||||
pBubble.pop( obj["mesg"] );
|
pBubble.pop( obj ? obj["mesg"] : "Server Error" );
|
||||||
Cycle.delay( function () { pBubble.blurp() }, 3000 );
|
Cycle.delay( function () { pBubble.blurp() }, 3000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,16 +312,9 @@
|
|||||||
, title: _title
|
, title: _title
|
||||||
, content: _content
|
, content: _content
|
||||||
, tags: _ae_tag.getTags()
|
, tags: _ae_tag.getTags()
|
||||||
, draft: ArticleModel.draft ? 1 : 0
|
, draft: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ArticleModel.draft == 0)
|
|
||||||
{
|
|
||||||
// This a published article
|
|
||||||
// action is Backup
|
|
||||||
_data.backup = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
postData( processorSet, _data, saveSuccess, serverFailed );
|
postData( processorSet, _data, saveSuccess, serverFailed );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -384,6 +403,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.drop = function ()
|
this.drop = function ()
|
||||||
|
{
|
||||||
|
if( ArticleModel.draft )
|
||||||
{
|
{
|
||||||
new MessageBox(
|
new MessageBox(
|
||||||
"Delete draft"
|
"Delete draft"
|
||||||
@ -391,6 +412,14 @@
|
|||||||
, "Delete", "No"
|
, "Delete", "No"
|
||||||
, deleteDraft
|
, deleteDraft
|
||||||
).show();
|
).show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new MessageBox(
|
||||||
|
"Delete Draft"
|
||||||
|
, "There is no draft to delete"
|
||||||
|
).show();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updateContent = contentUpdate;
|
this.updateContent = contentUpdate;
|
||||||
|
@ -70,8 +70,8 @@
|
|||||||
|
|
||||||
// Register on click function
|
// Register on click function
|
||||||
entry.addEventListener( "click", function() {
|
entry.addEventListener( "click", function() {
|
||||||
article.load( entry.getAttribute( "value" ), __pushState );
|
article.load( this.getAttribute( "value" ), __pushState );
|
||||||
} );
|
}.bind( entry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ae_drafts_h = ae_drafts.clientHeight;
|
ae_drafts_h = ae_drafts.clientHeight;
|
||||||
@ -147,7 +147,7 @@
|
|||||||
|
|
||||||
, __pushState = function ( obj, article_id )
|
, __pushState = function ( obj, article_id )
|
||||||
{
|
{
|
||||||
window.history.pushState( obj, "", "../" + article_id + "/" );
|
window.history.pushState( obj, "", "/astroedit/" + article_id + "/" );
|
||||||
}
|
}
|
||||||
|
|
||||||
setupExpand();
|
setupExpand();
|
||||||
|
@ -62,9 +62,9 @@
|
|||||||
background-color: crimson;
|
background-color: crimson;
|
||||||
}
|
}
|
||||||
|
|
||||||
.b_publish { background-color: slategrey; }
|
.b_scope { background-color: slategrey; }
|
||||||
.b_publish:before { content: 'Publish'; background-color: purple; }
|
.b_scope:before { content: 'Private'; background-color: purple; }
|
||||||
.b_publish:after { content: 'Unpublish'; background-color: orangered; }
|
.b_scope:after { content: 'Public'; background-color: orangered; }
|
||||||
|
|
||||||
.b_notify { background-color: slategrey; }
|
.b_notify { background-color: slategrey; }
|
||||||
.b_notify:before { content: 'Follow'; }
|
.b_notify:before { content: 'Follow'; }
|
||||||
|
@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
.btn_toggle:before, .btn_toggle:after {
|
.btn_toggle:before, .btn_toggle:after {
|
||||||
|
|
||||||
padding-top: 0.2em;
|
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -65,7 +63,7 @@
|
|||||||
.btn_toggle:after {
|
.btn_toggle:after {
|
||||||
content: '';
|
content: '';
|
||||||
background-color: royalblue;
|
background-color: royalblue;
|
||||||
top: 200%;
|
top: 100%;
|
||||||
|
|
||||||
-webkit-transition: all 750ms cubic-bezier(0.215, 0.610, 0.355, 1.000);
|
-webkit-transition: all 750ms cubic-bezier(0.215, 0.610, 0.355, 1.000);
|
||||||
-moz-transition: all 750ms cubic-bezier(0.215, 0.610, 0.355, 1.000);
|
-moz-transition: all 750ms cubic-bezier(0.215, 0.610, 0.355, 1.000);
|
||||||
@ -74,11 +72,11 @@
|
|||||||
transition: all 500ms cubic-bezier(0.215, 0.610, 0.355, 1.000); /* easeOutCubic */
|
transition: all 500ms cubic-bezier(0.215, 0.610, 0.355, 1.000); /* easeOutCubic */
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn_toggle[active]:after {
|
.btn_toggle[active="1"]:after {
|
||||||
top: 0%;
|
top: 0%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.btn_toggle[active]:before {
|
.btn_toggle[active="1"]:before {
|
||||||
top: -120%;
|
top: -100%;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
var n_toggle = function (args)
|
var n_toggle = function (args)
|
||||||
{
|
{
|
||||||
if(stage.getAttribute('active'))
|
if( stage.getAttribute("active") == 1 )
|
||||||
{
|
{
|
||||||
stage.removeAttribute('active');
|
stage.removeAttribute('active');
|
||||||
}
|
}
|
||||||
@ -39,7 +39,10 @@
|
|||||||
IDOMElement(stage).addEventListener(
|
IDOMElement(stage).addEventListener(
|
||||||
'Click'
|
'Click'
|
||||||
, function (e) {
|
, function (e) {
|
||||||
var _action = stage.getAttribute('active') ? obj.disable : obj.enable;
|
var _action = stage.getAttribute( "active" ) == 1
|
||||||
|
? obj[ "disable" ]
|
||||||
|
: obj[ "enable" ]
|
||||||
|
;
|
||||||
postData( processor, _action, n_toggle, nError );
|
postData( processor, _action, n_toggle, nError );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -47,7 +50,7 @@
|
|||||||
|
|
||||||
var init = function()
|
var init = function()
|
||||||
{
|
{
|
||||||
var toggles = config.get( "toggle_btns" );
|
var toggles = config.get( "ToggleButtons" );
|
||||||
for( var i in toggles )
|
for( var i in toggles )
|
||||||
{
|
{
|
||||||
new ToggleButton( toggles[ i ][0], toggles[ i ][1], toggles[ i ][2] );
|
new ToggleButton( toggles[ i ][0], toggles[ i ][1], toggles[ i ][2] );
|
||||||
|
@ -4,9 +4,13 @@ _AstJson_.AJaxGetArticle = {};
|
|||||||
/** @type {Boolean} */
|
/** @type {Boolean} */
|
||||||
_AstJson_.AJaxGetArticle.status;
|
_AstJson_.AJaxGetArticle.status;
|
||||||
/** @type {String} */
|
/** @type {String} */
|
||||||
_AstJson_.AJaxGetArticle.backup;
|
_AstJson_.AJaxGetArticle.ref_id;
|
||||||
|
/** @type {String} */
|
||||||
|
_AstJson_.AJaxGetArticle.article_id;
|
||||||
/** @type {Object} */
|
/** @type {Object} */
|
||||||
_AstJson_.AJaxGetArticle.entry;
|
_AstJson_.AJaxGetArticle.entry;
|
||||||
|
/** @type {String} */
|
||||||
|
_AstJson_.AJaxGetArticle.entry._id;
|
||||||
/** @type {String} */
|
/** @type {String} */
|
||||||
_AstJson_.AJaxGetArticle.entry.slug;
|
_AstJson_.AJaxGetArticle.entry.slug;
|
||||||
/** @type {Boolean} */
|
/** @type {Boolean} */
|
||||||
|
Loading…
Reference in New Issue
Block a user