OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/views/rb_server_variables/show.js.erb

49 lines
2.0 KiB

RB.constants = {
project_id: <%= @project.id %>,
sprint_id: <%= @sprint ? @sprint.id : "null" %>,
protect_against_forgery: <%= protect_against_forgery? ? "true" : "false" %>,
request_forgery_protection_token: '<%= request_forgery_protection_token %>',
form_authenticity_token: '<%= form_authenticity_token %>'
};
RB.i18n = {
generating_graph: '<%= l("backlogs.generating_chart") %>',
burndown_graph: '<%= l("backlogs.burndown_graph") %>'
};
RB.urlFor = (function () {
var routes = {
update_sprint: '<%= backlogs_project_sprint_path(:project_id => @project.identifier, :id => ":id") %>',
create_story: '<%= backlogs_project_sprint_stories_path(:project_id => @project.identifier, :sprint_id => ":sprint_id") %>',
update_story: '<%= backlogs_project_sprint_story_path(:project_id => @project.identifier, :sprint_id => ":sprint_id", :id => ":id") %>',
create_task: '<%= backlogs_project_sprint_tasks_path(:project_id => @project.identifier, :sprint_id => ":sprint_id") %>',
update_task: '<%= backlogs_project_sprint_task_path(:project_id => @project.identifier, :sprint_id => ":sprint_id", :id => ":id") %>',
create_impediment: '<%= backlogs_project_sprint_impediments_path(:project_id => @project.identifier, :sprint_id => ":sprint_id") %>',
update_impediment: '<%= backlogs_project_sprint_impediment_path(:project_id => @project.identifier, :sprint_id => ":sprint_id", :id => ":id") %>',
show_burndown_chart: '<%= backlogs_project_sprint_burndown_chart_path(:project_id => @project.identifier, :sprint_id => ":sprint_id") %>'
};
return function (routeName, options) {
route = routes[routeName];
if (options){
if (options.id) {
route = route.replace(":id", options.id);
}
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;
}
}());