unclecheese / silverstripe-gridfield-betterbuttons

Adds new form actions and buttons to the GridField detail form
GNU General Public License v2.0
80 stars 88 forks source link

javascripts/css links no longar valid in SilverStripe 4.1 #175

Open Martimiz opened 6 years ago

Martimiz commented 6 years ago

SilverStripe 4.1 seems to want javascript/css to live in resources/betterbuttons (fysically public/resources/betterbuttons), unless the path is set from the site root,

so this seems to fix that: _config.php use \SilverStripe\Control\Director; define('BETTER_BUTTONS_DIR', Director::baseURL() . basename(dirname(FILE)));

[EDIT] Sorry: This doesn't fix anything: it strips 'resources' from the url, but that will still generate a 404 (.htacces redirecting everything) :(

Martine

Martimiz commented 6 years ago

For now, in my dev setup, I did a quick and dirty .htaccess fix like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/betterbuttons/javascript.*
RewriteCond %{REQUEST_URI} !^/betterbuttons/css.*
RewriteCond %{REQUEST_URI} !^/betterbuttons/images.*
RewriteRule ^(.*)$ public/$1

that plus _config.php

use \SilverStripe\Control\Director;
define('BETTER_BUTTONS_DIR', Director::absoluteBaseURL()  . basename(dirname(__FILE__)));

... got it working again, but obviously modules in the root are not the thing anymore? What would be the best course? Besides better buttons finally becoming part of core :)

Martine

derralf commented 6 years ago

that somehow did't work for me, so i just added a symlink in the /public/ folder: ln -s ../betterbuttons betterbuttons

Martimiz commented 6 years ago

Yes, you’re right, I ultimately wound up with css/javascript/images in public too - but your symlink is a far nicer workaround for now 😊