-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #155 Added click-to-toggle for boolean columns (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #155). Discussion ---------- Added click-to-toggle for boolean columns This PR allows to click on any boolean value displayed in a listing to toggle its value: if you click on a `YES` value, you change it to `NO` and *vice versa*. This is a WIP pull request to hear your opinions: I need to clean JavaScript code a bit, add PHPdoc, document the feature, etc. I first saw this cool feature in SonataAdmin. I don't know if this feature is an original idea of Sonata project or if they copied it from someone else. In any case, thanks to whoever invented this feature and all the credits for the idea goes to him/her. ----- **This is how it works** 1) If the boolean column corresponds to an entity property, you now can click on it to toggle its value: ![toggle_1](https://cloud.githubusercontent.com/assets/73419/6515398/bd82628e-c389-11e4-8106-60b19299f845.gif) 2) If the boolean column is a virtual field, you cannot click on it to toggle its value: ![toggle_2](https://cloud.githubusercontent.com/assets/73419/6515406/d241e97e-c389-11e4-859b-0affe892c958.gif) 3) When things go right, clicking on a boolean column toggles its value without having to edit the entity: ![toggle_3](https://cloud.githubusercontent.com/assets/73419/6515413/ee384d1c-c389-11e4-926a-5b913d9af8c7.gif) 4) If some error happens, the label shows a warning `ERROR` message until the page is reloaded: ![toggle_4](https://cloud.githubusercontent.com/assets/73419/6515418/fc183230-c389-11e4-9064-b3265db1abe9.gif) Commits ------- d08dcd8 Added click-to-toggle for boolean columns
- Loading branch information
Showing
6 changed files
with
179 additions
and
9 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/*! ======================================================================== | ||
* Bootstrap Toggle: bootstrap-toggle.css v2.2.0 | ||
* http://www.bootstraptoggle.com | ||
* ======================================================================== | ||
* Copyright 2014 Min Hur, The New York Times Company | ||
* Licensed under MIT | ||
* ======================================================================== */ | ||
.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-20px;margin-right:5px} | ||
.toggle{position:relative;overflow:hidden} | ||
.toggle input[type=checkbox]{display:none} | ||
.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;-moz-user-select:none;-webkit-user-select:none} | ||
.toggle.off .toggle-group{left:-100%} | ||
.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0} | ||
.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0} | ||
.toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px} | ||
.toggle.btn{min-width:59px;min-height:34px} | ||
.toggle-on.btn{padding-right:24px} | ||
.toggle-off.btn{padding-left:24px} | ||
.toggle.btn-lg{min-width:79px;min-height:45px} | ||
.toggle-on.btn-lg{padding-right:31px} | ||
.toggle-off.btn-lg{padding-left:31px} | ||
.toggle-handle.btn-lg{width:40px} | ||
.toggle.btn-sm{min-width:50px;min-height:30px} | ||
.toggle-on.btn-sm{padding-right:20px} | ||
.toggle-off.btn-sm{padding-left:20px} | ||
.toggle.btn-xs{min-width:35px;min-height:22px} | ||
.toggle-on.btn-xs{padding-right:12px} | ||
.toggle-off.btn-xs{padding-left:12px} |
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