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 )
{
var p = this.plugins[i];
if( p.id == pluginId )
{
p.getSetData( data );
return p.getData( data );
}
}
};
@@ -121,6 +121,7 @@
, title: set_field_name( Dand.wrap( "input" ), "title" )
, content: set_field_name( Dand.wrap( "input" ), "content" )
, tags: set_field_name( Dand.wrap( "input" ), "tags" )
, section: set_field_name( Dand.wrap( "input" ), "section" )
};
// Initialize id
@@ -382,11 +383,10 @@
, title: _title
, content: _content
, draft: 1
, tags: plugins.getData( "tags" )
, section: plugins.getData( "section" )
};
plugins.getSetData( "tags", _data );
plugins.getSetData( "section", _data );
postData( processorSet, _data, saveSuccess, serverFailed );
}
};
@@ -417,7 +417,8 @@
? ArticleModel.date_published
: 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();
};
@@ -430,11 +431,6 @@
_visualizer = _class;
_visualizer.setContentDiv( ae_content );
}
if ( _class instanceof Flag )
{
_ae_tag = _class;
ArticleModel && ArticleModel.tags && ( _ae_tag ).setFlags( ArticleModel.tags );
}
};
this.saveAndPublish = function ()
@@ -461,7 +457,8 @@
_data.title = _title;
_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 );
}

View File

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