edit static pages in backend

This commit is contained in:
Arno Kaimbacher 2018-09-06 17:58:54 +02:00
parent e771c4921f
commit 783ac823ba
59 changed files with 1644 additions and 761 deletions

View File

@ -0,0 +1,26 @@
<?php
namespace App\Events\Pages;
use Illuminate\Queue\SerializesModels;
/**
* Class PageUpdated.
*/
class PageUpdated
{
use SerializesModels;
/**
* @var
*/
public $page;
/**
* @param $page
*/
public function __construct($page)
{
$this->page = $page;
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Exceptions;
use Exception;
/**
* Class GeneralException.
*/
class GeneralException extends Exception
{
}

View File

@ -1,9 +1,13 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
use App\Exceptions\GeneralException;
use App\Models\Page;
class HomeController extends Controller class HomeController extends Controller
{ {
/** /**
@ -40,7 +44,7 @@ class HomeController extends Controller
// } // }
// } // }
return view('rdr.home.index'); return view('frontend.home.index');
} }
/** /**
@ -50,7 +54,7 @@ class HomeController extends Controller
*/ */
public function contact(): View public function contact(): View
{ {
return view('rdr.home.contact'); return view('frontend.home.contact');
} }
/** /**
@ -60,7 +64,7 @@ class HomeController extends Controller
*/ */
public function imprint(): View public function imprint(): View
{ {
return view('rdr.home.imprint'); return view('frontend.home.imprint');
} }
/** /**
@ -70,7 +74,7 @@ class HomeController extends Controller
*/ */
public function about(): View public function about(): View
{ {
return view('rdr.home.about'); return view('frontend.home.about');
} }
/** /**
@ -80,6 +84,21 @@ class HomeController extends Controller
*/ */
public function news(): View public function news(): View
{ {
return view('rdr.home.news'); return view('frontend.home.news');
}
/**
* show page by $page_slug.
*/
public function showPage($slug)
{
// $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);
} else {
throw new GeneralException(trans('exceptions.backend.access.pages.not_found'));
}
} }
} }

View File

@ -1,13 +1,8 @@
<?php <?php
namespace App\Http\Controllers\Frontend;
namespace App\Http\Controllers; use App\Http\Controllers\Controller;
use App\Dataset; use App\Dataset;
use App\Book;
use App\Category;
use App\Shelf;
use App\Periode;
use App\Student;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\View\View; use Illuminate\View\View;
@ -19,11 +14,11 @@ class PagesController extends Controller
// $this->middleware('auth'); // $this->middleware('auth');
} }
public function documents() : View public function datasets() : View
{ {
// $books = Book::with('category', 'shelf')->orderByTitle()->get(); // $books = Book::with('category', 'shelf')->orderByTitle()->get();
$documents = Dataset::orderByType()->get(); $documents = Dataset::orderByType()->get();
return view('rdr.document.documents', compact('documents')); return view('frontend.dataset.dataset', compact('documents'));
} }
/** /**
@ -37,6 +32,6 @@ class PagesController extends Controller
$document = Dataset::findOrFail($id); $document = Dataset::findOrFail($id);
$document->load('titles'); $document->load('titles');
$document->load('abstracts'); $document->load('abstracts');
return view('rdr.document.show', compact('document')); return view('frontend.dataset.show', compact('document'));
} }
} }

View File

@ -1,9 +1,9 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Frontend;
use Illuminate\Support\Facades\DB; use App\Http\Controllers\Controller;
use App\Dataset; use App\Dataset;
use Illuminate\Http\Request; use Illuminate\Support\Facades\DB;
class SitelinkController extends Controller class SitelinkController extends Controller
{ {
@ -21,7 +21,7 @@ class SitelinkController extends Controller
$this->years = $select->pluck('published_date'); $this->years = $select->pluck('published_date');
$this->ids = array(); $this->ids = array();
return view('rdr.sitelink.index')->with(['years'=> $this->years,'documents'=> $this->ids]); return view('frontend.sitelink.index')->with(['years' => $this->years, 'documents' => $this->ids]);
} }
public function list($year) public function list($year)
@ -40,7 +40,6 @@ class SitelinkController extends Controller
->whereYear('server_date_published', '>=', $from) ->whereYear('server_date_published', '>=', $from)
->whereYear('server_date_published', '<', $until); ->whereYear('server_date_published', '<', $until);
$documents = $select $documents = $select
->get(); ->get();
@ -51,11 +50,11 @@ class SitelinkController extends Controller
// return $item->year !== $year; // return $item->year !== $year;
//}); //});
//$select->select('id'); //$select->select('id');
//$this->ids = $select->pluck('id'); //$this->ids = $select->pluck('id');
//return view('rdr.sitelink.index')->with(['years'=> $this->years,'ids'=> $this->ids]); //return view('rdr.sitelink.index')->with(['years'=> $this->years,'ids'=> $this->ids]);
return view('rdr.sitelink.index')->with(['years'=> $this->years,'documents'=> $documents]); return view('frontend.sitelink.index')
->with(['years' => $this->years, 'documents' => $documents]);
} }
} }
} }

View File

@ -316,7 +316,7 @@ class RequestController extends Controller
*/ */
private function _addLandingPageAttribute(\DOMNode $document, $dataid) private function _addLandingPageAttribute(\DOMNode $document, $dataid)
{ {
$url = route('document.show', $dataid); $url = route('frontend.dataset.show', $dataid);
$owner = $document->ownerDocument; $owner = $document->ownerDocument;
$attr = $owner->createAttribute('landingpage'); $attr = $owner->createAttribute('landingpage');

View File

@ -6,17 +6,27 @@ use App\Models\Page;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\Pages\IndexPageRequest; use App\Http\Requests\Pages\IndexPageRequest;
use App\Http\Requests\Pages\UpdatePageRequest;
use Illuminate\View\View;
use Illuminate\Http\RedirectResponse;
use App\Exceptions\GeneralException;
use App\Events\Pages\PageUpdated;
class PageController extends Controller class PageController extends Controller
{ {
/**
* Associated Repository Model.
*/
const MODEL = Page::class;
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function index(IndexPageRequest $request) public function index(IndexPageRequest $request): View
{ {
return new view('settings.pages.index'); return view('settings.page.index');
} }
/** /**
@ -59,19 +69,34 @@ class PageController extends Controller
*/ */
public function edit(Page $page) public function edit(Page $page)
{ {
// return view('settings.page.edit')
->withPage($page);
} }
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param @param \App\Http\Requests\Pages\UpdatePageRequest $request
* @param \App\Models\Page $page * @param \App\Models\Page $page
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, Page $page) public function update(UpdatePageRequest $request, Page $page) : RedirectResponse
{ {
// // $this->pages->update($page, $request->except(['_method', '_token']));
$input = $request->except(['_method', '_token']);
// Making extra fields
$input['page_slug'] = str_slug($input['title']);
$input['status'] = isset($input['status']) ? 1 : 0;
$input['updated_by'] = \Auth::user()->id;
if ($page->update($input)) {
event(new PageUpdated($page));
return redirect()
->route('settings.page.index')
->with('flash_message', trans('alerts.backend.pages.updated'));
}
throw new GeneralException(trans('exceptions.backend.pages.update_error'));
} }
/** /**
@ -84,4 +109,9 @@ class PageController extends Controller
{ {
// //
} }
public function query()
{
return call_user_func(static::MODEL.'::query');
}
} }

View File

@ -0,0 +1,46 @@
<?php
namespace App\Http\Controllers\Settings;
use App\Models\Page;
use App\Http\Controllers\Controller;
// use App\Http\Requests\Backend\Pages\ManagePageRequest;
use App\Http\Requests\Pages\IndexPageRequest;
// use App\Repositories\Backend\Pages\PagesRepository;
use Yajra\DataTables\Facades\DataTables;
/**
* Class PagesTableController.
*/
class PagesTableController extends Controller
{
protected $pages;
public function __construct() //(PagesRepository $pages)
{
//$this->pages = factory(Page::class, 2)->make();
$this->pages = Page::get();
}
public function get()
{
$test = Datatables::of($this->pages)
->escapeColumns(['title'])
->addColumn('status', function ($page) {
return $page->status;
})
->addColumn('created_at', function ($page) {
return $page->created_at->toDateString();
})
->addColumn('created_by', function ($page) {
return $page->created_by;
})
->addColumn('actions', function ($page) {
return $page->action_buttons;
})
->make(true);
return $test;
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class StaticPageController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function imprint()
{
////$books = Book::available()->orderByTitle()->lists('title', 'id');
//$persons = Person::active()->orderByName()->pluck('last_name', 'id');
////$categories = Category::lists('category', 'id');
//$categories = Project::get();
//return view('rdr.borrow.borrow', compact('persons', 'categories'));
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Http\Requests\Pages;
use App\Http\Requests\Request;
/**
* Class EditPageRequest.
*/
class EditPageRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
true;//return access()->allow('edit-page');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\Pages;
use App\Http\Requests\Request;
/**
* Class UpdatePageRequest.
*/
class UpdatePageRequest 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 [
'title' => 'required|max:191',
'description' => 'required',
];
}
}

View File

@ -1,25 +0,0 @@
<?php
use App\Dataset;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
// Route::get('/api/dropdown/peminjaman/{id}', [
// 'as' => 'api.dropdown.peminjaman', 'uses' => 'PeminjamanController@dropdown'
// ]);
Route::get('/api/dropdown/borrow/{id}', function ($id) {
if (Request::ajax()) {
//$category_id = Input::get('category_id');
// $books = Book::available()->orderByTitle()->where('category_id', '=', $id)->get();
$books = Dataset::OrderByType()->where('project_id', '=', $id)->get();
return Response::json($books);
}
});

View File

@ -2,6 +2,8 @@
namespace App\Models; namespace App\Models;
use Illuminate\Support\Facades\Auth;
trait ModelTrait trait ModelTrait
{ {
/** /**
@ -9,7 +11,7 @@ trait ModelTrait
*/ */
public function getEditButtonAttribute($permission, $route) public function getEditButtonAttribute($permission, $route)
{ {
if (access()->allow($permission)) { if (Auth::user()->can($permission)) {
return '<a href="'.route($route, $this).'" class="btn btn-flat btn-default"> return '<a href="'.route($route, $this).'" class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="Edit" class="fa fa-pencil"></i> <i data-toggle="tooltip" data-placement="top" title="Edit" class="fa fa-pencil"></i>
</a>'; </a>';
@ -21,7 +23,7 @@ trait ModelTrait
*/ */
public function getDeleteButtonAttribute($permission, $route) public function getDeleteButtonAttribute($permission, $route)
{ {
if (access()->allow($permission)) { if (Auth::user()->can($permission)) {
return '<a href="'.route($route, $this).'" return '<a href="'.route($route, $this).'"
class="btn btn-flat btn-default" data-method="delete" class="btn btn-flat btn-default" data-method="delete"
data-trans-button-cancel="'.trans('buttons.general.cancel').'" data-trans-button-cancel="'.trans('buttons.general.cancel').'"

View File

@ -4,9 +4,11 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use App\User; use App\User;
use App\Models\ModelTrait;
class Page extends Model class Page extends Model
{ {
use ModelTrait;
/** /**
* The database table used by the model. * The database table used by the model.
* *
@ -43,6 +45,40 @@ class Page extends Model
return $this->belongsTo(User::class, 'created_by'); return $this->belongsTo(User::class, 'created_by');
} }
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute('page', 'settings.page.edit').'
'.$this->getViewButtonAttribute().'
'.$this->getDeleteButtonAttribute('page', 'settings.page.destroy').'
</div>';
}
/**
* @return string
*/
public function getViewButtonAttribute()
{
return '<a target="_blank" href="'. route('frontend.pages.show', $this->page_slug) .'" class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="View Page" class="fa fa-eye"></i>
</a>';
}
/**
* @return string
*/
public function getStatusLabelAttribute()
{
if ($this->isActive()) {
return "<label class='label label-success'>".trans('labels.general.active').'</label>';
}
return "<label class='label label-danger'>".trans('labels.general.inactive').'</label>';
}
/** /**
* @return bool * @return bool
*/ */

View File

@ -16,16 +16,19 @@
"laravel/tinker": "~1.0", "laravel/tinker": "~1.0",
"laravelcollective/html": "^5.5.0", "laravelcollective/html": "^5.5.0",
"solarium/solarium": "^3.8", "solarium/solarium": "^3.8",
"yajra/laravel-datatables-oracle": "^8.8",
"zizaco/entrust": "^1.9" "zizaco/entrust": "^1.9"
}, },
"require-dev": { "require-dev": {
"fzaninotto/faker": "^1.8",
"phpunit/phpunit": "~6.0", "phpunit/phpunit": "~6.0",
"squizlabs/php_codesniffer": "^3.3" "squizlabs/php_codesniffer": "^3.3"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [
"database/seeds", "database/seeds",
"database/factories" "database/factories",
"database"
], ],
"psr-4": { "psr-4": {
"App\\": "app/" "App\\": "app/"

143
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "12d5d5d5edbaf033404b80e81076f7fb", "content-hash": "45de841e5697551ae24e4065b9afb6c4",
"packages": [ "packages": [
{ {
"name": "davejamesmiller/laravel-breadcrumbs", "name": "davejamesmiller/laravel-breadcrumbs",
@ -531,16 +531,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v5.5.42", "version": "v5.5.43",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "6550ae917b0c49a5915a52cd7c7eafd16fc0b538" "reference": "84f4ed02ec6eb4a56629fb6acbee1df56891e3c7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/6550ae917b0c49a5915a52cd7c7eafd16fc0b538", "url": "https://api.github.com/repos/laravel/framework/zipball/84f4ed02ec6eb4a56629fb6acbee1df56891e3c7",
"reference": "6550ae917b0c49a5915a52cd7c7eafd16fc0b538", "reference": "84f4ed02ec6eb4a56629fb6acbee1df56891e3c7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -661,7 +661,7 @@
"framework", "framework",
"laravel" "laravel"
], ],
"time": "2018-08-08T18:22:44+00:00" "time": "2018-09-02T11:45:05+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -1297,16 +1297,16 @@
}, },
{ {
"name": "psy/psysh", "name": "psy/psysh",
"version": "v0.9.7", "version": "v0.9.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/bobthecow/psysh.git", "url": "https://github.com/bobthecow/psysh.git",
"reference": "4f5b6c090948773a8bfeea6a0f07ab7d0b24e932" "reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/4f5b6c090948773a8bfeea6a0f07ab7d0b24e932", "url": "https://api.github.com/repos/bobthecow/psysh/zipball/ed3c32c4304e1a678a6e0f9dc11dd2d927d89555",
"reference": "4f5b6c090948773a8bfeea6a0f07ab7d0b24e932", "reference": "ed3c32c4304e1a678a6e0f9dc11dd2d927d89555",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1367,7 +1367,7 @@
"interactive", "interactive",
"shell" "shell"
], ],
"time": "2018-08-11T15:54:43+00:00" "time": "2018-09-05T11:40:09+00:00"
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",
@ -2538,6 +2538,77 @@
], ],
"time": "2018-07-29T20:33:41+00:00" "time": "2018-07-29T20:33:41+00:00"
}, },
{
"name": "yajra/laravel-datatables-oracle",
"version": "v8.8.0",
"source": {
"type": "git",
"url": "https://github.com/yajra/laravel-datatables.git",
"reference": "f2959bf773fc315e1b3319fb0a34c880b97706d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/f2959bf773fc315e1b3319fb0a34c880b97706d5",
"reference": "f2959bf773fc315e1b3319fb0a34c880b97706d5",
"shasum": ""
},
"require": {
"illuminate/database": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/filesystem": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/http": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/support": "5.4.*|5.5.*|5.6.*|5.7.*",
"illuminate/view": "5.4.*|5.5.*|5.6.*|5.7.*",
"php": ">=7.0"
},
"require-dev": {
"orchestra/testbench": "~3.5"
},
"suggest": {
"yajra/laravel-datatables-buttons": "Plugin for server-side exporting of dataTables.",
"yajra/laravel-datatables-editor": "Plugin to use DataTables Editor (requires a license).",
"yajra/laravel-datatables-fractal": "Plugin for server-side response using Fractal.",
"yajra/laravel-datatables-html": "Plugin for server-side HTML builder of dataTables."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "8.0-dev"
},
"laravel": {
"providers": [
"Yajra\\DataTables\\DataTablesServiceProvider"
],
"aliases": {
"DataTables": "Yajra\\DataTables\\Facades\\DataTables"
}
}
},
"autoload": {
"psr-4": {
"Yajra\\DataTables\\": "src/"
},
"files": [
"src/helper.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Arjay Angeles",
"email": "aqangeles@gmail.com"
}
],
"description": "jQuery DataTables API for Laravel 4|5",
"keywords": [
"datatables",
"jquery",
"laravel"
],
"time": "2018-09-05T05:43:38+00:00"
},
{ {
"name": "zizaco/entrust", "name": "zizaco/entrust",
"version": "1.9.1", "version": "1.9.1",
@ -2672,6 +2743,56 @@
], ],
"time": "2017-07-22T11:58:36+00:00" "time": "2017-07-22T11:58:36+00:00"
}, },
{
"name": "fzaninotto/faker",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/fzaninotto/Faker.git",
"reference": "f72816b43e74063c8b10357394b6bba8cb1c10de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de",
"reference": "f72816b43e74063c8b10357394b6bba8cb1c10de",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"ext-intl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7",
"squizlabs/php_codesniffer": "^1.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
"Faker\\": "src/Faker/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "François Zaninotto"
}
],
"description": "Faker is a PHP library that generates fake data for you.",
"keywords": [
"data",
"faker",
"fixtures"
],
"time": "2018-07-12T10:23:15+00:00"
},
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.8.1", "version": "1.8.1",

View File

@ -170,6 +170,7 @@ return [
// 'Illuminate\Html\HtmlServiceProvider', // 'Illuminate\Html\HtmlServiceProvider',
// 'Collective\Html\HtmlServiceProvider', // 'Collective\Html\HtmlServiceProvider',
Zizaco\Entrust\EntrustServiceProvider::class, Zizaco\Entrust\EntrustServiceProvider::class,
Yajra\DataTables\DataTablesServiceProvider::class,
/* /*
* Application Service Providers... * Application Service Providers...
@ -179,7 +180,6 @@ return [
'App\Providers\ConfigServiceProvider', 'App\Providers\ConfigServiceProvider',
'App\Providers\EventServiceProvider', 'App\Providers\EventServiceProvider',
'App\Providers\RouteServiceProvider', 'App\Providers\RouteServiceProvider',
// List off others providers... // List off others providers...
App\Providers\SolariumServiceProvider::class, App\Providers\SolariumServiceProvider::class,
@ -240,6 +240,7 @@ return [
// 'Form' => 'Collective\Html\FormFacade', // 'Form' => 'Collective\Html\FormFacade',
// 'Html' => 'Collective\Html\HtmlFacade', // 'Html' => 'Collective\Html\HtmlFacade',
'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facade::class, 'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facade::class,
//'Datatables' => Yajra\DataTables\Facades\DataTables::class
], ],

View File

@ -0,0 +1,79 @@
<?php
namespace Database;
use Illuminate\Support\Facades\DB;
/**
* Class DisablesForeignKeys.
*/
trait DisableForeignKeys
{
/**
* @var array
*/
private $commands = [
'mysql' => [
'enable' => 'SET FOREIGN_KEY_CHECKS=1;',
'disable' => 'SET FOREIGN_KEY_CHECKS=0;',
],
'sqlite' => [
'enable' => 'PRAGMA foreign_keys = ON;',
'disable' => 'PRAGMA foreign_keys = OFF;',
],
'sqlsrv' => [
'enable' => 'EXEC sp_msforeachtable @command1="print \'?\'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all";',
'disable' => 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";',
],
'pgsql' => [
'enable' => 'SET CONSTRAINTS ALL IMMEDIATE;',
'disable' => 'SET CONSTRAINTS ALL DEFERRED;',
],
];
/**
* Disable foreign key checks for current db driver.
*/
protected function disableForeignKeys()
{
DB::statement($this->getDisableStatement());
}
/**
* Enable foreign key checks for current db driver.
*/
protected function enableForeignKeys()
{
DB::statement($this->getEnableStatement());
}
/**
* Return current driver enable command.
*
* @return mixed
*/
private function getEnableStatement()
{
return $this->getDriverCommands()['enable'];
}
/**
* Return current driver disable command.
*
* @return mixed
*/
private function getDisableStatement()
{
return $this->getDriverCommands()['disable'];
}
/**
* Returns command array for current db driver.
*
* @return mixed
*/
private function getDriverCommands()
{
return $this->commands[DB::getDriverName()];
}
}

View File

@ -0,0 +1,22 @@
<?php
use App\Models\Access\User\User;
use App\Models\Page;
use Faker\Generator as Faker;
$factory->define(Page::class, function (Faker $faker) {
$title = $faker->sentence;
// $newestPage = Page::orderBy('id', 'desc')->first();
return [
'title' => $title,
'page_slug' => str_slug($title),
'description' => $faker->paragraph,
'cannonical_link' => 'http://localhost/'.str_slug($title),
'created_by' => 1,
'status' => 1,
'created_at' => Carbon\Carbon::now(),
'updated_at' => Carbon\Carbon::now(),
];
});

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pages', function (Blueprint $table) {
$table->increments('id');
$table->string('title', 191);
$table->string('page_slug', 191)->unique();
$table->text('description', 65535)->nullable();
$table->string('cannonical_link', 191)->nullable();
$table->string('seo_title', 191)->nullable();
$table->string('seo_keyword', 191)->nullable();
$table->text('seo_description', 65535)->nullable();
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pages');
}
}

View File

@ -1,10 +1,9 @@
<?php <?php
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class DatabaseSeeder extends Seeder {
class DatabaseSeeder extends Seeder
{
/** /**
* Run the database seeds. * Run the database seeds.
* *
@ -30,11 +29,10 @@ class DatabaseSeeder extends Seeder {
$this->call('DocumentTableSeeder'); $this->call('DocumentTableSeeder');
$this->command->info('User table seeded!'); $this->command->info('User table seeded!');
} }
} }
class UserTableSeeder extends Seeder { class UserTableSeeder extends Seeder
{
public function run() public function run()
{ {
// DB::table('users')->delete(); // DB::table('users')->delete();
@ -48,21 +46,19 @@ class UserTableSeeder extends Seeder {
[ [
'name' => "user1", 'name' => "user1",
'email' => "user1" . '@gmail.com', 'email' => "user1" . '@gmail.com',
'password' => bcrypt('secret') 'password' => bcrypt('secret'),
], ],
[ [
'name' => "admin", 'name' => "admin",
'email' => 'arno.kaimbacher@hotmail.de', 'email' => 'arno.kaimbacher@hotmail.de',
'password' => bcrypt('admin007') 'password' => bcrypt('admin007'),
] ],
]); ]);
}
} }
} class PeriodeTableSeeder extends Seeder
{
class PeriodeTableSeeder extends Seeder {
public function run() public function run()
{ {
// DB::table('users')->delete(); // DB::table('users')->delete();
@ -76,15 +72,13 @@ class PeriodeTableSeeder extends Seeder {
'id' => '1', 'id' => '1',
'days' => '100', 'days' => '100',
'created_at' => '2015-06-09 02:59:49', 'created_at' => '2015-06-09 02:59:49',
'updated_at' => '2015-06-10 08:14:27' 'updated_at' => '2015-06-10 08:14:27',
]); ]);
}
} }
} class CategoryTableSeeder extends Seeder
{
class CategoryTableSeeder extends Seeder {
public function run() public function run()
{ {
// DB::table('users')->delete(); // DB::table('users')->delete();
@ -99,34 +93,32 @@ class CategoryTableSeeder extends Seeder {
// 'id' => '1', // 'id' => '1',
'category' => 'Sains', 'category' => 'Sains',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
// 'id' => '2', // 'id' => '2',
'category' => 'Computer', 'category' => 'Computer',
'created_at' => '2015-06-09 01:07:41', 'created_at' => '2015-06-09 01:07:41',
'updated_at' => '2015-06-09 01:07:41' 'updated_at' => '2015-06-09 01:07:41',
], ],
[ [
// 'id' => '3', // 'id' => '3',
'category' => 'Life Lesson', 'category' => 'Life Lesson',
'created_at' => '2015-06-09 01:07:50', 'created_at' => '2015-06-09 01:07:50',
'updated_at' => '2015-06-09 01:07:50' 'updated_at' => '2015-06-09 01:07:50',
], ],
[ [
// 'id' => '4', // 'id' => '4',
'category' => 'Fairy Tail', 'category' => 'Fairy Tail',
'created_at' => '2015-06-09 01:07:50', 'created_at' => '2015-06-09 01:07:50',
'updated_at' => '2015-06-09 01:07:50' 'updated_at' => '2015-06-09 01:07:50',
] ],
]); ]);
}
} }
} class BookTableSeeder extends Seeder
{
class BookTableSeeder extends Seeder {
public function run() public function run()
{ {
// DB::table('users')->delete(); // DB::table('users')->delete();
@ -147,7 +139,7 @@ class BookTableSeeder extends Seeder {
'shelf_id' => '1', 'shelf_id' => '1',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36', 'updated_at' => '2015-06-09 01:01:36',
'year_id' => '0' 'year_id' => '0',
], ],
[ [
// 'id' => '2', // 'id' => '2',
@ -159,7 +151,7 @@ class BookTableSeeder extends Seeder {
'shelf_id' => '3', 'shelf_id' => '3',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36', 'updated_at' => '2015-06-09 01:01:36',
'year_id' => '0' 'year_id' => '0',
], ],
[ [
// 'id' => '3', // 'id' => '3',
@ -171,60 +163,55 @@ class BookTableSeeder extends Seeder {
'shelf_id' => '2', 'shelf_id' => '2',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36', 'updated_at' => '2015-06-09 01:01:36',
'year_id' => '0' 'year_id' => '0',
] ],
]); ]);
}
} }
} class ShelfTableSeeder extends Seeder
{
class ShelfTableSeeder extends Seeder {
public function run() public function run()
{ {
DB::table('shelves')->insert([ DB::table('shelves')->insert([
[ [
'id' => '1', 'id' => '1',
'shelf' => 'A', 'shelf' => 'A',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '2', 'id' => '2',
'shelf' => 'B', 'shelf' => 'B',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '3', 'id' => '3',
'shelf' => 'C', 'shelf' => 'C',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '4', 'id' => '4',
'shelf' => 'D', 'shelf' => 'D',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '5', 'id' => '5',
'shelf' => 'E', 'shelf' => 'E',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
] ],
]); ]);
} }
} }
class StudentTableSeeder extends Seeder { class StudentTableSeeder extends Seeder
{
public function run() public function run()
{ {
DB::table('students')->insert([ DB::table('students')->insert([
[ [
'id' => '1', 'id' => '1',
@ -233,7 +220,7 @@ class StudentTableSeeder extends Seeder {
'borrow' => '1', 'borrow' => '1',
'status' => '1', 'status' => '1',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '2', 'id' => '2',
@ -242,7 +229,7 @@ class StudentTableSeeder extends Seeder {
'borrow' => '1', 'borrow' => '1',
'status' => '1', 'status' => '1',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '3', 'id' => '3',
@ -251,7 +238,7 @@ class StudentTableSeeder extends Seeder {
'borrow' => '0', 'borrow' => '0',
'status' => '1', 'status' => '1',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '4', 'id' => '4',
@ -260,7 +247,7 @@ class StudentTableSeeder extends Seeder {
'borrow' => '1', 'borrow' => '1',
'status' => '1', 'status' => '1',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '5', 'id' => '5',
@ -269,15 +256,14 @@ class StudentTableSeeder extends Seeder {
'borrow' => '0', 'borrow' => '0',
'status' => '1', 'status' => '1',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
]); ]);
} }
} }
class CollectionTableSeeder extends Seeder { class CollectionTableSeeder extends Seeder
{
public function run() public function run()
{ {
// DB::table('users')->delete(); // DB::table('users')->delete();
@ -294,7 +280,7 @@ class CollectionTableSeeder extends Seeder {
'name' => 'first collection', 'name' => 'first collection',
'parent_id' => null, 'parent_id' => null,
'created_at' => new DateTime(), 'created_at' => new DateTime(),
'updated_at' => new DateTime() 'updated_at' => new DateTime(),
], ],
[ [
'id' => '1', 'id' => '1',
@ -302,7 +288,7 @@ class CollectionTableSeeder extends Seeder {
'name' => 'Informatik, Informationswissenschaft, allgemeine Werke', 'name' => 'Informatik, Informationswissenschaft, allgemeine Werke',
'parent_id' => '0', 'parent_id' => '0',
'created_at' => '2015-06-09 00:17:51', 'created_at' => '2015-06-09 00:17:51',
'updated_at' => '2015-06-09 01:01:36' 'updated_at' => '2015-06-09 01:01:36',
], ],
[ [
'id' => '2', 'id' => '2',
@ -310,7 +296,7 @@ class CollectionTableSeeder extends Seeder {
'name' => 'Philosophie und Psychologie', 'name' => 'Philosophie und Psychologie',
'parent_id' => '0', 'parent_id' => '0',
'created_at' => '2015-06-09 01:07:41', 'created_at' => '2015-06-09 01:07:41',
'updated_at' => '2015-06-09 01:07:41' 'updated_at' => '2015-06-09 01:07:41',
], ],
[ [
'id' => '3', 'id' => '3',
@ -318,7 +304,7 @@ class CollectionTableSeeder extends Seeder {
'name' => 'Religion', 'name' => 'Religion',
'parent_id' => '0', 'parent_id' => '0',
'created_at' => '2015-06-09 01:07:50', 'created_at' => '2015-06-09 01:07:50',
'updated_at' => '2015-06-09 01:07:50' 'updated_at' => '2015-06-09 01:07:50',
], ],
[ [
'id' => '4', 'id' => '4',
@ -326,39 +312,34 @@ class CollectionTableSeeder extends Seeder {
'name' => 'Sozialwissenschaften', 'name' => 'Sozialwissenschaften',
'parent_id' => '0', 'parent_id' => '0',
'created_at' => '2015-06-09 01:07:50', 'created_at' => '2015-06-09 01:07:50',
'updated_at' => '2015-06-09 01:07:50' 'updated_at' => '2015-06-09 01:07:50',
] ],
]); ]);
}
} }
} class DocumentTableSeeder extends Seeder
{
class DocumentTableSeeder extends Seeder {
public function run() public function run()
{ {
DB::table('documents')->insert([ DB::table('documents')->insert([
[ [
'id' => '0' 'id' => '0',
], ],
[ [
'id' => '1' 'id' => '1',
] ],
]); ]);
DB::table('link_documents_collections')->insert([ DB::table('link_documents_collections')->insert([
[ [
'document_id' => '0', 'document_id' => '0',
'collection_id' => '1' 'collection_id' => '1',
], ],
[ [
'document_id' => '1', 'document_id' => '1',
'collection_id' => '1' 'collection_id' => '1',
] ],
]); ]);
} }
} }

View File

@ -0,0 +1,40 @@
<?php
use Carbon\Carbon;
use Database\DisableForeignKeys;
use Database\TruncateTable;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Faker\Factory as Faker;
class PagesTableSeeder extends Seeder
{
use DisableForeignKeys;
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
$title = $faker->sentence;
$this->disableForeignKeys();
// $this->truncate('pages');
$page = [
[
'title' => 'Terms and conditions',
'page_slug' => 'terms-and-conditions',
'description' => $faker->text($maxNbChars = 255),
'status' => '1',
'created_by' => '1',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
];
DB::table('pages')->insert($page);
$this->enableForeignKeys();
}
}

20
package-lock.json generated
View File

@ -2452,6 +2452,23 @@
"assert-plus": "^1.0.0" "assert-plus": "^1.0.0"
} }
}, },
"datatables.net": {
"version": "1.10.19",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.10.19.tgz",
"integrity": "sha512-+ljXcI6Pj3PTGy5pesp3E5Dr3x3AV45EZe0o1r0gKENN2gafBKXodVnk2ypKwl2tTmivjxbkiqoWnipTefyBTA==",
"requires": {
"jquery": ">=1.7"
}
},
"datatables.net-buttons": {
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/datatables.net-buttons/-/datatables.net-buttons-1.5.3.tgz",
"integrity": "sha512-qGdYiquuIvoZSH0jkRTcVnS1LlCuJFOSlIX5wNmK+3267Ryq6r9llKFtgrIORkSlyy+M1TJMViFJxRSX5W62GA==",
"requires": {
"datatables.net": "^1.10.15",
"jquery": ">=1.7"
}
},
"date-now": { "date-now": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz",
@ -5166,8 +5183,7 @@
"jquery": { "jquery": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz",
"integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==", "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
"dev": true
}, },
"js-base64": { "js-base64": {
"version": "2.4.8", "version": "2.4.8",

View File

@ -16,5 +16,8 @@
"lodash": "^4.17.10", "lodash": "^4.17.10",
"vue": "^2.5.7" "vue": "^2.5.7"
}, },
"dependencies": {} "dependencies": {
"datatables.net": "^1.10.15",
"datatables.net-buttons": "^1.3.1"
}
} }

View File

@ -0,0 +1 @@
!function(t){var e={};function a(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=t,a.c=e,a.d=function(t,e,s){a.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="/",a(a.s=0)}([function(t,e,a){t.exports=a(1)},function(t,e){new Vue({el:"#app",data:function(){return{rows:[],errors:[],uploadedFiles:[],uploadError:null,currentStatus:null,uploadFieldName:"photos",fileCount:0,step:1,dataset:{type:"",state:"",rights:0,project_id:"",creating_corporation:"GBA",embargo_date:"",belongs_to_bibliography:0,title_main:{value:"",language:""},abstract_main:{value:"",language:""},checkedPersons:[],checkedLicenses:[],files:[]}}},mounted:function(){this.step=1,this.reset()},computed:{isInitial:function(){return 0===this.currentStatus},isSaving:function(){return 1===this.currentStatus},isSuccess:function(){return 2===this.currentStatus},isFailed:function(){return 3===this.currentStatus}},methods:{reset:function(){this.currentStatus=0,this.uploadedFiles=[],this.uploadError=null},resetDropbox:function(){this.currentStatus=0,this.dataset.files=[]},save:function(){var t=this;this.errors=[];for(var e=new FormData,a=0;a<this.dataset.files.length;a++){var s=this.dataset.files[a];e.append("files["+a+"][file]",s.file),e.append("files["+a+"][label]",s.label),e.append("files["+a+"][sorting]",a+1)}e.append("type",this.dataset.type),e.append("server_state",this.dataset.state),e.append("rights",this.dataset.rights),e.append("creating_corporation",this.dataset.creating_corporation),e.append("project_id",this.dataset.project_id),e.append("embargo_date",this.dataset.embargo_date),e.append("belongs_to_bibliography",this.dataset.belongs_to_bibliography),e.append("title_main[value]",this.dataset.title_main.value),e.append("title_main[language]",this.dataset.title_main.language),e.append("abstract_main[value]",this.dataset.abstract_main.value),e.append("abstract_main[language]",this.dataset.abstract_main.language);for(a=0;a<this.dataset.checkedLicenses.length;a++)e.append("licenses["+a+"]",this.dataset.checkedLicenses[a]);axios.post("/publish/dataset/store",e,{headers:{"Content-Type":"multipart/form-data"}}).then(function(e){console.log(e.data),t.currentStatus=2,e.data.redirect&&(window.location=e.data.redirect)}).catch(function(e){var a=JSON.parse(JSON.stringify(e));if(a.response.data.errors){var s=a.response.data.errors;for(var r in s)console.log(s[r]),t.errors.push(s[r])}if(a.response.data.error){e=a.response.data.error;t.errors.push(e.message)}t.currentStatus=3})},filesChange:function(t,e){for(var a=e,s=0;s<a.length;s++){var r=a[s].name.replace(/\.[^/.]+$/,""),n={file:a[s],label:r,sorting:0};this.dataset.files.push(n)}},removeFile:function(t){this.dataset.files.splice(t,1)},prev:function(){this.step--},next:function(){this.step++},submit:function(){this.save()}}})}]);

View File

@ -449,6 +449,8 @@ Hides the menu at `48em`, but modify this based on your app's needs.
left: 300px; left: 300px;
} }
} }
/* _______________________________my edits ------------------------------------- */ /* _______________________________my edits ------------------------------------- */
.box-l { .box-l {
padding-right: 1em; padding-right: 1em;

File diff suppressed because one or more lines are too long

5
public/js/dataTable.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
{ {
"/js/app.js": "/js/app.js" "/backend/publish/datasetPublish.js": "/backend/publish/datasetPublish.js",
"/js/dataTable.js": "/js/dataTable.js"
} }

View File

@ -1,218 +0,0 @@
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
Vue.prototype.$http = axios;
// Vue.component('example', require('./components/Example.vue'));
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
const app = new Vue({
el: '#app',
data() {
return {
rows: [
//initial data
// { qty: 5, value: "Something", language: 10, type: "additional", sort_order: 0 },
// { qty: 2, value: "Something else", language: 20, type: "additional", sort_order: 0 },
],
errors: [],
uploadedFiles: [],
uploadError: null,
currentStatus: null,
uploadFieldName: 'photos',
fileCount: 0,
step: 1,
dataset: {
type: '',
state: '',
rights: 0,
creating_corporation: "GBA",
embargo_date: '',
belongs_to_bibliography: 0,
title_main: {
value: '',
language: ''
},
abstract_main: {
value: '',
language: ''
},
checkedPersons: [],
checkedLicenses: [],
files: []
}
}
},
mounted() {
this.step = 1;
this.reset();
},
computed: {
isInitial() {
return this.currentStatus === STATUS_INITIAL;
},
isSaving() {
return this.currentStatus === STATUS_SAVING;
},
isSuccess() {
return this.currentStatus === STATUS_SUCCESS;
},
isFailed() {
return this.currentStatus === STATUS_FAILED;
}
},
methods: {
reset() {
// reset form to initial state
this.currentStatus = STATUS_INITIAL;
this.uploadedFiles = [];
this.uploadError = null;
},
resetDropbox() {
// reset form to initial state
this.currentStatus = STATUS_INITIAL;
this.dataset.files = [];
},
save() {
this.errors = [];
/*
Initialize the form data
*/
let formData = new FormData();
/*
Iteate over any file sent over appending the files
to the form data.
*/
// formData.append('files', []);
for (var i = 0; i < this.dataset.files.length; i++) {
let file = this.dataset.files[i];
formData.append('files[' + i + '][file]', file.file);
formData.append('files[' + i + '][label]', file.label);
formData.append('files[' + i + '][sorting]', i + 1);
// formData.append('files[' + i + ']', JSON.stringify(file));
}
/*
Additional POST Data
*/
formData.append('type', this.dataset.type);
formData.append('server_state', this.dataset.state);
formData.append('rights', this.dataset.rights);
formData.append('creating_corporation', this.dataset.creating_corporation);
formData.append('embargo_date', this.dataset.embargo_date);
formData.append('belongs_to_bibliography', this.dataset.belongs_to_bibliography);
formData.append('main_title[value]', this.dataset.title_main.value);
formData.append('main_title[language]', this.dataset.title_main.language);
formData.append('abstract_main[value]', this.dataset.title_main.value);
formData.append('abstract_main[language]', this.dataset.title_main.language);
for (var i = 0; i < this.dataset.checkedLicenses.length; i++) {
formData.append('licenses[' + i + ']', this.dataset.checkedLicenses[i]);
}
/*
Make the request to the POST /multiple-files URL
*/
axios.post('/publish/dataset/store',
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
}
})
.then((response) => {
// success callback
console.log(response.data);
// this.loading = false;
// this.items = response.data;
//Vue.set(app.skills, 1, "test55");
this.currentStatus = STATUS_SUCCESS;
})
.catch((error) => {
// this.loading = false;
console.log("test");
let errorObject = JSON.parse(JSON.stringify(error));
console.log(errorObject);
var errorsArray = errorObject.response.data.errors;
for (var index in errorsArray) {
console.log(errorsArray[index]);
this.errors.push(errorsArray[index]);
}
this.currentStatus = STATUS_FAILED;
});
},
// filesChange(fieldName, fileList) {
// // handle file changes
// // const formData = new FormData();
// if (!fileList.length) return;
// // append the files to FormData
// Array
// .from(Array(fileList.length).keys())
// .map(x => {
// dataset.files.append(fieldName, fileList[x], fileList[x].name);
// });
// // save it
// // this.save(formData);
// },
/*
Handles a change on the file upload
*/
filesChange(fieldName, fileList) {
// this.dataset.files = this.$refs.files.files;
let uploadedFiles = fileList;
/*
Adds the uploaded file to the files array
*/
for (var i = 0; i < uploadedFiles.length; i++) {
let fileName = uploadedFiles[i].name.replace(/\.[^/.]+$/, '');
let uploadeFile = { file: uploadedFiles[i], label: fileName, sorting: 0 };
//this.dataset.files.push(uploadedFiles[i]);
this.dataset.files.push(uploadeFile);
}
// if (this.dataset.files.length > 0)
// {
// this.currentStatus = STATUS_SAVING;
// }
},
/*
Removes a select file the user has uploaded
*/
removeFile(key) {
this.dataset.files.splice(key, 1);
},
prev() {
this.step--;
},
next() {
this.step++;
},
submit() {
// alert('Submit to blah and show blah and etc.');
// save it
this.save();
}
}
});
// const app = new Vue({
// el: '#app',
// data: {
// loading: false,
// downloading: false,
// items: [],
// message: "Just a test",
// }
// });

View File

@ -3,9 +3,24 @@
* includes Vue and other libraries. It is a great starting point when * includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel. * building robust, powerful web applications using Vue and Laravel.
*/ */
// require('./bootstrap'); // window.axios = require('axios');
// window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
// let token = document.head.querySelector('meta[name="csrf-token"]');
// if (token) {
// window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
// }
// else {
// console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
// }
// window.Vue = require('vue'); // window.Vue = require('vue');
Vue.prototype.$http = axios; // Vue.prototype.$http = axios;
// Vue.component('example', require('./components/Example.vue')); // Vue.component('example', require('./components/Example.vue'));
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3; const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
@ -158,8 +173,6 @@ const app = new Vue({
var error = errorObject.response.data.error; var error = errorObject.response.data.error;
this.errors.push(error.message); this.errors.push(error.message);
} }
this.currentStatus = STATUS_FAILED; this.currentStatus = STATUS_FAILED;
}); });
}, },

View File

@ -0,0 +1,23 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Alert Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain alert messages for various scenarios
| during CRUD operations. You are free to modify these language lines
| according to your application's requirements.
|
*/
'backend' => [
'pages' => [
'created' => 'The Page was successfully created.',
'deleted' => 'The Page was successfully deleted.',
'updated' => 'The Page was successfully updated.',
],
],
];

View File

@ -0,0 +1,55 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Buttons Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used in buttons throughout the system.
| Regardless where it is placed, a button can be listed here so it is easily
| found in a intuitive way.
|
*/
'backend' => [
'access' => [
'users' => [
'activate' => 'Activate',
'change_password' => 'Change Password',
'clear_session' => 'Clear Session',
'deactivate' => 'Deactivate',
'delete_permanently' => 'Delete Permanently',
'login_as' => 'Login As :user',
'resend_email' => 'Resend Confirmation E-mail',
'restore_user' => 'Restore User',
],
],
],
'emails' => [
'auth' => [
'confirm_account' => 'Confirm Account',
'reset_password' => 'Reset Password',
],
],
'general' => [
'cancel' => 'Cancel',
'continue' => 'Continue',
'preview' => 'Preview',
'save' => 'Save',
'view' => 'View',
'crud' => [
'create' => 'Create',
'add' => 'Add',
'delete' => 'Delete',
'edit' => 'Edit',
'update' => 'Update',
'view' => 'View',
],
],
];

View File

@ -0,0 +1,27 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Exception Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used in Exceptions thrown throughout the system.
| Regardless where it is placed, a button can be listed here so it is easily
| found in a intuitive way.
|
*/
'backend' => [
'pages' => [
'already_exists' => 'That Page already exists. Please choose a different name.',
'create_error' => 'There was a problem creating this Page. Please try again.',
'delete_error' => 'There was a problem deleting this Page. Please try again.',
'not_found' => 'That Page does not exist.',
'update_error' => 'There was a problem updating this Page. Please try again.',
],
],
'frontend' => [],
];

