You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/08/23 16:31:43 UTC
svn commit: r1376506 - in /incubator/cordova/site: public/index.html
www/template.html
Author: agrieve
Date: Thu Aug 23 14:31:42 2012
New Revision: 1376506
URL: http://svn.apache.org/viewvc?rev=1376506&view=rev
Log:
Make the JIRA search box on the main page more intelligent:
-Use a GET instead of a POST so that it's copy & pastable
-Extract out platform keywords and apply it to the component field
-Make they query contain all of the query terms instead of any of them.
-Forces them onto the simple mode of the edit tab of the navigator
Modified:
incubator/cordova/site/public/index.html
incubator/cordova/site/www/template.html
Modified: incubator/cordova/site/public/index.html
URL: http://svn.apache.org/viewvc/incubator/cordova/site/public/index.html?rev=1376506&r1=1376505&r2=1376506&view=diff
==============================================================================
--- incubator/cordova/site/public/index.html (original)
+++ incubator/cordova/site/public/index.html Thu Aug 23 14:31:42 2012
@@ -19,11 +19,42 @@
})();
function submitJiraSearchForm() {
- var queryTemplate = '(summary ~ "%1" OR description ~ "%1" OR comment ~ "%1") AND project = CB AND resolution = Unresolved ORDER BY created';
+ var queryTemplate1 = '(summary ~ "%1" OR description ~ "%1" OR comment ~ "%1") AND ';
+ var queryTemplate2 = 'project = CB AND resolution = Unresolved %2ORDER BY created';
+ var componentKeywords = [
+ /\b(ios|iphone|ipad|ipod)\b/ig, 'iOS',
+ /\b(android)\b/ig, 'Android',
+ /\b(blackberry|rim|bb.|webworks)\b/ig, 'BlackBerry',
+ /\b(webos)\b/ig, 'webOS',
+ /\b(wp7|windows phone)\b/ig, 'WP7',
+ /\b(wp8|windows phone)\b/ig, 'WP8'
+ ];
var query = document.getElementById('jira-search-box').value;
- var jiraForm = document.getElementById('jira-form');
- jiraForm.jqlQuery.value = queryTemplate.replace(/%1/g, query);
- jiraForm.submit();
+ // Check for some platform keywords:
+ var components = [];
+ for (var i = 0; i < componentKeywords.length; i += 2) {
+ if (query.match(componentKeywords[i])) {
+ query = query.replace(componentKeywords[i], '');
+ components.push(componentKeywords[i + 1]);
+ }
+ }
+ var componentsQuery = '';
+ if (components.length) {
+ // Add in components that apply to all platforms.
+ components.push('Docs', 'mobile-spec', 'CordovaJS');
+ componentsQuery = 'AND component in (' + components.join(', ') + ') ';
+ }
+ // Remove quotes since we are adding them in.
+ query = query.replace(/"/g, '');
+ var tokens = query.split(/\s+/);
+ query = '';
+ for (var i = 0; i < tokens.length; ++i) {
+ if (tokens[i]) {
+ query += queryTemplate1.replace(/%1/g, tokens[i]);
+ }
+ }
+ query += queryTemplate2.replace('%2', componentsQuery)
+ window.open('https://issues.apache.org/jira/secure/IssueNavigator.jspa?mode=show&reset=true&jqlQuery=' + encodeURIComponent(query), '_newtab' + new Date);
}
</script>
</head>
@@ -76,10 +107,6 @@
<p>First, make sure you have signed the <a href="http://www.apache.org/licenses/#clas">Apache CLA</a>.</p>
<p>The <a href="https://issues.apache.org/jira/browse/">JIRA issue tracker</a> and the <a href="#mailing-list">dev mailing list</a> are good places to identify areas to help out in.<br>
Search the issue tracker: <input placeholder="Search Query" id="jira-search-box" onkeypress="event.keyCode==13 && submitJiraSearchForm()"><button id="jira-search-button" onclick="submitJiraSearchForm()">Search</button></p>
- <form id="jira-form" action="https://issues.apache.org/jira/secure/IssueNavigator!executeAdvanced.jspa" method="post" style="display:none">
- <input name="jqlQuery" type=hidden>
- <input name="runQuery" value="true" type=hidden>
- </form>
<p>Next, clone the git repository for the project you are wishing to contribute to (see below). We recommend employing a certain type of git workflow, please see our <a href="http://wiki.apache.org/cordova/ContributerWorkflow">wiki article</a> for more information.</p>
<p>Finally, to share your changes with the community, you can send a pull request on GitHub to the Apache git mirrors. You can also advocate for your changes directly on our <a href="#mailing-list">mailing list</a>.</p>
<p>For detailed instruction on how to contribute for a specific platform / topic, choose from below:</p>
Modified: incubator/cordova/site/www/template.html
URL: http://svn.apache.org/viewvc/incubator/cordova/site/www/template.html?rev=1376506&r1=1376505&r2=1376506&view=diff
==============================================================================
--- incubator/cordova/site/www/template.html (original)
+++ incubator/cordova/site/www/template.html Thu Aug 23 14:31:42 2012
@@ -23,11 +23,42 @@
})();
function submitJiraSearchForm() {
- var queryTemplate = '(summary ~ "%1" OR description ~ "%1" OR comment ~ "%1") AND project = CB AND resolution = Unresolved ORDER BY created';
+ var queryTemplate1 = '(summary ~ "%1" OR description ~ "%1" OR comment ~ "%1") AND ';
+ var queryTemplate2 = 'project = CB AND resolution = Unresolved %2ORDER BY created';
+ var componentKeywords = [
+ /\b(ios|iphone|ipad|ipod)\b/ig, 'iOS',
+ /\b(android)\b/ig, 'Android',
+ /\b(blackberry|rim|bb.|webworks)\b/ig, 'BlackBerry',
+ /\b(webos)\b/ig, 'webOS',
+ /\b(wp7|windows phone)\b/ig, 'WP7',
+ /\b(wp8|windows phone)\b/ig, 'WP8'
+ ];
var query = document.getElementById('jira-search-box').value;
- var jiraForm = document.getElementById('jira-form');
- jiraForm.jqlQuery.value = queryTemplate.replace(/%1/g, query);
- jiraForm.submit();
+ // Check for some platform keywords:
+ var components = [];
+ for (var i = 0; i < componentKeywords.length; i += 2) {
+ if (query.match(componentKeywords[i])) {
+ query = query.replace(componentKeywords[i], '');
+ components.push(componentKeywords[i + 1]);
+ }
+ }
+ var componentsQuery = '';
+ if (components.length) {
+ // Add in components that apply to all platforms.
+ components.push('Docs', 'mobile-spec', 'CordovaJS');
+ componentsQuery = 'AND component in (' + components.join(', ') + ') ';
+ }
+ // Remove quotes since we are adding them in.
+ query = query.replace(/"/g, '');
+ var tokens = query.split(/\s+/);
+ query = '';
+ for (var i = 0; i < tokens.length; ++i) {
+ if (tokens[i]) {
+ query += queryTemplate1.replace(/%1/g, tokens[i]);
+ }
+ }
+ query += queryTemplate2.replace('%2', componentsQuery)
+ window.open('https://issues.apache.org/jira/secure/IssueNavigator.jspa?mode=show&reset=true&navType=simple&jqlQuery=' + encodeURIComponent(query), '_newtab' + new Date);
}
</script>
</head>
@@ -85,10 +116,6 @@
<p>First, make sure you have signed the <a href="http://www.apache.org/licenses/#clas">Apache CLA</a>.</p>
<p>The <a href="https://issues.apache.org/jira/browse/">JIRA issue tracker</a> and the <a href="#mailing-list">dev mailing list</a> are good places to identify areas to help out in.<br>
Search the issue tracker: <input placeholder="Search Query" id="jira-search-box" onkeypress="event.keyCode==13 && submitJiraSearchForm()"><button id="jira-search-button" onclick="submitJiraSearchForm()">Search</button></p>
- <form id="jira-form" action="https://issues.apache.org/jira/secure/IssueNavigator!executeAdvanced.jspa" method="post" style="display:none">
- <input name="jqlQuery" type=hidden>
- <input name="runQuery" value="true" type=hidden>
- </form>
<p>Next, clone the git repository for the project you are wishing to contribute to (see below). We recommend employing a certain type of git workflow, please see our <a href="http://wiki.apache.org/cordova/ContributerWorkflow">wiki article</a> for more information.</p>
<p>Finally, to share your changes with the community, you can send a pull request on GitHub to the Apache git mirrors. You can also advocate for your changes directly on our <a href="#mailing-list">mailing list</a>.</p>
<p>For detailed instruction on how to contribute for a specific platform / topic, choose from below:</p>