Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Dec 27, 2018
2 parents bb651c9 + ad0b9a4 commit 2d17919
Show file tree
Hide file tree
Showing 36 changed files with 11,402 additions and 45 deletions.
2 changes: 1 addition & 1 deletion dev/webpack.appfd.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = new Config().extend({
}),
// CC new FaviconsPlugin('images/user_logo.png'),
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify('1.4.7, 8 December 2018'),
APP_VERSION: JSON.stringify('1.4.8, 27 December 2018'),
// CC SET ABOVE: API: JSON.stringify(BASE_URL+'/api/'),
FACEBOOK_APPID: JSON.stringify('134980666550322'),
FACEBOOK_GRAFFITI_APPID: JSON.stringify('115376591981611'),
Expand Down
23 changes: 23 additions & 0 deletions http/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -1934,6 +1934,29 @@ blockquote cite:before {
height: 100%;
}

ins.diffins, ins.diffmod {
color: orange;
}

del.diffdel, del.diffmod {
color: red
}

/* Smaller previews and don't allow overflow */

.krajee-default.file-preview-frame .kv-file-content {
width: 100px;
height: 76px;
}

.krajee-default.file-preview-frame .file-thumbnail-footer {
height: 35px;
}

.file-preview-image {
max-height: 75px;
}

/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
Expand Down
Binary file added http/images/logos/Christmas2.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/Christmas3.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 24 additions & 5 deletions http/js/iznik/models/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,21 @@ define([
});
},

