summaryrefslogtreecommitdiffstats
path: root/client/components/lists/body.js
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-05-27 17:17:00 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-05-27 17:23:25 +0200
commitdcc64f44f9f81d32c8071c6bdac86546eaeb57a0 (patch)
treeb8977727227a3ddbb2874ea3f86f1e26e03c8835 /client/components/lists/body.js
parent42f6dc686f313ba294e3cbcfb0ebde50678580fe (diff)
downloadwekan-dcc64f44f9f81d32c8071c6bdac86546eaeb57a0.tar.gz
wekan-dcc64f44f9f81d32c8071c6bdac86546eaeb57a0.tar.bz2
wekan-dcc64f44f9f81d32c8071c6bdac86546eaeb57a0.zip
UI improvements
* Implement visibility choice on board creation; * Rework the board header bar. Remove links to un-implemented features; * Implement a board star counter (visible if the board have >2 stars); * Define a new icon (a thin cross) to close elements; * Remove $(document).on('mouseover') event handlers that were basically fired hundreds of times for nothing, we now define a proper Tracker dependency to execute jquery-ui plugin initialization only when something has changed; * Bug fixes related to list scrolling.
Diffstat (limited to 'client/components/lists/body.js')
-rw-r--r--client/components/lists/body.js34
1 files changed, 16 insertions, 18 deletions
diff --git a/client/components/lists/body.js b/client/components/lists/body.js
index d8238c9a..8400af96 100644
--- a/client/components/lists/body.js
+++ b/client/components/lists/body.js
@@ -7,10 +7,6 @@ BlazeComponent.extendComponent({
return [Mixins.PerfectScrollbar];
},
- isSelected: function() {
- return Session.equals('currentCard', this.currentData()._id);
- },
-
openForm: function(options) {
options = options || {};
options.position = options.position || 'top';
@@ -37,11 +33,6 @@ BlazeComponent.extendComponent({
sortIndex = Utils.getSortIndex(this.find('.js-minicard:last'), null);
}
- // Clear the form in-memory cache
- // var inputCacheKey = "addCard-" + this.listId;
- // InputsCache.set(inputCacheKey, '');
-
- // title trim if not empty then
if ($.trim(title)) {
Cards.insert({
title: title,
@@ -49,16 +40,18 @@ BlazeComponent.extendComponent({
boardId: this.data().board()._id,
sort: sortIndex
}, function(err, _id) {
- // In case the filter is active we need to add the newly
- // inserted card in the list of exceptions -- cards that are
- // not filtered. Otherwise the card will disappear instantly.
+ // In case the filter is active we need to add the newly inserted card
+ // in the list of exceptions -- cards that are not filtered. Otherwise
+ // the card will disappear instantly.
// See https://github.com/libreboard/libreboard/issues/80
Filter.addException(_id);
});
// We keep the form opened, empty it, and scroll to it.
textarea.val('').focus();
- Utils.Scroll(this.find('.js-minicards')).top(1000, true);
+ if (position === 'bottom') {
+ this.scrollToBottom();
+ }
}
},
@@ -67,9 +60,9 @@ BlazeComponent.extendComponent({
},
scrollToBottom: function() {
- var $container = $(this.firstNode());
- $container.animate({
- scrollTop: $container.height()
+ var container = this.firstNode();
+ $(container).animate({
+ scrollTop: container.scrollHeight
});
},
@@ -94,7 +87,12 @@ BlazeComponent.extendComponent({
// Pressing Enter should submit the card
if (evt.keyCode === 13) {
evt.preventDefault();
- $(evt.currentTarget).parents('form:first').submit();
+ var $form = $(evt.currentTarget).parents('form:first');
+ // XXX For some reason $form.submit() does not work (it's probably a bug
+ // of blaze-component related to the fact that the submit event is non-
+ // bubbling). This is why we click on the submit button instead -- which
+ // work.
+ $form.find('button[type=submit]').click();
// Pressing Tab should open the form of the next column, and Maj+Tab go
// in the reverse order
@@ -102,7 +100,7 @@ BlazeComponent.extendComponent({
evt.preventDefault();
var isReverse = evt.shiftKey;
var list = $('#js-list-' + this.data().listId);
- var listSelector = '.js-list:not(.js-add-list)';
+ var listSelector = '.js-list:not(.js-list-composer)';
var nextList = list[isReverse ? 'prev' : 'next'](listSelector).get(0);
// If there isn't no next list, loop back to the beginning.
if (! nextList) {