-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Helper Message is added for 'Links' section. 2) addHelperMessage m…
…ethod is added to CrudController.
- Loading branch information
Showing
5 changed files
with
85 additions
and
80 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
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
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 |
---|---|---|
@@ -1,111 +1,102 @@ | ||
<?php | ||
namespace Serverfireteam\Panel; | ||
|
||
|
||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
use Illuminate\Routing\Controller; | ||
|
||
class CrudController extends Controller | ||
{ | ||
|
||
|
||
public $grid; | ||
public $entity; | ||
public $set; | ||
public $edit; | ||
public $filter; | ||
public $grid; | ||
public $entity; | ||
public $set; | ||
public $edit; | ||
public $filter; | ||
protected $lang; | ||
public $helper_message; | ||
|
||
public function __construct(\Lang $lang) | ||
{ | ||
{ | ||
// $this->entity = $params['entity']; | ||
$route = \App::make('route'); | ||
$this->lang = $lang; | ||
$this->route = $route; | ||
$routeParamters = $route::current()->parameters(); | ||
$this->setEntity($routeParamters['entity']); | ||
$routeParamters = $route::current()->parameters(); | ||
$this->setEntity($routeParamters['entity']); | ||
} | ||
|
||
/** | ||
* @param string $entity name of the entity | ||
*/ | ||
public function all($entity) | ||
{ | ||
//$this->addStylesToGrid(); | ||
{ | ||
//$this->addStylesToGrid(); | ||
} | ||
|
||
/** | ||
* @param string $entity name of the entity | ||
*/ | ||
public function edit($entity) | ||
{ | ||
|
||
} | ||
|
||
} | ||
|
||
public function getEntity(){ | ||
public function getEntity() { | ||
return $this->entity; | ||
} | ||
|
||
public function setEntity($entity){ | ||
public function setEntity($entity) { | ||
$this->entity = $entity; | ||
} | ||
public function addStylesToGrid($orderByColumn = 'id',$paginateCount = 10) | ||
|
||
public function addStylesToGrid($orderByColumn = 'id', $paginateCount = 10) | ||
{ | ||
|
||
$this->grid->edit('edit', trans('panel::fields.edit'), 'show|modify|delete'); | ||
|
||
$this->grid->orderBy($orderByColumn, 'desc'); | ||
$this->grid->paginate($paginateCount); | ||
|
||
$this->grid->paginate($paginateCount); | ||
} | ||
|
||
public function addHelperMessage($message) | ||
{ | ||
$this->helper_message = $message; | ||
} | ||
|
||
public function returnView() | ||
{ | ||
$configs = \Serverfireteam\Panel\Link::returnUrls(); | ||
if ( !isset($configs) || $configs == null ){ | ||
throw new \Exception('NO URL is set for yet'); | ||
} else if( !in_array($this->entity, $configs)){ | ||
throw new \Exception('This url is not set yet!'); | ||
} else { | ||
|
||
if (!isset($configs) || $configs == null) { | ||
throw new \Exception('NO URL is set yet !'); | ||
} else if (!in_array($this->entity, $configs)) { | ||
throw new \Exception('This url is not set yet!'); | ||
} else { | ||
return \View::make('panelViews::all', array( | ||
'grid' => $this->grid, | ||
'filter' => $this->filter, | ||
'title' => $this->entity , | ||
'current_entity' => $this->entity, | ||
'import_message' => (\Session::has('import_message')) ? \Session::get('import_message') : '' | ||
)); | ||
} | ||
)); | ||
} | ||
} | ||
|
||
public function returnEditView() | ||
{ | ||
$configs = \Serverfireteam\Panel\Link::returnUrls(); | ||
|
||
if ( !isset($configs) || $configs == null ){ | ||
throw new \Exception('NO URL is set for yet'); | ||
} else if( !in_array($this->entity, $configs)){ | ||
throw new \Exception('This url is set yet !'); | ||
} else { | ||
return \View::make('panelViews::edit', array( | ||
'title' => $this->entity , | ||
'edit' => $this->edit | ||
)); | ||
} | ||
|
||
if (!isset($configs) || $configs == null) { | ||
throw new \Exception('NO URL is set yet !'); | ||
} else if (!in_array($this->entity, $configs)) { | ||
throw new \Exception('This url is not set yet !'); | ||
} else { | ||
return \View::make('panelViews::edit', array('title' => $this->entity, | ||
'edit' => $this->edit, | ||
'helper_message' => $this->helper_message)); | ||
} | ||
} | ||
public function finalizeFilter(){ | ||
|
||
public function finalizeFilter() { | ||
$lang = \App::make('lang'); | ||
$this->filter->submit($this->lang->get('panel::fields.search')); | ||
$this->filter->reset($this->lang->get('panel::fields.reset')); | ||
} | ||
|
||
|
||
} |
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 |
---|---|---|
@@ -1,54 +1,53 @@ | ||
<?php | ||
|
||
namespace Serverfireteam\Panel; | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
use Serverfireteam\Panel\CrudController; | ||
/** | ||
* Description of PagePanel | ||
* | ||
* @author alireza | ||
*/ | ||
class LinkController extends CrudController{ | ||
|
||
public function all($entity){ | ||
parent::all($entity); | ||
|
||
class LinkController extends CrudController { | ||
|
||
public function all($entity) { | ||
|
||
parent::all($entity); | ||
|
||
$this->filter = \DataFilter::source(new Link()); | ||
$this->filter->add('id', 'ID', 'text'); | ||
$this->filter->add('name', 'Name', 'text'); | ||
$this->filter->submit('search'); | ||
$this->filter->reset('reset'); | ||
$this->filter->build(); | ||
|
||
$this->grid = \DataGrid::source($this->filter); | ||
$this->grid->add('id','ID', true)->style("width:100px"); | ||
$this->grid->add('display','Display'); | ||
$this->grid->add('url','Model'); | ||
$this->grid->add('id', 'ID', true)->style("width:100px"); | ||
$this->grid->add('display', 'Display'); | ||
$this->grid->add('url', 'Model'); | ||
|
||
$this->addStylesToGrid(); | ||
|
||
return $this->returnView(); | ||
} | ||
public function edit($entity){ | ||
|
||
public function edit($entity) { | ||
|
||
parent::edit($entity); | ||
|
||
$this->edit = \DataEdit::source(new Link()); | ||
|
||
Link::creating(function($link) | ||
{ | ||
//dd(__DIR__); | ||
$appHelper = new libs\AppHelper(); | ||
return ( class_exists( $appHelper->getNameSpace() . $link['url'] )); | ||
return ( class_exists( $appHelper->getNameSpace() . $link['url'] )); | ||
}); | ||
|
||
$this->edit->label('Edit Admin'); | ||
|
||
$helpMessage = trans('rapyd::rapyd.links_help'); | ||
|
||
$this->edit->label('Edit Links'); | ||
$this->edit->link("rapyd-demo/filter", "Articles", "TR")->back(); | ||
$this->edit->add('display', 'Display', 'text'); | ||
$this->edit->add('url', 'link', 'text'); | ||
|
||
$this->addHelperMessage($helpMessage); | ||
|
||
return $this->returnEditView(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,15 @@ | ||
@extends('panelViews::mainTemplate') | ||
@section('page-wrapper') | ||
|
||
@if ($helper_message) | ||
<div> </div> | ||
<div class="alert alert-info"> | ||
<h3 class="help-title">{{ trans('rapyd::rapyd.help') }}</h3> | ||
{{ $helper_message }} | ||
</div> | ||
@endif | ||
|
||
<p> | ||
{!! $edit !!} | ||
</p> | ||
@stop | ||
|