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/assets/javascripts/common.js

43 lines
1.1 KiB

if(RB==null){
var RB = {};
}
// Douglas Crockford's technique for object extension
// http://javascript.crockford.com/prototypal.html
if(typeof Object.create !== 'function'){
Object.create = function(o, methods){
function F(){}
F.prototype = o;
obj = new F();
if(typeof methods == 'object'){
for(methodName in methods) obj[methodName] = methods[methodName];
}
return obj;
};
}
// Object factory for redmine_backlogs
RB.Factory = Object.create({
initialize: function(objType, el){
obj = Object.create(objType);
obj.initialize(el);
return obj;
}
});
// Common methods for models
RB.Model = Object.create({});
// Modify the ajax request before being sent to the server
$(document).ajaxSend(function(event, request, settings) {
var c = RB.constants;
settings.data = settings.data || "";
settings.data += (settings.data ? "&" : "") + "project_id=" + c.project_id;
if(c.protect_against_forgery){
settings.data += "&" + c.request_forgery_protection_token + "=" + encodeURIComponent(c.form_authenticity_token);
}
});