area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.74k stars 570 forks source link

Edit form doesn't load #180

Closed bastienrobert closed 5 years ago

bastienrobert commented 5 years ago

I'm following the documentation to add Twill (1.2.) on a fresh install (php ^7.1.3 & laravel 5.7.).

For now, I only set these env values on the .env:

MEDIA_LIBRARY_ENDPOINT_TYPE=local
MEDIA_LIBRARY_LOCAL_PATH=uploads/
FILE_LIBRARY_ENDPOINT_TYPE=local
FILE_LIBRARY_LOCAL_PATH=uploads/
MEDIA_LIBRARY_IMAGE_SERVICE=A17\Twill\Services\MediaLibrary\Local

And I setup the database to use sqlite3.

No problem with the installation, everything is going well. I've my administration credentials but when I'm trying to access to the dashboard settings, (it redirects me to http://admin.localhost:8000/users/1/edit but) the form is never appearing. The loader never stops. When I look at the DOM, the fields seem to be well generated.

image

I think it's a DOM error. Here is the logs in the JS console.

image

Uncaught SyntaxError: Unexpected token &

Uncaught TypeError: Cannot read property 'medias' of undefined
bastienrobert commented 5 years ago

Ok, I found the bug. In the form.blade.php layout, the line:

published: {{ json_encode(isset($item) ? $item->published : false) }},

returns "0"

So, I migrate my db from sqlite to postgresql. It works.

baysmac commented 5 years ago

I have just run into this issue when publishing my application to a production environment. Does anyone have any fixes other than @bastienrobert migrating from sqlite to postgresql?

bastienrobert commented 5 years ago

I'm now using MariaDB, still no problem. The issue seems to come from sqlite.

baysmac commented 5 years ago

@bastienrobert Must also be an issue with mysql as that is what I am using. Hesitant to have to migrate as I have populated over 100 records on local with no issues, its only when I publish to the production environment.

ifox commented 5 years ago

Hi @benmacgowan, MySQL shouldn't be the issue here. Can you share more about your error? Do you have something in your Laravel log? In the browser console?

baysmac commented 5 years ago

Hi @ifox

Browser console shows the following whenever loading the edit form (for all modules):

Alt

Nothing seems to be appearing in the Laravel logs.

bastienrobert commented 5 years ago

Yep, got exactly the same under SQLite but I don’t have this issue anymore with maria 🙃

adelinferaru commented 5 years ago

Hi! I also have the same error but it is not related to MySQL. In my local machine it is working just fine. The error appeared after I published on the server (cloudlinux, MariaDB 10.1.38, PHP 7.2 - cPanel).

As you probably know .. cPanel has the public_html folder so I have created another folder on the account root where I have uploaded everything except the "public" folder ... The "public" folder contents I have uploaded to the "public_html" folder in my cPanel account. I have done all necessary changes to reflect the new public_path() ... and everything is working fine both in frontend and the Twill's admin ... except the "EDIT" form. I can create new models ... but the edit part is same as @benmacgowan reported.

Chrome's reported error in vendor.js:

var d, p = {
            state: {
                crops: window.STORE.medias.crops || {},
                types: window.STORE.medias.types || [],
                type: "image"

The page however has a Githubissues.

  • Githubissues is a development platform for aggregating issues.