Hide the card composer link while a card is being dragged

This commit is contained in:
Maxime Quandalle 2015-05-23 22:23:27 +02:00
parent 9c2a3213eb
commit 40b605f7d8
5 changed files with 43 additions and 13 deletions

View file

@ -7,6 +7,12 @@ BlazeComponent.extendComponent({
this.componentChildren('addListForm')[0].open(); this.componentChildren('addListForm')[0].open();
}, },
showNewCardForms: function(value) {
_.each(this.componentChildren('list'), function(listComponent) {
listComponent.showNewCardForm(value);
});
},
scrollLeft: function() { scrollLeft: function() {
// TODO // TODO
}, },

View file

@ -34,9 +34,10 @@ template(name="listBody")
+inlinedForm(autoclose=false position="bottom") +inlinedForm(autoclose=false position="bottom")
+addCardForm(listId=_id position="bottom") +addCardForm(listId=_id position="bottom")
else else
a.open-card-composer.js-open-inlined-form if newCardFormIsVisible.get
i.fa.fa-plus a.open-card-composer.js-open-inlined-form
| {{_ 'add-card'}} i.fa.fa-plus
| {{_ 'add-card'}}
template(name="addCardForm") template(name="addCardForm")
.minicard.js-composer .minicard.js-composer

View file

@ -58,6 +58,14 @@ BlazeComponent.extendComponent({
} }
}, },
showNewCardForm: function(value) {
this.newCardFormIsVisible.set(value);
},
onCreated: function() {
this.newCardFormIsVisible = new ReactiveVar(true);
},
events: function() { events: function() {
return [{ return [{
submit: this.addCard submit: this.addCard

View file

@ -3,11 +3,19 @@ BlazeComponent.extendComponent({
return 'list'; return 'list';
}, },
// Proxy // Proxies
openForm: function(options) { openForm: function(options) {
this.componentChildren('listBody')[0].openForm(options); this.componentChildren('listBody')[0].openForm(options);
}, },
showNewCardForm: function(value) {
this.componentChildren('listBody')[0].showNewCardForm(value);
},
onCreated: function() {
this.newCardFormIsVisible = new ReactiveVar(true);
},
// XXX The jQuery UI sortable plugin is far from ideal here. First we include // XXX The jQuery UI sortable plugin is far from ideal here. First we include
// all jQuery components but only use one. Second, it modifies the DOM itself, // all jQuery components but only use one. Second, it modifies the DOM itself,
// resulting in Blaze abandoning reactive update of the nodes that have been // resulting in Blaze abandoning reactive update of the nodes that have been
@ -16,6 +24,7 @@ BlazeComponent.extendComponent({
// the drag&drop code ourselves? // the drag&drop code ourselves?
onRendered: function() { onRendered: function() {
if (Meteor.user().isBoardMember()) { if (Meteor.user().isBoardMember()) {
var boardComponent = this.componentParent();
var $cards = this.$('.js-minicards'); var $cards = this.$('.js-minicards');
$cards.sortable({ $cards.sortable({
connectWith: '.js-minicards', connectWith: '.js-minicards',
@ -27,6 +36,7 @@ BlazeComponent.extendComponent({
start: function(event, ui) { start: function(event, ui) {
$('.minicard.placeholder').height(ui.item.height()); $('.minicard.placeholder').height(ui.item.height());
Popup.close(); Popup.close();
boardComponent.showNewCardForms(false);
}, },
stop: function(event, ui) { stop: function(event, ui) {
// To attribute the new index number, we need to get the dom element // To attribute the new index number, we need to get the dom element
@ -43,6 +53,7 @@ BlazeComponent.extendComponent({
sort: sort sort: sort
} }
}); });
boardComponent.showNewCardForms(true);
} }
}).disableSelection(); }).disableSelection();

View file

@ -99,27 +99,31 @@
height: 4px height: 4px
.open-card-composer .open-card-composer
border-top-left-radius: 0 border-radius: 2px
border-top-right-radius: 0
border-bottom-right-radius: 3px
border-bottom-left-radius: 3px
color: #8c8c8c color: #8c8c8c
display: block display: block
// flex: 0 0 auto
margin: 2px -3px -3px
padding: 7px 10px padding: 7px 10px
position: relative position: relative
text-decoration: none text-decoration: none
animation: fadeIn 0.2s
i.fa
margin-right: 7px
&:hover &:hover
background: #c3c3c3 background: white
color: #222 color: #222
text-decoration: underline box-shadow: 0 1px 2px rgba(0,0,0,.2)
&::selection &::selection
background: transparent background: transparent
@keyframes fadeIn
from
opacity: 0
to
opacity: 1
.list.placeholder .list.placeholder
background-color: rgba(0, 0, 0, .2) background-color: rgba(0, 0, 0, .2)
border-color: transparent border-color: transparent