Skip to content

Commit 368a25b

Browse files
author
bnu
committed
Merge branch 'release/1.0.8'
2 parents 5d4000c + b972c63 commit 368a25b

28 files changed

Lines changed: 793 additions & 82 deletions

assets/js/BoardTags.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/src/BoardTags.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ window.jQuery(function ($) {
1717
tag: '',
1818
tags: [],
1919
autocompleteItems: [],
20-
searchItem: null
20+
searchItem: null,
21+
addOnKey: [13, 44],
22+
separators: [',' ]
2123
}
2224
},
2325

components/Skins/Board/Blog/views/index.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{!! uio('uiobject/board@select', [
3939
'name' => 'order_type',
4040
'label' => xe_trans('xe::order'),
41-
'value' => Request::get('order_type'),
41+
'value' => Request::get('order_type', $config->get('orderType')),
4242
'items' => $handler->getOrders(),
4343
]) !!}
4444
</div>
@@ -122,7 +122,7 @@
122122
</div>
123123
</form>
124124
<form method="get" class="__xe_search" action="{{ $urlHandler->get('index') }}">
125-
<input type="hidden" name="order_type" value="{{ Request::get('order_type') }}" />
125+
<input type="hidden" name="order_type" value="{{ Request::get('order_type', $config->get('orderType')) }}" />
126126
<div class="bd_search_detail">
127127
<div class="bd_search_detail_option">
128128
<div class="xe-row">

components/Skins/Board/Common/views/index.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{!! uio('uiobject/board@select', [
3838
'name' => 'order_type',
3939
'label' => xe_trans('xe::order'),
40-
'value' => Request::get('order_type'),
40+
'value' => Request::get('order_type', $config->get('orderType')),
4141
'items' => $handler->getOrders(),
4242
]) !!}
4343
</div>
@@ -121,7 +121,7 @@
121121
</div>
122122
</form>
123123
<form method="get" class="__xe_search" action="{{ $urlHandler->get('index') }}">
124-
<input type="hidden" name="order_type" value="{{ Request::get('order_type') }}" />
124+
<input type="hidden" name="order_type" value="{{ Request::get('order_type', $config->get('orderType')) }}" />
125125
<div class="bd_search_detail">
126126
<div class="bd_search_detail_option">
127127
<div class="xe-row">

components/Skins/Board/Gallery/views/index.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
{!! uio('uiobject/board@select', [
4040
'name' => 'order_type',
4141
'label' => xe_trans('xe::order'),
42-
'value' => Request::get('order_type'),
42+
'value' => Request::get('order_type', $config->get('orderType')),
4343
'items' => $handler->getOrders(),
4444
]) !!}
4545
</div>
@@ -123,7 +123,7 @@
123123
</div>
124124
</form>
125125
<form method="get" class="__xe_search" action="{{ $urlHandler->get('index') }}">
126-
<input type="hidden" name="order_type" value="{{ Request::get('order_type') }}" />
126+
<input type="hidden" name="order_type" value="{{ Request::get('order_type', $config->get('orderType')) }}" />
127127
<div class="bd_search_detail">
128128
<div class="bd_search_detail_option">
129129
<div class="xe-row">

components/UIObjects/DesignSelect/DesignSelectUIObject.php

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ public function render()
8282
$args['value'] = '';
8383
$args['text'] = '';
8484
} else {
85-
foreach ($args['items'] as $item) {
86-
if ($item['value'] == $args['value']) {
87-
$args['text'] = $item['text'];
88-
}
85+
$selectedItem = self::getSelectedItem($args['items'], $args['value']);
86+
if ($selectedItem) {
87+
$args['text'] = $selectedItem['text'];
88+
} else {
89+
$args['value'] = '';
90+
$args['text'] = '';
8991
}
9092
}
9193

@@ -98,4 +100,57 @@ public function render()
98100

99101
return View::make('board::components/UIObjects/DesignSelect/designSelect', $args)->render();
100102
}
103+
104+
private static function getSelectedItem ($items, $selectedValue)
105+
{
106+
foreach($items as $item) {
107+
if ($item['value'] == $selectedValue) {
108+
return [
109+
'value' => $item['value'],
110+
'text' => $item['text']
111+
];
112+
}
113+
114+
if (self::hasChildren($item)) {
115+
$selectedItem = self::getSelectedItem(self::getChildren($item), $selectedValue);
116+
if ($selectedItem) {
117+
return $selectedItem;
118+
}
119+
}
120+
}
121+
122+
return false;
123+
}
124+
125+
/**
126+
* @param array $item
127+
* @return boolean
128+
*/
129+
public static function hasChildren ($item)
130+
{
131+
return array_has($item, 'children');
132+
}
133+
134+
/**
135+
* @param array $item
136+
* @return array
137+
*/
138+
public static function getChildren ($item)
139+
{
140+
if (array_has($item, 'children')) {
141+
return array_get($item, 'children');
142+
}
143+
144+
return [];
145+
}
146+
147+
public static function renderList ($items, $value = null)
148+
{
149+
$args = [
150+
'items' => $items,
151+
'selectedItemValue' => $value
152+
];
153+
154+
return View::make('board::components/UIObjects/DesignSelect/designSelectItem', $args)->render();
155+
}
101156
}

