forked from kbingman/paperclipped
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
209 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
%p.title | ||
%label{ :for => "asset_title" } Title | ||
= form.text_field :title, :class => 'textbox', :maxlength => 100 | ||
#extended-metadata{ :class => "row", :style => "display: none" } | ||
%table.fieldset{ :cellpadding => "0", :cellspacing => "0", :border => "0" } | ||
%tr | ||
%td.label | ||
%label{ :for => "asset_caption" } Caption | ||
%td.field | ||
= form.text_field :caption, :class => 'textbox', :maxlength => 255 | ||
%p | ||
%small | ||
%a{ :id => "more-extended-metadata", :href => "#", :onclick => "#{toggle_javascript_for('extended-metadata')}; return false;" } More | ||
%a{ :id => "less-extended-metadata", :href => "#", :onclick => "#{toggle_javascript_for('extended-metadata')}; return false;", :style => "display: none" } Less | ||
= render_region :form_top | ||
- render_region :form do |form| | ||
- form.edit_title do | ||
%p.title | ||
%label{ :for => "asset_title" } Title | ||
= f.text_field :title, :class => 'textbox', :maxlength => 100 | ||
- form.edit_metadata do | ||
#extended-metadata{ :class => "row", :style => "display: none" } | ||
%table.fieldset{ :cellpadding => "0", :cellspacing => "0", :border => "0" } | ||
%tr | ||
%td.label | ||
%label{ :for => "asset_caption" } Caption | ||
%td.field | ||
= f.text_field :caption, :class => 'textbox', :maxlength => 255 | ||
%p | ||
%small | ||
%a{ :id => "more-extended-metadata", :href => "#", :onclick => "#{toggle_javascript_for('extended-metadata')}; return false;" } More | ||
%a{ :id => "less-extended-metadata", :href => "#", :onclick => "#{toggle_javascript_for('extended-metadata')}; return false;", :style => "display: none" } Less | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,99 @@ | ||
- include_stylesheet 'admin/assets' | ||
= render_region :top | ||
|
||
%h1 Assets | ||
- render_region :preamble do |preamble| | ||
- preamble.header do | ||
%h1 Assets | ||
|
||
%p | ||
Assets and images can be uploaded and then attached or inserted into pages, snippets and layouts. | ||
Click on a asset name below to edit it or click <code>Remove</code> to delete it. | ||
|
||
%p= link_to image_tag('assets/new-asset.png', :alt => 'New Asset'), new_asset_path | ||
|
||
%p | ||
- form_tag(assets_url,:id => 'filesearchform', :method => 'get') do | ||
%span | ||
= link_to "Images", "#" | ||
%span | ||
= link_to "Others", "#" | ||
%span | ||
= link_to "Audio", "#" | ||
%span | ||
= link_to "Movies", "#" | ||
|
||
#type_boxes{ :style => "display: none" } | ||
= check_box_tag 'filter[audio]', '1', false, :id => 'audio-check' | ||
= check_box_tag 'filter[image]', '1', false, :id => 'images-check' | ||
= check_box_tag 'filter[other]', '1', false, :id => 'others-check' | ||
= check_box_tag 'filter[movie]', '1', false, :id => 'movies-check' | ||
|
||
%label Search | ||
%input{ :type => "text", :id => "search", :name => "search" } | ||
= observe_field 'search', :frequency => 1, :update => 'assets_table', :url => { :controller => 'assets', :action=> 'index' }, :method => 'get', :with => "'search=' + escape(value)" | ||
- preamble.explanation do | ||
%p | ||
Assets and images can be uploaded and then attached or inserted into pages, snippets and layouts. | ||
Click on a asset name below to edit it or click <code>Remove</code> to delete it. | ||
|
||
- preamble.new_button do | ||
%p= link_to image_tag('assets/new-asset.png', :alt => 'New Asset'), new_asset_path | ||
|
||
- preamble.filters do | ||
%p | ||
- form_tag(assets_url,:id => 'filesearchform', :method => 'get') do | ||
%span | ||
= link_to "Images", "#" | ||
%span | ||
= link_to "Others", "#" | ||
%span | ||
= link_to "Audio", "#" | ||
%span | ||
= link_to "Movies", "#" | ||
|
||
#type_boxes{ :style => "display: none" } | ||
= check_box_tag 'filter[audio]', '1', false, :id => 'audio-check' | ||
= check_box_tag 'filter[image]', '1', false, :id => 'images-check' | ||
= check_box_tag 'filter[other]', '1', false, :id => 'others-check' | ||
= check_box_tag 'filter[movie]', '1', false, :id => 'movies-check' | ||
|
||
%label Search | ||
%input{ :type => "text", :id => "search", :name => "search" } | ||
= observe_field 'search', :frequency => 1, :update => 'assets_table', :url => { :controller => 'assets', :action=> 'index' }, :method => 'get', :with => "'search=' + escape(value)" | ||
|
||
#assets_table | ||
= render :partial => 'asset_table' | ||
|
||
= render :partial => 'assets_container' | ||
|
||
- if current_user.admin? | ||
%p | ||
You can regenerate all thumbnails here. Beware that this will take a while and consume considerable resources on your server. | ||
%table{ :class => "index", :cellpadding => "0", :cellspacing => "0", :border => "0"} | ||
%thead | ||
%tr | ||
- render_region :thead do |thead| | ||
- thead.thumbnail_header do | ||
%th.asset Image | ||
- thead.title_header do | ||
%th.asset-title Title | ||
- thead.content_type_header do | ||
%th.content_type Type | ||
- thead.modify_header do | ||
%th.modify{ :colspan =>"2"} Modify | ||
|
||
%tbody | ||
- unless @assets.empty? | ||
- for asset in @assets | ||
- render_region :tbody do |tbody| | ||
%tr.node.level-1 | ||
- tbody.thumbnail_cell do | ||
%td.asset | ||
- asset_id = "asset_#{asset.id.to_s}" | ||
= link_to image_tag(asset.thumbnail(:icon)), edit_asset_url(:id => asset), :class => 'icon' | ||
- tbody.title_cell do | ||
%td.asset-title | ||
= link_to asset.title, edit_asset_url(:id => asset.id) | ||
| ||
%span.caption | ||
= asset.caption | ||
- tbody.content_type_cell do | ||
%td.content_type | ||
= asset.asset_content_type | ||
- tbody.bucket_cell do | ||
%td.add-to-bucket | ||
= link_to_remote(image_tag('assets/add-to-bucket.png', :alt => 'Add to Bucket'), :url => add_bucket_url(:id => asset)) | ||
- tbody.remove_cell do | ||
%td.remove | ||
= link_to image_tag('admin/remove.png', :alt => 'Remove Asset'), remove_asset_url(:id => asset) | ||
- else | ||
- render_region :tbody do |tbody| | ||
%tr | ||
%td.note{ :colspan => "5" } | ||
No Assets | ||
|
||
- render_region :pagination do | ||
= will_paginate @assets | ||
|
||
%script{ :type => "text/javascript"} | ||
// <! [CDATA[ | ||
new RuledTable('assets') | ||
//] | ||
|
||
- render_region :assets_container do | ||
= render :partial => 'assets_container' | ||
|
||
- form_tag refresh_assets_path do | ||
%input.button{ :type => "submit", :value => "Regenerate" } | ||
- render_region :bottom do |bottom| | ||
- bottom.regenerate do | ||
- if current_user.admin? | ||
%p | ||
You can regenerate all thumbnails here. Beware that this will take a while and consume considerable resources on your server. | ||
- form_tag refresh_assets_path do | ||
%input.button{ :type => "submit", :value => "Regenerate" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
- include_stylesheet 'admin/assets' | ||
= render_region :top | ||
|
||
%h1= "New Asset" | ||
- render_region :main do |main| | ||
- main.edit_header do | ||
%h1= "New Asset" | ||
%p | ||
Choose an asset to upload here. If the <code>Title</code> field is left blank, the filename (without the file type) will be automatically added. | ||
By clicking on <code>More</code>, you can add a caption as well. | ||
|
||
%p | ||
Choose an asset to upload here. If the <code>Title</code> field is left blank, the filename (without the file type) will be automatically added. | ||
By clicking on <code>More</code>, you can add a caption as well. | ||
|
||
- form_for :asset, :url => assets_path, :html => { :method => "post", :multipart => true } do |form| | ||
.form-area | ||
= render :partial => "form", :locals => { :form => form } | ||
%p.upload | ||
%label.upload Choose a file to upload | ||
= form.file_field :asset, :class => "", :style => "width: 100%" | ||
- main.edit_form do | ||
- form_for :asset, :url => assets_path, :html => { :method => "post", :multipart => true } do |f| | ||
.form-area | ||
= render :partial => "form", :locals => { :f => f } | ||
|
||
%p.upload | ||
%label.upload Choose a file to upload | ||
= f.file_field :asset, :class => "", :style => "width: 100%" | ||
|
||
%p.buttons | ||
= save_model_button(@asset) | ||
= save_model_and_continue_editing_button(@asset) | ||
or | ||
= link_to "Cancel", assets_url | ||
%p.buttons | ||
= save_model_button(@asset) | ||
= save_model_and_continue_editing_button(@asset) | ||
or | ||
= link_to "Cancel", assets_url | ||
|
||
= main.edit_regenerate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module AssetsAdminUI | ||
|
||
def self.included(base) | ||
base.class_eval do | ||
|
||
attr_accessor :asset | ||
alias_method :assets, :asset | ||
|
||
protected | ||
|
||
def load_default_asset_regions | ||
returning OpenStruct.new do |asset| | ||
asset.edit = Radiant::AdminUI::RegionSet.new do |edit| | ||
edit.main.concat %w{edit_header edit_form edit_regenerate} | ||
edit.form.concat %w{edit_title edit_metadata} | ||
end | ||
asset.index = Radiant::AdminUI::RegionSet.new do |index| | ||
index.preamble.concat %w{header explanation new_button filters} | ||
index.thead.concat %w{thumbnail_header title_header content_type_header modify_header} | ||
index.tbody.concat %w{thumbnail_cell title_cell content_type_cell bucket_cell remove_cell} | ||
index.paginate | ||
index.assets_container | ||
index.bottom.concat %w{regenerate} | ||
end | ||
asset.remove = asset.index | ||
asset.new = asset.edit | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters