fixd missing venue images and description

This commit is contained in:
Martin Donnelly 2018-10-22 17:07:41 +01:00
parent 5303b7f4de
commit d31adcba66
5 changed files with 39 additions and 19 deletions

View File

@ -21,6 +21,7 @@ function reduceExplore(data) {
const iconSuffix = get(categories[0], 'icon.suffix', '');
obj.name = get(localObj, 'name', '');
obj.description = get(localObj, 'description', '');
obj.category = get(categories[0], 'shortName', '');
obj.icon = (iconPrefix !== '') ? `${iconPrefix}64${iconSuffix}` : '';
obj.id = get(localObj, 'id', '');
@ -31,7 +32,7 @@ function reduceExplore(data) {
obj.postcode = get(location, 'postalCode', '');
obj.twitter = get(contact, 'twitter', '');
obj.facebook = get(contact, 'facebookName', '');
obj.url = get(localObj, 'url', '');
obj.url = get(localObj, 'canonicalUrl', '');
obj.latitude = get(location, 'lat', '');
obj.longitude = get(location, 'lng', '');
@ -57,7 +58,7 @@ function reduceYelp(data) {
const urlBit = url[2];
obj.viewIntent = `https://m.yelp.com/${urlBit}`;
}
else
else
obj.viewIntent = '';
return obj;
@ -67,12 +68,18 @@ function reduceFullFS(data) {
const obj = {};
if (typeof data === 'undefined' || isEmpty(data)) return obj;
const localObj = Object.assign({}, data);
const photoBlob = get(localObj, 'photos.groups');
let photoItems;
const photosCount = get(localObj, 'photos.count', 0);
for (const i of photoBlob)
if (i.type === 'venue')
photoItems = i.items;
const photosCount = photoItems.length;
const tipsCount = get(localObj, 'tips.count', 0);
if (photosCount > 0) {
const photoItems = get(localObj, 'photos.groups[0].items');
if (photosCount > 0)
obj.images = photoItems.map(item => {
const prefix = get(item, 'prefix', '');
const suffix = get(item, 'suffix', '');
@ -86,7 +93,6 @@ function reduceFullFS(data) {
return `${prefix}${640}x${ratioHeight}${suffix}`;
});
}
if (tipsCount > 0) {
const tipItems = get(localObj, 'tips.groups[0].items');
@ -100,7 +106,7 @@ function reduceFullFS(data) {
function reduceTwitter(data) {
let obj = [];
if (data.length > 0)
if (data.length > 0)
obj = data.map(item => {
return get(item, 'text');
});

View File

@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const CACHE_VERSION = { 'version': '0.0.918' };
const CACHE_VERSION = { 'version': '0.0.933' };
const PRECACHE = `jubileeData-${CACHE_VERSION.version}`;
const RUNTIME = 'runtime';

View File

@ -66,7 +66,7 @@ const GotoCardView = Backbone.View.extend({
'template': _.template(`
<div id='gotoDetails' class="mui-container" style="margin-bottom: 50px;">
<div><h1>Details</h1></div>
<div id="gotoDetailsText"></div>
<div id="gotoDetailsText" class="mui-panel"></div>
</div>
</div>
`),

View File

@ -102,12 +102,12 @@ const VenueDetailView = Backbone.View.extend({
const $map = $('#map');
if (!isEmpty(m.images))
contents.push(templates.imagesTemplate(m));
contents.push(templates.map());
contents.push(templates.venueDirections());
contents.push(templates.venueDescription(m));
if (!isEmpty(m.yelp))
contents.push(templates.yelpTemplate(m));
@ -117,6 +117,9 @@ const VenueDetailView = Backbone.View.extend({
if (!isEmpty(m.tweets))
contents.push(templates.tweetsTemplate(m));
if (!isEmpty(m.images))
contents.push(templates.imagesTemplate(m));
contents.push(templates.openInFS(m));
this.$el.empty();
this.$el.html(contents.join(''));

View File

@ -21,9 +21,9 @@ const templates = {
<div class="mui-col-xs-10 mui--text-body2">Tips</div>
<div class="mui-col-xs-1" style="font-family:fujicons;"></div>
</div>
<div class='scrolling-wrapper-flexbox' style="height: 100px;">
<div class='scrolling-wrapper-flexbox' style="height: 200px;">
<%_.forEach(tips, function(i) {%>
<div class="scrollCardHalf mui--text-body1">
<div class="scrollCard mui--text-body1">
<%=i %>
</div>
<%}) %>
@ -47,9 +47,9 @@ const templates = {
<div class="mui-col-xs-10 mui--text-body2">Tweets</div>
<div class="mui-col-xs-1" style="font-family:fujicons;"></div>
</div>
<div class='scrolling-wrapper-flexbox' style="height: 100px;">
<div class='scrolling-wrapper-flexbox' style="height: 200px;">
<%_.forEach(tweets, function(i) {%>
<div class="scrollCardHalf mui--text-body1">
<div class="scrollCard mui--text-body1">
<%=i %>
</div>
<%}) %>
@ -59,11 +59,14 @@ const templates = {
'venueTitle' : _.template(`
<div class="mui--text-display1 mui--text-center" style="font-weight: 900;"><%=name %></div>
`),
'venueDescription' : _.template(`
<div class="mui--text-subhead" ><%=description %></div>
`),
'venueDirections' : _.template(`
<div class="mui--text-subhead mui--text-center separate" style="" id="getDirections"><p><i class="fa fa-sm fa-map-marker mui--align-middle " ></i></p><p>Directions</p></div>
`),
'openInFS' : _.template(`
<div class=""><a href="https://m.foursquare.com/v/<%=id%>">Open in Foursquare</a></div>
<div style="margin-bottom:50px"><a href="<%=url%>">Open in Foursquare</a></div>
`),
'map': _.template('<div id="map"></div>'),
'templateCurrently': _.template(`
@ -143,11 +146,19 @@ const templates = {
`),
'templateDirections': _.template(`
<%_.forEach(directions, function(i) {%>
<div class="directionsCard">
<div class="mui--text-body2"><%=i %></div>
<div class="itemRow mui--align-middle">
<span class="mui--text-dark mui--text-subhead"><%=i %></span>
</div>
<%}) %>
`)
};
module.exports = templates;
/*
<div data-id="4b926c3af964a52068f833e3" class="itemRow mui--align-middle">
<img class="mui--align-middle" src="https://ss3.4sqi.net/img/categories_v2/nightlife/pub_32.png" width="32px" height="32px" style="-webkit-filter: invert(100%);">
<span class="mui--text-dark mui--text-subhead">The Mayflower</span> <span class="mui--text-caption mui--text-dark-secondary">Pub</span> </div>
*/