better collection handlich in backend
This commit is contained in:
parent
324eacf061
commit
50bcae442e
|
@ -92,13 +92,12 @@ class HomeController extends Controller
|
|||
/**
|
||||
* show page by $page_slug.
|
||||
*/
|
||||
public function showPage($slug)
|
||||
public function showPage($slug): View
|
||||
{
|
||||
// $result = $pages->findBySlug($slug);
|
||||
if (!is_null(Page::query()->wherePage_slug($slug)->firstOrFail())) {
|
||||
$result = Page::query()->wherePage_slug($slug)->firstOrFail();
|
||||
return view('frontend.pages.index')
|
||||
->withpage($result);
|
||||
if (!is_null(Page::query()->where('page_slug', $slug)->firstOrFail())) {
|
||||
$result = Page::query()->where('page_slug', $slug)->firstOrFail();
|
||||
return view('frontend.pages.index')->withpage($result);
|
||||
} else {
|
||||
throw new GeneralException(trans('exceptions.backend.access.pages.not_found'));
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ use Illuminate\Http\Request;
|
|||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Collection;
|
||||
use App\Models\CollectionRole;
|
||||
use App\Http\Requests\Collection\CollectionRequest;
|
||||
|
||||
class CollectionController extends Controller
|
||||
{
|
||||
|
@ -52,12 +54,17 @@ class CollectionController extends Controller
|
|||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @param Collection $collection
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
public function show(Collection $collection)
|
||||
{
|
||||
//
|
||||
$collection = Collection::findOrFail($collection->id);
|
||||
//get child collections
|
||||
$collections = $collection
|
||||
->children()
|
||||
->paginate(10);
|
||||
return view('settings.collection.collection', compact('collections'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +75,9 @@ class CollectionController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
$collection = Collection::findOrFail($id);
|
||||
$collectionroles = CollectionRole::pluck('name', 'id');
|
||||
return view('settings.collection.edit', compact('collection', 'collectionroles'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,9 +87,20 @@ class CollectionController extends Controller
|
|||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(CollectionRequest $request, $id)
|
||||
{
|
||||
//
|
||||
$collection = Collection::findOrFail($id);
|
||||
$input = $request->all();
|
||||
//$input = $request->except('licenses', 'titles');
|
||||
$collection->update($input);
|
||||
session()->flash('flash_message', 'You have updated the collection "' . $collection->name . '"!');
|
||||
if ($collection->parent()->exists()) {
|
||||
return redirect()->route('settings.collection.show', $collection->parent);
|
||||
} else {
|
||||
$test = $collection->collectionrole;
|
||||
return redirect()->route('settings.collectionrole.show', $collection->collectionrole);
|
||||
}
|
||||
//return redirect()->route('settings.collectionrole.index');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
148
app/Http/Controllers/Settings/CollectionRoleController.php
Normal file
148
app/Http/Controllers/Settings/CollectionRoleController.php
Normal file
|
@ -0,0 +1,148 @@
|
|||
<?php
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CollectionRole;
|
||||
use App\Models\Collection;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class CollectionRoleController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//$collections = Collection::take(10)->get();
|
||||
//$collections = Collection::get();
|
||||
$collectionroles = CollectionRole::query() //with('collections')
|
||||
->with(['collections' => function ($query) {
|
||||
$query->whereNull('parent_id');
|
||||
}])
|
||||
->get();
|
||||
return view('settings.collectionrole.index', compact('collectionroles'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param CollectionRole $collectionrole
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(CollectionRole $collectionrole)
|
||||
{
|
||||
$collectionrole = CollectionRole::findOrFail($collectionrole->id);
|
||||
//$collections = Collection::query()
|
||||
$collections = $collectionrole
|
||||
->collections()
|
||||
->whereNull('parent_id')
|
||||
// ->where('role_id', '=', $id)
|
||||
->paginate(10);
|
||||
return view('settings.collectionrole.show', compact('collections'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$collectionrole = CollectionRole::findOrFail($id);
|
||||
return view('settings.collectionrole.edit', compact('collectionrole'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$project = CollectionRole::findOrFail($id);
|
||||
$input = $request->all();
|
||||
$project->update($input);
|
||||
session()->flash('flash_message', 'You have updated the collection role!');
|
||||
return redirect()->route('settings.collectionrole.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* deactivate author, submitter etc....
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function hide($id): RedirectResponse
|
||||
{
|
||||
$collectionrole = CollectionRole::findOrFail($id);
|
||||
$collectionrole->update(['visible' => 0]);
|
||||
session()->flash(
|
||||
'flash_message',
|
||||
'Visibility of collection role "' . $collectionrole->name . '" has changed successfully.'
|
||||
);
|
||||
return redirect()->route('settings.collectionrole.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* activatew author, submitter etc....
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function up($id): RedirectResponse
|
||||
{
|
||||
// $dateNow = time();
|
||||
$collectionrole = CollectionRole::findOrFail($id);
|
||||
$collectionrole->update(['visible' => 1]);
|
||||
session()->flash(
|
||||
'flash_message',
|
||||
'Visibility of collection role "' . $collectionrole->name . '" has changed successfully.'
|
||||
);
|
||||
return redirect()->route('settings.collectionrole.index');
|
||||
}
|
||||
}
|
34
app/Http/Requests/Collection/CollectionRequest.php
Normal file
34
app/Http/Requests/Collection/CollectionRequest.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests\Collection;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
/**
|
||||
* Class UpdatePageRequest.
|
||||
*/
|
||||
class CollectionRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;//return access()->allow('edit-page');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|max:255',
|
||||
'role_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ class PersonRequest extends Request
|
|||
return [
|
||||
'academic_title' => 'nullable|min:2|max:255',
|
||||
'last_name' => 'required|min:3|max:255',
|
||||
'first_name' => 'nullable|min:3|max:255',
|
||||
'first_name' => 'required|min:3|max:255',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'identifier_orcid' => 'nullable|min:19|max:50',
|
||||
'status' => 'required|boolean'
|
||||
|
|
|
@ -25,8 +25,8 @@ class ProjectRequest extends Request
|
|||
return [
|
||||
|
||||
'name' => 'required|min:3|max:255',
|
||||
'label' => 'required|min:3|max:10'
|
||||
|
||||
'label' => 'required|min:3|max:10',
|
||||
'description' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,34 @@ use App\Models\Dataset;
|
|||
|
||||
class Collection extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'role_id',
|
||||
];
|
||||
|
||||
public function documents()
|
||||
{
|
||||
return $this->belongsToMany(Dataset::class, 'link_documents_collections', 'collection_id', 'document_id');
|
||||
}
|
||||
|
||||
#region self join
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(self::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(self::class, 'parent_id');
|
||||
}
|
||||
#endregion
|
||||
|
||||
/**
|
||||
* Get the collection role that the dataset belongs to.
|
||||
*/
|
||||
public function collectionrole()
|
||||
{
|
||||
return $this->belongsTo(CollectionRole::class, 'role_id', 'id');
|
||||
}
|
||||
}
|
||||
|
|
29
app/Models/CollectionRole.php
Normal file
29
app/Models/CollectionRole.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Collection;
|
||||
use App\Models\Dataset;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CollectionRole extends Model
|
||||
{
|
||||
protected $table = 'collections_roles';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'oai_name',
|
||||
'visible',
|
||||
];
|
||||
|
||||
// public function documents()
|
||||
// {
|
||||
// return $this->belongsToMany(Dataset::class, 'link_documents_collections', 'role_id', 'document_id');
|
||||
// }
|
||||
|
||||
public function collections()
|
||||
{
|
||||
//model, foreign key on the Collection model is role_id, local id of this is id
|
||||
return $this->hasMany(Collection::class, 'role_id', 'id');
|
||||
}
|
||||
}
|
|
@ -62,6 +62,12 @@ class Dataset extends Model
|
|||
->belongsToMany(Collection::class, 'link_documents_collections', 'document_id', 'collection_id');
|
||||
}
|
||||
|
||||
// public function collectionRoles()
|
||||
// {
|
||||
// return $this
|
||||
// ->belongsToMany(CollectionRole::class, 'link_documents_collections', 'document_id', 'role_id');
|
||||
// }
|
||||
|
||||
#region [person table]
|
||||
|
||||
//return all persons attached to this film
|
||||
|
|
|
@ -12,7 +12,7 @@ class Project extends Model
|
|||
// for using $input = $request->all();
|
||||
//$project = Project::create($input);
|
||||
protected $fillable = [
|
||||
'name', 'label'
|
||||
'name', 'label', 'description'
|
||||
];
|
||||
|
||||
|
||||
|
|
42
composer.lock
generated
42
composer.lock
generated
|
@ -854,26 +854,26 @@
|
|||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "1.0.46",
|
||||
"version": "1.0.47",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem.git",
|
||||
"reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2"
|
||||
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2",
|
||||
"reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a11e4a75f256bdacf99d20780ce42d3b8272975c",
|
||||
"reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"conflict": {
|
||||
"league/flysystem-sftp": "<1.0.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-fileinfo": "*",
|
||||
"phpspec/phpspec": "^3.4",
|
||||
"phpunit/phpunit": "^5.7.10"
|
||||
},
|
||||
|
@ -934,7 +934,7 @@
|
|||
"sftp",
|
||||
"storage"
|
||||
],
|
||||
"time": "2018-08-22T07:45:22+00:00"
|
||||
"time": "2018-09-14T15:30:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
|
@ -1060,16 +1060,16 @@
|
|||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "1.33.0",
|
||||
"version": "1.34.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "55667c1007a99e82030874b1bb14d24d07108413"
|
||||
"reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413",
|
||||
"reference": "55667c1007a99e82030874b1bb14d24d07108413",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
|
||||
"reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1111,20 +1111,20 @@
|
|||
"datetime",
|
||||
"time"
|
||||
],
|
||||
"time": "2018-08-07T08:39:47+00:00"
|
||||
"time": "2018-09-20T19:36:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/php-parser",
|
||||
"version": "v4.0.3",
|
||||
"version": "v4.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nikic/PHP-Parser.git",
|
||||
"reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d"
|
||||
"reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d",
|
||||
"reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d",
|
||||
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fa6ee28600d21d49b2b4e1006b48426cec8e579c",
|
||||
"reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1162,7 +1162,7 @@
|
|||
"parser",
|
||||
"php"
|
||||
],
|
||||
"time": "2018-07-15T17:25:16+00:00"
|
||||
"time": "2018-09-18T07:03:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
|
@ -4169,16 +4169,16 @@
|
|||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.3.1",
|
||||
"version": "3.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||
"reference": "628a481780561150481a9ec74709092b9759b3ec"
|
||||
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/628a481780561150481a9ec74709092b9759b3ec",
|
||||
"reference": "628a481780561150481a9ec74709092b9759b3ec",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e",
|
||||
"reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -4216,7 +4216,7 @@
|
|||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2018-07-26T23:47:18+00:00"
|
||||
"time": "2018-09-23T23:08:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "theseer/tokenizer",
|
||||
|
|
2
public/backend/style.css
vendored
2
public/backend/style.css
vendored
|
@ -475,7 +475,7 @@ a:hover { text-decoration: none; }*/
|
|||
/*table { width: 100%; margin: 2em 0; }*/
|
||||
.pure-table a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.pure-table a:hover {
|
||||
|
|
|
@ -17,7 +17,6 @@ window.Vue = require('vue');
|
|||
|
||||
Vue.component('my-vuetable', require('./components/MyVuetable.vue'));
|
||||
|
||||
|
||||
const app = new Vue({
|
||||
el: '#app'
|
||||
});
|
|
@ -1,5 +1,4 @@
|
|||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="pure-g">
|
||||
<div class="pure-u-1 pure-u-md-2-3">
|
||||
|
@ -13,9 +12,9 @@
|
|||
<?php endforeach; ?>
|
||||
</span>
|
||||
|
||||
|
||||
<div class="posts">
|
||||
<ol><?php foreach ($documents as $document) : ?>
|
||||
<ol>
|
||||
<?php foreach ($documents as $document) : ?>
|
||||
<li>
|
||||
<section class="post">
|
||||
<header class="post-header">
|
||||
|
@ -24,14 +23,14 @@
|
|||
</a>
|
||||
</h2>
|
||||
</header>
|
||||
<div class="blog-meta"><?= $document->server_date_published->toDayDateTimeString() ?>
|
||||
<div class="blog-meta">
|
||||
<?= $document->server_date_published->toDayDateTimeString() ?>
|
||||
</div>
|
||||
<div class="post-description">
|
||||
@foreach ($document->authors as $author)
|
||||
<em>Author: {{ $author->getFullName() }}</em>
|
||||
<em>Author: {{ $author->full_name }}</em>
|
||||
<br />
|
||||
@endforeach
|
||||
|
||||
@foreach ($document->titles as $title)
|
||||
<em>Main Title: {{ $title->value }}</em>
|
||||
<br />
|
||||
|
@ -39,12 +38,13 @@
|
|||
</div>
|
||||
|
||||
</section>
|
||||
</li><?php endforeach; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
|
@ -11,16 +11,16 @@
|
|||
<div class="pure-g box-content">
|
||||
|
||||
<div class="pure-u-1 pure-u-md-3-3">
|
||||
<a href="{{ route('settings.project.add') }}" class="pure-button button-small is-primary">
|
||||
<i class="fa fa-plus-circle"></i>ADD NEW COLLECTION
|
||||
<a href="{{ route('settings.collection.create') }}" class="pure-button button-small is-primary">
|
||||
<i class="fa fa-plus-circle"></i>ADD NEW CHILD COLLECTION
|
||||
</a>
|
||||
<br><br>
|
||||
|
||||
<table class="pure-table pure-table-horizontal">
|
||||
|
||||
<thead>
|
||||
<th>Collection</th>
|
||||
<th>id</th>
|
||||
<th>Collection (number of child collections)</th>
|
||||
<th>Collection Role</th>
|
||||
<th>Document id's</th>
|
||||
<th>Options</th>
|
||||
</thead>
|
||||
|
@ -30,8 +30,13 @@
|
|||
@foreach($collections as $collection)
|
||||
|
||||
<tr>
|
||||
<td>{{ $collection->name }}</td>
|
||||
<td>{{ $collection->id }}</td>
|
||||
<td>
|
||||
<a class="show" href="{{ route('settings.collection.show', $collection) }}">
|
||||
{{-- <span">{{ $collection->name }}</span> --}}
|
||||
<span">{{ $collection->name .' ('. $collection->children->count() .')' }}</span>
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ $collection->collectionrole->name }}</td>
|
||||
<td>
|
||||
@foreach ($collection->documents as $document)
|
||||
<p>document id: {{ $document->id }}</p>
|
||||
|
@ -39,12 +44,8 @@
|
|||
|
||||
</td>
|
||||
<td>
|
||||
<a class="edit" href="{{ route('settings.collection.edit', $collection->id) }}"><span aria-hidden="true"></span></a>
|
||||
<a class="delete" href="{{ route('settings.collection.delete', $collection->id) }}"><span aria-hidden="true"></span></a>
|
||||
|
||||
|
||||
|
||||
|
||||
<a class="edit" href="{{ route('settings.collection.edit', $collection->id) }}"><span aria-hidden="true">edit collection</span></a>
|
||||
{{-- <a class="delete" href="{{ route('settings.collection.delete', $collection->id) }}"><span aria-hidden="true"></span></a> --}}
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
44
resources/views/settings/collection/edit.blade.php
Normal file
44
resources/views/settings/collection/edit.blade.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
@extends('settings.layouts.app')
|
||||
@section('content')
|
||||
<div class="header">
|
||||
<h3 class="header-title">
|
||||
Edit Collection "{{ $collection->name }}"
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-content">
|
||||
@if($collection->parent()->exists())
|
||||
<a href="{{ route('settings.collection.show', $collection->parent) }}" class="pure-button button-small">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
<span>BACK</span>
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ route('settings.collectionrole.show', $collection->collectionrole) }}" class="pure-button button-small">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
<span>BACK</span>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
{!! Form::model($collection, ['method' => 'PATCH', 'route' => ['settings.collection.update', $collection->id], 'class' =>
|
||||
'pure-form pure-form-aligned']) !!}
|
||||
<fieldset>
|
||||
<div class="pure-control-group">
|
||||
{{ Form::label('name', 'collection name') }} {{ Form::text('name', null, ['class' => 'form-control']) }}
|
||||
<em>*</em>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group pure-div">
|
||||
{!! Form::label('role_id', 'Collection Role..') !!}
|
||||
{!! Form::select('role_id', $collectionroles, null, ['id' => 'role_id', 'placeholder' => '-- no role selected --']) !!}
|
||||
|
||||
<em>*</em>
|
||||
</div>
|
||||
|
||||
{{ Form::submit("Submit", ['class' => 'pure-button button-small']) }}
|
||||
</fieldset>
|
||||
@include('errors._errors')
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
46
resources/views/settings/collectionrole/edit.blade.php
Normal file
46
resources/views/settings/collectionrole/edit.blade.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
@extends('settings.layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="header">
|
||||
<h3 class="header-title">
|
||||
Edit Collection Role
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="box-content">
|
||||
<a href="{{ route('settings.collectionrole.index') }}" class="pure-button button-small">
|
||||
<i class="fa fa-chevron-left"></i>
|
||||
<span>BACK</span>
|
||||
</a>
|
||||
<div>
|
||||
{!! Form::model($collectionrole, ['method' => 'PATCH', 'route' => ['settings.collectionrole.update', $collectionrole->id], 'class' => 'pure-form pure-form-aligned']) !!}
|
||||
<fieldset>
|
||||
|
||||
<div class="pure-control-group">
|
||||
{{ Form::label('name', 'collectionrole name') }}
|
||||
{{ Form::text('name', null, ['class' => 'form-control']) }}
|
||||
<em>*</em>
|
||||
</div>
|
||||
<div class="pure-control-group">
|
||||
{{ Form::label('oai_name', 'name of oai set') }}
|
||||
{{ Form::text('oai_name', null, ['class' => 'form-control']) }}
|
||||
<em>*</em>
|
||||
</div>
|
||||
<!-- checkboxes -->
|
||||
<label for="active" class="pure-checkbox">
|
||||
<input type="hidden" name="visible" value="0">
|
||||
<input name="visible" value="1" {{ ($collectionrole->visible == 1) ? 'checked="checked" ' : '' }} type="checkbox" class="form-check-input">
|
||||
Visible?
|
||||
</label>
|
||||
<label for="active" class="pure-checkbox">
|
||||
<input type="hidden" name="visible_oai" value="0">
|
||||
<input name="visible_oai" value="1" {{ ($collectionrole->visible_oai == 1) ? 'checked="checked" ' : '' }} type="checkbox" class="form-check-input">
|
||||
Use collection as OAI set
|
||||
</label>
|
||||
|
||||
{{ Form::submit("Submit", ['class' => 'pure-button button-small']) }}
|
||||
</fieldset>
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
67
resources/views/settings/collectionrole/index.blade.php
Normal file
67
resources/views/settings/collectionrole/index.blade.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
@extends('settings.layouts.app')
|
||||
@section('content')
|
||||
<div class="header">
|
||||
<h3 class="header-title">
|
||||
<i class="fa fa-archive"></i> Collection Roles
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pure-g box-content">
|
||||
|
||||
<div class="pure-u-1 pure-u-md-3-3">
|
||||
{{-- <a href="{{ route('settings.collectionrole.create') }}" class="pure-button button-small is-primary">
|
||||
<i class="fa fa-plus-circle"></i>ADD NEW COLLECTION ROLE
|
||||
</a> --}}
|
||||
<br><br>
|
||||
|
||||
<table class="pure-table pure-table-horizontal">
|
||||
|
||||
<thead>
|
||||
<th>Collection</th>
|
||||
<th>Count Of Nested Collections</th>
|
||||
<th>Options</th>
|
||||
<th>Visible</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach($collectionroles as $collectionrole)
|
||||
<tr>
|
||||
<td>
|
||||
<a class="show" href="{{ route('settings.collectionrole.show', $collectionrole) }}">
|
||||
<span">{{ $collectionrole->name .' ('. $collectionrole->collections->count() .')' }}</span>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{-- @foreach ($collection->documents as $document)
|
||||
<p>document id: {{ $document->id }}</p>
|
||||
@endforeach --}}
|
||||
{{ $collectionrole->collections->count() }}
|
||||
{{-- <a href="" class="pure-button button-small is-success">Show Collections</a> --}}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<a class="edit" href="{{ route('settings.collectionrole.edit', $collectionrole->id) }}"><span aria-hidden="true">Edit</span></a>
|
||||
{{-- <a class="delete" href="{{ route('settings.collection.delete', $collection->id) }}"><span aria-hidden="true"></span></a> --}}
|
||||
</td>
|
||||
<td>
|
||||
@if($collectionrole->visible == 1)
|
||||
<a href="{{ route('settings.collectionrole.hide', $collectionrole->id) }}" class="pure-button button-small is-warning">Hide</a>
|
||||
@else
|
||||
<a href="{{ route('settings.collectionrole.up', $collectionrole->id) }}" class="pure-button button-small is-success">Unhide</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1 pure-u-md-3-3">
|
||||
{{-- {{ $collectionroles->links('vendor.pagination.default') }} --}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@stop
|
65
resources/views/settings/collectionrole/show.blade.php
Normal file
65
resources/views/settings/collectionrole/show.blade.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
@extends('settings.layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="header">
|
||||
<h3 class="header-title">
|
||||
<i class="fa fa-archive"></i> Top Level Collections
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pure-g box-content">
|
||||
|
||||
<div class="pure-u-1 pure-u-md-3-3">
|
||||
{{-- <a href="{{ route('settings.collection.create') }}" class="pure-button button-small is-primary">
|
||||
<i class="fa fa-plus-circle"></i>ADD NEW COLLECTION
|
||||
</a> --}}
|
||||
<br><br>
|
||||
|
||||
<table class="pure-table pure-table-horizontal">
|
||||
|
||||
<thead>
|
||||
<th>Collection (number of child collections)</th>
|
||||
<th>Collection Role</th>
|
||||
<th>Document id's</th>
|
||||
<th>Options</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
@foreach($collections as $collection)
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a class="show" href="{{ route('settings.collection.show', $collection) }}">
|
||||
{{-- <span">{{ $collection->name }}</span> --}}
|
||||
<span">{{ $collection->name .' ('. $collection->children->count() .')' }}</span>
|
||||
</a>
|
||||
</td>
|
||||
<td>{{ $collection->collectionrole->name }}</td>
|
||||
<td>
|
||||
@foreach ($collection->documents as $document)
|
||||
<p>document id: {{ $document->id }}</p>
|
||||
@endforeach
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<a class="edit" href="{{ route('settings.collection.edit', $collection->id) }}"><span aria-hidden="true">edit collection</span></a>
|
||||
{{-- <a class="delete" href="{{ route('settings.collection.delete', $collection->id) }}"><span aria-hidden="true"></span></a> --}}
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pure-u-1 pure-u-md-3-3">
|
||||
{{ $collections->links('vendor.pagination.default') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@stop
|
|
@ -53,8 +53,11 @@
|
|||
<li class="pure-menu-item {{ Route::is('settings.document*') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ route('settings.document') }}"><i class="fa fa-database"></i> Datasets</a>
|
||||
</li>
|
||||
<li class="pure-menu-item {{ Route::is('settings.collection*') ? 'active' : '' }}">
|
||||
{{-- <li class="pure-menu-item {{ Route::is('settings.collection*') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ route('settings.collection') }}"><i class="fa fa-archive"></i> Collections</a>
|
||||
</li> --}}
|
||||
<li class="pure-menu-item {{ Route::is('settings.collectionrole') ? 'active' : '' }}">
|
||||
<a class="pure-menu-link" href="{{ route('settings.collectionrole.index') }}"><i class="fa fa-archive"></i> Collection Roles</a>
|
||||
</li>
|
||||
<li class="pure-menu-item {{ Route::is('settings.license*') ? 'active' : '' }}">
|
||||
<a href="{{ route('settings.license') }}" class="pure-menu-link"><i class="fa fa-file"></i> Licenses</a>
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
<div class="pure-control-group" ">
|
||||
{!! Form::label('first_name', 'First Name..') !!}
|
||||
{!! Form::text('first_name', null, ['class' => 'form-control']) !!}
|
||||
<aside id="firstNameHelp" class="pure-form-message-inline">first name is optional.</aside>
|
||||
<em>*</em>
|
||||
{{-- <aside id="firstNameHelp" class="pure-form-message-inline">first name is optional.</aside> --}}
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
{{ Form::text('label', null, ['class' => 'form-control']) }}
|
||||
<em>*</em>
|
||||
</div>
|
||||
<div class="pure-control-group">
|
||||
{{ Form::label('description', 'description') }}
|
||||
{{ Form::textarea('description', null, ['class' => 'form-control', 'size' => '70x6']) }}
|
||||
<em>*</em>
|
||||
</div>
|
||||
{{ Form::submit($submitButtonText, ['class' => 'pure-button button-small']) }}
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -56,3 +56,34 @@ Breadcrumbs::register('settings.page.index', function ($breadcrumbs) {
|
|||
$breadcrumbs->parent('settings.dashboard');
|
||||
$breadcrumbs->push('Page Management', route('settings.page.index'));
|
||||
});
|
||||
|
||||
|
||||
Breadcrumbs::register('settings.collectionrole.index', function ($breadcrumbs) {
|
||||
$breadcrumbs->parent('settings.dashboard');
|
||||
$breadcrumbs->push('Collection Roles', route('settings.collectionrole.index'));
|
||||
});
|
||||
Breadcrumbs::register('settings.collectionrole.show', function ($breadcrumbs, $collectionrole) {
|
||||
$breadcrumbs->parent('settings.collectionrole.index');
|
||||
$breadcrumbs->push(
|
||||
'top level collections of role ' . $collectionrole->name,
|
||||
route('settings.collectionrole.show', $collectionrole)
|
||||
);
|
||||
});
|
||||
Breadcrumbs::register('settings.collection.show', function ($breadcrumbs, $collection) {
|
||||
// $breadcrumbs->parent('settings.collectionrole.show', $collection->collectionrole);
|
||||
if ($collection->parent()->exists()) {
|
||||
$breadcrumbs->parent('settings.collection.show', $collection->parent);
|
||||
} else {
|
||||
$breadcrumbs->parent('settings.collectionrole.show', $collection->collectionrole);
|
||||
}
|
||||
$breadcrumbs->push('show collection: ' . $collection->name, route('settings.collection.show', $collection));
|
||||
});
|
||||
Breadcrumbs::register('settings.collection.edit', function ($breadcrumbs, $id) {
|
||||
$collection = App\Models\Collection::findOrFail($id);
|
||||
if ($collection->parent()->exists()) {
|
||||
$breadcrumbs->parent('settings.collection.show', $collection->parent);
|
||||
} else {
|
||||
$breadcrumbs->parent('settings.collectionrole.show', $collection->collectionrole);
|
||||
}
|
||||
$breadcrumbs->push('edit collection: ' . $collection->name, route('settings.collection.edit', $id));
|
||||
});
|
||||
|
|
|
@ -121,17 +121,49 @@ Route::group(['middleware' => ['permission:settings']], function () {
|
|||
]);
|
||||
//=================================================setting collection=============================================
|
||||
Route::get('/settings/collection', [
|
||||
'as' => 'settings.collection', 'uses' => 'Settings\CollectionController@index',
|
||||
'as' => 'settings.collection.index', 'uses' => 'Settings\CollectionController@index',
|
||||
]);
|
||||
|
||||
Route::get('/settings/collection/create', [
|
||||
'as' => 'settings.collection.create', 'uses' => 'Settings\CollectionController@create',
|
||||
]);
|
||||
Route::post('settings/collection/store', [
|
||||
'as' => 'settings.collection.store', 'uses' => 'Settings\CollectionController@store',
|
||||
]);
|
||||
|
||||
Route::get('settings/collection/edit/{id}', [
|
||||
'as' => 'settings.collection.edit', 'uses' => 'Settings\CollectionController@edit',
|
||||
]);
|
||||
Route::patch('settings/collection/edit/{id}', [
|
||||
'as' => 'settings.collection.update', 'uses' => 'Settings\CollectionController@update',
|
||||
]);
|
||||
Route::get('settings/collection/show/{collection}', [
|
||||
'as' => 'settings.collection.show', 'uses' => 'Settings\CollectionController@show',
|
||||
]);
|
||||
Route::get('settings/collection/delete/{id}', [
|
||||
'as' => 'settings.collection.delete', 'uses' => 'Settings\CollectionController@delete',
|
||||
]);
|
||||
//=================================================setting collection_role=========================================
|
||||
Route::get('/settings/collectionrole', [
|
||||
'as' => 'settings.collectionrole.index', 'uses' => 'Settings\CollectionRoleController@index',
|
||||
]);
|
||||
|
||||
Route::get('settings/collectionrole/edit/{id}', [
|
||||
'as' => 'settings.collectionrole.edit', 'uses' => 'Settings\CollectionRoleController@edit',
|
||||
]);
|
||||
Route::patch('settings/collectionrole/update/{id}', [
|
||||
'as' => 'settings.collectionrole.update', 'uses' => 'Settings\CollectionRoleController@update',
|
||||
]);
|
||||
Route::get('settings/collectionrole/show/{collectionrole}', [
|
||||
'as' => 'settings.collectionrole.show', 'uses' => 'Settings\CollectionRoleController@show',
|
||||
]);
|
||||
Route::get('settings/collectionrole/hide/{id}', [
|
||||
'as' => 'settings.collectionrole.hide', 'uses' => 'Settings\CollectionRoleController@hide',
|
||||
]);
|
||||
Route::get('settings/collectionrole/up/{id}', [
|
||||
'as' => 'settings.collectionrole.up', 'uses' => 'Settings\CollectionRoleController@up',
|
||||
]);
|
||||
|
||||
//==================================================================================================================
|
||||
//=================================================setting project==================================================
|
||||
Route::get('/settings/project', [
|
||||
|
|
Loading…
Reference in New Issue
Block a user