serverEdit: function(subject, textbody, htmlbody) {
// We also drop the text part here, because the server will (in its absence)
// convert the HTML variant to text - and do a better job than we may have done on the client.
serverEdit: function(subject, textbody, htmlbody, attachments) {
var self = this;

self.data2 = {
id: self.get('id'),
subject: subject
};

if (!_.isUndefined(attachments) && attachments) {
self.data2.attachments = attachments;
}

if (htmlbody) {
// We drop the text part here, because the server will (in its absence)
// convert the HTML variant to text - and do a better job than we may have done on the client.
self.data2.htmlbody = htmlbody;
} else {
self.data2.textbody = textbody;
Expand Down Expand Up @@ -274,7 +278,7 @@ define([
});
},

edit: function(subject, textbody, htmlbody) {
edit: function(subject, textbody, htmlbody, attachments) {
// We need a closure to guard the parameters.

function closure(self, subject, textbody, htmlbody) {
Expand All @@ -284,7 +288,7 @@ define([
console.log("Edit on group", group);

if (!group.onyahoo) {
self.serverEdit(subject, textbody, htmlbody);
self.serverEdit(subject, textbody, htmlbody, attachments);
} else {
// Editing is complex.
// - We need a crumb from Yahoo to allow us to do it.
Expand Down Expand Up @@ -486,6 +490,21 @@ define([
}

this.set(property, text);
},

isFreegle() {
var self = this;

var isFreegle = false;

var groups = self.get('groups');
_.each(groups, function(group) {
if (group.type === 'Freegle') {
isFreegle = true;
}
});

return(isFreegle);
}
});

Expand Down
7 changes: 7 additions & 0 deletions http/js/iznik/models/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ define([
window: true,
sound: true
},
{
fi: 'editreview',
el: '.js-editreviewcount',
ev: 'editreviewcountschanged',
window: true,
sound: true
},
{
fi: 'pendingother',
el: '.js-pendingcountother',
Expand Down
20 changes: 20 additions & 0 deletions http/js/iznik/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ define([
"modtools/messages/approved/membersearch/:search": "approvedMessagesSearchMembers",
"modtools/messages/approved": "approvedMessages",
"modtools/messages/spam": "spamMessages",
"modtools/messages/edits": "editReviewMessages",
"modtools/members/pending(/:search)": "pendingMembers",
"modtools/members/approved/member/:groupid/:userid": "approvedMember",
"modtools/members/approved(/:search)": "approvedMembers",
Expand Down Expand Up @@ -1227,6 +1228,25 @@ define([
}
},

editReviewMessages: function () {
if (MODTOOLS) {
var self = this;

require(["iznik/views/pages/modtools/messages_editreview"], function () {
self.listenToOnce(Iznik.Session, 'loggedIn', function (loggedIn) {
var page = new Iznik.Views.ModTools.Pages.EditReviewMessages();
self.loadRoute({page: page, modtools: true});
});

Iznik.Session.forceLogin([
'me',
'groups',
'configs'
]);
});
}
},

approvedMessagesSearchMessages: function (search) {
if (MODTOOLS) {
this.approvedMessages(search, null);
Expand Down
110 changes: 86 additions & 24 deletions http/js/iznik/views/pages/modtools/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ define([
], function($, _, Backbone, moment, Iznik) {
Iznik.Views.ModTools.Message = Iznik.View.extend({
events: {
'change .js-fop': 'setFOP'
'change .js-fop': 'setFOP',
'click .js-edithistory': 'editHistory'
},


editHistory: function() {
var self = this;
var v = new Iznik.Views.User.Message.EditHistory({
model: self.model
});

v.render();
},

rarelyUsed: function () {
this.$('.js-rarelyused').fadeOut('slow');
this.$('.js-stdmsgs li').fadeIn('slow');
Expand Down Expand Up @@ -186,7 +196,6 @@ define([

_.each(self.model.get('groups'), function (group) {
var groupid = group.groupid;
console.log("Exclude location", self.model.get('location').id);
$.ajax({
type: 'POST',
url: API + 'locations',
Expand All @@ -204,7 +213,6 @@ define([
collection: self.collectionType
}
}).then(function () {
console.log("New location", self.model.get('location').id);
self.render();
});

Expand Down Expand Up @@ -246,7 +254,7 @@ define([
_.each(fromuser.messagehistory, function (message) {
message.dupage = dupage;

console.log("Check message", message.id, id, message.daysago, Iznik.canonSubj(message.subject), subj);
//console.log("Check message", message.id, id, message.daysago, Iznik.canonSubj(message.subject), subj);
// The id of the message might have been manipulated in user.js to make sure it's unique per
// posting.

Expand Down Expand Up @@ -833,7 +841,6 @@ define([
}
});


Iznik.Views.ModTools.Message.ViewSource = Iznik.Views.Modal.extend({
template: 'modtools_messages_pending_viewsource',

Expand Down Expand Up @@ -876,29 +883,80 @@ define([
self.$('.js-editfailed').hide();

self.listenToOnce(self.model, 'editsucceeded', function () {
console.log("Edit succeeded - close");
self.close();
});

self.listenToOnce(self.model, 'editfailed', function () {
self.$('.js-editfailed').fadeIn('slow');
});

var html = tinyMCE.activeEditor.getContent({format: 'raw'});
var text = tinyMCE.activeEditor.getContent({format: 'text'});
var html = null;
var text = null;
var attachments = null;

if (self.model.isFreegle()) {
// Freegle messages are text only.
text = self.$('.js-text').val();

// We might have picked up new images.
attachments = [];
var newatts = self.model.get('attachments');
_.each(newatts, function(att) {
attachments.push(att.id);
});

} else {
// Other groups are rich text edited using TinyMCE.
html = tinyMCE.activeEditor.getContent({format: 'raw'});
text = tinyMCE.activeEditor.getContent({format: 'text'});
}

self.model.edit(
self.$('.js-subject').val(),
text,
html
html,
attachments
);
},

renderImages: function() {
var self = this;
var photos = self.model.get('attachments');
self.photoCollection = new Iznik.Collection(photos);

var v = new Iznik.Views.User.Message.EditablePhotos({
collection: self.photoCollection,
message: self.model,
});

v.render().then(function () {
self.$('.js-editablephotos').html(v.el);
});
},

expand: function () {
var self = this;
this.open(this.template, this.model).then(function() {
var body = self.model.get('htmlbody');
body = body ? body : self.model.get('textbody');
var body;

if (self.model.isFreegle()) {
// Freegle messages are text only.
body = self.model.get('textbody');

// Might have images - strip that because we're showing the images separately.
var r = /You can see photos here[\s\S]*jpg/gi;
body = body.replace(r, '');

body = body.trim();

// And can have photos uploaded during edit.
self.$('.js-photosallowed').show();
self.renderImages();
} else {
// Might have HTML.
body = self.model.get('htmlbody');
body = body ? body : self.model.get('textbody');
}

var subj = self.model.get('subject');

Expand Down Expand Up @@ -970,18 +1028,22 @@ define([

self.$('.js-text').val(body);

tinymce.init({
selector: '.js-text',
height: 300,
plugins: [
'advlist autolink lists link charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code'
],
menubar: 'edit insert format tools',
statusbar: false,
toolbar: 'bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link'
});
if (!self.model.isFreegle()) {
// Freegle messages are text only, so we can leave the textarea as it is. For other types of
// group we support rich editing using TinyMCE.
tinymce.init({
selector: '.js-text',
height: 300,
plugins: [
'advlist autolink lists link charmap print preview anchor',
'searchreplace visualblocks code fullscreen',
'insertdatetime media table paste code'
],
menubar: 'edit insert format tools',
statusbar: false,
toolbar: 'bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link'
});
}
});
},

Expand Down
2 changes: 1 addition & 1 deletion http/js/iznik/views/pages/modtools/messages_approved.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ define([

// Get a zoom level for the map.
_.each(self.model.get('groups'), function (group) {
self.model.set('mapzoom', group.settings.hasOwnProperty('map') ? group.settings.map.zoom : 12);
self.model.set('mapzoom', group.settings.hasOwnProperty('map') ? group.settings.map.zoom : 9);
});

if (!self.rendering) {
Expand Down
Loading

0 comments on commit 2d17919

Please sign in to comment.