diff --git a/modules/backend/assets/css/october.css b/modules/backend/assets/css/october.css index b5dfb783c..fb406fc2b 100644 --- a/modules/backend/assets/css/october.css +++ b/modules/backend/assets/css/october.css @@ -8262,10 +8262,14 @@ label { margin-top: -44px; height: 88px; width: 36px; + color: #8c8c8c; } .field-recordfinder .btn i { font-size: 14px; } +.field-recordfinder .btn:hover { + color: #666666; +} .field-recordfinder .text-muted i { font-size: 14px; position: relative; @@ -8276,6 +8280,12 @@ label { .field-recordfinder .primary { font-weight: 600; } +.recordfinder-search { + background-position: right -81px !important; + border-top: none !important; + border-left: none !important; + border-right: none !important; +} .form-buttons { padding-bottom: 20px; font-size: 0; diff --git a/modules/backend/assets/less/controls/forms.less b/modules/backend/assets/less/controls/forms.less index 2a5942c05..62875db49 100644 --- a/modules/backend/assets/less/controls/forms.less +++ b/modules/backend/assets/less/controls/forms.less @@ -213,10 +213,15 @@ label { margin-top: -44px; height: 88px; width: 36px; + color: lighten(@btn-default-color, 15%); i { font-size: 14px; } + + &:hover { + color: @btn-default-color; + } } .text-muted i { font-size: 14px; @@ -230,6 +235,13 @@ label { } } +.recordfinder-search { + background-position: right -81px !important; + border-top: none !important; + border-left: none !important; + border-right: none !important; +} + .form-buttons { .clearfix(); padding-bottom: 20px; diff --git a/modules/backend/formwidgets/RecordFinder.php b/modules/backend/formwidgets/RecordFinder.php index 304738258..7b5346475 100644 --- a/modules/backend/formwidgets/RecordFinder.php +++ b/modules/backend/formwidgets/RecordFinder.php @@ -64,6 +64,11 @@ class RecordFinder extends FormWidgetBase */ protected $listWidget; + /** + * @var Backend\Classes\WidgetBase Reference to the widget used for searching. + */ + protected $searchWidget; + /** * {@inheritDoc} */ @@ -82,6 +87,20 @@ class RecordFinder extends FormWidgetBase if (post('recordfinder_flag')) { $this->listWidget = $this->makeListWidget(); + $this->listWidget->bindToController(); + + $this->searchWidget = $this->makeSearchWidget(); + $this->searchWidget->bindToController(); + + /* + * Link the Search Widget to the List Widget + */ + $this->searchWidget->bindEvent('search.submit', function() { + $this->listWidget->setSearchTerm($this->searchWidget->getActiveTerm()); + return $this->listWidget->onRefresh(); + }); + + $this->searchWidget->setActiveTerm(null); } } @@ -112,6 +131,7 @@ class RecordFinder extends FormWidgetBase $this->vars['nameValue'] = $this->getNameValue(); $this->vars['descriptionValue'] = $this->getDescriptionValue(); $this->vars['listWidget'] = $this->listWidget; + $this->vars['searchWidget'] = $this->searchWidget; $this->vars['prompt'] = str_replace('%s', '', $this->prompt); } @@ -168,6 +188,7 @@ class RecordFinder extends FormWidgetBase $config->alias = $this->alias . 'List'; $config->showSetup = false; $config->showCheckboxes = false; + $config->recordsPerPage = 20; $config->recordOnClick = sprintf("$('#%s').recordFinder('updateRecord', this, ':id')", $this->getId()); $widget = $this->makeWidget('Backend\Widgets\Lists', $config); @@ -185,4 +206,15 @@ class RecordFinder extends FormWidgetBase return $widget; } + + protected function makeSearchWidget() + { + $config = $this->makeConfig(); + $config->alias = $this->alias . 'Search'; + $config->growable = false; + $config->useSession = false; + $widget = $this->makeWidget('Backend\Widgets\Search', $config); + $widget->cssClasses[] = 'recordfinder-search'; + return $widget; + } } \ No newline at end of file diff --git a/modules/backend/formwidgets/recordfinder/assets/js/recordfinder.js b/modules/backend/formwidgets/recordfinder/assets/js/recordfinder.js index d872e5a4a..f50e19ee6 100644 --- a/modules/backend/formwidgets/recordfinder/assets/js/recordfinder.js +++ b/modules/backend/formwidgets/recordfinder/assets/js/recordfinder.js @@ -33,6 +33,7 @@ var self = this $(this.options.dataLocker).val(recordId) + this.$el.loadIndicator({ opaque: true }) this.$el.request(this.options.refreshHandler, { success: function(data) { this.success(data) diff --git a/modules/backend/formwidgets/recordfinder/partials/_recordfinder.htm b/modules/backend/formwidgets/recordfinder/partials/_recordfinder.htm index a12f6635c..338ca40ba 100644 --- a/modules/backend/formwidgets/recordfinder/partials/_recordfinder.htm +++ b/modules/backend/formwidgets/recordfinder/partials/_recordfinder.htm @@ -1,9 +1,9 @@