social_stream-documents 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,12 +28,6 @@ $('.attachment_tile a, .picture_link a').live("click",function(e){
28
28
  $('body').append("<a href='"+download_link+"'><img id='downloadButton' src='<%= asset_path "16/default.png" %>' /></a>");
29
29
  return;
30
30
  }
31
- if(this.type == "Picture"){
32
- removePlayers();
33
- $(this).parent().parent().addClass("selected");
34
- $('body').append("<img class='player' id='picture_player' src='"+download_link+"' />");
35
- $('body').append("<a href='" + download_link + "'><img id='downloadButton' src='<%= asset_path "16/default.png" %>' /></a>");
36
- }
37
31
  });
38
32
 
39
33
  function removePlayers(){
@@ -1,2 +1,3 @@
1
1
  //= require jquery.jplayer
2
2
  //= require_tree .
3
+ //= require jquery.lightbox.min
@@ -1,4 +1,5 @@
1
1
  /*
2
2
  *= require jplayer.blue.monday
3
3
  *= require_tree .
4
+ *= require jquery.lightbox
4
5
  */
@@ -7,6 +7,10 @@ module DocumentsHelper
7
7
  def thumb_for(document, size)
8
8
  image_tag document.thumb(size, self)
9
9
  end
10
+
11
+ def thumb_file_for(document, size)
12
+ document.thumb(size, self)
13
+ end
10
14
 
11
15
  def link_for_wall(document)
12
16
  format = Mime::Type.lookup(document.file_content_type)
@@ -17,11 +17,23 @@
17
17
  :class => "attachment_text_link" %>
18
18
  </div>
19
19
 
20
- <div class="picture_link">
20
+ <div class="picture_link picture_thumbnail_show">
21
21
  <%= link_to thumb_for(picture, 130),
22
- {:controller => "documents", :action => "download", :id => picture},
22
+ picture,
23
23
  :type => picture.type,
24
24
  :title => picture.file_file_name,
25
25
  :path => document_path(picture) %>
26
26
  </div>
27
27
  <% end %>
28
+
29
+
30
+ <%= javascript_tag do %>
31
+ $(document).ready(function() {
32
+ $('.picture_thumbnail_show a').lightBox({
33
+ imageLoading: 'assets/lightbox-ico-loading.gif',
34
+ imageBtnClose: 'assets/lightbox-btn-close.gif',
35
+ imageBtnPrev: 'assets/lightbox-btn-prev.gif',
36
+ imageBtnNext: 'assets/lightbox-btn-next.gif',
37
+ imageBlank: 'assets/lightbox-blank.gif'});
38
+ })
39
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "0.2.7".freeze
3
+ VERSION = "0.2.8".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.9.7')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.9.8')
16
16
  s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
17
17
  s.add_runtime_dependency('paperclip','2.3.11')
18
18
  s.add_runtime_dependency('delayed_paperclip','>= 0.7.2')
