Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Jul 22, 2018
2 parents f9187ca + 407d825 commit 1118a04
Show file tree
Hide file tree
Showing 32 changed files with 413 additions and 143 deletions.
2 changes: 1 addition & 1 deletion client/appfd.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import "bootstrap-select.min.css";
import "bootstrap-switch.min.css";
import "bootstrap-dropmenu.min.css";
import "bootstrap-notifications.min.css";
import "bootstrap-datepicker/dist/css/bootstrap-datepicker3.css";
import "eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css";
import "dd.css";
import "bootstrap-fileinput/css/fileinput.css";

Expand Down
2 changes: 1 addition & 1 deletion client/appmt.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import "bootstrap-select.min.css";
import "bootstrap-switch.min.css";
import "bootstrap-dropmenu.min.css";
import "bootstrap-notifications.min.css";
import "bootstrap-datepicker/dist/css/bootstrap-datepicker.css";
import "eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css";
import "dd.css";
import "bootstrap-fileinput/css/fileinput.css";

Expand Down
2 changes: 1 addition & 1 deletion dev/webpack.appfd.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = new Config().extend({
}),
// CC new FaviconsPlugin('images/user_logo.png'),
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify('1.3.15, 9 July 2018'),
APP_VERSION: JSON.stringify('1.3.16, 22 July 2018'),
// CC SET ABOVE: API: JSON.stringify(BASE_URL+'/api/'),
FACEBOOK_APPID: JSON.stringify('134980666550322'),
FACEBOOK_GRAFFITI_APPID: JSON.stringify('115376591981611'),
Expand Down
4 changes: 4 additions & 0 deletions http/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ nav .nav-tabs>li {
margin-bottom: 5px;
}

.margbotmd {
margin-bottom: 10px;
}

.margbotnone {
margin-bottom: 0px;
}
Expand Down
12 changes: 12 additions & 0 deletions http/css/user.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
color: #61AE24 !important;
}

.photobadge {
color: white;
background-color: blue !important;
position: relative;
top: -36px;
left: -12px;
}

