intesys_asset_manager 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +127 -0
- data/Rakefile +31 -0
- data/app/assets/images/loader.gif +0 -0
- data/app/assets/javascripts/asset_manager.js.coffee +149 -0
- data/app/assets/stylesheets/asset_manager.css.sass +85 -0
- data/app/assets/stylesheets/asset_manager/base/colors.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/base/fonts.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/controllers/asset_categories.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/controllers/assets.css.sass +104 -0
- data/app/assets/stylesheets/asset_manager/controllers/index.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/layout/footer.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/layout/generic.css.sass +17 -0
- data/app/assets/stylesheets/asset_manager/layout/header.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/layout/main.css.sass +26 -0
- data/app/assets/stylesheets/asset_manager/modules/alerts.css.sass +3 -0
- data/app/assets/stylesheets/asset_manager/modules/btn_group.css.sass +3 -0
- data/app/assets/stylesheets/asset_manager/modules/page_header.sass +12 -0
- data/app/assets/stylesheets/asset_manager/modules/quick_upload.css.sass +26 -0
- data/app/assets/stylesheets/asset_manager/modules/translations.css.sass +4 -0
- data/app/assets/stylesheets/asset_manager/plugins/plugins.css.sass +7 -0
- data/app/assets/stylesheets/asset_manager/resources/asset_categories/asset_category.css.sass +0 -0
- data/app/assets/stylesheets/asset_manager/resources/asset_instances/asset_instance.css.sass +4 -0
- data/app/assets/stylesheets/asset_manager/resources/assets/asset.css.sass +35 -0
- data/app/assets/stylesheets/asset_manager/resources/resource/resource.css.sass +0 -0
- data/app/controllers/asset_manager/application_controller.rb +4 -0
- data/app/controllers/asset_manager/asset_categories_controller.rb +56 -0
- data/app/controllers/asset_manager/asset_instances_controller.rb +22 -0
- data/app/controllers/asset_manager/assets_controller.rb +122 -0
- data/app/controllers/asset_manager/index_controller.rb +8 -0
- data/app/helpers/asset_manager/application_helper.rb +9 -0
- data/app/helpers/asset_manager/asset_instances_helper.rb +59 -0
- data/app/helpers/asset_manager/assets_helper.rb +145 -0
- data/app/helpers/asset_manager/links_helper.rb +21 -0
- data/app/inputs/asset_manager_input.rb +27 -0
- data/app/models/asset_manager/asset.rb +99 -0
- data/app/models/asset_manager/asset_association.rb +15 -0
- data/app/models/asset_manager/asset_category.rb +22 -0
- data/app/models/asset_manager/asset_instance.rb +33 -0
- data/app/models/asset_manager/asset_private_instance.rb +6 -0
- data/app/models/asset_manager/asset_public_instance.rb +6 -0
- data/app/uploaders/asset_manager/asset_private_uploader.rb +9 -0
- data/app/uploaders/asset_manager/asset_public_uploader.rb +12 -0
- data/app/uploaders/asset_manager/asset_uploader.rb +36 -0
- data/app/views/admin/asset_manager/assets/_asset.html.haml +7 -0
- data/app/views/admin/asset_manager/assets/_assets.html.haml +2 -0
- data/app/views/asset_manager/asset_categories/_form.html.haml +10 -0
- data/app/views/asset_manager/asset_categories/_translated_fields.html.haml +3 -0
- data/app/views/asset_manager/asset_categories/edit.html.haml +8 -0
- data/app/views/asset_manager/asset_categories/index.html.haml +43 -0
- data/app/views/asset_manager/asset_categories/new.html.haml +4 -0
- data/app/views/asset_manager/asset_categories/show.html.haml +30 -0
- data/app/views/asset_manager/asset_instances/_asset_instance.html.haml +14 -0
- data/app/views/asset_manager/asset_instances/_asset_instance_as_flag.html.haml +3 -0
- data/app/views/asset_manager/asset_instances/_asset_instances.html.haml +5 -0
- data/app/views/asset_manager/asset_instances/_asset_instances_as_flag.html.haml +12 -0
- data/app/views/asset_manager/assets/_asset.html.haml +3 -0
- data/app/views/asset_manager/assets/_asset_draggable.html.haml +8 -0
- data/app/views/asset_manager/assets/_asset_group_by_instance_context.html.haml +7 -0
- data/app/views/asset_manager/assets/_asset_instance_fields.haml +10 -0
- data/app/views/asset_manager/assets/_assets.html.haml +4 -0
- data/app/views/asset_manager/assets/_assets_draggable.html.haml +7 -0
- data/app/views/asset_manager/assets/_form.html.haml +63 -0
- data/app/views/asset_manager/assets/_new_actions.html.haml +8 -0
- data/app/views/asset_manager/assets/_quick_upload.html.haml +20 -0
- data/app/views/asset_manager/assets/_translated_fields.html.haml +4 -0
- data/app/views/asset_manager/assets/edit.html.haml +6 -0
- data/app/views/asset_manager/assets/index.html.haml +68 -0
- data/app/views/asset_manager/assets/new.html.haml +4 -0
- data/app/views/asset_manager/assets/quick_upload.js.erb +7 -0
- data/app/views/asset_manager/assets/select.html.haml +57 -0
- data/app/views/asset_manager/assets/select.js.erb +1 -0
- data/app/views/asset_manager/assets/show.html.haml +51 -0
- data/app/views/asset_manager/index/index.html.haml +6 -0
- data/app/views/asset_manager/partials/_form_errors.html.haml +7 -0
- data/app/views/asset_manager/partials/_locales_tabs.html.haml +4 -0
- data/app/views/asset_manager/partials/_pagination_status.html.haml +2 -0
- data/app/views/layouts/asset_manager/_base.html.haml +6 -0
- data/app/views/layouts/asset_manager/application.html.haml +15 -0
- data/app/views/layouts/asset_manager/partials/_flash_messages.html.haml +4 -0
- data/app/views/layouts/asset_manager/partials/_head.html.haml +11 -0
- data/app/views/layouts/asset_manager/partials/_header.html.haml +15 -0
- data/app/views/layouts/asset_manager/simple.html.haml +4 -0
- data/config/locales/en.yml +179 -0
- data/config/locales/it.yml +181 -0
- data/config/routes.rb +20 -0
- data/db/migrate/20120919130657_asset_manager_init.rb +44 -0
- data/db/migrate/20121005072255_acts_as_taggable_on_migration.rb +30 -0
- data/db/migrate/20121102141009_add_file_type_to_asset.rb +5 -0
- data/db/migrate/20130417082644_asset_manager_add_index_to_foreign_keys.rb +5 -0
- data/db/migrate/20140512090936_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/db/migrate/20140512090937_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/lib/asset_manager.rb +57 -0
- data/lib/asset_manager/all.rb +5 -0
- data/lib/asset_manager/engine.rb +29 -0
- data/lib/asset_manager/extensions/active_record.rb +152 -0
- data/lib/asset_manager/extensions/all.rb +1 -0
- data/lib/assets/images/bootstrap/glyphicons-halflings-white.png +0 -0
- data/lib/assets/images/bootstrap/glyphicons-halflings.png +0 -0
- data/lib/assets/javascripts/bootstrap2/bootstrap.js +2280 -0
- data/lib/assets/stylesheets/bootstrap2/bootstrap-responsive.css +1109 -0
- data/lib/assets/stylesheets/bootstrap2/bootstrap.css.erb +6167 -0
- data/lib/custom_versions.rb +20 -0
- data/lib/deprecated.rb +61 -0
- data/lib/intesys_asset_manager.rb +1 -0
- data/lib/intesys_asset_manager/version.rb +3 -0
- data/lib/tasks/asset_manager_tasks.rake +32 -0
- data/lib/touch_translation.rb +18 -0
- data/lib/translations.rb +19 -0
- data/spec/controllers/asset_manager/asset_categories_controller_spec.rb +164 -0
- data/spec/controllers/asset_manager/assets_controller_spec.rb +164 -0
- data/spec/controllers/asset_manager/index_controller_spec.rb +12 -0
- data/spec/factories/asset_manager_asset_associations.rb +10 -0
- data/spec/factories/asset_manager_asset_categories.rb +7 -0
- data/spec/factories/asset_manager_asset_instances.rb +9 -0
- data/spec/factories/asset_manager_assets.rb +8 -0
- data/spec/helpers/asset_manager/asset_categories_helper_spec.rb +5 -0
- data/spec/helpers/asset_manager/assets_helper_spec.rb +5 -0
- data/spec/helpers/asset_manager/index_helper_spec.rb +5 -0
- data/spec/models/asset_manager/asset_association_spec.rb +5 -0
- data/spec/models/asset_manager/asset_category_spec.rb +5 -0
- data/spec/models/asset_manager/asset_instance_spec.rb +7 -0
- data/spec/models/asset_manager/asset_spec.rb +5 -0
- data/spec/requests/asset_manager/asset_manager_asset_categories_spec.rb +11 -0
- data/spec/requests/asset_manager/asset_manager_assets_spec.rb +11 -0
- data/spec/routing/asset_manager/asset_categories_routing_spec.rb +35 -0
- data/spec/routing/asset_manager/assets_routing_spec.rb +35 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/capybara.rb +8 -0
- data/spec/views/asset_manager/asset_categories/edit.html.haml_spec.rb +15 -0
- data/spec/views/asset_manager/asset_categories/index.html.haml_spec.rb +15 -0
- data/spec/views/asset_manager/asset_categories/new.html.haml_spec.rb +15 -0
- data/spec/views/asset_manager/asset_categories/show.html.haml_spec.rb +12 -0
- data/spec/views/asset_manager/assets/edit.html.haml_spec.rb +20 -0
- data/spec/views/asset_manager/assets/index.html.haml_spec.rb +23 -0
- data/spec/views/asset_manager/assets/new.html.haml_spec.rb +20 -0
- data/spec/views/asset_manager/assets/show.html.haml_spec.rb +17 -0
- data/spec/views/asset_manager/index/index.html.haml_spec.rb +5 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/aac.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/ai.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/aif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/asp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/aspx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/avi.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/bin.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/bmp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/css.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/db.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/default.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/dll.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/dll2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/doc.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/eps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/exe1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/exe2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/fav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericBlue.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericGray.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericOrange.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericRed.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/genericTurquesa.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/gif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/gz.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/help.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/help2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/hqx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/html.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlFirefox.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlIE.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlSafari1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/htmlSafari2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/jpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/js.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mov.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mov2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mp2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mp3.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mp4.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/mpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/pdf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/php.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/pic.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/png.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/pps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/ppt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/psd.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/rar.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/rb.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/rtf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/template.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/tif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/ttf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/txt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/vbs.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/vbs2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/warning.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/wav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/xls.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/xml.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/zip.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/16x16/zip2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/aac.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/ai.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/aif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/asp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/aspx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/avi.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/bin.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/bmp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/css.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/db.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/default.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/dll.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/dll2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/doc.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/eps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/exe1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/exe2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/fav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericBlue.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericGray.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericOrange.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericRed.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/genericTurquesa.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/gif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/gz.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/help.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/help2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/hqx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/html.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlFirefox.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlIE.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlSafari1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/htmlSafari2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/jpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/js.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mov.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mov2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mp2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mp3.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mp4.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/mpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/pdf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/php.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/pic.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/png.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/pps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/ppt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/psd.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/rar.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/rb.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/rtf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/template.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/tif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/ttf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/txt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/vbs.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/vbs2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/warning.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/wav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/xls.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/xml.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/zip.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/20x20/zip2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/aac.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/ai.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/aif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/asp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/aspx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/avi.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/bin.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/bmp.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/css.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/db.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/default.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/dll.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/dll2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/doc.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/eps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/exe1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/exe2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/fav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericBlue.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericGray.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericOrange.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericRed.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/genericTurquesa.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/gif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/gz.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/help.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/help2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/hqx.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/html.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlFirefox.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlIE.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlSafari1.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/htmlSafari2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/jpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/js.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mov.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mov2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mp2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mp3.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mp4.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/mpg.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/pdf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/php.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/pic.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/png.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/pps.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/ppt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/psd.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/rar.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/rb.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/rtf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/tif.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/ttf.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/txt.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/vbs.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/vbs2.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/warning.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/wav.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/xls.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/xml.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/zip.png +0 -0
- data/vendor/assets/images/asset_manager/file_icons/32x32/zip2.png +0 -0
- data/vendor/assets/images/blank.gif +0 -0
- data/vendor/assets/images/clippy.swf +0 -0
- data/vendor/assets/images/fancybox_buttons.png +0 -0
- data/vendor/assets/images/fancybox_loading.gif +0 -0
- data/vendor/assets/images/fancybox_loading@2x.gif +0 -0
- data/vendor/assets/images/fancybox_overlay.png +0 -0
- data/vendor/assets/images/fancybox_sprite.png +0 -0
- data/vendor/assets/images/fancybox_sprite@2x.png +0 -0
- data/vendor/assets/images/ias/loader.gif +0 -0
- data/vendor/assets/javascripts/ias/jquery.ias.js +620 -0
- data/vendor/assets/stylesheets/ias/jquery.ias.css +8 -0
- metadata +748 -0
@@ -0,0 +1,145 @@
|
|
1
|
+
module AssetManager
|
2
|
+
module AssetsHelper
|
3
|
+
include AssetManager::Deprecated::AssetsHelper
|
4
|
+
|
5
|
+
def am_render(resource, field, options = {})
|
6
|
+
send("am_render_#{resource.class.am_field_option(field, :mode)}", resource.send(field), options)
|
7
|
+
end
|
8
|
+
|
9
|
+
def am_render_image(asset, options = {})
|
10
|
+
unless asset.nil?
|
11
|
+
ais = asset.asset_instances rescue nil
|
12
|
+
if ais && ais.count == 1
|
13
|
+
am_asset_instance_image(ais.first, options)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def am_render_images(assets, options = {})
|
19
|
+
unless assets.empty?
|
20
|
+
result = content_tag(:ul) do
|
21
|
+
items = []
|
22
|
+
assets.each do |asset|
|
23
|
+
items.push(
|
24
|
+
content_tag(:li) { am_render_image(asset, options) }
|
25
|
+
)
|
26
|
+
end
|
27
|
+
safe_join items, ''
|
28
|
+
end
|
29
|
+
raw(result)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def am_render_file(asset, options = {})
|
34
|
+
unless asset.nil?
|
35
|
+
options.assert_valid_keys(:ico_size)
|
36
|
+
render(partial: 'asset_manager/assets/asset_group_by_instance_context', locals: { resource: asset, ico_size: options[:ico_size] })
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def am_render_files(assets, options = {})
|
41
|
+
unless assets.empty?
|
42
|
+
options.assert_valid_keys(:ico_size, :categorized)
|
43
|
+
options.reverse_merge!(categorized: false)
|
44
|
+
(options[:categorized] ?
|
45
|
+
am_categorized_assets_group(assets, ico_size: options[:ico_size]) :
|
46
|
+
am_assets_group(assets, ico_size: options[:ico_size])
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Others
|
52
|
+
def am_select_link(resource, field, save = false)
|
53
|
+
href = asset_manager.select_assets_path(owner: resource.class.name, id: resource.id, field: field, save: save)
|
54
|
+
title = "Asset Manager - #{resource.class.name} - #{field}"
|
55
|
+
content_tag(:a, href: href, class: 'asset_manager_iframe', title: title, data: { href: href }) {
|
56
|
+
t('select', scope: [resource.class.i18n_scope, resource.class.name.demodulize.tableize, :show], default: 'Select')
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def am_ico_path(type, options = {})
|
61
|
+
options.assert_valid_keys(:size)
|
62
|
+
options.delete_if { |k, v| v.nil? }.reverse_merge!(size: 16)
|
63
|
+
size = options[:size]
|
64
|
+
file_name = type.to_s + '.png'
|
65
|
+
file_path = ['asset_manager', 'file_icons', (size.to_s + 'x' + size.to_s), file_name].join('/')
|
66
|
+
if Rails.application.assets.find_asset(file_path).nil?
|
67
|
+
file_path.gsub!(file_name, 'default.png')
|
68
|
+
end
|
69
|
+
image_path(file_path)
|
70
|
+
end
|
71
|
+
|
72
|
+
def am_clippy(text, options = {})
|
73
|
+
options.assert_valid_keys(:bg_color)
|
74
|
+
options.reverse_merge!(bg_color: '#FFFFFF')
|
75
|
+
html = <<-EOF
|
76
|
+
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
|
77
|
+
width="110"
|
78
|
+
height="14"
|
79
|
+
id="clippy" >
|
80
|
+
<param name="movie" value="/assets/clippy.swf"/>
|
81
|
+
<param name="allowScriptAccess" value="always" />
|
82
|
+
<param name="quality" value="high" />
|
83
|
+
<param name="scale" value="noscale" />
|
84
|
+
<param NAME="FlashVars" value="text=#{text}">
|
85
|
+
<param name="bgcolor" value="#{options[:bg_color]}">
|
86
|
+
<embed src="/assets/clippy.swf"
|
87
|
+
width="110"
|
88
|
+
height="14"
|
89
|
+
name="clippy"
|
90
|
+
quality="high"
|
91
|
+
allowScriptAccess="always"
|
92
|
+
type="application/x-shockwave-flash"
|
93
|
+
pluginspage="http://www.macromedia.com/go/getflashplayer"
|
94
|
+
FlashVars="text=#{text}"
|
95
|
+
bgcolor="#{options[:bg_color]}"
|
96
|
+
/>
|
97
|
+
</object>
|
98
|
+
EOF
|
99
|
+
end
|
100
|
+
|
101
|
+
def am_asset_url(resource, options = {})
|
102
|
+
ais = resource.asset_instances rescue nil
|
103
|
+
if ais && ais.count == 1
|
104
|
+
am_asset_instance_url(ais.first, options)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def categories_assets(assets)
|
111
|
+
items = {}
|
112
|
+
assets.each do |asset|
|
113
|
+
asset_category = asset.asset_category_id
|
114
|
+
items[asset_category] = [] unless items.include?(asset_category)
|
115
|
+
items[asset_category].push(asset)
|
116
|
+
end
|
117
|
+
items
|
118
|
+
end
|
119
|
+
|
120
|
+
def am_categorized_assets_group(assets, options = {})
|
121
|
+
result = content_tag(:div, class: 'categorized_assets_group') do
|
122
|
+
items = []
|
123
|
+
categories_assets(assets).each do |asset_category_id, assets|
|
124
|
+
items.push(
|
125
|
+
content_tag(:h3) { AssetManager::AssetCategory.find(asset_category_id).title rescue t('.other') } +
|
126
|
+
am_assets_group(assets, options)
|
127
|
+
)
|
128
|
+
end
|
129
|
+
safe_join items, ''
|
130
|
+
end
|
131
|
+
raw(result)
|
132
|
+
end
|
133
|
+
|
134
|
+
def am_assets_group(assets, options = {})
|
135
|
+
options.assert_valid_keys(:ico_size)
|
136
|
+
content_tag(:div, class: 'assets_group') do
|
137
|
+
items = []
|
138
|
+
assets.each do |asset|
|
139
|
+
items.push(am_render_file(asset, options))
|
140
|
+
end
|
141
|
+
safe_join items, ''
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module AssetManager
|
2
|
+
module LinksHelper
|
3
|
+
def show_resource_link(resource)
|
4
|
+
link_to url_for(resource), title: t('show', default: 'Show') do
|
5
|
+
content_tag(:i, class: 'icon-eye-open') { '' }
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def edit_resource_link(resource)
|
10
|
+
link_to url_for(resource) + '/edit', title: t('edit', default: 'Edit') do
|
11
|
+
content_tag(:i, class: 'icon-pencil') { '' }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete_resource_link(resource)
|
16
|
+
link_to url_for(resource), title: t('delete', default: 'Delete'), confirm: t('.delete_confirmation', default: 'Are you sure?'), method: :delete do
|
17
|
+
content_tag(:i, class: 'icon-remove') { '' }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class AssetManagerInput
|
2
|
+
include Formtastic::Inputs::Base
|
3
|
+
|
4
|
+
def to_html
|
5
|
+
no_items_label = I18n.t('not_available', scope: [object.class.i18n_scope, object.class.name.demodulize.tableize, :show], default: 'N/A')
|
6
|
+
|
7
|
+
input_wrapping do
|
8
|
+
result = label_html
|
9
|
+
result << template.content_tag(:div, class: 'asset_manager_container') do
|
10
|
+
template.controller.view_context.am_select_link(object, method) <<
|
11
|
+
template.content_tag(:div, id: "dinamyc_assets_#{method}", no_items_label: no_items_label) do
|
12
|
+
cr = object.send(method)
|
13
|
+
unless cr.blank?
|
14
|
+
if cr.kind_of?(Array)
|
15
|
+
template.controller.view_context.render(partial: '/admin/asset_manager/assets/assets', locals: { collection: cr })
|
16
|
+
else
|
17
|
+
template.controller.view_context.render(partial: '/admin/asset_manager/assets/asset', locals: { resource: cr })
|
18
|
+
end
|
19
|
+
else
|
20
|
+
no_items_label
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
result
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module AssetManager
|
2
|
+
class Asset < ActiveRecord::Base
|
3
|
+
include Translations
|
4
|
+
|
5
|
+
before_validation do
|
6
|
+
if file_type
|
7
|
+
asset_instances.clone.each do |asset_instance|
|
8
|
+
unless asset_instance.file.blank?
|
9
|
+
if asset_instance.file.file.extension.downcase != file_type.downcase
|
10
|
+
errors[:file_type] << "File type deve esserere [#{file_type}]"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
else
|
15
|
+
unless asset_instances.empty?
|
16
|
+
first_type = asset_instances.first.file.file.extension
|
17
|
+
unless asset_instances.select { |ai| ai.file.file.extension.downcase != first_type.downcase }.empty?
|
18
|
+
errors[:file_type] << 'Devono avere tutti stessa estensione'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
before_save do
|
25
|
+
unless asset_instances.empty?
|
26
|
+
self.file_type = asset_instances.first.file.file.extension.downcase
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
attr_accessible :title, :description, :asset_category_id, :public, :tag_list, :asset_public_instances_attributes,
|
31
|
+
:asset_private_instances_attributes, :translations_attributes, :file_type
|
32
|
+
|
33
|
+
translates :title, :description, fallbacks_for_empty_translations: true
|
34
|
+
include TouchTranslation
|
35
|
+
|
36
|
+
acts_as_taggable_on :tags
|
37
|
+
|
38
|
+
has_many :asset_associations, class_name: 'AssetManager::AssetAssociation', foreign_key: 'asset_id', dependent: :destroy
|
39
|
+
has_many :asset_public_instances, class_name: 'AssetManager::AssetPublicInstance', foreign_key: 'asset_id', dependent: :destroy, inverse_of: :asset
|
40
|
+
has_many :asset_private_instances, class_name: 'AssetManager::AssetPrivateInstance', foreign_key: 'asset_id', dependent: :destroy, inverse_of: :asset
|
41
|
+
|
42
|
+
belongs_to :asset_category, class_name: 'AssetManager::AssetCategory'
|
43
|
+
|
44
|
+
accepts_nested_attributes_for :translations, reject_if: lambda { |t| t[:title].blank? && t[:description].blank? }
|
45
|
+
accepts_nested_attributes_for :asset_public_instances, reject_if: lambda { |t| t[:file].blank? }, allow_destroy: true
|
46
|
+
accepts_nested_attributes_for :asset_private_instances, reject_if: lambda { |t| t[:file].blank? }, allow_destroy: true
|
47
|
+
|
48
|
+
validates :title, presence: true
|
49
|
+
|
50
|
+
scope :not_ids, lambda { |ids| { conditions: ['asset_manager_assets.id not in (?)', ids] } unless ids.empty? }
|
51
|
+
scope :by_category_id, lambda { |id| where(asset_category_id: id) unless id.blank? }
|
52
|
+
scope :by_instance_context, lambda { |ic| includes(:asset_instances).where("instance_context = #{ic}") unless ic.nil? }
|
53
|
+
|
54
|
+
def self.public(public)
|
55
|
+
case public
|
56
|
+
when :public
|
57
|
+
where(public: true)
|
58
|
+
when :private
|
59
|
+
where(public: false)
|
60
|
+
else
|
61
|
+
where('1=1')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.accepted(file_type)
|
66
|
+
if file_type
|
67
|
+
file_type = [file_type] unless file_type.kind_of?(Array)
|
68
|
+
where('file_type in (?)', file_type)
|
69
|
+
else
|
70
|
+
where('1=1')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.find_ordered(ids)
|
75
|
+
collection = Asset.find(ids)
|
76
|
+
ids.map { |id| collection.find { |resource| resource.id == id.to_i } }
|
77
|
+
end
|
78
|
+
|
79
|
+
def alt
|
80
|
+
description
|
81
|
+
end
|
82
|
+
|
83
|
+
def is_image?
|
84
|
+
%w(jpg png jpeg gif).include?(file_type)
|
85
|
+
end
|
86
|
+
|
87
|
+
def is_pdf?
|
88
|
+
file_type == 'pdf'
|
89
|
+
end
|
90
|
+
|
91
|
+
def has_this_instance_context?(ic)
|
92
|
+
asset_instances.any? { |ai| ai.instance_context.to_sym == ic }
|
93
|
+
end
|
94
|
+
|
95
|
+
def asset_instances
|
96
|
+
public ? asset_public_instances : asset_private_instances
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module AssetManager
|
2
|
+
class AssetAssociation < ActiveRecord::Base
|
3
|
+
attr_accessible :context, :owner_id, :owner_type, :asset_id, :position
|
4
|
+
|
5
|
+
belongs_to :asset, class_name: 'AssetManager::Asset'
|
6
|
+
belongs_to :owner, polymorphic: true
|
7
|
+
|
8
|
+
validates :asset_id, presence: true
|
9
|
+
validates :owner_id, presence: true
|
10
|
+
validates :owner_type, presence: true
|
11
|
+
validates :context, presence: true
|
12
|
+
|
13
|
+
default_scope order: 'position'
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module AssetManager
|
2
|
+
class AssetCategory < ActiveRecord::Base
|
3
|
+
include Translations
|
4
|
+
|
5
|
+
before_save do
|
6
|
+
translations.clone.each do |translation|
|
7
|
+
translations.destroy(translation) if translation.title.blank?
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_accessible :title, :translations_attributes
|
12
|
+
|
13
|
+
translates :title, fallbacks_for_empty_translations: true
|
14
|
+
include TouchTranslation
|
15
|
+
|
16
|
+
accepts_nested_attributes_for :translations
|
17
|
+
|
18
|
+
validates :title, presence: true
|
19
|
+
|
20
|
+
scope :sorted, -> { with_translations.order(:title) }
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module AssetManager
|
2
|
+
class AssetInstance < ActiveRecord::Base
|
3
|
+
attr_accessible :file, :instance_context, :asset_id
|
4
|
+
|
5
|
+
# validates :asset_id, presence: true
|
6
|
+
validates :instance_context, presence: true
|
7
|
+
validates :file, presence: true
|
8
|
+
validates_uniqueness_of :asset_id, scope: [:instance_context]
|
9
|
+
|
10
|
+
after_destroy do
|
11
|
+
if asset.asset_instances.empty?
|
12
|
+
asset.file_type = nil
|
13
|
+
asset.save
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def is_all?
|
18
|
+
instance_context.to_sym == self.class.instance_context_all.to_sym
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.instance_contexts
|
22
|
+
[:it, :en]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.instance_context_all
|
26
|
+
:all
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.instance_contexts_with_all
|
30
|
+
[instance_context_all] | instance_contexts
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module AssetManager
|
4
|
+
class AssetUploader < CarrierWave::Uploader::Base
|
5
|
+
include CarrierWave::MiniMagick
|
6
|
+
include CarrierWave::MimeTypes
|
7
|
+
|
8
|
+
storage :file
|
9
|
+
|
10
|
+
process :set_content_type
|
11
|
+
|
12
|
+
def store_dir
|
13
|
+
Rails.root.to_s + "/private/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def cache_dir
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def image?(picture)
|
23
|
+
%w(.jpg .png .jpeg .gif).include?(File.extname(picture.file).downcase)
|
24
|
+
end
|
25
|
+
|
26
|
+
def pdf?(picture)
|
27
|
+
File.extname(picture.file).downcase == '.pdf'
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def end_path
|
33
|
+
"#{mounted_as}/#{model.id % 1000}/#{model.id}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|