View File

@ -0,0 +1,82 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Labels Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used in labels throughout the system.
| Regardless where it is placed, a label can be listed here so it is easily
| found in a intuitive way.
|
*/
'general' => [
'all' => 'All',
'yes' => 'Yes',
'no' => 'No',
'custom' => 'Custom',
'actions' => 'Actions',
'active' => 'Active',
'buttons' => [
'save' => 'Save',
'update' => 'Update',
],
'hide' => 'Hide',
'inactive' => 'Inactive',
'none' => 'None',
'show' => 'Show',
'toggle_navigation' => 'Toggle Navigation',
],
'backend' => [
'profile_updated' => 'Your profile has been updated.',
'access' => [
'roles' => [
'create' => 'Create Role',
'edit' => 'Edit Role',
'management' => 'Role Management',
'table' => [
'number_of_users' => 'Number of Users',
'permissions' => 'Permissions',
'role' => 'Role',
'sort' => 'Sort',
'total' => 'role total|roles total',
],
],
'permissions' => [
'create' => 'Create Permission',
'edit' => 'Edit Permission',
'management' => 'Permission Management',
'table' => [
'permission' => 'Permission',
'display_name' => 'Display Name',
'sort' => 'Sort',
'status' => 'Status',
'total' => 'role total|roles total',
],
]
],
'pages' => [
'create' => 'Create Page',
'edit' => 'Edit Page',
'management' => 'Page Management',
'title' => 'Pages',
'table' => [
'title' => 'Title',
'status' => 'Status',
'createdat' => 'Created At',
'updatedat' => 'Updated At',
'createdby' => 'Created By',
'all' => 'All',
],
]
]
];

