app/helpers/scrivito_helper.rb in scrivito_sdk-0.66.0 vs app/helpers/scrivito_helper.rb in scrivito_sdk-0.70.0.rc1
- old
+ new
@@ -120,10 +120,13 @@
# @param [Hash] editing_options Additional options for inplace editing
#
# @option editing_options [String] :placeholder ('/assets/scrivito/image_placeholder.png') URL
# or path to image to be displayed if target is missing
#
+ # @option editing_options [Hash] :transform if set, the displayed image will be transformed using
+ # the definition in the given hash, see {Scrivito::Binary#transform}.
+ #
# @example
# scrivito_image_tag(@obj, :my_linklist)
# scrivito_image_tag(@obj, :my_linklist, alt: 'Interesting picture', class: 'my_image')
# scrivito_image_tag(@obj, :my_linklist, {}, placeholder: image_path('my_placeholder.png'))
# scrivito_image_tag(@obj, :my_linklist, {class: 'my_image'}, placeholder: 'http://placehold.it/350x150')
@@ -138,10 +141,13 @@
# scrivito_image_tag(@obj, :my_binary)
#
# @example Render an image tag for a binary Obj
# scrivito_image_tag(@image)
#
+ # @example Render an image tag with an on-the-fly calculated thumbnail
+ # scrivito_image_tag @obj, :my_binary, {}, transform: {width: 50, height: 50}
+ #
# @return [String] HTML image tag
#
# @raise [ScrivitoError] if +field_name+ is not set and Obj is not binary
#
def scrivito_image_tag(obj, field_name_or_tag_options=nil,
@@ -354,11 +360,11 @@
#
# Renders all tags needed in the HTML body.
# @api public
#
def scrivito_body_tags
- Scrivito::LayoutTags.new(self).client_config(@obj, @scrivito_resource)
+ Scrivito::LayoutTags.new(self).page_config(@obj)
end
{
'cms_image_tag' => 'scrivito_image_tag',
'cms_path' => 'scrivito_path',
@@ -377,36 +383,24 @@
Please use `#{new_method_name}' instead.
}
end
end
- #
- # Returns the current user.
- #
# @api public
- # @return [Scrivito::User] if the {Scrivito::Configuration.editing_auth} callback returns an
- # instance of {Scrivito::User}.
- # @return +nil+ otherwise.
- #
+ # @return [Scrivito::User, nil]
+ # See {Scrivito::ControllerActions#scrivito_user} for details.
def scrivito_user
- Scrivito::EditingContextHelper.new(request).scrivito_user
+ Scrivito::EditingContextMiddleware.from_request(request).editor
end
def inplace_editing_allowed?
raise %{
The helper method `inplace_editing_allowed?' has been removed.
Please use helper method `scrivito_user` instead.
}
end
- #
- # Returns whether the GUI is in the +editable+ view.
- #
- # @api public
- # @return +true+ if the current visitor is an authenticated editor, the selected workspace is
- # editable and the display mode is +editing+.
- # @return +false+ otherwise.
- #
- def scrivito_in_editable_view?
- Scrivito::EditingContextHelper.new(request).in_editable_view?
- end
+ # @!method scrivito_in_editable_view?
+ # @return [Boolean]
+ # See {Scrivito::ControllerActions#scrivito_in_editable_view?} for details.
+ # @api public
end