Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Sep 10, 2018
2 parents 5b1a545 + 34dd714 commit 2fb1d27
Show file tree
Hide file tree
Showing 36 changed files with 345 additions and 242 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ webpack-assets.json
.idea/
iosapp/www/ios/
http/ios/
.package-lock.json

16 changes: 16 additions & 0 deletions http/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,22 @@ blockquote cite:before {
content: "\2013";
}

.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px; height: 0; overflow: hidden;
}

.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
Expand Down
4 changes: 2 additions & 2 deletions http/js/iznik/models/chat/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ define([
}
}).then(function() {
// We've sent it successfully.
trigger.trigger('sent', msg);

Storage.set('chatqueue', JSON.stringify(sending));

if (sending.length > 0) {
// We have another message to send.
_.delay(_.bind(sendQueue, self), 100);
}

trigger.trigger('sent', msg);
});
}
} catch (e) {
Expand Down
19 changes: 16 additions & 3 deletions http/js/iznik/views/chat/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,12 @@ define([

var cb = _.bind(self.fetchedChats, self);

Iznik.Session.chats.fetch().then(cb);
// We only fetch the summary information, for performance.
Iznik.Session.chats.fetch({
data: {
summary: true
}
}).then(cb);
});

$(document).on('hide', function () {
Expand Down Expand Up @@ -589,7 +594,11 @@ define([

self.model.close().then(function() {
// Also refetch the chats, so that our cached copy gets updated.
Iznik.Session.chats.fetch();
Iznik.Session.chats.fetch({
data: {
summary: true
}
});
})
} catch (e) {
console.error(e.message)
Expand Down Expand Up @@ -621,7 +630,11 @@ define([

self.model.block().then(function() {
// Also refetch the chats, so that our cached copy gets updated.
Iznik.Session.chats.fetch();
Iznik.Session.chats.fetch({
data: {
summary: true
}
});
})
} catch (e) {
console.error(e.message)
Expand Down
205 changes: 111 additions & 94 deletions http/js/iznik/views/group/communityevents.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,111 +222,128 @@ define([
save: function() {
var self = this;

if (!self.wait && self.dates.length > 0) {
self.promises = [];
// Check all datas are in the future
var datesvalid = true;
var today = new moment();
self.$('.js-datesinvalid').hide();
self.datesCV.viewManager.each(function(date) {
var start = new moment(date.getStart());
var end = new moment(date.getEnd());

if (start.diff(today) < 0 || end.diff(today) < 0) {
datesvalid = false;
}
});

if (self.$('form').valid()) {
self.wait = new Iznik.Views.PleaseWait({
timeout: 1
});
self.wait.render();
if (!datesvalid) {
self.$('.js-datesinvalid').fadeIn('slow');
} else {
if (!self.wait && self.dates.length > 0) {
self.promises = [];

self.$('input,textarea').each(function () {
var name = $(this).prop('name');
if (name.length > 0 && name != 'photo') {
self.model.set(name, $(this).val());
}
});
if (self.$('form').valid()) {
self.wait = new Iznik.Views.PleaseWait({
timeout: 1
});
self.wait.render();

var p = self.model.save({}, {
success: function(model, response, options) {
if (response.id) {
self.model.set('id', response.id);
self.$('input,textarea').each(function () {
var name = $(this).prop('name');
if (name.length > 0 && name != 'photo') {
self.model.set(name, $(this).val());
}
}
}).then(function() {
// Add the group and dates.
var groups = self.model.get('groups');
if (_.isUndefined(groups) || self.groupSelect.get() != groups[0]['id']) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'AddGroup',
groupid: self.groupSelect.get()
},
success: function (ret) {
if (!_.isUndefined(groups)) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'RemoveGroup',
groupid: groups[0]['id']
}
}));
}
}
}));
}

// Delete any old dates.
var olddates = self.model.get('dates');
_.each(olddates, function(adate) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'RemoveDate',
dateid: adate.id
}
}));
});

// Add new dates.
self.datesCV.viewManager.each(function(date) {
var start = date.getStart();
var end = date.getEnd();

self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'AddDate',
start: start,
end: end
var p = self.model.save({}, {
success: function(model, response, options) {
if (response.id) {
self.model.set('id', response.id);
}
}));
});
}
}).then(function() {
// Add the group and dates.
var groups = self.model.get('groups');
if (_.isUndefined(groups) || self.groupSelect.get() != groups[0]['id']) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'AddGroup',
groupid: self.groupSelect.get()
},
success: function (ret) {
if (!_.isUndefined(groups)) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'RemoveGroup',
groupid: groups[0]['id']
}
}));
}
}
}));
}

