Commit c2926260 authored by Kevin Yumang's avatar Kevin Yumang

SERV-2286 - added random select (randomizer) element

parent b759a483
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
'Limitless::ElementCardStart' => 'cardStart', 'Limitless::ElementCardStart' => 'cardStart',
'Limitless::ElementCardStop' => 'cardStop', 'Limitless::ElementCardStop' => 'cardStop',
'Limitless::LoremIpsum' => 'loremIpsum', 'Limitless::LoremIpsum' => 'loremIpsum',
'Limitless::RandomSelect' => 'randomSelect',
'Limitless::Divider' => 'divider', 'Limitless::Divider' => 'divider',
'Limitless::Example' => 'example', 'Limitless::Example' => 'example',
]; ];
...@@ -105,6 +106,18 @@ ...@@ -105,6 +106,18 @@
} }
/*
|--------------------------------------------------------------------------------------------
| Method "randomSelect"
|--------------------------------------------------------------------------------------------
*/
public function randomSelect($items)
{
return View('Limitless::Element.RandomSelect.RandomSelect')
->withItems($items);
}
/* /*
|-------------------------------------------------------------------------------------------- |--------------------------------------------------------------------------------------------
......
{{-- Layout Reference --}}
@extends('Limitless::Help.Layout.Master')
@section('Limitless::Content')
{{-- Description --}}
@Limitless::ElementCardStart(['title' => "RandomSelect", 'icon' => 'icon-shuffle'])
<p>Selects one random item from a <i>one (1)</i> level array.</p>
@Limitless::ElementCardStop
{{-- Elements --}}
@Limitless::ElementCardStart(['title' => "Fragments", 'icon' => 'icon-grid5'])
<div class="bg-dark rounded py-2 px-3 mb-3">
<h6 class="mb-0 font-weight-semibold">RandomSelect</h6>
<p class="mb-3 text-muted">Selects one random item from a <i>one (1)</i> level array.</p>
<p class="font-italic font-size-lg">Parameters</p>
<div class="row mt-2">
@Limitless::TableStart([ 'extra' => ['class' => 'table table-xs table-striped'] ])
@Limitless::TableAutofillHeader([
['name' => 'Key'],
['name' => 'Type'],
['name' => 'Description']
])
@Limitless::TableAutofillBody([
[
['value' => 'items'],
['value' => '<i>Array</i> [Default = <code>[]</code>]', 'secure' => false],
['value' => 'The array of items.']
]
])
@Limitless::TableStop
</div>
</div>
@Limitless::ElementCardStop
{{-- Sample Output --}}
@Limitless::ElementCardStart(['title' => "Sample Output", 'icon' => 'icon-display4' ] )
@php
$items = ['Item1', 'Item2', 'Item3', 'Item4', 'Item5'];
@endphp
<div> @Limitless::RandomSelect($items) </div>
<div> @Limitless::RandomSelect($items) </div>
<div> @Limitless::RandomSelect($items) </div>
<div> @Limitless::RandomSelect($items) </div>
<div> @Limitless::RandomSelect($items) </div>
@Limitless::ElementCardStop
@php
$example = base64_decode("QHBocAoJJGl0ZW1zID0gWydJdGVtMScsICdJdGVtMicsICdJdGVtMycsICdJdGVtNCcsICdJdGVtNSddOwpAZW5kcGhwCjxkaXY+IEBMaW1pdGxlc3M6OlJhbmRvbVNlbGVjdCgkaXRlbXMpIDwvZGl2Pgo8ZGl2PiBATGltaXRsZXNzOjpSYW5kb21TZWxlY3QoJGl0ZW1zKSA8L2Rpdj4KPGRpdj4gQExpbWl0bGVzczo6UmFuZG9tU2VsZWN0KCRpdGVtcykgPC9kaXY+CjxkaXY+IEBMaW1pdGxlc3M6OlJhbmRvbVNlbGVjdCgkaXRlbXMpIDwvZGl2Pgo8ZGl2PiBATGltaXRsZXNzOjpSYW5kb21TZWxlY3QoJGl0ZW1zKSA8L2Rpdj4=");
@endphp
{{-- Sample Code --}}
@Limitless::ElementCardStart(['title' => "Sample Code", 'icon' => 'icon-circle-code' ] )
@Limitless::Codemirror([ 'language' => 'javascript', 'theme' => 'zenburn', 'value' => $example ])
@Limitless::ElementCardStop
@stop
{{ $items[array_rand($items)] }}
\ No newline at end of file
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
case "navigation": case "navigation":
$path = 'Limitless::Navigation.Documentation.Index'; $path = 'Limitless::Navigation.Documentation.Index';
break; break;
case "randomselect":
$path = 'Limitless::Element.RandomSelect.Documentation.Index';
break;
case "table": case "table":
$path = 'Limitless::Table.Documentation.Index'; $path = 'Limitless::Table.Documentation.Index';
break; break;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
@Limitless::NavigationMenuItem(['url' => '?page=divider', 'target' => '_self', 'icon' => 'icon-minus2', 'title' => 'Divider']) @Limitless::NavigationMenuItem(['url' => '?page=divider', 'target' => '_self', 'icon' => 'icon-minus2', 'title' => 'Divider'])
@Limitless::NavigationMenuItem(['url' => '?page=loremipsum', 'target' => '_self', 'icon' => 'icon-bubble-lines3', 'title' => 'Lorem Ipsum']) @Limitless::NavigationMenuItem(['url' => '?page=loremipsum', 'target' => '_self', 'icon' => 'icon-bubble-lines3', 'title' => 'Lorem Ipsum'])
@Limitless::NavigationMenuItem(['url' => '?page=navigation', 'target' => '_self', 'icon' => 'icon-menu8', 'title' => 'Navigation']) @Limitless::NavigationMenuItem(['url' => '?page=navigation', 'target' => '_self', 'icon' => 'icon-menu8', 'title' => 'Navigation'])
@Limitless::NavigationMenuItem(['url' => '?page=randomselect', 'target' => '_self', 'icon' => 'icon-shuffle', 'title' => 'Random Select'])
@Limitless::NavigationMenuItem(['url' => '?page=table', 'target' => '_self', 'icon' => 'icon-table2', 'title' => 'Table']) @Limitless::NavigationMenuItem(['url' => '?page=table', 'target' => '_self', 'icon' => 'icon-table2', 'title' => 'Table'])
@Limitless::NavigationStop @Limitless::NavigationStop
@stop @stop
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment