diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98d243548..4c3e29eb0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt python3 manage.py collectstatic --noinput + python3 manage.py collectstatic_js_reverse --noinput - name: Django Testing project run: | python3 manage.py test diff --git a/cookbook/static/vue/js/recipe_view.js b/cookbook/static/vue/js/recipe_view.js index 57062a5f7..233c89049 100644 --- a/cookbook/static/vue/js/recipe_view.js +++ b/cookbook/static/vue/js/recipe_view.js @@ -1 +1 @@ -(function(e){function t(t){for(var r,s,o=t[0],c=t[1],l=t[2],u=0,p=[];u0?n("div",{staticClass:"col-md-6 order-md-1 col-sm-12 order-sm-2 col-12 order-2"},[n("div",{staticClass:"card border-primary"},[n("div",{staticClass:"card-body"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col col-md-8"},[n("h4",{staticClass:"card-title"},[e._v(e._s(e._("Ingredients")))])]),n("div",{staticClass:"col col-md-4"},[n("div",{staticClass:"input-group d-print-none"},[n("input",{directives:[{name:"model",rawName:"v-model.number",value:e.servings,expression:"servings",modifiers:{number:!0}}],staticClass:"form-control",staticStyle:{"min-width":"4vw"},attrs:{type:"number",value:"1",maxlength:"3"},domProps:{value:e.servings},on:{input:function(t){t.target.composing||(e.servings=e._n(t.target.value))},blur:function(t){return e.$forceUpdate()}}}),e._m(0)])])]),n("br"),n("div",{staticClass:"row"},[n("div",{staticClass:"col-md-12"},[n("table",{staticClass:"table table-sm"},e._l(e.recipe.steps,(function(t){return n("div",{key:t.id},e._l(t.ingredients,(function(t){return n("div",{key:t.id},[n("Ingredient",{attrs:{ingredient:t,servings:e.servings}})],1)})),0)})),0)])])])])]):e._e(),n("div",{staticClass:"col-12 order-1 col-sm-12 order-sm-1 col-md-6 order-md-2",staticStyle:{"text-align":"center"}},[n("img",{staticClass:"img img-fluid rounded",staticStyle:{"max-height":"30vh"},attrs:{src:e.recipe.image,alt:e._("Recipe Image")}}),n("div")])]),e._l(e.recipe.steps,(function(t,r){return n("div",{key:t.id,staticStyle:{"margin-top":"1vh"}},[n("Step",{attrs:{step:t,servings:e.servings,index:r}})],1)}))],2)},i=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"input-group-append"},[n("span",{staticClass:"input-group-text"},[n("i",{staticClass:"fas fa-calculator"})])])}],s=n("b85c"),o=n("5f5b"),c=(n("2dd8"),n("bc3a")),l=n.n(c),d=(n("99af"),n("59e4"));function u(e,t,n){var r=Math.floor(e),a=1,i=r+1,s=1;if(e!==r)while(a<=t&&s<=t){var o=(r+i)/(a+s);if(e===o){a+s<=t?(a+=s,r+=i,s=t+1):a>s?s=t+1:a=t+1;break}et&&(a=s,r=i),!n)return[0,r,a];var c=Math.floor(r/a);return[c,r-c*a,a]}var p={methods:{makeToast:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return f(e,t,n)}}};function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=new d["a"];r.$bvToast.toast(t,{title:e,variant:n,toaster:"b-toaster-top-center",solid:!0})}var m={methods:{_:function(e){return v(e)}}};function v(e){return window.gettext(e)}var _={methods:{resolveDjangoUrl:function(e,t){return g(e,t)}}};function g(e,t){return window.Urls[e](t)}function h(e){return window.USER_PREF[e]}function b(e,t){if(h("user_fractions")){var n="",r=u.cont(e*t,9,!0);return r[0]>0&&(n+=r[0]),r[1]>0&&(n+=" ".concat(r[1],"").concat(r[2],"")),n}return w(e*t)}function w(e){var t=h("user_fractions")?h("user_fractions"):2;return+(Math.round(e+"e+".concat(t))+"e-".concat(t))}function C(e){return l.a.get(g("api:recipe-detail",e)).then((function(e){return e.data})).catch((function(e){console.log(e),f("Error","There was an error loading a resource!","danger")}))}var y=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("h5",{staticClass:"text-secondary"},[e.step.name?[e._v(e._s(e.step.name))]:[e._v(e._s(e._("Step"))+" "+e._s(e.index+1))]],2),n("div",{staticClass:"row"},[n("div",{staticClass:"col-md-3"},[n("i",{staticClass:"fa fa-stopwatch"}),e._v(" "+e._s(e.step.time)+" "),n("table",e._l(e.step.ingredients,(function(t){return n("div",{key:t.id},[n("Ingredient",{attrs:{ingredient:t,servings:e.servings}})],1)})),0)]),n("div",{staticClass:"col-md-9"},[n("i",{staticClass:"fas fa-paragraph text-secondary"}),n("compile-component",{attrs:{code:e.step.ingredients_markdown,servings:e.servings}})],1)])])},x=[],k=(n("a9e3"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("tr",[e._m(0),n("td",[0!==e.ingredient.amount?n("span",[e._v(e._s(e.calculateAmount(e.ingredient.amount)))]):e._e()]),n("td",[null!==e.ingredient.unit?n("span",[e._v(e._s(e.ingredient.unit.name))]):e._e()]),n("td",[null!==e.ingredient.food?n("span",[e._v(e._s(e.ingredient.food.name))]):e._e()]),n("td",[e.ingredient.note?n("div",[n("span",{directives:[{name:"b-popover",rawName:"v-b-popover.hover",value:e.ingredient.note,expression:"ingredient.note",modifiers:{hover:!0}}],staticClass:"d-print-none"},[n("i",{staticClass:"far fa-comment"})]),n("div",{staticClass:"d-none d-print-block"},[n("i",{staticClass:"far fa-comment-alt"}),e._v(" "+e._s(e.ingredient.note)+" ")])]):e._e()])])])}),j=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("td",[n("input",{attrs:{type:"checkbox"}})])}],O={name:"Ingredient",props:{ingredient:Object,servings:{type:Number,default:1}},methods:{calculateAmount:function(e){return b(e,this.servings)}}},S=O,E=n("2877"),P=Object(E["a"])(S,k,j,!1,null,null,null),$=P.exports,M=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n(e.compiled,{tag:"component",attrs:{servings:e.servings,code:e.code}})],1)},N=[],I=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("span",[e._v(e._s(e.calculateAmount(e.number)))])},R=[],A={name:"ScalableNumber",props:{number:Number,factor:{type:Number,default:4}},methods:{calculateAmount:function(e){return console.log("calculated amount"),b(e,this.factor)}}},U=A,D=Object(E["a"])(U,I,R,!1,null,null,null),T=D.exports,J={name:"CompileComponent",props:["code","servings"],data:function(){return{compiled:null}},mounted:function(){this.compiled=r["default"].component("compiled-component",{props:["servings","code"],components:{ScalableNumber:T},template:"
".concat(this.code,"
")})}},L=J,B=Object(E["a"])(L,M,N,!1,null,null,null),F=B.exports,V={name:"Step",mixins:[m],components:{Ingredient:$,CompileComponent:F},props:{step:Object,servings:Number,index:Number},mounted:function(){},methods:{calculateAmount:function(e){return b(e,this.servings)}}},W=V,q=Object(E["a"])(W,y,x,!1,null,null,null),z=q.exports,G=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"dropdown"},[e._m(0),n("div",{staticClass:"dropdown-menu dropdown-menu-right",attrs:{"aria-labelledby":"dropdownMenuLink"}},[n("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("edit_recipe",e.recipe.id)}},[n("i",{staticClass:"fas fa-pencil-alt fa-fw"}),e._v(" "+e._s(e._("Edit")))]),n("button",{staticClass:"dropdown-item",attrs:{onclick:"$('#bookmarkModal').modal({'show':true})"}},[n("i",{staticClass:"fas fa-bookmark fa-fw"}),e._v(" "+e._s(e._("Add to Book"))+" ")]),n("a",{staticClass:"dropdown-item",attrs:{href:e.recipe.name}},[n("i",{staticClass:"fas fa-shopping-cart fa-fw"}),e._v(" "+e._s(e._("Add to Shopping"))+" ")]),n("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("new_meal_plan",e.recipe.id)}},[n("i",{staticClass:"fas fa-calendar fa-fw"}),e._v(" "+e._s(e._("Add to Plan")))]),n("button",{staticClass:"dropdown-item",attrs:{onclick:"window.print()"}},[n("i",{staticClass:"fas fa-print fa-fw"}),e._v(" "+e._s(e._("Print"))+" ")]),n("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("view_export",e.recipe.id),target:"_blank",rel:"noopener noreferrer"}},[n("i",{staticClass:"fas fa-file-export fa-fw"}),e._v(" "+e._s(e._("Export")))]),e.recipe.internal?n("a",{staticClass:"dropdown-item",attrs:{href:e.resolveDjangoUrl("new_share_link",e.recipe.id),target:"_blank",rel:"noopener noreferrer"}},[n("i",{staticClass:"fas fa-share-alt fa-fw"}),e._v(" "+e._s(e._("Share")))]):e._e()])])])},H=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("a",{staticClass:"btn shadow-none",attrs:{href:"#",role:"button",id:"dropdownMenuLink","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"}},[n("i",{staticClass:"fas fa-ellipsis-v"})])}],K={name:"RecipeContextMenu",mixins:[_,m],props:{recipe:Object}},Q=K,X=Object(E["a"])(Q,G,H,!1,null,null,null),Y=X.exports;r["default"].use(o["a"]);var Z={name:"RecipeView",mixins:[m,p],components:{Ingredient:$,Step:z,RecipeContextMenu:Y,ScalableNumber:T},data:function(){return{loading:!0,recipe_id:window.RECIPE_ID,recipe:void 0,ingredient_count:0,servings:1}},mounted:function(){this.loadRecipe(this.recipe_id)},methods:{loadRecipe:function(e){var t=this;C(e).then((function(e){t.recipe=e,t.loading=!1;var n,r=Object(s["a"])(t.recipe.steps);try{for(r.s();!(n=r.n()).done;){var a=n.value;t.ingredient_count+=a.ingredients.length,0!==a.time&&(t.has_times=!0)}}catch(i){r.e(i)}finally{r.f()}}))}}},ee=Z,te=Object(E["a"])(ee,a,i,!1,null,null,null),ne=te.exports;r["default"].config.productionTip=!1,new r["default"]({render:function(e){return e(ne)}}).$mount("#app")}}); \ No newline at end of file +(function(t){function e(e){for(var s,n,l=e[0],c=e[1],o=e[2],p=0,u=[];p0?i("div",{staticClass:"col-md-6 order-md-1 col-sm-12 order-sm-2 col-12 order-2"},[i("div",{staticClass:"card border-primary"},[i("div",{staticClass:"card-body"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col col-md-8"},[i("h4",{staticClass:"card-title"},[i("i",{staticClass:"fas fa-pepper-hot"}),t._v(" "+t._s(t._("Ingredients")))])])]),i("br"),i("div",{staticClass:"row"},[i("div",{staticClass:"col-md-12"},[i("table",{staticClass:"table table-sm"},[t._l(t.recipe.steps,(function(e){return[t._l(e.ingredients,(function(e){return[i("Ingredient",{key:e.id,attrs:{ingredient:e,servings:t.servings}})]}))]}))],2)])])])])]):t._e(),i("div",{staticClass:"col-12 order-1 col-sm-12 order-sm-1 col-md-6 order-md-2"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col-12"},[null!==t.recipe.image?i("img",{staticClass:"img img-fluid rounded",staticStyle:{"max-height":"30vh"},attrs:{src:t.recipe.image,alt:t._("Recipe Image")}}):t._e()])]),i("div",{staticClass:"row",staticStyle:{"margin-top":"2vh"}},[i("div",{staticClass:"col-12"},[i("Nutrition",{attrs:{recipe:t.recipe,servings:t.servings}})],1)])])]),t.recipe.file_path.includes(".pdf")?i("div",[i("PdfViewer",{attrs:{recipe:t.recipe}})],1):t._e(),t.recipe.file_path.includes(".png")||t.recipe.file_path.includes(".jpg")||t.recipe.file_path.includes(".jpeg")?i("div",[i("ImageViewer",{attrs:{recipe:t.recipe}})],1):t._e(),t._l(t.recipe.steps,(function(e,s){return i("div",{key:e.id,staticStyle:{"margin-top":"1vh"}},[i("Step",{attrs:{recipe:t.recipe,step:e,servings:t.servings,index:s}})],1)}))],2)},r=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("td",{attrs:{rowspan:"2"}},[i("i",{staticClass:"fas fa-user-clock fa-2x text-primary"})])},function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("td",{attrs:{rowspan:"2"}},[i("i",{staticClass:"far fa-clock fa-2x text-primary"})])},function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("td",[i("i",{staticClass:"fas fa-pizza-slice fa-2x text-primary"})])}],n=i("b85c"),l=i("5f5b"),c=(i("2dd8"),i("bc3a")),o=i.n(c),d=(i("99af"),i("59e4"));function p(t,e,i){var s=Math.floor(t),a=1,r=s+1,n=1;if(t!==s)while(a<=e&&n<=e){var l=(s+r)/(a+n);if(t===l){a+n<=e?(a+=n,s+=r,n=e+1):a>n?n=e+1:a=e+1;break}te&&(a=n,s=r),!i)return[0,s,a];var c=Math.floor(s/a);return[c,s-c*a,a]}var u={methods:{makeToast:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return f(t,e,i)}}};function f(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=new d["a"];s.$bvToast.toast(e,{title:t,variant:i,toaster:"b-toaster-top-center",solid:!0})}var v={methods:{_:function(t){return _(t)}}};function _(t){return window.gettext(t)}var m={methods:{resolveDjangoUrl:function(t,e){return g(t,e)}}};function g(t,e){return window.Urls[t](e)}function h(t){return window.USER_PREF[t]}function b(t,e){if(h("user_fractions")){var i="",s=p.cont(t*e,9,!0);return s[0]>0&&(i+=s[0]),s[1]>0&&(i+=" ".concat(s[1],"").concat(s[2],"")),i}return C(t*e)}function C(t){var e=h("user_fractions")?h("user_fractions"):2;return+(Math.round(t+"e+".concat(e))+"e-".concat(e))}function w(t){return o.a.get(g("api:recipe-detail",t)).then((function(t){return t.data})).catch((function(t){console.log(t),f("Error","There was an error loading a resource!","danger")}))}var x=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("hr"),"TEXT"===t.step.type?[t.recipe.steps.length>1?i("div",{staticClass:"row"},[i("div",{staticClass:"col col-md4"},[i("h5",{staticClass:"text-primary"},[t.step.name?[t._v(t._s(t.step.name))]:[t._v(t._s(t._("Step"))+" "+t._s(t.index+1))],0!==t.step.time?i("small",{staticClass:"text-muted",staticStyle:{"margin-left":"4px"}},[i("i",{staticClass:"fas fa-user-clock"}),t._v(" "+t._s(t.step.time)+" "+t._s(t._("min")))]):t._e()],2)]),i("div",{staticClass:"col col-md-8",staticStyle:{"text-align":"right"}},[i("b-button",{staticClass:"shadow-none",class:{"text-primary":t.details_visible,"text-success":!t.details_visible},staticStyle:{border:"none",background:"none"},on:{click:function(e){t.details_visible=!t.details_visible}}},[i("i",{staticClass:"far fa-check-circle"})])],1)]):t._e(),i("b-collapse",{attrs:{id:"collapse-1"},model:{value:t.details_visible,callback:function(e){t.details_visible=e},expression:"details_visible"}},[i("div",{staticClass:"row"},[t.step.ingredients.length>0&&t.recipe.steps.length>1?i("div",{staticClass:"col col-md-4"},[i("table",{staticClass:"table table-sm"},[t._l(t.step.ingredients,(function(e){return[i("Ingredient",{key:e.id,attrs:{ingredient:e,servings:t.servings}})]}))],2)]):t._e(),i("div",{staticClass:"col",class:{"col-md-8":t.recipe.steps.length>1,"col-md-12":t.recipe.steps.length<=1}},[i("compile-component",{attrs:{code:t.step.ingredients_markdown,servings:t.servings}})],1)])])]:t._e(),"TIME"===t.step.type?[i("div",{staticClass:"row"},[i("div",{staticClass:"col-10 offset-1",staticStyle:{"text-align":"center"}},[i("h4",{staticClass:"text-primary"},[t.step.name?[t._v(t._s(t.step.name))]:[t._v(t._s(t._("Step"))+" "+t._s(t.index+1))]],2),0!==t.step.time?i("span",{staticClass:"text-muted",staticStyle:{"margin-left":"4px"}},[i("i",{staticClass:"fa fa-stopwatch"}),t._v(" "+t._s(t.step.time)+" "+t._s(t._("min")))]):t._e()]),i("div",{staticClass:"col-1",staticStyle:{"text-align":"right"}},[i("b-button",{staticClass:"shadow-none",class:{"text-primary":t.details_visible,"text-success":!t.details_visible},staticStyle:{border:"none",background:"none"},on:{click:function(e){t.details_visible=!t.details_visible}}},[i("i",{staticClass:"far fa-check-circle"})])],1)]),i("b-collapse",{attrs:{id:"collapse-1"},model:{value:t.details_visible,callback:function(e){t.details_visible=e},expression:"details_visible"}},[""!==t.step.instruction?i("div",{staticClass:"row"},[i("div",{staticClass:"col col-md-12",staticStyle:{"text-align":"center"}},[i("compile-component",{attrs:{code:t.step.ingredients_markdown,servings:t.servings}})],1)]):t._e()])]:t._e()],2)},y=[],k=(i("a9e3"),function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("tr",[t._m(0),i("td",[0!==t.ingredient.amount?i("span",[t._v(t._s(t.calculateAmount(t.ingredient.amount)))]):t._e()]),i("td",[null!==t.ingredient.unit?i("span",[t._v(t._s(t.ingredient.unit.name))]):t._e()]),i("td",[null!==t.ingredient.food?i("span",[t._v(t._s(t.ingredient.food.name))]):t._e()]),i("td",[t.ingredient.note?i("div",[i("span",{directives:[{name:"b-popover",rawName:"v-b-popover.hover",value:t.ingredient.note,expression:"ingredient.note",modifiers:{hover:!0}}],staticClass:"d-print-none"},[i("i",{staticClass:"far fa-comment"})]),i("div",{staticClass:"d-none d-print-block"},[i("i",{staticClass:"far fa-comment-alt"}),t._v(" "+t._s(t.ingredient.note)+" ")])]):t._e()])])}),j=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("td",[i("input",{attrs:{type:"checkbox"}})])}],S={name:"Ingredient",props:{ingredient:Object,servings:{type:Number,default:1}},methods:{calculateAmount:function(t){return b(t,this.servings)}}},O=S,E=i("2877"),$=Object(E["a"])(O,k,j,!1,null,null,null),P=$.exports,I=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i(t.compiled,{tag:"component",attrs:{servings:t.servings,code:t.code}})],1)},N=[],A=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("span",[t._v(t._s(t.calculateAmount(t.number)))])},M=[],U={name:"ScalableNumber",props:{number:Number,factor:{type:Number,default:4}},methods:{calculateAmount:function(t){return b(t,this.factor)}}},R=U,T=Object(E["a"])(R,A,M,!1,null,null,null),V=T.exports,D={name:"CompileComponent",props:["code","servings"],data:function(){return{compiled:null}},mounted:function(){this.compiled=s["default"].component("compiled-component",{props:["servings","code"],components:{ScalableNumber:V},template:"
".concat(this.code,"
")})}},z=D,F=Object(E["a"])(z,I,N,!1,null,null,null),J=F.exports,L={name:"Step",mixins:[v],components:{Ingredient:P,CompileComponent:J},props:{step:Object,servings:Number,index:Number,recipe:Object},data:function(){return{details_visible:!0}},mounted:function(){},methods:{calculateAmount:function(t){return b(t,this.servings)}}},B=L,W=Object(E["a"])(B,x,y,!1,null,null,null),X=W.exports,q=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("div",{staticClass:"dropdown"},[t._m(0),i("div",{staticClass:"dropdown-menu dropdown-menu-right",attrs:{"aria-labelledby":"dropdownMenuLink"}},[i("a",{staticClass:"dropdown-item",attrs:{href:t.resolveDjangoUrl("edit_recipe",t.recipe.id)}},[i("i",{staticClass:"fas fa-pencil-alt fa-fw"}),t._v(" "+t._s(t._("Edit")))]),i("button",{staticClass:"dropdown-item",attrs:{onclick:"$('#bookmarkModal').modal({'show':true})"}},[i("i",{staticClass:"fas fa-bookmark fa-fw"}),t._v(" "+t._s(t._("Add to Book"))+" ")]),i("a",{staticClass:"dropdown-item",attrs:{href:t.recipe.name}},[i("i",{staticClass:"fas fa-shopping-cart fa-fw"}),t._v(" "+t._s(t._("Add to Shopping"))+" ")]),i("a",{staticClass:"dropdown-item",attrs:{href:t.resolveDjangoUrl("new_meal_plan",t.recipe.id)}},[i("i",{staticClass:"fas fa-calendar fa-fw"}),t._v(" "+t._s(t._("Add to Plan")))]),i("button",{staticClass:"dropdown-item",attrs:{onclick:"window.print()"}},[i("i",{staticClass:"fas fa-print fa-fw"}),t._v(" "+t._s(t._("Print"))+" ")]),i("a",{staticClass:"dropdown-item",attrs:{href:t.resolveDjangoUrl("view_export",t.recipe.id),target:"_blank",rel:"noopener noreferrer"}},[i("i",{staticClass:"fas fa-file-export fa-fw"}),t._v(" "+t._s(t._("Export")))]),t.recipe.internal?i("a",{staticClass:"dropdown-item",attrs:{href:t.resolveDjangoUrl("new_share_link",t.recipe.id),target:"_blank",rel:"noopener noreferrer"}},[i("i",{staticClass:"fas fa-share-alt fa-fw"}),t._v(" "+t._s(t._("Share")))]):t._e()])])])},G=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("a",{staticClass:"btn shadow-none",attrs:{href:"#",role:"button",id:"dropdownMenuLink","data-toggle":"dropdown","aria-haspopup":"true","aria-expanded":"false"}},[i("i",{staticClass:"fas fa-ellipsis-v"})])}],H={name:"RecipeContextMenu",mixins:[m,v],props:{recipe:Object}},K=H,Q=Object(E["a"])(K,q,G,!1,null,null,null),Y=Q.exports,Z=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("iframe",{staticStyle:{border:"none"},attrs:{src:t.pdfUrl,width:"100%",height:"700px"}})])},tt=[],et={name:"PdfViewer",mixins:[m],props:{recipe:Object},computed:{pdfUrl:function(){return"/static/pdfjs/viewer.html?file="+g("api_get_recipe_file",this.recipe.id)}}},it=et,st=Object(E["a"])(it,Z,tt,!1,null,null,null),at=st.exports,rt=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("img",{attrs:{src:t.pdfUrl,width:"100%",height:"700px",alt:t._("External Recipe Image")}})])},nt=[],lt={name:"ImageViewer",mixins:[v],props:{recipe:Object},computed:{pdfUrl:function(){return g("api_get_recipe_file",this.recipe.id)}}},ct=lt,ot=Object(E["a"])(ct,rt,nt,!1,null,null,null),dt=ot.exports,pt=function(){var t=this,e=t.$createElement,i=t._self._c||e;return null!==t.recipe.nutrition?i("div",[i("div",{staticClass:"card border-success"},[i("div",{staticClass:"card-body"},[i("div",{staticClass:"row"},[i("div",{staticClass:"col-12"},[i("h4",{staticClass:"card-title"},[i("i",{staticClass:"fas fa-carrot"}),t._v(" "+t._s(t._("Nutrition")))])])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-fire fa-fw"}),t._v(" "+t._s(t._("Calories"))+" ")]),i("div",{staticClass:"col-6"},[t._v(" "+t._s(t.calculateAmount(t.recipe.nutrition.calories))+" kcal ")])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-bread-slice fa-fw"}),t._v(" "+t._s(t._("Carbohydrates"))+" ")]),i("div",{staticClass:"col-6"},[t._v(" "+t._s(t.calculateAmount(t.recipe.nutrition.carbohydrates))+" g ")])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-cheese fa-fw"}),t._v(" "+t._s(t._("Fats"))+" ")]),i("div",{staticClass:"col-6"},[t._v(" "+t._s(t.calculateAmount(t.recipe.nutrition.fats))+" g ")])]),i("div",{staticClass:"row"},[i("div",{staticClass:"col-6"},[i("i",{staticClass:"fas fa-drumstick-bite fa-fw"}),t._v(" "+t._s(t._("Proteins"))+" ")]),i("div",{staticClass:"col-6"},[t._v(" "+t._s(t.calculateAmount(t.recipe.nutrition.proteins))+" g ")])])])])]):t._e()},ut=[],ft={name:"Nutrition",mixins:[v],props:{recipe:Object,servings:Number},methods:{calculateAmount:function(t){return b(t,this.servings)}}},vt=ft,_t=Object(E["a"])(vt,pt,ut,!1,null,null,null),mt=_t.exports;s["default"].use(l["a"]);var gt={name:"RecipeView",mixins:[v,u],components:{PdfViewer:at,ImageViewer:dt,Ingredient:P,Step:X,RecipeContextMenu:Y,Nutrition:mt},data:function(){return{loading:!0,recipe_id:window.RECIPE_ID,recipe:void 0,ingredient_count:0,servings:1}},mounted:function(){this.loadRecipe(this.recipe_id)},methods:{loadRecipe:function(t){var e=this;w(t).then((function(t){e.recipe=t,e.loading=!1;var i,s=Object(n["a"])(e.recipe.steps);try{for(s.s();!(i=s.n()).done;){var a=i.value;e.ingredient_count+=a.ingredients.length,0!==a.time&&(e.has_times=!0)}}catch(r){s.e(r)}finally{s.f()}}))}}},ht=gt,bt=Object(E["a"])(ht,a,r,!1,null,null,null),Ct=bt.exports;s["default"].config.productionTip=!1,new s["default"]({render:function(t){return t(Ct)}}).$mount("#app")}}); \ No newline at end of file diff --git a/vue/webpack-stats.json b/vue/webpack-stats.json index 4da71d2e4..586b98ecd 100644 --- a/vue/webpack-stats.json +++ b/vue/webpack-stats.json @@ -1 +1 @@ -{"status":"done","publicPath":"http://localhost:8080/","chunks":{"chunk-vendors":[{"name":"js/chunk-vendors.js","publicPath":"http://localhost:8080/js/chunk-vendors.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\chunk-vendors.js"}],"recipe_view":[{"name":"js/recipe_view.js","publicPath":"http://localhost:8080/js/recipe_view.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\js\\recipe_view.js"},{"name":"recipe_view.19a3fb10aeaef2519f5d.hot-update.js","publicPath":"http://localhost:8080/recipe_view.19a3fb10aeaef2519f5d.hot-update.js","path":"F:\\Developement\\Django\\recipes\\cookbook\\static\\vue\\recipe_view.19a3fb10aeaef2519f5d.hot-update.js"}]},"error":"ModuleError","message":"Module Error (from ./node_modules/eslint-loader/index.js):\n\nF:\\Developement\\Django\\recipes\\vue\\src\\components\\Step.vue\n 22:44 error Unexpected mutation of \"details_visible\" prop vue/no-mutating-props\n 93:22 error The \"details_visible\" property should be a constructor vue/require-prop-type-constructor\n\n✖ 2 problems (2 errors, 0 warnings)\n"} \ No newline at end of file +{"status":"compiling","publicPath":"http://localhost:8080/"} \ No newline at end of file