Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix module and resource loading for SS 4.1.0 #177

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions _config.php

This file was deleted.

10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "unclecheese/betterbuttons",
"description": "Adds new form actions and buttons to GridField detail form for usability enhancements.",
"type": "silverstripe-module",
"type": "silverstripe-vendormodule",
"keywords": ["silverstripe", "gridfield", "buttons"],
"license": "GNU",
"authors": [
Expand All @@ -11,12 +11,18 @@
}
],
"require": {
"silverstripe/vendor-plugin": "^1.0",
"silverstripe/framework": "^4.0@dev"
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"expose": [
"css",
"images",
"javascript"
]
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 11 additions & 1 deletion css/gridfield_betterbuttons.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
.cms .gridfield-better-buttons-prevnext.disabled { opacity: 0.3; filter: alpha(opacity=30); }

.cms .gridfield-better-buttons-prevnext img { height:7px; vertical-align:1px; }
.cms .gridfield-better-buttons-prev {
background: url('../images/prev.png') no-repeat center center;
background-position-x: 2px;
padding-left: 22px;
}

.cms .gridfield-better-buttons-next {
background: url('../images/next.png') no-repeat center center;
background-position-x: 100%;
padding-right: 22px;
}

.cms .gridfield-better-buttons-prevnext .ui-button-text { line-height:1; }

Expand Down
4 changes: 2 additions & 2 deletions src/Actions/BetterButtonPrevNextAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getButtonHTML()
$linkText = $previousRecordID ? _t('GridFieldBetterButtons.PREVIOUS', 'Previous') : "";

$html .= sprintf(
"<a class='ss-ui-button btn btn-default gridfield-better-buttons-prevnext gridfield-better-buttons-prev %s' href='%s' title='%s'><img src='".BETTER_BUTTONS_DIR."/images/prev.png' alt='previous' /> %s</a>",
"<a class='ss-ui-button btn btn-default gridfield-better-buttons-prevnext gridfield-better-buttons-prev %s' href='%s' title='%s'>%s</a>",
$cssClass,
$prevLink,
$linkTitle,
Expand All @@ -53,7 +53,7 @@ public function getButtonHTML()
$linkText = $nextRecordID ? _t('GridFieldBetterButtons.NEXT', 'Next') : "";

$html .= sprintf(
"<a class='ss-ui-button btn btn-default gridfield-better-buttons-prevnext gridfield-better-buttons-next %s' href='%s' title='%s'>%s <img src='".BETTER_BUTTONS_DIR."/images/next.png' alt='next' /></a>",
"<a class='ss-ui-button btn btn-default gridfield-better-buttons-prevnext gridfield-better-buttons-next %s' href='%s' title='%s'>%s</a>",
$cssClass,
$nextLink,
$linkTitle,
Expand Down
2 changes: 1 addition & 1 deletion src/Buttons/BetterButton_Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct()
public function baseTransform()
{
parent::baseTransform();
Requirements::javascript(BETTER_BUTTONS_DIR.'/javascript/gridfield_betterbuttons_delete.js');
Requirements::javascript('unclecheese/betterbuttons:javascript/gridfield_betterbuttons_delete.js');

return $this
->setUseButtonTag(true)
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/BetterButtonsNestedFormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function Form()
*/
public function index(HTTPRequest $r)
{
Requirements::css(BETTER_BUTTONS_DIR.'/css/betterbuttons_nested_form.css');
Requirements::css('unclecheese/betterbuttons:css/betterbuttons_nested_form.css');

return $this->customise(array(
'Form' => $this->Form()
Expand Down
4 changes: 2 additions & 2 deletions src/Extensions/GridFieldBetterButtonsItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public function updateItemEditForm($form)
if ($this->owner->record->stat('better_buttons_enabled') !== true) {
return false;
}
Requirements::css(BETTER_BUTTONS_DIR.'/css/gridfield_betterbuttons.css');
Requirements::javascript(BETTER_BUTTONS_DIR.'/javascript/gridfield_betterbuttons.js');
Requirements::css('unclecheese/betterbuttons:css/gridfield_betterbuttons.css');
Requirements::javascript('unclecheese/betterbuttons:javascript/gridfield_betterbuttons.js');


$actions = $this->owner->record->getBetterButtonsActions();
Expand Down
4 changes: 2 additions & 2 deletions src/FormFields/DropdownFormAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function __construct($title = null, $children = array ())
*/
public function Field($properties = array ())
{
Requirements::css(BETTER_BUTTONS_DIR . '/css/dropdown_form_action.css');
Requirements::javascript(BETTER_BUTTONS_DIR . '/javascript/dropdown_form_action.js');
Requirements::css('unclecheese/betterbuttons:css/dropdown_form_action.css');
Requirements::javascript('unclecheese/betterbuttons:javascript/dropdown_form_action.js');
$this->setAttribute('data-form-action-dropdown', '#' . $this->DropdownID());

return parent::Field();
Expand Down