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,20 @@
|
|
1
|
+
module AssetManager
|
2
|
+
module CustomVersions
|
3
|
+
# http://carrierwave.rubyforge.org/rdoc/classes/CarrierWave/RMagick.html
|
4
|
+
def custom_versions
|
5
|
+
version :thumb, if: :image? do
|
6
|
+
process resize_and_pad: [50, 50]
|
7
|
+
end
|
8
|
+
version :show, if: :image? do
|
9
|
+
process resize_and_pad: [300, 300]
|
10
|
+
end
|
11
|
+
version :thumb_pdf, if: :pdf? do
|
12
|
+
process convert: :jpg
|
13
|
+
process resize_to_fill: [230, 326]
|
14
|
+
def full_filename(for_file = model.source.file)
|
15
|
+
super.chomp(File.extname(super)) + '.jpg'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/deprecated.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module AssetManager
|
2
|
+
module Deprecated
|
3
|
+
module AssetsHelper
|
4
|
+
def asset_manager_select_link(resource, field, save = false)
|
5
|
+
ActiveSupport::Deprecation.warn('asset_manager_select_link will be deprecated; use am_select_link')
|
6
|
+
am_select_link(resource, field, save)
|
7
|
+
end
|
8
|
+
|
9
|
+
def am_icon_url(type, size = 16, frontend = true)
|
10
|
+
ActiveSupport::Deprecation.warn('am_icon_url will be deprecated; use am_ico_path')
|
11
|
+
am_ico_path(type, size: size)
|
12
|
+
end
|
13
|
+
|
14
|
+
def render_attachments(assets, title = t('.downloads', default: 'Downloads'), size = nil, categorized = true)
|
15
|
+
ActiveSupport::Deprecation.warn('render_attachments will be deprecated; use am_render')
|
16
|
+
end
|
17
|
+
|
18
|
+
def categorized_asset_group(assets, size = nil)
|
19
|
+
ActiveSupport::Deprecation.warn('categorized_asset_group will be deprecated; use am_render')
|
20
|
+
end
|
21
|
+
|
22
|
+
def asset_group(assets, size = nil)
|
23
|
+
ActiveSupport::Deprecation.warn('asset_group will be deprecated; use am_render')
|
24
|
+
end
|
25
|
+
|
26
|
+
def assets(collection, version = nil, options = {}, container_class = '', linked = false)
|
27
|
+
ActiveSupport::Deprecation.warn('assets will be deprecated; use am_render')
|
28
|
+
end
|
29
|
+
|
30
|
+
def asset(resource, version = nil, options = {}, container_asset_class = '', linked = false)
|
31
|
+
ActiveSupport::Deprecation.warn('asset will be deprecated; use am_render')
|
32
|
+
end
|
33
|
+
|
34
|
+
def clippy(text, bgcolor = '#FFFFFF')
|
35
|
+
ActiveSupport::Deprecation.warn('clippy will be deprecated; use am_clippy')
|
36
|
+
am_clippy(text, bg_color: bgcolor)
|
37
|
+
end
|
38
|
+
|
39
|
+
def asset_url(resource, version = nil)
|
40
|
+
ActiveSupport::Deprecation.warn('asset_url will be deprecated; use am_asset_url')
|
41
|
+
am_asset_url(resource, version: version)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
module AssetInstancesHelper
|
46
|
+
def asset_instance(resource, version = nil, options = {}, linked = false)
|
47
|
+
ActiveSupport::Deprecation.warn('asset_instance will be deprecated')
|
48
|
+
end
|
49
|
+
|
50
|
+
def asset_instance_url(resource, options = {})
|
51
|
+
ActiveSupport::Deprecation.warn('asset_instance_url will be deprecated; use am_asset_instance_url')
|
52
|
+
am_asset_instance_url(resource, options)
|
53
|
+
end
|
54
|
+
|
55
|
+
def display_instance_context(resource)
|
56
|
+
ActiveSupport::Deprecation.warn('display_instance_context will be deprecated; use am_display_instance_context')
|
57
|
+
am_display_instance_context(resource)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'asset_manager'
|
@@ -0,0 +1,32 @@
|
|
1
|
+
namespace :asset_manager do
|
2
|
+
|
3
|
+
desc 'Recreate versions'
|
4
|
+
task :recreate_versions => :environment do |t|
|
5
|
+
recreate_versions
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def recreate_versions
|
13
|
+
# Public
|
14
|
+
assets = AssetManager::Asset.where(public: true)
|
15
|
+
count = assets.count
|
16
|
+
assets.each_with_index do |a, i|
|
17
|
+
puts "PUBLIC File #{i+1} of #{count}\n"
|
18
|
+
a.asset_public_instances.each do |ai|
|
19
|
+
ai.file.recreate_versions! rescue nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Private
|
24
|
+
assets = AssetManager::Asset.where(public: false)
|
25
|
+
count = assets.count
|
26
|
+
assets.each_with_index do |a, i|
|
27
|
+
puts "PRIVATE File #{i+1} of #{count}\n"
|
28
|
+
a.asset_private_instances.each do |ai|
|
29
|
+
ai.file.recreate_versions! rescue nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module AssetManager
|
2
|
+
module TouchTranslation
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
method_name = 'touch_after_save_or_destroy_for_globalized_model'
|
6
|
+
self::Translation.class_eval do
|
7
|
+
redefine_method(method_name) do
|
8
|
+
record = send(:globalized_model)
|
9
|
+
record.touch unless record.nil?
|
10
|
+
end
|
11
|
+
after_save(method_name)
|
12
|
+
after_touch(method_name)
|
13
|
+
after_destroy(method_name)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/translations.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module AssetManager
|
2
|
+
module Translations
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
scope :sorted_by_translated, lambda { |field|
|
6
|
+
with_translations(Globalize.fallbacks).order(translations_table_name + '.' + field.to_s)
|
7
|
+
}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def translations_for_locales(locales)
|
12
|
+
translations_for = []
|
13
|
+
locales.map do |locale|
|
14
|
+
translations_for << translation_for(locale)
|
15
|
+
end
|
16
|
+
translations_for
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
6
|
+
#
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
9
|
+
# controller code, this generated spec may or may not pass.
|
10
|
+
#
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
14
|
+
#
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
19
|
+
# that an instance is receiving a specific message.
|
20
|
+
|
21
|
+
describe AssetManager::AssetCategoriesController do
|
22
|
+
|
23
|
+
# This should return the minimal set of attributes required to create a valid
|
24
|
+
# AssetCategory. As you add validations to AssetCategory, be sure to
|
25
|
+
# update the return value of this method accordingly.
|
26
|
+
def valid_attributes
|
27
|
+
{}
|
28
|
+
end
|
29
|
+
|
30
|
+
# This should return the minimal set of values that should be in the session
|
31
|
+
# in order to pass any filters (e.g. authentication) defined in
|
32
|
+
# AssetCategoriesController. Be sure to keep this updated too.
|
33
|
+
def valid_session
|
34
|
+
{}
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'GET index' do
|
38
|
+
it 'assigns all asset_categories as @asset_categories' do
|
39
|
+
asset_category = AssetCategory.create! valid_attributes
|
40
|
+
get :index, {}, valid_session
|
41
|
+
assigns(:asset_categories).should eq([asset_category])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'GET show' do
|
46
|
+
it 'assigns the requested asset_category as @asset_category' do
|
47
|
+
asset_category = AssetCategory.create! valid_attributes
|
48
|
+
get :show, { id: asset_category.to_param }, valid_session
|
49
|
+
assigns(:asset_category).should eq(asset_category)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'GET new' do
|
54
|
+
it 'assigns a new asset_category as @asset_category' do
|
55
|
+
get :new, {}, valid_session
|
56
|
+
assigns(:asset_category).should be_a_new(AssetCategory)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'GET edit' do
|
61
|
+
it 'assigns the requested asset_category as @asset_category' do
|
62
|
+
asset_category = AssetCategory.create! valid_attributes
|
63
|
+
get :edit, { id: asset_category.to_param }, valid_session
|
64
|
+
assigns(:asset_category).should eq(asset_category)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'POST create' do
|
69
|
+
describe 'with valid params' do
|
70
|
+
it 'creates a new AssetCategory' do
|
71
|
+
expect do
|
72
|
+
post :create, { asset_category: valid_attributes }, valid_session
|
73
|
+
end.to change(AssetCategory, :count).by(1)
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'assigns a newly created asset_category as @asset_category' do
|
77
|
+
post :create, { asset_category: valid_attributes }, valid_session
|
78
|
+
assigns(:asset_category).should be_a(AssetCategory)
|
79
|
+
assigns(:asset_category).should be_persisted
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'redirects to the created asset_category' do
|
83
|
+
post :create, { asset_category: valid_attributes }, valid_session
|
84
|
+
response.should redirect_to(AssetCategory.last)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe 'with invalid params' do
|
89
|
+
it 'assigns a newly created but unsaved asset_category as @asset_category' do
|
90
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
91
|
+
AssetCategory.any_instance.stub(:save).and_return(false)
|
92
|
+
post :create, { asset_category: {} }, valid_session
|
93
|
+
assigns(:asset_category).should be_a_new(AssetCategory)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "re-renders the 'new' template" do
|
97
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
98
|
+
AssetCategory.any_instance.stub(:save).and_return(false)
|
99
|
+
post :create, { asset_category: {} }, valid_session
|
100
|
+
response.should render_template('new')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe 'PUT update' do
|
106
|
+
describe 'with valid params' do
|
107
|
+
it 'updates the requested asset_category' do
|
108
|
+
asset_category = AssetCategory.create! valid_attributes
|
109
|
+
# Assuming there are no other asset_categories in the database, this
|
110
|
+
# specifies that the AssetCategory created on the previous line
|
111
|
+
# receives the :update_attributes message with whatever params are
|
112
|
+
# submitted in the request.
|
113
|
+
AssetCategory.any_instance.should_receive(:update_attributes).with('these' => 'params')
|
114
|
+
put :update, { id: asset_category.to_param, asset_category: { 'these' => 'params' } }, valid_session
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'assigns the requested asset_category as @asset_category' do
|
118
|
+
asset_category = AssetCategory.create! valid_attributes
|
119
|
+
put :update, { id: asset_category.to_param, asset_category: valid_attributes }, valid_session
|
120
|
+
assigns(:asset_category).should eq(asset_category)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'redirects to the asset_category' do
|
124
|
+
asset_category = AssetCategory.create! valid_attributes
|
125
|
+
put :update, { id: asset_category.to_param, asset_category: valid_attributes }, valid_session
|
126
|
+
response.should redirect_to(asset_category)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe 'with invalid params' do
|
131
|
+
it 'assigns the asset_category as @asset_category' do
|
132
|
+
asset_category = AssetCategory.create! valid_attributes
|
133
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
134
|
+
AssetCategory.any_instance.stub(:save).and_return(false)
|
135
|
+
put :update, { id: asset_category.to_param, asset_category: {} }, valid_session
|
136
|
+
assigns(:asset_category).should eq(asset_category)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "re-renders the 'edit' template" do
|
140
|
+
asset_category = AssetCategory.create! valid_attributes
|
141
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
142
|
+
AssetCategory.any_instance.stub(:save).and_return(false)
|
143
|
+
put :update, { id: asset_category.to_param, asset_category: {} }, valid_session
|
144
|
+
response.should render_template('edit')
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe 'DELETE destroy' do
|
150
|
+
it 'destroys the requested asset_category' do
|
151
|
+
asset_category = AssetCategory.create! valid_attributes
|
152
|
+
expect {
|
153
|
+
delete :destroy, { id: asset_category.to_param }, valid_session
|
154
|
+
}.to change(AssetCategory, :count).by(-1)
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'redirects to the asset_categories list' do
|
158
|
+
asset_category = AssetCategory.create! valid_attributes
|
159
|
+
delete :destroy, { id: asset_category.to_param }, valid_session
|
160
|
+
response.should redirect_to(asset_categories_url)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
4
|
+
# It demonstrates how one might use RSpec to specify the controller code that
|
5
|
+
# was generated by Rails when you ran the scaffold generator.
|
6
|
+
#
|
7
|
+
# It assumes that the implementation code is generated by the rails scaffold
|
8
|
+
# generator. If you are using any extension libraries to generate different
|
9
|
+
# controller code, this generated spec may or may not pass.
|
10
|
+
#
|
11
|
+
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
12
|
+
# of tools you can use to make these specs even more expressive, but we're
|
13
|
+
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
14
|
+
#
|
15
|
+
# Compared to earlier versions of this generator, there is very limited use of
|
16
|
+
# stubs and message expectations in this spec. Stubs are only used when there
|
17
|
+
# is no simpler way to get a handle on the object needed for the example.
|
18
|
+
# Message expectations are only used when there is no simpler way to specify
|
19
|
+
# that an instance is receiving a specific message.
|
20
|
+
|
21
|
+
describe AssetManager::AssetsController do
|
22
|
+
|
23
|
+
# This should return the minimal set of attributes required to create a valid
|
24
|
+
# Asset. As you add validations to Asset, be sure to
|
25
|
+
# update the return value of this method accordingly.
|
26
|
+
def valid_attributes
|
27
|
+
{}
|
28
|
+
end
|
29
|
+
|
30
|
+
# This should return the minimal set of values that should be in the session
|
31
|
+
# in order to pass any filters (e.g. authentication) defined in
|
32
|
+
# AssetsController. Be sure to keep this updated too.
|
33
|
+
def valid_session
|
34
|
+
{}
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'GET index' do
|
38
|
+
it 'assigns all assets as @assets' do
|
39
|
+
asset = Asset.create! valid_attributes
|
40
|
+
get :index, {}, valid_session
|
41
|
+
assigns(:assets).should eq([asset])
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'GET show' do
|
46
|
+
it 'assigns the requested asset as @asset' do
|
47
|
+
asset = Asset.create! valid_attributes
|
48
|
+
get :show, { id: asset.to_param }, valid_session
|
49
|
+
assigns(:asset).should eq(asset)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'GET new' do
|
54
|
+
it 'assigns a new asset as @asset' do
|
55
|
+
get :new, {}, valid_session
|
56
|
+
assigns(:asset).should be_a_new(Asset)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'GET edit' do
|
61
|
+
it 'assigns the requested asset as @asset' do
|
62
|
+
asset = Asset.create! valid_attributes
|
63
|
+
get :edit, { id: asset.to_param }, valid_session
|
64
|
+
assigns(:asset).should eq(asset)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'POST create' do
|
69
|
+
describe 'with valid params' do
|
70
|
+
it 'creates a new Asset' do
|
71
|
+
expect do
|
72
|
+
post :create, { asset: valid_attributes }, valid_session
|
73
|
+
end.to change(Asset, :count).by(1)
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'assigns a newly created asset as @asset' do
|
77
|
+
post :create, { asset: valid_attributes }, valid_session
|
78
|
+
assigns(:asset).should be_a(Asset)
|
79
|
+
assigns(:asset).should be_persisted
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'redirects to the created asset' do
|
83
|
+
post :create, { asset: valid_attributes }, valid_session
|
84
|
+
response.should redirect_to(Asset.last)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe 'with invalid params' do
|
89
|
+
it 'assigns a newly created but unsaved asset as @asset' do
|
90
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
91
|
+
Asset.any_instance.stub(:save).and_return(false)
|
92
|
+
post :create, { asset: {} }, valid_session
|
93
|
+
assigns(:asset).should be_a_new(Asset)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "re-renders the 'new' template" do
|
97
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
98
|
+
Asset.any_instance.stub(:save).and_return(false)
|
99
|
+
post :create, { asset: {} }, valid_session
|
100
|
+
response.should render_template('new')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe 'PUT update' do
|
106
|
+
describe 'with valid params' do
|
107
|
+
it 'updates the requested asset' do
|
108
|
+
asset = Asset.create! valid_attributes
|
109
|
+
# Assuming there are no other assets in the database, this
|
110
|
+
# specifies that the Asset created on the previous line
|
111
|
+
# receives the :update_attributes message with whatever params are
|
112
|
+
# submitted in the request.
|
113
|
+
Asset.any_instance.should_receive(:update_attributes).with('these' => 'params')
|
114
|
+
put :update, { id: asset.to_param, asset: { 'these' => 'params' } }, valid_session
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'assigns the requested asset as @asset' do
|
118
|
+
asset = Asset.create! valid_attributes
|
119
|
+
put :update, { id: asset.to_param, asset: valid_attributes }, valid_session
|
120
|
+
assigns(:asset).should eq(asset)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'redirects to the asset' do
|
124
|
+
asset = Asset.create! valid_attributes
|
125
|
+
put :update, { id: asset.to_param, asset: valid_attributes }, valid_session
|
126
|
+
response.should redirect_to(asset)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe 'with invalid params' do
|
131
|
+
it 'assigns the asset as @asset' do
|
132
|
+
asset = Asset.create! valid_attributes
|
133
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
134
|
+
Asset.any_instance.stub(:save).and_return(false)
|
135
|
+
put :update, { id: asset.to_param, asset: {} }, valid_session
|
136
|
+
assigns(:asset).should eq(asset)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "re-renders the 'edit' template" do
|
140
|
+
asset = Asset.create! valid_attributes
|
141
|
+
# Trigger the behavior that occurs when invalid params are submitted
|
142
|
+
Asset.any_instance.stub(:save).and_return(false)
|
143
|
+
put :update, { id: asset.to_param, asset: {} }, valid_session
|
144
|
+
response.should render_template('edit')
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe 'DELETE destroy' do
|
150
|
+
it 'destroys the requested asset' do
|
151
|
+
asset = Asset.create! valid_attributes
|
152
|
+
expect {
|
153
|
+
delete :destroy, { id: asset.to_param }, valid_session
|
154
|
+
}.to change(Asset, :count).by(-1)
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'redirects to the assets list' do
|
158
|
+
asset = Asset.create! valid_attributes
|
159
|
+
delete :destroy, { id: asset.to_param }, valid_session
|
160
|
+
response.should redirect_to(assets_url)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|