commit 8ef1df3c94256170ba622ed65b2f3e77d17e1430
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2016-10-25T11:31:01Z |
| subject | Gusets Comment Reply impl |
commit 8ef1df3c94256170ba622ed65b2f3e77d17e1430
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2016-10-25T11:31:01Z
Gusets Comment Reply impl
---
botan-start.py | 4 +--
botanjs/src/Astro/Blog/Components/Comment.js | 28 ++++++++++++++++-----
botanjs/src/Astro/Blog/Layout/Subs/Manage.css | 14 +++++++++++
botanjs/src/Astro/Blog/Layout/Subs/Manage.js | 35 +++++++++++++++++++++++++++
botanjs/src/Astro/Blog/Layout/Subs/_this.js | 3 +++
5 files changed, 76 insertions(+), 8 deletions(-)
diff --git a/botan-start.py b/botan-start.py
index 81708f3..e36bf7b 100755
--- a/botan-start.py
+++ b/botan-start.py
@@ -11,7 +11,7 @@ SiteRoot = os.path.abspath( "." )
config["Paths"]["SiteRoot"] = SiteRoot;
# Create the lock folder for celery
-lockDir = os.path.join( SiteRoot, "env", "var", "run" "celery" )
+lockDir = os.path.join( SiteRoot, "env", "var", "run", "celery" )
os.makedirs( lockDir, exist_ok=True )
@@ -31,7 +31,7 @@ if __name__ == "__main__":
[
"celery", "multi", "restart", nodeName
, "-A", jwork, "worker"
- , "--pidfile=" + lockDir + jwork + ".pid"
+ , "--pidfile=" + os.path.join( lockDir, jwork + ".pid" )
, "--logfile=" + os.path.join( config["Paths"]["Log"], jwork + ".log" )
, "--workdir=" + config["Paths"]["Runtime"]
, "beat", "-l", "info"
diff --git a/botanjs/src/Astro/Blog/Components/Comment.js b/botanjs/src/Astro/Blog/Components/Comment.js
index b1bfda2..5d1ccbc 100644
--- a/botanjs/src/Astro/Blog/Components/Comment.js
+++ b/botanjs/src/Astro/Blog/Components/Comment.js
@@ -555,7 +555,7 @@
// Validation
- , fields = loggedIn ? ["content"] : ["content", "name", "email", "website"]
+ , fields = loggedIn ? ["content"] : [ "content", "name", "email", "website", "email_notify" ]
, _getFieldsValidated = function (obj)
{
var name, field, falsefield, f;
@@ -567,7 +567,8 @@
falsefield = "false_" + name;
f = Dand.id( falsefield );
- f.style.height = 0;
+ if( f ) f.style.height = 0;
+
switch(name)
{
case "name":
@@ -587,7 +588,7 @@
else
{
if(obj[name] == true)
- delete obj[name]
+ delete obj[ name ];
}
break;
case "email":
@@ -598,14 +599,29 @@
}
else
{
- if(obj[name] == true)
- delete obj[name]
+ if( obj[ name ] == true )
+ delete obj[ name ];
+ }
+ break;
+ case "email_notify":
+ if( obj[ name ] = Dand.id( field ).checked )
+ {
+ if( obj[ "email" ] == undefined )
+ {
+ obj[ name ] = false;
+ Cycle.delay( function() { this.style.height = elmH; }.bind(f), 500 );
+ }
+ }
+ else
+ {
+ delete obj[ name ];
}
break;
}
}
- for(var i in obj) if(!obj[i]) return false;
+ for( var i in obj )
+ if( !obj[i] ) return false;
return true;
}
diff --git a/botanjs/src/Astro/Blog/Layout/Subs/Manage.css b/botanjs/src/Astro/Blog/Layout/Subs/Manage.css
new file mode 100644
index 0000000..01397a9
--- /dev/null
+++ b/botanjs/src/Astro/Blog/Layout/Subs/Manage.css
@@ -0,0 +1,14 @@
+.ban-btn { color: red; }
+.subs-type { margin: 1em; }
+
+.subs-item {
+ position: relative;
+ margin: .5em 2.5em .5em .5em;
+ border-left: 0.5em solid royalblue;
+ background-color: white;
+}
+
+.subs-item > p a {
+ color: orangered;
+ margin: 0.5em;
+}
diff --git a/botanjs/src/Astro/Blog/Layout/Subs/Manage.js b/botanjs/src/Astro/Blog/Layout/Subs/Manage.js
new file mode 100644
index 0000000..613c714
--- /dev/null
+++ b/botanjs/src/Astro/Blog/Layout/Subs/Manage.js
@@ -0,0 +1,35 @@
+(function(){
+ var ns = __namespace( "Astro.Blog.Layout.Subs.Manage" );
+ /** @type {Components.MessageBox} */
+ var MessageBox = __import( "Components.MessageBox" );
+ /** @type {Dandelion} */
+ var Dand = __import( "Dandelion" );
+ /** @type {Astro.Bootstrap} */
+ var Bootstrap = __import( "Astro.Bootstrap" );
+ /** @type {Dandelion.IDOMElement} */
+ var IDOMElement = __import( "Dandelion.IDOMElement" );
+
+ var init = function ()
+ {
+ /** @type {Dandelion.IDOMElement} */
+ var banbtn = Dand.id( "action-ban", true );
+
+ if( banbtn )
+ {
+ banbtn.addEventListener( "Click", function( e ) {
+ e.preventDefault();
+
+ var msgBox = new MessageBox(
+ "Ban this address"
+ , "This action cannot be undone, confirm?"
+ , "Yes", "No"
+ , function( _confirm ) {
+ if( !_confirm ) return;
+ window.location = banbtn.getDAttribute( "href" );
+ } ).show();
+ } );
+ }
+ };
+
+ Bootstrap.regInit( init );
+})();
diff --git a/botanjs/src/Astro/Blog/Layout/Subs/_this.js b/botanjs/src/Astro/Blog/Layout/Subs/_this.js
new file mode 100644
index 0000000..3d0b757
--- /dev/null
+++ b/botanjs/src/Astro/Blog/Layout/Subs/_this.js
@@ -0,0 +1,3 @@
+(function(){
+ var ns = __namespace( "Astro.Blog.Layout.Subs" );
+})();