Skip to content

Commit

Permalink
Merge branch 'master' into mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Jul 9, 2018
2 parents 2732ee1 + e59cdf3 commit 81e17dd
Show file tree
Hide file tree
Showing 19 changed files with 306 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Iznik is a platform for online reuse of unwanted items. This is the client half
The development has been funded by Freegle for use in the UK,
but it is an open source platform which can be used or adapted by others.

This codebase supports two sites - the user site Freegle Direct (aka FD), and the moderator site ModTools (aka MT). If you're not sure, you're probably interested in MT.
This codebase supports two sites - the user site Freegle Direct (aka FD), and the moderator site ModTools (aka MT). If you're not sure, you're probably interested in FD.

We welcome potential developers with open arms. Have a look at the wiki section.

Expand Down
36 changes: 36 additions & 0 deletions http/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,42 @@ fieldset[disabled] .twitter-typeahead .tt-input {
padding-right: 10px;
}

blockquote {
font-family: Georgia, serif;
position: relative;
margin: 0.5em;
padding: 0.5em 2em 0.5em 3em;
border-left: none;
}
/* Thanks: http://callmenick.com/post/styling-blockquotes-with-css-pseudo-classes */
blockquote:before {
font-family: Georgia, serif;
position: absolute;
font-size: 6em;
line-height: 1;
top: 0;
left: 0;
content: "\201C";
}
blockquote:after {
font-family: Georgia, serif;
position: absolute;
/* display: block; don't use this, it raised the quote too high from the bottom - defeated line-height? */
float:right;
font-size:6em;
line-height: 1;
right:0;
bottom:-0.5em;
content: "\201D";
}
blockquote footer {
padding: 0 2em 0 0;
text-align:right;
}
blockquote cite:before {
content: "\2013";
}

/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
Expand Down
Binary file added http/images/logos/Emoji.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions http/js/iznik/models/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,31 @@ define([
})
});

return(p);
},

