r93836 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93835‎ | r93836 | r93837 >
Date:17:10, 3 August 2011
Author:yuvipanda
Status:deferred (Comments)
Tags:
Comment:
Proper UI to add filtered article lists to Selections
Modified paths:
  • /trunk/extensions/GPoC/templates/FilterRatingsTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GPoC/templates/FilterRatingsTemplate.php
@@ -11,15 +11,21 @@
1212 $selection = $this->data['selection'];
1313 ?>
1414
15 -<form method="GET">
 15+<form method="GET" id="filterForm">
1616 <p>
1717 Project Name: <input type="text" name="project" value="<?php echo $filters['r_project']?>" />
1818 Importance: <input type="text" name="importance" value="<?php echo $filters['r_importance']?>" />
1919 Quality: <input type="text" name="quality" value="<?php echo $filters['r_quality']?>" />
2020 <br />
2121 Categories (comma separated): <input type="text" name="categories" value="<?php echo $filters['categories']?>" />
22 -<input type="submit" />
 22+<input type="submit" id="submit-query" />
2323 </p>
 24+<div>
 25+Add to Selection:
 26+<input type="text" name="selection" id="selection" />
 27+<input type="hidden" name="action" id="action" />
 28+<input type="button" id="add-to-selection" value="Add" />
 29+</div>
2430 </form>
2531 <div id="notice">
2632 <?php if( $action == 'addtoselection' ) { ?>
@@ -50,6 +56,20 @@
5157 <?php } ?>
5258 </div>
5359
 60+ <script type="text/javascript">
 61+ // Should I use RL for tiny snippets like this too?
 62+ $("#add-to-selection").click(function() {
 63+ $("#action").val("addtoselection");
 64+ $("#filterForm").submit();
 65+ return false;
 66+ });
 67+ $("#submit-query").click(function() {
 68+ $("#selection").val("");
 69+ // Hitting submit shouldn't add to selection
 70+ $("#filterForm").submit();
 71+ return false;
 72+ });
 73+ </script>
5474
5575 <?php
5676 } // execute()

Comments

#Comment by Hashar (talk | contribs)   21:01, 25 August 2011

You really want to use the resource loader. Makes things easier to handle in the long term.

The documentation is at: http://www.mediawiki.org/wiki/ResourceLoader/Documentation/Using_with_extensions

Probably need a good 2 hours to read it and another 2 hours to migrate / test.

Tip: put the file a new directory named 'modules'. Have a look at the WikiLove extension for a naming scheme.

Status & tagging log