Minor code clean

This commit is contained in:
Sam Georges 2014-10-18 15:52:44 +11:00
parent 8ee28b214d
commit ed552f1591
5 changed files with 25 additions and 33 deletions

View File

@ -1,13 +0,0 @@
/*
* Filter Behavior
*
* Data attributes:
* - data-behavior="filter" - enables the filter plugin
*
* JavaScript API:
* $('a#someLink').filterBehavior()
*
* Dependences:
* - October Popover (october.popover.js)
*/

View File

@ -9,8 +9,8 @@
// <tr>
// <th class="list-checkbox">
// <div class="checkbox custom-checkbox nolabel">
// <input type="checkbox" id="checkbox_0" />
// <label for="checkbox_0"></label>
// <input type="checkbox" id="checkboxAll" />
// <label for="checkboxAll"></label>
// </div>
// </th>
// <th class="sort-desc"><a href="/">Title</a></th>
@ -26,7 +26,8 @@
// <tr>
// <td class="list-checkbox nolink">
// <div class="checkbox custom-checkbox nolabel">
// <input id="checkbox_1" type="checkbox" /><label for="checkbox_1"></label>
// <input id="checkbox_1" type="checkbox" />
// <label for="checkbox_1">Check</label>
// </div>
// </td>
// <td><a href="/">Welcome to October</a></td>

View File

@ -122,7 +122,7 @@ class Index extends Controller
return [
'tabTitle' => $this->getTabTitle($type, $template),
'tab' => $this->makePartial('form_page', [
'tab' => $this->makePartial('form_page', [
'form' => $widget,
'templateType' => $type,
'templateTheme' => $this->theme->getDirName(),

View File

@ -46,7 +46,7 @@ class TemplateList extends WidgetBase
/**
* @var string Message to display when there are no records in the list.
*/
public $noRecordsMessage = 'No records found';
public $noRecordsMessage = 'No records found';
/**
* @var string Message to display when the Delete button is clicked.
@ -216,13 +216,13 @@ class TemplateList extends WidgetBase
}
$result = [
'title' => $this->getItemTitle($item),
'fileName' => $item->getFileName(),
'description' => $description,
'title' => $this->getItemTitle($item),
'fileName' => $item->getFileName(),
'description' => $description,
'descriptions' => $descriptions
];
return (object)$result;
return (object) $result;
}
protected function getItemTitle($item)
@ -270,16 +270,19 @@ class TemplateList extends WidgetBase
if (strlen($item->title)) {
if (Str::contains(Str::lower($item->title), $word))
return true;
} else
if (Str::contains(Str::lower($item->fileName), $word))
return true;
if (Str::contains(Str::lower($item->description), $word) && strlen($item->description))
}
else if (Str::contains(Str::lower($item->fileName), $word)) {
return true;
}
foreach ($item->descriptions as $value)
if (Str::contains(Str::lower($item->description), $word) && strlen($item->description)) {
return true;
}
foreach ($item->descriptions as $value) {
if (Str::contains(Str::lower($value), $word) && strlen($value))
return true;
}
return false;
}

View File

@ -8,14 +8,15 @@
<?= $this->makePartial('items', ['items'=>$item->items, 'nested'=>true]) ?>
</li>
<?php endif ?>
<?php else:
<?php else: ?>
<?php
$dataId = $this->itemType.'-'.$this->theme->getDirName().'-'.$item->fileName;
?>
<li class="item" data-item-path="<?= e($item->fileName) ?>" data-item-theme="<?= e($this->theme->getDirName()) ?>" data-item-type="<?= $this->itemType ?>" data-id="<?= e($dataId) ?>">
<a href="#">
<span class="title"><?= e($item->title) ?></span>
<span class="description">
<?php foreach ($item->descriptions as $title=>$value): ?>
<?php foreach ($item->descriptions as $title => $value): ?>
<?php if (strlen($value)): ?>
<?= e($title) ?>: <strong><?= e($value) ?></strong>
<?php endif ?>
@ -29,11 +30,11 @@
<input type="hidden" name="template[<?= e($item->fileName) ?>]" value="0"/>
<div class="checkbox custom-checkbox nolabel">
<?php $cbId = 'cb'.md5($item->fileName) ?>
<input
<input
id="<?= $cbId ?>"
type="checkbox"
name="template[<?= e($item->fileName) ?>]"
<?= $this->isTemplateSelected($item) ? 'checked' : null ?>
name="template[<?= e($item->fileName) ?>]"
<?= $this->isTemplateSelected($item) ? 'checked' : null ?>
data-request="<?= $this->getEventHandler('onSelect') ?>"
value="1">
<label for="<?= $cbId ?>">Select</label>