@@ -0,0 +1,42 @@
1
+ /**
2
+ * jQuery lightBox plugin
3
+ * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
4
+ * and adapted to me for use like a plugin from jQuery.
5
+ * @name jquery-lightbox-0.5.js
6
+ * @author Leandro Vieira Pinho - http://leandrovieira.com
7
+ * @version 0.5
8
+ * @date April 11, 2008
9
+ * @category jQuery plugin
10
+ * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
11
+ * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
12
+ * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
13
+ */
14
+ (function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'images/lightbox-ico-loading.gif',imageBtnPrev:'images/lightbox-btn-prev.gif',imageBtnNext:'images/lightbox-btn-next.gif',imageBtnClose:'images/lightbox-btn-close.gif',imageBlank:'images/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
15
+ function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}}
16
+ while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
17
+ _set_image_to_view();}
18
+ function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
19
+ function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
20
+ var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
21
+ $('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
22
+ if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
23
+ function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
24
+ if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
25
+ _enable_keyboard_navigation();}
26
+ function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
27
+ function _disable_keyboard_navigation(){$(document).unbind();}
28
+ function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
29
+ key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
30
+ if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
31
+ if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
32
+ function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
33
+ if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
34
+ function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
35
+ function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
36
+ var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
37
+ windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
38
+ if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
39
+ if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
40
+ arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
41
+ arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
42
+ while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);
@@ -0,0 +1,101 @@
1
+ /**
2
+ * jQuery lightBox plugin
3
+ * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
4
+ * and adapted to me for use like a plugin from jQuery.
5
+ * @name jquery-lightbox-0.5.css
6
+ * @author Leandro Vieira Pinho - http://leandrovieira.com
7
+ * @version 0.5
8
+ * @date April 11, 2008
9
+ * @category jQuery plugin
10
+ * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
11
+ * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
12
+ * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
13
+ */
14
+ #jquery-overlay {
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ z-index: 90;
19
+ width: 100%;
20
+ height: 500px;
21
+ }
22
+ #jquery-lightbox {
23
+ position: absolute;
24
+ top: 0;
25
+ left: 0;
26
+ width: 100%;
27
+ z-index: 100;
28
+ text-align: center;
29
+ line-height: 0;
30
+ }
31
+ #jquery-lightbox a img { border: none; }
32
+ #lightbox-container-image-box {
33
+ position: relative;
34
+ background-color: #fff;
35
+ width: 250px;
36
+ height: 250px;
37
+ margin: 0 auto;
38
+ }
39
+ #lightbox-container-image { padding: 10px; }
40
+ #lightbox-loading {
41
+ position: absolute;
42
+ top: 40%;
43
+ left: 0%;
44
+ height: 25%;
45
+ width: 100%;
46
+ text-align: center;
47
+ line-height: 0;
48
+ }
49
+ #lightbox-nav {
50
+ position: absolute;
51
+ top: 0;
52
+ left: 0;
53
+ height: 100%;
54
+ width: 100%;
55
+ z-index: 10;
56
+ }
57
+ #lightbox-container-image-box > #lightbox-nav { left: 0; }
58
+ #lightbox-nav a { outline: none;}
59
+ #lightbox-nav-btnPrev, #lightbox-nav-btnNext {
60
+ width: 49%;
61
+ height: 100%;
62
+ zoom: 1;
63
+ display: block;
64
+ }
65
+ #lightbox-nav-btnPrev {
66
+ left: 0;
67
+ float: left;
68
+ }
69
+ #lightbox-nav-btnNext {
70
+ right: 0;
71
+ float: right;
72
+ }
73
+ #lightbox-container-image-data-box {
74
+ font: 10px Verdana, Helvetica, sans-serif;
75
+ background-color: #fff;
76
+ margin: 0 auto;
77
+ line-height: 1.4em;
78
+ overflow: auto;
79
+ width: 100%;
80
+ padding: 0 10px 0;
81
+ }
82
+ #lightbox-container-image-data {
83
+ padding: 0 10px;
84
+ color: #666;
85
+ }
86
+ #lightbox-container-image-data #lightbox-image-details {
87
+ width: 70%;
88
+ float: left;
89
+ text-align: left;
90
+ }
91
+ #lightbox-image-details-caption { font-weight: bold; }
92
+ #lightbox-image-details-currentNumber {
93
+ display: block;
94
+ clear: left;
95
+ padding-bottom: 1.0em;
96
+ }
97
+ #lightbox-secNav-btnClose {
98
+ width: 66px;
99
+ float: right;
100
+ padding-bottom: 0.7em;
101
+ }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-documents
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 7
10
- version: 0.2.7
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - "V\xC3\xADctor S\xC3\xA1nchez Belmar"
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-09-26 00:00:00 +02:00
19
+ date: 2011-09-27 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,12 +27,12 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- hash: 53
30
+ hash: 43
31
31
  segments:
32
32
  - 0
33
33
  - 9
34
- - 7
35
- version: 0.9.7
34
+ - 8
35
+ version: 0.9.8
36
36
  name: social_stream-base
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency
@@ -229,6 +229,11 @@ files:
229
229
  - app/assets/images/btn/btn_video.png
230
230
  - app/assets/images/btn/btn_word.png
231
231
  - app/assets/images/btn/document.png
232
+ - app/assets/images/lightbox-blank.gif
233
+ - app/assets/images/lightbox-btn-close.gif
234
+ - app/assets/images/lightbox-btn-next.gif
235
+ - app/assets/images/lightbox-btn-prev.gif
236
+ - app/assets/images/lightbox-ico-loading.gif
232
237
  - app/assets/javascripts/documents.js.erb
233
238
  - app/assets/javascripts/social_stream-documents.js
234
239
  - app/assets/stylesheets/documents.css
@@ -341,10 +346,12 @@ files:
341
346
  - spec/support/devise.rb
342
347
  - spec/support/mock.rb
343
348
  - vendor/assets/javascripts/jquery.jplayer.js
349
+ - vendor/assets/javascripts/jquery.lightbox.min.js
344
350
  - vendor/assets/stylesheets/jplayer.blue.monday.css
345
351
  - vendor/assets/stylesheets/jplayer.blue.monday.jpg
346
352
  - vendor/assets/stylesheets/jplayer.blue.monday.video.play.hover.png
347
353
  - vendor/assets/stylesheets/jplayer.blue.monday.video.play.png
354
+ - vendor/assets/stylesheets/jquery.lightbox.css
348
355
  - vendor/assets/stylesheets/pbar-ani.gif
349
356
  has_rdoc: true
350
357
  homepage: http://github.com/ging/social_stream-documents