components/UIObjects/DesignSelect/designSelect.blade.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
@php
2+
use Xpressengine\Plugins\Board\Components\UIObjects\DesignSelect\DesignSelectUIObject;
3+
@endphp
4+
15
@if($scriptInit === true)
26
<script>
37
jQuery(function($) {
4-
$('.__xe-dropdown-form .xe-dropdown-menu a').on('click touchstart', function(event) {
8+
$('.__xe-dropdown-form .xe-dropdown-menu a').on('click', function(event) {
59
event.preventDefault();
610
var $target = $(event.target),
711
$container = $target.closest('.__xe-dropdown-form'),
@@ -17,14 +21,13 @@
1721
});
1822
</script>
1923
@endif
20-
2124
<div class="xe-dropdown __xe-dropdown-form">
2225
<input type="hidden" name="{{ $name }}" value="{{ $value }}" data-valid-name="{{ xe_trans($label) }}" />
2326
<button class="xe-btn" type="button" data-toggle="xe-dropdown" aria-expanded="false">{{ $value != $default ? xe_trans($text) : xe_trans($label) }}</button>
2427
<ul class="xe-dropdown-menu" data-name="{{ $name }}">
25-
<li @if($value == (string)$default) class="on" @endif><a href="#">{{ xe_trans($label) }}</a></li>
26-
@foreach ($items as $item)
27-
<li @if($value == (string)$item['value']) class="on" @endif><a href="#" data-value="{{$item['value']}}">{{xe_trans($item['text'])}}</a></li>
28-
@endforeach
28+
<li @if($value == (string)$default) class="on" @endif>
29+
<a href="#">{{ xe_trans($label) }}</a>
30+
{!! DesignSelectUIObject::renderList($items, $value) !!}
31+
</li>
2932
</ul>
3033
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@php
2+
use Xpressengine\Plugins\Board\Components\UIObjects\DesignSelect\DesignSelectUIObject;
3+
@endphp
4+
5+
@if(isset($items) && is_array($items) && count($items))
6+
<ul class="xe-dropdown-menu__sub">
7+
@foreach ($items as $item)
8+
<li @if($selectedItemValue == (string)$item['value']) class="on" @endif>
9+
<a href="#" data-value="{{$item['value']}}">{{ xe_trans($item['text']) }}</a>
10+
@if (DesignSelectUIObject::hasChildren($item))
11+
{!! DesignSelectUIObject::renderList(DesignSelectUIObject::getChildren($item), $selectedItemValue) !!}
12+
@endif
13+
</li>
14+
@endforeach
15+
</ul>
16+
@endif

components/Widgets/ArticleList/ArticleListWidget.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ public function render()
7474

7575
//상위카테고리는 하위카테고리를 포함해야함
7676
$categoryIds = array_map(function ($item) {
77-
return CategoryItem::find(mb_substr($item, 9))->getDescendantTree(true)->getNodes()->pluck('id');
77+
$item = CategoryItem::find(mb_substr($item, 9));
78+
if ($item === null) {
79+
return [];
80+
}
81+
82+
return $item->getDescendantTree(true)->getNodes()->pluck('id');
7883
}, $categoryIds);
7984

8085
$categoryIds = array_flatten($categoryIds);
@@ -129,10 +134,19 @@ public function render()
129134
sprintf('%s.%s', 'board_gallery_thumbs', 'target_id')
130135
);
131136

132-
if (isset($widgetConfig['noticeInList']) === true && $widgetConfig['noticeInList'] == 'on') {
133-
$query = $query->visibleWithNotice();
134-
} else {
135-
$query = $query->visible();
137+
switch (array_get($widgetConfig, 'noticeInList', array_get($widgetConfig, 'notice_type', 'withOutNotice'))) {
138+
case 'onlyNotice':
139+
$query->notice();
140+
break;
141+
142+
case 'on':
143+
case 'withNotice':
144+
$query->visibleWithNotice();
145+
break;
146+
147+
default:
148+
$query->visible();
149+
break;
136150
}
137151

138152
//$recent_date
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
namespace Xpressengine\Plugins\Board\Components\Widgets\ArticleList\Skins\Basic;
3+
4+
use Xpressengine\Skin\GenericSkin;
5+
use View;
6+
use Xpressengine\Plugins\Board\Components\Widgets\ArticleList\Skins\Gallery\GallerySkin;
7+
8+
class BasicCardSkin extends GallerySkin
9+
{
10+
/**
11+
* @var string
12+
*/
13+
protected static $path = 'board/components/Widgets/ArticleList/Skins/Basic';
14+
15+
public static function view($view)
16+
{
17+
$dir = static::$viewDir ? '.' . static::$viewDir : '';
18+
$view = str_replace('/', '.', static::$path) . "$dir.widget-card";
19+
return $view;
20+
}
21+
22+
public static function info($key = null, $default = null)
23+
{
24+
if (static::$info === null) {
25+
static::$info = include(base_path(static::getPath().'/'.'info-card.php'));
26+
}
27+
28+
if ($key !== null) {
29+
return array_get(static::$info, $key, $default);
30+
}
31+
return static::$info;
32+
}
33+
}

0 commit comments

Comments
 (0)