Commit 95f8ae67 authored by Irina Ivanova's avatar Irina Ivanova

Small fixes of default project functionality

parent 975429c7
......@@ -24,17 +24,19 @@ Source code and issue reporting is available at GitHub: [https://github.com/irii
![JIRA Issue Opener](https://raw.githubusercontent.com/iriiiina/JIRA-Issue-Opener/master/screenshots/extension.png "JIRA Issue Opener") ![JIRA Issue Opener: Options](https://raw.githubusercontent.com/iriiiina/JIRA-Issue-Opener/master/screenshots/options.png "JIRA Issue Opener: Options")
# Description
Basically extension simply adds your issue key to specified URL and opens it in new tab:
Basically extension simply adds your issue key to specified URL and opens it in new tab. `URL` is parameter, that user should specify in Options page (only one time after installation) and `KEY` is issue key that user inserts into extension field.
`URL/browse/KEY`
Where `URL` is parameter, that user should specify in Options page (only one time after installation) and `KEY` is issue key that user inserts into extension field.
There are two possible options:
* URL of JIRA
* Default Project
If only first one is filled, then final URL will be `URL/browse/KEY` - you can use this if you have multiple JIRA projects.
If both fields are filled and inserted key contains only numbers, then default project will be prepended to the key. The final URL will be `URL/browse/PROJECT-KEY` - this option can be used if you have only one JIRA project and you operate only with the sequence number in the JIRA issue code.
**Features**
* `KEY` is case insensitive
* All spaces in the beginning and in the end will be trimmed
* Skype formatting will be trimmed: `[16.09.2014 13:34:34] Irina Ivanova: KEY-776` will be recognized as `KEY-776`
* If key contains only numbers it will be prepended with PROJECT option
* If key contains only numbers it will be prepended with project option: the link will be `URL/browse/PROJECT-KEY`
# Chrome Tip
You can configure hot keys for extension in the Google Chrome:
......
......@@ -3,7 +3,7 @@ body {
font-family: Arial, sans-serif;
font-size: 14px;
color: black;
padding-left: 50px
padding-left: 50px
}
img {
float: left;
......@@ -42,7 +42,7 @@ td {
float: left
}
#error {
position: relative;
position: relative;
color: #CC0000;
padding-top: 25px;
float: left
......@@ -61,5 +61,6 @@ a {
color: #205081
}
#contacts {
font-size: 10px
}
\ No newline at end of file
font-size: 10px;
float: right;
}
......@@ -14,11 +14,11 @@ input {
#error {
font-size: 14px;
color: #CC0000;
padding-bottom: 10px;
padding-bottom: 10px;
text-align: center
}
.description {
text-align: right;
font-size: 11px;
color: #CCCCCC
}
\ No newline at end of file
}
......@@ -17,23 +17,23 @@ function returnError(errorText, element) {
}
var key,
url;
url;
function setUrl(urlOption) {
if (urlOption !== undefined) {
if (urlOption.charAt(urlOption.length - 1) === '/') {
url = urlOption + 'browse/';
} else {
url = urlOption + '/browse/';
}
if (urlOption !== undefined) {
if (urlOption.charAt(urlOption.length - 1) === '/') {
url = urlOption + 'browse/';
} else {
url = urlOption + '/browse/';
}
}
}
function removeSpaces(string) {
while (string.charAt(string.length - 1) === ' ') {
while (string.charAt(string.length - 1) === ' ') {
string = string.slice(0, string.length - 1);
}
if (string.charAt(0) === ' ') {
var temp = string.split(' ');
string = temp[temp.length - 1];
......@@ -47,15 +47,16 @@ function removeSkypeFormatting(string) {
var temp = string.split(' ');
string = temp[temp.length - 1];
}
return string;
}
function maybeAddProject(string, project) {
if (string.match(/^[0-9]+$/) != null) {
string = project + '-' + string;
}
return string;
function addDefaultProject(string, project) {
if (string.match(/^[0-9]+$/) != null) {
string = project + '-' + string;
}
return string;
}
function openWindow() {
......@@ -66,19 +67,19 @@ function openIssue() {
chrome.storage.sync.get(function (item) {
var urlOption = item.savedUrl;
var projectOption = item.savedProject;
var projectOption = item.savedProject;
key = document.getElementById('key').value;
setUrl(urlOption);
key = removeSpaces(key);
key = removeSkypeFormatting(key);
key = maybeAddProject(key, projectOption);
key = addDefaultProject(key, projectOption);
if (key === '') {
returnError('Please insert key', 'key');
} else if (url === undefined) {
returnError('Please define URL in Options', 'key');
} else {
} else {
openWindow();
}
});
......
function save_options() {
var url = document.getElementById('urlOption').value;
var project = document.getElementById('projectOption').value;
var status = document.getElementById('status');
var error = document.getElementById('error');
var border = document.getElementById('urlOption');
var status = document.getElementById('status');
var error = document.getElementById('error');
var border = document.getElementById('urlOption');
if (url === '') {
error.textContent = 'Please fill URL';
border.style.borderColor = '#CC0000';
border.focus();
} else {
error.innerText = '\n';
border.style.border = '';
border.focus();
border.select();
chrome.storage.sync.set({
savedUrl: url,
savedProject: project
}, function () {
status.textContent = 'Options saved';
setTimeout(function () {
status.textContent = '';
}, 2000);
});
}
error.textContent = 'Please fill URL';
border.style.borderColor = '#CC0000';
border.focus();
} else {
error.innerText = '\n';
border.style.border = '';
border.focus();
border.select();
chrome.storage.sync.set({
savedUrl: url,
savedProject: project
}, function () {
status.textContent = 'Options saved';
setTimeout(function () {
status.textContent = '';
}, 2000);
});
}
}
function restore_options() {
chrome.storage.sync.get({
savedUrl: 'https://jira.atlassian.com',
savedProject: 'PROJECT'
savedProject: 'PROJECT'
}, function (items) {
document.getElementById('urlOption').value = items.savedUrl;
document.getElementById('projectOption').value = items.savedProject;
......@@ -41,8 +41,6 @@ document.addEventListener('DOMContentLoaded', restore_options);
document.getElementById('save').addEventListener('click',
save_options);
var enter = 13;
function inputURLListener(e) {
......
......@@ -2,7 +2,7 @@
<html>
<head>
<title>Options of JIRA Issue Opener 2.1</title>
<title>Options of JIRA Issue Opener 2.1</title>
<link rel='stylesheet' type='text/css' href='css/options.css' />
</head>
......@@ -15,7 +15,7 @@
<li>KEY is case insensitive</li>
<li>All spaces in the beginning and in the end will be trimmed</li>
<li>Skype formatting will be trimmed: <code>[16.09.2014 13:34:34] Irina Ivanova: KEY-776</code> will be recognized as <code>KEY-776</code></li>
<li>If key contains only numbers it will be prepended with PROJECT option</li>
<li>If key contains only numbers it will be prepended with project option: the link will be <code>URL/browse/PROJECT-KEY</code></li>
</ul>
<p id='contacts'>Read more on <a href='http://ivanova-irina.blogspot.com/p/jira-issue-opener.html' target='_blank'>JIRA Issue Opener page</a> or write to <a href='mailto:iriiiina@gmail.com'>iriiiina@gmail.com</a>
</p>
......@@ -23,9 +23,9 @@
<br />
<br />
<table>
<tr>
<td colspan = '2'><div id='error'><br /></div></td>
</tr>
<tr>
<td colspan = '2'><div id='error'><br /></div></td>
</tr>
<tr>
<td>
<label for='urlOption'><b>URL of JIRA:</b>
......@@ -37,11 +37,11 @@
</tr>
<tr>
<td>
<label for='urlOption'><b>Default project:</b>
<label for='urlOption'><b>Default Project:</b>
</label>
</td>
<td>
<input type='text' name='projectOption' id='projectOption' maxlength='255' size='30' autofocus />&nbsp;<code>PROJECT-123</code>
<input type='text' name='projectOption' id='projectOption' maxlength='255' size='30' />&nbsp;<code>-KEY</code>
</td>
</tr>
<tr>
......
screenshots/options.png

81.4 KB | W: | H:

screenshots/options.png

251 KB | W: | H:

screenshots/options.png
screenshots/options.png
screenshots/options.png
screenshots/options.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment