sofa_gallery 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/Gemfile +4 -2
  2. data/Gemfile.lock +67 -61
  3. data/VERSION +1 -1
  4. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnNext.png +0 -0
  5. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png +0 -0
  6. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png +0 -0
  7. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/default_thumbnail.gif +0 -0
  8. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/loader.gif +0 -0
  9. data/app/assets/images/sofa_gallery/prettyPhoto/dark_rounded/sprite.png +0 -0
  10. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnNext.png +0 -0
  11. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/btnPrevious.png +0 -0
  12. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/contentPattern.png +0 -0
  13. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/default_thumbnail.gif +0 -0
  14. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/loader.gif +0 -0
  15. data/app/assets/images/sofa_gallery/prettyPhoto/dark_square/sprite.png +0 -0
  16. data/app/assets/images/sofa_gallery/prettyPhoto/default/default_thumb.png +0 -0
  17. data/app/assets/images/sofa_gallery/prettyPhoto/default/loader.gif +0 -0
  18. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite.png +0 -0
  19. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_next.png +0 -0
  20. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_prev.png +0 -0
  21. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_x.png +0 -0
  22. data/app/assets/images/sofa_gallery/prettyPhoto/default/sprite_y.png +0 -0
  23. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnNext.png +0 -0
  24. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/btnPrevious.png +0 -0
  25. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png +0 -0
  26. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png +0 -0
  27. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternRight.png +0 -0
  28. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/contentPatternTop.png +0 -0
  29. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif +0 -0
  30. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/loader.gif +0 -0
  31. data/app/assets/images/sofa_gallery/prettyPhoto/facebook/sprite.png +0 -0
  32. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnNext.png +0 -0
  33. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png +0 -0
  34. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/default_thumbnail.gif +0 -0
  35. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/loader.gif +0 -0
  36. data/app/assets/images/sofa_gallery/prettyPhoto/light_rounded/sprite.png +0 -0
  37. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnNext.png +0 -0
  38. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/btnPrevious.png +0 -0
  39. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/default_thumbnail.gif +0 -0
  40. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/loader.gif +0 -0
  41. data/app/assets/images/sofa_gallery/prettyPhoto/light_square/sprite.png +0 -0
  42. data/app/assets/javascripts/sofa_gallery/admin.js +72 -0
  43. data/app/assets/javascripts/sofa_gallery/carousel.js +44 -0
  44. data/app/assets/javascripts/sofa_gallery/thumbnails.js +85 -0
  45. data/app/assets/stylesheets/sofa_gallery/admin.css +13 -0
  46. data/app/assets/stylesheets/sofa_gallery/application.css +0 -1
  47. data/app/assets/stylesheets/sofa_gallery/carousel.css +186 -0
  48. data/app/assets/stylesheets/sofa_gallery/tango/credits.txt +1 -0
  49. data/app/assets/stylesheets/sofa_gallery/tango/next-horizontal.png +0 -0
  50. data/app/assets/stylesheets/sofa_gallery/tango/next-vertical.png +0 -0
  51. data/app/assets/stylesheets/sofa_gallery/tango/prev-horizontal.png +0 -0
  52. data/app/assets/stylesheets/sofa_gallery/tango/prev-vertical.png +0 -0
  53. data/app/assets/stylesheets/sofa_gallery/thumbnails.css.scss +182 -0
  54. data/app/controllers/application_controller.rb +1 -0
  55. data/app/controllers/sofa_gallery/admin/base_controller.rb +3 -0
  56. data/app/controllers/{gallery_admin → sofa_gallery/admin}/galleries_controller.rb +4 -4
  57. data/app/controllers/{gallery_admin → sofa_gallery/admin}/photos_controller.rb +6 -6
  58. data/app/controllers/sofa_gallery/galleries_controller.rb +9 -0
  59. data/app/helpers/sofa_gallery_helper.rb +11 -1
  60. data/app/models/{sofa → sofa_gallery}/gallery.rb +2 -2
  61. data/app/models/{sofa → sofa_gallery}/photo.rb +18 -9
  62. data/app/views/layouts/gallery_admin/application.html.erb +2 -2
  63. data/app/views/sofa_gallery/_carousel.html.erb +17 -0
  64. data/app/views/sofa_gallery/_thumbnails.html.erb +19 -0
  65. data/app/views/sofa_gallery/admin/_html_head.html.erb +1 -0
  66. data/app/views/sofa_gallery/admin/_navigation.html.erb +5 -0
  67. data/app/views/sofa_gallery/admin/galleries/_form.html.erb +17 -0
  68. data/app/views/sofa_gallery/admin/galleries/edit.html.erb +5 -0
  69. data/app/views/sofa_gallery/admin/galleries/index.html.erb +48 -0
  70. data/app/views/sofa_gallery/admin/galleries/new.html.erb +5 -0
  71. data/app/views/sofa_gallery/admin/photos/_form.html.erb +16 -0
  72. data/app/views/sofa_gallery/admin/photos/crop.html.erb +64 -0
  73. data/app/views/sofa_gallery/admin/photos/edit.html.erb +5 -0
  74. data/app/views/{gallery_admin → sofa_gallery/admin}/photos/index.html.erb +4 -4
  75. data/app/views/sofa_gallery/admin/photos/new.html.erb +5 -0
  76. data/app/views/sofa_gallery/galleries/show.html.erb +1 -0
  77. data/config/routes.rb +12 -7
  78. data/db/migrate/01_create_sofa_gallery.rb +15 -12
  79. data/lib/paperclip_processors/cropper.rb +16 -3
  80. data/lib/sofa_gallery/configuration.rb +4 -4
  81. data/lib/sofa_gallery/engine.rb +2 -1
  82. data/sofa_gallery.gemspec +89 -30
  83. data/test/fixtures/files/default2.jpg +0 -0
  84. data/test/fixtures/{sofa → sofa_gallery}/galleries.yml +4 -2
  85. data/test/fixtures/{sofa → sofa_gallery}/photos.yml +0 -0
  86. data/test/functional/admin/galleries_controller_test.rb +87 -0
  87. data/test/functional/admin/photos_controller_test.rb +177 -0
  88. data/test/functional/galleries_controller_test.rb +8 -78
  89. data/test/test_helper.rb +4 -1
  90. data/test/unit/configuration_test.rb +1 -1
  91. data/test/unit/gallery_test.rb +6 -6
  92. data/test/unit/photo_test.rb +5 -5
  93. metadata +150 -79
  94. data/app/assets/javascripts/sofa_gallery/jquery.js +0 -18
  95. data/app/assets/javascripts/sofa_gallery/jquery_ui.js +0 -248
  96. data/app/assets/javascripts/sofa_gallery/rails.js +0 -315
  97. data/app/controllers/gallery_admin/base_controller.rb +0 -3
  98. data/app/views/gallery_admin/_navigation.html.erb +0 -1
  99. data/app/views/gallery_admin/galleries/_form.html.erb +0 -11
  100. data/app/views/gallery_admin/galleries/edit.html.erb +0 -5
  101. data/app/views/gallery_admin/galleries/index.html.erb +0 -28
  102. data/app/views/gallery_admin/galleries/new.html.erb +0 -5
  103. data/app/views/gallery_admin/photos/_form.html.erb +0 -13
  104. data/app/views/gallery_admin/photos/crop.html.erb +0 -32
  105. data/app/views/gallery_admin/photos/edit.html.erb +0 -5
  106. data/app/views/gallery_admin/photos/new.html.erb +0 -5
  107. data/test/functional/photos_controller_test.rb +0 -123
