forked from Botanical/BotanJS
		
	Delete button
This commit is contained in:
		@@ -431,7 +431,7 @@
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		, generateCommentStack = function (rObj, obj)
 | 
			
		||||
		, generateCommentStack = function ( rObj, obj )
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
			var
 | 
			
		||||
@@ -453,7 +453,7 @@
 | 
			
		||||
				)
 | 
			
		||||
			: _c_info
 | 
			
		||||
			// Generate comment stack
 | 
			
		||||
			, c_stack = rObj.comment_id
 | 
			
		||||
			, c_stack = rObj["comment_id"]
 | 
			
		||||
				// Reply Structure
 | 
			
		||||
				? wrapc("reply", wrapc("c_cont", [ c_ind = wrapc("r_indicator") , wrapc("c_text", rObj.content) , c_info ]))
 | 
			
		||||
				: wrapc("c_comm",
 | 
			
		||||
 
 | 
			
		||||
@@ -41,31 +41,6 @@
 | 
			
		||||
	min-height: 155px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.b_button {
 | 
			
		||||
	position: relative;
 | 
			
		||||
 | 
			
		||||
	font-family: custom-sans;
 | 
			
		||||
	font-size: 1em;
 | 
			
		||||
 | 
			
		||||
	padding: 0.2em 0.5em;
 | 
			
		||||
	margin:  0.5em 0.2em;
 | 
			
		||||
 | 
			
		||||
	background-color: grey;
 | 
			
		||||
	color: white;
 | 
			
		||||
 | 
			
		||||
	cursor: default;
 | 
			
		||||
 | 
			
		||||
	float: right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.b_delete {
 | 
			
		||||
	background-color: crimson;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.b_scope { background-color: slategrey; }
 | 
			
		||||
.b_scope:before { content: 'Private'; background-color: purple; }
 | 
			
		||||
.b_scope:after { content: 'Public'; background-color: orangered; }
 | 
			
		||||
 | 
			
		||||
.b_notify { background-color: slategrey; }
 | 
			
		||||
.b_notify:before { content: 'Follow'; }
 | 
			
		||||
.b_notify:after { content: 'Unfollow'; }
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
.b_button {
 | 
			
		||||
	position: relative;
 | 
			
		||||
 | 
			
		||||
	font-family: custom-sans;
 | 
			
		||||
	font-size: 1em;
 | 
			
		||||
 | 
			
		||||
	padding: 0.2em 0.5em;
 | 
			
		||||
	margin:  0.5em 0.2em;
 | 
			
		||||
 | 
			
		||||
	background-color: grey;
 | 
			
		||||
	color: white;
 | 
			
		||||
 | 
			
		||||
	cursor: default;
 | 
			
		||||
 | 
			
		||||
	float: right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.b_delete {
 | 
			
		||||
    color: crimson;
 | 
			
		||||
	background-color: crimson;
 | 
			
		||||
    position: relative;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.b_delete:after {
 | 
			
		||||
    content: "\2715";
 | 
			
		||||
    color: white;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
    width: 100%;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    top: 0;
 | 
			
		||||
    right: 0;
 | 
			
		||||
}
 | 
			
		||||
.b_delete:hover:after {
 | 
			
		||||
    text-decoration: underline;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.b_scope { background-color: slategrey; }
 | 
			
		||||
.b_scope:before { content: 'Private'; background-color: purple; }
 | 
			
		||||
.b_scope:after { content: 'Public'; background-color: orangered; }
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,47 @@
 | 
			
		||||
(function(){
 | 
			
		||||
	var ns = __namespace( "Astro.Blog.Components.ToggleButton.DeleteArticle" );
 | 
			
		||||
 | 
			
		||||
    /** @type {Components.MessageBox} */
 | 
			
		||||
	var MessageBox                       = __import( "Components.MessageBox" );
 | 
			
		||||
	/** @type {Dandelion} */
 | 
			
		||||
	var Dand                             = __import( "Dandelion" );
 | 
			
		||||
	/** @type {Dandelion.IDOMElement} */
 | 
			
		||||
	var IDOMElement                      = __import( "Dandelion.IDOMElement" );
 | 
			
		||||
	/** @type {Astro.Bootstrap} */
 | 
			
		||||
	var Bootstrap                        = __import( "Astro.Bootstrap" );
 | 
			
		||||
 | 
			
		||||
	var postData                         = __import( "System.Net.postData" );
 | 
			
		||||
 | 
			
		||||
	var init = function()
 | 
			
		||||
	{
 | 
			
		||||
		var stage = Dand.id( "b_entry", true );
 | 
			
		||||
		if( !stage ) return;
 | 
			
		||||
 | 
			
		||||
		var doDelete = function( confirmed )
 | 
			
		||||
		{
 | 
			
		||||
			var a_deleteSuccess = function( args ) { window.location.reload( true ); };
 | 
			
		||||
			var a_deleteFailed = function( args ) { };
 | 
			
		||||
 | 
			
		||||
			if( confirmed ) postData(
 | 
			
		||||
				"/ajax/del-article"
 | 
			
		||||
				, { "article_id": stage.getDAttribute( "aid" ) }
 | 
			
		||||
				, a_deleteSuccess
 | 
			
		||||
				, a_deleteFailed
 | 
			
		||||
			);
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		stage.addEventListener(
 | 
			
		||||
			'Click'
 | 
			
		||||
			, function (e) {
 | 
			
		||||
				new MessageBox(
 | 
			
		||||
					"Confirm"
 | 
			
		||||
					, "Are you sure you want to delete this article?. Comments will also be deleted!"
 | 
			
		||||
					, "Yes", "No"
 | 
			
		||||
					, doDelete
 | 
			
		||||
				).show();
 | 
			
		||||
			}
 | 
			
		||||
		);
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Bootstrap.regInit( init );
 | 
			
		||||
})();
 | 
			
		||||
		Reference in New Issue
	
	Block a user