saveAboutMe: function(aboutme) {
var self = this;

var p = new Promise(function(resolve, reject) {
$.ajax({
url: API + 'session',
type: 'PATCH',
data: {
aboutme: aboutme
}, success: function (ret) {
if (ret.ret === 0) {
resolve();
} else {
reject(ret);
}

}, error: function() {
reject(null);
}
})
});

return(p);
}
});
Expand Down
1 change: 1 addition & 0 deletions http/js/iznik/views/pages/modtools/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ define([
self.wait = new Iznik.Views.PleaseWait({
timeout: 1
});
self.wait.closeAfter = 600000;
self.wait.render();

self.allGroups = new Iznik.Collections.Group();
Expand Down
17 changes: 17 additions & 0 deletions http/js/iznik/views/pages/mydata.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ define([
[ 'newsfeed_reports', Iznik.Views.MyData.NewsfeedReport, '.js-newsfeedreports' ],
[ 'stories', Iznik.Views.MyData.Story, '.js-stories' ],
[ 'stories_likes', Iznik.Views.MyData.StoryLike, '.js-storylikes' ],
[ 'aboutme', Iznik.Views.MyData.AboutMe, '.js-aboutme' ],
[ 'logins', Iznik.Views.MyData.Login, '.js-logins' ],
[ 'exports', Iznik.Views.MyData.Export, '.js-exports' ]
], function(view) {
Expand Down Expand Up @@ -647,6 +648,22 @@ define([
template: 'mydata_storylike',
});

Iznik.Views.MyData.AboutMe = Iznik.View.extend({
template: 'mydata_aboutme',

render: function() {
var self = this;

var p = Iznik.View.prototype.render.call(self);
p.then(function() {
var m = new moment(self.model.get('timestamp'));
self.$('.js-timestamp').html(m.format('MMMM Do YYYY, h:mm:ss a'));
});

return(p);
}
});

Iznik.Views.MyData.Login = Iznik.View.extend({
template: 'mydata_login',

Expand Down
17 changes: 9 additions & 8 deletions http/js/iznik/views/pages/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ define([
'backbone',
'iznik/base',
'iznik/views/chat/chat',
'iznik/views/user/user',
'iznik/models/group',
'iznik/events',
'iznik/models/notification'
], function($, _, Backbone, Iznik, ChatHolder, monitor) {
], function($, _, Backbone, Iznik, ChatHolder) {
// We have a view for everything that is common across all pages, e.g. sidebars.
var currentPage = null;

Expand Down Expand Up @@ -174,12 +175,6 @@ define([
render: function (options) {
var self = this;

// Start event tracking. Don't do this for ModTools because it seems to kill performance on some
// low-end hardware, and we don't really need it.
if (monitor && !self.modtools) {
// monitor.start();
}

if (currentPage) {
// We have previous rendered a page. Kill that off, so that it is not listening for events and
// messing about with the DOM.
Expand Down Expand Up @@ -773,7 +768,13 @@ define([

events: {
'mouseover': 'markSeen',
'click .js-top': 'goto'
'click .js-top': 'goto',
'click .js-notifaboutme': 'aboutMe'
},

aboutMe: function() {
var v = new Iznik.Views.User.TellAboutMe({})
v.render();
},

goto: function() {
Expand Down
2 changes: 1 addition & 1 deletion http/js/iznik/views/pages/user/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ define([
});

Iznik.Session.testLoggedIn();
console.log("Tested");
$('#js-appbuttons').fadeIn('slow');
});

return (p);
Expand Down
24 changes: 21 additions & 3 deletions http/js/iznik/views/pages/user/newsfeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ define([
'iznik/models/newsfeed',
'iznik/views/group/communityevents',
'iznik/views/group/volunteering',
'iznik/views/user/user',
'iznik/views/pages/pages',
'iznik/views/pages/user/post',
'iznik/views/infinite',
Expand Down Expand Up @@ -331,7 +332,10 @@ define([
modelView: Iznik.Views.User.Feed.Item,
collection: self.collection,
visibleModelsFilter: _.bind(self.visible, self),
processKeyEvents: false
processKeyEvents: false,
modelViewOptions: {
page: self
}
});

self.collectionView.render();
Expand All @@ -342,7 +346,8 @@ define([
'VolunteerOpportunity',
// CC Remove as IFRAMEs don't work in apps 'CentralPublicity',
'Alert',
'Story'
'Story',
'AboutMe'
]
});

Expand Down Expand Up @@ -503,11 +508,23 @@ define([
'click .js-attachtothread': 'attachToThread',
'click .js-preview': 'clickPreview',
'click .js-reply': 'reply',
'click .js-edit': 'edit'
'click .js-edit': 'edit',
'click .js-aboutyourself': 'aboutYourself'
},

imageid: null,

aboutYourself: function() {
var self = this;

var v = new Iznik.Views.User.TellAboutMe({})
this.listenToOnce(v, 'modalCancelled, modalClosed', function() {
self.options.page.refetch();
})

v.render();
},

photoZoom: function (e) {
e.preventDefault();
e.stopPropagation();
Expand Down Expand Up @@ -1314,6 +1331,7 @@ define([
case 'CentralPublicity': self.template = 'user_newsfeed_centralpublicity'; break;
case 'Alert': self.template = 'user_newsfeed_alert'; self.model.set('sitename', SITE_NAME); break;
case 'Story': self.template = 'user_newsfeed_story'; break;
case 'AboutMe': self.template = 'user_newsfeed_aboutme'; break;
}

if (self.template) {
Expand Down
17 changes: 16 additions & 1 deletion http/js/iznik/views/pages/user/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([
'underscore',
'backbone',
'iznik/base',
'jquery-ui',
'iznik/views/pages/pages',
'iznik/views/pages/user/pages',
'iznik/views/postaladdress',
Expand Down Expand Up @@ -52,7 +53,8 @@ define([
'click .js-addressbook': 'addressBook',
'click .js-schedule': 'schedule',
'click .js-savephone': 'savePhone',
'click .js-deletephone': 'deletePhone'
'click .js-deletephone': 'deletePhone',
'click .js-saveaboutme': 'saveAboutMe',
},

savePhone: function() {
Expand All @@ -67,6 +69,15 @@ define([
})
},

saveAboutMe: function() {
var self = this;
self.$('.js-saveaboutmeok').addClass('hidden');

Iznik.Session.saveAboutMe(self.$('.js-aboutme').val()).then(function() {
self.$('.js-saveaboutmeok').removeClass('hidden');
})
},

deletePhone: function() {
var self = this;
self.$('.js-savephoneok').addClass('hidden');
Expand Down Expand Up @@ -496,6 +507,10 @@ define([
self.$('.js-phonedonate').show();
}

if (me.aboutme) {
self.$('.js-aboutme').val(me.aboutme.text);
}

self.showHideMine();

if (me.hasOwnProperty('notifications')) {
Expand Down
34 changes: 34 additions & 0 deletions http/js/iznik/views/user/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1194,4 +1194,38 @@ define([
return (p)
}
})

Iznik.Views.User.TellAboutMe = Iznik.Views.Modal.extend({
template: 'user_tellaboutme',

events: {
'click .js-save': 'save'
},

save: function() {
var self = this;

Iznik.Session.saveAboutMe(self.$('.js-aboutme').val()).then(function() {
Iznik.Session.testLoggedIn(true);
self.close();
});
},

render: function() {
var self = this;

var p = Iznik.Views.Modal.prototype.render.call(this);

p.then(function() {
var aboutme = Iznik.Session.get('me').aboutme;

if (aboutme) {
self.$('.js-aboutme').val(aboutme.text);
}
});

return(p);
}
});

})
5 changes: 5 additions & 0 deletions http/template/chat/interested.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
<div class="panel-body">
{{message}}
</div>
<% if (user.aboutme) { %>
<div class="panel-footer small">
<p class="faded">About {{user.displayname}}:</p>
<b>&quot;</b><%- user.aboutme.text %><b>&quot;</b></div>
<% } %>
</div>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions http/template/mydata/aboutme.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="panel panel-success">
<div class="panel-body">
<div class="row">
<div class="col-xs-2 js-timestamp" />
<div class="col-xs-10 prewrap">{{text}}</div>
</div>
</div>
</div>
3 changes: 3 additions & 0 deletions http/template/mydata/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ <h2>Stories</h2>
<ul class="js-more list-unstyled js-stories" />
<h2>Stories Loves</h2>
<p>These are any stories you've loved.</p>
<h2>About Me</h2>
<p>These are any "about me" info you've given us</p>
<ul class="js-more list-unstyled js-aboutme" />
<ul class="js-more list-unstyled js-storylikes" />
<h2>Community Events</h2>
<p>These are community events which you've created.</p>
Expand Down
Loading

0 comments on commit 81e17dd

Please sign in to comment.