text: webpackJsonp([1],{Jun0:function(t,a){},NHnr:function(t,a,n){"use strict";function e(t){n("meh0")}function s(t){n("Jun0")}function r(t){n("hlfe")}Object.defineProperty(a,"__esModule",{value:!0});var o=n("7+uW"),c=n("pFYg"),i=n.n(c),d=n("mvHQ"),u=n.n(d),l=n("mtWM"),w=n.n(l),p=function(t,a,n){console.log("calling: "+t+" with "+u()(a)),w.a.post("/fn/Card/"+t,u()(a)).then(function(t){console.log("response: "+t.data),n(t.data)}).catch(function(t){console.log("response failed: "+t.responseText)})},v=function(t){return"object"===(void 0===t?"undefined":i()(t))&&"HolochainError"===t.name},h={props:{parent:{type:Object,default:null}},data:function(){return{title:"",content:"",sentError:"",sentResult:""}},methods:{createCard:function(){var t=this,a=null!==this.parent?this.parent.hash:"";p("cardCreate",{parentHash:a,title:this.title,content:this.content,showNew:!1},function(a){v(a)?(t.sentResult=a,t.sentError=!0):null===t.parent?p("cardAddAsFavorite",a,function(a){t.$emit("card-created"),t.$emit("please-close")}):(t.$emit("card-created"),t.$emit("please-close"))})}}},f=function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("div",{staticClass:"w3-modal"},[n("div",{staticClass:"w3-modal-content"},[n("div",{staticClass:"w3-card-4"},[n("div",{staticClass:"w3-container"},[null===t.parent?n("h3",[t._v("Create new card")]):n("h3",[t._v("Create new subcard of "),n("br"),n("i",[t._v(t._s(t.parent.title))])]),t._v(" "),n("hr"),t._v(" "),n("div",{staticClass:"w3-row"},[n("label",{attrs:{for:""}},[t._v("Title")]),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.title,expression:"title"}],staticClass:"w3-input",attrs:{type:"text",name:"",value:""},domProps:{value:t.title},on:{input:function(a){a.target.composing||(t.title=a.target.value)}}})]),t._v(" "),n("div",{staticClass:"w3-row w3-margin-top"},[n("label",{attrs:{for:""}},[t._v("Content")]),t._v(" "),n("textarea",{directives:[{name:"model",rawName:"v-model",value:t.content,expression:"content"}],staticClass:"w3-input w3-border",attrs:{name:"name",rows:"3",cols:"80"},domProps:{value:t.content},on:{input:function(a){a.target.composing||(t.content=a.target.value)}}})]),t._v(" "),n("div",{staticClass:"w3-row w3-margin-top"},[n("button",{staticClass:"w3-button w3-gray w3-round-large",attrs:{type:"button",name:"button"},on:{click:function(a){t.$emit("please-close")}}},[t._v("cancel")]),t._v(" "),n("button",{staticClass:"w3-button w3-blue w3-round-large",attrs:{type:"button",name:"button"},on:{click:function(a){t.createCard()}}},[t._v("create")])]),t._v(" "),t.sentError?n("div",{staticClass:"w3-row w3-margin-top"},[n("div",{staticClass:"w3-panel w3-pale-green"},[n("p",[t._v(t._s(t.sentResult))])])]):t._e()])])])])},b=[],m={render:f,staticRenderFns:b},_=m,C=n("VU/8"),g=e,y=C(h,_,!1,g,"data-v-4cfffd8f",null),N=y.exports,S={name:"app-card",components:{"app-new-card-modal":N},props:{card:{type:Object,default:null},expanded:{type:Boolean,default:!1}},data:function(){return{showNewCardModal:!1,subcards:[],subcardsShown:!1}},methods:{showNewSubCard:function(){this.showNewCardModal=!0},toggleSubcards:function(){this.subcardsShown=!this.subcardsShown},updateSubCards:function(){var t=this;p("cardGetLinks",this.card.hash,function(a){a.forEach(function(a){if("CHILD_OF"===a.type){var n=a.card;p("cardRead",n,function(a){console.log("card: "+a),a.hash=n,t.subcards.push(a)})}})})}},created:function(){this.subcardsShown=this.expanded,this.updateSubCards()}},M=function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("div",{},[n("transition",{attrs:{name:"slide-down-up"}},[t.showNewCardModal?n("app-new-card-modal",{attrs:{parent:t.card},on:{"please-close":function(a){t.showNewCardModal=!1},"card-created":function(a){t.$emit("card-created")}}}):t._e()],1),t._v(" "),n("div",{staticClass:"w3-card-4"},[n("div",{staticClass:"w3-row w3-container"},[n("h4",[t._v(t._s(t.card.title))]),t._v(" "),n("p",{staticClass:"w3-left"},[t._v(t._s(t.card.content))])]),t._v(" "),t.subcardsShown?n("div",{staticClass:"w3-row"},[n("button",{staticClass:"w3-button show-subcards-btn",attrs:{type:"button",name:"button"},on:{click:function(a){t.toggleSubcards()}}},[t._v("\n        "+t._s(t.subcardsShown?"hide":"show")+" subcards\n      ")])]):t._e(),t._v(" "),n("div",{staticClass:"slider-container w3-container"},[n("transition",{attrs:{name:"slide-down-up"}},[t.subcardsShown?n("div",{staticClass:"w3-row subcards-container"},[t.subcards.length>0?n("div",t._l(t.subcards,function(a){return n("div",{},[n("app-card",{attrs:{card:a},on:{"card-created":function(a){t.$emit("card-created")}}})],1)})):n("div",{},[n("i",[t._v("no subcards")])]),t._v(" "),n("button",{staticClass:"w3-button w3-border w3-round-large w3-margin-top",on:{click:function(a){t.showNewCardModal=!0}}},[n("i",{staticClass:"fa fa-plus",attrs:{"aria-hidden":"true"}}),t._v(" "),n("span",{staticClass:"w3-margin-left"},[t._v("new subcard")])])]):t._e()])],1),t._v(" "),n("div",{staticClass:"w3-row"},[n("button",{staticClass:"w3-button show-subcards-btn show-subcards-btn-bottom",attrs:{type:"button",name:"button"},on:{click:function(a){t.toggleSubcards()}}},[t._v("\n        "+t._s(t.subcardsShown?"hide":"show")+" subcards\n      ")])])])],1)},x=[],$={render:M,staticRenderFns:x},k=$,E=n("VU/8"),F=s,R=E(S,k,!1,F,"data-v-88f75e5c",null),H=R.exports,j={name:"app",components:{"app-new-card-modal":N,"app-card":H},data:function(){return{showNewCard:!1,myCards:[]}},methods:{updateMyCards:function(){var t=this;this.myCards=[],p("cardGetMyFavorites",{},function(a){a.forEach(function(a){p("cardRead",a,function(n){n.hash=a,t.myCards.push(n)})})})}},created:function(){this.updateMyCards()}},O=function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("div",{staticClass:"w3-container w3-center",attrs:{id:"app"}},[n("h1",{staticClass:"w3-center"},[t._v("Fractal Wiki")]),t._v(" "),n("transition",{attrs:{name:"slide-down-up"}},[t.showNewCard?n("app-new-card-modal",{attrs:{parent:null},on:{"please-close":function(a){t.showNewCard=!1},"card-created":function(a){t.updateMyCards()}}}):t._e()],1),t._v(" "),n("hr"),t._v(" "),n("div",{staticClass:"w3-container"},[n("h2",[t._v("My cards")]),t._v(" "),n("div",{staticClass:"w3-row-padding"},[t._l(t.myCards,function(a){return n("div",{staticClass:"card-container w3-col m4"},[n("app-card",{attrs:{card:a,expanded:!0},on:{"card-created":function(a){t.updateMyCards()}}})],1)}),t._v(" "),0==t.myCards.length?n("div",{},[n("i",[t._v("no cards found - start by creating one")])]):t._e(),t._v(" "),n("div",{staticClass:"w3-col m4"},[n("button",{staticClass:"new-card-btn w3-button w3-blue",attrs:{type:"button",name:"button"},on:{click:function(a){t.showNewCard=!0}}},[t._v("new root card")])])],2)])],1)},J=[],P={render:O,staticRenderFns:J},U=P,V=n("VU/8"),W=r,A=V(j,U,!1,W,null,null),G=A.exports;new o.a({el:"#app",render:function(t){return t(G)}})},hlfe:function(t,a){},meh0:function(t,a){}},["NHnr"]);
  //# sourceMappingURL=app.605f238f3e1c61137273.js.map