Added Section, early plugin model

This commit is contained in:
斟酌 鵬兄 2015-09-23 02:23:16 +08:00
parent 1d812de551
commit 0f7896a925
6 changed files with 43 additions and 17 deletions

View File

@ -58,14 +58,14 @@
} }
}; };
PluginBundles.prototype.getSetData = function( pluginId, data ) PluginBundles.prototype.getData = function( pluginId, data )
{ {
for( var i in this.plugins ) for( var i in this.plugins )
{ {
var p = this.plugins[i]; var p = this.plugins[i];
if( p.id == pluginId ) if( p.id == pluginId )
{ {
p.getSetData( data ); return p.getData( data );
} }
} }
}; };
@ -121,6 +121,7 @@
, title: set_field_name( Dand.wrap( "input" ), "title" ) , title: set_field_name( Dand.wrap( "input" ), "title" )
, content: set_field_name( Dand.wrap( "input" ), "content" ) , content: set_field_name( Dand.wrap( "input" ), "content" )
, tags: set_field_name( Dand.wrap( "input" ), "tags" ) , tags: set_field_name( Dand.wrap( "input" ), "tags" )
, section: set_field_name( Dand.wrap( "input" ), "section" )
}; };
// Initialize id // Initialize id
@ -382,11 +383,10 @@
, title: _title , title: _title
, content: _content , content: _content
, draft: 1 , draft: 1
, tags: plugins.getData( "tags" )
, section: plugins.getData( "section" )
}; };
plugins.getSetData( "tags", _data );
plugins.getSetData( "section", _data );
postData( processorSet, _data, saveSuccess, serverFailed ); postData( processorSet, _data, saveSuccess, serverFailed );
} }
}; };
@ -417,7 +417,8 @@
? ArticleModel.date_published ? ArticleModel.date_published
: Math.floor( 0.001*( new Date().getTime() ) ) : Math.floor( 0.001*( new Date().getTime() ) )
; ;
ae_p_fields.tags.value = _ae_tag.getFlags(); ae_p_fields.tags.value = plugins.getData( "tags" );
ae_p_fields.section.value = plugins.getData( "section" );
ae_preview.submit(); ae_preview.submit();
}; };
@ -430,11 +431,6 @@
_visualizer = _class; _visualizer = _class;
_visualizer.setContentDiv( ae_content ); _visualizer.setContentDiv( ae_content );
} }
if ( _class instanceof Flag )
{
_ae_tag = _class;
ArticleModel && ArticleModel.tags && ( _ae_tag ).setFlags( ArticleModel.tags );
}
}; };
this.saveAndPublish = function () this.saveAndPublish = function ()
@ -461,7 +457,8 @@
_data.title = _title; _data.title = _title;
_data.content = _content; _data.content = _content;
_data.tags = _ae_tag.getFlags(); _data.tags = plugins.getData( "tags" );
_data.section = plugins.getData( "section" );
postData( processorSet, _data, publishSuccess.bind({ contentUpdate: true }), serverFailed ); postData( processorSet, _data, publishSuccess.bind({ contentUpdate: true }), serverFailed );
} }

View File

@ -153,7 +153,7 @@
} }
} }
this.getSetData = function ( data ) this.getData = function ()
{ {
// Compile flag list // Compile flag list
var tlist = []; var tlist = [];
@ -165,7 +165,7 @@
tlist[tlist.length] = flags[i].lastChild.nodeValue; tlist[tlist.length] = flags[i].lastChild.nodeValue;
} }
data[ this.id ] = tlist.join("\n"); return tlist.join("\n");
} }
this.setForView = function ( flagList ) this.setForView = function ( flagList )

View File

@ -0,0 +1,28 @@
.section-buttons > a {
display: inline-block;
color: white;
background-color: darkslategray;
padding: 0.75em 0;
opacity: 0.5;
}
.section-buttons > a:hover, .section-buttons > a[active]:hover {
opacity: 0.8;
text-decoration: none;
}
.section-buttons > a[data-name="blog"] {
background-color: purple;
}
.section-buttons > a[data-name="wenku8"] {
background-color: royalblue;
}
.section-buttons > a > span {
padding: 0.75em 0.5em;
}
.section-buttons > a[active] {
opacity: 1;
}
.section-buttons > a > .count {
background-color: rgba( 0, 0, 0, 0.3 );
}

View File

@ -0,0 +1 @@
// __namespace( "Astro.Blog.Components.Section" );

View File

@ -11,7 +11,7 @@
.main { .main {
/* background-color: #FAFAFA; */ /* background-color: #FAFAFA; */
vertical-align: top; vertical-align: top;
min-width: 80%; min-width: 70%;
position: relative; position: relative;
} }
@ -29,7 +29,7 @@ ul.breadcrumb > li.sep:after { content: "\2022"; }
.nav_panel { .nav_panel {
padding-left 0.5em; padding-left 0.5em;
min-width: 20%; min-width: 30%;
} }
#dockright { #dockright {

View File

@ -5,4 +5,4 @@ Astro.Blog.AstroEdit.IPlugin.id;
/** @type {Function} */ /** @type {Function} */
Astro.Blog.AstroEdit.IPlugin.setFromData; Astro.Blog.AstroEdit.IPlugin.setFromData;
/** @type {Function} */ /** @type {Function} */
Astro.Blog.AstroEdit.IPlugin.getSetData; Astro.Blog.AstroEdit.IPlugin.getData;