.visbubble
{
position: relative;
Expand Down Expand Up @@ -357,6 +365,10 @@ h1,h2,h3,h4 {
right: 15px;
}

.notiflist {
overflow-x: hidden
}

#js-notifchat ul, #js-notifchat li {
color: black;
background-color: #edeef1;
Expand Down
Binary file added http/images/logos/IceCream.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/images/logos/Lollipop.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions http/js/iznik/models/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ define([
parse: function(ret) {
var self = this;

// Store for context
self.ret = ret;

if (ret.hasOwnProperty('notifications')) {
return ret.notifications;
} else {
Expand Down
2 changes: 2 additions & 0 deletions http/js/iznik/views/infinite.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ define([
fetching: null,
fetchData: {},
fetchPromise: null,
fetchLast: null,
listening: false,
wait: null,

fetch: function (data) {
var self = this;
self.fetchLast = (new Date()).getTime();

if (self.fetchPromise && self.fetching == self.selected) {
// We are already fetching what we need to be.
Expand Down
97 changes: 66 additions & 31 deletions http/js/iznik/views/pages/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,32 @@ define([
}
},

fetchNotifications() {
var self = this;
var p;

if (!self.fetchingNotifications) {
var ctx = self.notifications.ret && self.notifications.ret.context ? self.notifications.ret.context : null;

p = self.notifications.fetch({
remove: false,
data: {
context: ctx
}
});

self.fetchingNotifications = p;

p.then(function() {
self.fetchingNotifications = null;
});
} else {
p = self.fetchingNotifications;
}

return(p);
},

render: function (options) {
var self = this;

Expand Down Expand Up @@ -360,45 +386,43 @@ define([

if ($('.js-notiflist').length) {
// Notifications count and dropdown.
//
// Delay check by a few seconds because loading the rest of the page is more important
// than this.
self.notifications = new Iznik.Collections.Notification();

_.delay(_.bind(function() {
this.notificationCheck();

self.notificationsCV1 = new Backbone.CollectionView({
el: $('.js-notiflist1'),
modelView: Iznik.Views.Notification,
collection: self.notifications,
modelViewOptions: {
page: self,
notificationCheck: self.notificationCheck
},
processKeyEvents: false
});
this.notificationCheck();

self.notificationsCV1 = new Backbone.CollectionView({
el: $('.js-notiflist1'),
modelView: Iznik.Views.Notification,
collection: self.notifications,
modelViewOptions: {
page: self,
notificationCheck: self.notificationCheck
},
processKeyEvents: false,
detachedRendering: true
});

self.notificationsCV2 = new Backbone.CollectionView({
el: $('.js-notiflist2'),
modelView: Iznik.Views.Notification,
collection: self.notifications,
modelViewOptions: {
page: self,
notificationCheck: self.notificationCheck
},
processKeyEvents: false
});
self.notificationsCV2 = new Backbone.CollectionView({
el: $('.js-notiflist2'),
modelView: Iznik.Views.Notification,
collection: self.notifications,
modelViewOptions: {
page: self,
notificationCheck: self.notificationCheck
},
processKeyEvents: false,
detachedRendering: true
});

self.notificationsCV1.render();
self.notificationsCV2.render();
self.notifications.fetch();
}, self), 5000);
self.notificationsCV1.render();
self.notificationsCV2.render();
self.fetchNotifications();

$(".js-notifholder").click(_.bind(function (e) {
var self = this;
self.notifications.ret = null;
// Fetch the notifications, which the CV will then render.
self.notifications.fetch().then(function() {
self.fetchNotifications().then(function() {
// Clear the first notification after a while, because we'll have seen it.
_.delay(function() {
var notif = self.notifications.first();
Expand All @@ -410,6 +434,17 @@ define([
});
}, self));

$('.js-notiflist').on('scroll', function() {
var top = $(this).scrollTop();
var height = $(this).innerHeight();
var scroll = $(this)[0].scrollHeight;
// console.log("Scroll", top, height, scroll);

if (top + height * 2 + 50 >= scroll) {
self.fetchNotifications();
}
})

$(".js-markallnotifread").click(function (e) {
e.preventDefault();
e.stopPropagation();
Expand Down
44 changes: 35 additions & 9 deletions http/js/iznik/views/pages/user/newsfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ define([
shownFind: false,
shownGive: false,

considerFetch: function() {
var self = this;

if (!self.fetchLast || (new Date()).getTime() - self.fetchLast > 0) {
// We last fetched a while ago - fetch again.
self.fetch();
}
},

checkMessage: function() {
var self = this;

Expand Down Expand Up @@ -423,6 +432,15 @@ define([
self.$('.file-preview-frame').remove();
}, 500);
});

$(document).on('hide', function () {
self.tabActive = false;
});

$(document).on('show', function () {
self.tabActive = true;
self.considerFetch();
});
});

return(p);
Expand All @@ -446,23 +464,31 @@ define([

self.model.fetch({
success: function() {
if (self.model.get('replyto')) {
if (self.model.get('deleted')) {
self.$('.js-error').fadeIn('slow');
self.$('.js-back').fadeIn('slow');
} else if (self.model.get('replyto')) {
// Notification is on a reply; render then make sure the reply is visible.
self.model = new Iznik.Models.Newsfeed({
id: self.model.get('replyto')
});

self.model.fetch({
success: function() {
var v = new Iznik.Views.User.Feed.Item({
model: self.model,
highlight: self.options.id
});

v.render().then(function() {
self.$('.js-item').html(v.$el);
if (self.model.get('deleted')) {
self.$('.js-error').fadeIn('slow');
self.$('.js-back').fadeIn('slow');
});
} else {
var v = new Iznik.Views.User.Feed.Item({
model: self.model,
highlight: self.options.id
});

v.render().then(function() {
self.$('.js-item').html(v.$el);
self.$('.js-back').fadeIn('slow');
});
}
},
error: function() {
self.$('.js-error').fadeIn('slow');
Expand Down
30 changes: 17 additions & 13 deletions http/js/iznik/views/pages/user/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ define([
'underscore',
'backbone',
'iznik/base',
'jquery-ui',
'moment',
'iznik/views/pages/pages',
'iznik/views/pages/user/pages',
'iznik/views/postaladdress',
'iznik/views/user/schedule',
'iznik/views/help',
'bootstrap-switch',
'bootstrap-datepicker'
], function($, _, Backbone, Iznik) {
'eonasdan-bootstrap-datetimepicker'
], function($, _, Backbone, Iznik, moment) {
// We extend WhereAmI to get the location-choosing code.
Iznik.Views.User.Pages.Settings = Iznik.Views.User.Pages.WhereAmI.extend({
template: "user_settings_main",
Expand Down Expand Up @@ -39,7 +39,6 @@ define([
'switchChange.bootstrapSwitch .js-newsletter': 'newsletterSwitch',
'switchChange.bootstrapSwitch #useprofile': 'useProfileSwitch',
'switchChange.bootstrapSwitch .js-notificationmails': 'notificationSwitch',
'changeDate .js-onholidaytill': 'onholidaytill',
'keyup .js-name': 'nameChange',
'click .js-savename': 'nameChange',
'click .js-savepostcode': 'locChange',
Expand Down Expand Up @@ -135,11 +134,14 @@ define([
this.$('.js-showpassword').show();
},

onholidaytill: function() {
onholidaytill: function(e) {
var me = Iznik.Session.get('me');
var till = this.$('.js-onholidaytill').datepicker('getUTCDates');
till = (new Date(Date.parse(till)).toISOString());
this.$('.js-onholidaytill').datepicker('hide');

// Set the hour else midnight and under DST goes back a day.
e.date.hour(5);
var till = e.date.toISOString();

this.$('.js-onholidaytill').datetimepicker('hide');

Iznik.Session.save({
id: me.id,
Expand All @@ -156,7 +158,7 @@ define([
if (this.$('.js-holidayswitch').bootstrapSwitch('state')) {
this.$('.js-onholidaytill').show();
this.$('.js-until').show();
this.$('.js-onholidaytill').datepicker('update', till);
this.$('.js-onholidaytill').datetimepicker('date', till);
} else {
this.$('.js-onholidaytill').val('1970-01-01T00:00:00Z');
this.$('.js-onholidaytill').hide();
Expand Down Expand Up @@ -376,12 +378,14 @@ define([
});

self.$('abbr.timeago').timeago();
self.$('.datepicker').datepicker({
format: 'D, dd MM yyyy',
startDate: '0d',
endDate: '+30d'
self.$('.datepicker').datetimepicker({
format: 'ddd, DD MMMM',
minDate: new moment(),
maxDate: (new moment()).add(30, 'days')
});

self.$('.datepicker').on("dp.change", _.bind(self.onholidaytill, self));

var me = Iznik.Session.get('me');
self.$('.js-name').val(me.displayname);

Expand Down
Loading

0 comments on commit 1118a04

Please sign in to comment.