leskhq / Laravel-Enterprise-Starter-Kit

👔 Enterprise Web application starter kit or template using Laravel
http://lesk.it
GNU General Public License v3.0
361 stars 175 forks source link

Will CRUD and Grids eventually be part of L51ESK? #15

Open tamer-hassan opened 8 years ago

tamer-hassan commented 8 years ago

Dear Sebastian,

I was just wondering what is your choice of CRUD and Grids in general? And will one be eventually integrated in L51ESK? I come from Yii2 framework and miss things like Gii code generator (module built-in Yii2) and kartik-v/yii2-grid extension

For a start, I've used Nayjest/Grids for a simple listing & export to csv/excel functionality, and dealing with a one-to-many relation was a breeze, but I'm now looking into complete CRUD grids solution such as:

LaravelPanel looks like it uses (forked-)rapyd for its CRUD functionality, so I guess the same could be accomplished with L51ESK + rapyd. Don't you think?

On a sidenote, I've also purchased and used jQuery DataTables Editor extensively in the past, but only in standalone/custom projects not specifically based on full-blown framework. But I've now also discovered DataTables Editor Interface to Laravel 5 which adds yet another option.

sroutier commented 8 years ago

Hello Tamer,

I totally need this and hope to integrate something like that in l51esk. That is actually one of the features from Yii2 that I wish was easier to do in Laravel.

"zofe/rapyd-laravel" looks really promising and following the example from LaravelPanel we should be able to integrate rapyd-laravel without too much trouble. Are you volunteering to do it?

Cheers. /S

tamer-hassan commented 8 years ago

Yep. Count me in.

sroutier commented 8 years ago

;-) Awesome! Thanks man.

tamer-hassan commented 8 years ago

This is the forked project: https://github.com/serverfireteam/rapyd-laravel Currently: This branch is 47 commits ahead, 124 commits behind zofe:master. Latest commit 80b88dd 2 days ago (Jan 10)

tamer-hassan commented 8 years ago

My main concern was about the text editor, because of this issue (about redactor support being dropped for it going commercial) in the upstream project: https://github.com/zofe/rapyd-laravel/issues/62 As you can see in the comments I and someone else were recommending TinyMCE (LGPL 2.1).

I'm pleased to discover TinyMCE already looks to be integrated in serverfireteam/rapyd-laravel fork: https://github.com/serverfireteam/rapyd-laravel/commit/d1810ce1cf08c2d5725dbc74553cbeb86f97add7

sroutier commented 8 years ago

Good stuff, man. So you would recommend using https://github.com/serverfireteam/rapyd-laravel instead of https://github.com/zofe/rapyd-laravel ?

tamer-hassan commented 8 years ago

I merged serverfireteam/rapyd-laravel master with l51esk master. Linked it up, including the demo routes, demo runs, clicking populate database indeed populates db, but then every other tab of the demo has its own set of issues. Ex. DataSet tab had issue with old use Illuminate\Html\HtmlFacade instead of the Collective, and then more issues. Seeing as things like this are already fixed upstream makes me more leaning to track zofe/rapyd-laravel and integrate TinyMCE myself. It's good also that zofe/rapyd-laravel dev-master is on laravel 5.1 So I'm still working on it. :)

tamer-hassan commented 8 years ago

It works well and it was way too easy to add that I consider I did nothing..

Merged (with history) into a 'rapyd' branch, ready for Pull Request: https://github.com/thassan/laravel-5.1-enterprise-starter-kit/commits/rapyd

But even though i required the rapyd routes file within authorize middleware group, the /rapyd-demo route does not ask me to login. Haven't looked into this yet.

tamer-hassan commented 8 years ago