View File

@ -0,0 +1,22 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Menus Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used in menu items throughout the system.
| Regardless where it is placed, a menu item can be listed here so it is easily
| found in a intuitive way.
|
*/
'backend' => [
'access' => [
'title' => 'Access Management',
],
],
];

View File

@ -102,6 +102,35 @@ return [
| |
*/ */
'attributes' => [], 'attributes' => [
'backend' => [
'create-dataset' => [
// 'email' => 'E-mail Address',
// 'firstName' => 'First Name',
// 'lastName' => 'Last Name',
// 'password' => 'Password',
// 'address' => 'Address',
// 'country' => 'Country',
// 'state' => 'Select State',
// 'city' => 'Select City',
// 'zipcode' => 'Zip Code',
// 'ssn' => 'SSN',
// 'password_confirmation' => 'Password Confirmation',
// 'old_password' => 'Old Password',
// 'new_password' => 'New Password',
// 'new_password_confirmation' => 'New Password Confirmation',
'terms_and_conditions' => 'terms and conditions',
],
'pages' => [
'title' => 'Title',
'description' => 'Description',
'cannonical_link' => 'Cannonical Link',
'seo_title' => 'SEO Title',
'seo_keyword' => 'SEO Keyword',
'seo_description' => 'SEO Description',
'is_active' => 'Active',
],
],
],
]; ];

