forked from Botanical/BotanJS
Early album draft
This commit is contained in:
@@ -45,10 +45,25 @@
|
||||
|
||||
, __applyData = function (e)
|
||||
{
|
||||
var finfo = JSON.parse(e).file, s, m, l
|
||||
, content = this.stage.firstChild
|
||||
, desc = this.stage.lastChild
|
||||
, _hash = this.hash;
|
||||
if( typeof( e ) == "string" )
|
||||
e = JSON.parse(e);
|
||||
|
||||
var _stage = IDOMElement( this.stage );
|
||||
|
||||
var isAlbum = false;
|
||||
// Check if this is an album
|
||||
if( isAlbum = ( "files" in e ) )
|
||||
{
|
||||
e.file = e.files[0];
|
||||
_stage.setAttribute( new DataKey( "collection", 1 ) );
|
||||
}
|
||||
|
||||
var s, m, l;
|
||||
|
||||
var finfo = e.file;
|
||||
var content = this.stage.firstChild;
|
||||
var desc = this.stage.lastChild;
|
||||
var _hash = finfo.hash;
|
||||
|
||||
switch ( finfo.type )
|
||||
{
|
||||
@@ -56,34 +71,33 @@
|
||||
|
||||
this.stage.removeChild(content);
|
||||
// Default size is large
|
||||
var _image = Dand.wrapna("img", new IKey("src", config.path.image.large + _hash + ".jpg"))
|
||||
, _stage = IDOMElement(this.stage)
|
||||
, keys = [ new IKey( "type", "radio" ), new IKey( "name", "size_grp" + Perf.uuid ) ]
|
||||
, sid
|
||||
, selectionChanged = function ()
|
||||
var _image = Dand.wrapna( "img", new IKey("src", config.path.image.large + _hash + ".jpg") );
|
||||
var keys = [ new IKey( "type", "radio" ), new IKey( "name", "size_grp" + Perf.uuid ) ];
|
||||
var sid;
|
||||
var selectionChanged = function ()
|
||||
{
|
||||
_stage.setAttribute(new DataKey("size", this.size));
|
||||
_stage.setAttribute( new DataKey( "size", this.size ) );
|
||||
//// Handles the size selection
|
||||
switch(this.size)
|
||||
{
|
||||
case "small":
|
||||
_image.setAttribute("src", config.path.image.small + _hash + ".jpg");
|
||||
_image.setAttribute( "src", config.path.image.small + _hash + ".jpg" );
|
||||
break;
|
||||
case "medium":
|
||||
_image.setAttribute("src", config.path.image.medium + _hash + ".jpg");
|
||||
_image.setAttribute( "src", config.path.image.medium + _hash + ".jpg" );
|
||||
break;
|
||||
case "large":
|
||||
_image.setAttribute("src", config.path.image.large + _hash + ".jpg");
|
||||
_image.setAttribute( "src", config.path.image.large + _hash + ".jpg" );
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
this.stage.insertBefore(_image, desc);
|
||||
this.stage.insertBefore( _image, desc );
|
||||
|
||||
desc.removeChild(desc.firstChild);
|
||||
desc.removeChild( desc.firstChild );
|
||||
desc.appendChild(
|
||||
Dand.wrape([
|
||||
Dand.textNode("Size: ")
|
||||
Dand.textNode( ( isAlbum ? "[Album] " : "" ) + "Size: ")
|
||||
, s = Dand.wrapna("input", keys.concat( new IKey("id", sid = "size_" + Perf.uuid) ))
|
||||
, Dand.wrapne("label", "small", new IKey("for", sid))
|
||||
, m = Dand.wrapna("input", keys.concat( new IKey("id", sid = "size_" + Perf.uuid) ))
|
||||
@@ -112,7 +126,7 @@
|
||||
|
||||
, loadFailed = function (e) { }
|
||||
|
||||
, visualizer = function (submitted, override)
|
||||
, visualizer = function ( submitted, override )
|
||||
{
|
||||
|
||||
var hash = override ? override.value : this.code.value
|
||||
@@ -128,9 +142,9 @@
|
||||
, Dand.wrapc("v_description", "Site file (hash): " + hash)
|
||||
]
|
||||
, [
|
||||
new DataKey("value", hash)
|
||||
, new DataKey("size", "large")
|
||||
, new IKey("style", "max-height: 150px;")
|
||||
new DataKey( "value", hash )
|
||||
, new DataKey( "size", "large" )
|
||||
, new IKey( "style", "max-height: 150px;" )
|
||||
]
|
||||
);
|
||||
|
||||
@@ -162,6 +176,7 @@
|
||||
stage = IDOMElement( stage );
|
||||
// [html][/html]
|
||||
return "[sitefile"
|
||||
+ " collection=\"" + stage.getDAttribute( "collection" ) + "\""
|
||||
+ " size=\"" + stage.getDAttribute( "size" ) + "\"" + "]"
|
||||
+ escapeStr( stage.getDAttribute( "value" ) )
|
||||
+ "[/sitefile]";
|
||||
|
Reference in New Issue
Block a user