Skip to content

Commit 99cce61

Browse files
committed
Readme and cs
1 parent 07dc133 commit 99cce61

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
### For Laravel 4, please use the [1.0 branch](https://github.com/Arrilot/laravel-widgets/tree/1.0)!
1111

12-
*Note: this is the doc for the latest stable release. If you need documentation for your specific version you can find it by clicking on a corresponding tag here https://github.com/Arrilot/laravel-widgets/releases*
12+
> Note: This is the doc for the latest stable release. If you need documentation for your specific version you can find it by clicking on a corresponding tag here https://github.com/Arrilot/laravel-widgets/releases
1313
1414
## Installation
1515

@@ -104,7 +104,7 @@ or even
104104

105105
There is no real difference between them. The choice is up to you.
106106

107-
*Note: For Laravel 5.0.0 - 5.1.3 you have to use `{!! !!}` tags instead of `{{ }}`*
107+
> Note: For Laravel 5.0.0 - 5.1.3 you have to use `{!! !!}` tags instead of `{{ }}`
108108
109109
## Passing variables to widget
110110

@@ -132,7 +132,7 @@ class RecentNews extends AbstractWidget {
132132
```
133133
`['count' => 10]` is a config array that can be accessed by $this->config.
134134

135-
*Note: Config fields that are not specified when you call the widget aren't overridden:*
135+
> Note: Config fields that are not specified when you call the widget aren't overridden:
136136
137137
```php
138138
class RecentNews extends AbstractWidget {
@@ -199,15 +199,13 @@ You can pass FQCN too.
199199
In some situations it can be very beneficial to load widget content with AJAX.
200200

201201
Fortunately, this can be achieved very easily!
202+
All you need to do is to change facade or blade directive - `Widget::` => `AsyncWidget::`, `@widget` => `@asyncWidget`
202203

203-
1. Make sure you have jquery loaded for ajax calls before the widget is called.
204-
2. Change facade or blade directive - `Widget::` => `AsyncWidget::`, `@widget` => `@asyncWidget`
205-
206-
Done.
204+
> Note: Since version 3.1 you no longer need jquery to make ajax calls. Set `use_jquery_for_ajax_calls` to `true` in the config file if you need it.
207205
208206
By default nothing is shown until ajax call is finished.
209207

210-
This can be easily customized by adding a `placeholder()` method to the widget class.
208+
This can be customized by adding a `placeholder()` method to the widget class.
211209

212210
```php
213211
public function placeholder()
@@ -220,10 +218,7 @@ public function placeholder()
220218

221219
You can go even further and automatically reload widget every N seconds.
222220

223-
To achieve that:
224-
225-
1. Make sure you have jquery loaded for ajax calls before the widget is called.
226-
2. Set the `$reloadTimeout` property of the widget class.
221+
To achieve that simply set the `$reloadTimeout` property of the widget class.
227222

228223
```php
229224
class RecentNews extends AbstractWidget

src/Factories/JavascriptFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected function constructAjaxCall()
9393
'params' => serialize($this->widgetFactory->widgetFullParams),
9494
];
9595

96-
$url = $this->ajaxLink."?".http_build_query($queryParams);
96+
$url = $this->ajaxLink.'?'.http_build_query($queryParams);
9797

9898
return $this->useJquery()
9999
? $this->constructJqueryAjaxCall($url)

tests/AsyncWidgetFactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ public function testItCanRunNestedAsyncWidgetUsingDotNotation()
174174

175175
public function testItCanRunAsyncWidgetWithoutJquery()
176176
{
177-
178177
$this->factory->app->config['laravel-widgets.use_jquery_for_ajax_calls'] = false;
179178

180179
$output = $this->factory->run('testDefaultSlider');

tests/Support/TestApplicationWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TestApplicationWrapper implements ApplicationWrapperContract
1616
* @var array
1717
*/
1818
public $config = [
19-
'laravel-widgets.default_namespace' => 'Arrilot\Widgets\Test\Dummies',
19+
'laravel-widgets.default_namespace' => 'Arrilot\Widgets\Test\Dummies',
2020
'laravel-widgets.use_jquery_for_ajax_calls' => true,
2121
];
2222

tests/Support/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function tearDown()
1414

1515
public function ajaxUrl($widgetName, $widgetParams = [], $id = 1)
1616
{
17-
return "/arrilot/load-widget?".http_build_query([
17+
return '/arrilot/load-widget?'.http_build_query([
1818
'id' => $id,
1919
'name' => $widgetName,
2020
'params' => serialize($widgetParams),

0 commit comments

Comments
 (0)