Skip to content

Commit

Permalink
Add "refresh" button to the RelationController
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers committed Aug 14, 2023
1 parent eeb7149 commit 40a23e4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/backend/behaviors/RelationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,12 @@ public function onRelationButtonLink()
return $this->onRelationManageForm();
}

public function onRelationButtonRefresh()
{
$this->beforeAjax();
return $this->relationRefresh();
}

public function onRelationButtonUnlink()
{
return $this->onRelationManageRemove();
Expand Down Expand Up @@ -1588,6 +1594,10 @@ protected function evalToolbarButtons()
$text = 'backend::lang.relation.add_name';
break;

case 'refresh':
$text = 'backend::lang.relation.refresh';
break;

case 'remove':
$text = 'backend::lang.relation.remove';
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<button
class="btn btn-sm btn-secondary wn-icon-arrows-rotate"
data-request="onRelationButtonRefresh"
data-stripe-load-indicator>
<?= e(trans($text)) ?>
</button>
1 change: 1 addition & 0 deletions modules/backend/lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
'relationwidget_unsupported_type' => 'The ":type" relation type is unsupported by the Relation widget.',
'help' => 'Click on an item to add',
'related_data' => 'Related :name data',
'refresh' => 'Refresh',
'add' => 'Add',
'add_selected' => 'Add selected',
'add_a_new' => 'Add a new :name',
Expand Down

0 comments on commit 40a23e4

Please sign in to comment.