You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-28Lines changed: 21 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@
7
7
8
8
*A powerful alternative to view composers. Asynchronous widgets, reloadable widgets, console generator, caching - everything you can think of.*
9
9
10
-
### For Laravel 4, please use the [1.0 branch](https://github.com/Arrilot/laravel-widgets/tree/1.0)!
10
+
### For Laravel 4, please use the [1.0 branch](https://github.com/arrilot/laravel-widgets/tree/1.0)!
11
11
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 herehttps://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 therehttps://github.com/arrilot/laravel-widgets/releases
13
13
14
14
## Installation
15
15
@@ -27,7 +27,7 @@
27
27
?>
28
28
```
29
29
30
-
3) Add some facades here too. If you prefer custom blade directives instead of facades (see later) you can skip it.
30
+
3) Add some facades here too. If you prefer custom blade directives to facades you can skip this step.
31
31
32
32
```php
33
33
<?php
@@ -93,15 +93,15 @@ The last step is to call the widget.
93
93
You've actually got several ways to do so.
94
94
95
95
```php
96
-
{{ Widget::run('recentNews') }}
96
+
@widget('recentNews')
97
97
```
98
98
or
99
99
```php
100
-
{{ Widget::recentNews() }}
100
+
{{ Widget::run('recentNews') }}
101
101
```
102
102
or even
103
103
```php
104
-
@widget('recentNews')
104
+
{{ Widget::recentNews() }}
105
105
```
106
106
107
107
There is no real difference between them. The choice is up to you.
@@ -123,13 +123,11 @@ class RecentNews extends AbstractWidget {
You can override this by publishing package config (```php artisan vendor:publish --provider="Arrilot\Widgets\ServiceProvider"```) and setting `default_namespace` property.
194
190
195
-
Although using the default namespace is very convenient, in some situations you may wish to have more flexibility.
191
+
Although using the default namespace is very convenient, in some cases you may wish to have more flexibility.
196
192
For example, if you've got dozens of widgets it makes sense to group them in namespaced folders.
197
193
198
194
No problem, you have several ways to call those widgets:
199
195
200
196
1) Pass a full widget name from the `default_namespace` (basically `App\Widgets`) to the `run` method.
@@ -224,7 +217,7 @@ All you need to do is to change facade or blade directive - `Widget::` => `Async
224
217
225
218
> Note: Widget params are encrypted and sent via ajax call. Expect them to be json_encoded and json_decoded afterwards.
226
219
227
-
> Note: Since version 3.1 you no longer need `jquery` to make ajax calls. However you can set `use_jquery_for_ajax_calls` to `true` in the config file if you need for some reason.
220
+
> Note: Since version 3.1 you no longer need `jquery` to make ajax calls. However you can set `use_jquery_for_ajax_calls` to `true` in the config file if you want to.
228
221
229
222
By default nothing is shown until ajax call is finished.
230
223
@@ -237,7 +230,7 @@ public function placeholder()
237
230
}
238
231
```
239
232
240
-
> Note: If you need to do smth with the routes package uses to load async widgets (e.g. you run app in a subfolder http://site.com/app/) you need to copy Arrilot\Widgets\ServiceProvider to your app, modify it according to your needs and register it in Laravel instead of the former one.
233
+
> Side note: If you need to do smth with the routes package uses to load async widgets (e.g. you run app in a subfolder http://site.com/app/) you need to copy Arrilot\Widgets\ServiceProvider to your app, modify it according to your needs and register it in Laravel instead of the former one.
241
234
242
235
## Reloadable widgets
243
236
@@ -260,12 +253,12 @@ class RecentNews extends AbstractWidget
260
253
Both sync and async widgets can become reloadable.
261
254
262
255
You should use this feature with care, because it can easily spam your app with ajax calls if timeouts are too low.
263
-
Consider using web sockets too but they are waaaay harder to set up on the other hand.
256
+
Consider using web sockets too but they are way harder to set up.
264
257
265
258
## Container
266
259
267
260
Async and Reloadable widgets both require some DOM interaction so they wrap all widget output in a html container.
268
-
This container is defined by AbstractWidget::container() method and can be customized therefore.
261
+
This container is defined by `AbstractWidget::container()` method and can be customized too.
269
262
270
263
```php
271
264
/**
@@ -283,7 +276,7 @@ This container is defined by AbstractWidget::container() method and can be custo
283
276
}
284
277
```
285
278
286
-
> Note: Nested async or reloadable widgets are not supported because of container id collision.
279
+
> Note: Nested async or reloadable widgets are not supported.
287
280
288
281
## Caching
289
282
@@ -310,17 +303,17 @@ Override ```cacheKey``` method if you need to adjust it.
310
303
## Widget groups (extra)
311
304
312
305
In most cases Blade is a perfect tool for setting the position and order of widgets.
313
-
However, in some cases you may find useful the approach with widget groups:
306
+
However, sometimes you may find useful the following approach:
314
307
315
308
```php
316
309
// add several widgets to the 'sidebar' group anywhere you want (even in controller)
0 commit comments