Permalink
Browse files

Remove hard-coded edit page layout

By creating a new, hard-coded, edit page layout, other page modifications
made by other extensions loaded before paperclipped, e.g., the comments
extension, were removed from the edit page, while page modifications by
extensions that loaded after paperclipped, e.g., the textile_editor
extension would only apply to the new page layout.

Instead, the asset_tabs, bucket_pane, and asset_panes are added to the
edit page in the activate method. Since this also applies to the new
page, which should not have access to the assets, the show_bucket_link
partial is modified to only display the link on existing pages.
  • Loading branch information...
1 parent dbc6a0d commit cfeeb92d0d14ed7ac44add148425f0c345130f85 @davec davec committed Jun 1, 2009
Showing with 7 additions and 12 deletions.
  1. +3 −2 app/views/assets/_show_bucket_link.html.haml
  2. +0 −9 lib/assets_admin_ui.rb
  3. +4 −1 paperclipped_extension.rb
@@ -1,2 +1,3 @@
-#show-bucket
- = link_to "Show Assets Bucket", "#"
+- unless @page.new_record?
+ #show-bucket
+ = link_to "Show Assets Bucket", "#"
View
@@ -29,15 +29,6 @@ def load_default_asset_regions
index.paginate
end
asset.remove = asset.index
- page.edit = Radiant::AdminUI::RegionSet.new do |edit|
- edit.main.concat %w{edit_header edit_form edit_popups }
- edit.form.concat %w{edit_title edit_extended_metadata edit_page_parts}
- edit.form_bottom.concat %w{edit_buttons}
- edit.parts_bottom.concat %w{edit_layout_and_type edit_timestamp}
- edit.asset_tabs.concat %w{attachment_tab upload_tab bucket_tab search_tab}
- edit.bucket_pane.concat %w{bucket_notes bucket bucket_bottom}
- edit.asset_panes.concat %w{page_attachments upload search}
- end
end
end
@@ -29,6 +29,9 @@ def activate
%w{page}.each do |view|
admin.send(view).edit.add :main, "/assets/show_bucket_link", :before => "edit_header"
admin.send(view).edit.add :main, "/assets/assets_bucket", :after => "edit_buttons"
+ admin.send(view).edit.asset_tabs.concat %w{attachment_tab upload_tab bucket_tab search_tab}
+ admin.send(view).edit.bucket_pane.concat %w{bucket_notes bucket bucket_bottom}
+ admin.send(view).edit.asset_panes.concat %w{page_attachments upload search}
end
Page.class_eval {
@@ -51,4 +54,4 @@ def deactivate
# admin.tabs.remove "Assets"
end
-end
+end

0 comments on commit cfeeb92

Please sign in to comment.