-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4728cd3
commit 0d6d8d3
Showing
8 changed files
with
418 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace Xpressengine\Plugins\Board\Components\Widgets\Searching; | ||
|
||
use View; | ||
use Illuminate\Support\Arr; | ||
use Xpressengine\Menu\Models\MenuItem; | ||
use Xpressengine\Plugin\SupportInfoTrait;; | ||
use Xpressengine\Plugins\Board\ConfigHandler; | ||
use Xpressengine\Plugins\Board\UrlHandler; | ||
use Xpressengine\Widget\AbstractWidget; | ||
|
||
class SearchingWidget extends AbstractWidget | ||
{ | ||
use SupportInfoTrait; | ||
|
||
protected static $path = 'board/components/Widgets/Searching'; | ||
|
||
/** | ||
* 그려줄 내용 반환. | ||
* | ||
* @return string | ||
*/ | ||
public function render() | ||
{ | ||
/** @var UrlHandler $urlHandler */ | ||
$urlHandler = app(UrlHandler::class); | ||
$widgetConfig = $this->setting(); | ||
$boardId = Arr::get($widgetConfig, 'board_id'); | ||
$boardMenuItem = MenuItem::where('type', 'board@board')->findOrFail($boardId); | ||
$boardConfig = ConfigHandler::make()->get($boardMenuItem->id); | ||
|
||
return $this->renderSkin([ | ||
'urlHandler' => $urlHandler, | ||
'widgetConfig' => $widgetConfig, | ||
'boardMenuItem' => $boardMenuItem, | ||
'boardConfig' => $boardConfig | ||
]); | ||
} | ||
|
||
/** | ||
* render settings | ||
* | ||
* @param array $args | ||
* @return string | ||
*/ | ||
public function renderSetting(array $args = []): string | ||
{ | ||
$boards = $this->getBoards(); | ||
|
||
return View::make('board::components.Widgets.Searching.views.settings', [ | ||
'args' => $args, | ||
'boards' => $boards | ||
]); | ||
} | ||
|
||
/** | ||
* get boards | ||
* | ||
* @return array | ||
*/ | ||
protected function getBoards(): array | ||
{ | ||
return MenuItem::where('type', 'board@board') | ||
->where('activated', true) | ||
->get() | ||
->map(function(MenuItem $menuItem) { | ||
return [ | ||
'id' => $menuItem->id, | ||
'text' => $menuItem->title, | ||
]; | ||
}) | ||
->toArray(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
components/Widgets/Searching/Skins/Basic/BasicSearchingSkin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Xpressengine\Plugins\Board\Components\Widgets\Searching\Skins\Basic; | ||
|
||
use Xpressengine\Skin\GenericSkin; | ||
|
||
class BasicSearchingSkin extends GenericSkin | ||
{ | ||
protected static $path = 'board/components/Widgets/Searching/Skins/Basic'; | ||
|
||
public function render() | ||
{ | ||
return parent::render(); // TODO: Change the autogenerated stub | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
components/Widgets/Searching/Skins/Basic/assets/css/skin.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
body { | ||
padding-top: 20px; | ||
padding-bottom: 20px; | ||
} | ||
|
||
.header, | ||
.footer { | ||
padding-right: 15px; | ||
padding-left: 15px; | ||
} | ||
|
||
.header { | ||
padding-bottom: 20px; | ||
margin-bottom: 30px; | ||
border-bottom: 1px solid #e5e5e5; | ||
} | ||
|
||
.header h3 { | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
line-height: 40px; | ||
font-size: 24px; | ||
} | ||
|
||
.footer { | ||
padding-top: 19px; | ||
color: #777; | ||
border-top: 1px solid #e5e5e5; | ||
} | ||
|
||
.spot { | ||
text-align: center; | ||
color: inherit; | ||
padding: 48px 30px; | ||
border-radius: 6px; | ||
border-bottom: 1px solid #e5e5e5; | ||
margin-bottom: 30px; | ||
background-color: #eee; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
return [ | ||
'setting' => [], | ||
'support' => [ | ||
'mobile' => true, | ||
'desktop' => true | ||
] | ||
]; |
3 changes: 3 additions & 0 deletions
3
components/Widgets/Searching/Skins/Basic/views/widget.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{-- implement it!! --}} | ||
{{--{{ dd($widgetConfig) }}--}} | ||
{{--{{ dd($moreUrl) }}--}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
return [ | ||
'setting' => [ | ||
'sample_text2' => [ | ||
'_type' => 'text', | ||
'_section' => '기본설정', | ||
'label' => '샘플 문구', | ||
'placeholder' => '샘플용 설정 필드입니다.', | ||
'description' => '샘플용 설정 필드입니다.', | ||
], | ||
] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="form-group"> | ||
<label>게시판 선택</label> | ||
<select name="board_id" class="form-control"> | ||
@foreach ($boards as $board) | ||
<option value="{{ $board['id'] }}" @if(in_array($board['id'], (array)(\Illuminate\Support\Arr::get($args, 'board_id')))) selected="selected" @endif>{{ xe_trans($board['text']) }}</option> | ||
@endforeach | ||
</select> | ||
</div> |
Oops, something went wrong.