View File

@ -6,7 +6,7 @@
<div id="titlemain-wrapper"> <div id="titlemain-wrapper">
<div class="frontdoor_pagination"> <div class="frontdoor_pagination">
{{-- <a id="pagination-link-hitlist" href="{{ route('settings.document') }}">BACK</a> --}} {{-- <a id="pagination-link-hitlist" href="{{ route('settings.document') }}">BACK</a> --}}
<a href="{{ route('documents') }}" class="pure-button"> <a href="{{ route('frontend.datasets') }}" class="pure-button">
<span class="glyphicon glyphicon-chevron-left" ></span> BACK <span class="glyphicon glyphicon-chevron-left" ></span> BACK
</a> </a>

View File

@ -0,0 +1,5 @@
@extends('layouts.app')
@section('content')
{!! $page->description !!}
@endsection

View File

@ -8,7 +8,7 @@
<span> <span>
<?php foreach ($years as $year) : ?> <?php foreach ($years as $year) : ?>
<a title="documents published in year <?= $year ?>" href="{{ URL::route('sitelinks.list',['year' => $year]) }}"><?= $year ?> <a title="datasets published in year <?= $year ?>" href="{{ URL::route('frontend.sitelinks.list',['year' => $year]) }}"><?= $year ?>
</a> </a>
<?php endforeach; ?> <?php endforeach; ?>
</span> </span>
@ -20,7 +20,7 @@
<section class="post"> <section class="post">
<header class="post-header"> <header class="post-header">
<h2 class="post-title"> <h2 class="post-title">
<a href="{{ URL::route('document.show',['id' =>$document->id]) }}"><?= $document->type; $document->id; ?> <a href="{{ URL::route('frontend.dataset.show',['id' =>$document->id]) }}"><?= $document->type; $document->id; ?>
</a> </a>
</h2> </h2>
</header> </header>

View File

@ -56,8 +56,8 @@
<div class="block"> <div class="block">
<h3 class="block-title">About RDR</h3> <h3 class="block-title">About RDR</h3>
<ul> <ul>
<li><a href="{{ URL::route('home.about') }}">About Us</a></li> <li><a href="{{ URL::route('frontend.home.about') }}">About Us</a></li>
<li><a href="{{ URL::route('home.news') }}">News</a></li> <li><a href="{{ URL::route('frontend.home.news') }}">News</a></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -68,9 +68,11 @@
<h3 class="block-title">TOOLS &amp; SUPPORT</h3> <h3 class="block-title">TOOLS &amp; SUPPORT</h3>
<ul id="secondary-nav" class="nav"> <ul id="secondary-nav" class="nav">
{{-- <li>{{ Request::ip() }}</li> --}} {{-- <li>{{ Request::ip() }}</li> --}}
<li class="first"><a href="{{ URL::route('home.contact') }}">Contact</a></li> <li class="first"><a href="{{ URL::route('frontend.home.contact') }}">Contact</a></li>
<li><a href="{{ URL::route('home.imprint') }}">Impressum</a></li> <li><a href="{{ URL::route('frontend.home.imprint') }}">Impressum</a></li>
<li class="last"><a href="{{ URL::route('sitelinks.index') }}">Sitelinks</a></li> <li class="last"><a href="{{ URL::route('frontend.sitelinks.index') }}">Sitelinks</a></li>
<li class="last"><a href="{!! URL::route('frontend.pages.show', ['page_slug'=>'terms-and-conditions']) !!}">Terms and Conditions</a></li>
<li><a target="_blank" href="https://github.com/geolba"><i class="fa fa-github"></i> rdr bei GitHub</a></li> <li><a target="_blank" href="https://github.com/geolba"><i class="fa fa-github"></i> rdr bei GitHub</a></li>
</ul> </ul>
</div> </div>

