spud_photos 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ Spud.Admin = (typeof(Spud.Admin) == 'undefined') ? {} : Spud.Admin;
4
4
  Spud.Admin.Photos = new function(){
5
5
 
6
6
  var self = this;
7
+ var html5upload = false;
7
8
 
8
9
  this.init = function(){
9
10
  // event handlers
@@ -18,7 +19,8 @@ Spud.Admin.Photos = new function(){
18
19
  $('body').on('click', '#spud_admin_photo_album_action_library', self.clickedPhotoLibrary);
19
20
 
20
21
  // html5 drag and drop file
21
- if(FormData){
22
+ if(typeof(FormData) != 'undefined' && typeof(XMLHttpRequest) != 'undefined'){
23
+ html5upload = true;
22
24
  $('#spud_admin_photo_upload_queue').show();
23
25
  var droparea = document.getElementById('spud_admin_photo_upload_queue');
24
26
  droparea.addEventListener('dragenter', self.stopDndPropagation, false);
@@ -97,7 +99,7 @@ Spud.Admin.Photos = new function(){
97
99
  -------------------------------- */
98
100
 
99
101
  this.submittedPhotoForm = function(e){
100
- if(FormData && XMLHttpRequest){
102
+ if(html5upload){
101
103
  // create a FormData object and attach form values
102
104
  var fd = new FormData();
103
105
  var form = $(this);
@@ -0,0 +1,74 @@
1
+ spud_photos = new function(){
2
+
3
+ var self = this;
4
+ var transition;
5
+
6
+ this.init = function(){
7
+ transition = new spud_photos.transitions.slide('#spud_photo_showcase');
8
+ $('#spud_photo_album_photos').on('click', 'a', self.clickedPhoto);
9
+ };
10
+
11
+ this.clickedPhoto = function(e){
12
+ e.preventDefault();
13
+ transition.transition($(this).attr('href'));
14
+ };
15
+ };
16
+
17
+ spud_photos.transitions = {};
18
+
19
+ spud_photos.transitions.fade = function(_container, _firstPhoto){
20
+
21
+ var self = this;
22
+ var z_index = 100;
23
+ var container = $(_container);
24
+
25
+ this.transition = function(photo){
26
+ z_index++;
27
+ var image = $('<img/>', {
28
+ src:photo,
29
+ style:'position:absolute;left:0;top:0;z-index:'+z_index
30
+ });
31
+ container.trigger('spud:photos:transitionStart');
32
+ container.append(image);
33
+ image.hide().fadeIn(200, self.fadeCompleted);
34
+ };
35
+
36
+ this.fadeCompleted = function(e){
37
+ var imgs = container.find('img');
38
+ if(imgs.length > 1){
39
+ $(imgs[0]).remove();
40
+ }
41
+ container.trigger('spud:photos:transitionComplete');
42
+ };
43
+ };
44
+
45
+ spud_photos.transitions.slide = function(_container, _firstPhoto){
46
+
47
+ var self = this;
48
+ var container = $(_container);
49
+ var slider = $('<div/>', {
50
+ id:'spud_photos_transition_slider',
51
+ style:'position:absolute;left:0;top:0;width:400px;height:800px'
52
+ });
53
+ container.append(slider);
54
+
55
+ this.transition = function(photo){
56
+ console.log('transition slider');
57
+ var image = $('<img/>', {
58
+ src:photo,
59
+ style:'display:block'
60
+ });
61
+ container.trigger('spud:photos:transitionStart');
62
+ slider.append(image);
63
+ slider.animate({top:-400}, 500, self.slideCompleted);
64
+ };
65
+
66
+ this.slideCompleted = function(e){
67
+ var imgs = container.find('img');
68
+ if(imgs.length > 1){
69
+ $(imgs[0]).remove();
70
+ }
71
+ slider.css('top', 0);
72
+ container.trigger('spud:photos:transitionComplete');
73
+ };
74
+ }
File without changes
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Photos
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spud_photos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-12 00:00:00.000000000 Z
12
+ date: 2012-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70315539580300 !ruby/object:Gem::Requirement
16
+ requirement: &70246767895340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70315539580300
24
+ version_requirements: *70246767895340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: spud_core
27
- requirement: &70315539594840 !ruby/object:Gem::Requirement
27
+ requirement: &70246767894420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: 0.9.0
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70315539594840
38
+ version_requirements: *70246767894420
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: paperclip
41
- requirement: &70315539593500 !ruby/object:Gem::Requirement
41
+ requirement: &70246767893080 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: '0'
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *70315539593500
49
+ version_requirements: *70246767893080
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: mysql2
52
- requirement: &70315539592500 !ruby/object:Gem::Requirement
52
+ requirement: &70246767891900 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: '0'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *70315539592500
60
+ version_requirements: *70246767891900
61
61
  description: Spud Photos is a feature complete photo management/gallery for the spud
62
62
  engine. Manage multiple galleries, albums, and photos. Use HTML 5 to drag and drop
63
63
  many images at once.
@@ -72,11 +72,9 @@ files:
72
72
  - app/assets/images/spud/photos/photo_albums_thumb.png
73
73
  - app/assets/images/spud/photos/photo_albums_thumb@2x.png
74
74
  - app/assets/javascripts/spud/admin/photos.js
75
- - app/assets/stylesheets/photo_albums.css
76
- - app/assets/stylesheets/photo_galleries.css
77
- - app/assets/stylesheets/spud/admin/photo_albums.css
78
- - app/assets/stylesheets/spud/admin/photo_galleries.css
75
+ - app/assets/javascripts/spud_photos.js
79
76
  - app/assets/stylesheets/spud/admin/photos.css
77
+ - app/assets/stylesheets/spud_photos.css
80
78
  - app/controllers/photo_albums_controller.rb
81
79
  - app/controllers/photo_galleries_controller.rb
82
80
  - app/controllers/spud/admin/photo_albums_controller.rb
@@ -171,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
169
  version: '0'
172
170
  segments:
173
171
  - 0
174
- hash: 792898936705985964
172
+ hash: -1394536087294010782
175
173
  required_rubygems_version: !ruby/object:Gem::Requirement
176
174
  none: false
177
175
  requirements:
@@ -180,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
178
  version: '0'
181
179
  segments:
182
180
  - 0
183
- hash: 792898936705985964
181
+ hash: -1394536087294010782
184
182
  requirements: []
185
183
  rubyforge_project:
186
184
  rubygems_version: 1.8.10
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */
@@ -1,4 +0,0 @@
1
- /*
2
- Place all the styles related to the matching controller here.
3
- They will automatically be included in application.css.
4
- */