polygallery 0.1.9 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/polygallery/acts_as_polyphoto.rb +37 -16
- data/app/models/polygallery/gallery.rb +0 -36
- data/app/models/polygallery/photo.rb +1 -0
- data/db/migrate/20150701180557_create_polygalleries_if_necessary.rb +30 -0
- data/db/migrate/20150701180956_add_associations_to_polygallery_photos.rb +24 -0
- data/lib/generators/polygallery/install/install_generator.rb +13 -1
- data/lib/generators/polygallery/install/templates/add_gallery_title.rb +9 -0
- data/lib/generators/polygallery/install/templates/polygallery_migration.rb +1 -1
- data/lib/polygallery/engine.rb +7 -0
- data/lib/polygallery/has_polygallery.rb +9 -15
- data/lib/polygallery/has_polyphotos.rb +29 -25
- data/lib/polygallery/version.rb +1 -1
- data/test/dummy/app/models/event.rb +11 -2
- data/test/dummy/db/schema.rb +4 -1
- data/test/dummy/log/development.log +78 -0
- data/test/dummy/log/test.log +10375 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/001/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/001/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/001/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/002/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/002/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/002/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/003/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/003/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/003/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/004/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/custom/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/medium/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/original/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/thumb/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/005/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/006/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/006/medium/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/006/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/006/original/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/006/thumb/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/006/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/007/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/007/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/007/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/007/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/007/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/007/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/008/custom/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/008/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/008/medium/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/008/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/008/original/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/008/thumb/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/008/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/medium/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/original/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/test/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/thumb/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/009/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/010/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/010/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/010/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/010/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/custom/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/test/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/011/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/012/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/012/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/012/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/012/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/013/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/013/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/013/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/013/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/013/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/013/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/013/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/014/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/014/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/014/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/custom/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/test/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/015/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/016/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/016/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/016/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/016/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/016/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/016/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/016/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/017/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/017/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/017/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/017/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/custom/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/018/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/019/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/019/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/019/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/019/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/custom/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/020/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/021/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/021/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/021/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/021/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/022/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/022/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/022/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/022/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/022/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/022/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/022/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/custom/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/medium/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/original/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/thumb/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/023/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/024/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/024/medium/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/024/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/024/original/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/024/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/024/thumb/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/024/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/025/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/025/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/025/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/025/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/025/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/025/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/025/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/custom/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/medium/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/original/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/thumb/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/026/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/027/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/027/medium/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/027/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/027/original/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/027/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/027/thumb/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/027/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/028/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/028/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/028/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/028/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/028/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/028/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/028/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/029/custom/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/029/medium/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/029/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/029/original/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/029/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/029/thumb/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/029/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/030/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/030/medium/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/030/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/030/original/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/030/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/030/thumb/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/030/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/031/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/031/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/031/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/031/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/031/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/031/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/031/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/custom/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/medium/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/original/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/thumb/cat2.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/032/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/033/medium/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/033/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/033/original/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/033/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/033/thumb/cat3.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/033/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/034/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/034/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/034/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/034/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/035/custom/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/035/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/035/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/035/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/035/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/035/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/035/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/036/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/036/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/036/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/036/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/037/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/037/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/037/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/038/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/038/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/038/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/038/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/039/custom/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/039/medium/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/039/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/039/original/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/039/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/039/thumb/cat1.jpg +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/039/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/040/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/040/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/040/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/040/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/041/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/041/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/041/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/042/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/042/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/042/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/042/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/044/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/044/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/044/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/044/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/045/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/045/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/045/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/046/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/046/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/046/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/046/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/047/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/047/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/047/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/048/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/048/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/048/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/048/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/049/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/049/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/049/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/050/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/050/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/050/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/050/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/051/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/051/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/051/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/052/custom/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/052/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/052/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/052/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/053/medium/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/053/original/logo_placeholder_medium.png +0 -0
- data/test/dummy/public/system/polygallery/photos/photos/000/000/053/thumb/logo_placeholder_medium.png +0 -0
- data/test/dummy/spec/features/events_spec.rb +1 -1
- data/test/dummy/spec/models/events_spec.rb +98 -0
- data/test/dummy/spec/upload_files/cat1.jpg +0 -0
- data/test/dummy/spec/upload_files/cat2.jpg +0 -0
- data/test/dummy/spec/upload_files/cat3.jpg +0 -0
- data/test/dummy/spec/upload_files/cat4.jpg +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1dd8a1ad1294beb4de74919655bff9a6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/60be7d49344e422d2fd9b6f9471598c3 +0 -0
- metadata +533 -5
- data/db/migrate/20140803171516_create_polygallery_galleries.rb +0 -12
- data/db/migrate/20140803171534_create_polygallery_photos.rb +0 -12
- data/db/migrate/20141001192141_add_sti_to_galleries_and_photos.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4c91e60af4f41c8aaa0976ae64ec0f5efa6e17d
|
4
|
+
data.tar.gz: 07821da031205f67c63918a383c16f418062055a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9460848c90ebe20ba08478f4a91968f22ed8258497179a88f97a388faac6c20ed256d6afb53b73e2494b024a64674a97c256501b0877dc61f808965bea68870b
|
7
|
+
data.tar.gz: b0db985ec4ef235896cebda1165d6671af5e8cda43d1875cd05f1547ef655b2d1bfd53c64d60f9059e72089c250d50e5569cfeb75bf7ad89fcd3d65c85319ead
|
@@ -3,20 +3,20 @@ module Polygallery
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
attr_accessor :photo_to_upload, :polygallery_options,
|
7
|
-
:galleryable_id, :galleryable_type, :gallery_title
|
8
|
-
acts_as_polyphoto
|
9
6
|
end
|
10
7
|
|
11
8
|
module ClassMethods
|
12
9
|
def acts_as_polyphoto(options={})
|
13
10
|
defaults = self.polygallery_settings
|
14
11
|
settings = defaults.deep_merge(options)
|
12
|
+
|
13
|
+
attr_accessor :photo_to_upload, :polygallery_options
|
15
14
|
|
16
15
|
init_attachment settings[:paperclip]
|
16
|
+
init_associations settings
|
17
17
|
|
18
18
|
after_initialize do
|
19
|
-
|
19
|
+
self.polygallery_options ||= self.polygallery_settings
|
20
20
|
self.initialize_polyphoto
|
21
21
|
end
|
22
22
|
|
@@ -24,40 +24,61 @@ module Polygallery
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def polygallery_settings
|
27
|
-
|
27
|
+
HasPolygallery::DEFAULTS
|
28
28
|
end
|
29
29
|
|
30
30
|
def init_attachment(paperclip_settings)
|
31
31
|
has_attached_file :photo,
|
32
|
-
|
33
|
-
|
32
|
+
:styles => ->(a) { a.instance.paperclip_settings[:styles] },
|
33
|
+
:default_url => paperclip_settings[:default_url]
|
34
34
|
validations = polygallery_settings[:paperclip_validations]
|
35
35
|
validates_attachment_content_type(:photo, :content_type =>
|
36
36
|
validations[:content_type]) if validations[:content_type]
|
37
37
|
validates_attachment_presence(:photo) if validations[:presence]
|
38
|
+
|
39
|
+
before_validation :process_photo_to_upload
|
40
|
+
end
|
41
|
+
|
42
|
+
def init_associations(settings=HasPolygallery::DEFAULTS)
|
43
|
+
belongs_to settings[:association_names][:gallery],
|
44
|
+
:class_name => settings[:associations][:gallery][:class_name],
|
45
|
+
:foreign_key => :gallery_id
|
46
|
+
belongs_to :galleryable, :polymorphic => true
|
38
47
|
end
|
39
48
|
|
40
49
|
end
|
41
50
|
|
42
51
|
module LocalInstanceMethods
|
43
52
|
def include_polygallery_settings(settings)
|
44
|
-
|
53
|
+
self.polygallery_options = settings
|
45
54
|
self.initialize_polyphoto
|
46
55
|
end
|
47
56
|
|
48
57
|
def initialize_polyphoto
|
49
|
-
|
50
|
-
|
51
|
-
self.class.belongs_to settings[:association_names][:gallery],
|
52
|
-
:class_name => settings[:associations][:gallery][:class_name],
|
53
|
-
:foreign_key => :gallery_id
|
54
|
-
|
58
|
+
self.class.init_associations(self.polygallery_settings)
|
55
59
|
self.init_attachment
|
56
|
-
self.class.before_save :process_photo_to_upload
|
57
60
|
end
|
58
61
|
|
59
62
|
def polygallery_settings
|
60
|
-
polygallery_options
|
63
|
+
return self.polygallery_options if self.polygallery_options.present?
|
64
|
+
if self.gallery_title.present?
|
65
|
+
s = if self.galleryable.present?
|
66
|
+
galleryable.class.send(:"#{self.gallery_title}_settings")
|
67
|
+
elsif self.galleryable_type.present?
|
68
|
+
Kernel.const_get(self.galleryable_type)
|
69
|
+
.send(:"#{self.gallery_title}_settings")
|
70
|
+
end
|
71
|
+
return s if s.present?
|
72
|
+
# elsif respond_to?(:gallery) && gallery.present?
|
73
|
+
# return gallery.polygallery_settings
|
74
|
+
# elsif self.gallery_id.present?
|
75
|
+
# g = Kernel.const_get(self.galleryable_type).find(self.gallery_id)
|
76
|
+
# if g.present?
|
77
|
+
# self.gallery_title = g.title
|
78
|
+
# return self.polygallery_settings
|
79
|
+
# end
|
80
|
+
end
|
81
|
+
self.class.polygallery_settings
|
61
82
|
# if gallery_title.present? && galleryable_type.present?
|
62
83
|
# galleryable_class = Kernel.const_get(galleryable_type)
|
63
84
|
# galleryable_class.send :"#{gallery_title}_settings"
|
@@ -1,41 +1,5 @@
|
|
1
1
|
module Polygallery
|
2
2
|
class Gallery < ActiveRecord::Base
|
3
|
-
|
4
|
-
belongs_to :galleryable, :polymorphic => true
|
5
3
|
has_polyphotos
|
6
|
-
|
7
|
-
def settings
|
8
|
-
if galleryable.present?
|
9
|
-
galleryable.send("#{title}_settings".to_sym)
|
10
|
-
elsif galleryable_id.present? && galleryable_type.present?
|
11
|
-
puts 'Galleryable can\'t be loaded'
|
12
|
-
klass = Object.const_get(galleryable_type)
|
13
|
-
if klass.exists? :id => galleryable_id
|
14
|
-
puts 'Galleryable found! Attempting to load now.'
|
15
|
-
klass.find(galleryable_id).send("#{title}_settings".to_sym)
|
16
|
-
else
|
17
|
-
puts 'Galleryable still not found.'
|
18
|
-
defaults
|
19
|
-
end
|
20
|
-
elsif galleryable_type.present?
|
21
|
-
Object.const_get(galleryable_type).send("#{title}_settings".to_sym)
|
22
|
-
else
|
23
|
-
puts 'WARNING: Galleryable not found! Using default paperclip settings...'
|
24
|
-
defaults
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def defaults
|
29
|
-
if self.class_name.present?
|
30
|
-
Kernel.const_get(self.class_name)::DEFAULTS
|
31
|
-
else
|
32
|
-
DEFAULTS
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def default_options
|
37
|
-
@default_options ||= DEFAULTS
|
38
|
-
end
|
39
|
-
|
40
4
|
end
|
41
5
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CreatePolygalleriesIfNecessary < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
unless ActiveRecord::Base.connection.table_exists? 'polygallery_galleries'
|
4
|
+
create_table :polygallery_galleries do |t|
|
5
|
+
t.string :title, :default => 'gallery'
|
6
|
+
t.integer :default_photo_id
|
7
|
+
t.integer :galleryable_id
|
8
|
+
t.string :galleryable_type
|
9
|
+
t.string :class_name
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
unless ActiveRecord::Base.connection.table_exists? 'polygallery_photos'
|
15
|
+
create_table :polygallery_photos do |t|
|
16
|
+
t.integer :gallery_id
|
17
|
+
t.attachment :photo
|
18
|
+
t.string :title
|
19
|
+
t.text :caption
|
20
|
+
t.string :class_name
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
def down
|
27
|
+
drop_table :polygallery_galleries
|
28
|
+
drop_table :polygallery_photos
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class AddAssociationsToPolygalleryPhotos < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :polygallery_photos, :gallery_title, :string
|
4
|
+
add_column :polygallery_photos, :galleryable_id, :integer
|
5
|
+
add_column :polygallery_photos, :galleryable_type, :string
|
6
|
+
if Polygallery::Gallery.any?
|
7
|
+
Polygallery::Gallery.all.each do |pg|
|
8
|
+
if pg.polygallery_photos.any?
|
9
|
+
pg.polygallery_photos.each do |pp|
|
10
|
+
pp.update_attributes :gallery_title => pg.title,
|
11
|
+
:galleryable_id => pg.galleryable_id,
|
12
|
+
:galleryable_type => pg.galleryable_type
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def down
|
20
|
+
remove_column :polygallery_photos, :gallery_title
|
21
|
+
remove_column :polygallery_photos, :galleryable_id
|
22
|
+
remove_column :polygallery_photos, :galleryable_type
|
23
|
+
end
|
24
|
+
end
|
@@ -17,7 +17,19 @@ module Polygallery
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def copy_migrations
|
20
|
-
|
20
|
+
# This is the old way of including migrations in a gem.
|
21
|
+
# Migrations are now automatically appended by the engine.
|
22
|
+
# Legacy code left commented below.
|
23
|
+
|
24
|
+
# dest_dir = Rails.root.join 'db', 'migrate'
|
25
|
+
# {
|
26
|
+
# 'polygallery_migration.rb' => 'create_polygalleries.rb',
|
27
|
+
# 'add_gallery_title.rb' => 'add_gallery_title_to_polyphotos.rb'
|
28
|
+
# }.each do |source, dest_name|
|
29
|
+
# unless self.class.migration_exists? dest_dir, dest_name
|
30
|
+
# migration_template source, dest_dir.join(dest_name)
|
31
|
+
# end
|
32
|
+
# end
|
21
33
|
end
|
22
34
|
|
23
35
|
def inject_engine_routing
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddGalleryTitleToPolyphotos < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :polygallery_photos, :gallery_title, :string
|
4
|
+
add_column :polygallery_photos, :gallery_title, :string
|
5
|
+
end
|
6
|
+
def down
|
7
|
+
remove_column :polygallery_photos, :gallery_title
|
8
|
+
end
|
9
|
+
end
|
data/lib/polygallery/engine.rb
CHANGED
@@ -6,5 +6,12 @@ module Polygallery
|
|
6
6
|
|
7
7
|
end
|
8
8
|
end
|
9
|
+
initializer :append_migrations do |app|
|
10
|
+
unless app.root.to_s == root.to_s
|
11
|
+
config.paths['db/migrate'].expanded.each do |expanded_path|
|
12
|
+
app.config.paths['db/migrate'] << expanded_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
@@ -21,19 +21,10 @@ module Polygallery
|
|
21
21
|
:photos => :photos
|
22
22
|
},
|
23
23
|
:nested_attributes => {
|
24
|
-
:gallery => {
|
25
|
-
:reject_if => :all_blank
|
26
|
-
# proc {|attributes| false }
|
27
|
-
# photo_attr_sets = attributes
|
28
|
-
# .select{|k, _| k.include? 'photos_attributes' }
|
29
|
-
# photo_attr_sets.select{|_, photo_sets|
|
30
|
-
# photo_sets.select{|_, photo_attrs|
|
31
|
-
# puts photo_attrs
|
32
|
-
# photo_attrs.key? 'photo' }.empty? }.empty? }
|
33
|
-
},
|
24
|
+
:gallery => { :reject_if => :all_blank },
|
34
25
|
:photos => {
|
35
26
|
:reject_if => proc {|attributes| !attributes.key?('photo') },
|
36
|
-
:allow_destroy => true}
|
27
|
+
:allow_destroy => true }
|
37
28
|
},
|
38
29
|
:validates => {},
|
39
30
|
:paperclip => {
|
@@ -58,7 +49,7 @@ module Polygallery
|
|
58
49
|
|
59
50
|
associations = options[:associations]
|
60
51
|
gallery_association = options[:associations][:gallery] if associations.present?
|
61
|
-
gallery_class_name =
|
52
|
+
gallery_class_name = gallery_association[:class_name] if gallery_association.present?
|
62
53
|
defaults = if gallery_class_name.present? && gallery_class_name != 'Polygallery::Gallery'
|
63
54
|
Kernel.const_get(gallery_class_name)::POLYGALLERY_DEFAULTS
|
64
55
|
else
|
@@ -66,7 +57,7 @@ module Polygallery
|
|
66
57
|
end
|
67
58
|
if options[:association_names].nil? && title.to_s != 'gallery'
|
68
59
|
options[:association_names] = {
|
69
|
-
:gallery => title
|
60
|
+
:gallery => :"#{title}",
|
70
61
|
:photos => :"#{title.to_s.gsub('_gallery', '')}_photos"
|
71
62
|
}
|
72
63
|
end
|
@@ -120,8 +111,11 @@ module Polygallery
|
|
120
111
|
gallery_association = send pg
|
121
112
|
next if gallery_association.present?
|
122
113
|
gallery_settings = send :"#{pg.to_s}_settings"
|
123
|
-
gallery_association
|
124
|
-
|
114
|
+
if gallery_association.nil?
|
115
|
+
built_gallery = send :"build_#{pg.to_s}",
|
116
|
+
:polygallery_options => gallery_settings
|
117
|
+
gallery_association = send :"#{pg.to_s}=", built_gallery
|
118
|
+
end
|
125
119
|
gallery_association.galleryable ||= self
|
126
120
|
end
|
127
121
|
end
|
@@ -19,13 +19,10 @@ module Polygallery
|
|
19
19
|
end
|
20
20
|
|
21
21
|
settings = defaults.deep_merge options
|
22
|
-
|
23
|
-
has_many association_names[:photos], settings[:associations][:photos]
|
24
|
-
accepts_nested_attributes_for association_names[:photos],
|
25
|
-
settings[:nested_attributes][:photos]
|
22
|
+
init_associations settings
|
26
23
|
|
27
24
|
after_initialize do
|
28
|
-
|
25
|
+
self.polygallery_options ||= self.polygallery_settings
|
29
26
|
self.initialize_polygallery
|
30
27
|
end
|
31
28
|
|
@@ -33,8 +30,17 @@ module Polygallery
|
|
33
30
|
end
|
34
31
|
|
35
32
|
def polygallery_settings
|
36
|
-
|
33
|
+
HasPolygallery::DEFAULTS
|
34
|
+
end
|
35
|
+
|
36
|
+
def init_associations(settings=HasPolygallery::DEFAULTS)
|
37
|
+
belongs_to :galleryable, :polymorphic => true
|
38
|
+
photos_name = settings[:association_names][:photos]
|
39
|
+
has_many photos_name, settings[:associations][:photos]
|
40
|
+
accepts_nested_attributes_for photos_name,
|
41
|
+
settings[:nested_attributes][:photos]
|
37
42
|
end
|
43
|
+
|
38
44
|
end
|
39
45
|
|
40
46
|
|
@@ -46,38 +52,36 @@ module Polygallery
|
|
46
52
|
photo.gallery_title ||= title
|
47
53
|
end
|
48
54
|
|
49
|
-
# def polygallery_settings
|
50
|
-
# Kernel.const_get(self.galleryable_type).send :"#{self.title}_settings"
|
51
|
-
# end
|
52
|
-
|
53
55
|
def include_polygallery_settings(settings)
|
54
|
-
|
56
|
+
self.polygallery_options = settings
|
55
57
|
self.initialize_polygallery
|
56
58
|
end
|
57
59
|
|
58
60
|
def initialize_polygallery
|
59
|
-
|
60
|
-
|
61
|
-
# self.class.has_many association_names[:photos],
|
62
|
-
# settings[:associations][:photos].deep_merge({})
|
63
|
-
# self.class.accepts_nested_attributes_for association_names[:photos],
|
64
|
-
# settings[:nested_attributes][:photos]
|
61
|
+
settings = self.polygallery_settings
|
62
|
+
self.class.init_associations(settings)
|
65
63
|
end
|
66
64
|
|
67
65
|
def build_first_photo
|
68
|
-
|
69
|
-
photo_association = send settings[:association_names][:photos]
|
66
|
+
photo_association = self.polygallery_photos
|
70
67
|
photo_association.build(
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
) unless photo_association.any?
|
68
|
+
:polygallery_options => self.polygallery_settings,
|
69
|
+
:galleryable_id => self.galleryable_id,
|
70
|
+
:galleryable_type => self.galleryable_type,
|
71
|
+
:gallery_title => self.title ) unless photo_association.any?
|
76
72
|
end
|
77
73
|
|
78
74
|
def polygallery_settings
|
79
|
-
polygallery_options
|
75
|
+
return self.polygallery_options if self.polygallery_options.present?
|
76
|
+
return Kernel.const_get(self.galleryable_type)
|
77
|
+
.send(:"#{self.title}_settings") if galleryable_type.present?
|
78
|
+
self.class.polygallery_settings
|
79
|
+
end
|
80
|
+
|
81
|
+
def polygallery_photos
|
82
|
+
self.send self.polygallery_settings[:association_names][:photos]
|
80
83
|
end
|
84
|
+
|
81
85
|
end
|
82
86
|
end
|
83
87
|
end
|
data/lib/polygallery/version.rb
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
class Event < ActiveRecord::Base
|
2
2
|
|
3
|
-
has_polygallery
|
4
|
-
has_polygallery :custom_gallery,
|
3
|
+
has_polygallery # :paperclip => {:styles => {:test => '100x200#'}}
|
4
|
+
has_polygallery :custom_gallery,
|
5
|
+
:association_names => {
|
6
|
+
:gallery => :custom_gallery,
|
7
|
+
:photos => :custom_photos },
|
8
|
+
:paperclip => {:styles => {:custom => '500x500#'}}
|
9
|
+
has_polygallery :gallery_with_altered_style,
|
10
|
+
:association_names => {
|
11
|
+
:gallery => :gallery_with_altered_style,
|
12
|
+
:photos => :altered_photos },
|
13
|
+
:paperclip => {:styles => {:medium => '100x200#'}}
|
5
14
|
|
6
15
|
end
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20150701180956) do
|
15
15
|
|
16
16
|
# These are extensions that must be enabled in order to support this database
|
17
17
|
enable_extension "plpgsql"
|
@@ -43,6 +43,9 @@ ActiveRecord::Schema.define(version: 20150320165705) do
|
|
43
43
|
t.string "class_name"
|
44
44
|
t.datetime "created_at"
|
45
45
|
t.datetime "updated_at"
|
46
|
+
t.string "gallery_title"
|
47
|
+
t.integer "galleryable_id"
|
48
|
+
t.string "galleryable_type"
|
46
49
|
end
|
47
50
|
|
48
51
|
end
|
@@ -37742,3 +37742,81 @@ Started GET "/assets/polygallery/thumbnail-missing.jpg" for 127.0.0.1 at 2015-03
|
|
37742
37742
|
[1m[36mPolygallery::Gallery Load (0.2ms)[0m [1mSELECT "polygallery_galleries".* FROM "polygallery_galleries" WHERE "polygallery_galleries"."galleryable_id" = $1 AND "polygallery_galleries"."galleryable_type" = $2 AND "polygallery_galleries"."title" = 'gallery' LIMIT 1[0m [["galleryable_id", 14], ["galleryable_type", "Event"]]
|
37743
37743
|
[1m[35mPolygallery::Gallery Load (0.2ms)[0m SELECT "polygallery_galleries".* FROM "polygallery_galleries" WHERE "polygallery_galleries"."galleryable_id" = $1 AND "polygallery_galleries"."galleryable_type" = $2 AND "polygallery_galleries"."title" = 'custom_gallery' LIMIT 1 [["galleryable_id", 14], ["galleryable_type", "Event"]]
|
37744
37744
|
[1m[36mPolygallery::Photo Load (0.4ms)[0m [1mSELECT "polygallery_photos".* FROM "polygallery_photos" INNER JOIN "polygallery_galleries" ON "polygallery_photos"."gallery_id" = "polygallery_galleries"."id" WHERE "polygallery_galleries"."galleryable_id" = $1 AND "polygallery_galleries"."galleryable_type" = $2 AND "polygallery_galleries"."title" = 'custom_gallery'[0m [["galleryable_id", 14], ["galleryable_type", "Event"]]
|
37745
|
+
[1m[36m (169.0ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL) [0m
|
37746
|
+
[1m[35m (34.9ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
37747
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37748
|
+
Migrating to CreateEvents (20140803170839)
|
37749
|
+
[1m[35m (0.2ms)[0m BEGIN
|
37750
|
+
[1m[36m (60.0ms)[0m [1mCREATE TABLE "events" ("id" serial primary key, "title" character varying(255), "created_at" timestamp, "updated_at" timestamp) [0m
|
37751
|
+
[1m[35mSQL (15.6ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140803170839"]]
|
37752
|
+
[1m[36m (1.3ms)[0m [1mCOMMIT[0m
|
37753
|
+
Migrating to CreatePolygalleries (20150320165705)
|
37754
|
+
[1m[35m (15.4ms)[0m BEGIN
|
37755
|
+
[1m[36m (58.9ms)[0m [1mCREATE TABLE "polygallery_galleries" ("id" serial primary key, "title" character varying(255) DEFAULT 'gallery', "default_photo_id" integer, "galleryable_id" integer, "galleryable_type" character varying(255), "class_name" character varying(255), "created_at" timestamp, "updated_at" timestamp) [0m
|
37756
|
+
[1m[35m (21.0ms)[0m CREATE TABLE "polygallery_photos" ("id" serial primary key, "gallery_id" integer, "photo_file_name" character varying(255), "photo_content_type" character varying(255), "photo_file_size" integer, "photo_updated_at" timestamp, "title" character varying(255), "caption" text, "class_name" character varying(255), "created_at" timestamp, "updated_at" timestamp)
|
37757
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20150320165705"]]
|
37758
|
+
[1m[35m (30.4ms)[0m COMMIT
|
37759
|
+
Migrating to CreatePolygalleriesIfNecessary (20150701180557)
|
37760
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37761
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
37762
|
+
Migrating to CreatePolygalleries (20150320165705)
|
37763
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
37764
|
+
[1m[35m (54.2ms)[0m DROP TABLE "polygallery_photos"
|
37765
|
+
[1m[36m (23.7ms)[0m [1mDROP TABLE "polygallery_galleries"[0m
|
37766
|
+
[1m[35mSQL (33.3ms)[0m DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = '20150320165705'
|
37767
|
+
[1m[36m (1.6ms)[0m [1mCOMMIT[0m
|
37768
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
37769
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37770
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
37771
|
+
Migrating to CreateEvents (20140803170839)
|
37772
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
37773
|
+
[1m[35m (1.2ms)[0m DROP TABLE "events"
|
37774
|
+
[1m[36mSQL (0.6ms)[0m [1mDELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = '20140803170839'[0m
|
37775
|
+
[1m[35m (16.3ms)[0m COMMIT
|
37776
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37777
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37778
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
37779
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37780
|
+
Migrating to CreateEvents (20140803170839)
|
37781
|
+
[1m[35m (0.2ms)[0m BEGIN
|
37782
|
+
[1m[36m (37.8ms)[0m [1mCREATE TABLE "events" ("id" serial primary key, "title" character varying(255), "created_at" timestamp, "updated_at" timestamp) [0m
|
37783
|
+
[1m[35mSQL (16.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140803170839"]]
|
37784
|
+
[1m[36m (16.0ms)[0m [1mCOMMIT[0m
|
37785
|
+
Migrating to CreatePolygalleries (20150320165705)
|
37786
|
+
[1m[35m (15.4ms)[0m BEGIN
|
37787
|
+
[1m[36m (72.0ms)[0m [1mCREATE TABLE "polygallery_galleries" ("id" serial primary key, "title" character varying(255) DEFAULT 'gallery', "default_photo_id" integer, "galleryable_id" integer, "galleryable_type" character varying(255), "class_name" character varying(255), "created_at" timestamp, "updated_at" timestamp) [0m
|
37788
|
+
[1m[35m (12.7ms)[0m CREATE TABLE "polygallery_photos" ("id" serial primary key, "gallery_id" integer, "photo_file_name" character varying(255), "photo_content_type" character varying(255), "photo_file_size" integer, "photo_updated_at" timestamp, "title" character varying(255), "caption" text, "class_name" character varying(255), "created_at" timestamp, "updated_at" timestamp)
|
37789
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20150320165705"]]
|
37790
|
+
[1m[35m (0.6ms)[0m COMMIT
|
37791
|
+
Migrating to CreatePolygalleriesIfNecessary (20150701180557)
|
37792
|
+
[1m[36m (32.9ms)[0m [1mBEGIN[0m
|
37793
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150701180557"]]
|
37794
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
37795
|
+
Migrating to AddAssociationsToPolygalleryPhotos (20150701180956)
|
37796
|
+
[1m[35m (0.1ms)[0m BEGIN
|
37797
|
+
[1m[36m (0.3ms)[0m [1mALTER TABLE "polygallery_photos" ADD COLUMN "gallery_title" character varying(255)[0m
|
37798
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "polygallery_photos" ADD COLUMN "galleryable_id" integer
|
37799
|
+
[1m[36m (0.3ms)[0m [1mALTER TABLE "polygallery_photos" ADD COLUMN "galleryable_type" character varying(255)[0m
|
37800
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150701180956"]]
|
37801
|
+
[1m[36m (16.1ms)[0m [1mCOMMIT[0m
|
37802
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
37803
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37804
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
37805
|
+
Migrating to AddAssociationsToPolygalleryPhotos (20150701180956)
|
37806
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
37807
|
+
[1m[35m (0.7ms)[0m ALTER TABLE "polygallery_photos" DROP "galleryable_type"
|
37808
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "polygallery_photos" DROP "galleryable_id"[0m
|
37809
|
+
[1m[35m (0.2ms)[0m ALTER TABLE "polygallery_photos" DROP "gallery_title"
|
37810
|
+
[1m[36mSQL (0.7ms)[0m [1mDELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = '20150701180956'[0m
|
37811
|
+
[1m[35m (15.7ms)[0m COMMIT
|
37812
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37813
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
37814
|
+
Migrating to AddAssociationsToPolygalleryPhotos (20150701180956)
|
37815
|
+
[1m[35m (0.2ms)[0m BEGIN
|
37816
|
+
[1m[36m (35.3ms)[0m [1mALTER TABLE "polygallery_photos" ADD COLUMN "gallery_title" character varying(255)[0m
|
37817
|
+
[1m[35m (0.3ms)[0m ALTER TABLE "polygallery_photos" ADD COLUMN "galleryable_id" integer
|
37818
|
+
[1m[36m (0.2ms)[0m [1mALTER TABLE "polygallery_photos" ADD COLUMN "galleryable_type" character varying(255)[0m
|
37819
|
+
[1m[35m (9.0ms)[0m SELECT COUNT(*) FROM "polygallery_galleries"
|
37820
|
+
[1m[36mSQL (16.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES ($1)[0m [["version", "20150701180956"]]
|
37821
|
+
[1m[35m (19.2ms)[0m COMMIT
|
37822
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|