View File

@ -66,8 +66,8 @@
<ul class="pure-menu-children" role="menu"> <ul class="pure-menu-children" role="menu">
<li class="pure-menu-item"><a class="pure-menu-link" href="{{ URL::route('oai') }}" target="_blank"> OAI-PMH 2.0</a></li> <li class="pure-menu-item"><a class="pure-menu-link" href="{{ URL::route('oai') }}" target="_blank"> OAI-PMH 2.0</a></li>
{{-- <li class="pure-menu-item"><a class="pure-menu-link" href="{{ URL::route('dataset.create1') }}">PUBLISH</a></li> --}} {{-- <li class="pure-menu-item"><a class="pure-menu-link" href="{{ URL::route('dataset.create1') }}">PUBLISH</a></li> --}}
<li class="pure-menu-item"><a class="pure-menu-link" href="{{ URL::route('home.news') }}">NEWS</a></li> <li class="pure-menu-item"><a class="pure-menu-link" href="{{ URL::route('frontend.home.news') }}">NEWS</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" href="{{ route('documents') }}">DATASETS</a></li> <li class="pure-menu-item"><a class="pure-menu-link" href="{{ route('frontend.datasets') }}">DATASETS</a></li>
</ul> </ul>
</li> </li>
@ -91,10 +91,10 @@
<li class="pure-menu-item pure-menu-allow-hover custom-can-transform"> <li class="pure-menu-item pure-menu-allow-hover custom-can-transform">
<a href="#" class="pure-menu-link">{{ Auth::user()->login }} <span class="fa fa-angle-down"></span></a> <a href="#" class="pure-menu-link">{{ Auth::user()->login }} <span class="fa fa-angle-down"></span></a>
<ul class="pure-menu-children" role="menu"> <ul class="pure-menu-children" role="menu">
<li class="pure-menu-item"><a class="pure-menu-link" href="{{route('settings.user.edit',['id'=>Auth::user()->id]) }}"><i class="fa fa-user"></i> EDIT</a> </li> <li class="pure-menu-item"><a class="pure-menu-link" href="{{route('access.user.edit',['id'=>Auth::user()->id]) }}"><i class="fa fa-user"></i> EDIT</a> </li>
@role('administrator') @role('administrator')
<li class="pure-menu-item"><a class="pure-menu-link" href="{{route('settings.user.index') }}"><i class="fa fa-users"></i> EDIT USERS</a></li> <li class="pure-menu-item"><a class="pure-menu-link" href="{{route('access.user.index') }}"><i class="fa fa-users"></i> EDIT USERS</a></li>
<li class="pure-menu-item"><a class="pure-menu-link" href="{{route('role.index') }}"><i class="fa fa-key"></i> EDIT ROLES</a></li> <li class="pure-menu-item"><a class="pure-menu-link" href="{{route('access.role.index') }}"><i class="fa fa-key"></i> EDIT ROLES</a></li>
@endrole @endrole
<li class="pure-menu-item"><a class="pure-menu-link" href="{{ route('logout') }}"><i class="fa fa-sign-out"></i> LOG OUT</a></li> <li class="pure-menu-item"><a class="pure-menu-link" href="{{ route('logout') }}"><i class="fa fa-sign-out"></i> LOG OUT</a></li>
</ul> </ul>

View File

@ -33,7 +33,12 @@
<span class="required" title="Dieses Feld muss ausgefüllt werden.">*</span> <span class="required" title="Dieses Feld muss ausgefüllt werden.">*</span>
</small> </small>
{{-- <input name="rights" value="0" type="hidden"> --}} {{-- <input name="rights" value="0" type="hidden"> --}}
<label>
<input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" true-value="1" false-value="0"> <input class="form-checkbox" name="rights" id="rights" type="checkbox" v-model="dataset.rights" true-value="1" false-value="0">
<p>
I accept {!! link_to_route('frontend.pages.show', trans('validation.attributes.backend.create-dataset.terms_and_conditions').'*', ['page_slug'=>'terms-and-conditions']) !!}
</p>
</label>
</div> </div>
</fieldset> </fieldset>
@ -244,10 +249,10 @@
@section('after-scripts') @section('after-scripts')
{{-- <script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}} {{-- <script type="text/javascript" src="{{ asset('js/lib.js') }}"></script> --}}
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> {{-- <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<!-- production version, optimized for size and speed --> <script src="https://cdn.jsdelivr.net/npm/vue"></script>--}}
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript" src="{{ asset('js/app.js') }}"></script> {{-- <script type="text/javascript" src="{{ resource_path('assets\js\datasetPublish.js') }}"></script> --}}
{{-- <script type="text/javascript" src="{{ resource_path('assets\js\app.js') }}"></script> --}} <script type="text/javascript" src="{{ asset('backend/publish/datasetPublish.js') }}"></script>
@stop @stop

View File

@ -42,6 +42,7 @@
@endsection @endsection
@section('after-scripts') @section('after-scripts')
<!-- <script src="bower_components/chart.js/dist/Chart.min.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.min.js"></script>
<script> <script>
var ctx = document.getElementById("myChart"); var ctx = document.getElementById("myChart");

View File

