From f3a56dd9bb5d7c5a36ed5ef0d9751a153e940279 Mon Sep 17 00:00:00 2001 From: Semenov Date: Tue, 9 Aug 2022 11:16:39 +0300 Subject: [PATCH] dev --- src/widgets/AjaxControllerActionsWidget.php | 11 ++++++++++- src/widgets/assets/src/css/backend-filters.css | 3 +++ .../assets/src/js/ajax-controller-actions-widget.js | 9 +++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/widgets/AjaxControllerActionsWidget.php b/src/widgets/AjaxControllerActionsWidget.php index b070ea9..3487a39 100644 --- a/src/widgets/AjaxControllerActionsWidget.php +++ b/src/widgets/AjaxControllerActionsWidget.php @@ -48,6 +48,14 @@ class AjaxControllerActionsWidget extends Widget * @var */ public $modelId; + /** + * @var + */ + public $urlParams = []; + /** + * @var + */ + public $isRunFirstActionOnClick = false; /** * @throws Exception @@ -101,9 +109,10 @@ public function run() $this->options = ArrayHelper::merge($this->defaultOptions, [ 'data' => [ - 'url' => Url::to(["/".$this->controllerId."/model-actions", 'pk' => $this->modelId]), + 'url' => Url::to(ArrayHelper::merge(["/".$this->controllerId."/model-actions", 'pk' => $this->modelId], (array) $this->urlParams)), 'controller-id' => $this->controllerId, 'model-id' => $this->modelId, + 'is-run-first-action-on-click' => (int)$this->isRunFirstActionOnClick, ], ], $this->options); diff --git a/src/widgets/assets/src/css/backend-filters.css b/src/widgets/assets/src/css/backend-filters.css index 7d59b78..e54519a 100644 --- a/src/widgets/assets/src/css/backend-filters.css +++ b/src/widgets/assets/src/css/backend-filters.css @@ -145,6 +145,9 @@ .sx-backend-filters-form.form-inline .form-control { width: 100%; } +.sx-backend-filters-form.form-inline .form-control { + padding: 5px; +} .sx-backend-filters-form.form-inline .dropdown-menu .filter--group--body { margin: 20px 10px; } diff --git a/src/widgets/assets/src/js/ajax-controller-actions-widget.js b/src/widgets/assets/src/js/ajax-controller-actions-widget.js index 40b0c31..1228655 100644 --- a/src/widgets/assets/src/js/ajax-controller-actions-widget.js +++ b/src/widgets/assets/src/js/ajax-controller-actions-widget.js @@ -83,7 +83,12 @@ $("body").on("click", '.sx-btn-ajax-actions', function(e) { e.preventDefault(); - $(this).addClass('sx-opened-actions'); + if ($(this).data("is-run-first-action-on-click") == 1) { + $(this).trigger("firstAction"); + } else { + $(this).trigger("contextmenu"); + } + /*$(this).addClass('sx-opened-actions'); $('.popover').popover('hide'); @@ -92,7 +97,7 @@ } else { var data = _.clone($(this).data()); self._createPopover($(this), data); - } + }*/ }); //Скрыть лишние окошки