Skip to content

Commit

Permalink
add update request Url for custom update request
Browse files Browse the repository at this point in the history
  • Loading branch information
yakovenko.dima committed Jun 11, 2012
1 parent 043227b commit 4c7fdbb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 15 additions & 1 deletion background.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
return localStorage.redmineUrl;
}

function getRedmineUpdateUrl() {
if( !localStorage.redmineUpdateUrl ) {
return null;
}

return localStorage.redmineUpdateUrl;
}

function isRedmineUrl(url) {
var redmine = getRedmineUrl();

Expand Down Expand Up @@ -167,7 +175,13 @@
}

function getIssuesCount(onSuccess, onError) {
getJSON("issues.json?assigned_to_id=" + currentUserId + "&limit=50",
var jsonRequestUrl = "";
if(getRedmineUpdateUrl() != null) {
jsonRequestUrl = getRedmineUpdateUrl();
} else {
jsonRequestUrl = "issues.json?assigned_to_id=" + currentUserId + "&limit=50";
}
getJSON(jsonRequestUrl,
function(json){
if(json.issues != undefined && localStorage.showNotifications == '1') {
showNotificationOnNewIssue(json.issues);
Expand Down
10 changes: 9 additions & 1 deletion options.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<p>Password:</p>
<p><input type="password" id="user-password" oninput="markDirty()"></p>

<div class="section-header first">Update request URL</div>
<p>Enter your redmine update url (live empty for receiving your personal tasks):</p>
<p><input type="text" id="redmine-update-url" oninput="markDirty()"> <em>(eg "issues.json?query_id=6")</em></p>

<div class="section-header first">Issues</div>
<p>Show number of issues:</p>
<ul>
Expand Down Expand Up @@ -134,7 +138,7 @@
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>

<script>
var redmineUrlTextbox, showActiveIssues, showNewIssues, showActiveNewIssues, iconPressUrl, iconPressDontRedirect;
var redmineUrlTextbox, redmineUpdateUrlTextbox, showActiveIssues, showNewIssues, showActiveNewIssues, iconPressUrl, iconPressDontRedirect;
var userLogin, userPassword;
var showNotifications, notificationsType, notificationsTimeout, notificationFieldsDiv, notificationFields, notificationColors;
var saveButton;
Expand All @@ -143,6 +147,7 @@

function init() {
redmineUrlTextbox = document.getElementById("redmine-url");
redmineUpdateUrlTextbox = document.getElementById("redmine-update-url");

showActiveIssues = document.getElementById("issues-active");
showNewIssues = document.getElementById("issues-new");
Expand Down Expand Up @@ -192,6 +197,7 @@
function loadDefaults()
{
redmineUrlTextbox.value = localStorage.redmineUrl || "";
redmineUpdateUrlTextbox.value = localStorage.redmineUpdateUrl || "";

showActiveIssues.checked = false;
showNewIssues.checked = false;
Expand Down Expand Up @@ -267,6 +273,7 @@

function save() {
var newUrl = redmineUrlTextbox.value;
var updateUrl = redmineUpdateUrlTextbox.value;

if( !isUrl(newUrl) ) {
loadDefaults();
Expand Down Expand Up @@ -338,6 +345,7 @@
localStorage.notificationsTimeout = newTimeout;

localStorage.redmineUrl = newUrl;
localStorage.redmineUpdateUrl = updateUrl;
markClean();

chrome.extension.getBackgroundPage().init();
Expand Down

0 comments on commit 4c7fdbb

Please sign in to comment.