Browse Source

Fix new list form

Fixes #157.
Maxime Quandalle 10 years ago
parent
commit
018bb343b5

+ 2 - 2
.meteor/versions

@@ -87,8 +87,8 @@ observe-sequence@1.0.6
 ongoworks:speakingurl@1.1.0
 ordered-dict@1.0.3
 peerlibrary:assert@0.2.5
-peerlibrary:base-component@0.8.0
-peerlibrary:blaze-components@0.10.0
+peerlibrary:base-component@0.9.2
+peerlibrary:blaze-components@0.11.0
 raix:eventemitter@0.1.2
 raix:handlebar-helpers@0.2.4
 random@1.0.3

+ 3 - 3
client/components/boards/body.jade

@@ -12,18 +12,18 @@ template(name="boardComponent")
           each lists
             +list(this)
           if currentUser.isBoardMember
-            +addlistForm
+            +addListForm
       +boardSidebar
     if currentCard
       +cardSidebar(currentCard)
   else
     +message(label="board-no-found")
 
-template(name="addlistForm")
+template(name="addListForm")
   .list.js-list.add-list.js-add-list
     +inlinedForm(autoclose=false)
       input.list-name-input(type="text" placeholder="{{_ 'add-list'}}"
-        autocomplete="off" autofocus)
+        autocomplete="off" autofocus value=getCache)
       div.edit-controls.clearfix
         button.primary.confirm.js-save-edit(type="submit") {{_ 'save'}}
         a.fa.fa-times.dark-hover.cancel.js-close-inlined-form

+ 21 - 3
client/components/boards/body.js

@@ -4,7 +4,7 @@ BlazeComponent.extendComponent({
   },
 
   openNewListForm: function() {
-    this.componentChildren('addlistForm')[0].open();
+    this.componentChildren('addListForm')[0].open();
   },
 
   scrollLeft: function() {
@@ -60,11 +60,29 @@ BlazeComponent.extendComponent({
 
 BlazeComponent.extendComponent({
   template: function() {
-    return 'addlistForm';
+    return 'addListForm';
   },
 
   // Proxy
   open: function() {
     this.componentChildren('inlinedForm')[0].open();
+  },
+
+  events: function() {
+    return [{
+      submit: function(evt) {
+        evt.preventDefault();
+        var title = this.find('.list-name-input');
+        if ($.trim(title.value)) {
+          Lists.insert({
+            title: title.value,
+            boardId: Session.get('currentBoard'),
+            sort: $('.list').length
+          });
+
+          title.value = '';
+        }
+      }
+    }];
   }
-}).register('addlistForm');
+}).register('addListForm');

+ 40 - 40
client/components/cards/details.styl

@@ -1,45 +1,45 @@
 @import 'nib'
 
-.card-detail.sidebar-content
-  width: 496px - 2 * 20px
-  top: -46px !important
-  z-index: 20 !important
-  // XXX Animate apparition
-
-  .card-detail-header
-    background: #F7F7F7
-    border-bottom: 1px solid darken(white, 10%)
-    position: absolute
-    min-height: 38px
-    top: 0
-    left: 0
-    right: 0
-    padding 7px 20px 0
-
-    i.fa
-      float: right
-      font-size: 1.3em
-      color: darken(white, 35%)
-      margin-top: 7px
-
-    .card-detail-title
-      font-weight: bold
-      font-size: 1.7em
-      margin: 3px 0 0
-      padding: 0
-
-  .card-detail-list
-    font-size: 0.85em
-    margin-bottom: 3px
-
-    a.card-detail-list-title
-      font-weight: bold
-
-      &.is-editable
-        display: inline-block
-        background: darken(white, 10%)
-        border-radius: 3px
-        padding: 0px 5px
+.card-sidebar.sidebar
+  width: 496px
+  top: -46px
+
+  .card-detail.sidebar-content
+    padding: 0 20px
+    z-index: 20 !important
+    // XXX Animate apparition
+
+    .card-detail-header
+      margin: 0 -20px 5px
+      padding 7px 20px 0
+      background: #F7F7F7
+      border-bottom: 1px solid darken(white, 10%)
+      min-height: 38px
+
+      i.fa
+        float: right
+        font-size: 1.3em
+        color: darken(white, 35%)
+        margin-top: 7px
+
+      .card-detail-title
+        font-weight: bold
+        font-size: 1.7em
+        margin: 3px 0 0
+        padding: 0
+
+    .card-detail-list
+      font-size: 0.85em
+      margin-bottom: 3px
+
+      a.card-detail-list-title
+        font-weight: bold
+
+        &.is-editable
+          display: inline-block
+          background: darken(white, 10%)
+          border-radius: 3px
+          padding: 0px 5px
 
 .new-comment
   position: relative

+ 0 - 16
client/components/lists/events.js

@@ -1,16 +0,0 @@
-Template.addlistForm.events({
-  submit: function(event, t) {
-    event.preventDefault();
-    var title = t.find('.list-name-input');
-    if ($.trim(title.value)) {
-      Lists.insert({
-        title: title.value,
-        boardId: Session.get('currentBoard'),
-        sort: $('.list').length
-      });
-
-      Utils.Scroll('.js-lists').left(270, true);
-      title.value = '';
-    }
-  }
-});

+ 5 - 4
client/components/sidebar/sidebar.styl

@@ -1,6 +1,11 @@
 @import 'nib'
 
 .sidebar
+  position: absolute
+  top: 0
+  bottom: 0
+  right: 0
+
   .sidebar-content
     padding: 10px 20px
     background: white
@@ -22,10 +27,7 @@
 
 .board-sidebar
   width: 248px
-  position: absolute
-  top: 0
   right: -@width
-  bottom: 0
   transition: top .1s, right .1s, width .1s
 
   &.is-open
@@ -104,7 +106,6 @@
     .toggle-widget-nav
       color: #4d4d4d
 
-
 .board-widget-title
   display: block
   min-height: 20px