Included the rewriting of the :sprint_id in javascript and updated call parameters

for the urlfor rewrite function
pull/6827/head
Sebastian Schuster 12 years ago
parent 56bffcb4b2
commit e17a370a4a
  1. 2
      app/assets/javascripts/backlogs/app/burndown.js
  2. 4
      app/assets/javascripts/backlogs/app/impediment.js
  3. 6
      app/assets/javascripts/backlogs/app/story.js
  4. 4
      app/assets/javascripts/backlogs/app/task.js
  5. 3
      app/views/rb_server_variables/show.js.erb

@ -27,7 +27,7 @@ RB.Burndown = (function ($) {
$('<div id="charts"></div>').appendTo("body");
}
$('#charts').html("<div class='loading'>" + RB.i18n.generating_graph + "</div>");
$('#charts').load(RB.urlFor('show_burndown_chart', { id: $(this).data('this').sprintId,
$('#charts').load(RB.urlFor('show_burndown_chart', { sprint_id: $(this).data('this').sprintId,
project_id: RB.constants.project_id}));
$('#charts').dialog({
dialogClass: "rb_dialog",

@ -38,10 +38,10 @@ RB.Impediment = (function ($) {
(this.isNew() ? "" : "&id=" + j.children('.id').text());
if (this.isNew()) {
url = RB.urlFor('create_impediment');
url = RB.urlFor('create_impediment', {sprint_id: RB.constants.sprint_id});
}
else {
url = RB.urlFor('update_impediment', {id: this.getID()});
url = RB.urlFor('update_impediment', {id: this.getID(), sprint_id: RB.constants.sprint_id});
data += "&_method=put";
}

@ -84,10 +84,12 @@ RB.Story = (function ($) {
data += "&" + this.$.find('.editor').serialize();
}
//TODO: this might be unsave in case the parent of this story is not the sprint backlog, then we dont have
//a sprintId an cannot generate a valid url - one option might be to take RB.constants.sprint_id hoping it exists
if (this.isNew()) {
url = RB.urlFor('create_story');
url = RB.urlFor('create_story', {sprint_id: sprintId});
} else {
url = RB.urlFor('update_story', {id: this.getID()});
url = RB.urlFor('update_story', {id: this.getID(), sprint_id: sprintId});
data += "&_method=put";
}

@ -54,10 +54,10 @@ RB.Task = (function ($) {
(this.isNew() ? "" : "&id=" + this.$.children('.id').text());
if (this.isNew()) {
url = RB.urlFor('create_task');
url = RB.urlFor('create_task', {sprint_id: RB.constants.sprint_id});
}
else {
url = RB.urlFor('update_task', {id: this.getID()});
url = RB.urlFor('update_task', {id: this.getID(), sprint_id: RB.constants.sprint_id});
data += "&_method=put";
}

@ -37,6 +37,9 @@ RB.urlFor = (function () {
if (options.project_id){
route = route.replace(":project_id", options.project_id);
}
if(options.sprint_id) {
route = route.replace(":sprint_id", options.sprint_id)
}
}
return route;

Loading…
Cancel
Save