Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

put the images from the feed into fotorama

  • Loading branch information...
commit 9c0be0aa2be235fd57b2bd83f427957de8b8cd40 1 parent d4bc1f8
Roald de Vries authored
Showing with 81 additions and 14 deletions.
  1. +11 −11 index.html
  2. +70 −3 js/index.js
View
22 index.html
@@ -43,17 +43,17 @@
// // search and play song
startMusicByYearRange(1900, 1910);
- // image gallery initialization
- $('#my-fotorama').fotorama({
- data: [
- {img: 'http://www.rijksmuseum.nl/images/aria/sk/org/sk-c-5.org?aria/maxwidth_288', thumb: 'http://www.rijksmuseum.nl/images/aria/sk/org/sk-c-5.org?aria/maxwidth_288', caption: 'One'},
- {img: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-697.org?aria/maxwidth_288', thumb: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-697.org?aria/maxwidth_288'},
- {img: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-268.org?aria/maxwidth_288', thumb: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-268.org?aria/maxwidth_288'}
- ],
- // fullscreen: true
- // autoplay: 5000
- fullscreenIcon: true
- });
+ // // image gallery initialization
+ // $('#my-fotorama').fotorama({
+ // data: [
+ // {img: 'http://www.rijksmuseum.nl/images/aria/sk/org/sk-c-5.org?aria/maxwidth_288', thumb: 'http://www.rijksmuseum.nl/images/aria/sk/org/sk-c-5.org?aria/maxwidth_288', caption: 'One'},
+ // {img: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-697.org?aria/maxwidth_288', thumb: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-697.org?aria/maxwidth_288'},
+ // {img: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-268.org?aria/maxwidth_288', thumb: 'http://www.rijksmuseum.nl/images/aria/rp/org/rp-p-ob-268.org?aria/maxwidth_288'}
+ // ],
+ // // fullscreen: true
+ // // autoplay: 5000
+ // fullscreenIcon: true
+ // });
});
</script>
<script type="text/javascript" src="js/index.js"></script>
View
73 js/index.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.3.1
(function() {
- var originalSync,
+ var FotoramaView, originalSync,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
@@ -181,6 +181,72 @@
})(Backbone.View);
+ FotoramaView = (function(_super) {
+
+ __extends(FotoramaView, _super);
+
+ FotoramaView.name = 'FotoramaView';
+
+ function FotoramaView() {
+ this.render = __bind(this.render, this);
+
+ this.resetCollection = __bind(this.resetCollection, this);
+
+ this.initialize = __bind(this.initialize, this);
+ return FotoramaView.__super__.constructor.apply(this, arguments);
+ }
+
+ FotoramaView.prototype.initialize = function() {
+ return this.collection.on('reset', this.resetCollection);
+ };
+
+ FotoramaView.prototype.resetCollection = function() {
+ var model;
+ this.subviews = (function() {
+ var _i, _len, _ref, _results;
+ _ref = this.collection.models;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ model = _ref[_i];
+ _results.push(new RecordView({
+ model: model
+ }));
+ }
+ return _results;
+ }).call(this);
+ return this.render();
+ };
+
+ FotoramaView.prototype.render = function() {
+ var fotoramaData, fotoramaOptions, model;
+ console.log('rendering', this.$el);
+ fotoramaData = (function() {
+ var _i, _len, _ref, _results;
+ _ref = this.collection.models;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ model = _ref[_i];
+ _results.push({
+ img: model.get('url'),
+ thumb: model.get('url100'),
+ caption: model.get('title')
+ });
+ }
+ return _results;
+ }).call(this);
+ fotoramaOptions = {
+ data: fotoramaData,
+ fullscreen: true,
+ fullscreenIcon: true,
+ height: 400
+ };
+ return this.$el.fotorama(fotoramaOptions);
+ };
+
+ return FotoramaView;
+
+ })(Backbone.View);
+
window.xmlDoc = (function(filename) {
var xhr;
xhr = new window.XMLHttpRequest;
@@ -192,10 +258,11 @@
window.data = Jath.parse(Record.schema, xmlDoc);
$(function() {
- window.bodyView = new BodyView({
+ window.fotoramaView = new FotoramaView({
+ el: $('#my-fotorama'),
collection: new Records
});
- return bodyView.collection.reset(data);
+ return fotoramaView.collection.reset(data);
});
}).call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.