if (self.model.get('photo')) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'SetPhoto',
photoid: self.model.get('photo')
}
}));
}
// Delete any old dates.
var olddates = self.model.get('dates');
_.each(olddates, function(adate) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'RemoveDate',
dateid: adate.id
}
}));
});

// Add new dates.
self.datesCV.viewManager.each(function(date) {
var start = date.getStart();
var end = date.getEnd();

self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'AddDate',
start: start,
end: end
}
}));
});

if (self.model.get('photo')) {
self.promises.push($.ajax({
url: API + 'communityevent',
type: 'PATCH',
data: {
id: self.model.get('id'),
action: 'SetPhoto',
photoid: self.model.get('photo')
}
}));
}

Promise.all(self.promises).then(function() {
self.wait.close();
self.wait = null;
self.trigger('saved');
self.model.trigger('edited');
Promise.all(self.promises).then(function() {
self.wait.close();
self.wait = null;
self.trigger('saved');
self.model.trigger('edited');

if (self.closeAfterSave) {
self.close();
(new Iznik.Views.User.CommunityEvent.Confirm()).render();
}
if (self.closeAfterSave) {
self.close();
(new Iznik.Views.User.CommunityEvent.Confirm()).render();
}
});
});
});
}
}
}
},
Expand Down
12 changes: 10 additions & 2 deletions http/js/iznik/views/pages/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,11 @@ define([

self.model.close().then(function() {
// Reload. Bit clunky but it'll do.
Iznik.Session.chats.fetch().then(function() {
Iznik.Session.chats.fetch({
data: {
summary: true
}
}).then(function() {
// CC window.location.reload();
Router.navigate("/chats", true);
});
Expand Down Expand Up @@ -435,7 +439,11 @@ define([

self.model.block().then(function() {
// Reload. Bit clunky but it'll do.
Iznik.Session.chats.fetch().then(function() {
Iznik.Session.chats.fetch({
data: {
summary: true
}
}).then(function() {
window.location.reload();
});
});
Expand Down
2 changes: 1 addition & 1 deletion http/js/iznik/views/pages/modtools/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ define([
},
{
name: 'approvemembers',
label: '(Freegle native groups only) Group approves new members?',
label: '(Freegle native groups only) New member approval required?',
control: 'radio',
options: [{label: 'Yes', value: 1}, {label: 'No', value:0 }],
helpMessage: "Normally members can join immediately, and any posts they make will be moderated. Some groups prefer to approve new members manually, which gives more control over the group but loses postential members."
Expand Down
6 changes: 4 additions & 2 deletions http/js/iznik/views/pages/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ define([
$('.js-unseennews').hide();
}
}

self.notificationChecking = false;
}
});
}
Expand Down Expand Up @@ -388,7 +390,7 @@ define([
collection: self.notifications,
modelViewOptions: {
page: self,
notificationCheck: self.notificationCheck
notificationCheck: _.bind(self.notificationCheck, self)
},
processKeyEvents: false,
detachedRendering: true
Expand All @@ -400,7 +402,7 @@ define([
collection: self.notifications,
modelViewOptions: {
page: self,
notificationCheck: self.notificationCheck
notificationCheck: _.bind(self.notificationCheck, self)
},
processKeyEvents: false,
detachedRendering: true
Expand Down
3 changes: 2 additions & 1 deletion http/js/iznik/views/pages/user/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,8 @@ define([
self.$('.js-description a').attr('data-realurl', true);

// Add the area map.
self.areaMap();
// TODO MAPS
// self.areaMap();

self.collection = new Iznik.Collections.Message(null, {
modtools: false,
Expand Down
6 changes: 5 additions & 1 deletion http/js/iznik/views/pages/user/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,11 @@ define([

var p = Iznik.Views.User.Pages.WhatNext.prototype.render.call(this);
p.then(function () {
if (!Storage.get('dontaskschedule')) {
var now = (new Date()).getTime();
var last = Storage.get('lastaskschedule');

if (!Storage.get('dontaskschedule') && (!last || (now - last > 24 * 60 * 60 * 1000))) {
Storage.set('lastaskschedule', now);
self.listenToOnce(Iznik.Session, 'isLoggedIn', function () {
try {
var v = new Iznik.Views.User.Schedule.Modal({
Expand Down
Loading

0 comments on commit 2fb1d27

Please sign in to comment.