comfy_gallery 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.travis.yml +2 -0
- data/Gemfile +10 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +21 -0
- data/VERSION +1 -0
- data/app/assets/images/sofa_gallery/jcrop.gif +0 -0
- data/app/assets/images/sofa_gallery/orbit/bullets.jpg +0 -0
- data/app/assets/images/sofa_gallery/orbit/left-arrow.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/loading.gif +0 -0
- data/app/assets/images/sofa_gallery/orbit/mask-black.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/pause-black.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/right-arrow.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/rotator-black.png +0 -0
- data/app/assets/images/sofa_gallery/orbit/timer-black.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif +0 -0
- data/app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png +0 -0
- data/app/assets/javascripts/sofa_gallery/admin.js +72 -0
- data/app/assets/javascripts/sofa_gallery/application.js +15 -0
- data/app/assets/javascripts/sofa_gallery/jquery.jcrop.js +246 -0
- data/app/assets/javascripts/sofa_gallery/jquery.orbit-1.2.3.min.js +17 -0
- data/app/assets/javascripts/sofa_gallery/thumbnails.js +85 -0
- data/app/assets/stylesheets/comfy_gallery/admin.css +57 -0
- data/app/assets/stylesheets/comfy_gallery/application.css +67 -0
- data/app/assets/stylesheets/comfy_gallery/carousel.css.erb +208 -0
- data/app/assets/stylesheets/comfy_gallery/gallery_list.css +18 -0
- data/app/assets/stylesheets/comfy_gallery/jquery.jcrop.css +32 -0
- data/app/assets/stylesheets/comfy_gallery/reset.css +1 -0
- data/app/assets/stylesheets/comfy_gallery/thumbnails.css.erb +181 -0
- data/app/controllers/admin/gallery/base_controller.rb +3 -0
- data/app/controllers/admin/gallery/galleries_controller.rb +63 -0
- data/app/controllers/admin/gallery/photos_controller.rb +96 -0
- data/app/controllers/application_controller.rb +7 -0
- data/app/controllers/gallery/galleries_controller.rb +15 -0
- data/app/helpers/gallery/application_helper.rb +30 -0
- data/app/models/gallery/gallery.rb +19 -0
- data/app/models/gallery/photo.rb +78 -0
- data/app/views/admin/gallery/_html_head.html.erb +1 -0
- data/app/views/admin/gallery/_navigation.html.erb +5 -0
- data/app/views/admin/gallery/galleries/_form.html.erb +18 -0
- data/app/views/admin/gallery/galleries/edit.html.erb +5 -0
- data/app/views/admin/gallery/galleries/index.html.erb +40 -0
- data/app/views/admin/gallery/galleries/new.html.erb +5 -0
- data/app/views/admin/gallery/photos/_form.html.erb +16 -0
- data/app/views/admin/gallery/photos/crop.html.erb +64 -0
- data/app/views/admin/gallery/photos/edit.html.erb +5 -0
- data/app/views/admin/gallery/photos/index.html.erb +24 -0
- data/app/views/admin/gallery/photos/new.html.erb +5 -0
- data/app/views/gallery/_carousel.html.erb +31 -0
- data/app/views/gallery/_list_galleries.html.erb +26 -0
- data/app/views/gallery/_thumbnails.html.erb +26 -0
- data/app/views/gallery/galleries/index.html.erb +1 -0
- data/app/views/gallery/galleries/show.html.erb +7 -0
- data/app/views/layouts/gallery/application.html.erb +16 -0
- data/comfy_gallery.gemspec +177 -0
- data/config/application.rb +51 -0
- data/config/boot.rb +13 -0
- data/config/database.yml +16 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +25 -0
- data/config/environments/production.rb +52 -0
- data/config/environments/test.rb +39 -0
- data/config/initializers/comfy_gallery.rb +15 -0
- data/config/initializers/paperclip.rb +3 -0
- data/config/routes.rb +17 -0
- data/config.ru +4 -0
- data/db/migrate/01_create_comfy_gallery.rb +36 -0
- data/lib/comfy_gallery/configuration.rb +26 -0
- data/lib/comfy_gallery/engine.rb +22 -0
- data/lib/comfy_gallery/form_builder.rb +50 -0
- data/lib/comfy_gallery.rb +23 -0
- data/lib/generators/README +10 -0
- data/lib/generators/comfy_gallery_generator.rb +33 -0
- data/lib/paperclip_processors/cropper.rb +31 -0
- data/lib/tasks/comfy_gallery.rake +4 -0
- data/script/rails +6 -0
- data/sofa_gallery.gemspec +175 -0
- data/test/fixtures/files/default.jpg +0 -0
- data/test/fixtures/files/default.txt +1 -0
- data/test/fixtures/files/default2.jpg +0 -0
- data/test/fixtures/gallery/galleries.yml +11 -0
- data/test/fixtures/gallery/photos.yml +9 -0
- data/test/functional/admin/gallery/galleries_controller_test.rb +87 -0
- data/test/functional/admin/gallery/photos_controller_test.rb +234 -0
- data/test/functional/gallery/galleries_controller_test.rb +24 -0
- data/test/test_helper.rb +39 -0
- data/test/unit/configuration_test.rb +18 -0
- data/test/unit/gallery_test.rb +33 -0
- data/test/unit/photo_test.rb +33 -0
- metadata +233 -0
@@ -0,0 +1,181 @@
|
|
1
|
+
ul.gallery {
|
2
|
+
padding-left: 0;
|
3
|
+
margin: 20px auto;
|
4
|
+
overflow: hidden;
|
5
|
+
list-style: none; }
|
6
|
+
ul.gallery li {
|
7
|
+
float: left;
|
8
|
+
text-align: center;
|
9
|
+
margin: 0 10px 10px 0;
|
10
|
+
border: none; }
|
11
|
+
|
12
|
+
div.pp_default .pp_top,div.pp_default .pp_top .pp_middle,div.pp_default .pp_top .pp_left,div.pp_default .pp_top .pp_right,div.pp_default .pp_bottom,div.pp_default .pp_bottom .pp_left,div.pp_default .pp_bottom .pp_middle,div.pp_default .pp_bottom .pp_right{height:13px}
|
13
|
+
div.pp_default .pp_top .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) -78px -93px no-repeat}
|
14
|
+
div.pp_default .pp_top .pp_middle{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite_x.png") %>) top left repeat-x}
|
15
|
+
div.pp_default .pp_top .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) -112px -93px no-repeat}
|
16
|
+
div.pp_default .pp_content .ppt{color:#f8f8f8}
|
17
|
+
div.pp_default .pp_content_container .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite_y.png") %>) -7px 0 repeat-y;padding-left:13px}
|
18
|
+
div.pp_default .pp_content_container .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite_y.png") %>) top right repeat-y;padding-right:13px}
|
19
|
+
div.pp_default .pp_next:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite_next.png") %>) center right no-repeat;cursor:pointer}
|
20
|
+
div.pp_default .pp_previous:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite_prev.png") %>) center left no-repeat;cursor:pointer}
|
21
|
+
div.pp_default .pp_expand{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) 0 -29px no-repeat;cursor:pointer;height:28px;width:28px}
|
22
|
+
div.pp_default .pp_expand:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) 0 -56px no-repeat;cursor:pointer}
|
23
|
+
div.pp_default .pp_contract{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) 0 -84px no-repeat;cursor:pointer;height:28px;width:28px}
|
24
|
+
div.pp_default .pp_contract:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) 0 -113px no-repeat;cursor:pointer}
|
25
|
+
div.pp_default .pp_close{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) 2px 1px no-repeat;cursor:pointer;height:30px;width:30px}
|
26
|
+
div.pp_default .pp_gallery ul li a{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/default_thumb.png") %>) center center #f8f8f8;border:1px solid #aaa}
|
27
|
+
div.pp_default .pp_social{margin-top:7px}
|
28
|
+
div.pp_default .pp_gallery a.pp_arrow_previous,div.pp_default .pp_gallery a.pp_arrow_next{left:auto;position:static}
|
29
|
+
div.pp_default .pp_nav .pp_play,div.pp_default .pp_nav .pp_pause{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) -51px 1px no-repeat;height:30px;width:30px}
|
30
|
+
div.pp_default .pp_nav .pp_pause{background-position:-51px -29px}
|
31
|
+
div.pp_default a.pp_arrow_previous,div.pp_default a.pp_arrow_next{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) -31px -3px no-repeat;height:20px;margin:4px 0 0;width:20px}
|
32
|
+
div.pp_default a.pp_arrow_next{background-position:-82px -3px;left:52px}
|
33
|
+
div.pp_default .pp_content_container .pp_details{margin-top:5px}
|
34
|
+
div.pp_default .pp_nav{clear:none;height:30px;position:relative;width:110px}
|
35
|
+
div.pp_default .pp_nav .currentTextHolder{color:#999;font-family:Georgia;font-size:11px;font-style:italic;left:75px;line-height:25px;margin:0;padding:0 0 0 10px;position:absolute;top:2px}
|
36
|
+
div.pp_default .pp_close:hover,div.pp_default .pp_nav .pp_play:hover,div.pp_default .pp_nav .pp_pause:hover,div.pp_default .pp_arrow_next:hover,div.pp_default .pp_arrow_previous:hover{opacity:0.7}
|
37
|
+
div.pp_default .pp_description{font-size:11px;font-weight:700;line-height:14px;margin:5px 50px 5px 0}
|
38
|
+
div.pp_default .pp_bottom .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) -78px -127px no-repeat}
|
39
|
+
div.pp_default .pp_bottom .pp_middle{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite_x.png") %>) bottom left repeat-x}
|
40
|
+
div.pp_default .pp_bottom .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/sprite.png") %>) -112px -127px no-repeat}
|
41
|
+
div.pp_default .pp_loaderIcon{background: url(<%= asset_path("sofa_gallery/prettyPhoto/default/loader.gif") %>) center center no-repeat}
|
42
|
+
div.light_rounded .pp_top .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -88px -53px no-repeat}
|
43
|
+
div.light_rounded .pp_top .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -110px -53px no-repeat}
|
44
|
+
div.light_rounded .pp_next:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/btnNext.png") %>) center right no-repeat;cursor:pointer}
|
45
|
+
div.light_rounded .pp_previous:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png") %>) center left no-repeat;cursor:pointer}
|
46
|
+
div.light_rounded .pp_expand{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -31px -26px no-repeat;cursor:pointer}
|
47
|
+
div.light_rounded .pp_expand:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -31px -47px no-repeat;cursor:pointer}
|
48
|
+
div.light_rounded .pp_contract{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) 0 -26px no-repeat;cursor:pointer}
|
49
|
+
div.light_rounded .pp_contract:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) 0 -47px no-repeat;cursor:pointer}
|
50
|
+
div.light_rounded .pp_close{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
|
51
|
+
div.light_rounded .pp_nav .pp_play{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -1px -100px no-repeat;height:15px;width:14px}
|
52
|
+
div.light_rounded .pp_nav .pp_pause{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -24px -100px no-repeat;height:15px;width:14px}
|
53
|
+
div.light_rounded .pp_arrow_previous{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) 0 -71px no-repeat}
|
54
|
+
div.light_rounded .pp_arrow_next{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -22px -71px no-repeat}
|
55
|
+
div.light_rounded .pp_bottom .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -88px -80px no-repeat}
|
56
|
+
div.light_rounded .pp_bottom .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/sprite.png") %>) -110px -80px no-repeat}
|
57
|
+
div.dark_rounded .pp_top .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -88px -53px no-repeat}
|
58
|
+
div.dark_rounded .pp_top .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -110px -53px no-repeat}
|
59
|
+
div.dark_rounded .pp_content_container .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png") %>) top left repeat-y}
|
60
|
+
div.dark_rounded .pp_content_container .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png") %>) top right repeat-y}
|
61
|
+
div.dark_rounded .pp_next:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/btnNext.png") %>) center right no-repeat;cursor:pointer}
|
62
|
+
div.dark_rounded .pp_previous:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png") %>) center left no-repeat;cursor:pointer}
|
63
|
+
div.dark_rounded .pp_expand{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -31px -26px no-repeat;cursor:pointer}
|
64
|
+
div.dark_rounded .pp_expand:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -31px -47px no-repeat;cursor:pointer}
|
65
|
+
div.dark_rounded .pp_contract{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) 0 -26px no-repeat;cursor:pointer}
|
66
|
+
div.dark_rounded .pp_contract:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) 0 -47px no-repeat;cursor:pointer}
|
67
|
+
div.dark_rounded .pp_close{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
|
68
|
+
div.dark_rounded .pp_description{color:#fff;margin-right:85px}
|
69
|
+
div.dark_rounded .pp_nav .pp_play{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -1px -100px no-repeat;height:15px;width:14px}
|
70
|
+
div.dark_rounded .pp_nav .pp_pause{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -24px -100px no-repeat;height:15px;width:14px}
|
71
|
+
div.dark_rounded .pp_arrow_previous{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) 0 -71px no-repeat}
|
72
|
+
div.dark_rounded .pp_arrow_next{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -22px -71px no-repeat}
|
73
|
+
div.dark_rounded .pp_bottom .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -88px -80px no-repeat}
|
74
|
+
div.dark_rounded .pp_bottom .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/sprite.png") %>) -110px -80px no-repeat}
|
75
|
+
div.dark_rounded .pp_loaderIcon{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/loader.gif") %>) center center no-repeat}
|
76
|
+
div.dark_square .pp_left,div.dark_square .pp_middle,div.dark_square .pp_right,div.dark_square .pp_content{background:#000}
|
77
|
+
div.dark_square .pp_description{color:#fff;margin:0 85px 0 0}
|
78
|
+
div.dark_square .pp_loaderIcon{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/loader.gif") %>) center center no-repeat}
|
79
|
+
div.dark_square .pp_expand{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) -31px -26px no-repeat;cursor:pointer}
|
80
|
+
div.dark_square .pp_expand:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) -31px -47px no-repeat;cursor:pointer}
|
81
|
+
div.dark_square .pp_contract{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) 0 -26px no-repeat;cursor:pointer}
|
82
|
+
div.dark_square .pp_contract:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) 0 -47px no-repeat;cursor:pointer}
|
83
|
+
div.dark_square .pp_close{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
|
84
|
+
div.dark_square .pp_nav{clear:none}
|
85
|
+
div.dark_square .pp_nav .pp_play{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) -1px -100px no-repeat;height:15px;width:14px}
|
86
|
+
div.dark_square .pp_nav .pp_pause{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) -24px -100px no-repeat;height:15px;width:14px}
|
87
|
+
div.dark_square .pp_arrow_previous{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) 0 -71px no-repeat}
|
88
|
+
div.dark_square .pp_arrow_next{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/sprite.png") %>) -22px -71px no-repeat}
|
89
|
+
div.dark_square .pp_next:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/btnNext.png") %>) center right no-repeat;cursor:pointer}
|
90
|
+
div.dark_square .pp_previous:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_square/btnPrevious.png") %>) center left no-repeat;cursor:pointer}
|
91
|
+
div.light_square .pp_expand{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) -31px -26px no-repeat;cursor:pointer}
|
92
|
+
div.light_square .pp_expand:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) -31px -47px no-repeat;cursor:pointer}
|
93
|
+
div.light_square .pp_contract{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) 0 -26px no-repeat;cursor:pointer}
|
94
|
+
div.light_square .pp_contract:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) 0 -47px no-repeat;cursor:pointer}
|
95
|
+
div.light_square .pp_close{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
|
96
|
+
div.light_square .pp_nav .pp_play{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) -1px -100px no-repeat;height:15px;width:14px}
|
97
|
+
div.light_square .pp_nav .pp_pause{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) -24px -100px no-repeat;height:15px;width:14px}
|
98
|
+
div.light_square .pp_arrow_previous{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) 0 -71px no-repeat}
|
99
|
+
div.light_square .pp_arrow_next{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/sprite.png") %>) -22px -71px no-repeat}
|
100
|
+
div.light_square .pp_next:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/btnNext.png") %>) center right no-repeat;cursor:pointer}
|
101
|
+
div.light_square .pp_previous:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_square/btnPrevious.png") %>) center left no-repeat;cursor:pointer}
|
102
|
+
div.facebook .pp_top .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -88px -53px no-repeat}
|
103
|
+
div.facebook .pp_top .pp_middle{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/contentPatternTop.png") %>) top left repeat-x}
|
104
|
+
div.facebook .pp_top .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -110px -53px no-repeat}
|
105
|
+
div.facebook .pp_content_container .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png") %>) top left repeat-y}
|
106
|
+
div.facebook .pp_content_container .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/contentPatternRight.png") %>) top right repeat-y}
|
107
|
+
div.facebook .pp_expand{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -31px -26px no-repeat;cursor:pointer}
|
108
|
+
div.facebook .pp_expand:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -31px -47px no-repeat;cursor:pointer}
|
109
|
+
div.facebook .pp_contract{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) 0 -26px no-repeat;cursor:pointer}
|
110
|
+
div.facebook .pp_contract:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) 0 -47px no-repeat;cursor:pointer}
|
111
|
+
div.facebook .pp_close{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -1px -1px no-repeat;cursor:pointer;height:22px;width:22px}
|
112
|
+
div.facebook .pp_description{margin:0 37px 0 0}
|
113
|
+
div.facebook .pp_loaderIcon{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/loader.gif") %>) center center no-repeat}
|
114
|
+
div.facebook .pp_arrow_previous{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) 0 -71px no-repeat;height:22px;margin-top:0;width:22px}
|
115
|
+
div.facebook .pp_arrow_previous.disabled{background-position:0 -96px;cursor:default}
|
116
|
+
div.facebook .pp_arrow_next{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -32px -71px no-repeat;height:22px;margin-top:0;width:22px}
|
117
|
+
div.facebook .pp_arrow_next.disabled{background-position:-32px -96px;cursor:default}
|
118
|
+
div.facebook .pp_nav{margin-top:0}
|
119
|
+
div.facebook .pp_nav p{font-size:15px;padding:0 3px 0 4px}
|
120
|
+
div.facebook .pp_nav .pp_play{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -1px -123px no-repeat;height:22px;width:22px}
|
121
|
+
div.facebook .pp_nav .pp_pause{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -32px -123px no-repeat;height:22px;width:22px}
|
122
|
+
div.facebook .pp_next:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/btnNext.png") %>) center right no-repeat;cursor:pointer}
|
123
|
+
div.facebook .pp_previous:hover{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/btnPrevious.png") %>) center left no-repeat;cursor:pointer}
|
124
|
+
div.facebook .pp_bottom .pp_left{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -88px -80px no-repeat}
|
125
|
+
div.facebook .pp_bottom .pp_middle{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png") %>) top left repeat-x}
|
126
|
+
div.facebook .pp_bottom .pp_right{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/sprite.png") %>) -110px -80px no-repeat}
|
127
|
+
div.pp_pic_holder a:focus{outline:none}
|
128
|
+
div.pp_overlay{background:#000;display:none;left:0;position:absolute;top:0;width:100%;z-index:9500}
|
129
|
+
div.pp_pic_holder{display:none;position:absolute;width:100px;z-index:10000}
|
130
|
+
.pp_content{height:40px;min-width:40px}
|
131
|
+
* html .pp_content{width:40px}
|
132
|
+
.pp_content_container{position:relative;text-align:left;width:100%}
|
133
|
+
.pp_content_container .pp_left{padding-left:20px}
|
134
|
+
.pp_content_container .pp_right{padding-right:20px}
|
135
|
+
.pp_content_container .pp_details{float:left;margin:10px 0 2px}
|
136
|
+
.pp_description{display:none;margin:0}
|
137
|
+
.pp_social{float:left;margin:0}
|
138
|
+
.pp_social .facebook{float:left;margin-left:5px;overflow:hidden;width:55px}
|
139
|
+
.pp_social .twitter{float:left}
|
140
|
+
.pp_nav{clear:right;float:left;margin:3px 10px 0 0}
|
141
|
+
.pp_nav p{float:left;margin:2px 4px;white-space:nowrap}
|
142
|
+
.pp_nav .pp_play,.pp_nav .pp_pause{float:left;margin-right:4px;text-indent:-10000px}
|
143
|
+
a.pp_arrow_previous,a.pp_arrow_next{display:block;float:left;height:15px;margin-top:3px;overflow:hidden;text-indent:-10000px;width:14px}
|
144
|
+
.pp_hoverContainer{position:absolute;top:0;width:100%;z-index:2000}
|
145
|
+
.pp_gallery{display:none;left:50%;margin-top:-50px;position:absolute;z-index:10000}
|
146
|
+
.pp_gallery div{float:left;overflow:hidden;position:relative}
|
147
|
+
.pp_gallery ul{float:left;height:35px;margin:0 0 0 5px;padding:0;position:relative;white-space:nowrap}
|
148
|
+
.pp_gallery ul a{border:1px rgba(0,0,0,0.5) solid;display:block;float:left;height:33px;overflow:hidden}
|
149
|
+
.pp_gallery ul a img{border:0}
|
150
|
+
.pp_gallery li{display:block;float:left;margin:0 5px 0 0;padding:0}
|
151
|
+
.pp_gallery li.default a{background: url(<%= asset_path("sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif") %>) 0 0 no-repeat;display:block;height:33px;width:50px}
|
152
|
+
.pp_gallery .pp_arrow_previous,.pp_gallery .pp_arrow_next{margin-top:7px!important}
|
153
|
+
a.pp_next{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/btnNext.png") %>) 10000px 10000px no-repeat;display:block;float:right;height:100%;text-indent:-10000px;width:49%}
|
154
|
+
a.pp_previous{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/btnNext.png") %>) 10000px 10000px no-repeat;display:block;float:left;height:100%;text-indent:-10000px;width:49%}
|
155
|
+
a.pp_expand,a.pp_contract{cursor:pointer;display:none;height:20px;position:absolute;right:30px;text-indent:-10000px;top:10px;width:20px;z-index:20000}
|
156
|
+
a.pp_close{display:block;line-height:22px;position:absolute;right:0;text-indent:-10000px;top:0}
|
157
|
+
.pp_loaderIcon{display:block;height:24px;left:50%;margin:-12px 0 0 -12px;position:absolute;top:50%;width:24px}
|
158
|
+
#pp_full_res{line-height:1!important}
|
159
|
+
#pp_full_res .pp_inline{text-align:left}
|
160
|
+
#pp_full_res .pp_inline p{margin:0 0 15px}
|
161
|
+
div.ppt{color:#fff;display:none;font-size:17px;margin:0 0 5px 15px;z-index:9999}
|
162
|
+
div.pp_default .pp_content,div.light_rounded .pp_content{background-color:#fff}
|
163
|
+
div.pp_default #pp_full_res .pp_inline,div.light_rounded .pp_content .ppt,div.light_rounded #pp_full_res .pp_inline,div.light_square .pp_content .ppt,div.light_square #pp_full_res .pp_inline,div.facebook .pp_content .ppt,div.facebook #pp_full_res .pp_inline{color:#000}
|
164
|
+
div.pp_default .pp_gallery ul li a:hover,div.pp_default .pp_gallery ul li.selected a,.pp_gallery ul a:hover,.pp_gallery li.selected a{border-color:#fff}
|
165
|
+
div.pp_default .pp_details,div.light_rounded .pp_details,div.dark_rounded .pp_details,div.dark_square .pp_details,div.light_square .pp_details,div.facebook .pp_details{position:relative}
|
166
|
+
div.light_rounded .pp_top .pp_middle,div.light_rounded .pp_content_container .pp_left,div.light_rounded .pp_content_container .pp_right,div.light_rounded .pp_bottom .pp_middle,div.light_square .pp_left,div.light_square .pp_middle,div.light_square .pp_right,div.light_square .pp_content,div.facebook .pp_content{background:#fff}
|
167
|
+
div.light_rounded .pp_description,div.light_square .pp_description{margin-right:85px}
|
168
|
+
div.light_rounded .pp_gallery a.pp_arrow_previous,div.light_rounded .pp_gallery a.pp_arrow_next,div.dark_rounded .pp_gallery a.pp_arrow_previous,div.dark_rounded .pp_gallery a.pp_arrow_next,div.dark_square .pp_gallery a.pp_arrow_previous,div.dark_square .pp_gallery a.pp_arrow_next,div.light_square .pp_gallery a.pp_arrow_previous,div.light_square .pp_gallery a.pp_arrow_next{margin-top:12px!important}
|
169
|
+
div.light_rounded .pp_arrow_previous.disabled,div.dark_rounded .pp_arrow_previous.disabled,div.dark_square .pp_arrow_previous.disabled,div.light_square .pp_arrow_previous.disabled{background-position:0 -87px;cursor:default}
|
170
|
+
div.light_rounded .pp_arrow_next.disabled,div.dark_rounded .pp_arrow_next.disabled,div.dark_square .pp_arrow_next.disabled,div.light_square .pp_arrow_next.disabled{background-position:-22px -87px;cursor:default}
|
171
|
+
div.light_rounded .pp_loaderIcon,div.light_square .pp_loaderIcon{background: url(<%= asset_path("sofa_gallery/prettyPhoto/light_rounded/loader.gif") %>) center center no-repeat}
|
172
|
+
div.dark_rounded .pp_top .pp_middle,div.dark_rounded .pp_content,div.dark_rounded .pp_bottom .pp_middle{background: url(<%= asset_path("sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png") %>) top left repeat}
|
173
|
+
div.dark_rounded .currentTextHolder,div.dark_square .currentTextHolder{color:#c4c4c4}
|
174
|
+
div.dark_rounded #pp_full_res .pp_inline,div.dark_square #pp_full_res .pp_inline{color:#fff}
|
175
|
+
.pp_top,.pp_bottom{height:20px;position:relative}
|
176
|
+
* html .pp_top,* html .pp_bottom{padding:0 20px}
|
177
|
+
.pp_top .pp_left,.pp_bottom .pp_left{height:20px;left:0;position:absolute;width:20px}
|
178
|
+
.pp_top .pp_middle,.pp_bottom .pp_middle{height:20px;left:20px;position:absolute;right:20px}
|
179
|
+
* html .pp_top .pp_middle,* html .pp_bottom .pp_middle{left:0;position:static}
|
180
|
+
.pp_top .pp_right,.pp_bottom .pp_right{height:20px;left:auto;position:absolute;right:0;top:0;width:20px}
|
181
|
+
.pp_fade,.pp_gallery li.default a img{display:none}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class Admin::Gallery::GalleriesController < Admin::Gallery::BaseController
|
2
|
+
|
3
|
+
before_filter :load_gallery, :except => [:index, :new, :create]
|
4
|
+
before_filter :build_gallery, :only => [:new, :create]
|
5
|
+
|
6
|
+
def index
|
7
|
+
if params[:category].present?
|
8
|
+
@galleries = Gallery::Gallery.for_category(params[:category]).all
|
9
|
+
else
|
10
|
+
@galleries = Gallery::Gallery.all
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def new
|
15
|
+
render
|
16
|
+
end
|
17
|
+
|
18
|
+
def create
|
19
|
+
@gallery.save!
|
20
|
+
flash[:notice] = 'Gallery created'
|
21
|
+
redirect_to :action => :index
|
22
|
+
rescue ActiveRecord::RecordInvalid
|
23
|
+
flash.now[:error] = 'Failed to create Gallery'
|
24
|
+
render :action => :new
|
25
|
+
end
|
26
|
+
|
27
|
+
def show
|
28
|
+
render
|
29
|
+
end
|
30
|
+
|
31
|
+
def edit
|
32
|
+
render
|
33
|
+
end
|
34
|
+
|
35
|
+
def update
|
36
|
+
@gallery.update_attributes!(params[:gallery])
|
37
|
+
flash[:notice] = 'Gallery updated'
|
38
|
+
redirect_to :action => :index
|
39
|
+
rescue ActiveRecord::RecordInvalid
|
40
|
+
flash.now[:error] = 'Failed to update Gallery'
|
41
|
+
render :action => :edit
|
42
|
+
end
|
43
|
+
|
44
|
+
def destroy
|
45
|
+
@gallery.destroy
|
46
|
+
flash[:notice] = 'Gallery deleted'
|
47
|
+
redirect_to :action => :index
|
48
|
+
end
|
49
|
+
|
50
|
+
protected
|
51
|
+
|
52
|
+
def load_gallery
|
53
|
+
@gallery = Gallery::Gallery.find(params[:id])
|
54
|
+
rescue ActiveRecord::RecordNotFound
|
55
|
+
flash[:error] = 'Gallery not found'
|
56
|
+
redirect_to :action => :index
|
57
|
+
end
|
58
|
+
|
59
|
+
def build_gallery
|
60
|
+
@gallery = Gallery::Gallery.new(params[:gallery])
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
class Admin::Gallery::PhotosController < Admin::Gallery::BaseController
|
2
|
+
|
3
|
+
before_filter :load_gallery
|
4
|
+
before_filter :load_photo, :only => [:edit, :update, :destroy, :crop]
|
5
|
+
before_filter :build_photo, :only => [:new, :create]
|
6
|
+
|
7
|
+
def index
|
8
|
+
@photos = @gallery.photos
|
9
|
+
end
|
10
|
+
|
11
|
+
def new
|
12
|
+
render
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
file_array = params[:gallery_photo][:image] || [nil]
|
17
|
+
|
18
|
+
file_array.each_with_index do |file, i|
|
19
|
+
file_params = params[:gallery_photo].merge(:image => file)
|
20
|
+
|
21
|
+
title = (file_params[:title].blank? && file_params[:image] ?
|
22
|
+
file_params[:image].original_filename :
|
23
|
+
file_params[:title]
|
24
|
+
)
|
25
|
+
title = title + " #{i + 1}" if file_params[:title] == title && file_array.size > 1
|
26
|
+
|
27
|
+
slug = (file_params[:slug].blank? && file_params[:image] ?
|
28
|
+
file_params[:image].original_filename.parameterize :
|
29
|
+
file_params[:slug]
|
30
|
+
)
|
31
|
+
slug = (slug + "-#{i + 1}") if file_params[:slug] == slug && file_array.size > 1
|
32
|
+
|
33
|
+
@photo = Gallery::Photo.new({:gallery => @gallery}.merge(file_params.merge(:title => title, :slug => slug) || {}))
|
34
|
+
@photo.save!
|
35
|
+
end
|
36
|
+
|
37
|
+
flash[:notice] = 'Photo created'
|
38
|
+
redirect_to :action => :index
|
39
|
+
rescue ActiveRecord::RecordInvalid
|
40
|
+
flash[:error] = 'Failed to create Photo'
|
41
|
+
render :action => :new
|
42
|
+
end
|
43
|
+
|
44
|
+
def edit
|
45
|
+
render
|
46
|
+
end
|
47
|
+
|
48
|
+
def update
|
49
|
+
@photo.update_attributes!(params[:gallery_photo])
|
50
|
+
flash[:notice] = 'Photo updated'
|
51
|
+
redirect_to :action => :index
|
52
|
+
rescue ActiveRecord::RecordInvalid
|
53
|
+
flash.now[:error] = 'Failed to updated Photo'
|
54
|
+
render :action => :edit
|
55
|
+
end
|
56
|
+
|
57
|
+
def destroy
|
58
|
+
@photo.destroy
|
59
|
+
flash[:notice] = 'Photo deleted'
|
60
|
+
redirect_to :action => :index
|
61
|
+
end
|
62
|
+
|
63
|
+
def reorder
|
64
|
+
(params[:gallery_photo] || []).each_with_index do |id, index|
|
65
|
+
if (photo = Gallery::Photo.find_by_id(id))
|
66
|
+
photo.update_attribute(:position, index)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
render :nothing => true
|
70
|
+
end
|
71
|
+
|
72
|
+
def crop
|
73
|
+
render
|
74
|
+
end
|
75
|
+
|
76
|
+
protected
|
77
|
+
|
78
|
+
def load_gallery
|
79
|
+
@gallery = Gallery::Gallery.find(params[:gallery_id])
|
80
|
+
rescue ActiveRecord::RecordNotFound
|
81
|
+
flash[:error] = 'Gallery not found'
|
82
|
+
redirect_to admin_gallery_galleries_path
|
83
|
+
end
|
84
|
+
|
85
|
+
def load_photo
|
86
|
+
@photo = @gallery.photos.find(params[:id])
|
87
|
+
rescue ActiveRecord::RecordNotFound
|
88
|
+
flash[:error] = 'Photo not found'
|
89
|
+
redirect_to :action => :index
|
90
|
+
end
|
91
|
+
|
92
|
+
def build_photo
|
93
|
+
@photo = Gallery::Photo.new({:gallery => @gallery}.merge(params[:sofa_gallery_photo] || {}))
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Gallery::GalleriesController < ApplicationController
|
2
|
+
|
3
|
+
def index
|
4
|
+
@galleries = Gallery::Gallery.all
|
5
|
+
rescue ActiveRecord::RecordNotFound
|
6
|
+
render :text => 'Gallery not found', :status => 404
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
@gallery = Gallery::Gallery.find(params[:id])
|
11
|
+
rescue ActiveRecord::RecordNotFound
|
12
|
+
render :text => 'Gallery not found', :status => 404
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Gallery::ApplicationHelper
|
2
|
+
|
3
|
+
def comfy_gallery_form_for(record_or_name_or_array, *args, &proc)
|
4
|
+
options = args.extract_options!
|
5
|
+
form_for(
|
6
|
+
record_or_name_or_array,
|
7
|
+
*(args << options.merge(:builder => ComfyGallery.config.form_builder.to_s.constantize)),
|
8
|
+
&proc
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
def render_gallery(slug, type = 'thumbnails')
|
13
|
+
@gallery = Gallery::Gallery.find_by_slug(slug)
|
14
|
+
if (@gallery)
|
15
|
+
render :partial => "gallery/#{type}"
|
16
|
+
else
|
17
|
+
render :text => 'Gallery not found', :status => 404
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def render_galleries(type = 'list_galleries')
|
22
|
+
@galleries = Gallery::Gallery.all
|
23
|
+
if (@galleries)
|
24
|
+
render :partial => "gallery/#{type}"
|
25
|
+
else
|
26
|
+
render :text => 'Gallery not found', :status => 404
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Gallery::Gallery < ActiveRecord::Base
|
2
|
+
|
3
|
+
cms_is_categorized if defined?(ComfortableMexicanSofa)
|
4
|
+
|
5
|
+
self.table_name = :gallery_galleries
|
6
|
+
|
7
|
+
# -- Relationships --------------------------------------------------------
|
8
|
+
has_many :photos, :dependent => :destroy
|
9
|
+
|
10
|
+
# -- Validations ----------------------------------------------------------
|
11
|
+
validates :title,
|
12
|
+
:presence => true
|
13
|
+
|
14
|
+
validates :slug,
|
15
|
+
:presence => true,
|
16
|
+
:uniqueness => true,
|
17
|
+
:format => { :with => /^\w[a-z0-9_-]*$/i }
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
class Gallery::Photo < ActiveRecord::Base
|
2
|
+
|
3
|
+
self.table_name = :gallery_photos
|
4
|
+
|
5
|
+
upload_options = (ComfyGallery.config.upload_options || {}).merge(
|
6
|
+
:styles => lambda { |image|
|
7
|
+
g = image.instance.gallery
|
8
|
+
f_settings = "#{g.full_width}x#{g.full_height}#{g.force_ratio_full?? '#' : '>'}"
|
9
|
+
t_settings = "#{g.thumb_width}x#{g.thumb_height}#{g.force_ratio_thumb?? '#' : '>'}"
|
10
|
+
{
|
11
|
+
:full => { :geometry => f_settings, :processors => [:full_cropper] },
|
12
|
+
:thumb => { :geometry => t_settings, :processors => [:thumb_cropper] },
|
13
|
+
:admin_full => '800x600>',
|
14
|
+
:admin_thumb => '40x30#'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
)
|
18
|
+
has_attached_file :image, upload_options
|
19
|
+
|
20
|
+
attr_accessor :thumb_crop_x, :thumb_crop_y, :thumb_crop_w, :thumb_crop_h,
|
21
|
+
:full_crop_x, :full_crop_y, :full_crop_w, :full_crop_h
|
22
|
+
|
23
|
+
# -- Relationships --------------------------------------------------------
|
24
|
+
belongs_to :gallery
|
25
|
+
|
26
|
+
# -- Callbacks ------------------------------------------------------------
|
27
|
+
before_create :assign_position
|
28
|
+
after_update :reprocess_image, :if => :cropping?
|
29
|
+
|
30
|
+
# -- Validations ----------------------------------------------------------
|
31
|
+
validates :gallery_id,
|
32
|
+
:presence => true
|
33
|
+
validates :slug,
|
34
|
+
:presence => true,
|
35
|
+
:uniqueness => true,
|
36
|
+
:format => { :with => /^\w[a-z0-9_-]*$/i }
|
37
|
+
validates_attachment_presence :image,
|
38
|
+
:message => 'There was no file uploaded!'
|
39
|
+
validates_attachment_content_type :image,
|
40
|
+
:content_type => %w(image/jpeg image/pjpeg image/gif image/png image/x-png),
|
41
|
+
:message => 'Please only upload .jpg, .jpeg, .gif or .png files.'
|
42
|
+
validates_attachment_size :image,
|
43
|
+
:less_than => 5.megabytes
|
44
|
+
|
45
|
+
# -- Instance Methods -----------------------------------------------------
|
46
|
+
def image_geometry(style = :original)
|
47
|
+
@geometry ||= {}
|
48
|
+
@geometry[style] ||= Paperclip::Geometry.from_file(image.path(style))
|
49
|
+
end
|
50
|
+
|
51
|
+
def force_aspect?
|
52
|
+
self.gallery.force_ratio_full? || self.gallery.force_ratio_thumb?
|
53
|
+
end
|
54
|
+
|
55
|
+
def cropping?
|
56
|
+
cropping_thumb? || cropping_full?
|
57
|
+
end
|
58
|
+
|
59
|
+
def cropping_thumb?
|
60
|
+
!thumb_crop_x.blank? && !thumb_crop_y.blank? && !thumb_crop_w.blank? && !thumb_crop_h.blank?
|
61
|
+
end
|
62
|
+
|
63
|
+
def cropping_full?
|
64
|
+
!full_crop_x.blank? && !full_crop_y.blank? && !full_crop_w.blank? && !full_crop_h.blank?
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def assign_position
|
70
|
+
max = self.gallery.photos.maximum(:position)
|
71
|
+
self.position = max ? max + 1 : 0
|
72
|
+
end
|
73
|
+
|
74
|
+
def reprocess_image
|
75
|
+
image.reprocess!
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= stylesheet_link_tag 'sofa_gallery/admin' %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= form.text_field :title, :id => (@gallery.new_record?? 'slugify' : nil)%>
|
2
|
+
<%= form.text_field :slug, :id => 'slug' %>
|
3
|
+
<%= form.text_area :description%>
|
4
|
+
|
5
|
+
<%= form.text_field :full_width %>
|
6
|
+
<%= form.text_field :full_height %>
|
7
|
+
<%= form.check_box :force_ratio_full, :label => "Force Ratio" %>
|
8
|
+
<%= form.text_field :thumb_width %>
|
9
|
+
<%= form.text_field :thumb_height %>
|
10
|
+
<%= form.check_box :force_ratio_thumb, :label => "Force Ratio" %>
|
11
|
+
|
12
|
+
<%= render :partial => 'cms_admin/categories/form', :object => form if defined?(ComfortableMexicanSofa) %>
|
13
|
+
|
14
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
15
|
+
<%= link_to "Cancel", admin_gallery_galleries_path, :id => 'cancel_btn' %>
|
16
|
+
<span>or</span>
|
17
|
+
<%= form.submit "Save", :disable_builder => true%>
|
18
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%= link_to 'Add new gallery', new_admin_gallery_gallery_path, :class => 'big button' %>
|
2
|
+
|
3
|
+
<h1>Galleries</h1>
|
4
|
+
|
5
|
+
<%= render :partial => 'cms_admin/categories/index', :object => 'SofaGallery::Gallery' if defined?(ComfortableMexicanSofa) %>
|
6
|
+
|
7
|
+
<br />
|
8
|
+
|
9
|
+
<table class='formatted'>
|
10
|
+
<tr>
|
11
|
+
<th> Preview </th>
|
12
|
+
<th> Name </th>
|
13
|
+
<th> URL </th>
|
14
|
+
<th> Embed Code </th>
|
15
|
+
<th> Actions </th>
|
16
|
+
</tr>
|
17
|
+
<% @galleries.each do |gallery| %>
|
18
|
+
<tr>
|
19
|
+
<td class='preview'>
|
20
|
+
<% gallery.photos.limit(1).each do |photo| %>
|
21
|
+
<%= image_tag(photo.image.url(:admin_thumb)) %>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
<td class='main'>
|
25
|
+
<%= link_to gallery.title, admin_gallery_gallery_photos_path(gallery) %>
|
26
|
+
</td>
|
27
|
+
<td>
|
28
|
+
<%= link_to gallery_path(gallery), gallery_path(gallery), :target => '_blank' %>
|
29
|
+
</td>
|
30
|
+
<td class='embed'>
|
31
|
+
{{ cms:helper:render_gallery:<%= gallery.slug %> }}
|
32
|
+
</td>
|
33
|
+
<td class='action_links'>
|
34
|
+
<%= link_to 'Show Photos', admin_gallery_gallery_photos_path(gallery) %>
|
35
|
+
<%= link_to 'Edit', edit_admin_gallery_gallery_path(gallery) %>
|
36
|
+
<%= link_to 'Delete', admin_gallery_gallery_path(gallery), :method => :delete, :confirm => 'Are you sure?' %>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
40
|
+
</table>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= form.text_field :title, :id => (@photo.new_record?? 'slugify' : nil) %>
|
2
|
+
<%= form.text_field :slug, :id => 'slug' %>
|
3
|
+
<% if @photo.image? && @photo.id.present? %>
|
4
|
+
<%= form.simple_field 'Current Image' do %>
|
5
|
+
<%= image_tag(@photo.image.url(:thumb)) %>
|
6
|
+
<br/>
|
7
|
+
<%= link_to 'Crop Image', crop_admin_gallery_gallery_photo_path(@gallery, @photo) if @photo.force_aspect? %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<%= form.file_field :image, :multiple => true %>
|
11
|
+
<%= form.text_area :description %>
|
12
|
+
<%= form.simple_field nil, nil, :class => 'submit_element' do %>
|
13
|
+
<%= link_to "Cancel", admin_gallery_gallery_photos_path(@photo.gallery), :id => 'cancel_btn' %>
|
14
|
+
<span>or</span>
|
15
|
+
<%= form.submit "Save", :disable_builder => true%>
|
16
|
+
<% end %>
|