Giter Club home page Giter Club logo

decoy's Introduction

Decoy Build Status Coverage Status

Decoy is a PHP content management written for the Laravel framework that allows you to access your data using standard Laravel Eloquent models.

Screenshots

Screenshot of example projects listing Screenshot of example project edit view Screenshot of example category edit view Screenshot of elements editor

About

Since 2012 and Laravel 3, Bukwild has been maintaining our own content management system that we call Decoy. Decoy is meant to reduce the development effort for implementing content management while being highly flexible. And it helps you generate a great looking, easy to use admin interface; no manual required.

The driving philosophy behind Decoy is that a CMS should share models with your public facing app; your app interacts with data stored with Decoy only through standard Laravel models. This approach makes reading controller code simple (Article::ordered()->take(6)->get()), gives you access to Laravel mutators so you views are human readable ($article->full_date), and allows you to share business logic between admin and public sites. There is no additional templating or querying language to learn. After the CMS is setup, the developer interacts with the data using purely Laravel APIs.

Features

Besides it’s model-centric paradigm, Decoy includes the following features:

  • Great looking, zero-training required design
  • Croppa integration for advanced image support including cropping, setting focal point, and storing alt text
  • Video encoding via Zencoder integration
  • WYSIWYG text editing via Redactor
  • Support for all Laravel relationship types
  • Easy creation of content editing forms using Former
  • Remote file storage (S3, etc) via Upchuck and Flysystem
  • Granular admin permissioning
  • Fully customizable edit views with Bootstrap support
  • Commands panel for executing artisan commands via web UI
  • Cloning of content, even across servers
  • Localization
  • Organized key-value pair type data as Elements
  • Drag and drop ordering of data in list views
  • Built in interface for creating 301 and 302 redirects
  • All configuration stored in the filesystem to keep your team in sync via Git (or whatever VCS)

Implementation

Decoy installs into your app as a composer package and integrates with your project rather than being a standalone install. Decoy shares the Eloquent models of your public site and stores data in regular Laravel migrated tables. Your controllers and views do not need to touch Decoy at all and while your models need to use Decoy’s subclass of Eloquent\Model, there is very little behavior added at model instantiation. In other words, Decoy adds almost no overhead to your public site.

Implementing Decoy to manage model is done through a common MVC pattern that allows for overriding of default behavior at every step:

  • The admin nav, permission levels, localization options, and other settings are stored in Laravel-style php config arrays
  • For each manageable database table / Eloquent model, a Laravel-style controller is created that allows you to override defaults like how the title of the model appears, it’s description, how it can be searched within the admin, and even override any CRUD method (create, update, destroy, etc).
  • You specify validation rules, ordering scopes, and features like which relationships to follow when cloning from the model, adding specifically named properties and methods.
  • Finally, you create a regular Laravel view containing the form that should be shown to the admin during creation and editing of content. This is easier than it sounds through support of Former and many Decoy-unqiue Former fields like our image uploader and wysiwyg types.

Next steps

Interested in giving Decoy a spin? Check out the quick start guide.

decoy's People

Contributors

aaron-nunley avatar arminulrich avatar brokenhd avatar dependabot[bot] avatar kulemantu avatar laravel-shift avatar mattaebersold avatar noxify avatar seanthepottingshed avatar svenluijten avatar thelucre avatar weotch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

decoy's Issues

Localize Admin Strings

It would be great if all strings hardcoded into admin may be translated via lang* files.
Some of the strings are hardcoded in the index.js file (filters in listings, datepicker, etc).
I'm willing to pull my Brazilian Portuguese pack.

/admin/changes: ErrorException: SQLSTATE[42000]: Syntax error or access violation: 1055

Page /admin/changes gives this error:

Method Bkwld\Decoy\Fields\Listing::__toString() must not throw an exception, caught ErrorException: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'opio.changes.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select changes.id, CONCAT(first_name, " ", last_name) name from changes inner join admins on admins.id = admin_id group by admin_id) (View: C:\Users\emin\Dev\opio\vendor\bkwld\decoy\views\shared\list_full_header.haml)

Laravel 5.4

Add test that files get deleted

I think these could be in their own test for file handling. Maybe the image stuff from CrudTest could be moved into this test too.

  • Test that normal files get deleted as part of model being deleted
  • Test that normal files get deleted as part of explicit choice in UI to delete them
  • Test both with images
  • Test with Element images

[Question] Alternative Authentication possible?

Hi,

i would ask, if it's possible to use an alternative authentication package?

