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 @@
|
|
1
|
+
= render :partial => 'admin/assets/asset', :object => asset, :locals => {:dom_id => "attachment_#{asset.id}" }
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
errors:
|
5
|
+
models:
|
6
|
+
asset:
|
7
|
+
attributes:
|
8
|
+
asset:
|
9
|
+
blank: 'You must choose a file to upload!'
|
10
|
+
paperclipped:
|
11
|
+
add_asset_to_bucket: 'Add Asset to Bucket'
|
12
|
+
add_to_bucket: 'Add to Bucket'
|
13
|
+
asset: 'Asset'
|
14
|
+
asset_edit_title: 'Edit Asset'
|
15
|
+
asset_errors: 'Sorry. {{errors}}'
|
16
|
+
asset_page_attachment_note: 'Attached assets. These can be inserted with drag and drop or shown with the <code><r:assets:each /></code> tag.'
|
17
|
+
asset_note: 'Attached assets. '
|
18
|
+
assets_explanation: 'Assets and images can be uploaded and then attached or inserted into pages, snippets and layouts. Click on a asset name above to edit it or click <code>Remove</code> to delete it.'
|
19
|
+
assets_title: 'Assets'
|
20
|
+
asset_page_upload_note: 'Assets uploaded here will be automatically associated with this page.'
|
21
|
+
asset_upload_note: '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.'
|
22
|
+
attached_assets: 'Attached Assets'
|
23
|
+
attach_to_page: 'Attach to page'
|
24
|
+
audio: 'Audio'
|
25
|
+
bucket: 'Bucket'
|
26
|
+
bucket_note: 'The Bucket provides temporary storage for your items. You can use it to place items in your pages or snippets.'
|
27
|
+
caption: 'Caption'
|
28
|
+
choose_upload: 'Choose a file to upload'
|
29
|
+
clear_bucket: 'Clear Bucket'
|
30
|
+
confirm_remove_asset: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following asset?'
|
31
|
+
confirm_remove_from_page: 'Are you sure you want to remove this assets from the page?'
|
32
|
+
delete_asset: 'Delete Asset'
|
33
|
+
edit_asset: 'Edit {{asset}}'
|
34
|
+
empty_bucket: 'Your bucket is empty'
|
35
|
+
filename: 'Filename'
|
36
|
+
images: 'Images'
|
37
|
+
images_automatically_created: 'images are automatically created'
|
38
|
+
less: 'Less'
|
39
|
+
movies: 'Movies'
|
40
|
+
need_to_upload: 'Need to upload?'
|
41
|
+
new_asset: 'New Asset'
|
42
|
+
no_assets_found: 'There were no assets found'
|
43
|
+
no_assets: 'No Assets'
|
44
|
+
no_attached_assets: 'You have no attached assets.'
|
45
|
+
others: 'Others'
|
46
|
+
regenerate_all_thumbnails: 'You can regenerate all thumbnails here. Beware that this will take a while and consume considerable resources on your server.'
|
47
|
+
regenerate: 'Regenerate'
|
48
|
+
regenerate_thumbnails: 'You can regenerate the asset thumbnails here. Beware that this will take a while and consume considerable resources on your server.'
|
49
|
+
remove_asset: 'Remove Asset'
|
50
|
+
remove_from_page: 'Remove from page'
|
51
|
+
reorder: 'Reorder'
|
52
|
+
replace_file: 'Replace File'
|
53
|
+
save_and_upload: 'Save and Upload'
|
54
|
+
search_assets: 'Search for assets'
|
55
|
+
search: 'Search'
|
56
|
+
show_assets_bucket: 'Show Assets Bucket'
|
57
|
+
title: 'Title'
|
58
|
+
type: 'Type'
|
59
|
+
types_to_find: 'Types to find'
|
60
|
+
upload: 'Upload'
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
nl:
|
3
|
+
activerecord:
|
4
|
+
errors:
|
5
|
+
models:
|
6
|
+
asset:
|
7
|
+
attributes:
|
8
|
+
asset:
|
9
|
+
blank: 'Je moet eerst het bestand selecteren dat je wilt uploaden'
|
10
|
+
paperclipped:
|
11
|
+
add_asset_to_bucket: 'Voeg bestand toe aan klembord'
|
12
|
+
add_to_bucket: 'Naar klembord kopieren'
|
13
|
+
asset: 'Bestand'
|
14
|
+
asset_edit_title: 'Bestand aanpassen'
|
15
|
+
asset_errors: 'Sorry. {{errors}}'
|
16
|
+
asset_page_attachment_note: 'Gekoppelde bestanden. Deze kunnen worden ingevoegd met "drag and drop", of getoond worden met de <code><r:assets:each /></code> tag.'
|
17
|
+
asset_note: 'Gekoppelde bestanden.'
|
18
|
+
assets_explanation: "Bestanden en afbeeldingen kunnen geüpload worden en dan toegevoegd worden aan Pagina's, Snippets en Layouts."
|
19
|
+
assets_title: 'Bestanden'
|
20
|
+
asset_page_upload_note: 'Bestanden die hier worden geüpload, zullen automatisch gekoppeld worden aan de huidige pagina.'
|
21
|
+
asset_upload_note: 'Selecteer hier het bestand dat je wil uploaden. Als je het <code>Titel</code> veld leeg laat, zal de bestandsnaam daarvoor gebruikt worden. Je kunt ook een onderschrift toevoegen door op <code>Meer</code> te klikken.'
|
22
|
+
attached_assets: 'Gekoppelde bestanden'
|
23
|
+
attach_to_page: 'Aan pagina koppelen'
|
24
|
+
audio: 'Geluid'
|
25
|
+
bucket: 'Klembord'
|
26
|
+
bucket_note: 'Het klembord is een tijdelijke plaats voor je bestanden. Je kunt ze van daaruit makkelijk kopieren naar in een pagina of snippet.'
|
27
|
+
caption: 'Onderschrift'
|
28
|
+
choose_upload: 'Kies een bestand om te uploaden'
|
29
|
+
clear_bucket: 'Klembord leeg maken'
|
30
|
+
confirm_remove_asset: 'Ben je zeker dat je dit bestand <strong class="warning">voorgoed wilt verwijderen</strong>?'
|
31
|
+
confirm_remove_from_page: 'Ben je zeker dat je dit bestand van de pagina wilt ontkoppelen?'
|
32
|
+
delete_asset: 'Bestand verwijderen'
|
33
|
+
edit_asset: 'Pas {{asset}} aan'
|
34
|
+
empty_bucket: 'Het klembord is leeg'
|
35
|
+
filename: 'Bestandsnaam'
|
36
|
+
images: 'Afbeeldingen'
|
37
|
+
images_automatically_created: 'afbeeldingen worden automatisch gegenereerd'
|
38
|
+
less: 'Minder'
|
39
|
+
movies: 'Filmpjes'
|
40
|
+
need_to_upload: 'Een bestand uploaden?'
|
41
|
+
new_asset: 'Nieuw Bestand'
|
42
|
+
no_assets_found: 'Er zijn geen bestanden gevonden'
|
43
|
+
no_assets: 'Geen bestanden'
|
44
|
+
no_attached_assets: 'Er zijn geen gekoppelde bestanden.'
|
45
|
+
others: 'Andere'
|
46
|
+
regenerate_all_thumbnails: 'Je kunt hier alle thumbnails voor afbeeldingen opnieuw genereren. Houd er rekening mee dat dit lang kan duren, en aanzienlijke druk veroorzaakt op de server.'
|
47
|
+
regenerate: 'Opnieuw genereren'
|
48
|
+
regenerate_thumbnails: 'Je kunt hier de thumbnails voor afbeeldingen opnieuw genereren. Houd er rekening mee dat dit lang kan duren, en aanzienlijke druk veroorzaakt op de server.'
|
49
|
+
remove_asset: 'Bestand verwijderen'
|
50
|
+
remove_from_page: 'Van pagina ontkoppelen'
|
51
|
+
reorder: 'Herschikken'
|
52
|
+
replace_file: 'Bestand vervangen'
|
53
|
+
save_and_upload: 'Opslaan en uploaden'
|
54
|
+
search_assets: 'Zoeken naar bestanden'
|
55
|
+
search: 'Zoek'
|
56
|
+
show_assets_bucket: 'Toon klembord'
|
57
|
+
title: 'Titel'
|
58
|
+
type: 'Type'
|
59
|
+
types_to_find: 'Te doorzoeken types'
|
60
|
+
upload: 'Uploaden'
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
pl:
|
3
|
+
activerecord:
|
4
|
+
errors:
|
5
|
+
models:
|
6
|
+
asset:
|
7
|
+
attributes:
|
8
|
+
asset:
|
9
|
+
blank: 'Musisz wybrać plik do załadowania!'
|
10
|
+
paperclipped:
|
11
|
+
add_asset_to_bucket: 'Dodaj Zasób do Przybornika'
|
12
|
+
add_to_bucket: 'Dodaj do Przybornika'
|
13
|
+
asset: 'Zasób'
|
14
|
+
asset_edit_title: 'Edytuj Zasób'
|
15
|
+
asset_errors: 'Niestety. {{errors}}'
|
16
|
+
asset_page_attachment_note: 'Załączone zasoby. Mogą być wstawione za pomocą przeciągnięcia i upuszczenia albo wyświetlone z użyciem znacznika <code><r:assets:each /></code>.'
|
17
|
+
asset_note: 'Załączone zasoby. '
|
18
|
+
assets_explanation: 'Zasoby i obrazki mogą być załadowane, a następnie załączone lub wstawione do stron, skrawków i szablonów. Kliknij na nazwę zasobu powyżej aby go edytować lub na <code>Usuń</code> aby go usunąć.'
|
19
|
+
assets_title: 'Zasoby'
|
20
|
+
asset_upload_note: 'Zasoby załadowane tutaj będą automatycznie przypisane do tej strony.'
|
21
|
+
asset_upload_note: 'Wybierz zasób do załadowania. Jeśli pole <code>Tytuł</code> pozostanie puste, nazwa pliku (bez rozszerzenia) zostanie użyta automatycznie. Po kliknięciu na <code>Więcej</code> możesz też dodać podpis.'
|
22
|
+
attached_assets: 'Załączone Zasoby'
|
23
|
+
attach_to_page: 'Załącz do strony'
|
24
|
+
audio: 'Audio'
|
25
|
+
bucket: 'Przybornik'
|
26
|
+
bucket_note: 'Przybornik to tymczasowy pojemnik na Twoje zasoby. Możesz użyć go żeby umieszczać je w swoich stronach albo skrawkach.'
|
27
|
+
caption: 'Podpis'
|
28
|
+
choose_upload: 'Wybierz plik do załadowania'
|
29
|
+
clear_bucket: 'Opróżnij Przybornik'
|
30
|
+
confirm_remove_asset: 'Czy na pewno chcesz <strong class="warning">trwale usunąć</strong> następujący zasób?'
|
31
|
+
confirm_remove_from_page: 'Czy na pewno chcesz usunąć te zasoby ze strony?'
|
32
|
+
delete_asset: 'Usuń Zasób'
|
33
|
+
edit_asset: 'Edytuj {{asset}}'
|
34
|
+
empty_bucket: 'Twój przybornik jest pusty'
|
35
|
+
filename: 'Nazwa pliku'
|
36
|
+
images: 'Obrazki'
|
37
|
+
images_automatically_created: 'images are automatically created'
|
38
|
+
less: 'Mniej'
|
39
|
+
movies: 'Filmy'
|
40
|
+
need_to_upload: 'Need to upload?'
|
41
|
+
new_asset: 'Nowy Zasób'
|
42
|
+
no_assets_found: 'Nie znaleziono zasobów'
|
43
|
+
no_assets: 'Brak zasobów'
|
44
|
+
no_attached_assets: 'brak załączonych zasobów.'
|
45
|
+
others: 'Inne'
|
46
|
+
regenerate_all_thumbnails: 'Tutaj możesz odtworzyć wszystkie miniatury. Weź pod uwagę, że może to chwilę potrwać i zająć zasoby serwera.'
|
47
|
+
regenerate: 'Odtwórz'
|
48
|
+
regenerate_thumbnails: 'Tutaj możesz odtworzyć miniatury zasobów. Weź pod uwagę, że może to chwilę potrwać i zająć zasoby serwera.'
|
49
|
+
remove_asset: 'Usuń Zasób'
|
50
|
+
remove_from_page: 'Usuń ze strony'
|
51
|
+
reorder: 'Zmień kolejność'
|
52
|
+
replace_file: 'Zastąp Plik'
|
53
|
+
save_and_upload: 'Zapisz i Załaduj'
|
54
|
+
search_assets: 'Szukaj Zasobów'
|
55
|
+
search: 'Szukaj'
|
56
|
+
show_assets_bucket: 'Pokaż Przybornik z Zasobami'
|
57
|
+
title: 'Tytuł'
|
58
|
+
type: 'Typ'
|
59
|
+
types_to_find: 'Typy do znalezienia'
|
60
|
+
upload: 'Załaduj'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
|
3
|
+
# Main RESTful routes for Assets
|
4
|
+
map.namespace :admin, :member => { :remove => :get }, :collection => { :refresh => :post } do |admin|
|
5
|
+
admin.resources :assets
|
6
|
+
end
|
7
|
+
|
8
|
+
# Bucket routes
|
9
|
+
map.with_options(:controller => 'admin/assets') do |asset|
|
10
|
+
asset.add_bucket '/admin/assets/:id/add', :action => 'add_bucket'
|
11
|
+
# asset.refresh_assets "/admin/assets/:id/refresh", :action => 'regenerate_thumbnails'
|
12
|
+
|
13
|
+
asset.clear_bucket '/admin/assets/clear_bucket', :action => 'clear_bucket'
|
14
|
+
asset.reorder_assets '/admin/assets/reorder/:id', :action => 'reorder'
|
15
|
+
asset.attach_page_asset '/admin/assets/attach/:asset/page/:page', :action => 'attach_asset'
|
16
|
+
asset.remove_page_asset '/admin/assets/remove/:asset/page/:page', :action => 'remove_asset'
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreatePaperclipAttributes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :assets, :asset_file_name, :string
|
4
|
+
add_column :assets, :asset_content_type, :string
|
5
|
+
add_column :assets, :asset_file_size, :integer
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
remove_column :assets, :asset_file_name
|
10
|
+
remove_column :assets, :asset_content_type
|
11
|
+
remove_column :assets, :asset_file_size
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateUserObserver < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :assets, :created_by, :integer
|
4
|
+
add_column :assets, :updated_by, :integer
|
5
|
+
add_column :assets, :created_at, :datetime
|
6
|
+
add_column :assets, :updated_at, :datetime
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
remove_column :assets, :created_by
|
11
|
+
remove_column :assets, :updated_by
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreatePageAttachments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
# See if a page_attachments table from the original 'page_attachments' extension already exists
|
4
|
+
# If so, rename the table to old_page_attachments so they can be migrated later
|
5
|
+
if self.connection.tables.include?('page_attachments')
|
6
|
+
rename_table :page_attachments, :old_page_attachments
|
7
|
+
end
|
8
|
+
create_table :page_attachments do |t|
|
9
|
+
t.column :asset_id, :integer
|
10
|
+
t.column :page_id, :integer
|
11
|
+
t.column :position, :integer
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :page_attachments
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class RenameUsers < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
rename_column :assets, :created_by, :created_by_id
|
5
|
+
rename_column :assets, :updated_by, :updated_by_id
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
rename_column :assets, :created_by_id, :created_by
|
10
|
+
rename_column :assets, :updated_by_id, :updated_by
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class AddDefaultConfigs < ActiveRecord::Migration
|
2
|
+
|
3
|
+
class Config < ActiveRecord::Base; end
|
4
|
+
|
5
|
+
def self.up
|
6
|
+
Radiant::Config['assets.additional_thumbnails'] = "normal=640x640>"
|
7
|
+
Radiant::Config['assets.display_size'] = "original"
|
8
|
+
puts "-- Setting default display sizes in Radiant::Config"
|
9
|
+
if defined? SettingsExtension && Radiant::Config.column_names.include?('description')
|
10
|
+
Config.find(:all).each do |c|
|
11
|
+
description = case c.key
|
12
|
+
when 'assets.additional_thumbnails'
|
13
|
+
'Defines the default sizes for image assets that are created when an image is uploaded. Use "#" to crop the image to a specific size. "42x42#" would be a square thumbnail, cropped in the center 42 pixels by 42 pixels.'
|
14
|
+
|
15
|
+
when 'assets.display_size'
|
16
|
+
'Sets which of your image sizes is shown is the edit view. Defaults to the "original" image size, but any size may be used. '
|
17
|
+
else
|
18
|
+
c.description
|
19
|
+
end
|
20
|
+
c.update_attribute :description, description
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.down
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class AddDefaultContentTypes < ActiveRecord::Migration
|
2
|
+
|
3
|
+
class Config < ActiveRecord::Base; end
|
4
|
+
|
5
|
+
def self.up
|
6
|
+
Radiant::Config['assets.content_types'] = "image/jpeg, image/pjpeg, image/gif, image/png, image/x-png, image/jpg, video/x-m4v, video/quicktime, application/x-shockwave-flash, audio/mpeg, video/mpeg"
|
7
|
+
Radiant::Config['assets.max_asset_size'] = 5
|
8
|
+
puts "-- Setting default content types in Radiant::Config"
|
9
|
+
if defined? SettingsExtension && Radiant::Config.column_names.include?('description')
|
10
|
+
Config.find(:all).each do |c|
|
11
|
+
description = case c.key
|
12
|
+
when 'assets.content_types'
|
13
|
+
'Defines the content types of that will be allowed to be uploaded as assets.'
|
14
|
+
|
15
|
+
when 'assets.max_asset_size'
|
16
|
+
'The size in megabytes that will be the max size allowed to be uploaded for an asset'
|
17
|
+
else
|
18
|
+
c.description
|
19
|
+
end
|
20
|
+
c.update_attribute :description, description
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.down
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class DisableFileTypes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
Radiant::Config['assets.skip_filetype_validation'] = true
|
4
|
+
puts "-- Setting default content types in Radiant::Config"
|
5
|
+
if defined? SettingsExtension && Radiant::Config.column_names.include?('description')
|
6
|
+
Radiant::Config.find(:all).each do |c|
|
7
|
+
description = case c.key
|
8
|
+
when 'assets.skip_filetype_validations'
|
9
|
+
'When set to true, disables the filetype validations. Set to false to enable them.'
|
10
|
+
else
|
11
|
+
c.description
|
12
|
+
end
|
13
|
+
c.update_attribute :description, description
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module AssetsAdminUI
|
2
|
+
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
|
6
|
+
attr_accessor :asset
|
7
|
+
alias_method :assets, :asset
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def load_default_asset_regions
|
12
|
+
returning OpenStruct.new do |asset|
|
13
|
+
asset.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
14
|
+
edit.main.concat %w{edit_header edit_form assets_container edit_regenerate}
|
15
|
+
edit.form.concat %w{edit_title edit_metadata}
|
16
|
+
# need to DRY this up...
|
17
|
+
edit.bucket_pane.concat %w{bucket_notes bucket bucket_bottom}
|
18
|
+
edit.asset_tabs.concat %w{bucket_tab}
|
19
|
+
end
|
20
|
+
asset.new = asset.edit
|
21
|
+
asset.index = Radiant::AdminUI::RegionSet.new do |index|
|
22
|
+
index.top.concat %w{filters}
|
23
|
+
index.assets_container
|
24
|
+
index.bottom.concat %w{}
|
25
|
+
index.thead.concat %w{thumbnail_header title_header content_type_header modify_header}
|
26
|
+
index.tbody.concat %w{thumbnail_cell title_cell content_type_cell bucket_cell remove_cell}
|
27
|
+
index.bucket_pane.concat %w{bucket_notes bucket bucket_bottom}
|
28
|
+
index.asset_tabs.concat %w{bucket_tab}
|
29
|
+
index.paginate
|
30
|
+
end
|
31
|
+
asset.remove = asset.index
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -0,0 +1,123 @@
|
|
1
|
+
namespace :radiant do
|
2
|
+
namespace :extensions do
|
3
|
+
namespace :paperclipped do
|
4
|
+
|
5
|
+
desc "Runs the migration of the Assets extension"
|
6
|
+
task :migrate => :environment do
|
7
|
+
require 'radiant/extension_migrator'
|
8
|
+
if ENV["VERSION"]
|
9
|
+
PaperclippedExtension.migrator.migrate(ENV["VERSION"].to_i)
|
10
|
+
Rake::Task['db:schema:dump'].invoke
|
11
|
+
else
|
12
|
+
PaperclippedExtension.migrator.migrate
|
13
|
+
Rake::Task['db:schema:dump'].invoke
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Copies public assets of the Assets to the instance public/ directory."
|
18
|
+
task :update => :environment do
|
19
|
+
is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
|
20
|
+
Dir[PaperclippedExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
|
21
|
+
path = file.sub(PaperclippedExtension.root, '')
|
22
|
+
directory = File.dirname(path)
|
23
|
+
puts "Copying #{path}..."
|
24
|
+
mkdir_p RAILS_ROOT + directory, :verbose => false
|
25
|
+
cp file, RAILS_ROOT + path, :verbose => false
|
26
|
+
end
|
27
|
+
|
28
|
+
# unless PaperclippedExtension.starts_with? RAILS_ROOT # don't need to copy vendored tasks
|
29
|
+
# puts "Copying rake tasks from PaperclippedExtension"
|
30
|
+
# local_tasks_path = File.join(RAILS_ROOT, %w(lib tasks))
|
31
|
+
# mkdir_p local_tasks_path, :verbose => false
|
32
|
+
# Dir[File.join PaperclippedExtension.root, %w(lib tasks *.rake)].each do |file|
|
33
|
+
# cp file, local_tasks_path, :verbose => false
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
|
37
|
+
desc "Syncs all available translations for this ext to the English ext master"
|
38
|
+
task :sync => :environment do
|
39
|
+
# The main translation root, basically where English is kept
|
40
|
+
language_root = PaperclippedExtension.get_translation_keys(language_root)
|
41
|
+
|
42
|
+
Dir["#{language_root}/*.yml"].each do |filename|
|
43
|
+
next if filename.match('_available_tags')
|
44
|
+
basename = File.basename(filename, '.yml')
|
45
|
+
puts "Syncing #{basename}"
|
46
|
+
(comments, other) = TranslationSupport.read_file(filename, basename)
|
47
|
+
words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
|
48
|
+
other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
|
49
|
+
TranslationSupport.write_file(filename, basename, comments, other)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "Exports assets from database to assets directory"
|
55
|
+
task :export => :environment do
|
56
|
+
asset_path = File.join(RAILS_ROOT, "assets")
|
57
|
+
mkdir_p asset_path
|
58
|
+
Asset.find(:all).each do |asset|
|
59
|
+
puts "Exporting #{asset.asset_file_name}"
|
60
|
+
cp asset.asset.path, File.join(asset_path, asset.asset_file_name)
|
61
|
+
end
|
62
|
+
puts "Done."
|
63
|
+
end
|
64
|
+
|
65
|
+
desc "Imports assets to database from assets directory"
|
66
|
+
task :import => :environment do
|
67
|
+
asset_path = File.join(RAILS_ROOT, "assets")
|
68
|
+
if File.exist?(asset_path) && File.stat(asset_path).directory?
|
69
|
+
Dir.glob("#{asset_path}/*").each do |file_with_path|
|
70
|
+
if File.stat(file_with_path).file?
|
71
|
+
new_asset = File.new(file_with_path)
|
72
|
+
puts "Creating #{File.basename(file_with_path)}"
|
73
|
+
Asset.create :asset => new_asset
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "Migrates page attachments from the original page attachments extension into new Assets"
|
80
|
+
task :migrate_from_page_attachments => :environment do
|
81
|
+
puts "This task can clean up traces of the page_attachments (think table records and files currently in /public/page_attachments).
|
82
|
+
If you would like to use this mode type \"yes\", type \"no\" or just hit enter to leave them untouched for now."
|
83
|
+
answer = STDIN.gets.chomp
|
84
|
+
erase_tracks = answer.eql?('yes') ? true : false
|
85
|
+
OldPageAttachment.find_all_by_parent_id(nil).each do |opa|
|
86
|
+
asset = opa.create_paperclipped_record
|
87
|
+
# move the actual file
|
88
|
+
old_dir = "#{RAILS_ROOT}/public/page_attachments/0000/#{opa.id.to_s.rjust(4,'0')}"
|
89
|
+
new_dir = "#{RAILS_ROOT}/public/assets/#{asset.id}"
|
90
|
+
puts "Copying #{old_dir.gsub(RAILS_ROOT, '')}/#{opa.filename} to #{new_dir.gsub(RAILS_ROOT, '')}/#{opa.filename}..."
|
91
|
+
mkdir_p new_dir
|
92
|
+
cp old_dir + "/#{opa.filename}", new_dir + "/#{opa.filename}"
|
93
|
+
# remove old record and remainings
|
94
|
+
if erase_tracks
|
95
|
+
rm_rf old_dir
|
96
|
+
end
|
97
|
+
end
|
98
|
+
# regenerate thumbnails
|
99
|
+
@assets = Asset.find(:all)
|
100
|
+
@assets.each do |asset|
|
101
|
+
asset.asset.reprocess!
|
102
|
+
asset.save
|
103
|
+
end
|
104
|
+
puts "Done."
|
105
|
+
end
|
106
|
+
|
107
|
+
desc "Migrates from old 'assets' extension."
|
108
|
+
task :migrate_from_assets => :environment do
|
109
|
+
Asset.delete_all("thumbnail IS NOT NULL OR parent_id IS NOT NULL")
|
110
|
+
ActiveRecord::Base.connection.tap do |c|
|
111
|
+
c.rename_column :assets, :filename, :asset_file_name
|
112
|
+
c.rename_column :assets, :content_type, :asset_content_type
|
113
|
+
c.rename_column :assets, :size, :asset_file_size
|
114
|
+
c.remove_column :assets, :parent_id
|
115
|
+
c.remove_column :assets, :thumbnail
|
116
|
+
end
|
117
|
+
|
118
|
+
PaperclippedExtension.migrator.new(:up, PaperclippedExtension.migrations_path).send(:assume_migrated_upto_version, 3)
|
119
|
+
PaperclippedExtension.migrator.migrate
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|