move search logic to frontend

This commit is contained in:
Arno Kaimbacher 2018-09-07 15:31:05 +02:00
parent 783ac823ba
commit 98f50a2b6f
18 changed files with 330 additions and 76 deletions

View File

@ -1,12 +1,10 @@
<?php <?php
namespace App\Http\Controllers\Frontend; namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\View\View;
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
use App\Http\Controllers\Controller;
use App\Models\Page; use App\Models\Page;
use Illuminate\View\View;
class HomeController extends Controller class HomeController extends Controller
{ {
@ -45,6 +43,7 @@ class HomeController extends Controller
// } // }
return view('frontend.home.index'); return view('frontend.home.index');
// return view('welcome');
} }
/** /**

View File

@ -1,21 +1,22 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Frontend;
use App\Book; use App\Book;
use App\Dataset; use App\Dataset;
use Illuminate\Http\Request; use App\Http\Controllers\Controller;
use Illuminate\View\View;
use App\Library\Search\Navigation; use App\Library\Search\Navigation;
use App\Library\Util\SolrSearchSearcher; use App\Library\Util\SolrSearchSearcher;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
class SearchController extends Controller class SearchController extends Controller
{ {
private $_query; private $query;
private $_numOfHits; private $numOfHits;
private $_searchtype; private $searchtype;
private $_resultList; private $resultList;
private $_facetMenu; private $facetMenu;
protected $client; protected $client;
@ -57,9 +58,9 @@ class SearchController extends Controller
{ {
$this->_request = $request; $this->_request = $request;
$data = $request->all(); $data = $request->all();
//$this->_searchtype = $request->input('searchtype'); //$this->searchtype = $request->input('searchtype');
$this->_searchtype = $request->input('searchtype'); $this->searchtype = $request->input('searchtype');
return view('rdr.solrsearch.index'); return view('frontend.solrsearch.index');
} }
public function search(Request $request): View public function search(Request $request): View
@ -76,10 +77,10 @@ class SearchController extends Controller
// // // display the total number of documents found by solr // // // display the total number of documents found by solr
// echo 'NumFound: ' .$results->getNumFound(); // echo 'NumFound: ' .$results->getNumFound();
//$this->_query = Navigation::getQueryUrl($request); //$this->query = Navigation::getQueryUrl($request);
$query = $this->buildQuery(); $query = $this->buildQuery();
if (!is_null($query)) { if (!is_null($query)) {
$this->_query = $query; $this->query = $query;
$this->performSearch(); $this->performSearch();
// set start and rows param (comparable to SQL limit) using fluent interface // set start and rows param (comparable to SQL limit) using fluent interface
@ -87,14 +88,12 @@ class SearchController extends Controller
// set fields to fetch (this overrides the default setting 'all fields') // set fields to fetch (this overrides the default setting 'all fields')
//$query->setFields(array('id','year')); //$query->setFields(array('id','year'));
$results = $this->resultList->getResults();
$numOfHits = $this->numOfHits;
$results = $this->_resultList->getResults(); return view('frontend.solrsearch.index', compact('results', 'numOfHits'));
$numOfHits = $this->_numOfHits;
return view('rdr.solrsearch.index', compact('results', 'numOfHits'));
} }
return view('rdr.solrsearch.index'); return view('frontend.solrsearch.index');
} }
/** /**
@ -103,17 +102,15 @@ class SearchController extends Controller
public function index(): View public function index(): View
{ {
$totalNumOfDocs = Dataset::count(); $totalNumOfDocs = Dataset::count();
return view('rdr.solrsearch.index', compact('totalNumOfDocs')); return view('frontend.solrsearch.index', compact('totalNumOfDocs'));
} }
public function searchDb(Request $request): View public function searchDb(Request $request): View
{ {
$searchType = "simple"; $searchType = "simple";
$params = $request->all(); $params = $request->all();
//build query //build query
$this->_searchtype = $request->input('searchtype'); $this->searchtype = $request->input('searchtype');
// Gets the query string from our form submission // Gets the query string from our form submission
//$query = Request::input('search'); //$query = Request::input('search');
@ -126,16 +123,15 @@ class SearchController extends Controller
->get(); //paginate(10); ->get(); //paginate(10);
// returns a view and passes the view the list of articles and the original query. // returns a view and passes the view the list of articles and the original query.
return view('rdr.solrsearch.index', compact('books')); return view('frontend.solrsearch.index', compact('books'));
} }
#region private helper #region private helper
private function buildQuery() private function buildQuery()
{ {
$request = $this->_request; $request = $this->_request;
$this->_searchtype = $request->input('searchtype'); $this->searchtype = $request->input('searchtype');
return Navigation::getQueryUrl($request); return Navigation::getQueryUrl($request);
} }
@ -147,16 +143,16 @@ class SearchController extends Controller
//$this->getLogger()->debug('performing search'); //$this->getLogger()->debug('performing search');
try { try {
$searcher = new SolrSearchSearcher(); $searcher = new SolrSearchSearcher();
// $openFacets = $this->_facetMenu->buildFacetArray( $this->getRequest()->getParams() ); // $openFacets = $this->facetMenu->buildFacetArray( $this->getRequest()->getParams() );
// $searcher->setFacetArray($openFacets); // $searcher->setFacetArray($openFacets);
$this->_resultList = $searcher->search($this->_query); $this->resultList = $searcher->search($this->query);
// $this->view->openFacets = $openFacets; // $this->view->openFacets = $openFacets;
} catch (Exception $e) { } catch (Exception $e) {
// $this->getLogger()->err(__METHOD__ . ' : ' . $e); // $this->getLogger()->err(__METHOD__ . ' : ' . $e);
//throw new Application_SearchException($e); //throw new Application_SearchException($e);
echo 'Exception abgefangen: ', $e->getMessage(), "\n"; echo 'Exception abgefangen: ', $e->getMessage(), "\n";
} }
$this->_numOfHits = $this->_resultList->getNumberOfHits(); $this->numOfHits = $this->resultList->getNumberOfHits();
} }
#endregion private helper #endregion private helper
} }

184
package-lock.json generated
View File

@ -478,6 +478,17 @@
} }
} }
}, },
"babel-helper-bindify-decorators": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz",
"integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-builder-binary-assignment-operator-visitor": { "babel-helper-builder-binary-assignment-operator-visitor": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz",
@ -524,6 +535,18 @@
"babel-types": "^6.24.1" "babel-types": "^6.24.1"
} }
}, },
"babel-helper-explode-class": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz",
"integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=",
"dev": true,
"requires": {
"babel-helper-bindify-decorators": "^6.24.1",
"babel-runtime": "^6.22.0",
"babel-traverse": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-helper-function-name": { "babel-helper-function-name": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz",
@ -650,6 +673,30 @@
"integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=",
"dev": true "dev": true
}, },
"babel-plugin-syntax-async-generators": {
"version": "6.13.0",
"resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz",
"integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=",
"dev": true
},
"babel-plugin-syntax-class-properties": {
"version": "6.13.0",
"resolved": "http://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz",
"integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=",
"dev": true
},
"babel-plugin-syntax-decorators": {
"version": "6.13.0",
"resolved": "http://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz",
"integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=",
"dev": true
},
"babel-plugin-syntax-dynamic-import": {
"version": "6.18.0",
"resolved": "http://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz",
"integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=",
"dev": true
},
"babel-plugin-syntax-exponentiation-operator": { "babel-plugin-syntax-exponentiation-operator": {
"version": "6.13.0", "version": "6.13.0",
"resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz",
@ -668,6 +715,17 @@
"integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=",
"dev": true "dev": true
}, },
"babel-plugin-transform-async-generator-functions": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz",
"integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=",
"dev": true,
"requires": {
"babel-helper-remap-async-to-generator": "^6.24.1",
"babel-plugin-syntax-async-generators": "^6.5.0",
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-transform-async-to-generator": { "babel-plugin-transform-async-to-generator": {
"version": "6.24.1", "version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz",
@ -679,6 +737,31 @@
"babel-runtime": "^6.22.0" "babel-runtime": "^6.22.0"
} }
}, },
"babel-plugin-transform-class-properties": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz",
"integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=",
"dev": true,
"requires": {
"babel-helper-function-name": "^6.24.1",
"babel-plugin-syntax-class-properties": "^6.8.0",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1"
}
},
"babel-plugin-transform-decorators": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz",
"integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=",
"dev": true,
"requires": {
"babel-helper-explode-class": "^6.24.1",
"babel-plugin-syntax-decorators": "^6.13.0",
"babel-runtime": "^6.22.0",
"babel-template": "^6.24.1",
"babel-types": "^6.24.1"
}
},
"babel-plugin-transform-es2015-arrow-functions": { "babel-plugin-transform-es2015-arrow-functions": {
"version": "6.22.0", "version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz",
@ -1012,6 +1095,63 @@
} }
} }
}, },
"babel-preset-es2015": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz",
"integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=",
"dev": true,
"requires": {
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-plugin-transform-es2015-computed-properties": "^6.24.1",
"babel-plugin-transform-es2015-destructuring": "^6.22.0",
"babel-plugin-transform-es2015-duplicate-keys": "^6.24.1",
"babel-plugin-transform-es2015-for-of": "^6.22.0",
"babel-plugin-transform-es2015-function-name": "^6.24.1",
"babel-plugin-transform-es2015-literals": "^6.22.0",
"babel-plugin-transform-es2015-modules-amd": "^6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-plugin-transform-es2015-modules-systemjs": "^6.24.1",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-plugin-transform-es2015-object-super": "^6.24.1",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "^6.24.1",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "^6.22.0",
"babel-plugin-transform-es2015-unicode-regex": "^6.24.1",
"babel-plugin-transform-regenerator": "^6.24.1"
}
},
"babel-preset-stage-2": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz",
"integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=",
"dev": true,
"requires": {
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators": "^6.24.1",
"babel-preset-stage-3": "^6.24.1"
}
},
"babel-preset-stage-3": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz",
"integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=",
"dev": true,
"requires": {
"babel-plugin-syntax-trailing-function-commas": "^6.22.0",
"babel-plugin-transform-async-generator-functions": "^6.24.1",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-exponentiation-operator": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.22.0"
}
},
"babel-register": { "babel-register": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
@ -10778,6 +10918,12 @@
"integrity": "sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==", "integrity": "sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ==",
"dev": true "dev": true
}, },
"vue-events": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/vue-events/-/vue-events-3.1.0.tgz",
"integrity": "sha512-JoE6ZlIEFdpj/vE7oW6T1T3Vz2h0Zxc4XEyz92L2tiRVc1TZ0u/nY1s6ZrnpHKoVxeEU0ouAp/FMxTKI3JBpvA==",
"dev": true
},
"vue-hot-reload-api": { "vue-hot-reload-api": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz",
@ -10872,6 +11018,44 @@
"integrity": "sha512-x3LV3wdmmERhVCYy3quqA57NJW7F3i6faas++pJQWtknWT+n7k30F4TVdHvCLn48peTJFRvCpxs3UuFPqgeELg==", "integrity": "sha512-x3LV3wdmmERhVCYy3quqA57NJW7F3i6faas++pJQWtknWT+n7k30F4TVdHvCLn48peTJFRvCpxs3UuFPqgeELg==",
"dev": true "dev": true
}, },
"vuetable-2": {
"version": "1.7.5",
"resolved": "https://registry.npmjs.org/vuetable-2/-/vuetable-2-1.7.5.tgz",
"integrity": "sha512-cKLD7ufbwNZZA1exOU1U7oXC+nrXq88YwDNAPL8dR9Kk1Pj/HMvLhOr4xw/15748c4OfYxBZQvVTJh4Hnu35AA==",
"dev": true,
"requires": {
"axios": "^0.15.3"
},
"dependencies": {
"axios": {
"version": "0.15.3",
"resolved": "http://registry.npmjs.org/axios/-/axios-0.15.3.tgz",
"integrity": "sha1-LJ1jiy4ZGgjqHWzJiOrda6W9wFM=",
"dev": true,
"requires": {
"follow-redirects": "1.0.0"
}
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.0.0.tgz",
"integrity": "sha1-jjQpjL0uF28lTv/sdaHHjMhJ/Tc=",
"dev": true,
"requires": {
"debug": "^2.2.0"
}
}
}
},
"watchpack": { "watchpack": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz",

View File

@ -9,12 +9,17 @@
}, },
"devDependencies": { "devDependencies": {
"axios": "^0.18", "axios": "^0.18",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.22.0",
"bootstrap-sass": "^3.3.7", "bootstrap-sass": "^3.3.7",
"cross-env": "^5.1", "cross-env": "^5.1",
"jquery": "^3.2", "jquery": "^3.2",
"laravel-mix": "^2.1.14", "laravel-mix": "^2.1.14",
"lodash": "^4.17.10", "lodash": "^4.17.10",
"vue": "^2.5.7" "vue": "^2.5.7",
"vue-events": "^3.0.0",
"vuetable-2": "^1.7.5"
}, },
"dependencies": { "dependencies": {
"datatables.net": "^1.10.15", "datatables.net": "^1.10.15",

View File

@ -1 +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()}}})}]); !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=53)}({53:function(t,e,a){t.exports=a(54)},54: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()}}})}});

1
public/js/app.js Normal file

File diff suppressed because one or more lines are too long

View File

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

View File

@ -0,0 +1,22 @@
/**
* 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');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('my-vuetable', require('./components/MyVuetable.vue'));
const app = new Vue({
el: '#app'
});

View File

@ -0,0 +1,18 @@
// MyVuetable.vue
<template>
<vuetable ref="vuetable"
api-url="https://vuetable.ratiw.net/api/users"
:fields="['name', 'email', 'birthdate']"
></vuetable>
</template>
<script>
import Vuetable from "vuetable-2/src/components/Vuetable";
export default {
components: {
Vuetable
}
};
</script>

View File

@ -1,5 +1,5 @@
<div class="sidebar-simplesearch"> <div class="sidebar-simplesearch">
{!! Form::open(array('route' => 'queries','method' => 'POST', 'class'=>'pure-form')) !!} {!! Form::open(array('route' => 'frontend.queries','method' => 'POST', 'class'=>'pure-form')) !!}
@ -23,7 +23,7 @@
} }
?> ?>
<a id="link-solrsearch-all-documents" class="link" href="{{ URL::route('queries1',['searchtype' => 'all']) }}"><?= $searchAllDocsText; ?> <a id="link-solrsearch-all-documents" class="link" href="{{ URL::route('frontend.queries1',['searchtype' => 'all']) }}"><?= $searchAllDocsText; ?>
</a> </a>
<!--<a class="link" href="">'resources.solrsearch_title_latest'</a>--> <!--<a class="link" href="">'resources.solrsearch_title_latest'</a>-->

View File

@ -12,7 +12,7 @@
<div class="pure-u-1 pure-u-md-2-3"> <div class="pure-u-1 pure-u-md-2-3">
<div class="content"> <div class="content">
<h1>Suche</h1> <h1>Suche</h1>
@include('rdr.solrsearch.simpleSearchForm') @include('frontend.partials.simpleSearchForm')
<div id="searchbar"> <div id="searchbar">
@if (isset($results)) @if (isset($results))
@ -25,7 +25,7 @@
@endif @endif
@if (!is_null($result->getAsset('title_output'))) @if (!is_null($result->getAsset('title_output')))
<a href="{{ route('document.show', $result->getId()) }}"> <a href="{{ route('frontend.dataset.show', $result->getId()) }}">
{{ $result->getAsset('title_output') }} {{ $result->getAsset('title_output') }}
</a> </a>
@else @else
@ -55,7 +55,7 @@
</div> </div>
@endif @endif
@include('rdr.solrsearch.pagination') @include('frontend.solrsearch.pagination')
</div> </div>
</div> </div>

View File

@ -18,5 +18,4 @@
</strong> </strong>
</p> </p>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@ -99,11 +99,11 @@
</p>--> </p>-->
</div> </div>
<div class="pure-u-1 pure-u-md-1-4 footer-funded"> <div class="pure-u-1 pure-u-md-1-4 footer-funded">
@role('administrator') {{-- @role('administrator')
I'm an administrator! I'm an administrator!
@else @else
I'm not an administrator... I'm not an administrator...
@endrole @endrole --}}
</div> </div>
<div class="pure-u-1 pure-u-md-1-4 footer-funded"> <div class="pure-u-1 pure-u-md-1-4 footer-funded">
</div> </div>

View File

@ -24,7 +24,7 @@
<div id="topmenu-inner"> <div id="topmenu-inner">
<nav class="pure-menu pure-menu-open pure-menu-horizontal"> <nav class="pure-menu pure-menu-open pure-menu-horizontal">
<ul class="pure-menu-list"> <ul class="pure-menu-list">
<li class="pure-menu-item {{ Route::currentRouteName() == 'home.index' ? 'active' : '' }}"> <li class="pure-menu-item {{ Route::currentRouteName() == 'frontend.home.index' ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ url('/') }}">HOME</a> <a class="pure-menu-link" href="{{ url('/') }}">HOME</a>
</li> </li>
@ -51,8 +51,8 @@
@else @else
<li class="pure-menu-item {{ Route::currentRouteName() == 'search.index' ? 'active' : '' }}"> <li class="pure-menu-item {{ Route::currentRouteName() == 'frontend.search.index' ? 'active' : '' }}">
<a class="pure-menu-link" href="{{ route('search.index') }}"> <a class="pure-menu-link" href="{{ route('frontend.search.index') }}">
<i class="fa fa-search" aria-hidden="true"></i> <i class="fa fa-search" aria-hidden="true"></i>
SEARCH SEARCH
</a> </a>

View File

@ -36,7 +36,10 @@
<label> <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> <p>
I accept {!! link_to_route('frontend.pages.show', trans('validation.attributes.backend.create-dataset.terms_and_conditions').'*', ['page_slug'=>'terms-and-conditions']) !!} I accept
<a target="_blank" href="{{ route("frontend.pages.show", ['page_slug'=>'terms-and-conditions']) }}">
{!! trans('validation.attributes.backend.create-dataset.terms_and_conditions').'*' !!}
</a>
</p> </p>
</label> </label>
</div> </div>

View File

@ -0,0 +1,28 @@
<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<div id="app">
<div class="container">
<my-vuetable></my-vuetable>
</div>
</div>
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>

View File

@ -190,7 +190,7 @@ Route::group(['middleware' => ['permission:settings']], function () {
]); ]);
}); });
//=================================================home fronmtend controller======================================= //=================================================home frontend controller=======================================
/* /*
* Frontend Routes * Frontend Routes
* Namespaces indicate folder structure * Namespaces indicate folder structure
@ -230,11 +230,6 @@ Route::group(['namespace' => 'Frontend', 'as' => 'frontend.'], function () {
* Show pages * Show pages
*/ */
Route::get('pages/{slug}', 'HomeController@showPage')->name('pages.show'); Route::get('pages/{slug}', 'HomeController@showPage')->name('pages.show');
});
//=================================================solr search==================================================== //=================================================solr search====================================================
Route::get('/index', [ Route::get('/index', [
@ -247,6 +242,8 @@ Route::get('/queries/', [
'as' => 'queries1', 'uses' => 'SearchController@search', 'as' => 'queries1', 'uses' => 'SearchController@search',
]); ]);
Route::get('/ping', 'SearchController@ping'); Route::get('/ping', 'SearchController@ping');
});
//=================================================borrow==================================================== //=================================================borrow====================================================
Route::get('borrow', [ Route::get('borrow', [
'as' => 'borrow.borrow', 'uses' => 'BorrowController@index', 'as' => 'borrow.borrow', 'uses' => 'BorrowController@index',

View File

@ -15,6 +15,7 @@ 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/datasetPublish.js', 'public/backend/publish') mix.js('resources/assets/js/datasetPublish.js', 'public/backend/publish')
.js('resources/assets/js/app.js', 'public/js')
.scripts([ .scripts([
'node_modules/datatables.net/js/jquery.dataTables.js', 'node_modules/datatables.net/js/jquery.dataTables.js',
'node_modules/datatables.net-buttons/js/dataTables.buttons.js', 'node_modules/datatables.net-buttons/js/dataTables.buttons.js',