Property "open" was accessed during render but is not defined on instance - laravel

Inside my Laravel-Vue app this
Works:
#include('header')
<div id="app">
#yield('content')
</div>
#include('footer')
But putting #includes inside #app, throws warning "Property "open" was accessed during render but is not defined on instance."
Not working:
<div id="app">
#include('header')
#yield('content')
#include('footer')
</div>
header.blade.php
<header x-data="{ open: false }">
<button #click="open = !open"> open </button>
<nav :class="{'hidden' : !open}" x-cloak></nav>
</header>

The reason was I put Alpine.js inisde Vue, so #click and :class weren't working.
So I replaced them with x-bind:class and x-on:click and everything worked as expected.

Related

Laravel #section not showing

My issue is that when I define a section in a laravel blade (not master) I cannot display it's content on the page, however if I yield it on the master.blade.php it works fine. So how can I make this page display:
section 'content'
section 'template'
#extends('layouts.master')
#section('title', 'Website Builder')
#section('content')
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript" src="{!! asset('js/template.js') !!}"></script>
#endsection
#section('template')
<div class= "container template_class ">
#foreach ($templates as $template)
<a class="content-link" href="{{ asset($template->file )}}">
<img id = "image" src="{{ asset($template->image )}}"/>
</a>
#endforeach
</div>
<div id="content-link2"></div>
<div class="container">
#yield('content')
#yield('template')
</div>
#endsection
#show
So, if you already have a #section defined in the master layout, it will be overriden unless you specify #parent inside the child layout's #section.
But for #yield, it always gets the section from the child layout. That means it always overrides the #yield part, even if it has a default defined as #yield('section', 'Default Content')
Hope this works!

append div with another div content using xpath

I want to append div using xpath inheriting a parent template.
for ex.
this is parent template
<template id="parent_id">
<div id="header">
<div class="container">
<h1> HEADER </h1>
</div>
</div>
<div id="product">
<div class="container">
<!-- THERE IS SOME CONTENT -->
</div>
</div>
</template>
i want to change like this,
<template id="parent_id">
<div id="product">
<div class="inner">
<div class="container">
<!-- THERE IS SOME CONTENT -->
</div>
</div>
</div>
</template>
i try this,
<template id="product_custom" inherit_id="parent_id">
<xpath expr="//div[#id='product']" position="after">
<div class="inner">
</xpath>
</template>
while replace all content is easy or copy all content to custom template, but it not proper way. i want to wrap a div on content.
I think you cannot do that, because you are going either to override the content or to place your <div/> before, after on inside the selected element.
A simple solution will be to give the id="product" div the class inner by using position="attributes". Or if you really need this, a possible solution is:
replace id="product" with class="inner" with one override using attributes position
define your own template in a second override and call the original one inside it
You will end up with something like this:
<template id="my_parent" inherit_id="foo.parent_id">
<div id="product">
<t t-call="foo.parent_id" />
</div>
</template>
plus the override of the attributes. Never done something like this and the code above is not tested but it could work ;)

"Could not find the file list container in the template" error

I am getting message "Could not find the file list container in the template" appearing in my Javascript debug console when using fine uploader.
Here is a jsfiddle example of the problem occurring.
http://jsfiddle.net/Lu82ba9L/1/
The code from the example is repeated here
<!-- using fine uploader 5.1.3 at http://keysymmetrics.com/jsfiddle/jquery.fine-uploader.js -->
$(document).ready(function () {
$("#fine-uploader").fineUploader({
debug: true,
template: 'qq-template-bootstrap',
request: {
endpoint: "/my-endpoint"
}
});
});
<script type="text/template" id="qq-template-bootstrap" class="qq-uploader-selector">
<div class="row">
<div class="col-sm-4" >
<div class="qq-upload-button-selector qq-upload-drop-area-selector drag-drop-area">
<div>Drag and drop files here or click to upload</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4" >
<div class="qq-upload-list-selector" >
<div class="panel panel-default" >
<div class="panel-body" >
<div class="qq-progress-bar-container-selector progress">
<div class="qq-progress-bar-selector progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<span class="qq-upload-file-selector qq-upload-file"></span>
<span class="qq-upload-size-selector qq-upload-size"></span>
<span class="qq-upload-status-text-selector qq-upload-status-text"></span>
<img class="qq-thumbnail-selector" qq-max-size="100" />
</div><!-- close panel-body -->
</div><!-- close panel -->
</div>
</div>
</div>
</script>
<h1>Fine Uploader Test</h1>
<div id="fine-uploader"></div>
Just for additional information that may be helpful, I have a working version here. http://jsfiddle.net/61motjed/2/ .In this version here I have moved the "div.qq-upload-list-selector" element to a different position in the DOM (however, this is not the DOM structure I want). It is also unclear to me why the first example fails but the 2nd example is working.
Your template is not valid. The template must contain a top-level element with a CSS class of "qq-uploader-selector". This element must contain all other elements in your template. Simply wrapping the contents of your template in an element with this class should fix your issue.

Custom Root Container Doesn't Load Correctly

In my kendo mobile application, if I have a custom root container like so:
<div id="appcontainer">
<div data-layout="StandardLayout" data-role="view" data-title="My Group List" id="MainView">
This is the first contents.
</div>
<div data-layout="StandardLayout" data-role="view" data-title="View Group" id="SelectedView">
This is the second contents.
</div>
<div data-role="layout" id="StandardLayout">
<header data-role="header">
<div data-role="navbar">
<a data-role="backbutton" data-align="left" href="nav-button">Back</a>
<span data-role="view-title"></span>
</div>
</header>
<footer data-role="footer">
</footer>
</div>
</div>
<script type="text/javascript">
window["appframework"] = new kendo.mobile.Application($("#appcontainer").get(0));
</script>
The Kendo mobile framework does not initialize the views correctly, and I get the error:
Error: Your kendo mobile application element does not contain any
direct child elements with data-role="view" attribute set. Make sure
that you instantiate the mobile application using the correct
container.
But if I remove the appcontainer element, and use document.body as the root element, everything works fine. Any idea why a custom root container doesn't work?

onClick event won't work until page is reloaded

The following code snippet which includes an onClick event will
not work until I click reload on both the simulator and the phone.
The code is in an .erb file in an app model folder.
<section id="page1" data-role="page">
<header data-role="header">
<h1>CSS 3 Animations</h1>
</header>
<div data-role="content" class="content">
<p class="show-menu" onclick="ToggleText()">(Show/Hide) Menu</p>
<div class="sliding-menu slide out">Menu</div>
</div>
</section>
<script type="text/javascript">
function ToggleText() {
$(".sliding-menu").toggleClass("reverse out in");
}
</script>
I'm using rhomobile 3.2.1 with. Can someone explain why and what to do to
fix it?
Would something like this work?
http://jsfiddle.net/aJshm/3/
JS
$('.toggle-menu').click(function() {
$(".sliding-menu").toggleClass("reverse out in");
});
HTML
<section id="page1" data-role="page">
<header data-role="header">
<h1>CSS 3 Animations</h1>
</header>
<div data-role="content" class="content">
<p class="toggle-menu">(Show/Hide) Menu</p>
<div class="sliding-menu slide out">Menu</div>
</div>
</section>
Just a guess, try defining the function before it is invoked?

Resources