commit a6618dc9ffdff0e1a1db77ed090949073001b394
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2015-08-18T08:03:07Z |
| subject | Delete button |
commit a6618dc9ffdff0e1a1db77ed090949073001b394
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2015-08-18T08:03:07Z
Delete button
---
botanjs/src/Astro/Blog/Components/Comment.js | 4 +-
botanjs/src/Astro/Blog/Components/Entry/Blog.css | 25 ------------
.../Blog/Components/ToggleButton/DeleteArticle.css | 41 +++++++++++++++++++
.../Blog/Components/ToggleButton/DeleteArticle.js | 47 ++++++++++++++++++++++
4 files changed, 90 insertions(+), 27 deletions(-)
diff --git a/botanjs/src/Astro/Blog/Components/Comment.js b/botanjs/src/Astro/Blog/Components/Comment.js
index a40e386..ad19e80 100644
--- a/botanjs/src/Astro/Blog/Components/Comment.js
+++ b/botanjs/src/Astro/Blog/Components/Comment.js
@@ -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",
diff --git a/botanjs/src/Astro/Blog/Components/Entry/Blog.css b/botanjs/src/Astro/Blog/Components/Entry/Blog.css
index 2759945..38d8291 100644
--- a/botanjs/src/Astro/Blog/Components/Entry/Blog.css
+++ b/botanjs/src/Astro/Blog/Components/Entry/Blog.css
@@ -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'; }
diff --git a/botanjs/src/Astro/Blog/Components/ToggleButton/DeleteArticle.css b/botanjs/src/Astro/Blog/Components/ToggleButton/DeleteArticle.css
new file mode 100644
index 0000000..74ee3cc
--- /dev/null
+++ b/botanjs/src/Astro/Blog/Components/ToggleButton/DeleteArticle.css
@@ -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; }
+
diff --git a/botanjs/src/Astro/Blog/Components/ToggleButton/DeleteArticle.js b/botanjs/src/Astro/Blog/Components/ToggleButton/DeleteArticle.js
new file mode 100644
index 0000000..384c4a9
--- /dev/null
+++ b/botanjs/src/Astro/Blog/Components/ToggleButton/DeleteArticle.js
@@ -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 );
+})();