@ -9,15 +9,12 @@
<link rel='stylesheet' href="{{ asset('css/pure-min.css') }}" /> <link rel='stylesheet' href="{{ asset('css/pure-min.css') }}" />
<link rel='stylesheet' href="{{ asset('css/grids-responsive-min.css') }}" /> <link rel='stylesheet' href="{{ asset('css/grids-responsive-min.css') }}" />
<!-- <script src="bower_components/chart.js/dist/Chart.min.js"></script> -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.2.1/Chart.min.js"></script>
<!--<link rel="stylesheet" type="text/css" href="bower_components/font-awesome/css/font-awesome.min.css">--> <!--<link rel="stylesheet" type="text/css" href="bower_components/font-awesome/css/font-awesome.min.css">-->
<link rel='stylesheet' href="{{ asset('css/font-awesome.css') }}" /> <link rel='stylesheet' href="{{ asset('css/font-awesome.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ asset('/assets/style.css') }}"> <link rel="stylesheet" type="text/css" href="{{ asset('/backend/style.css') }}">
<link rel="stylesheet" type="text/css" href="{{ asset('/assets/pagination.css') }}"> <link rel="stylesheet" type="text/css" href="{{ asset('/backend/pagination.css') }}">
</head> </head>
<body> <body>
@ -84,9 +81,26 @@
</li> </li>
@endpermission @endpermission
@permission('page')
<li class="{{ active_class(Active::checkUriPattern('settings/page*')) }}">
<a class="pure-menu-link" href="{{ route('settings.page.index') }}">
<i class="fa fa-file-text"></i>
<span>{{ trans('labels.backend.pages.title') }}</span>
</a>
</li>
@endpermission
<li class="treeview"> <li class="treeview">
<h2 class="pure-menu-heading">Access Management <span class="fa fa-angle-down"></h2> <h2 class="pure-menu-heading">
<span>{{ trans('menus.backend.access.title') }}</span>
<i class="fa fa-angle-down"></i>
</h2>
{{-- <a href="#">
<i class="fa fa-users"></i>
<span>{{ trans('menus.backend.access.title') }}</span>
<i class="fa fa-angle-left pull-right"></i>
</a> --}}
<ul class="pure-menu-list treeview-menu {{ active_class(Route::is('access.*'), 'menu-open') }}" style="display: none; {{ active_class(Route::is('access.*'), 'display: block;') }}"> <ul class="pure-menu-list treeview-menu {{ active_class(Route::is('access.*'), 'menu-open') }}" style="display: none; {{ active_class(Route::is('access.*'), 'display: block;') }}">
@if (Auth::guest()) @if (Auth::guest())
<li class="pure-menu-item {{ Route::currentRouteName() == 'login' ? 'active' : '' }}"> <li class="pure-menu-item {{ Route::currentRouteName() == 'login' ? 'active' : '' }}">
@ -108,16 +122,6 @@
<a class="pure-menu-link" href="{{ route('logout') }}"><i class="fa fa-sign-out"></i>Logout</a> <a class="pure-menu-link" href="{{ route('logout') }}"><i class="fa fa-sign-out"></i>Logout</a>
</li> </li>
@endif @endif
{{-- @if (Auth::guest())
<li class="pure-menu-item {{ Route::currentRouteName() == 'login' ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ route('login') }}">LOGIN</a>
</li>
@else
<li class="pure-menu-item"><a class="pure-menu-link" href="{{ route('logout') }}"><i class="fa fa-sign-out"></i>Logout</a></li>
@endif --}}
</ul> </ul>
</li> </li>
@ -144,18 +148,23 @@
</div> </div>
<div class="content"> <div class="content">
<section class="content-header">
@yield('page-header')
{{-- <div class="breadcrumb"> {{-- <div class="breadcrumb">
<i class="fa fa-home"></i><a href="#" rel="Dashboard">Dashboard</a> <i class="fa fa-home"></i><a href="#" rel="Dashboard">Dashboard</a>
<i class="fa fa-angle-right"></i><a href="#" rel="Dashboard">Sales</a> <i class="fa fa-angle-right"></i><a href="#" rel="Dashboard">Sales</a>
</div> --}} </div> --}}
{{-- @yield('breadcrumbs') --}} {{-- @yield('breadcrumbs') --}}
<!-- Breadcrumbs would render from routes/breadcrumb.php -->
@if(Breadcrumbs::exists()) @if(Breadcrumbs::exists())
{!! Breadcrumbs::render() !!} {!! Breadcrumbs::render() !!}
@endif @endif
<div class="l-box"> </section>
<section class="l-box">
@include('partials.flash') @include('partials.flash')
@yield('content') @yield('content')
</div> </section>
</div> </div>
</div> </div>
</div> </div>
@ -166,7 +175,7 @@
<script type="text/javascript"> <script type="text/javascript">
$('div.alert').not('alert-important');//.delay(3000).slideUp(300); $('div.alert').not('alert-important');//.delay(3000).slideUp(300);
</script> </script>
<script type="text/javascript" src="{{ asset('assets/functions.js') }}"></script> <script type="text/javascript" src="{{ asset('backend/functions.js') }}"></script>
@yield('after-scripts') @yield('after-scripts')
</div> </div>

View File

