Skip to content

Commit

Permalink
- fix default template link
Browse files Browse the repository at this point in the history
- update navigation
- fix permissions
  • Loading branch information
butschster committed May 23, 2016
1 parent a2f9bfe commit 70241ed
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 48 deletions.
6 changes: 3 additions & 3 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

Route::group(['prefix' => backend_url_segment(), 'as' => 'backend.', 'middleware' => ['web']], function () {
Route::group(['prefix' => backend_url_segment(), 'as' => 'backend.', 'middleware' => ['web', 'backend.auth']], function () {
Route::get('snippets', ['as' => 'snippet.list', 'uses' => 'SnippetController@getIndex']);
Route::get('snippet/create', ['as' => 'snippet.create', 'uses' => 'SnippetController@getCreate']);
Route::post('snippet/create', ['as' => 'snippet.create.post', 'uses' => 'SnippetController@postCreate']);
Expand All @@ -15,13 +15,13 @@
Route::post('widget/{id}/edit', ['as' => 'widget.edit.post', 'uses' => 'WidgetController@postEdit']);
Route::get('widget/create/{type?}', ['as' => 'widget.create', 'uses' => 'WidgetController@getCreate']);
Route::post('widget/create', ['as' => 'widget.create.post', 'uses' => 'WidgetController@postCreate']);
Route::get('widget/{id/}template', ['as' => 'widget.template', 'uses' => 'WidgetController@getCreate']);
Route::get('widget/{id}/template', ['as' => 'widget.template', 'uses' => 'WidgetController@getTemplate']);
Route::post('widget/{id}/delete', ['as' => 'widget.delete', 'uses' => 'WidgetController@postDelete']);
Route::get('widget/popup/{id}', ['as' => 'widget.popup_list', 'uses' => 'WidgetController@getPopupList']);
Route::get('widget/{type}', ['as' => 'widget.list.by_type', 'uses' => 'WidgetController@getIndex']);
});

Route::group(['as' => 'api.', 'middleware' => ['web', 'api']], function () {
Route::group(['as' => 'api.', 'middleware' => ['web', 'api', 'backend.auth']], function () {
RouteAPI::put('widget', ['as' => 'widget.place', 'uses' => 'API\WidgetController@putPlace']);
RouteAPI::post('widget.set.template', [
'as' => 'widget.set.template',
Expand Down
6 changes: 2 additions & 4 deletions src/Providers/EventsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

use PackageManager;
use KodiCMS\Pages\Helpers\Block;
use KodiCMS\Users\Model\UserRole;
use KodiCMS\Users\Model\Role;
use KodiCMS\Widgets\Model\Widget;
use KodiCMS\Widgets\Manager\WidgetManager;
use KodiCMS\Widgets\Model\SnippetCollection;
use KodiCMS\Widgets\Contracts\WidgetPaginator;
use KodiCMS\Widgets\Collection\PageWidgetCollection;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as BaseEventServiceProvider;
use KodiCMS\Widgets\Observers\WidgetObserver;
use KodiCMS\Widgets\Manager\WidgetManagerDatabase;
use Request;
use KodiCMS\Pages\Model\Page;

Expand Down Expand Up @@ -74,7 +72,7 @@ public function boot(DispatcherContract $events)
}

if (acl_check('widgets.roles') and ! $widget->isHandler()) {
$usersRoles = UserRole::lists('name', 'id')->all();
$usersRoles = Role::pluck('name', 'id')->all();
echo view('widgets::widgets.partials.permissions', compact('widget', 'usersRoles'))->render();
}
});
Expand Down
26 changes: 26 additions & 0 deletions src/Providers/ModuleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public function boot()
$this->app->alias('widget.manager', WidgetManager::class);

$this->app['view']->addNamespace('snippets', snippets_path());

$this->registerNavigation();
}

public function register()
Expand All @@ -26,4 +28,28 @@ public function register()
EventsServiceProvider::class,
]);
}

private function registerNavigation()
{
if ($navigation = \Navigation::getPages()->findById('design')) {
$navigation->setFromArray([
[
'id' => 'snippets',
'title' => 'widgets::snippet.title.list',
'url' => route('backend.snippet.list'),
'permissions' => 'snippet.index',
'priority' => 200,
'icon' => 'cutlery',
],
[
'id' => 'widgets',
'title' => 'widgets::core.title.list',
'url' => route('backend.widget.list'),
'permissions' => 'widgets.index',
'priority' => 300,
'icon' => 'cubes',
],
]);
}
}
}
25 changes: 0 additions & 25 deletions src/config/sitemap.php

This file was deleted.

5 changes: 2 additions & 3 deletions src/resources/views/snippet/snippet_select.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@section('scripts')
@parent
@push('scripts')
<script type="text/javascript">
$(function() {
var editSnippetUrl = '{{ route('backend.snippet.edit', ['***']) }}';
Expand Down Expand Up @@ -31,7 +30,7 @@ function update_snippets_list(e, response) {
.change();
}
</script>
@stop
@endpush

<?php
if (empty($templates))
Expand Down
4 changes: 3 additions & 1 deletion src/resources/views/widgets/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
</td>
<td class="template">
@if ($widget->isRenderable())
<span class="editable-template label label-info" data-value="{{ $widget->template or null }}">{{ $widget->template }}</span>
<span class="editable-template label label-info" data-value="{{ $widget->template or null }}">
{{ $widget->template }}
</span>
@endif
</td>
<td class="cache">
Expand Down
8 changes: 3 additions & 5 deletions src/resources/views/widgets/page/iframe.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
@section('page-content')
@parent

@push('page-content')
<div class="panel-heading">
<span class="panel-title" data-icon="cubes">
@lang('widgets::core.title.list') <span class="text-muted">[{{ $page->getLayout() }}]</span>
</h4>
</span>
</div>
<div class="panel-body no-padding panel-body-page-widgets">
<iframe src="{{ route('backend.pages.wysiwyg', [$page]) }}" style="width:100%;height:500px;border:none;"></iframe>
</div>
@endsection
@endpush
12 changes: 5 additions & 7 deletions src/resources/views/widgets/page/list.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
@section('page-content')
@parent

@push('page-content')
<div class="panel-heading panel-toggler" data-hotkeys="shift+w">
<span class="panel-title" data-icon="cubes">@lang('widgets::core.title.list')</h4>
<span class="panel-title" data-icon="cubes">@lang('widgets::core.title.list')</span>
</div>
<div class="panel-body panel-spoiler">
@if (is_null($page->id))
Expand Down Expand Up @@ -45,8 +43,8 @@
</table>
@endif
</div>
@stop
@endpush

@section('scripts')
@push('scripts')
<script src="/backend/cms/js/WidgetController.js"></script>
@stop
@endpush

0 comments on commit 70241ed

Please sign in to comment.