Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3.16k stars 894 forks source link

Checkbox for checkbox field in table view? #61

Closed wiretail closed 8 years ago

wiretail commented 8 years ago

What would you think about showing a checkbox field in the list table view, as a checkbox vs 1/0? (Not sure the direction you might be going on these, so didn't want to just create a pull request.)

I'm using this, around line 90 in list.blade.php, myself:

@elseif (isset($column['type']) && $column['type']=='checkbox')   
    {{-- checkbox with loose false/null/0 checking --}}
    <td><input type="checkbox"
        @unless(strip_tags($entry->{$column['name']}) == false)
            checked = "checked"
        @endunless
    ></td>

PS. Started using backpack pretty heavily on a new project -- thanks so much for creating this, and making it so flexible!

tabacitu commented 8 years ago

Hmm... I think it's a great idea and I'd be happy to merge it, but perhaps the font-awesome checkbox icons would be more appropriate? Checkboxes are actionable, people expect them to do something, while icons are just informative, so I think icons would be a better match here.

Great to hear that you're enjoying it. I'm pretty busy right now, but as soon as I find some time, I'll be working on the next major version, which comes with:

wiretail commented 8 years ago

Awesome!

If you want to close this, I can create a pull once I get the final icon version done. Although might make more sense to wait for the next version with custom fields so it works more like the other form template snippets, that are easy to override.

Also have done some other things like user login-as/impersonation and filtered/sublist reordering (with foreign key labels, as I'm actually reordeing a pivot in one case) ...but those rely on hacked-in new buttons and such, so probably best to send your way, into the next version you mentioned.

I'm also still transitioning from an overdue and long time use of CodeIgniter to Laravel this year, so sometimes still learning the best ways to do things. :) That'll give me some time to refine the code too...

Thanks again!

tabacitu commented 8 years ago

That. Sounds. AWESOME :-) Always happy to see what you've done with it and see new solutions.

It's ok either way - you can submit the pull request now and I'll port it to v3 OR you can submit a pull request then. Let's leave the issue open until we do it, so we don't forget.

Cheers!

tabacitu commented 8 years ago

I beat you to it! :-) I've done it for 2.1, where extending columns is just like extending fields (just another blade file). 2.1 is on the dev branch righ now - will release after more testing and documentation.

I say it looks pretty good, right? screen shot 2016-07-22 at 15 12 10