Giter Club home page Giter Club logo

Comments (6)

0xTim avatar 0xTim commented on August 15, 2024

What's the error? Do you get a blank page, any errors in the console?

from leaf-kit.

arikivandeput avatar arikivandeput commented on August 15, 2024

empty page.

from leaf-kit.

0xTim avatar 0xTim commented on August 15, 2024

Anything in the console, any logs etc? Have you tried removing parts of the template to see what breaks it? Going to need more to go on here

from leaf-kit.

0xTim avatar 0xTim commented on August 15, 2024

Also do you get any generated HTML? Even if the page is blank

from leaf-kit.

arikivandeput avatar arikivandeput commented on August 15, 2024

finally got it working
application.leaf

<!DOCTYPE html>
<html lang="en">
<head>
<title>#(title)</title>
<!-- bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
 

<meta name="csrf-token" content="#(csrfToken)">

</head>
<body>
<main class="container-sm">
#extend("Layouts/header")
        #import("content")
</main>
#extend("Layouts/footer")
<script>
       document.addEventListener('DOMContentLoaded', function() {
           const token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
           document.querySelectorAll('form').forEach(function(form) {
               form.addEventListener('submit', function(event) {
                   const input = document.createElement('input');
                   input.type = 'hidden';
                   input.name = 'csrf_token';
                   input.value = token;
                   form.appendChild(input);
               });
           });
       });
   </script>
</body>
</html>

header.leaf

<nav class="navbar navbar-expand-lg bg-body-tertiary">
  
    <a class="navbar-brand" href="/">LOGO</a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
        <li class="nav-item">
          <a class="nav-link active" aria-current="page" href="/">Home</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/about">About us</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="/privacy">Privacy</a>
        </li>
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            Dropdown
          </a>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="#">Action</a></li>
            <li><a class="dropdown-item" href="#">Another action</a></li>
            <li><hr class="dropdown-divider"></li>
            <li><a class="dropdown-item" href="#">Something else here</a></li>
          </ul>
        </li>
      </ul>
    </div>
</nav>
 

and index.leaf

#extend("Layouts/application")
<div class="container">
   <h1>Hello  #(companyName)</h1>
 
</div>

The documentation is incorrect/incomplete regarding syntax for extend and export and import.
for each website a structure with subview is required like header, footer, sidemenu and main content

footer.leaf

<footer class="bg-dark text-white text-center py-3 mt-auto fixed-bottom">
    <div class="container">
    <p>&copy; 2024 #(companyName). All rights reserved.</p>
    </div>
</footer>

from leaf-kit.

0xTim avatar 0xTim commented on August 15, 2024

What did you fix? It's hard to tell here. Feel free to submit a PR to the docs!

from leaf-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.