-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 120f3ae
Showing
18 changed files
with
563 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace Salaback\LiquidCMS; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class PackageServiceProvider extends ServiceProvider | ||
{ | ||
|
||
/** | ||
* Perform post-registration booting of services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
if (! $this->app->routesAreCached()) { | ||
require __DIR__ . '/routes.php'; | ||
} | ||
|
||
$this->publishes([ | ||
__DIR__ . '/src/config.php' => config_path('liquid.php'), | ||
]); | ||
|
||
$this->publishes([ | ||
__DIR__ . '/src/assets' => public_path('vendor/liquidcms'), | ||
], 'public'); | ||
|
||
$this->publishes([ | ||
__DIR__ . '/src/migrations/' => database_path('migrations') | ||
], 'migrations'); | ||
|
||
|
||
|
||
//Load in the classes | ||
|
||
|
||
} | ||
|
||
|
||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
$this->loadViewsFrom(__DIR__.'/views', 'liquid'); | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
* | ||
* @return array | ||
*/ | ||
public function provides() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "salaback/liquidcms", | ||
"description": "An inline focused CMS", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Sean Alaback", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "dev", | ||
"require": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Salaback\LiquidCMS\Http; | ||
|
||
use App\Http\Controllers\Controller; | ||
use CityNexus\CityNexus\Property; | ||
use CityNexus\CityNexus\DatasetQuery; | ||
use CityNexus\CityNexus\GenerateScore; | ||
use CityNexus\CityNexus\Score; | ||
use CityNexus\CityNexus\Setting; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Schema; | ||
use CityNexus\CityNexus\Table; | ||
use CityNexus\CityNexus\ScoreBuilder; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Salaback\LiquidCMS\Route; | ||
|
||
|
||
class CMSController extends Controller | ||
{ | ||
public function postCreatePage(Request $request) | ||
{ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
namespace Salaback\LiquidCMS\Http; | ||
|
||
use App\Http\Controllers\Controller; | ||
use CityNexus\CityNexus\Property; | ||
use CityNexus\CityNexus\DatasetQuery; | ||
use CityNexus\CityNexus\GenerateScore; | ||
use CityNexus\CityNexus\Score; | ||
use CityNexus\CityNexus\Setting; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Schema; | ||
use CityNexus\CityNexus\Table; | ||
use CityNexus\CityNexus\ScoreBuilder; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Salaback\LiquidCMS\Route; | ||
|
||
|
||
class PublicController extends Controller | ||
{ | ||
public function getIndex($a = null, $b = null, $c = null, $d = null, $e = null, $f = null) | ||
{ | ||
$slugs = [$a, $b, $c, $d, $e, $f, 'null']; | ||
|
||
$route = $this->findRoute($slugs); | ||
|
||
if($route == 404) | ||
{ | ||
if(Auth::getUser() && Auth::getUser()->admin == true) | ||
{ | ||
|
||
} | ||
else{ | ||
return response('Route does not exist', 404); | ||
} | ||
} | ||
|
||
return view('liquid::' . $route->template) | ||
->with('page', $route->page); | ||
} | ||
|
||
|
||
private function findRoute($slugs) | ||
{ | ||
$return = null; | ||
// Check each slug for existing route info | ||
foreach($slugs as $depth => $slug) | ||
{ | ||
// If there is a slug at this depth | ||
if($slug != null) | ||
{ | ||
// Find the first route of the same slug and depth | ||
|
||
$route = Route::where('slug', $slug)->where('depth', $depth)->first(); | ||
|
||
// If no route exists matching the slug and depth return a 404 error | ||
if($route == null) | ||
{ | ||
$return = 404; | ||
} | ||
|
||
// If a route does exist, save it to the return variable and start the loop at the next depth | ||
else | ||
{ | ||
$return = $route; | ||
} | ||
} | ||
|
||
// If there is no slug, return the last route model found. | ||
else | ||
{ | ||
return $return; | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| 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::controller('/', 'Salaback\LiquidCMS\Http\PublicController'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
return [ | ||
'theme' => 'app', | ||
'section' => 'content' | ||
]; |
34 changes: 34 additions & 0 deletions
34
src/migrations/2015_06_13_010032_create_add_admin_to_user_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateAddAdminTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('users', function(Blueprint $table) | ||
{ | ||
$table->boolean('admin')->default(false); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('users', function(Blueprint $table) | ||
{ | ||
$table->dropColumn('admin'); | ||
}); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/migrations/2015_06_13_010032_create_contents_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateContentsTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('contents', function(Blueprint $table) | ||
{ | ||
$table->increments('id'); | ||
$table->text('content')->nullable(); | ||
$table->integer('block_id'); | ||
$table->integer('created_by'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('contents'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateBlocksTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('blocks', function(Blueprint $table) | ||
{ | ||
$table->increments('id'); | ||
$table->string('slug'); | ||
$table->integer('page_id'); | ||
$table->integer('content_id')->nullable(); | ||
$table->integer('updated_by'); | ||
$table->integer('created_by'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('blocks'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
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'); | ||
$table->string('template'); | ||
$table->json('keywords')->nullable(); | ||
$table->integer('updated_by'); | ||
$table->integer('created_by'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('pages'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateRoutesTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('routes', function(Blueprint $table) | ||
{ | ||
$table->increments('id'); | ||
$table->string('slug'); | ||
$table->integer('depth'); | ||
$table->integer('page_id')->nullable(); | ||
$table->integer('updated_by'); | ||
$table->integer('created_by'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('routes'); | ||
} | ||
|
||
} |
Oops, something went wrong.