@@ -0,0 +1,186 @@
1
+ .jcarousel-skin-tango .jcarousel-container {
2
+ -moz-border-radius: 10px;
3
+ -webkit-border-radius: 10px;
4
+ border-radius: 10px;
5
+ background: #F0F6F9;
6
+ border: 1px solid #346F97;
7
+ }
8
+
9
+ .jcarousel-skin-tango .jcarousel-direction-rtl {
10
+ direction: rtl;
11
+ }
12
+
13
+ .jcarousel-skin-tango .jcarousel-container-horizontal {
14
+ width: 245px;
15
+ padding: 20px 40px;
16
+ }
17
+
18
+ .jcarousel-skin-tango .jcarousel-container-vertical {
19
+ width: 75px;
20
+ height: 245px;
21
+ padding: 40px 20px;
22
+ }
23
+
24
+ .jcarousel-skin-tango .jcarousel-clip {
25
+ overflow: hidden;
26
+ }
27
+
28
+ .jcarousel-skin-tango .jcarousel-clip-horizontal {
29
+ width: 245px;
30
+ height: 75px;
31
+ }
32
+
33
+ .jcarousel-skin-tango .jcarousel-clip-vertical {
34
+ width: 75px;
35
+ height: 245px;
36
+ }
37
+
38
+ .jcarousel-skin-tango .jcarousel-item {
39
+ width: 75px;
40
+ height: 75px;
41
+ }
42
+
43
+ .jcarousel-skin-tango .jcarousel-item-horizontal {
44
+ margin-left: 0;
45
+ margin-right: 10px;
46
+ }
47
+
48
+ .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-item-horizontal {
49
+ margin-left: 10px;
50
+ margin-right: 0;
51
+ }
52
+
53
+ .jcarousel-skin-tango .jcarousel-item-vertical {
54
+ margin-bottom: 10px;
55
+ }
56
+
57
+ .jcarousel-skin-tango .jcarousel-item-placeholder {
58
+ background: #fff;
59
+ color: #000;
60
+ }
61
+
62
+ /**
63
+ * Horizontal Buttons
64
+ */
65
+ .jcarousel-skin-tango .jcarousel-next-horizontal {
66
+ position: absolute;
67
+ top: 43px;
68
+ right: 5px;
69
+ width: 32px;
70
+ height: 32px;
71
+ cursor: pointer;
72
+ background: transparent url((/assets/sofa_gallery/tango/next-horizontal.png) no-repeat 0 0;
73
+ }
74
+
75
+ .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-next-horizontal {
76
+ left: 5px;
77
+ right: auto;
78
+ background-image: url((/assets/sofa_gallery/tango/prev-horizontal.png);
79
+ }
80
+
81
+ .jcarousel-skin-tango .jcarousel-next-horizontal:hover,
82
+ .jcarousel-skin-tango .jcarousel-next-horizontal:focus {
83
+ background-position: -32px 0;
84
+ }
85
+
86
+ .jcarousel-skin-tango .jcarousel-next-horizontal:active {
87
+ background-position: -64px 0;
88
+ }
89
+
90
+ .jcarousel-skin-tango .jcarousel-next-disabled-horizontal,
91
+ .jcarousel-skin-tango .jcarousel-next-disabled-horizontal:hover,
92
+ .jcarousel-skin-tango .jcarousel-next-disabled-horizontal:focus,
93
+ .jcarousel-skin-tango .jcarousel-next-disabled-horizontal:active {
94
+ cursor: default;
95
+ background-position: -96px 0;
96
+ }
97
+
98
+ .jcarousel-skin-tango .jcarousel-prev-horizontal {
99
+ position: absolute;
100
+ top: 43px;
101
+ left: 5px;
102
+ width: 32px;
103
+ height: 32px;
104
+ cursor: pointer;
105
+ background: transparent url((/assets/sofa_gallery/tango/prev-horizontal.png) no-repeat 0 0;
106
+ }
107
+
108
+ .jcarousel-skin-tango .jcarousel-direction-rtl .jcarousel-prev-horizontal {
109
+ left: auto;
110
+ right: 5px;
111
+ background-image: url((/assets/sofa_gallery/tango/next-horizontal.png);
112
+ }
113
+
114
+ .jcarousel-skin-tango .jcarousel-prev-horizontal:hover,
115
+ .jcarousel-skin-tango .jcarousel-prev-horizontal:focus {
116
+ background-position: -32px 0;
117
+ }
118
+
119
+ .jcarousel-skin-tango .jcarousel-prev-horizontal:active {
120
+ background-position: -64px 0;
121
+ }
122
+
123
+ .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal,
124
+ .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal:hover,
125
+ .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal:focus,
126
+ .jcarousel-skin-tango .jcarousel-prev-disabled-horizontal:active {
127
+ cursor: default;
128
+ background-position: -96px 0;
129
+ }
130
+
131
+ /**
132
+ * Vertical Buttons
133
+ */
134
+ .jcarousel-skin-tango .jcarousel-next-vertical {
135
+ position: absolute;
136
+ bottom: 5px;
137
+ left: 43px;
138
+ width: 32px;
139
+ height: 32px;
140
+ cursor: pointer;
141
+ background: transparent url((/assets/sofa_gallery/tango/next-vertical.png) no-repeat 0 0;
142
+ }
143
+
144
+ .jcarousel-skin-tango .jcarousel-next-vertical:hover,
145
+ .jcarousel-skin-tango .jcarousel-next-vertical:focus {
146
+ background-position: 0 -32px;
147
+ }
148
+
149
+ .jcarousel-skin-tango .jcarousel-next-vertical:active {
150
+ background-position: 0 -64px;
151
+ }
152
+
153
+ .jcarousel-skin-tango .jcarousel-next-disabled-vertical,
154
+ .jcarousel-skin-tango .jcarousel-next-disabled-vertical:hover,
155
+ .jcarousel-skin-tango .jcarousel-next-disabled-vertical:focus,
156
+ .jcarousel-skin-tango .jcarousel-next-disabled-vertical:active {
157
+ cursor: default;
158
+ background-position: 0 -96px;
159
+ }
160
+
161
+ .jcarousel-skin-tango .jcarousel-prev-vertical {
162
+ position: absolute;
163
+ top: 5px;
164
+ left: 43px;
165
+ width: 32px;
166
+ height: 32px;
167
+ cursor: pointer;
168
+ background: transparent url((/assets/sofa_gallery/tango/prev-vertical.png) no-repeat 0 0;
169
+ }
170
+
171
+ .jcarousel-skin-tango .jcarousel-prev-vertical:hover,
172
+ .jcarousel-skin-tango .jcarousel-prev-vertical:focus {
173
+ background-position: 0 -32px;
174
+ }
175
+
176
+ .jcarousel-skin-tango .jcarousel-prev-vertical:active {
177
+ background-position: 0 -64px;
178
+ }
179
+
180
+ .jcarousel-skin-tango .jcarousel-prev-disabled-vertical,
181
+ .jcarousel-skin-tango .jcarousel-prev-disabled-vertical:hover,
182
+ .jcarousel-skin-tango .jcarousel-prev-disabled-vertical:focus,
183
+ .jcarousel-skin-tango .jcarousel-prev-disabled-vertical:active {
184
+ cursor: default;
185
+ background-position: 0 -96px;
186
+ }
@@ -0,0 +1 @@
1
+ Button images copyright by Tango Icon Library Team (http://tango.freedesktop.org/Tango_Icon_Library)
@@ -0,0 +1,182 @@
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
+ padding: 5px;
9
+ text-align: center;
10
+ margin: 0 10px 10px 0;
11
+ border: none; }
12
+
13
+ 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}
14
+ div.pp_default .pp_top .pp_left{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) -78px -93px no-repeat}
15
+ div.pp_default .pp_top .pp_middle{background: asset-url('sofa_gallery/prettyPhoto/default/sprite_x.png', image) top left repeat-x}
16
+ div.pp_default .pp_top .pp_right{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) -112px -93px no-repeat}
17
+ div.pp_default .pp_content .ppt{color:#f8f8f8}
18
+ div.pp_default .pp_content_container .pp_left{background: asset-url('sofa_gallery/prettyPhoto/default/sprite_y.png', image) -7px 0 repeat-y;padding-left:13px}
19
+ div.pp_default .pp_content_container .pp_right{background: asset-url('sofa_gallery/prettyPhoto/default/sprite_y.png', image) top right repeat-y;padding-right:13px}
20
+ div.pp_default .pp_next:hover{background: asset-url('sofa_gallery/prettyPhoto/default/sprite_next.png', image) center right no-repeat;cursor:pointer}
21
+ div.pp_default .pp_previous:hover{background: asset-url('sofa_gallery/prettyPhoto/default/sprite_prev.png', image) center left no-repeat;cursor:pointer}
22
+ div.pp_default .pp_expand{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) 0 -29px no-repeat;cursor:pointer;height:28px;width:28px}
23
+ div.pp_default .pp_expand:hover{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) 0 -56px no-repeat;cursor:pointer}
24
+ div.pp_default .pp_contract{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) 0 -84px no-repeat;cursor:pointer;height:28px;width:28px}
25
+ div.pp_default .pp_contract:hover{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) 0 -113px no-repeat;cursor:pointer}
26
+ div.pp_default .pp_close{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) 2px 1px no-repeat;cursor:pointer;height:30px;width:30px}
27
+ div.pp_default .pp_gallery ul li a{background: asset-url('sofa_gallery/prettyPhoto/default/default_thumb.png', image) center center #f8f8f8;border:1px solid #aaa}
28
+ div.pp_default .pp_social{margin-top:7px}
29
+ div.pp_default .pp_gallery a.pp_arrow_previous,div.pp_default .pp_gallery a.pp_arrow_next{left:auto;position:static}
30
+ div.pp_default .pp_nav .pp_play,div.pp_default .pp_nav .pp_pause{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) -51px 1px no-repeat;height:30px;width:30px}
31
+ div.pp_default .pp_nav .pp_pause{background-position:-51px -29px}
32
+ div.pp_default a.pp_arrow_previous,div.pp_default a.pp_arrow_next{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) -31px -3px no-repeat;height:20px;margin:4px 0 0;width:20px}
33
+ div.pp_default a.pp_arrow_next{background-position:-82px -3px;left:52px}
34
+ div.pp_default .pp_content_container .pp_details{margin-top:5px}
35
+ div.pp_default .pp_nav{clear:none;height:30px;position:relative;width:110px}
36
+ 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}
37
+ 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}
38
+ div.pp_default .pp_description{font-size:11px;font-weight:700;line-height:14px;margin:5px 50px 5px 0}
39
+ div.pp_default .pp_bottom .pp_left{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) -78px -127px no-repeat}
40
+ div.pp_default .pp_bottom .pp_middle{background: asset-url('sofa_gallery/prettyPhoto/default/sprite_x.png', image) bottom left repeat-x}
41
+ div.pp_default .pp_bottom .pp_right{background: asset-url('sofa_gallery/prettyPhoto/default/sprite.png', image) -112px -127px no-repeat}
42
+ div.pp_default .pp_loaderIcon{background: asset-url('sofa_gallery/prettyPhoto/default/loader.gif', image) center center no-repeat}
43
+ div.light_rounded .pp_top .pp_left{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -88px -53px no-repeat}
44
+ div.light_rounded .pp_top .pp_right{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -110px -53px no-repeat}
45
+ div.light_rounded .pp_next:hover{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/btnNext.png', image) center right no-repeat;cursor:pointer}
46
+ div.light_rounded .pp_previous:hover{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/btnPrevious.png', image) center left no-repeat;cursor:pointer}
47
+ div.light_rounded .pp_expand{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -31px -26px no-repeat;cursor:pointer}
48
+ div.light_rounded .pp_expand:hover{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -31px -47px no-repeat;cursor:pointer}
49
+ div.light_rounded .pp_contract{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) 0 -26px no-repeat;cursor:pointer}
50
+ div.light_rounded .pp_contract:hover{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) 0 -47px no-repeat;cursor:pointer}
51
+ div.light_rounded .pp_close{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
52
+ div.light_rounded .pp_nav .pp_play{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -1px -100px no-repeat;height:15px;width:14px}
53
+ div.light_rounded .pp_nav .pp_pause{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -24px -100px no-repeat;height:15px;width:14px}
54
+ div.light_rounded .pp_arrow_previous{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) 0 -71px no-repeat}
55
+ div.light_rounded .pp_arrow_next{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -22px -71px no-repeat}
56
+ div.light_rounded .pp_bottom .pp_left{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -88px -80px no-repeat}
57
+ div.light_rounded .pp_bottom .pp_right{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/sprite.png', image) -110px -80px no-repeat}
58
+ div.dark_rounded .pp_top .pp_left{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -88px -53px no-repeat}
59
+ div.dark_rounded .pp_top .pp_right{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -110px -53px no-repeat}
60
+ div.dark_rounded .pp_content_container .pp_left{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png', image) top left repeat-y}
61
+ div.dark_rounded .pp_content_container .pp_right{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png', image) top right repeat-y}
62
+ div.dark_rounded .pp_next:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/btnNext.png', image) center right no-repeat;cursor:pointer}
63
+ div.dark_rounded .pp_previous:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/btnPrevious.png', image) center left no-repeat;cursor:pointer}
64
+ div.dark_rounded .pp_expand{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -31px -26px no-repeat;cursor:pointer}
65
+ div.dark_rounded .pp_expand:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -31px -47px no-repeat;cursor:pointer}
66
+ div.dark_rounded .pp_contract{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) 0 -26px no-repeat;cursor:pointer}
67
+ div.dark_rounded .pp_contract:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) 0 -47px no-repeat;cursor:pointer}
68
+ div.dark_rounded .pp_close{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
69
+ div.dark_rounded .pp_description{color:#fff;margin-right:85px}
70
+ div.dark_rounded .pp_nav .pp_play{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -1px -100px no-repeat;height:15px;width:14px}
71
+ div.dark_rounded .pp_nav .pp_pause{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -24px -100px no-repeat;height:15px;width:14px}
72
+ div.dark_rounded .pp_arrow_previous{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) 0 -71px no-repeat}
73
+ div.dark_rounded .pp_arrow_next{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -22px -71px no-repeat}
74
+ div.dark_rounded .pp_bottom .pp_left{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -88px -80px no-repeat}
75
+ div.dark_rounded .pp_bottom .pp_right{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/sprite.png', image) -110px -80px no-repeat}
76
+ div.dark_rounded .pp_loaderIcon{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/loader.gif', image) center center no-repeat}
77
+ div.dark_square .pp_left,div.dark_square .pp_middle,div.dark_square .pp_right,div.dark_square .pp_content{background:#000}
78
+ div.dark_square .pp_description{color:#fff;margin:0 85px 0 0}
79
+ div.dark_square .pp_loaderIcon{background: asset-url('sofa_gallery/prettyPhoto/dark_square/loader.gif', image) center center no-repeat}
80
+ div.dark_square .pp_expand{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) -31px -26px no-repeat;cursor:pointer}
81
+ div.dark_square .pp_expand:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) -31px -47px no-repeat;cursor:pointer}
82
+ div.dark_square .pp_contract{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) 0 -26px no-repeat;cursor:pointer}
83
+ div.dark_square .pp_contract:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) 0 -47px no-repeat;cursor:pointer}
84
+ div.dark_square .pp_close{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
85
+ div.dark_square .pp_nav{clear:none}
86
+ div.dark_square .pp_nav .pp_play{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) -1px -100px no-repeat;height:15px;width:14px}
87
+ div.dark_square .pp_nav .pp_pause{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) -24px -100px no-repeat;height:15px;width:14px}
88
+ div.dark_square .pp_arrow_previous{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) 0 -71px no-repeat}
89
+ div.dark_square .pp_arrow_next{background: asset-url('sofa_gallery/prettyPhoto/dark_square/sprite.png', image) -22px -71px no-repeat}
90
+ div.dark_square .pp_next:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_square/btnNext.png', image) center right no-repeat;cursor:pointer}
91
+ div.dark_square .pp_previous:hover{background: asset-url('sofa_gallery/prettyPhoto/dark_square/btnPrevious.png', image) center left no-repeat;cursor:pointer}
92
+ div.light_square .pp_expand{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) -31px -26px no-repeat;cursor:pointer}
93
+ div.light_square .pp_expand:hover{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) -31px -47px no-repeat;cursor:pointer}
94
+ div.light_square .pp_contract{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) 0 -26px no-repeat;cursor:pointer}
95
+ div.light_square .pp_contract:hover{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) 0 -47px no-repeat;cursor:pointer}
96
+ div.light_square .pp_close{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) -1px -1px no-repeat;cursor:pointer;height:22px;width:75px}
97
+ div.light_square .pp_nav .pp_play{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) -1px -100px no-repeat;height:15px;width:14px}
98
+ div.light_square .pp_nav .pp_pause{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) -24px -100px no-repeat;height:15px;width:14px}
99
+ div.light_square .pp_arrow_previous{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) 0 -71px no-repeat}
100
+ div.light_square .pp_arrow_next{background: asset-url('sofa_gallery/prettyPhoto/light_square/sprite.png', image) -22px -71px no-repeat}
101
+ div.light_square .pp_next:hover{background: asset-url('sofa_gallery/prettyPhoto/light_square/btnNext.png', image) center right no-repeat;cursor:pointer}
102
+ div.light_square .pp_previous:hover{background: asset-url('sofa_gallery/prettyPhoto/light_square/btnPrevious.png', image) center left no-repeat;cursor:pointer}
103
+ div.facebook .pp_top .pp_left{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -88px -53px no-repeat}
104
+ div.facebook .pp_top .pp_middle{background: asset-url('sofa_gallery/prettyPhoto/facebook/contentPatternTop.png', image) top left repeat-x}
105
+ div.facebook .pp_top .pp_right{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -110px -53px no-repeat}
106
+ div.facebook .pp_content_container .pp_left{background: asset-url('sofa_gallery/prettyPhoto/facebook/contentPatternLeft.png', image) top left repeat-y}
107
+ div.facebook .pp_content_container .pp_right{background: asset-url('sofa_gallery/prettyPhoto/facebook/contentPatternRight.png', image) top right repeat-y}
108
+ div.facebook .pp_expand{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -31px -26px no-repeat;cursor:pointer}
109
+ div.facebook .pp_expand:hover{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -31px -47px no-repeat;cursor:pointer}
110
+ div.facebook .pp_contract{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) 0 -26px no-repeat;cursor:pointer}
111
+ div.facebook .pp_contract:hover{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) 0 -47px no-repeat;cursor:pointer}
112
+ div.facebook .pp_close{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -1px -1px no-repeat;cursor:pointer;height:22px;width:22px}
113
+ div.facebook .pp_description{margin:0 37px 0 0}
114
+ div.facebook .pp_loaderIcon{background: asset-url('sofa_gallery/prettyPhoto/facebook/loader.gif', image) center center no-repeat}
115
+ div.facebook .pp_arrow_previous{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) 0 -71px no-repeat;height:22px;margin-top:0;width:22px}
116
+ div.facebook .pp_arrow_previous.disabled{background-position:0 -96px;cursor:default}
117
+ div.facebook .pp_arrow_next{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -32px -71px no-repeat;height:22px;margin-top:0;width:22px}
118
+ div.facebook .pp_arrow_next.disabled{background-position:-32px -96px;cursor:default}
119
+ div.facebook .pp_nav{margin-top:0}
120
+ div.facebook .pp_nav p{font-size:15px;padding:0 3px 0 4px}
121
+ div.facebook .pp_nav .pp_play{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -1px -123px no-repeat;height:22px;width:22px}
122
+ div.facebook .pp_nav .pp_pause{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -32px -123px no-repeat;height:22px;width:22px}
123
+ div.facebook .pp_next:hover{background: asset-url('sofa_gallery/prettyPhoto/facebook/btnNext.png', image) center right no-repeat;cursor:pointer}
124
+ div.facebook .pp_previous:hover{background: asset-url('sofa_gallery/prettyPhoto/facebook/btnPrevious.png', image) center left no-repeat;cursor:pointer}
125
+ div.facebook .pp_bottom .pp_left{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -88px -80px no-repeat}
126
+ div.facebook .pp_bottom .pp_middle{background: asset-url('sofa_gallery/prettyPhoto/facebook/contentPatternBottom.png', image) top left repeat-x}
127
+ div.facebook .pp_bottom .pp_right{background: asset-url('sofa_gallery/prettyPhoto/facebook/sprite.png', image) -110px -80px no-repeat}
128
+ div.pp_pic_holder a:focus{outline:none}
129
+ div.pp_overlay{background:#000;display:none;left:0;position:absolute;top:0;width:100%;z-index:9500}
130
+ div.pp_pic_holder{display:none;position:absolute;width:100px;z-index:10000}
131
+ .pp_content{height:40px;min-width:40px}
132
+ * html .pp_content{width:40px}
133
+ .pp_content_container{position:relative;text-align:left;width:100%}
134
+ .pp_content_container .pp_left{padding-left:20px}
135
+ .pp_content_container .pp_right{padding-right:20px}
136
+ .pp_content_container .pp_details{float:left;margin:10px 0 2px}
137
+ .pp_description{display:none;margin:0}
138
+ .pp_social{float:left;margin:0}
139
+ .pp_social .facebook{float:left;margin-left:5px;overflow:hidden;width:55px}
140
+ .pp_social .twitter{float:left}
141
+ .pp_nav{clear:right;float:left;margin:3px 10px 0 0}
142
+ .pp_nav p{float:left;margin:2px 4px;white-space:nowrap}
143
+ .pp_nav .pp_play,.pp_nav .pp_pause{float:left;margin-right:4px;text-indent:-10000px}
144
+ a.pp_arrow_previous,a.pp_arrow_next{display:block;float:left;height:15px;margin-top:3px;overflow:hidden;text-indent:-10000px;width:14px}
145
+ .pp_hoverContainer{position:absolute;top:0;width:100%;z-index:2000}
146
+ .pp_gallery{display:none;left:50%;margin-top:-50px;position:absolute;z-index:10000}
147
+ .pp_gallery div{float:left;overflow:hidden;position:relative}
148
+ .pp_gallery ul{float:left;height:35px;margin:0 0 0 5px;padding:0;position:relative;white-space:nowrap}
149
+ .pp_gallery ul a{border:1px rgba(0,0,0,0.5) solid;display:block;float:left;height:33px;overflow:hidden}
150
+ .pp_gallery ul a img{border:0}
151
+ .pp_gallery li{display:block;float:left;margin:0 5px 0 0;padding:0}
152
+ .pp_gallery li.default a{background: asset-url('sofa_gallery/prettyPhoto/facebook/default_thumbnail.gif', image) 0 0 no-repeat;display:block;height:33px;width:50px}
153
+ .pp_gallery .pp_arrow_previous,.pp_gallery .pp_arrow_next{margin-top:7px!important}
154
+ a.pp_next{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/btnNext.png', image) 10000px 10000px no-repeat;display:block;float:right;height:100%;text-indent:-10000px;width:49%}
155
+ a.pp_previous{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/btnNext.png', image) 10000px 10000px no-repeat;display:block;float:left;height:100%;text-indent:-10000px;width:49%}
156
+ 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}
157
+ a.pp_close{display:block;line-height:22px;position:absolute;right:0;text-indent:-10000px;top:0}
158
+ .pp_loaderIcon{display:block;height:24px;left:50%;margin:-12px 0 0 -12px;position:absolute;top:50%;width:24px}
159
+ #pp_full_res{line-height:1!important}
160
+ #pp_full_res .pp_inline{text-align:left}
161
+ #pp_full_res .pp_inline p{margin:0 0 15px}
162
+ div.ppt{color:#fff;display:none;font-size:17px;margin:0 0 5px 15px;z-index:9999}
163
+ div.pp_default .pp_content,div.light_rounded .pp_content{background-color:#fff}
164
+ 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}
165
+ 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}
166
+ 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}
167
+ 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}
168
+ div.light_rounded .pp_description,div.light_square .pp_description{margin-right:85px}
169
+ 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}
170
+ 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}
171
+ 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}
172
+ div.light_rounded .pp_loaderIcon,div.light_square .pp_loaderIcon{background: asset-url('sofa_gallery/prettyPhoto/light_rounded/loader.gif', image) center center no-repeat}
173
+ div.dark_rounded .pp_top .pp_middle,div.dark_rounded .pp_content,div.dark_rounded .pp_bottom .pp_middle{background: asset-url('sofa_gallery/prettyPhoto/dark_rounded/contentPattern.png', image) top left repeat}
174
+ div.dark_rounded .currentTextHolder,div.dark_square .currentTextHolder{color:#c4c4c4}
175
+ div.dark_rounded #pp_full_res .pp_inline,div.dark_square #pp_full_res .pp_inline{color:#fff}
176
+ .pp_top,.pp_bottom{height:20px;position:relative}
177
+ * html .pp_top,* html .pp_bottom{padding:0 20px}
178
+ .pp_top .pp_left,.pp_bottom .pp_left{height:20px;left:0;position:absolute;width:20px}
179
+ .pp_top .pp_middle,.pp_bottom .pp_middle{height:20px;left:20px;position:absolute;right:20px}
180
+ * html .pp_top .pp_middle,* html .pp_bottom .pp_middle{left:0;position:static}
181
+ .pp_top .pp_right,.pp_bottom .pp_right{height:20px;left:auto;position:absolute;right:0;top:0;width:20px}
182
+ .pp_fade,.pp_gallery li.default a img{display:none}
@@ -1,4 +1,5 @@
1
1
  class ApplicationController < ActionController::Base
2
+
2
3
  protect_from_forgery
3
4
 
4
5
  layout 'gallery_admin/application'
@@ -0,0 +1,3 @@
1
+ class SofaGallery::Admin::BaseController < SofaGallery.config.admin_controller.to_s.constantize
2
+ # ...
3
+ end
@@ -1,10 +1,10 @@
1
- class GalleryAdmin::GalleriesController < GalleryAdmin::BaseController
1
+ class SofaGallery::Admin::GalleriesController < SofaGallery::Admin::BaseController
2
2
 
3
3
  before_filter :load_gallery, :except => [:index, :new, :create]
4
4
  before_filter :build_gallery, :only => [:new, :create]
5
5
 
6
6
  def index
7
- @galleries = Sofa::Gallery.all
7
+ @galleries = SofaGallery::Gallery.all
8
8
  end
9
9
 
10
10
  def new
@@ -46,14 +46,14 @@ class GalleryAdmin::GalleriesController < GalleryAdmin::BaseController
46
46
  protected
47
47
 
48
48
  def load_gallery
49
- @gallery = Sofa::Gallery.find(params[:id])
49
+ @gallery = SofaGallery::Gallery.find(params[:id])
50
50
  rescue ActiveRecord::RecordNotFound
51
51
  flash[:error] = 'Gallery not found'
52
52
  redirect_to :action => :index
53
53
  end
54
54
 
55
55
  def build_gallery
56
- @gallery = Sofa::Gallery.new(params[:gallery])
56
+ @gallery = SofaGallery::Gallery.new(params[:gallery])
57
57
  end
58
58
 
59
59
  end
@@ -1,4 +1,4 @@
1
- class GalleryAdmin::PhotosController < GalleryAdmin::BaseController
1
+ class SofaGallery::Admin::PhotosController < SofaGallery::Admin::BaseController
2
2
 
3
3
  before_filter :load_gallery
4
4
  before_filter :load_photo, :only => [:edit, :update, :destroy, :crop]
@@ -41,8 +41,8 @@ class GalleryAdmin::PhotosController < GalleryAdmin::BaseController
41
41
  end
42
42
 
43
43
  def reorder
44
- (params[:sofa_photo] || []).each_with_index do |id, index|
45
- if (photo = Sofa::Photo.find_by_id(id))
44
+ (params[:sofa_gallery_photo] || []).each_with_index do |id, index|
45
+ if (photo = SofaGallery::Photo.find_by_id(id))
46
46
  photo.update_attribute(:position, index)
47
47
  end
48
48
  end
@@ -56,10 +56,10 @@ class GalleryAdmin::PhotosController < GalleryAdmin::BaseController
56
56
  protected
57
57
 
58
58
  def load_gallery
59
- @gallery = Sofa::Gallery.find(params[:gallery_id])
59
+ @gallery = SofaGallery::Gallery.find(params[:gallery_id])
60
60
  rescue ActiveRecord::RecordNotFound
61
61
  flash[:error] = 'Gallery not found'
62
- redirect_to gallery_admin_galleries_path
62
+ redirect_to sofa_gallery_admin_galleries_path
63
63
  end
64
64
 
65
65
  def load_photo
@@ -70,7 +70,7 @@ protected
70
70
  end
71
71
 
72
72
  def build_photo
73
- @photo = Sofa::Photo.new({:gallery => @gallery}.merge(params[:photo] || {}))
73
+ @photo = SofaGallery::Photo.new({:gallery => @gallery}.merge(params[:photo] || {}))
74
74
  end
75
75
 
76
76
  end
@@ -0,0 +1,9 @@
1
+ class SofaGallery::GalleriesController < ApplicationController
2
+
3
+ def show
4
+ @gallery = SofaGallery::Gallery.find(params[:id])
5
+ rescue ActiveRecord::RecordNotFound
6
+ render :text => 'Gallery not found', :status => 404
7
+ end
8
+
9
+ end
@@ -1,6 +1,6 @@
1
1
  module SofaGalleryHelper
2
2
 
3
- def gallery_form_for(record_or_name_or_array, *args, &proc)
3
+ def sofa_gallery_form_for(record_or_name_or_array, *args, &proc)
4
4
  options = args.extract_options!
5
5
  form_for(
6
6
  record_or_name_or_array,
@@ -8,4 +8,14 @@ module SofaGalleryHelper
8
8
  &proc
9
9
  )
10
10
  end
11
+
12
+ def render_gallery(slug, type = 'thumbnails')
13
+ @gallery = SofaGallery::Gallery.find_by_slug(slug)
14
+ if (@gallery)
15
+ render :partial => "sofa_gallery/#{type}"
16
+ else
17
+ render :text => 'Gallery not found.', :status => 404
18
+ end
19
+ end
20
+
11
21
  end
@@ -1,6 +1,6 @@
1
- class Sofa::Gallery < ActiveRecord::Base
1
+ class SofaGallery::Gallery < ActiveRecord::Base
2
2
 
3
- set_table_name :sofa_galleries
3
+ set_table_name :sofa_gallery_galleries
4
4
 
5
5
  # -- Relationships --------------------------------------------------------
6
6
  has_many :photos, :dependent => :destroy
@@ -1,23 +1,24 @@
1
- class Sofa::Photo < ActiveRecord::Base
1
+ class SofaGallery::Photo < ActiveRecord::Base
2
2
 
3
- set_table_name :sofa_photos
3
+ set_table_name :sofa_gallery_photos
4
4
 
5
5
  upload_options = (SofaGallery.config.upload_options || {}).merge(
6
6
  :styles => lambda { |image|
7
7
  g = image.instance.gallery
8
- f_settings = "#{g.full_width}x#{g.full_height}#{g.force_ratio?? '#' : '>'}"
9
- t_settings = "#{g.thumb_width}x#{g.thumb_height}#{g.force_ratio?? '#' : '>'}"
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
10
  {
11
- :full => { :geometry => f_settings, :processors => [:cropper] },
12
- :thumb => { :geometry => t_settings, :processors => [:cropper] },
11
+ :full => { :geometry => f_settings, :processors => [:full_cropper] },
12
+ :thumb => { :geometry => t_settings, :processors => [:thumb_cropper] },
13
13
  :admin_full => '800x600>',
14
14
  :admin_thumb => '40x30#'
15
15
  }
16
16
  }
17
17
  )
18
- has_attached_file :image, upload_options
18
+ has_attached_file :image, upload_options
19
19
 
20
- attr_accessor :crop_x, :crop_y, :crop_w, :crop_h
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
21
22
 
22
23
  # -- Relationships --------------------------------------------------------
23
24
  belongs_to :gallery
@@ -47,7 +48,15 @@ class Sofa::Photo < ActiveRecord::Base
47
48
  end
48
49
 
49
50
  def cropping?
50
- !crop_x.blank? && !crop_y.blank? && !crop_w.blank? && !crop_h.blank?
51
+ cropping_thumb? || cropping_full?
52
+ end
53
+
54
+ def cropping_thumb?
55
+ !thumb_crop_x.blank? && !thumb_crop_y.blank? && !thumb_crop_w.blank? && !thumb_crop_h.blank?
56
+ end
57
+
58
+ def cropping_full?
59
+ !full_crop_x.blank? && !full_crop_y.blank? && !full_crop_w.blank? && !full_crop_h.blank?
51
60
  end
52
61
 
53
62
  private
@@ -3,8 +3,8 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5
5
  <title>SofaGallery</title>
6
- <%= javascript_include_tag 'sofa_gallery/application' %>
7
- <%= stylesheet_link_tag 'sofa_gallery/application' %>
6
+ <%= javascript_include_tag 'sofa_gallery/application.js' %>
7
+ <%= stylesheet_link_tag 'sofa_gallery/application.css' %>
8
8
  <%= yield :head %>
9
9
  </head>
10
10
  <body class='c_<%= params[:controller].gsub('/', '_') %> a_<%= params[:action] %>'>
@@ -0,0 +1,17 @@
1
+ <% if @gallery %>
2
+ <% content_for :head do %>
3
+ <%= stylesheet_link_tag "/assets/sofa_gallery/sofa_gallery_carousel.css" %>
4
+ <%= javascript_include_tag "/assets/sofa_gallery/sofa_gallery_carousel.js" %>
5
+ <% end %>
6
+ <ul id="cms_carousel" class="jcarousel-skin-tango">
7
+ <% @gallery.photos.each do |photo| %>
8
+ <li id="<%= dom_id(photo) %>">
9
+ <div class="photo">
10
+ <%= link_to image_tag(photo.image.url(:full), :alt => photo.description), photo.url %>
11
+ </div>
12
+ </li>
13
+ <% end %>
14
+ </ul>
15
+ <% else %>
16
+ Gallery not found.
17
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <% if @gallery %>
2
+ <% content_for :head do %>
3
+ <%= stylesheet_link_tag "sofa_gallery/thumbnails.css" %>
4
+ <%= javascript_include_tag "sofa_gallery/thumbnails.js" %>
5
+ <% end %>
6
+ <ul id="<%= dom_id(@gallery)%>" class="gallery" style="width: <%= @gallery.gallery_width %>px;">
7
+ <% @gallery.photos.each do |photo| %>
8
+ <li id="<%= dom_id(photo) %>">
9
+ <div class="photo" style="width: <%= @gallery.thumb_width %>px; height: <%= @gallery.thumb_height %>px;">
10
+ <%= link_to photo.image.url(:full), :rel => "prettyPhoto[pp_gal]", :title => photo.description do %>
11
+ <%= image_tag(photo.image.url(:thumb), :alt => photo.description) %>
12
+ <% end %>
13
+ </div>
14
+ </li>
15
+ <% end %>
16
+ </ul>
17
+ <% else %>
18
+ Gallery not found.
19
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= stylesheet_link_tag 'sofa_gallery/admin' %>
@@ -0,0 +1,5 @@
1
+ <% content_for :head do %>
2
+ <%= stylesheet_link_tag "sofa_gallery/sofa_gallery_admin.css" %>
3
+ <% end %>
4
+
5
+ <li><%= active_link_to 'Galleries', gallery_admin_galleries_path %></li>
@@ -0,0 +1,17 @@
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 :gallery_width %>
6
+ <%= form.text_field :full_width %>
7
+ <%= form.text_field :full_height %>
8
+ <%= form.check_box :force_ratio_full, :label => "Force Ratio" %>
9
+ <%= form.text_field :thumb_width %>
10
+ <%= form.text_field :thumb_height %>
11
+ <%= form.check_box :force_ratio_thumb, :label => "Force Ratio" %>
12
+
13
+ <%= form.simple_field nil, nil, :class => 'submit_element' do %>
14
+ <%= link_to "Cancel", sofa_gallery_admin_galleries_path, :id => 'cancel_btn' %>
15
+ <span>or</span>
16
+ <%= form.submit "Save", :disable_builder => true%>
17
+ <% end %>