-
Notifications
You must be signed in to change notification settings - Fork 30
Removed iCheck dependency #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Actually, iCheck is an AdminLTE's dependency. That is thanks to this plugin checkboxes are rendered with a better look in all templates. Maybe there is some places it is mal-initialized and not working properly? |
|
@sescandell I do not use the AdminLTE templates, but when I search this repository I do not find any iCheck call to initialize the checkboxes. In the AdminLTE changelog it states that the iCheck dependency is removed? AdminLTE changelog. Also I can not find any I will change this and check for the existence of the function before calling, that should provide enough compatibilty :) |
|
@sescandell How about this? |
|
Actually, they do use it:
I'm not sure Thanks, |
|
I did not check the plugins directory, just the The change event is the default event in jQuery, so I've no reason to suspect it's not working. It is working in my environment, but I did not test it on demo. Looks like there was a problem with the |
|
Great so 👍 |
|
@sescandell Did you test it? |
|
Not yet, |
|
Going to test it now, |
|
Well, actually I just check the previous version and... it's already not working. The reason is the dist version of Adminlte doesn't include the icheck initialization code (found in Missing code: /*
* We are gonna initialize all checkbox and radio inputs to
* ckck plugin in.
* You can find the documentation at http://fronteed.com/iCheck/
*/
$("input[type='checkbox']:not(.simple), input[type='radio']:not(.simple)").iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal'
});I totally agree with you: AdminLTE doesn't handle frontend dependencies the right way. |
|
That said, I tried your fix with the iCheck plugin correctly initialized, and it breaks the toggle selector on lists. |
|
@sescandell maybe we should open an issue (or PR) in AdminLTE project about incorrect handleing of dependencies? |
|
Guess it's to much work for us to fix the complete AdminLTE dependency handling ;) @sescandell Do you have any info on why it breaks when the iCheck is initialized? |
If I'm not wrong, this is because the
Someone already tried that, but PR was refused: ColorlibHQ/AdminLTE#548 |
Well, than the comment I made earlier probably did not yet make it into adminLTE...
Guess adding the check to the event list should solve it, but than it might also be the case that when the iCheck plugin is updated the event is fired twice. However, with the current implementation of the |
|
@sescandell Did you have any chance to test it? |
|
Checking it now... |
|
@bobvandevijver I just tested various combinations. Finally, if we want to be coherent with how the bundle should work initially, here is the right // Custom scripts belonging to Admingenerator
;(function(window, $, undefined){
...
S2A.batchActionsManager = function(options){
...
this.allElementsToggleButton.on('change ifChecked ifUnchecked', this.allElementsChangedHandler.bind(this));
...
};
// Called once the DOM is loaded
$(function(){
// Initializing the iCheck dependency: should be made in AdminLTE dist app.js code...
$("input[type='checkbox']:not(.simple), input[type='radio']:not(.simple)").iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal'
});
$("input[type='checkbox']:not(.simple), input[type='radio']:not(.simple)").on('ifChecked ifUnchecked', function(){
$(this).trigger('change');
});
});
})(window, jQuery);That way:
Is that good for you? |
Revert iCheck removed and added check Restored missed line Updated code after review
dd535a7 to
d30247f
Compare
|
@sescandell I'm not sure about this, but I believe we somewhere earlier said that this project should be usable without the AdminLTE dependency as it is not necessary (I do not use it for instance 😄). So, I took your sample and adjusted it such that it checks if the iCheck functionality is available. I've added it and squashed the PR. This solution means that it has another check, but in general that should not hurt anyone (actually it helps me, as otherwise the script fails). Furthermore, I've moved more of the initialization calls into the I believe in this way we help every user, so, what do you think? |
I don't know where did you read that, but, AFAIK, that's not true. Removing the AdminLTE dependency would break many things: design, menu, navigation, and probably others. I agree we can use the bundle without the AdminLTE, but removing JS / CSS from AdminLTE would break many things. That said, regarding the PR: 👍 |
|
Guess it's a design choice, but I found the response I was referring to (from @loostro in #245 (comment) about the KnpMenuBundle)
So, I would say that the AdminLTE should be available if you want to use it, but we should not force it (and make it a dependency). I also doubt a lot of stuff would break, but it doesn't matter for now. I'm merging it and releasing 2.1, thanks for the feedback 😃 |
For as far as I can see, there was only one place where the iCheck was used, which was also in fault.
This PR removes the complete iCheck dependency, as I believe it is not necessary. @sescandell, you were the first to add the iCheck to the
bower.json, what's your opinion?