Classes

Class TagAPI


Defined in: tag.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
TagAPI()
Exposes an API to operate on a Content.Node tag.
Method Summary
Method Attributes Method Name and Description
<static>  
TagAPI.edit(element, success, error, post)

Renders this tag for editing.

<static>  
TagAPI.parent()
Retrieve the object in which this tag is contained.
<static>  
TagAPI.part(name, value)

Gets or sets a part of a tag.

<static>  
TagAPI.parts(name)
Returns a list of all of this tag's parts.
<static>  
TagAPI.prop(name, set)
Gets or sets a property of this tags.
<static>  
TagAPI.remove(callback)
Remove this tag from its containing object (it's parent).
<static>  
TagAPI.render(selector, success, post)

Render the tag based on its settings on the server.

<static>  
TagAPI.save(settings, success, error)
Persists the changes to this tag on its container object.

Class Detail

TagAPI()

Exposes an API to operate on a Content.Node tag.

Method Detail

TagAPI.edit(element, success, error, post)

Renders this tag for editing.

Differs from the render() method in that it calls this tag to be rendered in "edit" mode via the REST API so that it is rendered with any additional content that is appropriate for when this tag is used in edit mode.

The GCN JS API library will also start keeping track of various aspects of this tag and its rendered content.

When a jQuery selector is passed to this method, the contents of the rendered tag will overwrite the element identified by that selector. All rendered blocks and editables will be automatically placed into the DOM and initialize for editing.

The behavior is different when this method is called with a function as its first argument. In this case the rendered contents of the tag will not be autmatically placed into the DOM, but will be passed onto the callback function as argmuments. It is then up to the caller to place the content into the DOM and initialize all rendered blocks and editables appropriately.

Parameters:
{(string|jQuery.HTMLElement)=} element
The element into which this tag is to be rendered.
{function(string|TagAPI)=} success
A function that will be called once the tag is rendered.
{function(GCNError):boolean=} error
A custom error handler.
{boolean} post
True, when the tag shall be rendered by POSTing the data to the REST API. Otherwise the tag is rendered with a GET call

{GCN.AbstractTagContainer} TagAPI.parent()

Retrieve the object in which this tag is contained. It does so by getting this chainback's "chainlink ancestor" object.
Returns:
{GCN.AbstractTagContainer}

{*} TagAPI.part(name, value)

Gets or sets a part of a tag.

There exists different types of tag parts, and the possible value of each kind of tag part may differ.

Below is a list of possible kinds of tag parts, and references to what the possible range their values can take:

     STRING : TagParts.STRING
   RICHTEXT : TagParts.RICHTEXT
    BOOLEAN : TagParts.BOOLEAN
      IMAGE : TagParts.IMAGE
       FILE : TagParts.FILE
     FOLDER : TagParts.FOLDER
       PAGE : TagParts.PAGE
   OVERVIEW : TagParts.OVERVIEW
    PAGETAG : TagParts.PAGETAG
TEMPLATETAG : TagParts.TEMPLATETAG
     SELECT : TagParts.SELECT
MULTISELECT : TagParts.MULTISELECT
       FORM : TagParts.FORM
Parameters:
{string} name
Name of tag opart.
{*=} value
(optional) If provided, the tag part will be update with this value. How this happens differs between different type of tag parts.
Throws:
UNFETCHED_OBJECT_ACCESS
Returns:
{*} The value of the accessed tag part. Null if the part does not exist.

{Array.} TagAPI.parts(name)

Returns a list of all of this tag's parts.
Parameters:
{string} name
Returns:
{Array.}

{*} TagAPI.prop(name, set)

Gets or sets a property of this tags. Note that tags do not have a `_shadow' object, and we update the `_data' object directly.
Parameters:
{string} name
Name of tag part.
{*=} set
Optional value. If provided, the tag part will be replaced with this value.
Throws:
UNFETCHED_OBJECT_ACCESS
Returns:
{*} The value of the accessed tag part.

TagAPI.remove(callback)

Remove this tag from its containing object (it's parent).
Parameters:
{function} callback
A function that receive this tag's parent object as its only arguments.

TagAPI.render(selector, success, post)

Render the tag based on its settings on the server. Can be called with the following arguments:<(p>

// Render tag contents into div whose id is "content-div"
render('#content-div') or render(jQuery('#content-div'))
// Pass the html rendering of the tag in the given callback
render(function(html, tag) {
  // implementation!
})
Whenever a 2nd argument is provided, it will be taken as as custom error handler. Invoking render() without any arguments will yield no results.
Parameters:
{string|jQuery.HTMLElement} selector
jQuery selector or jQuery target element to be used as render destination
{function(string|GCN.TagAPI)} success
success function that will receive the rendered html as well as the TagAPI object
{boolean} post
True, when the tag shall be rendered by POSTing the data to the REST API. Otherwise the tag is rendered with a GET call

TagAPI.save(settings, success, error)

Persists the changes to this tag on its container object. Will only save this one tag and not affect the container object itself. Important: be careful when dealing with editable contents - these will be reloaded from Aloha Editor editables when a page is saved and thus overwrite changes you made to an editable tag.
Parameters:
{object=} settings
Optional settings to pass on to the ajax function.
{function(TagAPI)} success
Callback to be invoked when this operation completes normally.
{function(GCNError):boolean} error
Custom error handler.

Documentation generated by JsDoc Toolkit 2.3.2 on Thu Dec 19 2024 12:32:17 GMT-0000 (UTC)