@ -0,0 +1,98 @@
@extends ('settings.layouts.app')
@section ('title', trans('labels.backend.pages.management') . ' | ' . trans('labels.backend.pages.edit'))
{{-- @section('page-header')
<h1>
{{ trans('labels.backend.pages.management') }}
<small>{{ trans('labels.backend.pages.edit') }}</small>
</h1>
@endsection --}}
@section('content')
{{ Form::model($page, ['method' => 'PATCH', 'route' => ['settings.page.update', $page], 'class' => 'pure-form pure-form-aligned', 'id' => 'edit-role', 'enctype' => 'multipart/form-data']) }}
<div class="box box-info">
<div class="header">
<h3 class="header-title">{{ trans('labels.backend.pages.edit') }}
</h3>
<div class="box-tools pull-right">
{{-- @include('backend.pages.partials.pages-header-buttons') --}}
</div>
</div>
<div class="box-body box-content">
<div class="pure-control-group">
{{ Form::label('title', trans('validation.attributes.backend.pages.title'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
{{ Form::text('title', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.pages.title'), 'required' => 'required']) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="pure-control-group">
{{ Form::label('description', trans('validation.attributes.backend.pages.description'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
{{ Form::textarea('description', null,['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.pages.description')]) }}
</div><!--col-lg-3-->
</div><!--form control-->
<div class="pure-control-group">
{{ Form::label('cannonical_link', trans('validation.attributes.backend.pages.cannonical_link'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::text('cannonical_link', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.pages.cannonical_link')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="pure-control-group">
{{ Form::label('seo_title', trans('validation.attributes.backend.pages.seo_title'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::text('seo_title', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.pages.seo_title')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="pure-control-group">
{{ Form::label('seo_keyword', trans('validation.attributes.backend.pages.seo_keyword'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::text('seo_keyword', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.pages.seo_keyword')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="pure-control-group">
{{ Form::label('seo_description', trans('validation.attributes.backend.pages.seo_description'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::textarea('seo_description', null,['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.pages.seo_description')]) }}
</div><!--col-lg-3-->
</div><!--form control-->
<div class="pure-control-group">
{{ Form::label('status', trans('validation.attributes.backend.pages.is_active'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
<div class="control-group">
<label class="control control--checkbox">
{{ Form::checkbox('status', 1, ($page->status == 1) ? true : false ) }}
<div class="control__indicator"></div>
</label>
</div>
</div><!--col-lg-3-->
</div><!--form control-->
<div class="pure-controls">
{{ link_to_route('settings.page.index', trans('buttons.general.cancel'), [], ['class' => 'pure-button button-small is-warning']) }}
{{ Form::submit(trans('buttons.general.crud.update'), ['class' => 'pure-button button-small is-primary']) }}
<div class="clearfix"></div>
</div>
</div><!-- /.box-body -->
</div><!--box-->
{{ Form::close() }}
@endsection
@section("after-scripts")
<script type="text/javascript">
// Backend.Pages.init();
</script>
@endsection

View File

@ -0,0 +1,198 @@
@extends ('settings.layouts.app')
@section ('title', trans('labels.backend.pages.management'))
{{-- @section('page-header')
<h2>{{ trans('labels.backend.pages.management') }}</h1>
@endsection --}}
@section('content')
<div class="box box-info">
<div class="box-header with-border header">
<h3 class="header-title">
<i class="fa fa fa-edit"></i> {{ trans('labels.backend.pages.management') }}
</h3>
<div class="box-tools pull-right">
{{-- @include('backend.pages.partials.pages-header-buttons') --}}
</div>
</div>
<div class="box-body pure-g box-content">
<div class="table-responsive data-table-wrapper pure-u-1 pure-u-md-1">
<table id="pages-table" class="table table-condensed table-hover table-bordered pure-table pure-table-horizontal">
<thead>
<tr>
<th>{{ trans('labels.backend.pages.table.title') }}</th>
<th>{{ trans('labels.backend.pages.table.status') }}</th>
<th>{{ trans('labels.backend.pages.table.createdat') }}</th>
<th>{{ trans('labels.backend.pages.table.createdby') }}</th>
<th>{{ trans('labels.general.actions') }}</th>
</tr>
</thead>
<thead class="transparent-bg">
<tr>
<th>
{!! Form::text('first_name', null, ["class" => "search-input-text form-control", "data-column" => 0, "placeholder" => trans('labels.backend.pages.table.title')]) !!}
<a class="reset-data" href="javascript:void(0)"><i class="fa fa-times"></i></a>
</th>
<th>
{!! Form::select('status', [0 => "InActive", 1 => "Active"], null, ["class" => "search-input-select form-control", "data-column" => 1, "placeholder" => trans('labels.backend.pages.table.all')]) !!}
</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
</table>
</div><!--table-responsive-->
</div><!-- /.box-body -->
</div><!--box-->
@endsection
@section('after-scripts')
{{-- For DataTables --}}
{{ Html::script(mix('js/dataTable.js')) }}
<script>
$(function() {
var dataTable = $('#pages-table').dataTable({
processing: true,
serverSide: true,
ajax: {
headers: {
'CSRFToken': document.head.querySelector('meta[name="csrf-token"]').content
},
url: '{{ route("settings.page.get") }}',
type: 'get'
},
columns: [
{data: 'title', name: 'title'},
{data: 'status', name: 'status'},
{data: 'created_at', name: 'created_at'},
{data: 'created_by', name: 'first_name'},
{data: 'actions', name: 'actions', searchable: false, sortable: false}
],
order: [[1, "asc"]],
searchDelay: 500,
dom: 'lBfrtip',
buttons: {
buttons: [
{ extend: 'copy', className: 'copyButton', exportOptions: {columns: [ 0, 1, 2, 3 ] }},
{ extend: 'csv', className: 'csvButton', exportOptions: {columns: [ 0, 1, 2, 3 ] }},
{ extend: 'excel', className: 'excelButton', exportOptions: {columns: [ 0, 1, 2, 3 ] }},
{ extend: 'pdf', className: 'pdfButton', exportOptions: {columns: [ 0, 1, 2, 3 ] }},
{ extend: 'print', className: 'printButton', exportOptions: {columns: [ 0, 1, 2, 3 ] }}
]
}
});
var Backend = {}; // common variable used in all the files of the backend
Backend = {
DataTableSearch: { //functionalities related to datable search at all the places
selector: {},
init: function (dataTable) {
this.setSelectors();
this.setSelectors.divAlerts.delay(2000).fadeOut(800);
this.addHandlers(dataTable);
},
setSelectors: function () {
this.selector.searchInput = document.querySelector("div.dataTables_filter input");
this.selector.columnSearchInput = document.querySelectorAll(".search-input-text");
this.selector.columnSelectInput = document.querySelectorAll(".search-input-select");
this.selector.restButton = document.querySelectorAll('.reset-data');
this.setSelectors.copyButton = document.getElementById("copyButton");
this.setSelectors.csvButton = document.getElementById("csvButton");
this.setSelectors.excelButton = document.getElementById("excelButton");
this.setSelectors.pdfButton = document.getElementById("pdfButton");
this.setSelectors.printButton = document.getElementById("printButton");
this.setSelectors.divAlerts = jQuery('div.alert').not('.alert-important');
},
cloneElement: function (element, callback) {
var clone = element.cloneNode();
while (element.firstChild) {
clone.appendChild(element.lastChild);
}
element.parentNode.replaceChild(clone, element);
Backend.DataTableSearch.setSelectors();
callback(this.selector.searchInput);
},
addHandlers: function (dataTable) {
// get the datatable search input and on its key press check if we hit enter then search with datatable
this.cloneElement(this.selector.searchInput, function (element) { //cloning done to remove any binding of the events
element.onkeypress = function (event) {
if (event.keyCode == 13) {
dataTable.fnFilter(this.value);
}
};
}); // to remove all the listinerers
// for text boxes
//column input search if search box on the column of the datatable given with enter then search with datatable
if (this.selector.columnSearchInput.length > 0) {
this.selector.columnSearchInput.forEach(function (element) {
element.onkeypress = function (event) {
if (event.keyCode == 13) {
var i = element.getAttribute("data-column"); // getting column index
var v = element.value; // getting search input value
dataTable.api().columns(i).search(v).draw();
}
};
});
}
// Individual columns search
if (this.selector.columnSelectInput.length >> 0) {
this.selector.columnSelectInput.forEach(function (element) {
element.onchange = function (event) {
var i = element.getAttribute("data-column"); // getting column index
var v = element.value; // getting search input value
dataTable.api().columns(i).search(v).draw();
};
});
}
// Individual columns reset
if (this.selector.restButton.length >> 0) {
this.selector.restButton.forEach(function (element) {
element.onclick = function (event) {
var inputelement = this.previousElementSibling;
var i = inputelement.getAttribute("data-column");
inputelement.value = "";
dataTable.api().columns(i).search("").draw();
};
});
}
/*this.setSelectors.copyButton.onclick = function (element) {
document.querySelector(".copyButton").click();
};
this.setSelectors.csvButton.onclick = function (element) {
document.querySelector(".csvButton").click();
};
this.setSelectors.excelButton.onclick = function (element) {
document.querySelector(".excelButton").click();
};
this.setSelectors.pdfButton.onclick = function (element) {
document.querySelector(".pdfButton").click();
};
this.setSelectors.printButton.onclick = function (element) {
document.querySelector(".printButton").click();
};*/
}
}
};
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection

View File

@ -51,3 +51,8 @@ Breadcrumbs::register('settings.document.show', function ($breadcrumbs, $id) {
$breadcrumbs->parent('settings.document'); $breadcrumbs->parent('settings.document');
$breadcrumbs->push('show ' . $id, route('settings.document.show', $id)); $breadcrumbs->push('show ' . $id, route('settings.document.show', $id));
}); });
Breadcrumbs::register('settings.page.index', function ($breadcrumbs) {
$breadcrumbs->parent('settings.dashboard');
$breadcrumbs->push('Page Management', route('settings.page.index'));
});

View File

@ -83,7 +83,21 @@ Route::group(
} }
); );
//=================================================setting dashboard==================================================== /*
* CMS Pages Management=============================================================================
*/
Route::group(['namespace' => 'Settings', 'prefix' => 'settings', 'as' => 'settings.',], function () {
Route::resource('page', 'PageController', ['except' => ['show', 'update']]);
Route::patch('page/{page}', [
'as' => 'page.update', 'uses' => 'PageController@update',
]);
// //For DataTables
Route::get('pages/get', ['uses' => 'PagesTableController@get'])->name('page.get');
});
//=================================================setting home - dashboard=======================================
Route::get('settings/', [ Route::get('settings/', [
'as' => 'settings.dashboard', 'uses' => 'Settings\DashboardController@index', 'as' => 'settings.dashboard', 'uses' => 'Settings\DashboardController@index',
]); ]);
@ -176,7 +190,13 @@ Route::group(['middleware' => ['permission:settings']], function () {
]); ]);
}); });
//=================================================home==================================================== //=================================================home fronmtend controller=======================================
/*
* Frontend Routes
* Namespaces indicate folder structure
*/
Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
// includeRouteFiles(__DIR__.'/Frontend/');
Route::get('/', [ Route::get('/', [
'as' => 'home.index', 'uses' => 'HomeController@index', 'as' => 'home.index', 'uses' => 'HomeController@index',
]); ]);
@ -192,17 +212,30 @@ Route::get('/about', [
Route::get('/news', [ Route::get('/news', [
'as' => 'home.news', 'uses' => 'HomeController@news', 'as' => 'home.news', 'uses' => 'HomeController@news',
]); ]);
Route::get('/dataset', [
'as' => 'documents', 'uses' => 'PagesController@documents',
]);
Route::get('/dataset/{id}', [
'as' => 'document.show', 'uses' => 'PagesController@show',
]);
//=================================================Crawlers==================================================== //=================================================Crawlers====================================================
Route::get('sitelinks', [ Route::get('sitelinks', [
'as' => 'sitelinks.index', 'uses' => 'SitelinkController@index', 'as' => 'sitelinks.index', 'uses' => 'SitelinkController@index',
]); ]);
Route::get('sitelinks/list/{year}', 'SitelinkController@list')->name('sitelinks.list'); Route::get('sitelinks/list/{year}', 'SitelinkController@list')->name('sitelinks.list');
Route::get('/dataset', [
'as' => 'datasets', 'uses' => 'PagesController@datasets',
]);
Route::get('/dataset/{id}', [
'as' => 'dataset.show', 'uses' => 'PagesController@show',
]);
/*
* Show pages
*/
Route::get('pages/{slug}', 'HomeController@showPage')->name('pages.show');
});
//=================================================solr search==================================================== //=================================================solr search====================================================
Route::get('/index', [ Route::get('/index', [
'as' => 'search.index', 'uses' => 'SearchController@index', 'as' => 'search.index', 'uses' => 'SearchController@index',
@ -288,7 +321,7 @@ Route::get('settings/book/delete/{id}', [
'as' => 'settings.book.delete', 'uses' => 'BookController@delete', 'as' => 'settings.book.delete', 'uses' => 'BookController@delete',
]); ]);
//=============================================================================================================== //====================================authentication===========================================================================
// Route::controllers([ // Route::controllers([
// 'auth' => 'Auth\AuthController', // 'auth' => 'Auth\AuthController',
// 'password' => 'Auth\PasswordController', // 'password' => 'Auth\PasswordController',

View File

@ -14,7 +14,14 @@ let mix = require('laravel-mix');
// .sass('resources/assets/sass/app1.scss', 'public/css') // .sass('resources/assets/sass/app1.scss', 'public/css')
mix.js('resources/assets/js/app.js', 'public/js'); mix.js('resources/assets/js/datasetPublish.js', 'public/backend/publish')
.scripts([
'node_modules/datatables.net/js/jquery.dataTables.js',
'node_modules/datatables.net-buttons/js/dataTables.buttons.js',
'node_modules/datatables.net-buttons/js/buttons.flash.js',
'node_modules/datatables.net-buttons/js/buttons.html5.js',
'node_modules/datatables.net-buttons/js/buttons.print.js',
], 'public/js/dataTable.js');
// .options({ // .options({
// //publicPath: '../' // //publicPath: '../'
// processCssUrls: false // processCssUrls: false