[aur-dev] Select All in Package Listing
There was some talk on the aur-general list about how it would be nice to have a select all option on the package listing page. This patch adds that. Note that I just dropped the javascript into a <script> tag as, as far as i can tell, there isn't any central location for js stuff. If that's a problem, I can move it elsewhere. Regards, Nick Lanham
On Thu, Dec 01, 2011 at 03:14:00PM +0100, Nick Lanham wrote:
There was some talk on the aur-general list about how it would be nice to have a select all option on the package listing page. This patch adds that.
Please send full Git-formatted patches (generated by git-format-patch(1)) and please send them inline instead of attaching stuff.
Note that I just dropped the javascript into a <script> tag as, as far as i can tell, there isn't any central location for js stuff. If that's a problem, I can move it elsewhere.
Well, the reason for not having a central location for JavaScript stuff is because we (that's me, basically) don't like JavaScript :) If we ever feel the need for such a thing, it should definitely be put in a central location, though. Also, there's a lot of design changes going on right now and all design/interface related patches should probably be delayed until everything is merged into master. Could you wait for a while and resubmit this patch when all the hard work is done? :) You can also open a feature request in the meantime, so we don't lose track of this one.
Regards,
Nick Lanham
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index 8ef352b..45173bb 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -10,12 +10,22 @@ </div>
- - -<table class='results'> +<script type="text/javascript"> + function clickAll(box,table) { + var checks = table.getElementsByTagName("input"); + for (var i = 0; i < checks.length; i++) + checks[i].checked = box.checked + } +</script> +<table class='results' id='result_table'> <tr> <?php if ($SID): ?> - <th class='header'> </th> + <th class='header' style='text-align:left'> + <input type='checkbox' + title='<?php print __("Select All/None") ?>' + onClick='clickAll(this,document.getElementById("result_table"))' + name='SelAllCheck' value='1' /> + </th> <?php endif; ?>
<th class='header'><span class='f2'>
Yeah, sorry about the patch format, I should have read the guidelines more carefully. I will get it right when I re-submit. I realized that there was probably a conscious avoidance of javascript (which I'm generally for too), but for modifying dom elements like this, it really does make sense. There would be a more convoluted way to do it, sort of like how search is done, with a new request and a parameter to indicate that all checkboxes should be checked or un-checked, so if there's really a desire to keep js out of the code, let me know, and I'll try to get that working for the re-submit. Regards, Nick On 12/02/2011 10:35 AM, Lukas Fleischer wrote:
On Thu, Dec 01, 2011 at 03:14:00PM +0100, Nick Lanham wrote:
There was some talk on the aur-general list about how it would be nice to have a select all option on the package listing page. This patch adds that. Please send full Git-formatted patches (generated by git-format-patch(1)) and please send them inline instead of attaching stuff.
Note that I just dropped the javascript into a<script> tag as, as far as i can tell, there isn't any central location for js stuff. If that's a problem, I can move it elsewhere. Well, the reason for not having a central location for JavaScript stuff is because we (that's me, basically) don't like JavaScript :) If we ever feel the need for such a thing, it should definitely be put in a central location, though.
Also, there's a lot of design changes going on right now and all design/interface related patches should probably be delayed until everything is merged into master. Could you wait for a while and resubmit this patch when all the hard work is done? :) You can also open a feature request in the meantime, so we don't lose track of this one.
Regards,
Nick Lanham diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index 8ef352b..45173bb 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -10,12 +10,22 @@ </div>
- - -<table class='results'> +<script type="text/javascript"> + function clickAll(box,table) { + var checks = table.getElementsByTagName("input"); + for (var i = 0; i< checks.length; i++) + checks[i].checked = box.checked + } +</script> +<table class='results' id='result_table'> <tr> <?php if ($SID): ?> - <th class='header'> </th> + <th class='header' style='text-align:left'> + <input type='checkbox' + title='<?php print __("Select All/None") ?>' + onClick='clickAll(this,document.getElementById("result_table"))' + name='SelAllCheck' value='1' /> + </th> <?php endif; ?>
<th class='header'><span class='f2'>
participants (2)
-
Lukas Fleischer
-
Nick Lanham