Coder Social home page Coder Social logo

bread-templates's Introduction

Voyager Templates

Build Status Build Status Total Downloads Latest Stable Version License

Made by Bruno Torrinha

This package let you use templates with BREAD views. It uses Laravel Blade Stacks to define each of the template sections where fields are pushed to.

You can manage Templates with the BREAD system, they are stored on database, and cache files are generated on disk at /resources/views/vendor/voyager/templates/{template-slug}.blade.php.

Template Example

Title: Columns 6/6

Slug: columns-6-6

View:

<div class="row">
    <div class="col-sm-6 col-md-6 col-lg-6">
        <div class="panel panel-bordered">@stack("lf")</div>
    </div>
    <div class="col-sm-6 col-md-6 col-lg-6">
        <div class="panel panel-bordered">@stack("rg")</div>
    </div>
</div>

JSON Options

{
    "template": {
        "slug":  "columns-6-4",
        "stack": "lf"
    }
}

Usage

1. Choose a Template

When you access Templates, by clicking the menu, you will see 3 templates as default, you can add or modify any of them.

2. Configure BREAD

Edit the BREAD, and use JSON Options for defining the template and stack to use.

Notes:

  • you may define the template.slug only once, on one field.
  • fields with no stack parameter are pushed to the bottom.

Example

To see it in action, Voyager Pages is provided as an example.

Make sure you have installed Voyager with dummy data.

bread-templates's People

Contributors

akazorg avatar marktopper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bread-templates's Issues

Readme > Example

In Readme > Example, you said :
To see it in action, Voyager Pages is provided as an example.
I think you want to say Posts

Translation strings do not work

Steps to reproduce:
1: Install Voyager v1.1.3
2: Install bread-templates via Voyager hooks
3: Define a bread with bread template json definitions on some fields
4: View the edit, create or view

In BREAD views that use bread-templates the page translation strings do not work. For example I can see voyager.generic.edit Entity in stead of Edit Entity

In the view the bread-templates use /vendor/bread-templates/resources/views/bread/edit-add.blade.php I see the following line used:

{{ __('voyager.generic.'.(isset($dataTypeContent->id) ? 'edit' : 'add')).' '.$dataType->display_name_singular }}

While in Voyager's original /vendor/tcg/voyager/resources/views/bread/edit-add.blade.php they use:

{{ __('voyager::generic.'.(!is_null($dataTypeContent->getKey()) ? 'edit' : 'add')).' '.$dataType->display_name_singular }}

I could propose a PR for just for the translation strings, but when I do a diff of voyager's edit-add.blade.php and the edit-add.blade.php file of this package I see more things in the original file that have changed since.

Furthermore In the browser console I see the following error:
schermafbeelding 2018-07-18 om 12 32 44

It seems to me the edit-add.blade.php (and possibly the read.blade.phpalso) view need an update to reflect the most recent Voyager version's template markup.

Hook install fails

I ran hook install on a fresh voyager with laravel 5.8

php artisan hook:install voyager-themes

Returns:

ErrorException : Undefined index: Launcher\BreadTemplates\Models\Template

How to install

Hi
What are the steps to include this in my project?
What commands do I need to do

Regards
Adrian

Using $this when not in object context

Error, line 94
File: vendor\bread-templates\src\TemplatesManager.php

templateModified() => static function
and
getPath() => no static function

public static function templateModified(Template $template) {
$_file = $this->getPath($template->slug); => Error
//$_file = resource_path('views/vendor/voyager/templates/').$template->slug.'.blade.php'; => OK

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.