Is it "just" changing the guard and the policy class in the config or do i have do change something else?

Thanks!

Possible support of another Theme ?

Is there any way we can change the admin template, I'm working with metronic theme, as you know, it's a tricky theme that requires some work on it ?

Date field on list filters

When cycling through filters in search, if you change from a date field to a new field of any type, the date field isn’t removed from DOM.

Allow aspect ratio to be required on image field

Hi again.

Case we set a focal point in an image and call it using crop, the image is cropped to center, losing the focal point referencial.

2 suggestions:

  1. Alter crop logic to take in consideration the focal point.
  2. (not an alternative to previous suggestion, more like an addition) add methods like resizeByWidth(<width>) and resizeByHeight(<height>) so we could keep the original aspect ratio and use focal point info and have control of image size uploaded by client. Or even a method minDimensions(<width>,<height>) which will resize the original respecting the minor dimension (width or height).

Make xhr request to different resource

I am creating a photo gallery and have a dropzone upload on the gallery edit page. My dropzone instance is attempting to make a POST request (/admin/photos) to my Photos controller to create a new Photo resource, but it appears that the Router is redirecting to galleries/{id}/edit. I also tried creating a custom route /admin/galleries/{id}/photos (based on instructions in docs) based on my dropzone url, but was running into a 'You must login first' error. Any thoughts?

bug in Quick Start Guide

Not sure if maybe I did not follow correctly, but after going through the Quick Start and then running a artisan config:cache, I go an error Call to undefined method Closure::__set_state() in /var/www/html/local.decoy.com/bootstrap/cache/config.php on line 354.

I removed the following from bootstrap/cache/config.php

'log_changes' => 
      Closure::__set_state(array(
      )),

and all worked as expected.

Thanks for OS'ing this!

Add Laravel 5.4 support

Trust to the ConvertEmptyStringsToNull middleware to converty empty string to null rather than that PHP Library method.

Support for multiple images

Is there a way to add multiple images to an image field? If not, what it would be the best way to accomplish this?

Elements + Image Fields

Guys, I've set up an image type field in my config\decoy\elements.yaml file:

seo:
  label: SEO
  help: SEO and social integrations
  sections:
    general:
      ogimage:
        type: image
        label: Open graph (fallback and home):
        value: /img/og_logo.png

On the first save, the image was moved to public\uploads\emelents. Then... when the page refreshs, the file goes missing. Reload again, these 2 errors:

Exception in Element.php line 263:
All Element images must be stored in public/img

and

ErrorException in Element.php line 263:
All Element images must be stored in public/img (View: /home/vagrant/Code/mambo/vendor/bkwld/decoy/views/elements/index.haml)

I tried to find the issue myself, no success there. I think it's something in the getReplacementImage() at Elements.php, ln 238. It tests if the image has changed or something and deletes the old one. Maybe a false positive is making the code to delete the image around there.

Disable "Add new change"

Hi,

when filtering the existing changes with something like this:
bildschirmfoto 2017-04-24 um 21 34 55

I can click on the "New" button... this produces the following:

InvalidArgumentException in FileViewFinder.php line 137:
View [changes.edit] not found.

I think, to add a change manually makes no sense.

Maybe there is already something like this to disable a "Add new" functionality on a listing.

protected $createable = true/false

Elements migration doesn't create locale_group column.

Hi Guys, I know it's just create a migration to solve it. But it's the expected default behavior.

Anyways, here is the migration to update the table 2017_03_27_174854_add_locale_group_to_elements.php:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddLocaleGroupToElements extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('elements', function (Blueprint $table) {
            $table->string('locale_group')->index();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('elements', function (Blueprint $table) {
            $table->dropColumn('locale_group');
        });
    }
}

Unable to update an admin - image can't be set

Hi,

with a fresh laravel project i see always the following error message even when iI try to update my own admin user (e.g. change firstname from "A" to "B")

 Validation error: The field in conflict is highlighted below. Your submission was not saved.

