Skip to content
This repository has been archived by the owner on Jun 19, 2020. It is now read-only.

Commit

Permalink
Code updated to target right folder for Joshfire framework. Fix for
Browse files Browse the repository at this point in the history
'useContent' property that was not properly propagated. Manifest file
now allows to specify 2D or 3D map.
  • Loading branch information
tidoust committed Feb 17, 2012
1 parent 285c8d8 commit bce8a12
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 41 deletions.
3 changes: 2 additions & 1 deletion app/index.html
Expand Up @@ -12,9 +12,10 @@
</head>

<body>
<script data-main="js/" src="js/joshfire/adapters/browser/bootstrap.js"></script>
<script data-main="js/" src="js/joshfire/lib/adapters/browser/bootstrap.js"></script>
<script data-joshfire-bootstrap src="js/boot.js"></script>
<script>
Joshfire.basePath = 'joshfire/lib/';
Joshfire.require(['app.browser'], function (App) {
window._app = new App();
});
Expand Down
39 changes: 23 additions & 16 deletions app/js/app.js
Expand Up @@ -79,22 +79,16 @@ Joshfire.define([
setup: function (callback) {
var self = this;
self.__super(callback);

// Subscribe to the afterInsert event that gets triggered
// when... er... that's a good question ???
self.subscribe('afterInsert', function () {
var lang = self.ui.element('/header/menu/lang');
var mode = lang.getState('selection').length ? _.first(lang.getState('selection')) : self.defaultMode;

var categs = self.ui.element(self.categsUIPath);
var categToTheLeft = self.ui.element('/header/menu/categories/rewind');
var categToTheRight = self.ui.element('/header/menu/categories/forward');

var newsList = self.ui.element('/news');
var map = self.ui.element('/map');
if (Joshfire.factory.config.template.options.durAnimation) {
self.newsShiftPeriod = Joshfire.factory.config.template.options.durAnimation * 1000;
}
if (Joshfire.factory.config.template.options.durRefresh) {
self.refreshInterval = Joshfire.factory.config.template.options.durRefresh * 1000;
}

var map = self.ui.element('/map');

/*
TODO: Following code won't work because map has already been initialized
// Set 3D and 3D provider
if (Joshfire.factory.config.template.options.enable3D) {
map.options.enable3D = true;
Expand All @@ -107,7 +101,19 @@ Joshfire.define([
if (Joshfire.factory.config.template.options.provider3D) {
map.options.mapOptions.provider3D = Joshfire.factory.config.template.options.provider3D;
}
*/

// Subscribe to the afterInsert event that gets triggered
// when... er... that's a good question ???
self.subscribe('afterInsert', function () {
var lang = self.ui.element('/header/menu/lang');
var mode = lang.getState('selection').length ? _.first(lang.getState('selection')) : self.defaultMode;

var categs = self.ui.element(self.categsUIPath);
var categToTheLeft = self.ui.element('/header/menu/categories/rewind');
var categToTheRight = self.ui.element('/header/menu/categories/forward');

var newsList = self.ui.element('/news');
var map = self.ui.element('/map');

// There's a weird bug that happens from time to time: the 'data'
// event may not be caught, even it the data was fetched. The workaround
Expand Down Expand Up @@ -205,7 +211,8 @@ Joshfire.define([
if (feed) {
feed.entries = _.map(feed.entries, function (item, index) {
return _.extend(item, {
id: '#' + category.name + '-' + index
id: '#' + category.name + '-' + index,
useContent: category.useContent
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/js/templates.js
Expand Up @@ -7,7 +7,7 @@ Joshfire.define(['joshfire/vendor/underscore'], function(_){
/* news */
templates.newsCity = '<% if (item.location && item.location.city){%><div class="josh-id-city-inner"><%=item.location.city%></div><%}%>';
templates.newsTitle = '<h3><%=item.name%></h3>';
templates.newsImage = '<%if (item.image && item.image.contentURL){%><div class="image"><img src="<%=item.image.contentURL%>" alt=""></div><%} else if (item.contentURL) {%><div class="image"><img src="<%=item.contentURL%>" alt=""></div><%}%>';
templates.newsImage = '<%if (item.contentURL) {%><div class="image"><img src="<%=item.contentURL%>" alt=""></div><%} else if (item.image && item.image.contentURL){%><div class="image"><img src="<%=item.image.contentURL%>" alt=""></div><%}%>';
templates.newsContent = '<div class="content"><%=item.description%></div>';
templates.newsAuthor = '<%if (item.author){%><div class="author"><%=item.author.name%></div><%}%>';
templates.newsCaption = '<div class="caption"><%=item.description%></div>';
Expand Down
23 changes: 0 additions & 23 deletions app/js/tree.data.js
Expand Up @@ -43,29 +43,6 @@ Joshfire.define([
image: {
itemType: 'ImageObject',
contentURL: feedMeta.image
},
children: function (query, cb) {
// When asked, retrieve the elements that compose the datasource
datasource.find({}, function (err, data) {
// The framework requires an 'id', but datasources
// use 'url' (or nothing). Make sure we have an id.
// NB: the framework does not like URL as ids!
if (err) {
// No data, an error occurred
return cb(err);
}
if (!data) {
return cb(null)
}
var items = _.map(data.entries, function (item, idx) {
return _.extend(item, {
id: "#" + idx,
useContent: feedMeta.useContent
});
});

cb(null, items);
});
}
}));
}
Expand Down
19 changes: 19 additions & 0 deletions package.json
Expand Up @@ -84,6 +84,20 @@

"options": {
"schema": {
"enable3D": {
"title": "Enable 3D",
"type": "boolean",
"default": true
},
"provider3D": {
"title": "3D map provider",
"type": "string",
"enum": [
"Bing",
"Google"
],
"default": "Bing"
},
"durAnimation": {
"title": "Display time",
"description": "Time to wait before jumping to next item (in seconds)",
Expand Down Expand Up @@ -265,6 +279,11 @@
}
},
"form": [
{
"key": "enable3D",
"inlinetitle": "Enable 3D globe or stick to a 2D map representation"
},
"provider3D",
"durAnimation",
"durRefresh",
{
Expand Down

0 comments on commit bce8a12

Please sign in to comment.