spud_photos 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.markdown +53 -0
- data/Rakefile +40 -0
- data/app/assets/images/spud/photos/buttons/cog_16x16.png +0 -0
- data/app/assets/images/spud/photos/buttons/x_16x16.png +0 -0
- data/app/assets/images/spud/photos/photo_albums_thumb.png +0 -0
- data/app/assets/images/spud/photos/photo_albums_thumb@2x.png +0 -0
- data/app/assets/javascripts/spud/admin/photos.js +158 -0
- data/app/assets/stylesheets/photo_albums.css +4 -0
- data/app/assets/stylesheets/photo_galleries.css +4 -0
- data/app/assets/stylesheets/spud/admin/photo_albums.css +4 -0
- data/app/assets/stylesheets/spud/admin/photo_galleries.css +4 -0
- data/app/assets/stylesheets/spud/admin/photos.css +112 -0
- data/app/controllers/photo_albums_controller.rb +25 -0
- data/app/controllers/photo_galleries_controller.rb +11 -0
- data/app/controllers/spud/admin/photo_albums_controller.rb +46 -0
- data/app/controllers/spud/admin/photo_galleries_controller.rb +51 -0
- data/app/controllers/spud/admin/photos_controller.rb +89 -0
- data/app/helpers/photo_albums_helper.rb +2 -0
- data/app/helpers/photo_galleries_helper.rb +2 -0
- data/app/helpers/spud/admin/photo_albums_helper.rb +2 -0
- data/app/helpers/spud/admin/photo_galleries_helper.rb +2 -0
- data/app/helpers/spud/admin/photos_helper.rb +2 -0
- data/app/models/spud_photo.rb +23 -0
- data/app/models/spud_photo_album.rb +34 -0
- data/app/models/spud_photo_gallery.rb +29 -0
- data/app/views/layouts/spud/admin/spud_photos.html.erb +8 -0
- data/app/views/photo_albums/index.html.erb +18 -0
- data/app/views/photo_albums/show.html.erb +17 -0
- data/app/views/photo_galleries/index.html.erb +18 -0
- data/app/views/spud/admin/photo_albums/_album.html.erb +10 -0
- data/app/views/spud/admin/photo_albums/_form.html.erb +37 -0
- data/app/views/spud/admin/photo_albums/destroy.js.erb +1 -0
- data/app/views/spud/admin/photo_albums/edit.html.erb +1 -0
- data/app/views/spud/admin/photo_albums/index.html.erb +9 -0
- data/app/views/spud/admin/photo_albums/new.html.erb +1 -0
- data/app/views/spud/admin/photo_galleries/_form.html.erb +40 -0
- data/app/views/spud/admin/photo_galleries/destroy.js.erb +1 -0
- data/app/views/spud/admin/photo_galleries/edit.html.erb +1 -0
- data/app/views/spud/admin/photo_galleries/index.html.erb +17 -0
- data/app/views/spud/admin/photo_galleries/new.html.erb +1 -0
- data/app/views/spud/admin/photos/_form.html.erb +48 -0
- data/app/views/spud/admin/photos/_photo.html.erb +9 -0
- data/app/views/spud/admin/photos/destroy.js.erb +1 -0
- data/app/views/spud/admin/photos/edit.html.erb +1 -0
- data/app/views/spud/admin/photos/index.html.erb +12 -0
- data/app/views/spud/admin/photos/new.html.erb +1 -0
- data/config/routes.rb +23 -0
- data/db/migrate/20120228232120_create_spud_photos.rb +13 -0
- data/db/migrate/20120228232329_create_spud_photo_albums.rb +15 -0
- data/db/migrate/20120228232344_create_spud_photo_galleries.rb +15 -0
- data/lib/generators/spud/photos/views_generator.rb +14 -0
- data/lib/spud_photos.rb +6 -0
- data/lib/spud_photos/configuration.rb +18 -0
- data/lib/spud_photos/engine.rb +37 -0
- data/lib/spud_photos/version.rb +5 -0
- data/lib/tasks/spud_photos_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +56 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +15 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- metadata +213 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Spud Photos
|
2
|
+
|
3
|
+
Spud Photos is an engine for creating and managing photo galleries, designed for use with [Spud][1].
|
4
|
+
|
5
|
+
## Installation/Usage
|
6
|
+
|
7
|
+
1. In your Gemfile add the following
|
8
|
+
|
9
|
+
gem 'spud_core', :git => "git://github.com/davydotcom/spud_core_admin.git"
|
10
|
+
gem 'spud_photos', :git => "git://github.com/gregawoods/spud_photos.git"
|
11
|
+
|
12
|
+
2. Run bundle install
|
13
|
+
3. Copy in database migrations to your new rails project
|
14
|
+
|
15
|
+
bundle exec rake spud_core:install:migrations
|
16
|
+
bundle exec rake spud_photos:install:migrations
|
17
|
+
rake db:migrate
|
18
|
+
|
19
|
+
4. Run a rails server instance and point your browser to /spud/admin
|
20
|
+
|
21
|
+
## Configuration
|
22
|
+
|
23
|
+
Spud Photos accepts the following configuration options:
|
24
|
+
|
25
|
+
Spud::Photos.configure do |config|
|
26
|
+
self.base_layout = 'application'
|
27
|
+
config.galleries_enabled = false
|
28
|
+
config.base_path = 'photos'
|
29
|
+
config.photo_styles = {
|
30
|
+
:small => '50x50#',
|
31
|
+
:medium => '200x200#',
|
32
|
+
:large => '400x400#',
|
33
|
+
:huge => '600x600'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
The `photo_styles` option will be passed to [Paperclip][2], so any valid paperclip styles can be added here.
|
38
|
+
|
39
|
+
## Galleries
|
40
|
+
|
41
|
+
A Gallery is just an additional layer of organization above the Album layer. For example, a Gallery called "Vacations" might include Albums titled "Europe", "Hawaii", and "Florida". Galleries are turned off by default.
|
42
|
+
|
43
|
+
## Customizing Views
|
44
|
+
|
45
|
+
A number of built-in views have been provided to help you get started with the frontend display. Customizing these views will require you to copy them into your local application, which can be accomplished by using the views generator.
|
46
|
+
|
47
|
+
rails generate spud:photos:views
|
48
|
+
|
49
|
+
__NOTE:__ The built-in views are likely to undergo changes as features are added to the photos engine. If a new version of Spud Photos does not play nicely with your customized views, try backing up your views to an alternate location and running the views generator again to see what has changed.
|
50
|
+
|
51
|
+
|
52
|
+
[1]:https://github.com/davydotcom/spud_core_admin
|
53
|
+
[2]:https://github.com/thoughtbot/paperclip
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'SpudPhotos'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,158 @@
|
|
1
|
+
Spud = (typeof(Spud) == 'undefined') ? {} : Spud;
|
2
|
+
Spud.Admin = (typeof(Spud.Admin) == 'undefined') ? {} : Spud.Admin;
|
3
|
+
|
4
|
+
Spud.Admin.Photos = new function(){
|
5
|
+
|
6
|
+
var self = this;
|
7
|
+
|
8
|
+
this.init = function(){
|
9
|
+
$('.spud_admin_photo_ui_thumbs_sortable').sortable({
|
10
|
+
connectWith:'.spud_admin_photo_ui_thumbs_sortable'
|
11
|
+
});
|
12
|
+
$('#spud_admin_photo_album_form, #spud_admin_photo_gallery_form').live('submit', self.submittedPhotoAlbumOrGalleryForm)
|
13
|
+
$('.spud_admin_photo_mass_destroy').live('click', self.massDestroySelected);
|
14
|
+
$('#spud_admin_photo_form').live('submit', self.submittedPhotoForm);
|
15
|
+
$('.spud_admin_photo_ui_thumb_selectable input[type=checkbox]').live('click', self.invertPhotoUiThumbCheckbox);
|
16
|
+
$('.spud_admin_photo_ui_thumb_selectable').live('click', self.selectedPhotoUiThumb);
|
17
|
+
self.markSelectedPhotoUiThumbs();
|
18
|
+
};
|
19
|
+
|
20
|
+
this.submittedPhotoAlbumOrGalleryForm = function(e){
|
21
|
+
// update photo checkboxes
|
22
|
+
$('.spud_admin_photo_ui_thumb').each(function(){
|
23
|
+
var item = $(this);
|
24
|
+
var checkbox = item.find('input[type=checkbox]');
|
25
|
+
checkbox.attr('checked', (item.parents('.spud_admin_photos_selection_left').length>0));
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
this.massDestroySelected = function(e){
|
30
|
+
e.preventDefault();
|
31
|
+
var ids = $.map($('.spud_admin_photo_ui_thumb_selected'), function(val, i){
|
32
|
+
return $(val).find('input[type=checkbox]').val()
|
33
|
+
});
|
34
|
+
$.ajax({
|
35
|
+
type: 'POST',
|
36
|
+
url: $(this).attr('href'),
|
37
|
+
data: {spud_photo_ids:ids},
|
38
|
+
success: function(data, textStatus, jqXHR){
|
39
|
+
$('.spud_admin_photo_ui_thumb_selected').fadeOut(200, function(){
|
40
|
+
$(this).remove();
|
41
|
+
});
|
42
|
+
},
|
43
|
+
error: function(jqXHR, textStatus, errorThrown){
|
44
|
+
console.log('An error occurred:')
|
45
|
+
console.log(arguments);
|
46
|
+
}
|
47
|
+
})
|
48
|
+
};
|
49
|
+
|
50
|
+
this.submittedPhotoForm = function(e){
|
51
|
+
if(FormData && XMLHttpRequest){
|
52
|
+
// create a FormData object and attach form values
|
53
|
+
var fd = new FormData();
|
54
|
+
var form = $(this);
|
55
|
+
fd.append('_method', form.find('[name=_method]').val());
|
56
|
+
fd.append('authenticity_token', form.find('[name=authenticity_token]').val());
|
57
|
+
fd.append('spud_photo[photo]', form.find('#spud_photo_photo')[0].files[0]);
|
58
|
+
fd.append('spud_photo[title]', form.find('#spud_photo_title').val());
|
59
|
+
fd.append('spud_photo[caption]', form.find('#spud_photo_caption').val());
|
60
|
+
|
61
|
+
// send FormData object as ajax request
|
62
|
+
var xhr = new XMLHttpRequest();
|
63
|
+
xhr.upload.addEventListener('progress', self.photoUploadProgress, false);
|
64
|
+
xhr.addEventListener('load', self.photoUploadComplete, false);
|
65
|
+
xhr.addEventListener('error', self.photoUploadFailed, false);
|
66
|
+
xhr.addEventListener('abort', self.photoUploadCanceled, false);
|
67
|
+
xhr.open('POST', form.attr('action'));
|
68
|
+
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
69
|
+
xhr.send(fd);
|
70
|
+
return false;
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
this.photoUploadProgress = function(e){
|
75
|
+
var percent = Math.round(e.loaded * 100 / e.total);
|
76
|
+
console.log('progress: ' + percent + '%');
|
77
|
+
$('.progress').show();
|
78
|
+
$('.progress .bar').css({width: percent + '%'});
|
79
|
+
};
|
80
|
+
|
81
|
+
this.photoUploadComplete = function(e){
|
82
|
+
// success
|
83
|
+
var photo = $.parseJSON(e.target.response);
|
84
|
+
if(e.target.status == 200){
|
85
|
+
var element = $('#spud_admin_photo_' + photo.id);
|
86
|
+
if(element.length > 0){
|
87
|
+
element.replaceWith(photo.html);
|
88
|
+
}
|
89
|
+
else{
|
90
|
+
var target = $('#spud_admin_photos_selected .spud_admin_photo_ui_thumbs, #spud_admin_photos');
|
91
|
+
target.prepend(photo.html).fadeIn(200);
|
92
|
+
}
|
93
|
+
$('#dialog').dialog('close');
|
94
|
+
}
|
95
|
+
// validation error
|
96
|
+
else{
|
97
|
+
$('#dialog').html(photo.html);
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
this.photoUploadFailed = function(e){
|
102
|
+
console.log('fail!');
|
103
|
+
console.log(e);
|
104
|
+
}
|
105
|
+
|
106
|
+
this.photoUploadCanceled = function(e){
|
107
|
+
console.log('cancel');
|
108
|
+
};
|
109
|
+
|
110
|
+
// need to invert the checkbox state so that it gets properly checked/uncheckd when `selectedPhotoUiThumb` fires
|
111
|
+
this.invertPhotoUiThumbCheckbox = function(e){
|
112
|
+
$(this).attr('checked', !$(this).attr('checked'));
|
113
|
+
};
|
114
|
+
|
115
|
+
this.selectedPhotoUiThumb = function(e){
|
116
|
+
var checkbox = $(this).find('input[type=checkbox]');
|
117
|
+
if(checkbox){
|
118
|
+
if(checkbox.attr('checked')){
|
119
|
+
$(this).removeClass('spud_admin_photo_ui_thumb_selected');
|
120
|
+
checkbox.attr('checked', false);
|
121
|
+
}
|
122
|
+
else{
|
123
|
+
$(this).addClass('spud_admin_photo_ui_thumb_selected');
|
124
|
+
checkbox.attr('checked', true);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
};
|
128
|
+
|
129
|
+
this.markSelectedPhotoUiThumbs = function(){
|
130
|
+
$('.spud_admin_photo_ui_thumb_selectable').each(function(){
|
131
|
+
var checkbox = $(this).find('input[type=checkbox]');
|
132
|
+
if(checkbox && checkbox.attr('checked')){
|
133
|
+
$(this).addClass('spud_admin_photo_ui_thumb_selected');
|
134
|
+
}
|
135
|
+
});
|
136
|
+
};
|
137
|
+
|
138
|
+
this.markPhotoAsDeleted = function(photo_id){
|
139
|
+
var photo = $('#spud_admin_photo_' + photo_id);
|
140
|
+
photo.fadeOut(200, function(){
|
141
|
+
photo.remove();
|
142
|
+
});
|
143
|
+
};
|
144
|
+
|
145
|
+
this.markPhotoAlbumAsDeleted = function(photo_album_id){
|
146
|
+
var photo_album = $('#spud_admin_photo_album_' + photo_album_id);
|
147
|
+
photo_album.fadeOut(200, function(){
|
148
|
+
photo_album.remove();
|
149
|
+
});
|
150
|
+
};
|
151
|
+
|
152
|
+
this.markPhotoGalleryAsDeleted = function(photo_gallery_id){
|
153
|
+
var photo_gallery = $('#spud_admin_photo_gallery_' + photo_gallery_id);
|
154
|
+
photo_gallery.fadeOut(200, function(){
|
155
|
+
photo_gallery.remove();
|
156
|
+
});
|
157
|
+
};
|
158
|
+
};
|
@@ -0,0 +1,112 @@
|
|
1
|
+
.spud_admin_photos_selection_left{
|
2
|
+
width: 520px;
|
3
|
+
margin-right: 18px;
|
4
|
+
float: left;
|
5
|
+
}
|
6
|
+
.spud_admin_photos_selection_right{
|
7
|
+
width: 400px;
|
8
|
+
float: left;
|
9
|
+
}
|
10
|
+
.spud_admin_photos_selection_left h4, .spud_admin_photos_selection_right h4{
|
11
|
+
font-weight: normal;
|
12
|
+
margin: 15px 0;
|
13
|
+
}
|
14
|
+
.spud_admin_photo_ui_thumbs{
|
15
|
+
height: 350px;
|
16
|
+
padding: 0;
|
17
|
+
border: 1px solid #cacaca;
|
18
|
+
margin: 15px 0;
|
19
|
+
overflow-y: scroll;
|
20
|
+
}
|
21
|
+
.spud_admin_photo_ui_thumb{
|
22
|
+
width: 125px;
|
23
|
+
height: 125px;
|
24
|
+
float: left;
|
25
|
+
background: #666;
|
26
|
+
background-clip: content-box;
|
27
|
+
margin: 16px;
|
28
|
+
position: relative;
|
29
|
+
-webkit-touch-callout: none;
|
30
|
+
-webkit-user-select: none;
|
31
|
+
-khtml-user-select: none;
|
32
|
+
-moz-user-select: none;
|
33
|
+
-ms-user-select: none;
|
34
|
+
user-select: none;
|
35
|
+
box-shadow: 0 0 5px black, inset 0 0 50px rgba(0,0,0,0.25);
|
36
|
+
border-radius: 15px;
|
37
|
+
-webkit-transition-property: box-shadow;
|
38
|
+
-webkit-transition-duration: 0.2s;
|
39
|
+
-webkit-transition-timing-function: ease-out;
|
40
|
+
}
|
41
|
+
.spud_admin_photo_ui_thumb_small{
|
42
|
+
width: 100px;
|
43
|
+
height: 100px;
|
44
|
+
background-size: 100px 100px;
|
45
|
+
margin: 12px;
|
46
|
+
}
|
47
|
+
.spud_admin_photo_ui_thumb:hover{
|
48
|
+
box-shadow: 0 0 5px black;
|
49
|
+
}
|
50
|
+
.spud_admin_photo_ui_thumbs_selectable .spud_admin_photo_ui_thumb{
|
51
|
+
cursor: pointer;
|
52
|
+
}
|
53
|
+
.spud_admin_photo_ui_thumb_selected{
|
54
|
+
border: 3px solid #006CCC;
|
55
|
+
margin: -3px 30px 30px -3px;
|
56
|
+
}
|
57
|
+
.spud_admin_photo_ui_thumbs_sortable .spud_admin_photo_ui_thumb{
|
58
|
+
cursor: move;
|
59
|
+
}
|
60
|
+
.spud_admin_photo_ui_thumb_selected:nth-child(6n){
|
61
|
+
margin-right: -3px;
|
62
|
+
}
|
63
|
+
.spud_admin_photo_ui_thumb h5{
|
64
|
+
font-size: 12px;
|
65
|
+
color: white;
|
66
|
+
text-align: center;
|
67
|
+
background: rgba(0,0,0,0.5);
|
68
|
+
padding: 3px 8px;
|
69
|
+
border-top-left-radius: 15px;
|
70
|
+
border-top-right-radius: 15px;
|
71
|
+
white-space: nowrap;
|
72
|
+
overflow: hidden;
|
73
|
+
text-overflow: ellipsis;
|
74
|
+
}
|
75
|
+
.spud_admin_photo_ui_thumb input[type=checkbox]{
|
76
|
+
position: absolute;
|
77
|
+
top: 4px;
|
78
|
+
left: 4px;
|
79
|
+
}
|
80
|
+
.spud_admin_photo_ui_thumb_controls{
|
81
|
+
position: absolute;
|
82
|
+
bottom: 0;
|
83
|
+
right: 0;
|
84
|
+
padding: 4px;
|
85
|
+
display: inline-block;
|
86
|
+
background: rgba(0,0,0,0.5);
|
87
|
+
border-bottom-right-radius: 15px;
|
88
|
+
}
|
89
|
+
.spud_admin_photos_btn_delete{
|
90
|
+
background: url('/assets/spud/photos/buttons/x_16x16.png');
|
91
|
+
height: 16px;
|
92
|
+
width: 16px;
|
93
|
+
text-indent: -7777px;
|
94
|
+
display: inline-block;
|
95
|
+
margin: 0 4px;
|
96
|
+
}
|
97
|
+
.spud_admin_photos_btn_edit{
|
98
|
+
background: url('/assets/spud/photos/buttons/cog_16x16.png');
|
99
|
+
height: 16px;
|
100
|
+
width: 16px;
|
101
|
+
text-indent: -7777px;
|
102
|
+
display: inline-block;
|
103
|
+
margin: 0 4px;
|
104
|
+
}
|
105
|
+
.spud_admin_photos_album_fieldset{
|
106
|
+
position: relative;
|
107
|
+
}
|
108
|
+
.spud_admin_photos_album_fieldset .spud_admin_photo_create{
|
109
|
+
position: absolute;
|
110
|
+
top: 0;
|
111
|
+
right: 0;
|
112
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class PhotoAlbumsController < ApplicationController
|
2
|
+
|
3
|
+
respond_to :html, :json, :xml
|
4
|
+
layout Spud::Photos.base_layout
|
5
|
+
|
6
|
+
def index
|
7
|
+
if params[:photo_gallery_id]
|
8
|
+
@photo_gallery = SpudPhotoGallery.find_by_url_name(params[:photo_gallery_id])
|
9
|
+
if @photo_gallery
|
10
|
+
@photo_albums = @photo_gallery.albums.order('created_at desc')
|
11
|
+
else
|
12
|
+
@photo_albums = []
|
13
|
+
end
|
14
|
+
else
|
15
|
+
@photo_albums = SpudPhotoAlbum.order('created_at desc')
|
16
|
+
end
|
17
|
+
respond_with @photo_albums
|
18
|
+
end
|
19
|
+
|
20
|
+
def show
|
21
|
+
@photo_album = SpudPhotoAlbum.find_by_url_name(params[:id])
|
22
|
+
respond_with @photo_album
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|