It seems that there is something wrong in the validation :)

  • OSX with MAMP (PHP7.1 and mysql5.6 (but same with pgsql)
  • Laravel 5.4.19
  • Decoy dev-master

Localization

Image related issues:

  1. On duplicating for another locale, images relationships are not duplicated. The checkbox Include images and files is checked.
  2. On hovering a image field with a Compare locale radio checked, the tooltip image is broken.

Fix configuring of base URL via dir config

What's the best way to change the base url from /admin/* to say /cms/* ?

I already have an admin panel and not sure how deep the code goes that has hard-coded values etc.

How to configure the WYSIWYG Editor

Hi,

is it possible to change the default button configuration from the wysiwyg editor?

I found the default configuration in:
https://github.com/BKWLD/decoy/blob/master/assets/js/wysiwyg/redactor.js#L20

But I didn't found a way to change the buttons.

In the Custom Fields Documenation there is a reference to http://docs.decoy.bukwild.com/wysiwyg but it's a dead link.

Maybe it's possible to use something like this:

Former::wysiwyg('body')->buttons(['bold', 'italic', 'link']);

or

Former::wysiwyg('body')->config(['buttons' => ['bold', 'italic', 'link']]);

Or is there already some magic to do this?

Thanks!

Get error on articles listing

After following the Quick Start tutorial to create a News Articles Listing, I get the following error when trying to see the list of articles:

FatalErrorException in ac61b2b66585f5333939165665079b0553efbf65.php line 0:
Method Bkwld\Decoy\Fields\Listing::__toString() must not throw an exception, caught ErrorException: 
Class 'Article' not found (View: /Users/juan/Sites/completeps/vendor/bkwld/decoy/views/shared/list/_full_header.haml)

ErrorException: scandir(C:\Users\emin\Dev\opio\app\Console/Commands,C:\Users\emin\Dev\opio\app\Console/Commands)

I've just installer Decoy on Laravel 5.4. (I'm really excited about Decoy!!)

I'm getting this error when logging in to the admin:

Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: scandir(C:\Users\emin\Dev\opio\app\Console/Commands,C:\Users\emin\Dev\opio\app\Console/Commands): The system cannot find the file specified. (code: 2) (View: C:\Users\emin\Dev\opio\vendor\bkwld\decoy\views\layouts\sidebar\_nav.haml) (View: C:\Users\emin\Dev\opio\vendor\bkwld\decoy\views\layouts\sidebar\_nav.haml)

I'm on Windows, using latest Laragon (Apache, php 7.0).
Could this error be related to the Windows slash/backslash in file paths?
Laravel without Decoy works fine on my system.

Pagination broken in 5.3+

Getting:

Class 'Illuminate\Pagination\BootstrapThreePresenter' not found

Laravel removed the concept of presetner classes in 5.3

Example project and docs in separate repo

Thanks for sharing this package! I've been looking forward to playing around with it these last few days. Unfortunately I've stumbled across some quirks before completing the quick start steps.

Firstly, could you please separate the example project and the documentation into their own repository? Both the example and the documentation are greatly appreciated, but their inclusion in the Decoy package is causing some problems.

Using PHPStorm I'm now getting warnings all over the place regarding to duplicate classes, resulting from the Laravel example project included in the Decoy package. Unfortunately PHPStorm does not seem to allow me to ignore the folder for autocompletion unless I ignore the entire Decoy package.

Secondly, the size of my project effectively doubled due to the near 30 MB of documentation included in the package. One of the gif assets takes up about 11 MB all by itself. The documentation is certainly valuable and the animation is informative, but doubt it should be part of the production deployment package. It caused a timeout during my initial deployment.

Thanks!

Localize array flip error and title() in models

The method localizableLocales() of Localize class is generating an error because Laravels query method "lists" returns a collection, not an array.

Classes\Input\Localize.php, ln 93

Suggested code:

public function localizableLocales() {
	return array_diff_key( // Keep only locales that don't exist in
		Config::get('decoy.site.locales'),
		array_flip($this->other()->lists('locale')->toArray()), // ... the locales of other localizations
			[$this->item->locale => null] // ... and this locale
	); 
}

Also, all translatable models should have a title() method?
In _localize.haml, ln 21 it expects that the model have it:

%a(href=DecoyURL::relative('edit', $model->getKey()))!=$model->title()

And in views\shared\form\display\_locale.php, ln 22:

$label = "<span class='locale-label'>{$label} - Localized as <a href='".DecoyURL::relative('edit', $sibling->getKey())."'>".$sibling->title().'</a></span>';

So we had to do this:

/**
 * Hopefully this is temporary. See: _localize.haml, ln 21
 *
 * @return string
 */
public function title() {
   return $this->title;
}

Isn't preferable that this is an attribute like ->adminTitle (getAdminTitleAttribute() in Base class)?

Suggested code for _localize.haml, ln 21:

%a(href=DecoyURL::relative('edit', $model->getKey()))!=$model->adminTitle

and for views\shared\form\display\_locale.php, ln 22:

