The Ruby API

With only very few exceptions, the Fiona 7 API corresponds to Scrivito’s API. All methods except “fiona7_login_button”, “fiona7_head_tags”, “fiona7_body_tags” are available in legacy mode only.

Helper methods

fiona7_login_button

Creates a button which is linked to the log-in page.

fiona7_head_tags

Does the same as “scrivito_head_tags” in Scrivito applications. Must be called in the HEAD section of a page to activate the editing components.

fiona7_body_tags

Does the same as “scrivito_body_tags” in Scrivito applications. Must be called in the BODY section of a page to activate the editing components.

fiona7_tag(tag_name, obj_or_widget, field_name, html_options = {}, &block)

For use in legacy mode only. Works like “scrivito_tag”, but additionally accepts as the second argument a “RailsConnector::BasicObj” instance, which makes in-place editing also available in classic RailsConnector views.

fiona7_tag_list(tag_name, obj, field_name, options = {}, &block)

For use in legacy mode only. Works like “scrivito_tag_list”, but additionally accepts as the second argument a “RailsConnector::BasicObj” instance.

RailsConnector::BasicObj#scrivito_obj

For use in legacy mode only. In legacy mode, every RailsConnector object has this method. It returns an instance of “Scrivito::BasicObj” and thus makes it possible to use the Scrivito API methods in legacy mode. If, for example, “@obj” is an instance of the “Publication” RailsConnector class and includes a widget attribute named “main_content”, this attribute can be rendered using:

<%= scrivito_field @obj.scrivito_obj, :main_content %>

Scrivito::BasicObj#fiona_obj

For use in legacy mode only. In legacy mode, every Scrivito object has this method which is the reversal of “scrivito_obj” and returns an instance of “RailsConnector::Obj.” Supports mixed operation of the RailsConnector and Fiona 7.

The “Obj" class

Analogous to the RailsConnector, both Fiona 7 and Scrivito require an “Obj” class. If the “Obj” class has already been defined globally by the RailsConnector – which is the case in legacy mode –, you should define it in the Scrivito namespace.

Example definition of “Obj” for the standalone mode:

class Obj < Scrivito::BasicObj
end

Example definition of “Obj” for the legacy mode:

module Scrivito
  class Obj < ::Scrivito::BasicObj
  end
end

Object classes and widgets

To be able to define your own methods for an object class or a widget, equally named Ruby classes are required for them. The “Publication” object class may be modelled as the “Publication” Ruby class, for instance.

In legacy mode, however, this name may already be in use, possibly by a class derived from “RailsConnector::BasicObj”. In this case the definition should be created in the “Scrivito” namespace werden. The definition of “Publication” in standalone mode:

class Publication < Obj
end

The definition of “Publication” in legacy mode:

module Scrivito
  class Publication < ::Scrivito::Obj
  end
end

These rules also apply to widgets: In legacy mode, the “TextImageWidget” widget object class can be modelled as the “TextImageWidget” or “Scrivito::TextImageWidget” Ruby class (if the former is already in use).