Now I would love to redo the admin/* routes in l51esk (at least users,permissions,roles,routes) with rapyd and using at least the following modules:

sroutier commented 8 years ago

Hello Tamer,

Man, you have been burning the midnight oil lately! Can't wait to try the CRUD/GRID. Send me a Pull-request and I will merge it in.

Yes, now we totally have to rebuild the admin/* page with your suggestions. But let me merge your basic CRUD/GRID changes and my dynamic menu and crumbtrail before. Otherwise I am afraid it may be just too much to handle at once. I will hurry and commit the menu patch asap.

/s

tamer-hassan commented 8 years ago

Pull Request #18 submitted. Cheers /T

sroutier commented 8 years ago

Holy smokes! this is huge. I am a little surprised. You pull request looks like it contains the entire rapyd source, could the rapyd-laravel package not simply be added as a dependency in our composer.json? Would that not be easier?

/s

tamer-hassan commented 8 years ago

I was doing that in hopes I could later modify rapyd source to use TinyMCE editor. But since that is an overkill, dropped and recreated branch rapyd and only added it via composer this time (both composer.json and composer.lock updated) Pull Request #19 resent

After merging and composer update zofe/rapyd, you will need to do the following (and possibly add it to README):

./artisan vendor:publish

Uncomment the following near the end of app/Http/routes.php //require __DIR__.'/rapyd.php';

Optionally, you may need to uncomment the demo route in app/Http/rapyd.php if its not already uncommented: // Route::controller('rapyd-demo','\Zofe\Rapyd\Demo\DemoController');

sroutier commented 8 years ago

Ah I see. If you want to get TinyMCE editor working in rapyd I would suggest forking your own repository of that and when you get that working we can always point L51ESK to your version. But were the author of rapyd not already working on switching to TinyMCE?

Thanks for the pull-request. I can't wait to try it, that will be awesome. /s

tamer-hassan commented 8 years ago

The authors of LaravelPanel forked way back for a reason. The author dropped support for Readactor.js as announced in (still open since Aug 1, 2014) https://github.com/zofe/rapyd-laravel/issues/62

sroutier commented 8 years ago

Wow... 2014... What do they use now if not TinyMCE and dropped Readactor.js?

tamer-hassan commented 8 years ago

still using the old v7.6.1 of 2012, it "was" mit licensed (so open source), before it went commercial :)

sroutier commented 8 years ago

Well if you are interested in upgrading them to TinyMCE, I am sure they would appreciate.

tamer-hassan commented 8 years ago

looks like redactor.min.js still included.. it is 11kb In https://github.com/zofe/rapyd-laravel/issues/62 , Zofe expressed he would go with summernote, probably cuz of average size minified js (around 60kb back then when mentioned, ~86kb today) I realize TinyMCE (Community Edition) minified js is 366kb. That is more than four times summernote. For me it is not an issue, especially given the advantage of some 44 plugins (tiny-in-size) with TinyMCE. But, I fear the author may not accept it.

In any case I will fork, integrate, and send a PR to Zofe.

Thanks for merging.

sroutier commented 8 years ago

Thanks for pointing me to rapyd. I have been looking at that package all evening. Really interesting. Now I have to fix all the admin/* pages... Can't leave them with the old code, would not be cool ;-).

I also would not mind using a 366kb file for TinyMCE with all the plugins, but when bandwidth is limited or when the client is mobile or "simple" one may want a smaller option. Perhaps both could be available either as an configuration option set at the app level or if the app detects a slow link or light client it would serve the smaller variant. Just an idea.

Thanks again. /s

sroutier commented 8 years ago

Hello Tamer,

I am thinking about revisiting this issue.

Rapyd-Laravel seems to be very good at doing what it was design to do: a single package to provide both grids and CRUD, but after experimenting with it this weekend, it appears hard to customize, to me at least. The ability to add actions for each row in a grid is present, but only the action that are already known (ie: show,modify,delete). Adding a custom action is not possible without changing the code. I cannot see how to render a row differently from the others based on the state of the object/model, meaning a way to show that the object is either enabled or disabled? The views that we would need to customize are not published, so we would have to fork our own version and try to maintain that fork ourselves.

I am wondering if you have had a chance to experiment a little more with the rapyd-laravel package? Has your experience been different? Maybe I am just missing something.

Otherwise perhaps looking at other options may be better. Perhaps packages that separate grids/datatable and CRUD and allow more flexibility.

What do you think?

/s

tamer-hassan commented 8 years ago

Hello Sebastian,

I apologize for the long delay in response. Just a few days ago, I started to get back on track with my project based on L51ESK, and just the last 2-3 days I have been playing a lot with rapyd.

I've used a custom action with DataGrid as follows:

$grid->add('<a href="/profile/{{ $username }}"><span class="glyphicon glyphicon-eye-open"></span></a>', 'Show');

And according to Zofe, https://github.com/zofe/rapyd-laravel/issues/73#issuecomment-52124306

with blade inline parse you can also use your own static functions. you can also use closures, as explained here https://github.com/zofe/rapyd-laravel/wiki/DataGrid

a special column like "edit" is only intended to link another widget action

Hope this helps.

tamer-hassan commented 8 years ago

I think this (using closures) would accomplish what you need:

$grid->add('enabled', 'Status')->cell( function ($value) {
    if ($value == 1)
    {
            return '<a href="{!! route('admin.users.disable', $user->id) !!}" title="Disable"><i class="fa fa-check-circle-o enabled"></i></a>';
    }
    else
    {
        return '<a href="{!! route('admin.users.enable', $user->id) !!}" title="Enable"><i class="fa fa-ban disabled"></i></a>';
    }
 });

This (from the documentation) is also helpful :)

    //row and cell manipulation via closure
    $grid->row(function ($row) {
       if ($row->cell('public')->value < 1) {
           $row->cell('title')->style("color:Gray");
           $row->style("background-color:#CCFF66");
       }  
    });