$label = "<span class='locale-label'>{$label} - Localized as <a href='".DecoyURL::relative('edit', $sibling->getKey())."'>".$sibling->adminTitle.'</a></span>';

Visibility toggle not working in list

It seems like a Model's public attribute, when getting put through the Bkwld\Library\Utils::nullEmpties is nulling false values. So I am getting the following when attempting to set public to false via the list toggle.

Integrity constraint violation: 1048 Column 'public' cannot be null'

The comments from the nullEmpties method seem to suggest numeric 0 is intentionally being excluded. Is the public boolean getting casted to true/false along the way?

Add Laravel 5.3 support

First time on login.

"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"bkwld/decoy": "^5.2"

FatalErrorException in Login.php line 17: Trait method hasTooManyLoginAttempts has not been applied, because there are collisions with other trait methods on Bkwld\Decoy\Controllers\Login

L5.3 - Test management of admins

Make sure creation and management of admins still works. I think these are more at risk that other things because of L5.3 changes to auth.

Funny Error when trying to access home page after login

I'm getting this odd error for an unknown reason.

fopen(C:\Users\AIO2\Sites\DecoySample\public\/img/temp/home-marquee.jpg): failed to open stream: No such file or directory (View: C:\Users\AIO2\Sites\DecoySample\vendor\bkwld\decoy\views\elements\index.haml)

Maybe I'm missing something.

FatalErrorException on first login

Hi

I have followed your quick-start instructions (http://docs.decoy.bukwild.com/quick-start), and everything seems to work until I go to /admin in the browser. The error comes up as follows:

Symfony\Component\Debug\Exception\FatalErrorException in d6b3bed5a9cf6ab689b4081dcf6401412aed3c3f.php line 0:
Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: scandir(/home/vagrant/Code/Sites/thebackend/app/Console/Commands): failed to open dir: No such file or directory (View: /home/vagrant/Code/Sites/thebackend/vendor/bkwld/decoy/views/layouts/sidebar/_nav.haml) (View: /home/vagrant/Code/Sites/thebackend/vendor/bkwld/decoy/views/layouts/sidebar/_nav.haml)

The admin user has been set up in the database, and it seems to log me in, but the re-direct then throws the error.

My environment is Homestead
Thanks

@symfonycoda
@UKLaravel

L5.2.45 Errors when login to admin for first time

  1. Error on /admin/articles
Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Undefined variable: back
  1. Error on /admin/elements
fopen(/Users/Od3n/Documents/Git/decoy/public//img/temp/home-marquee.jpg): failed to open stream: No such file or directory (View: /Users/Od3n/Documents/Git/decoy/vendor/bkwld/decoy/views/elements/index.haml)

locale_group not setting on model creation

Sorry guys. We've became great fans of Decoy, and we are heavy using it. So we are bumping into some issues that you may not have noticed. Especially localization related issues.

L5.4 - Wildcard event listeners

Confirm that the wildcard event listeners in the ServiceProvider still work.

From upgrade guide:

Wildcard event handlers now receive the event name as their first argument and the array of event data as their second argument. The Event::firing method has been removed:

Adopt PSR-1 & 2

Hey! I was wondering if there is any interest in switching this codebase to adopt some de-factor PHP standards (mainly PSR-2, thus including PSR-1).

I can work on porting the codebase over if you want, but I'd like your opinions on this before I get to work 🙂

Former::checkbox('category'), Array to string conversion error

I'm trying to figure out Former::checkbox, following the guide here: http://docs.decoy.bukwild.com/views

This is my view code:
!= Former::checkbox('category')->checkboxes(Bkwld\Library\Laravel\Former::checkboxArray('category', App\Project::$categories))->push(false)

The edit page is displayed correctly with the 4 checkboxes from the static array on the App\Project model, but when I try to save I get this:

Array to string conversion (SQL: update `projects` set `category` = inspiring, `updated_at` = 2017-04-21 18:28:49 where `id` = 1)

Am I missing something?
What does ->push(false) mean?

Laravel 5.4, PHP 7.0, MySQL 5.7

Assets on S3

I am planning to store all my app's assets on S3 and not on the local filesystem. I made my default filesystem S3 in the filesystems.php config file; however, when I upload a file for a post, etc, it is still saved on my local storage folder and not on my designated S3 folder. Am I missing something? or S3 is not supported for assets.

Media library?

My first impression of the CMS is that's absolutely great. Unfortunately I expect soms resistance during the adoption process in our organisation due to the lack of a media library. Are there any plans for a media/image library? Or would it be easy to create one myself? Thanks!

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.