Skip to content

Commit

Permalink
added support for laravel 4
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaneGlee committed May 12, 2019
1 parent 29cd48c commit c22973a
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 2 deletions.
30 changes: 30 additions & 0 deletions src/Laravel4CoreServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace FocalStrategy\Core;

use Illuminate\Support\ServiceProvider;
use View;

require_once __DIR__.'/helpers.php';

class Laravel4CoreServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
}

/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
View::addNamespace('core', __DIR__.'/views_4');
}
}
2 changes: 0 additions & 2 deletions src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use FocalStrategy\Core\Buttons\Button;
use FocalStrategy\Core\DatatableInterface;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Support\Collection as SupportCollection;
use View;

class Page implements Renderable
Expand Down
8 changes: 8 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

if (!function_exists('view')) {
function view($template, $with = [])
{
return View::make($template, $with);
}
}
15 changes: 15 additions & 0 deletions src/views_4/button.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@if($button->isButton())
<button {{ $button->attributes() }}>
@if($button->getIcon() != '')
<span class="fa fa-{{ $button->getIcon() }}"></span>
@endif
{{ $button->getText() }}
</button>
@else
<a {{ $button->attributes() }}>
@if($button->getIcon() != '')
<span class="fa fa-{{ $button->getIcon() }}"></span>
@endif
{{ $button->getText() }}
</a>
@endif
18 changes: 18 additions & 0 deletions src/views_4/button_group_dropdown.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="btn-group">
@if($button->isButton())
<button {{ $button->attributes() }}>{{ $button->getText() }}</button>
@else
<a {{ $button->attributes() }}>{{ $button->getText() }}</a>
@endif
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
@foreach($button->buttons as $btn)
<li>
{{ $btn->render() }}
</li>
@endforeach
</ul>
</div>
6 changes: 6 additions & 0 deletions src/views_4/image_button.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@if($button->isButton())
<button {!! $button->attributes() !!}><img height="20" src="{{ $button->getImage() }}" /></button>
@else
<a {!! $button->attributes() !!}><img height="20" src="{{ $button->getImage() }}" /></a>
@endif

46 changes: 46 additions & 0 deletions src/views_4/page.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@extends('layouts.app')

@section('content')
<div class="container-fluid">
<div class="page-header mb-2">
<div class="row">
<div class="col-sm-12 col-md-8">
<h1>{{ $page_title ?? 'No Title' }}
@if (!empty($page_sub_title))
<small>{{ $page_sub_title }}</small>
@endif
</h1>
</div>
<div class="col-sm-12 col-md-4">
@if(isset($header_renderables) && count($header_renderables) > 0)
<div class="pull-right">
@foreach($header_renderables as $hr)
{!! $hr->render() !!}
@endforeach
</div>
@endif
</div>
</div>
</div>
@if(Config::get('app.debug'))
@if(isset($dev_errors) && count($dev_errors) > 0)
@foreach($dev_errors as $error)
<div class="alert alert-danger">
<strong>Developer Notice</strong>
{{ $error }}
</div>
@endforeach
@endif
@endif

@section('page_content')
@if(isset($data_dump))
<div class="card bg-light">
<div class="card-body">
<pre>{{ json_encode($data_dump,JSON_PRETTY_PRINT | JSON_HEX_TAG) }}</pre>
</div>
</div>
@endif
@show
</div>
@endsection
6 changes: 6 additions & 0 deletions src/views_4/post_button.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{ Form::open(['url' => $button->getRoute(),'style' => 'display:inline-block;']) }}
@foreach($button->data() as $key => $value)
{{ Form::hidden($key, $value) }}
@endforeach
<button type="submit" {!! $button->attributes() !!}>{{ $button->getText() }}</button>
{{ Form::close() }}

0 comments on commit c22973a

Please sign in to comment.