pullentity-client 0.1.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +2 -0
  3. data/README.md +1 -1
  4. data/lib/pullentity-client/cli.rb +1 -1
  5. data/lib/pullentity-client/generate/auth.rb +32 -18
  6. data/lib/pullentity-client/generate/exporter.rb +14 -2
  7. data/lib/pullentity-client/generate/theme.rb +3 -3
  8. data/lib/pullentity-client/templates/app/assets/javascripts/application.js.erb +2 -1
  9. data/lib/pullentity-client/templates/app/assets/javascripts/config.js.erb +6 -0
  10. data/lib/pullentity-client/templates/app/assets/stylesheets/customtheme.css.scss +14 -8
  11. data/lib/pullentity-client/templates/app/index.html.haml +5 -3
  12. data/lib/pullentity-client/templates/app/views/list.haml +6 -6
  13. data/lib/pullentity-client/templates/app/views/shared/body.haml +5 -5
  14. data/lib/pullentity-client/templates/app/views/shared/head.haml +1 -9
  15. data/lib/pullentity-client/templates/app/views/shared/js.haml +0 -3
  16. data/lib/pullentity-client/templates/app/views/themes/home.haml +0 -1
  17. data/lib/pullentity-client/templates/app/views/themes/list-2.haml +13 -0
  18. data/lib/pullentity-client/templates/app/views/themes/theme1.haml +7 -8
  19. data/lib/pullentity-client/version.rb +1 -1
  20. data/spec/pullentity-client/generate/exporter_spec.rb +3 -3
  21. data/vendor/.DS_Store +0 -0
  22. data/vendor/assets/javascripts/{pullentity → backbone}/.DS_Store +0 -0
  23. data/vendor/assets/javascripts/backbone/backbone.js +1571 -0
  24. data/vendor/assets/javascripts/backbone/underscore.js +1227 -0
  25. data/vendor/assets/javascripts/bootstrap.js +1964 -0
  26. data/vendor/assets/javascripts/bootstrap.min.js +6 -0
  27. data/vendor/assets/javascripts/galleria/LICENSE +21 -0
  28. data/vendor/assets/javascripts/galleria/galleria-1.2.9.js +6121 -0
  29. data/vendor/assets/javascripts/galleria/galleria-1.2.9.min.js +9 -0
  30. data/vendor/assets/javascripts/galleria/plugins/flickr/flickr-demo.html +62 -0
  31. data/vendor/assets/javascripts/galleria/plugins/flickr/flickr-loader.gif +0 -0
  32. data/vendor/assets/javascripts/galleria/plugins/flickr/galleria.flickr.js +383 -0
  33. data/vendor/assets/javascripts/galleria/plugins/flickr/galleria.flickr.min.js +8 -0
  34. data/vendor/assets/javascripts/galleria/plugins/flickr/loader.gif +0 -0
  35. data/vendor/assets/javascripts/galleria/plugins/history/galleria.history.js +146 -0
  36. data/vendor/assets/javascripts/galleria/plugins/history/galleria.history.min.js +8 -0
  37. data/vendor/assets/javascripts/galleria/plugins/history/history-demo.html +100 -0
  38. data/vendor/assets/javascripts/galleria/plugins/picasa/galleria.picasa.js +320 -0
  39. data/vendor/assets/javascripts/galleria/plugins/picasa/galleria.picasa.min.js +8 -0
  40. data/vendor/assets/javascripts/galleria/plugins/picasa/loader.gif +0 -0
  41. data/vendor/assets/javascripts/galleria/plugins/picasa/picasa-demo.html +55 -0
  42. data/vendor/assets/javascripts/galleria/themes/classic/classic-demo.html +124 -0
  43. data/vendor/assets/javascripts/galleria/themes/classic/classic-loader.gif +0 -0
  44. data/vendor/assets/javascripts/galleria/themes/classic/classic-map.png +0 -0
  45. data/vendor/assets/javascripts/galleria/themes/classic/galleria.classic.css +220 -0
  46. data/vendor/assets/javascripts/galleria/themes/classic/galleria.classic.js +95 -0
  47. data/vendor/assets/javascripts/galleria/themes/classic/galleria.classic.min.js +8 -0
  48. data/vendor/assets/javascripts/handlebars.js +2278 -0
  49. data/vendor/assets/javascripts/jquery.infinite-scroll.min.js +1 -0
  50. data/vendor/assets/javascripts/jquery.isotope.min.js +11 -0
  51. data/vendor/assets/javascripts/jquery.loadimage.js +3 -0
  52. data/vendor/assets/javascripts/jquery.masonry.min.js +10 -0
  53. data/vendor/assets/javascripts/jquery.waitforimages.js +4 -0
  54. data/vendor/assets/javascripts/pullentity-backbone/.DS_Store +0 -0
  55. data/vendor/assets/javascripts/pullentity-backbone/app/helpers/app_helper.js.coffee +12 -0
  56. data/vendor/assets/javascripts/pullentity-backbone/app/models/project.js.coffee +11 -0
  57. data/vendor/assets/javascripts/pullentity-backbone/app/models/section.js.coffee +13 -0
  58. data/vendor/assets/javascripts/pullentity-backbone/app/models/site.js.coffee +7 -0
  59. data/vendor/assets/javascripts/pullentity-backbone/app/routers/router.coffee +7 -0
  60. data/vendor/assets/javascripts/pullentity-backbone/app/site.js.coffee +33 -0
  61. data/vendor/assets/javascripts/pullentity-backbone/app/views/main.js.coffee +123 -0
  62. data/vendor/assets/javascripts/pullentity-backbone/application.js.coffee +8 -0
  63. data/vendor/assets/javascripts/pullentity.js +3 -0
  64. data/vendor/assets/stylesheets/bootstrap.css +4677 -0
  65. data/vendor/assets/stylesheets/bootstrap.min.css +9 -0
  66. data/vendor/assets/stylesheets/galleria/LICENSE +21 -0
  67. data/vendor/assets/stylesheets/galleria/galleria-1.2.9.js +6121 -0
  68. data/vendor/assets/stylesheets/galleria/galleria-1.2.9.min.js +9 -0
  69. data/vendor/assets/stylesheets/galleria/plugins/flickr/flickr-demo.html +62 -0
  70. data/vendor/assets/stylesheets/galleria/plugins/flickr/flickr-loader.gif +0 -0
  71. data/vendor/assets/stylesheets/galleria/plugins/flickr/galleria.flickr.js +383 -0
  72. data/vendor/assets/stylesheets/galleria/plugins/flickr/galleria.flickr.min.js +8 -0
  73. data/vendor/assets/stylesheets/galleria/plugins/flickr/loader.gif +0 -0
  74. data/vendor/assets/stylesheets/galleria/plugins/history/galleria.history.js +146 -0
  75. data/vendor/assets/stylesheets/galleria/plugins/history/galleria.history.min.js +8 -0
  76. data/vendor/assets/stylesheets/galleria/plugins/history/history-demo.html +100 -0
  77. data/vendor/assets/stylesheets/galleria/plugins/picasa/galleria.picasa.js +320 -0
  78. data/vendor/assets/stylesheets/galleria/plugins/picasa/galleria.picasa.min.js +8 -0
  79. data/vendor/assets/stylesheets/galleria/plugins/picasa/loader.gif +0 -0
  80. data/vendor/assets/stylesheets/galleria/plugins/picasa/picasa-demo.html +55 -0
  81. data/vendor/assets/stylesheets/galleria/themes/classic/classic-demo.html +124 -0
  82. data/vendor/assets/stylesheets/galleria/themes/classic/classic-loader.gif +0 -0
  83. data/vendor/assets/stylesheets/galleria/themes/classic/classic-map-original.png +0 -0
  84. data/vendor/assets/stylesheets/galleria/themes/classic/galleria.classic.css +217 -0
  85. data/vendor/assets/stylesheets/galleria/themes/classic/galleria.classic.js +95 -0
  86. data/vendor/assets/stylesheets/galleria/themes/classic/galleria.classic.min.js +8 -0
  87. metadata +70 -8
  88. data/lib/pullentity-client/templates/defaults/test-data.js.erb +0 -193
  89. data/vendor/assets/javascripts/mustache.js +0 -535
  90. data/vendor/assets/javascripts/pullentity/development.js.coffee +0 -222
  91. data/vendor/assets/javascripts/pullentity.js.erb +0 -3
  92. data/vendor/assets/javascripts/underscore-min.js +0 -1
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Galleria History Plugin 2012-04-04
3
+ * http://galleria.io
4
+ *
5
+ * Licensed under the MIT license
6
+ * https://raw.github.com/aino/galleria/master/LICENSE
7
+ *
8
+ */
9
+
10
+ (function( $, window ) {
11
+
12
+ /*global jQuery, Galleria, window */
13
+
14
+ Galleria.requires(1.25, 'The History Plugin requires Galleria version 1.2.5 or later.');
15
+
16
+ Galleria.History = (function() {
17
+
18
+ var onloads = [],
19
+
20
+ init = false,
21
+
22
+ loc = window.location,
23
+
24
+ doc = window.document,
25
+
26
+ ie = Galleria.IE,
27
+
28
+ support = 'onhashchange' in window && ( doc.mode === undefined || doc.mode > 7 ),
29
+
30
+ iframe,
31
+
32
+ get = function( winloc ) {
33
+ if( iframe && !support && Galleria.IE ) {
34
+ winloc = winloc || iframe.location;
35
+ } else {
36
+ winloc = loc;
37
+ }
38
+ return parseInt( winloc.hash.substr(2), 10 );
39
+ },
40
+
41
+ saved = get( loc ),
42
+
43
+ callbacks = [],
44
+
45
+ onchange = function() {
46
+ $.each( callbacks, function( i, fn ) {
47
+ fn.call( window, get() );
48
+ });
49
+ },
50
+
51
+ ready = function() {
52
+ $.each( onloads, function(i, fn) {
53
+ fn();
54
+ });
55
+
56
+ init = true;
57
+ },
58
+
59
+ setHash = function( val ) {
60
+ return '/' + val;
61
+ };
62
+
63
+ // always remove support if IE < 8
64
+ if ( support && ie < 8 ) {
65
+ support = false;
66
+ }
67
+
68
+ if ( !support ) {
69
+
70
+ $(function() {
71
+
72
+ var interval = window.setInterval(function() {
73
+
74
+ var hash = get();
75
+
76
+ if ( !isNaN( hash ) && hash != saved ) {
77
+ saved = hash;
78
+ loc.hash = setHash( hash );
79
+ onchange();
80
+ }
81
+
82
+ }, 50);
83
+
84
+ if ( ie ) {
85
+
86
+ $('<iframe tabindex="-1" title="empty">').hide().attr( 'src', 'about:blank' ).one('load', function() {
87
+
88
+ iframe = this.contentWindow;
89
+
90
+ ready();
91
+
92
+ }).insertAfter(doc.body);
93
+
94
+ } else {
95
+ ready();
96
+ }
97
+ });
98
+ } else {
99
+ ready();
100
+ }
101
+
102
+ return {
103
+
104
+ change: function( fn ) {
105
+
106
+ callbacks.push( fn );
107
+
108
+ if( support ) {
109
+ window.onhashchange = onchange;
110
+ }
111
+ },
112
+
113
+ set: function( val ) {
114
+
115
+ if ( isNaN( val ) ) {
116
+ return;
117
+ }
118
+
119
+ if ( !support && ie ) {
120
+
121
+ this.ready(function() {
122
+
123
+ var idoc = iframe.document;
124
+ idoc.open();
125
+ idoc.close();
126
+
127
+ iframe.location.hash = setHash( val );
128
+
129
+ });
130
+ }
131
+
132
+ loc.hash = setHash( val );
133
+ },
134
+
135
+ ready: function(fn) {
136
+ if (!init) {
137
+ onloads.push(fn);
138
+ } else {
139
+ fn();
140
+ }
141
+ }
142
+ };
143
+ }());
144
+
145
+ }( jQuery, this ));
146
+
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Galleria History Plugin 2012-04-04
3
+ * http://galleria.io
4
+ *
5
+ * Licensed under the MIT license
6
+ * https://raw.github.com/aino/galleria/master/LICENSE
7
+ *
8
+ */(function(a,b){Galleria.requires(1.25,"The History Plugin requires Galleria version 1.2.5 or later."),Galleria.History=function(){var c=[],d=!1,e=b.location,f=b.document,g=Galleria.IE,h="onhashchange"in b&&(f.mode===undefined||f.mode>7),i,j=function(a){return i&&!h&&Galleria.IE?a=a||i.location:a=e,parseInt(a.hash.substr(2),10)},k=j(e),l=[],m=function(){a.each(l,function(a,c){c.call(b,j())})},n=function(){a.each(c,function(a,b){b()}),d=!0},o=function(a){return"/"+a};return h&&g<8&&(h=!1),h?n():a(function(){var c=b.setInterval(function(){var a=j();!isNaN(a)&&a!=k&&(k=a,e.hash=o(a),m())},50);g?a('<iframe tabindex="-1" title="empty">').hide().attr("src","about:blank").one("load",function(){i=this.contentWindow,n()}).insertAfter(f.body):n()}),{change:function(a){l.push(a),h&&(b.onhashchange=m)},set:function(a){if(isNaN(a))return;!h&&g&&this.ready(function(){var b=i.document;b.open(),b.close(),i.location.hash=o(a)}),e.hash=o(a)},ready:function(a){d?a():c.push(a)}}}()})(jQuery,this);
@@ -0,0 +1,100 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Galleria History Plugin</title>
6
+ <style>
7
+
8
+ /* Demo styles */
9
+ html,body{background:#222;margin:0;}
10
+ body{border-top:4px solid #000;}
11
+ .content{color:#777;font:12px/1.4 "helvetica neue",arial,sans-serif;width:620px;margin:20px auto;}
12
+ h1{font-size:12px;font-weight:normal;color:#ddd;margin:0;}
13
+ p{margin:0 0 20px}
14
+ a {color:#22BCB9;text-decoration:none;}
15
+ .cred{margin-top:20px;font-size:11px;}
16
+
17
+ /* This rule is read by Galleria to define the gallery height: */
18
+ #galleria{height:320px}
19
+
20
+ </style>
21
+
22
+ <!-- load jQuery -->
23
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
24
+
25
+ <!-- load Galleria -->
26
+ <script src="../../galleria-1.2.9.min.js"></script>
27
+
28
+ <!-- load the History plugin, no need for further scripting -->
29
+ <script src="galleria.history.min.js"></script>
30
+
31
+ </head>
32
+ <body>
33
+ <div class="content">
34
+ <h1>Galleria History Plugin</h1>
35
+ <p>Demonstrating a basic history example. Supports most browsers, including FF 3.0+ and IE 7+</p>
36
+
37
+ <!-- Adding gallery images. We use resized thumbnails here for better performance, but it’s not necessary -->
38
+
39
+ <div id="galleria">
40
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/800px-Locomotives-Roundhouse2.jpg">
41
+ <img title="Locomotives Roundhouse"
42
+ alt="Steam locomotives of the Chicago &amp; North Western Railway."
43
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/100px-Locomotives-Roundhouse2.jpg">
44
+ </a>
45
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Icebergs_in_the_High_Arctic_-_20050907.jpg/1000px-Icebergs_in_the_High_Arctic_-_20050907.jpg">
46
+ <img title="Icebergs in the High Arctic"
47
+ alt="”The debris loading isn't particularly extensive, but the color is usual.”"
48
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Icebergs_in_the_High_Arctic_-_20050907.jpg/100px-Icebergs_in_the_High_Arctic_-_20050907.jpg">
49
+ </a>
50
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/1000px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
51
+ <img title="Araña"
52
+ alt="Xysticus cristatus, A Estrada, Galicia, Spain"
53
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/100px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
54
+ </a>
55
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg/1000px-9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg">
56
+ <img title="Museo storia naturale"
57
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg/100px-9104_-_Milano_-_Museo_storia_naturale_-_Fluorite_-_Foto_Giovanni_Dall%27Orto_22-Apr-2007.jpg">
58
+ </a>
59
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg/1000px-Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg">
60
+ <img title="Grjótagjá caves in summer 2009"
61
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg/100px-Grj%C3%B3tagj%C3%A1_caves_in_summer_2009_%282%29.jpg">
62
+ </a>
63
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/9/90/20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg/1000px-20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg">
64
+ <img title="Thermes"
65
+ alt="Xanthi hot-spa springs, Xanthi Prefecture, Greece"
66
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/90/20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg/100px-20091128_Loutra_Thermes_Xanthi_Thrace_Greece_2.jpg">
67
+ </a>
68
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Polish_Army_Ko%C5%82obrzeg_077.JPG/1024px-Polish_Army_Ko%C5%82obrzeg_077.JPG">
69
+ <img title="Polish Army Kołobrzeg"
70
+ alt="A display of the Polish Army. Both the soldier, and the vehicle belong to the 7th Pomeranian Coastal Defence Brigade, a part of the Szczecin-based 12th Mechanized Division ”Bolesław Krzywousty”"
71
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/5/58/Polish_Army_Ko%C5%82obrzeg_077.JPG/100px-Polish_Army_Ko%C5%82obrzeg_077.JPG">
72
+ </a>
73
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/20100213_Zlatograd_Bulgaria_3.jpg/1024px-20100213_Zlatograd_Bulgaria_3.jpg">
74
+ <img title="Zlatograd Bulgaria"
75
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/20100213_Zlatograd_Bulgaria_3.jpg/100px-20100213_Zlatograd_Bulgaria_3.jpg">
76
+ </a>
77
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg/1024px-FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg">
78
+ <img title="09-28-2001 in New York City"
79
+ alt="New York, NY, September 28, 2001 -- Debris on surrounding roofs at the site of the World Trade Center. Photo by Andrea Booher/ FEMA News Photo"
80
+ src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg/100px-FEMA_-_5399_-_Photograph_by_Andrea_Booher_taken_on_09-28-2001_in_New_York.jpg">
81
+ </a>
82
+ <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Antennae%2C_Hubble_images.jpg/1024px-Antennae%2C_Hubble_images.jpg">
83
+ <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Antennae%2C_Hubble_images.jpg/100px-Antennae%2C_Hubble_images.jpg">
84
+ </a>
85
+ </div>
86
+
87
+ <p class="cred">Made by <a href="http://galleria.aino.se">Galleria</a>.</p>
88
+ </div>
89
+
90
+ <script>
91
+
92
+ // Load the classic theme
93
+ Galleria.loadTheme('../../themes/classic/galleria.classic.min.js');
94
+
95
+ // Initialize Galleria
96
+ Galleria.run('#galleria');
97
+
98
+ </script>
99
+ </body>
100
+ </html>
@@ -0,0 +1,320 @@
1
+ /**
2
+ * Galleria Picasa Plugin 2012-04-04
3
+ * http://galleria.io
4
+ *
5
+ * Licensed under the MIT license
6
+ * https://raw.github.com/aino/galleria/master/LICENSE
7
+ *
8
+ */
9
+
10
+ (function($) {
11
+
12
+ /*global jQuery, Galleria, window */
13
+
14
+ Galleria.requires(1.25, 'The Picasa Plugin requires Galleria version 1.2.5 or later.');
15
+
16
+ // The script path
17
+ var PATH = Galleria.utils.getScriptPath();
18
+
19
+ /**
20
+
21
+ @class
22
+ @constructor
23
+
24
+ @example var picasa = new Galleria.Picasa();
25
+
26
+ @author http://aino.se
27
+
28
+ @requires jQuery
29
+ @requires Galleria
30
+
31
+ @returns Instance
32
+ */
33
+
34
+ Galleria.Picasa = function() {
35
+
36
+ this.options = {
37
+ max: 30, // photos to return
38
+ imageSize: 'medium', // photo size ( thumb,small,medium,big,original ) or a number
39
+ thumbSize: 'thumb', // thumbnail size ( thumb,small,medium,big,original ) or a number
40
+ complete: function(){} // callback to be called inside the Galleria.prototype.load
41
+ };
42
+
43
+ };
44
+
45
+ Galleria.Picasa.prototype = {
46
+
47
+ // bring back the constructor reference
48
+
49
+ constructor: Galleria.Picasa,
50
+
51
+ /**
52
+ Search for anything at Picasa
53
+
54
+ @param {String} phrase The string to search for
55
+ @param {Function} [callback] The callback to be called when the data is ready
56
+
57
+ @returns Instance
58
+ */
59
+
60
+ search: function( phrase, callback ) {
61
+ return this._call( 'search', 'all', {
62
+ q: phrase
63
+ }, callback );
64
+ },
65
+
66
+ /**
67
+ Get a user's public photos
68
+
69
+ @param {String} username The username to fetch photos from
70
+ @param {Function} [callback] The callback to be called when the data is ready
71
+
72
+ @returns Instance
73
+ */
74
+
75
+ user: function( username, callback ) {
76
+ return this._call( 'user', 'user/' + username, callback );
77
+ },
78
+
79
+ /**
80
+ Get photos from an album
81
+
82
+ @param {String} username The username that owns the album
83
+ @param {String} album The album ID
84
+ @param {Function} [callback] The callback to be called when the data is ready
85
+
86
+ @returns Instance
87
+ */
88
+
89
+ useralbum: function( username, album, callback ) {
90
+ return this._call( 'useralbum', 'user/' + username + '/album/' + album, callback );
91
+ },
92
+
93
+ /**
94
+ Set picasa options
95
+
96
+ @param {Object} options The options object to blend
97
+
98
+ @returns Instance
99
+ */
100
+
101
+ setOptions: function( options ) {
102
+ $.extend(this.options, options);
103
+ return this;
104
+ },
105
+
106
+
107
+ // call Picasa
108
+
109
+ _call: function( type, url, params, callback ) {
110
+
111
+ url = 'https://picasaweb.google.com/data/feed/api/' + url + '?';
112
+
113
+ if (typeof params == 'function') {
114
+ callback = params;
115
+ params = {};
116
+ }
117
+
118
+ var self = this;
119
+
120
+ params = $.extend({
121
+ 'kind': 'photo',
122
+ 'access': 'public',
123
+ 'max-results': this.options.max,
124
+ 'thumbsize': this._getSizes().join(','),
125
+ 'alt': 'json-in-script',
126
+ 'callback': '?'
127
+ }, params );
128
+
129
+ $.each(params, function( key, value ) {
130
+ url += '&' + key + '=' + value;
131
+ });
132
+
133
+ // since Picasa throws 404 when the call is malformed, we must set a timeout here:
134
+
135
+ var data = false;
136
+
137
+ Galleria.utils.wait({
138
+ until: function() {
139
+ return data;
140
+ },
141
+ success: function() {
142
+ self._parse.call( self, data.feed.entry, callback );
143
+ },
144
+ error: function() {
145
+ var msg = '';
146
+ if ( type == 'user' ) {
147
+ msg = 'user not found.';
148
+ } else if ( type == 'useralbum' ) {
149
+ msg = 'album or user not found.';
150
+ }
151
+ Galleria.raise('Picasa request failed' + (msg ? ': ' + msg : '.'));
152
+ },
153
+ timeout: 5000
154
+ });
155
+
156
+ $.getJSON( url, function( result ) {
157
+ data = result;
158
+ });
159
+
160
+ return self;
161
+ },
162
+
163
+
164
+ // parse image sizes and return an array of three
165
+
166
+ _getSizes: function() {
167
+
168
+ var self = this,
169
+ norm = {
170
+ small: '72c',
171
+ thumb: '104u',
172
+ medium: '640u',
173
+ big: '1024u',
174
+ original: '1600u'
175
+ },
176
+ op = self.options,
177
+ t = {},
178
+ n,
179
+ sz = [32,48,64,72,94,104,110,128,144,150,160,200,220,288,320,400,512,576,640,720,800,912,1024,1152,1280,1440,1600];
180
+
181
+ $(['thumbSize', 'imageSize']).each(function() {
182
+ if( op[this] in norm ) {
183
+ t[this] = norm[ op[this] ];
184
+ } else {
185
+ n = Galleria.utils.parseValue( op[this] );
186
+ if (n > 1600) {
187
+ n = 1600;
188
+ } else {
189
+ $.each( sz, function(i) {
190
+ if ( n < this ) {
191
+ n = sz[i-1];
192
+ return false;
193
+ }
194
+ });
195
+ }
196
+ t[this] = n;
197
+ }
198
+ });
199
+
200
+ return [ t.thumbSize, t.imageSize, '1280u'];
201
+
202
+ },
203
+
204
+
205
+ // parse the result and call the callback with the galleria-ready data array
206
+
207
+ _parse: function( data, callback ) {
208
+
209
+ var self = this,
210
+ gallery = [],
211
+ img;
212
+
213
+ $.each( data, function() {
214
+
215
+ img = this.media$group.media$thumbnail;
216
+
217
+ gallery.push({
218
+ thumb: img[0].url,
219
+ image: img[1].url,
220
+ big: img[2].url,
221
+ title: this.summary.$t
222
+ });
223
+ });
224
+
225
+ callback.call( this, gallery );
226
+ }
227
+ };
228
+
229
+
230
+ /**
231
+ Galleria modifications
232
+ We fake-extend the load prototype to make Picasa integration as simple as possible
233
+ */
234
+
235
+
236
+ // save the old prototype in a local variable
237
+
238
+ var load = Galleria.prototype.load;
239
+
240
+
241
+ // fake-extend the load prototype using the picasa data
242
+
243
+ Galleria.prototype.load = function() {
244
+
245
+ // pass if no data is provided or picasa option not found
246
+ if ( arguments.length || typeof this._options.picasa !== 'string' ) {
247
+ load.apply( this, Galleria.utils.array( arguments ) );
248
+ return;
249
+ }
250
+
251
+ // define some local vars
252
+ var self = this,
253
+ args = Galleria.utils.array( arguments ),
254
+ picasa = this._options.picasa.split(':'),
255
+ p,
256
+ opts = $.extend({}, self._options.picasaOptions),
257
+ loader = typeof opts.loader !== 'undefined' ?
258
+ opts.loader : $('<div>').css({
259
+ width: 48,
260
+ height: 48,
261
+ opacity: 0.7,
262
+ background:'#000 url('+PATH+'loader.gif) no-repeat 50% 50%'
263
+ });
264
+
265
+ if ( picasa.length ) {
266
+
267
+ // validate the method
268
+ if ( typeof Galleria.Picasa.prototype[ picasa[0] ] !== 'function' ) {
269
+ Galleria.raise( picasa[0] + ' method not found in Picasa plugin' );
270
+ return load.apply( this, args );
271
+ }
272
+
273
+ // validate the argument
274
+ if ( !picasa[1] ) {
275
+ Galleria.raise( 'No picasa argument found' );
276
+ return load.apply( this, args );
277
+ }
278
+
279
+ // apply the preloader
280
+ window.setTimeout(function() {
281
+ self.$( 'target' ).append( loader );
282
+ },100);
283
+
284
+ // create the instance
285
+ p = new Galleria.Picasa();
286
+
287
+ // apply Flickr options
288
+ if ( typeof self._options.picasaOptions === 'object' ) {
289
+ p.setOptions( self._options.picasaOptions );
290
+ }
291
+
292
+ // call the picasa method and trigger the DATA event
293
+ var arg = [];
294
+ if ( picasa[0] == 'useralbum' ) {
295
+ arg = picasa[1].split('/');
296
+ if (arg.length != 2) {
297
+ Galleria.raise( 'Picasa useralbum not correctly formatted (should be [user]/[album])');
298
+ return;
299
+ }
300
+ } else {
301
+ arg.push( picasa[1] );
302
+ }
303
+
304
+ arg.push(function(data) {
305
+ self._data = data;
306
+ loader.remove();
307
+ self.trigger( Galleria.DATA );
308
+ p.options.complete.call(p, data);
309
+ });
310
+
311
+ p[ picasa[0] ].apply( p, arg );
312
+
313
+ } else {
314
+
315
+ // if flickr array not found, pass
316
+ load.apply( this, args );
317
+ }
318
+ };
319
+
320
+ }( jQuery ) );
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Galleria Picasa Plugin 2012-04-04
3
+ * http://galleria.io
4
+ *
5
+ * Licensed under the MIT license
6
+ * https://raw.github.com/aino/galleria/master/LICENSE
7
+ *
8
+ */(function(a){Galleria.requires(1.25,"The Picasa Plugin requires Galleria version 1.2.5 or later.");var b=Galleria.utils.getScriptPath();Galleria.Picasa=function(){this.options={max:30,imageSize:"medium",thumbSize:"thumb",complete:function(){}}},Galleria.Picasa.prototype={constructor:Galleria.Picasa,search:function(a,b){return this._call("search","all",{q:a},b)},user:function(a,b){return this._call("user","user/"+a,b)},useralbum:function(a,b,c){return this._call("useralbum","user/"+a+"/album/"+b,c)},setOptions:function(b){return a.extend(this.options,b),this},_call:function(b,c,d,e){c="https://picasaweb.google.com/data/feed/api/"+c+"?",typeof d=="function"&&(e=d,d={});var f=this;d=a.extend({kind:"photo",access:"public","max-results":this.options.max,thumbsize:this._getSizes().join(","),alt:"json-in-script",callback:"?"},d),a.each(d,function(a,b){c+="&"+a+"="+b});var g=!1;return Galleria.utils.wait({until:function(){return g},success:function(){f._parse.call(f,g.feed.entry,e)},error:function(){var a="";b=="user"?a="user not found.":b=="useralbum"&&(a="album or user not found."),Galleria.raise("Picasa request failed"+(a?": "+a:"."))},timeout:5e3}),a.getJSON(c,function(a){g=a}),f},_getSizes:function(){var b=this,c={small:"72c",thumb:"104u",medium:"640u",big:"1024u",original:"1600u"},d=b.options,e={},f,g=[32,48,64,72,94,104,110,128,144,150,160,200,220,288,320,400,512,576,640,720,800,912,1024,1152,1280,1440,1600];return a(["thumbSize","imageSize"]).each(function(){d[this]in c?e[this]=c[d[this]]:(f=Galleria.utils.parseValue(d[this]),f>1600?f=1600:a.each(g,function(a){if(f<this)return f=g[a-1],!1}),e[this]=f)}),[e.thumbSize,e.imageSize,"1280u"]},_parse:function(b,c){var d=this,e=[],f;a.each(b,function(){f=this.media$group.media$thumbnail,e.push({thumb:f[0].url,image:f[1].url,big:f[2].url,title:this.summary.$t})}),c.call(this,e)}};var c=Galleria.prototype.load;Galleria.prototype.load=function(){if(arguments.length||typeof this._options.picasa!="string"){c.apply(this,Galleria.utils.array(arguments));return}var d=this,e=Galleria.utils.array(arguments),f=this._options.picasa.split(":"),g,h=a.extend({},d._options.picasaOptions),i=typeof h.loader!="undefined"?h.loader:a("<div>").css({width:48,height:48,opacity:.7,background:"#000 url("+b+"loader.gif) no-repeat 50% 50%"});if(f.length){if(typeof Galleria.Picasa.prototype[f[0]]!="function")return Galleria.raise(f[0]+" method not found in Picasa plugin"),c.apply(this,e);if(!f[1])return Galleria.raise("No picasa argument found"),c.apply(this,e);window.setTimeout(function(){d.$("target").append(i)},100),g=new Galleria.Picasa,typeof d._options.picasaOptions=="object"&&g.setOptions(d._options.picasaOptions);var j=[];if(f[0]=="useralbum"){j=f[1].split("/");if(j.length!=2){Galleria.raise("Picasa useralbum not correctly formatted (should be [user]/[album])");return}}else j.push(f[1]);j.push(function(a){d._data=a,i.remove(),d.trigger(Galleria.DATA),g.options.complete.call(g,a)}),g[f[0]].apply(g,j)}else c.apply(this,e)}})(jQuery);
@@ -0,0 +1,55 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Galleria Flickr Plugin</title>
6
+ <style>
7
+
8
+ /* Demo styles */
9
+ html,body{background:#222;margin:0;}
10
+ body{border-top:4px solid #000;}
11
+ .content{color:#777;font:12px/1.4 "helvetica neue",arial,sans-serif;width:620px;margin:20px auto;}
12
+ h1{font-size:12px;font-weight:normal;color:#ddd;margin:0;}
13
+ p{margin:0 0 20px}
14
+ a {color:#22BCB9;text-decoration:none;}
15
+ .cred{margin-top:20px;font-size:11px;}
16
+
17
+ /* This rule is read by Galleria to define the gallery height: */
18
+ #galleria{height:320px;}
19
+
20
+ </style>
21
+
22
+ <!-- load jQuery -->
23
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
24
+
25
+ <!-- load Galleria -->
26
+ <script src="../../galleria-1.2.9.min.js"></script>
27
+
28
+ <!-- load picasa plugin -->
29
+ <script src="galleria.picasa.min.js"></script>
30
+
31
+ </head>
32
+ <body>
33
+ <div class="content">
34
+ <h1>Galleria Picasa Plugin Demo</h1>
35
+ <p>Demonstrating a basic gallery example with photos from a Picasa album.</p>
36
+
37
+ <!-- Adding gallery images. This is just a container for the dynamic picasa images -->
38
+
39
+ <div id="galleria"></div>
40
+
41
+ <p class="cred">Made by <a href="http://galleria.aino.se">Galleria</a>.</p>
42
+ </div>
43
+ <script>
44
+
45
+ // Load the classic theme
46
+ Galleria.loadTheme('../../themes/classic/galleria.classic.min.js');
47
+
48
+ Galleria.run('#galleria', {
49
+ // The user & album. This example fetches the album "Demo" from the user "galleriajs"
50
+ picasa: 'useralbum:galleriajs/Demo'
51
+ });
52
+
53
+ </script>
54
+ </body>
55
+ </html>