Skip to content

Commit

Permalink
Merge branch 'multipleUI'
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyu65 committed Aug 18, 2017
2 parents 2a10834 + 35a0980 commit 8766304
Show file tree
Hide file tree
Showing 7,769 changed files with 736,236 additions and 290 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
12 changes: 11 additions & 1 deletion src/Config/umi.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@
|
*/

'assets_path' => 'umi',
'assets_path' => 'umi/ace',

/*
|--------------------------------------------------------------------------
| 前端UI 大替换, 默认有 lte(admin-LTE) 和 ace(ACE). current_ui对应blade总文件夹名称
| front-end UI can be changed, now has lte(admin-LTE) and ace. UI name
| is same as the blade folder name
|--------------------------------------------------------------------------
*/

'current_ui' => 'ace',

/*
|--------------------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion src/Http/Controllers/dashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace YM\Http\Controllers;

use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use YM\Models\User;

class DashBoardController extends Controller
{
Expand All @@ -33,6 +33,11 @@ protected function create(array $data)
]);
}

public function redirectPath()
{
return route('dashboard');
}

public function index()
{
######################get IP Information##############################
Expand Down
5 changes: 3 additions & 2 deletions src/Http/Controllers/fieldDisplayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use YM\Models\FieldDisplayRead;
use YM\Models\Table;
use YM\Umi\FactoryDataType;
use YM\Umi\umiFieldDisplayBuilder;
use YM\Umi\FactoryUI;

class fieldDisplayController extends Controller
{
Expand Down Expand Up @@ -42,7 +42,8 @@ public function display($table, $type)
#get and show all fields that exist
public function loadFields($table, $tableId)
{
$builder = new umiFieldDisplayBuilder();
$factoryUI = new FactoryUI();
$builder = $factoryUI->fieldDisplayUI();
return $builder->showExistRecords($table, $tableId);
}

Expand Down
19 changes: 9 additions & 10 deletions src/Http/Controllers/menuController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,27 @@
use YM\Models\Menu;
use YM\Models\UserMenu;
use YM\Umi\Common\Selector;
use YM\Umi\umiMenusBuilder;
use YM\Umi\FactoryUI;

class menuController extends Controller
{
private $menu;
private $menuBuilder;

public function __construct()
{
$this->menu = new Menu();

$factoryUI = new FactoryUI();
$this->menuBuilder = $factoryUI->nestableUI();
}

#加载所有菜单 并管理
#load all menus and manage
public function management(Request $request)
{
$menuBuilder = new umiMenusBuilder();

$tableName = $request->route()->parameter('table');
$menuTree = $menuBuilder->showDragDropTree($tableName, true);
$menuTree = $this->menuBuilder->showDragDropTree($tableName, true);

return view('umi::menu.sideMenu', [
'menuTree' => $menuTree,
Expand Down Expand Up @@ -70,8 +72,7 @@ public function distribution($tableName)
$property = $selector->serialize();
#endregion

$menuBuilder = new umiMenusBuilder();
$menuTree = $menuBuilder->showDragDropTree($tableName);
$menuTree = $this->menuBuilder->showDragDropTree($tableName);

return view('umi::menu.distribution', compact('menuTree', 'tableName', 'userTableName', 'property'));
}
Expand All @@ -80,8 +81,7 @@ public function distribution($tableName)
#reload all the menus from ajax request
public function loadMenuTree($table, $showButton = false, $buttonException = [])
{
$menuBuilder = new umiMenusBuilder();
$menuTree = $menuBuilder->showDragDropTree($table, $showButton, $buttonException);
$menuTree = $this->menuBuilder->showDragDropTree($table, $showButton, $buttonException);

#必须重新用js启动可拖拽功能
#must to be restart the drag function with js command
Expand All @@ -97,8 +97,7 @@ public function loadMenuTreeFromJson($table, $userId)
$json = $userMenu->userJsonMenu($userId);
$jsonArr = json_decode($json);

$menuBuilder = new umiMenusBuilder();
return $menuBuilder->showDragDropTreeByJson($jsonArr);
return $this->menuBuilder->showDragDropTreeByJson($jsonArr);
}

#更新用户菜单 以json方式进行数据存储
Expand Down
5 changes: 3 additions & 2 deletions src/Http/Controllers/umiTableAddController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Support\Facades\Config;
use YM\Facades\Umi;
use YM\Models\UmiModel;
use YM\Umi\umiTableBreadBuilder;
use YM\Umi\FactoryUI;

class umiTableAddController extends Controller
{
Expand Down Expand Up @@ -54,7 +54,8 @@ private function getTableFields($tableName, $defaultValue)
$umiModel = new UmiModel($tableNameLoadingFieldTable, 'order', 'asc');
$records = $umiModel->getRecordsByWhere('table_id', $tableId);

$builder = new umiTableBreadBuilder();
$factoryUI = new FactoryUI();
$builder = $factoryUI->tableBreadUI();
return $builder->display($records, $defaultValue, 'add');
}
}
5 changes: 3 additions & 2 deletions src/Http/Controllers/umiTableEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Support\Facades\Config;
use YM\Facades\Umi;
use YM\Models\UmiModel;
use YM\Umi\umiTableBreadBuilder;
use YM\Umi\FactoryUI;

class umiTableEditController extends Controller
{
Expand Down Expand Up @@ -68,7 +68,8 @@ private function getTableFields($tableName, $defaultValue)
$umiModel = new UmiModel($tableNameLoadingFieldTable, 'order', 'asc');
$records = $umiModel->getRecordsByWhere('table_id', $tableId);

$builder = new umiTableBreadBuilder();
$factoryUI = new FactoryUI();
$builder = $factoryUI->tableBreadUI();
return $builder->display($records, $defaultValue, 'edit');
}
#endregion
Expand Down
5 changes: 3 additions & 2 deletions src/Http/Controllers/umiTableReadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Support\Facades\Config;
use YM\Facades\Umi;
use YM\Models\UmiModel;
use YM\Umi\umiTableBreadBuilder;
use YM\Umi\FactoryUI;

class umiTableReadController extends Controller
{
Expand All @@ -29,7 +29,8 @@ private function getTableFields($tableName, $defaultValue)
$umiModel2 = new UmiModel($tableNameLoadingFieldTable, 'order', 'asc');
$records = $umiModel2->getRecordsByWhere('table_id', $tableId);

$builder = new umiTableBreadBuilder();
$factoryUI = new FactoryUI();
$builder = $factoryUI->tableBreadUI();
return $builder->display($records, $defaultValue, 'read');
}
#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/BreadAccessMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function handle($request, Closure $next, $action)

return $next($request);
}
}
}
8 changes: 7 additions & 1 deletion src/Models/UmiModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,14 @@ public function getRecordsByFields($fields)
public function getRecordsByWhere($where, $value, $useCache = true)
{
if ($this->openCache && $useCache) {

if ($this->order === 'asc')
return $this->cachedTable
->where($where, $value)
->sortBy($this->orderBy);
return $this->cachedTable
->where($where, $value);
->where($where, $value)
->sortByDesc($this->orderBy);
}

$ds = DB::table($this->tableName)
Expand Down
8 changes: 1 addition & 7 deletions src/Umi/Auth/AdminMasterPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@

namespace YM\Umi\Auth;

use YM\Umi\umiMenusBuilder;

class AdminMasterPage extends UmiMasterPageAbstract
{
private $menusBuilder;

public function __construct()
{
parent::__construct();

$this->menusBuilder = new umiMenusBuilder();
}

public function sideMenu()
{
return $this->menusBuilder->Menus();
return $this->masterPageMenuBuilder->Menus();
}
}
8 changes: 1 addition & 7 deletions src/Umi/Auth/SuperAdminMasterPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@

namespace YM\Umi\Auth;

use YM\Umi\umiMenusBuilder;

class SuperAdminMasterPage extends UmiMasterPageAbstract
{
private $menusBuilder;

public function __construct()
{
parent::__construct();

$this->menusBuilder = new umiMenusBuilder();
}

public function sideMenu()
{
return $this->menusBuilder->AllMenus();
return $this->masterPageMenuBuilder->AllMenus();
}
}
9 changes: 6 additions & 3 deletions src/Umi/Auth/UmiMasterPageAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
namespace YM\Umi\Auth;

use YM\Umi\Contracts\PrintHtml\MasterPageInterface;
use YM\Umi\umiMasterPageBuilder;
use YM\Umi\FactoryUI;

abstract class UmiMasterPageAbstract implements MasterPageInterface
{
private $masterPageBuilder;
protected $masterPageBuilder;
protected $masterPageMenuBuilder;

public function __construct()
{
$this->masterPageBuilder = new umiMasterPageBuilder();
$factoryUI = new FactoryUI();
$this->masterPageBuilder = $factoryUI->masterPageUI();
$this->masterPageMenuBuilder = $factoryUI->masterPageMenuUI();
}

public function header()
Expand Down
14 changes: 14 additions & 0 deletions src/Umi/Contracts/PageBuilder/dataTableInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace YM\Umi\Contracts\PageBuilder;

interface dataTableInterface
{
public function tableHeadAlert();

public function tableHead();

public function tableBody();

public function tableFoot();
}
8 changes: 8 additions & 0 deletions src/Umi/Contracts/PageBuilder/fieldDisplayInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace YM\Umi\Contracts\PageBuilder;

interface fieldDisplayInterface
{
public function showExistRecords($tableName, $tableId);
}
12 changes: 12 additions & 0 deletions src/Umi/Contracts/PageBuilder/masterPageInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace YM\Umi\Contracts\PageBuilder;

interface masterPageInterface
{
public function masterPageHead();

public function masterPageBody();

public function masterPageFoot();
}
19 changes: 19 additions & 0 deletions src/Umi/Contracts/PageBuilder/menusInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace YM\Umi\Contracts\PageBuilder;

interface menusInterface
{
public function AllMenus();

/**
* 根据不同的json加载不同菜单
* load different menus according to the json
* @param string $json
* - 为空 : 根据当前用户从数据库加载json get json by search from database according to current user
* - 不为空 : 根据参数加载json get json by the parameter has given
* @return string
* @throws Exception
*/
public function Menus($json = '');
}
10 changes: 10 additions & 0 deletions src/Umi/Contracts/PageBuilder/nestableInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace YM\Umi\Contracts\PageBuilder;

interface nestableInterface
{
public function showDragDropTree($tableName, $showButton = false, $buttonException = []);

public function showDragDropTreeByJson($jsonArr);
}
8 changes: 8 additions & 0 deletions src/Umi/Contracts/PageBuilder/searchInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace YM\Umi\Contracts\PageBuilder;

interface searchInterface
{
public function searchHtml();
}
8 changes: 8 additions & 0 deletions src/Umi/Contracts/PageBuilder/tableBreadInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace YM\Umi\Contracts\PageBuilder;

interface tableBreadInterface
{
public function display($records, $defaultValue, $buttonType);
}
5 changes: 3 additions & 2 deletions src/Umi/DataTable/AdminDataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

namespace YM\Umi\DataTable;

use YM\Umi\umiDataTableBuilder;
use YM\Umi\FactoryUI;

class AdminDataTable extends umiDataTableAbstract
{
private $umiDataTable;

public function __construct()
{
$this->umiDataTable = new umiDataTableBuilder();
$factoryUI = new FactoryUI();
$this->umiDataTable = $factoryUI->dataTableUI();
}

public function headerAlert()
Expand Down
Loading

0 comments on commit 8766304

Please sign in to comment.