lib/scrivito/cms_routing.rb in scrivito_sdk-0.50.1 vs lib/scrivito/cms_routing.rb in scrivito_sdk-0.60.0.rc1
- old
+ new
@@ -71,31 +71,37 @@
url = url + "##{link.fragment}" if link.fragment.present?
url
end
def path_or_url_for_objs(obj, path_or_url, options = {})
+ if editing_context.display_mode == "editing"
+ return id_path_or_url_for_objs(obj, path_or_url, options)
+ end
+
permalink = obj.permalink
if permalink
main_app.public_send("scrivito_permalink_#{path_or_url}", options.merge(:permalink => permalink))
elsif obj.homepage?
main_app.public_send("scrivito_root_#{path_or_url}", options)
- else
- if obj.binary? && editing_context.display_mode != "editing"
- if obj.binary_url
- obj.binary_url
- else
- LINK_TO_EMPTY_BLOB
- end
+ elsif obj.binary?
+ if obj.binary_url
+ obj.binary_url
else
- main_app.public_send(
- "cms_id_#{path_or_url}",
- options.merge(
- id: obj.id,
- slug: obj.slug.presence
- )
- )
+ LINK_TO_EMPTY_BLOB
end
+ else
+ id_path_or_url_for_objs(obj, path_or_url, options)
end
+ end
+
+ def id_path_or_url_for_objs(obj, path_or_url, options)
+ main_app.public_send(
+ "cms_id_#{path_or_url}",
+ options.merge(
+ id: obj.id,
+ slug: obj.slug.presence
+ )
+ )
end
def editor_authenticated?
editing_context.authenticated_editor?
end