def tandem_content_tag(identifier, type, options = {}, html_options = {})
      options[:editor] ||= :plain

      using_tandem_abilities do
        tandem_content = Content.scoped_type(type).constantize.where(request_key: request_key, tag: identifier).first_or_create

        content = case tandem_content
          when Content::Text
            content_tag(:div, tandem_content, options.merge(
                id: "#{dom_class(tandem_content)}_#{identifier}",
                class: "#{dom_class(tandem_content)} #{options[:class]}".strip
            )) {
              tandem_content.formatted_content.html_safe
            }
          when Content::Image
            image_content_tag(tandem_content,options.merge(
                id: "#{dom_class(tandem_content)}_#{identifier}",
                class: "#{dom_class(tandem_content)} #{options[:class]}".strip
            ))
          else
            raise "Unable to create #{tandem_content.class.name}: #{tandem_content.errors.inspect}" if tandem_content.new_record?
            raise "Rendering behavior not defined for: #{tandem_content.class.name}"
        end

        content = link_to(content,tandem_content.link_url,{
            id: "tandem_content_link_#{identifier}",
            class: "tandem_content_link",
            target: tandem_content.link_target
        }) if tandem_content.link?

        content = content_tag(:div, tandem_content, {
            id: "tandem_toolbar_#{identifier}",
            class: "tandem_toolbar #{options[:class]}".strip
        }) {
          link_to("Edit", tandem.edit_content_path(tandem_content.id, editor: options[:editor]),{
              id: "tandem_edit_link_#{identifier}",
              class: "tandem_edit_link #{options[:class]}".strip,
              title: "editing #{identifier}"
          })
        } + content if can? :update, tandem_content

        html_options.merge! id: identifier
        html_options[:class] ||= ''
        html_options[:class] << ' tandem_content' if can? :update, tandem_content
        html_options[:class].strip!

        content_tag(:div, tandem_content, html_options) { content }
      end
    end
def tandem_content_tag(identifier, type, options = {}, html_options = {})
      options[:editor] ||= :plain

      using_tandem_abilities do
        tandem_content = Content.scoped_type(type).constantize.where(request_key: request_key, tag: identifier).first_or_create

        content = case tandem_content
          when Content::Text
            content_tag(:div, tandem_content, options.merge(
                id: "#{dom_class(tandem_content)}_#{identifier}",
                class: "#{dom_class(tandem_content)} #{options[:class]}".strip
            )) {
              tandem_content.formatted_content.html_safe
            }
          when Content::Image
            image_content_tag(tandem_content,options.merge(
                id: "#{dom_class(tandem_content)}_#{identifier}",
                class: "#{dom_class(tandem_content)} #{options[:class]}".strip
            ))
          else
            raise "Unable to create #{tandem_content.class.name}: #{tandem_content.errors.inspect}" if tandem_content.new_record?
            raise "Rendering behavior not defined for: #{tandem_content.class.name}"
        end

        content = link_to(content,tandem_content.link_url,{
            id: "tandem_content_link_#{identifier}",
            class: "tandem_content_link",
            target: tandem_content.link_target
        }) if tandem_content.link?

        content = content_tag(:div, tandem_content, {
            id: "tandem_toolbar_#{identifier}",
            class: "tandem_toolbar #{options[:class]}".strip
        }) {
          link_to("Edit", tandem.edit_content_path(tandem_content.id, editor: options[:editor]),{
              id: "tandem_edit_link_#{identifier}",
              class: "tandem_edit_link #{options[:class]}".strip,
              title: "editing #{identifier}"
          })
        } + content if can? :update, tandem_content

        html_options.merge! id: identifier
        html_options[:class] ||= ''
        html_options[:class] << ' tandem_content' if can? :update, tandem_content
        html_options[:class].strip!

        content_tag(:div, tandem_content, html_options) { content }
      end
    end
tandem_content_tag creates an HTML DIV element with id and class parameters that
 relate to the specified Tandem Content object and contains an internal content element.
 If a Tandem::Content record doesn't exist for the unique combination of:
 request_key, identifier and type, one will be created automatically. For example:

    <%= tandem_content_tag(:test_image, :image) %>

 would find_or_create a Tandem::Content::Image object and produce the following HTML:

    <div class="tandem_content" id="test_image">...<img id="tandem_content_image_test_image" class="tandem_content_image bar"...</div>

 If the user is authorized to update content then an edit link will be generated in
 conjunction with the content. For example:

    <%= tandem_content_tag(:test_text, :text) %>

 would produce the following HTML (assuming `can? :update, tandem_content` => true):

    <div class="tandem_content" id="test_text">
      <div class="tandem_toolbar" id="tandem_toolbar_test_text">
        <a href="#" id="tandem_edit_link_test_text" title="Edit test_text" class="tandem_edit_link" editor_options="{&quot;identifier&quot;:&quot;test_text&quot;,&quot;type&quot;:&quot;text&quot;}">Edit</a>
      </div>
      ....
    </div>

 If a user specifies link information for the corresponding Tandem::Content object,
 then an A HTML element will be generated surrounding the content. For example:

    <%= tandem_content_tag(:test_image, :image) %>

 produces (assuming that tandem_content.link? => true):

    <div class="tandem_content" id="test_image">
      ...
      <a id="tandem_content_link_test_image" class="tandem_content_link" ...
        <img id="tandem_content_image_test_image" class="tandem_content_image" ...
      </a>
    </div>

 tandem_content_tag accepts a hash of html_options, which will be converted to
 additional HTML attributes of the generated container div. If you specify a <tt>:class</tt> value, it will be combined
 with the default class name for your object. For example:

    <%= tandem_content_tag(:test_image, :image, {}, :class => "bar", :style => 'display:none') %>...

 produces:

    <div class="tandem_content bar" id="test_image" style = "display:none">...

 tandem_content_tag also accepts a hash of options, which will be converted to
 additional HTML attributes of the internal asset type. If you specify a <tt>:class</tt> value, it will be combined
 with the default class name for your object. For example:

    <%= tandem_content_tag(:test_image, :image, :class => "bar", :width => 80) %>...

 produces:

    ...<img id="tandem_content_image_test_image" class="tandem_content_image bar" width = "80"...

 Finally, text tandem_content_tags support an <tt>:editor</tt> option, which defaults to <tt>:plain</tt>, but
 can also be changed to <tt>:wysiwyg</tt> to enable a WYSIWYG editor, e.g.

     <%= tandem_content_tag(:main_body, :text, editor: :wysiwyg) %>