-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Edit this post" link on sitebar #445
Comments
I'd like to develop it if that's ok with you. |
It's been four years, so possibly not of interest to anyone (least of all @darmenise ), but Google took me here, so... :) My project's editors wanted an "edit this page" for our events (which uses a heavily customised extension that began with this guide), and since it's a different model from pages, I had to find my own solution. It's not exactly elegant, but it works.
Then I made this change: diff --git a/app/helpers/refinery/site_bar_helper.rb b/app/helpers/refinery/site_bar_helper.rb
index 6d65199..3cd6ec7 100644
--- a/app/helpers/refinery/site_bar_helper.rb
+++ b/app/helpers/refinery/site_bar_helper.rb
@@ -12,11 +12,18 @@ module Refinery
end
def site_bar_edit_link
- return nil if admin? || @page.nil?
- link_to t('refinery.admin.pages.edit', site_bar_translate_locale_args),
- refinery.admin_edit_page_path(@page.nested_url,
- :switch_locale => (@page.translations.first.locale unless @page.translated_to_default_locale?)),
- 'data-turbolinks' => false
+ if model = @page
+ return nil if admin? || @page.nil?
+ link_to t('refinery.admin.pages.edit', site_bar_translate_locale_args),
+ refinery.admin_edit_page_path(@page.nested_url,
+ :switch_locale => (@page.translations.first.locale unless @page.translated_to_default_locale?)),
+ 'data-turbolinks' => false
+ elsif model = @event
+ return nil if admin? || @event.nil?
+ link_to t('refinery.admin.pages.edit', site_bar_translate_locale_args),
+ "#{Refinery::Core.backend_path}/events/#{@event.id}/edit?switch_locale=#{locale}",
+ 'data-turbolinks' => false
+ end
end
def site_bar_translate_locale_args I couldn't find a handy method like It's probably not the most elegant method, but the This isn't a solution to this issue, but it might be a starting point for some devs who use the blog extension. Hope it helps some future Googler! :) |
Eh eh, thank you anyway! 👍 it will surely help someone else :) |
It would be nice if this feature would also work for the blog posts.
The text was updated successfully, but these errors were encountered: