radiant-paperclipped-extension 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/HELP_admin.markdown +69 -0
- data/LICENSE +21 -0
- data/README.md +137 -0
- data/Rakefile +110 -0
- data/VERSION +1 -0
- data/app/controllers/admin/assets_controller.rb +124 -0
- data/app/helpers/admin/assets_helper.rb +5 -0
- data/app/models/asset.rb +279 -0
- data/app/models/asset_page_tags.rb +101 -0
- data/app/models/asset_tags.rb +272 -0
- data/app/models/old_page_attachment.rb +26 -0
- data/app/models/page_attachment.rb +8 -0
- data/app/views/admin/assets/_asset.html.haml +19 -0
- data/app/views/admin/assets/_asset_table.html.haml +49 -0
- data/app/views/admin/assets/_assets_bucket.html.haml +8 -0
- data/app/views/admin/assets/_assets_container.html.haml +72 -0
- data/app/views/admin/assets/_bucket.html.haml +11 -0
- data/app/views/admin/assets/_bucket_asset.html.haml +9 -0
- data/app/views/admin/assets/_errors.html.haml +3 -0
- data/app/views/admin/assets/_form.html.haml +20 -0
- data/app/views/admin/assets/_page_assets.html.haml +12 -0
- data/app/views/admin/assets/_search_results.html.haml +17 -0
- data/app/views/admin/assets/_show_bucket_link.html.haml +4 -0
- data/app/views/admin/assets/_upload_to_page.html.haml +16 -0
- data/app/views/admin/assets/edit.html.haml +53 -0
- data/app/views/admin/assets/index.html.haml +43 -0
- data/app/views/admin/assets/new.html.haml +27 -0
- data/app/views/admin/assets/remove.html.haml +21 -0
- data/app/views/admin/bucket/_iframe.html.haml +1 -0
- data/config/locales/en.yml +60 -0
- data/config/locales/nl.yml +60 -0
- data/config/locales/pl.yml +60 -0
- data/config/routes.rb +20 -0
- data/db/migrate/001_create_assets.rb +12 -0
- data/db/migrate/002_create_paperclip_attributes.rb +13 -0
- data/db/migrate/003_create_user_observer.rb +13 -0
- data/db/migrate/004_create_page_attachments.rb +19 -0
- data/db/migrate/005_rename_users.rb +13 -0
- data/db/migrate/006_add_default_configs.rb +29 -0
- data/db/migrate/007_add_default_content_types.rb +29 -0
- data/db/migrate/20090316132151_disable_file_types.rb +20 -0
- data/lib/assets_admin_ui.rb +38 -0
- data/lib/mime_type_ext.rb +7 -0
- data/lib/tasks/assets_extension_tasks.rake +123 -0
- data/lib/tasks/paperclip_tasks.rake +79 -0
- data/lib/url_additions.rb +10 -0
- data/paperclipped_extension.rb +56 -0
- data/psds/file_type_icons.psd +0 -0
- data/psds/file_type_icons_.psd +0 -0
- data/public/images/assets/_page_assets.html.haml +26 -0
- data/public/images/assets/add-to-bucket.png +0 -0
- data/public/images/assets/add.png +0 -0
- data/public/images/assets/audio_icon.png +0 -0
- data/public/images/assets/audio_thumbnail.png +0 -0
- data/public/images/assets/delete.png +0 -0
- data/public/images/assets/doc_icon.png +0 -0
- data/public/images/assets/doc_thumbnail.png +0 -0
- data/public/images/assets/edit.png +0 -0
- data/public/images/assets/movie_icon.png +0 -0
- data/public/images/assets/movie_thumbnail.png +0 -0
- data/public/images/assets/new-asset.png +0 -0
- data/public/images/assets/page_edit.png +0 -0
- data/public/images/assets/pdf_icon.png +0 -0
- data/public/images/assets/pdf_thumbnail.png +0 -0
- data/public/images/assets/reorder_assets.png +0 -0
- data/public/javascripts/admin/assets.js +173 -0
- data/public/stylesheets/admin/assets.css +163 -0
- data/spec/controllers/admin/assets_controller_spec.rb +10 -0
- data/spec/models/asset_spec.rb +68 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +27 -0
- data/vendor/plugins/acts_as_list/README +23 -0
- data/vendor/plugins/acts_as_list/init.rb +3 -0
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/vendor/plugins/paperclip/LICENSE +26 -0
- data/vendor/plugins/paperclip/README.rdoc +179 -0
- data/vendor/plugins/paperclip/Rakefile +76 -0
- data/vendor/plugins/paperclip/cucumber/paperclip_steps.rb +6 -0
- data/vendor/plugins/paperclip/generators/paperclip/USAGE +5 -0
- data/vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb +27 -0
- data/vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb +19 -0
- data/vendor/plugins/paperclip/init.rb +1 -0
- data/vendor/plugins/paperclip/lib/generators/paperclip/USAGE +8 -0
- data/vendor/plugins/paperclip/lib/generators/paperclip/paperclip_generator.rb +31 -0
- data/vendor/plugins/paperclip/lib/generators/paperclip/templates/paperclip_migration.rb.erb +19 -0
- data/vendor/plugins/paperclip/lib/paperclip.rb +397 -0
- data/vendor/plugins/paperclip/lib/paperclip/attachment.rb +326 -0
- data/vendor/plugins/paperclip/lib/paperclip/callback_compatability.rb +61 -0
- data/vendor/plugins/paperclip/lib/paperclip/geometry.rb +115 -0
- data/vendor/plugins/paperclip/lib/paperclip/interpolations.rb +108 -0
- data/vendor/plugins/paperclip/lib/paperclip/iostream.rb +59 -0
- data/vendor/plugins/paperclip/lib/paperclip/matchers.rb +33 -0
- data/vendor/plugins/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb +57 -0
- data/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +74 -0
- data/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +54 -0
- data/vendor/plugins/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb +95 -0
- data/vendor/plugins/paperclip/lib/paperclip/processor.rb +49 -0
- data/vendor/plugins/paperclip/lib/paperclip/railtie.rb +24 -0
- data/vendor/plugins/paperclip/lib/paperclip/storage.rb +247 -0
- data/vendor/plugins/paperclip/lib/paperclip/style.rb +90 -0
- data/vendor/plugins/paperclip/lib/paperclip/thumbnail.rb +78 -0
- data/vendor/plugins/paperclip/lib/paperclip/upfile.rb +52 -0
- data/vendor/plugins/paperclip/lib/paperclip/version.rb +3 -0
- data/vendor/plugins/paperclip/lib/tasks/paperclip.rake +79 -0
- data/vendor/plugins/paperclip/paperclip.gemspec +34 -0
- data/vendor/plugins/paperclip/rails/init.rb +2 -0
- data/vendor/plugins/paperclip/shoulda_macros/paperclip.rb +119 -0
- data/vendor/plugins/paperclip/test/.gitignore +1 -0
- data/vendor/plugins/paperclip/test/attachment_test.rb +758 -0
- data/vendor/plugins/paperclip/test/database.yml +4 -0
- data/vendor/plugins/paperclip/test/fixtures/12k.png +0 -0
- data/vendor/plugins/paperclip/test/fixtures/50x50.png +0 -0
- data/vendor/plugins/paperclip/test/fixtures/5k.png +0 -0
- data/vendor/plugins/paperclip/test/fixtures/bad.png +1 -0
- data/vendor/plugins/paperclip/test/fixtures/s3.yml +8 -0
- data/vendor/plugins/paperclip/test/fixtures/text.txt +0 -0
- data/vendor/plugins/paperclip/test/fixtures/twopage.pdf +0 -0
- data/vendor/plugins/paperclip/test/geometry_test.rb +177 -0
- data/vendor/plugins/paperclip/test/helper.rb +148 -0
- data/vendor/plugins/paperclip/test/integration_test.rb +483 -0
- data/vendor/plugins/paperclip/test/interpolations_test.rb +124 -0
- data/vendor/plugins/paperclip/test/iostream_test.rb +78 -0
- data/vendor/plugins/paperclip/test/matchers/have_attached_file_matcher_test.rb +24 -0
- data/vendor/plugins/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb +37 -0
- data/vendor/plugins/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb +26 -0
- data/vendor/plugins/paperclip/test/matchers/validate_attachment_size_matcher_test.rb +51 -0
- data/vendor/plugins/paperclip/test/paperclip_test.rb +317 -0
- data/vendor/plugins/paperclip/test/processor_test.rb +10 -0
- data/vendor/plugins/paperclip/test/storage_test.rb +343 -0
- data/vendor/plugins/paperclip/test/style_test.rb +141 -0
- data/vendor/plugins/paperclip/test/thumbnail_test.rb +227 -0
- data/vendor/plugins/paperclip/test/upfile_test.rb +36 -0
- data/vendor/plugins/responds_to_parent/MIT-LICENSE +20 -0
- data/vendor/plugins/responds_to_parent/README +42 -0
- data/vendor/plugins/responds_to_parent/Rakefile +22 -0
- data/vendor/plugins/responds_to_parent/init.rb +2 -0
- data/vendor/plugins/responds_to_parent/lib/parent_selector_assertion.rb +144 -0
- data/vendor/plugins/responds_to_parent/lib/responds_to_parent.rb +46 -0
- data/vendor/plugins/responds_to_parent/test/assert_select_parent_test.rb +318 -0
- data/vendor/plugins/responds_to_parent/test/responds_to_parent_test.rb +115 -0
- metadata +226 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
def obtain_class
|
2
|
+
class_name = ENV['CLASS'] || ENV['class']
|
3
|
+
raise "Must specify CLASS" unless class_name
|
4
|
+
@klass = Object.const_get(class_name)
|
5
|
+
end
|
6
|
+
|
7
|
+
def obtain_attachments
|
8
|
+
name = ENV['ATTACHMENT'] || ENV['attachment']
|
9
|
+
raise "Class #{@klass.name} has no attachments specified" unless @klass.respond_to?(:attachment_definitions)
|
10
|
+
if !name.blank? && @klass.attachment_definitions.keys.include?(name)
|
11
|
+
[ name ]
|
12
|
+
else
|
13
|
+
@klass.attachment_definitions.keys
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def for_all_attachments
|
18
|
+
klass = obtain_class
|
19
|
+
names = obtain_attachments
|
20
|
+
ids = klass.connection.select_values(klass.send(:construct_finder_sql, :select => 'id'))
|
21
|
+
|
22
|
+
ids.each do |id|
|
23
|
+
instance = klass.find(id)
|
24
|
+
names.each do |name|
|
25
|
+
result = if instance.send("#{ name }?")
|
26
|
+
yield(instance, name)
|
27
|
+
else
|
28
|
+
true
|
29
|
+
end
|
30
|
+
print result ? "." : "x"; $stdout.flush
|
31
|
+
end
|
32
|
+
end
|
33
|
+
puts " Done."
|
34
|
+
end
|
35
|
+
|
36
|
+
namespace :paperclip do
|
37
|
+
desc "Refreshes both metadata and thumbnails."
|
38
|
+
task :refresh => ["paperclip:refresh:metadata", "paperclip:refresh:thumbnails"]
|
39
|
+
|
40
|
+
namespace :refresh do
|
41
|
+
desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT)."
|
42
|
+
task :thumbnails => :environment do
|
43
|
+
errors = []
|
44
|
+
for_all_attachments do |instance, name|
|
45
|
+
result = instance.send(name).reprocess!
|
46
|
+
errors << [instance.id, instance.errors] unless instance.errors.blank?
|
47
|
+
result
|
48
|
+
end
|
49
|
+
errors.each{|e| puts "#{e.first}: #{e.last.full_messages.inspect}" }
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)."
|
53
|
+
task :metadata => :environment do
|
54
|
+
for_all_attachments do |instance, name|
|
55
|
+
if file = instance.send(name).to_file
|
56
|
+
instance.send("#{name}_file_name=", instance.send("#{name}_file_name").strip)
|
57
|
+
instance.send("#{name}_content_type=", file.content_type.strip)
|
58
|
+
instance.send("#{name}_file_size=", file.size) if instance.respond_to?("#{name}_file_size")
|
59
|
+
instance.save(false)
|
60
|
+
else
|
61
|
+
true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Cleans out invalid attachments. Useful after you've added new validations."
|
68
|
+
task :clean => :environment do
|
69
|
+
for_all_attachments do |instance, name|
|
70
|
+
instance.send(name).send(:validate)
|
71
|
+
if instance.send(name).valid?
|
72
|
+
true
|
73
|
+
else
|
74
|
+
instance.send("#{name}=", nil)
|
75
|
+
instance.save
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require_dependency 'application_controller'
|
2
|
+
require File.dirname(__FILE__) + '/lib/url_additions'
|
3
|
+
include UrlAdditions
|
4
|
+
|
5
|
+
class PaperclippedExtension < Radiant::Extension
|
6
|
+
version "0.8.1"
|
7
|
+
description "Assets extension based on the lightweight Paperclip plugin."
|
8
|
+
url "http://github.com/kbingman/paperclipped"
|
9
|
+
|
10
|
+
def activate
|
11
|
+
|
12
|
+
Radiant::AdminUI.send :include, AssetsAdminUI unless defined? admin.asset # UI is a singleton and already loaded
|
13
|
+
admin.asset = Radiant::AdminUI.load_default_asset_regions
|
14
|
+
|
15
|
+
Admin::PagesController.class_eval {
|
16
|
+
helper Admin::AssetsHelper
|
17
|
+
}
|
18
|
+
|
19
|
+
%w{page}.each do |view|
|
20
|
+
# admin.send(view).edit.add :main, "/admin/assets/show_bucket_link", :before => "edit_header"
|
21
|
+
admin.pages.edit.add :part_controls, 'admin/assets/show_bucket_link'
|
22
|
+
admin.send(view).edit.add :main, "/admin/assets/assets_bucket", :after => "edit_buttons"
|
23
|
+
admin.send(view).edit.asset_tabs.concat %w{attachment_tab upload_tab bucket_tab search_tab}
|
24
|
+
admin.send(view).edit.bucket_pane.concat %w{bucket_notes bucket bucket_bottom}
|
25
|
+
admin.send(view).edit.asset_panes.concat %w{page_attachments upload search}
|
26
|
+
end
|
27
|
+
|
28
|
+
Page.class_eval {
|
29
|
+
has_many :page_attachments, :order => :position
|
30
|
+
has_many :assets, :through => :page_attachments
|
31
|
+
include AssetPageTags
|
32
|
+
}
|
33
|
+
|
34
|
+
# Make asset tags available in stylesheets and javascripts
|
35
|
+
if defined?(TextAsset)
|
36
|
+
TextAsset.send :include, AssetTags
|
37
|
+
end
|
38
|
+
|
39
|
+
# connect UserActionObserver with my models
|
40
|
+
UserActionObserver.instance.send :add_observer!, Asset
|
41
|
+
|
42
|
+
# This is just needed for testing if you are using mod_rails
|
43
|
+
if Radiant::Config.table_exists? && Radiant::Config["assets.image_magick_path"]
|
44
|
+
Paperclip.options[:image_magick_path] = Radiant::Config["assets.image_magick_path"]
|
45
|
+
end
|
46
|
+
|
47
|
+
tab 'Content' do
|
48
|
+
add_item I18n.translate("paperclipped.assets_title"), "/admin/assets", :after => "Pages"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def deactivate
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
- unless @page.assets.empty?
|
2
|
+
- @page.page_attachments.each do |a|
|
3
|
+
- asset = a.asset
|
4
|
+
- dom_id = "attachment_#{a.id}"
|
5
|
+
%li{ :id => dom_id }
|
6
|
+
- asset_type = asset.image? ? "image" : "link"
|
7
|
+
%div{ :class => "#{asset_type} asset" }
|
8
|
+
= link_to image_tag(asset.thumbnail(:thumbnail)), asset.thumbnail, :onclick => "return false;", :title => "Insert #{asset.title}"
|
9
|
+
.info{ :id => "#{dom_id}_info" }
|
10
|
+
%strong
|
11
|
+
= link_to "edit", edit_asset_url(asset.id), :id => "edit_asset", :title => "Edit #{asset.title}"
|
12
|
+
- if @page
|
13
|
+
= link_to_remote "remove", :html => { :id => "remove_asset", :title => "remove asset" }, :url => remove_page_asset_url(:asset => asset.id, :page => @page.id), |
|
14
|
+
:confirm => "Are you sure you want to remove this asset from the page?", |
|
15
|
+
:after => "Effect.Fade('#{dom_id}', { duration: 0.5 })", :complete => "Element.remove('#{dom_id}'); Element.highlight('assets')" |
|
16
|
+
= image_tag "/images/assets/reorder_assets.png", :class => "reorder", :title => "Reorder"
|
17
|
+
|
18
|
+
- else
|
19
|
+
%li
|
20
|
+
%p.note You have no attached assets.
|
21
|
+
|
22
|
+
%script{ :type => "text/javascript" }
|
23
|
+
$$('#assets .asset').each(function(element){
|
24
|
+
new Draggable(element, { revert: true });
|
25
|
+
element.addClassName('move');
|
26
|
+
});
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,173 @@
|
|
1
|
+
document.observe("dom:loaded", function() {
|
2
|
+
if($('asset-bucket')){
|
3
|
+
new Draggable('asset-bucket', { starteffect: false, endeffect: false });
|
4
|
+
}
|
5
|
+
if($('page-attachments')){
|
6
|
+
Asset.ChooseTabByName('page-attachments');
|
7
|
+
}
|
8
|
+
});
|
9
|
+
|
10
|
+
var Asset = {};
|
11
|
+
|
12
|
+
Asset.Tabs = Behavior.create({
|
13
|
+
onclick: function(e){
|
14
|
+
e.stop();
|
15
|
+
Asset.ChooseTab(this.element);
|
16
|
+
}
|
17
|
+
});
|
18
|
+
|
19
|
+
// factored out so that it can be called in an ajax response
|
20
|
+
|
21
|
+
Asset.ChooseTab = function (element) {
|
22
|
+
var pane = $(element.href.split('#')[1]);
|
23
|
+
var panes = $('assets').select('.pane');
|
24
|
+
|
25
|
+
var tabs = $('asset-tabs').select('.asset-tab');
|
26
|
+
tabs.each(function(tab) {tab.removeClassName('here');});
|
27
|
+
|
28
|
+
element.addClassName('here');;
|
29
|
+
panes.each(function(pane) {Element.hide(pane);});
|
30
|
+
Element.show($(pane));
|
31
|
+
}
|
32
|
+
|
33
|
+
Asset.ChooseTabByName = function (tabname) {
|
34
|
+
var element = $('tab_' + tabname);
|
35
|
+
Asset.ChooseTab(element);
|
36
|
+
}
|
37
|
+
|
38
|
+
// factored out so that it can be called after new page part creation
|
39
|
+
|
40
|
+
Asset.MakeDraggables = function () {
|
41
|
+
$$('div.asset').each(function(element){
|
42
|
+
new Draggable(element, { revert: true });
|
43
|
+
element.addClassName('move');
|
44
|
+
});
|
45
|
+
}
|
46
|
+
|
47
|
+
Asset.DisableLinks = Behavior.create({
|
48
|
+
onclick: function(e){
|
49
|
+
e.stop();
|
50
|
+
}
|
51
|
+
});
|
52
|
+
|
53
|
+
Asset.AddToPage = Behavior.create({
|
54
|
+
onclick: function(e){
|
55
|
+
e.stop();
|
56
|
+
url = this.element.href;
|
57
|
+
new Ajax.Updater('attachments', url, {
|
58
|
+
asynchronous : true,
|
59
|
+
evalScripts : true,
|
60
|
+
method : 'get'
|
61
|
+
// onComplete : Element.highlight('page-attachments')
|
62
|
+
});
|
63
|
+
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
Asset.MakeDroppables = function () {
|
68
|
+
$$('.textarea').each(function(box){
|
69
|
+
if (!box.hasClassName('droppable')) {
|
70
|
+
Droppables.add(box, {
|
71
|
+
accept: 'asset',
|
72
|
+
onDrop: function(element) {
|
73
|
+
var link = element.select('a.bucket_link')[0];
|
74
|
+
var asset_id = element.id.split('_').last();
|
75
|
+
var classes = element.className.split(' ');
|
76
|
+
var tag_type = classes[0];
|
77
|
+
var tag = '<r:assets:' + tag_type + ' id="' + asset_id + '" size="original" />';
|
78
|
+
//Form.Element.focus(box);
|
79
|
+
if(!!document.selection){
|
80
|
+
box.focus();
|
81
|
+
var range = (box.range) ? box.range : document.selection.createRange();
|
82
|
+
range.text = tag;
|
83
|
+
range.select();
|
84
|
+
}else if(!!box.setSelectionRange){
|
85
|
+
var selection_start = box.selectionStart;
|
86
|
+
box.value = box.value.substring(0,selection_start) + tag + box.value.substring(box.selectionEnd);
|
87
|
+
box.setSelectionRange(selection_start + tag.length,selection_start + tag.length);
|
88
|
+
}
|
89
|
+
box.focus();
|
90
|
+
}
|
91
|
+
});
|
92
|
+
box.addClassName('droppable');
|
93
|
+
}
|
94
|
+
});
|
95
|
+
}
|
96
|
+
|
97
|
+
Asset.ShowBucket = Behavior.create({
|
98
|
+
onclick: function(e){
|
99
|
+
e.stop();
|
100
|
+
var element = $('asset-bucket');
|
101
|
+
element.centerInViewport();
|
102
|
+
element.toggle();
|
103
|
+
Asset.MakeDroppables();
|
104
|
+
}
|
105
|
+
});
|
106
|
+
|
107
|
+
Asset.HideBucket = Behavior.create({
|
108
|
+
onclick: function(e){
|
109
|
+
e.stop();
|
110
|
+
var element = $('asset-bucket');
|
111
|
+
element.hide();
|
112
|
+
}
|
113
|
+
});
|
114
|
+
|
115
|
+
Asset.FileTypes = Behavior.create({
|
116
|
+
onclick: function(e){
|
117
|
+
e.stop();
|
118
|
+
var element = this.element;
|
119
|
+
var type_id = element.text.downcase();
|
120
|
+
var type_check = $(type_id + '-check');
|
121
|
+
var search_form = $('filesearchform');
|
122
|
+
if(element.hasClassName('pressed')) {
|
123
|
+
element.removeClassName('pressed');
|
124
|
+
type_check.removeAttribute('checked');
|
125
|
+
} else {
|
126
|
+
element.addClassName('pressed');
|
127
|
+
type_check.setAttribute('checked', 'checked');
|
128
|
+
}
|
129
|
+
new Ajax.Updater('assets_table', search_form.action, {
|
130
|
+
asynchronous: true,
|
131
|
+
evalScripts: true,
|
132
|
+
parameters: Form.serialize(search_form),
|
133
|
+
method: 'get',
|
134
|
+
onComplete: 'assets_table'
|
135
|
+
});
|
136
|
+
}
|
137
|
+
});
|
138
|
+
|
139
|
+
Asset.WaitingForm = Behavior.create({
|
140
|
+
onsubmit: function(e){
|
141
|
+
this.element.addClassName('waiting');
|
142
|
+
return true;
|
143
|
+
}
|
144
|
+
});
|
145
|
+
|
146
|
+
Asset.ResetForm = function (name) {
|
147
|
+
var element = $('asset-upload');
|
148
|
+
element.removeClassName('waiting');
|
149
|
+
element.reset();
|
150
|
+
Asset.MakeDroppables();
|
151
|
+
}
|
152
|
+
|
153
|
+
Asset.AddAsset = function (name) {
|
154
|
+
element = $(name);
|
155
|
+
asset = element.select('.asset')[0];
|
156
|
+
if (window.console && window.console.log) {
|
157
|
+
console.log('inserted element is ', element);
|
158
|
+
console.log('contained asset is ', asset);
|
159
|
+
}
|
160
|
+
if (asset) {
|
161
|
+
new Draggable(asset, { revert: true });
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
Event.addBehavior({
|
166
|
+
'#asset-tabs a' : Asset.Tabs,
|
167
|
+
'#close-link a' : Asset.HideBucket,
|
168
|
+
'#show-bucket a' : Asset.ShowBucket,
|
169
|
+
'#filesearchform a' : Asset.FileTypes,
|
170
|
+
'#asset-upload' : Asset.WaitingForm,
|
171
|
+
'div.asset a' : Asset.DisableLinks,
|
172
|
+
'a.add_asset' : Asset.AddToPage
|
173
|
+
});
|
@@ -0,0 +1,163 @@
|
|
1
|
+
#content { padding-bottom: 50px;} /*fix main css for #actions part*/
|
2
|
+
|
3
|
+
.asset_filters {
|
4
|
+
background: #ccc;
|
5
|
+
border-top: 1px solid #ccc;
|
6
|
+
border-bottom: 1px solid #ccc;
|
7
|
+
}
|
8
|
+
.asset_filters form { margin: 10px;}
|
9
|
+
.regenerator { float: right; margin-top: -40px; }
|
10
|
+
.regenerator a { background: #000; color: #ccc; padding: 5px; font-size: 80%; text-decoration: none; }
|
11
|
+
|
12
|
+
|
13
|
+
td.asset { width: 72px; }
|
14
|
+
|
15
|
+
td.asset a { }
|
16
|
+
td.asset a img { padding: 2px; background-color: #eee; border: 1px solid #ccc;}
|
17
|
+
|
18
|
+
td.asset-title, td.tag-name { font-size: 115%; font-weight: bold;}
|
19
|
+
td.asset-title a, td.tag-name a { text-decoration: none; color: black; }
|
20
|
+
|
21
|
+
td.asset-tags a { color: black; text-decoration:none; }
|
22
|
+
table td.asset-title a:hover, td.asset-tags a:hover, td.tag-name a:hover {
|
23
|
+
color: blue; text-decoration: underline; }
|
24
|
+
table .caption { color: #9eb3bf; font-style: italic; font-weight: normal; margin: 10px; }
|
25
|
+
|
26
|
+
table th.content_type { width: 120px; }
|
27
|
+
table td.content_type { width: 120px; color: #9eb3bf; font-style: italic; font-weight: normal; }
|
28
|
+
table td.add-to-bucket { width: 90px;}
|
29
|
+
table td.add-to-bucket a { background: url("../../images/admin/plus.png") no-repeat scroll 4px 0 transparent; color: black; font-size: 80%; padding: 0 0 0 20px; text-decoration: none;}
|
30
|
+
|
31
|
+
#asset-bucket {
|
32
|
+
width: 70%;
|
33
|
+
padding: 20px;
|
34
|
+
cursor: move;
|
35
|
+
}
|
36
|
+
|
37
|
+
#assets-container, #asset-bucket {
|
38
|
+
background-color: #9e9e9e;
|
39
|
+
}
|
40
|
+
|
41
|
+
#page #assets-container {
|
42
|
+
margin-left: -20px;
|
43
|
+
margin-right: -20px;
|
44
|
+
padding: 20px;
|
45
|
+
}
|
46
|
+
#content #asset-bucket form label { color: black; text-shadow: none; }
|
47
|
+
#content #asset-bucket #search-assets form label { display: inline; }
|
48
|
+
#close-link { margin-top: 10px; }
|
49
|
+
|
50
|
+
#assets {
|
51
|
+
clear: both;
|
52
|
+
position: relative;
|
53
|
+
margin-bottom: 4px;
|
54
|
+
padding: 0;
|
55
|
+
cursor: default;
|
56
|
+
min-height: 150px;
|
57
|
+
height: auto !important;
|
58
|
+
height: 150px;
|
59
|
+
background: white;
|
60
|
+
}
|
61
|
+
|
62
|
+
#asset-bucket, #assets .pane {
|
63
|
+
-webkit-box-shadow: rgba(0, 0, 0, 0.148438) 2px 2px 3px;
|
64
|
+
-moz-box-shadow: rgba(0, 0, 0, 0.148438) 2px 2px 3px;
|
65
|
+
-box-shadow: rgba(0, 0, 0, 0.148438) 2px 2px 3px;
|
66
|
+
}
|
67
|
+
|
68
|
+
#assets .pane,
|
69
|
+
#content .form-area .asset {
|
70
|
+
background: #F5F1E2 url(/images/admin/vertical_tan_gradient.png) repeat-x 0% 0%;
|
71
|
+
padding: 12px 20px;
|
72
|
+
}
|
73
|
+
|
74
|
+
#assets h4 { font-size: 100%; font-weight: bold; margin: 0; }
|
75
|
+
#assets p { padding: 0; margin: 0; line-height: 22px; }
|
76
|
+
#assets .note { font-weight: normal; color: black; font-size: 80%; }
|
77
|
+
|
78
|
+
.note:first-letter { text-transform: uppercase; }
|
79
|
+
|
80
|
+
#assets p.note { margin: 5px 0; font-style: italic;}
|
81
|
+
|
82
|
+
#clear-bucket, #reorder, #done {position: absolute; right: 10px;}
|
83
|
+
#clear-bucket a, #reorder a, #done a { text-align: right; font-weight: bold; font-size: 85%;
|
84
|
+
color: black; text-decoration: none; }
|
85
|
+
#clear-bucket a:hover, #reorder a:hover, #done a:hover { color: blue; text-decoration: underline; }
|
86
|
+
|
87
|
+
|
88
|
+
#asset-tabs { margin: 0 }
|
89
|
+
#asset-tabs .asset-tab {
|
90
|
+
background-color: #CAC8C0;
|
91
|
+
color: #7F7F7F;
|
92
|
+
border-top-left-radius: 6px 6px;
|
93
|
+
border-top-right-radius: 6px 6px;
|
94
|
+
display: inline-block;
|
95
|
+
font-weight: bold;
|
96
|
+
text-align: left;
|
97
|
+
font-size: 90%;
|
98
|
+
margin-right: 5px;
|
99
|
+
padding: 7px 10px 4px; text-decoration: none; text-transform: titlecase; outline: none; -moz-outline: none;
|
100
|
+
}
|
101
|
+
|
102
|
+
#asset-tabs .asset-tab.here {
|
103
|
+
background-color: white;
|
104
|
+
color: black;
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
#bucket ul, #page-attachments ul, #search-results ul { list-style: none; margin: 0; padding: 0 10px 0 0;}
|
109
|
+
|
110
|
+
#assets li { position: relative; float:left; margin: 8px 8px 0 8px; height: 106px; padding-right: 24px;}
|
111
|
+
#assets .asset { position: relative; }
|
112
|
+
#assets .asset img { padding: 3px; background-color:#eaeaea; border: 1px solid #ccc; }
|
113
|
+
|
114
|
+
#assets .info { position: absolute; top: 0; right: 0; }
|
115
|
+
#assets .info p { margin: 0; }
|
116
|
+
#assets .info a { display: block; color: black; text-decoration: none; height: 16; width: 16px; border: 1px solid #ccc; margin: 0 0 5px 0; }
|
117
|
+
|
118
|
+
#assets .info a#edit_asset { background: #fff url('/images/assets/edit.png') center center no-repeat; }
|
119
|
+
#assets .info a#add_asset { background: #fff url('/images/admin/plus.png') center center no-repeat; }
|
120
|
+
#assets .info a#remove_asset { background: #fff url('/images/admin/minus.png') center center no-repeat; }
|
121
|
+
#assets .info img.reorder { border: 1px solid #ccc; cursor: move; }
|
122
|
+
|
123
|
+
#assets .info a:hover { color: blue; text-decoration: underline; }
|
124
|
+
#assets .image_info h4 { margin: 0 0 10px 0; padding: 0; background: none; }
|
125
|
+
|
126
|
+
#content .form-area .asset {padding-top: 20px;padding-bottom:20px;}
|
127
|
+
#content .form-area .upload {}
|
128
|
+
#content p.content label.filename { margin-bottom: -5px; display: block; }
|
129
|
+
#content .form-area p.upload label { margin-bottom: 5px; display: block; }
|
130
|
+
p#asset-name { padding-top: 8px; font-size: 80%; }
|
131
|
+
p.info { font-size: 85%; }
|
132
|
+
|
133
|
+
.asset-buttons { font-size: 80%; }
|
134
|
+
|
135
|
+
table#site-map td.assets, table#site-map th.assets { text-align: right; border: 1px solid red;}
|
136
|
+
|
137
|
+
#upload-assets { }
|
138
|
+
#upload-assets a { color: black; font-weight: bold; text-decoration: none; }
|
139
|
+
#upload-assets a:hover { color: blue; text-decoration: underline; }
|
140
|
+
#upload-form .file { padding: 10px 10px 5px; }
|
141
|
+
#upload-form .upload-buttons { padding: 0 10px; font-size: 80%; }
|
142
|
+
#upload-form label { margin-bottom: 5px; display: block; font-weight: bold; }
|
143
|
+
#upload-form iframe { width: 1px; height: 1px; border: 0; }
|
144
|
+
|
145
|
+
#asset-upload .spinner { display: none; width: 16px; height: 16px; background-image: url(/images/admin/spinner.gif);}
|
146
|
+
#asset-upload.waiting { color: #666;}
|
147
|
+
#asset-upload.waiting .spinner { display: block;}
|
148
|
+
#asset-upload.waiting .button { display: none;}
|
149
|
+
|
150
|
+
#filesearchform { }
|
151
|
+
#filesearchform #search p input{ margin: -3px 0 -3px; padding: 1px; }
|
152
|
+
#filesearchform label { font-weight: bold; }
|
153
|
+
#filesearchform a { background: #999; color: #000; border: 1px solid #777; padding: 3px; text-decoration: none; outline: none; -moz-outline: none; font-size: 80%; }
|
154
|
+
#filesearchform a:hover { background: #eee; text-decoration: underline; }
|
155
|
+
#filesearchform a.pressed { background: #eee; }
|
156
|
+
|
157
|
+
.move a { cursor: move; }
|
158
|
+
|
159
|
+
#show-bucket { font-size: 85%; padding: 0 0 0 4px; }
|
160
|
+
#content form #show-bucket a { color: #44e; }
|
161
|
+
|
162
|
+
.highlight { color: #fff; }
|
163
|
+
.pagination { float: right; margin: 14px 10px 0 0;}
|