Skip to content

Commit

Permalink
1) Helper Message is added for 'Links' section. 2) addHelperMessage m…
Browse files Browse the repository at this point in the history
…ethod is added to CrudController.
  • Loading branch information
alenoosh committed Aug 31, 2015
1 parent feed4f8 commit c5e2b9b
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 80 deletions.
4 changes: 4 additions & 0 deletions public/css/global.less
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,7 @@ a.btn.btn-default.main-link {
a.btn.btn-default.dropdown-toggle.main-link {
padding-top : 7px;
}

.help-title {
margin-top: 0px;
}
3 changes: 3 additions & 0 deletions public/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7834,6 +7834,9 @@ a.btn.btn-default.main-link span.icon {
a.btn.btn-default.dropdown-toggle.main-link {
padding-top: 7px;
}
.help-title {
margin-top: 0px;
}
/*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
Expand Down
97 changes: 44 additions & 53 deletions src/controllers/CrudController.php
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'));
}


}
51 changes: 25 additions & 26 deletions src/controllers/LinkController.php
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();
}
}
}
10 changes: 9 additions & 1 deletion src/views/edit.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
@extends('panelViews::mainTemplate')
@section('page-wrapper')

@if ($helper_message)
<div>&nbsp;</div>
<div class="alert alert-info">
<h3 class="help-title">{{ trans('rapyd::rapyd.help') }}</h3>
{{ $helper_message }}
</div>
@endif

<p>
{!! $edit !!}
</p>
@stop

0 comments on commit c5e2b9b

Please sign in to comment.