1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-24 02:52:28 +01:00

fix middleware routing and few minor fixes

This commit is contained in:
devfake 2016-02-23 13:45:40 +01:00
parent 9cc3c562db
commit 0b7b648a59
6 changed files with 37 additions and 30 deletions

5
.gitignore vendored
View File

@ -1,6 +1,5 @@
.idea
.env
/backend/vendor
/client/node_modules
.env
/public/assets/js/app.js
/public/assets/css/app.css

View File

@ -1,20 +1,24 @@
<?php
// todo: Rewrite API.
Route::group(['prefix' => 'api', 'middleware' => ['web']], function() {
Route::group(['middleware' => ['web']], function() {
Route::get('all-categories', 'FloxController@allCategories');
Route::get('home-items/{category}/{orderBy}/{loading?}', 'FloxController@homeItems');
Route::get('category-items/{category}/{orderBy}/{loading?}', 'FloxController@categoryItems');
Route::get('more-category-items/{categoryID}/{orderBy}/{loading}/{loaded}', 'FloxController@moreCategoryItems');
Route::group(['prefix' => 'api'], function() {
Route::get('search/flox/{title}', 'FloxController@searchFloxByTitle');
Route::get('search/tmdb/{title}', 'TMDBController@searchTMDBByTitle');
Route::get('all-categories', 'FloxController@allCategories');
Route::get('home-items/{category}/{orderBy}/{loading?}', 'FloxController@homeItems');
Route::get('category-items/{category}/{orderBy}/{loading?}', 'FloxController@categoryItems');
Route::get('more-category-items/{categoryID}/{orderBy}/{loading}/{loaded}', 'FloxController@moreCategoryItems');
Route::post('new', 'FloxController@newItem');
Route::get('search/flox/{title}', 'FloxController@searchFloxByTitle');
Route::get('search/tmdb/{title}', 'TMDBController@searchTMDBByTitle');
Route::post('new', 'FloxController@newItem');
});
Route::get('/{uri}', function() {
return view('app');
})->where('uri', '(.*)');
});
Route::get('/{uri}', function() {
return view('app');
})->where('uri', '(.*)');

View File

@ -44,7 +44,7 @@ class Box extends React.Component {
<section className="box">
<div className="wrap">
<Link to="/" className="box-headline">
<Link to={config.uri + this.props.category.slug} className="box-headline">
{this.props.category.name} ({this.props.category.items_count.aggregate})
</Link>

View File

@ -30,9 +30,9 @@ class Header extends React.Component {
<nav className="site-nav">
<ul>
<li><Link to={config.uri}>All</Link></li>
<li><Link to={config.uri + 'movies'}>Movies</Link></li>
<li><Link to={config.uri + 'series'}>Series</Link></li>
<li><Link to={config.uri + 'animes'}>Animes</Link></li>
<li><Link to={config.uri + 'movies'} activeClassName="active">Movies</Link></li>
<li><Link to={config.uri + 'series'} activeClassName="active">Series</Link></li>
<li><Link to={config.uri + 'animes'} activeClassName="active">Animes</Link></li>
<li className="icon-search-wrap" onClick={this.changeModal.bind(this, 'flox')} title="Search in Flox">
<i className="icon-search"></i>
</li>

View File

@ -1,4 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Api from '../api';
import Item from './item';
@ -21,7 +22,7 @@ class Modal extends React.Component {
$('body').addClass('modal-active');
}, 200);
React.findDOMNode(this.refs.input).focus();
ReactDOM.findDOMNode(this.refs.input).focus();
setTimeout(() => {
this.setState({

View File

@ -35,8 +35,8 @@ var Api = function (_React$Component) {
}
}, {
key: 'items',
value: function items(type, category, filterBy, currentLoaded) {
return $.get(config.api + type + '-items/' + category + '/' + filterBy + '/' + currentLoaded);
value: function items(type, category, filterBy) {
return $.get(config.api + type + '-items/' + category + '/' + filterBy);
}
}, {
key: 'categoryItems',
@ -262,7 +262,7 @@ var Box = function (_React$Component) {
{ className: 'wrap' },
_react2.default.createElement(
_reactRouter.Link,
{ to: '/', className: 'box-headline' },
{ to: config.uri + this.props.category.slug, className: 'box-headline' },
this.props.category.name,
' (',
this.props.category.items_count.aggregate,
@ -292,7 +292,6 @@ var Box = function (_React$Component) {
value: function changeFilter(filterBy, category) {
var _this3 = this;
console.log(config);
_api2.default.changeUsersFilterFor(category, filterBy);
this.setState({
@ -300,7 +299,7 @@ var Box = function (_React$Component) {
});
setTimeout(function () {
_api2.default.items(_this3.props.type, _this3.props.category.slug, filterBy, _this3.props.currentLoaded).then(function (value) {
_api2.default.items(_this3.props.type, _this3.props.category.slug, filterBy).then(function (value) {
_this3.setState({
items: value.items
});
@ -614,7 +613,7 @@ var Header = function (_React$Component) {
null,
_react2.default.createElement(
_reactRouter.Link,
{ to: config.uri + 'movies' },
{ to: config.uri + 'movies', activeClassName: 'active' },
'Movies'
)
),
@ -623,7 +622,7 @@ var Header = function (_React$Component) {
null,
_react2.default.createElement(
_reactRouter.Link,
{ to: config.uri + 'series' },
{ to: config.uri + 'series', activeClassName: 'active' },
'Series'
)
),
@ -632,7 +631,7 @@ var Header = function (_React$Component) {
null,
_react2.default.createElement(
_reactRouter.Link,
{ to: config.uri + 'animes' },
{ to: config.uri + 'animes', activeClassName: 'active' },
'Animes'
)
),
@ -768,6 +767,10 @@ var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _api = require('../api');
var _api2 = _interopRequireDefault(_api);
@ -811,7 +814,7 @@ var Modal = function (_React$Component) {
$('body').addClass('modal-active');
}, 200);
_react2.default.findDOMNode(this.refs.input).focus();
_reactDom2.default.findDOMNode(this.refs.input).focus();
setTimeout(function () {
_this2.setState({
@ -910,7 +913,7 @@ var Modal = function (_React$Component) {
exports.default = Modal;
},{"../api":1,"./item":8,"react":226}],10:[function(require,module,exports){
},{"../api":1,"./item":8,"react":226,"react-dom":63}],10:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {