implement requirejs loading to test

This commit is contained in:
vitalets
2012-12-04 17:24:20 +04:00
parent a1c6d34730
commit 5d3d7d8c4c
26 changed files with 11719 additions and 231 deletions

View File

@@ -6,6 +6,9 @@ To create your own input you should inherit from this class.
**/
(function ($) {
//types
$.fn.editabletypes = {};
var Abstract = function () { };
Abstract.prototype = {
@@ -164,6 +167,6 @@ To create your own input you should inherit from this class.
name: null
};
$.extend($.fn.editableform.types, {abstract: Abstract});
$.extend($.fn.editabletypes, {abstract: Abstract});
}(window.jQuery));

View File

@@ -27,7 +27,7 @@ $(function(){
this.init('checklist', options, Checklist.defaults);
};
$.fn.editableform.utils.inherit(Checklist, $.fn.editableform.types.list);
$.fn.editableutils.inherit(Checklist, $.fn.editabletypes.list);
$.extend(Checklist.prototype, {
renderList: function() {
@@ -123,7 +123,7 @@ $(function(){
}
});
Checklist.defaults = $.extend({}, $.fn.editableform.types.list.defaults, {
Checklist.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <div></div>
@@ -173,6 +173,6 @@ $(function(){
limitText: 'Selected {checked} of {count}'
});
$.fn.editableform.types.checklist = Checklist;
$.fn.editabletypes.checklist = Checklist;
}(window.jQuery));

View File

@@ -27,7 +27,7 @@ $(function(){
this.init('date', options, Date.defaults);
//set popular options directly from settings or data-* attributes
var directOptions = $.fn.editableform.utils.sliceObj(this.options, ['format']);
var directOptions = $.fn.editableutils.sliceObj(this.options, ['format']);
//overriding datepicker config (as by default jQuery extend() is not recursive)
this.options.datepicker = $.extend({}, Date.defaults.datepicker, directOptions, options.datepicker);
@@ -48,7 +48,7 @@ $(function(){
this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat);
};
$.fn.editableform.utils.inherit(Date, $.fn.editableform.types.abstract);
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstract);
$.extend(Date.prototype, {
render: function () {
@@ -108,7 +108,7 @@ $(function(){
});
Date.defaults = $.extend({}, $.fn.editableform.types.abstract.defaults, {
Date.defaults = $.extend({}, $.fn.editabletypes.abstract.defaults, {
/**
@property tpl
@default <div></div>
@@ -165,6 +165,6 @@ $(function(){
clear: '&times; clear'
});
$.fn.editableform.types.date = Date;
$.fn.editabletypes.date = Date;
}(window.jQuery));

View File

@@ -27,7 +27,7 @@ $(function(){
this.init('dateui', options, DateUI.defaults);
//set popular options directly from settings or data-* attributes
var directOptions = $.fn.editableform.utils.sliceObj(this.options, ['format']);
var directOptions = $.fn.editableutils.sliceObj(this.options, ['format']);
//overriding datepicker config (as by default jQuery extend() is not recursive)
this.options.datepicker = $.extend({}, DateUI.defaults.datepicker, directOptions, options.datepicker);
@@ -46,7 +46,7 @@ $(function(){
this.options.datepicker.dateFormat = this.options.datepicker.format;
};
$.fn.editableform.utils.inherit(DateUI, $.fn.editableform.types.abstract);
$.fn.editableutils.inherit(DateUI, $.fn.editabletypes.abstract);
$.extend(DateUI.prototype, {
render: function () {
@@ -125,7 +125,7 @@ $(function(){
});
DateUI.defaults = $.extend({}, $.fn.editableform.types.abstract.defaults, {
DateUI.defaults = $.extend({}, $.fn.editabletypes.abstract.defaults, {
/**
@property tpl
@default <div></div>
@@ -183,7 +183,7 @@ $(function(){
clear: '&times; clear'
});
$.fn.editableform.types.dateui = DateUI;
$.fn.editableform.types.date = DateUI;
$.fn.editabletypes.dateui = DateUI;
$.fn.editabletypes.date = DateUI;
}(window.jQuery));

View File

@@ -10,7 +10,7 @@ List - abstract class for inputs that have source option loaded from js array or
};
$.fn.editableform.utils.inherit(List, $.fn.editableform.types.abstract);
$.fn.editableutils.inherit(List, $.fn.editabletypes.abstract);
$.extend(List.prototype, {
render: function () {
@@ -58,7 +58,7 @@ List - abstract class for inputs that have source option loaded from js array or
// try parse json in single quotes (for double quotes jquery does automatically)
try {
this.options.source = $.fn.editableform.utils.tryParseJson(this.options.source, false);
this.options.source = $.fn.editableutils.tryParseJson(this.options.source, false);
} catch (e) {
error.call(this);
return;
@@ -139,7 +139,7 @@ List - abstract class for inputs that have source option loaded from js array or
if(!$.isArray(this.prependData)) {
//try parse json in single quotes
this.options.prepend = $.fn.editableform.utils.tryParseJson(this.options.prepend, true);
this.options.prepend = $.fn.editableutils.tryParseJson(this.options.prepend, true);
if (typeof this.options.prepend === 'string') {
this.options.prepend = {'': this.options.prepend};
}
@@ -220,7 +220,7 @@ List - abstract class for inputs that have source option loaded from js array or
});
List.defaults = $.extend({}, $.fn.editableform.types.abstract.defaults, {
List.defaults = $.extend({}, $.fn.editabletypes.abstract.defaults, {
/**
Source data for list. If string - considered ajax url to load items. Otherwise should be an array.
Array format is: <code>[{value: 1, text: "text"}, {...}]</code><br>
@@ -249,6 +249,6 @@ List - abstract class for inputs that have source option loaded from js array or
sourceError: 'Error when loading list'
});
$.fn.editableform.types.list = List;
$.fn.editabletypes.list = List;
}(window.jQuery));

View File

@@ -26,7 +26,7 @@ $(function(){
this.init('select', options, Select.defaults);
};
$.fn.editableform.utils.inherit(Select, $.fn.editableform.types.list);
$.fn.editableutils.inherit(Select, $.fn.editabletypes.list);
$.extend(Select.prototype, {
renderList: function() {
@@ -54,7 +54,7 @@ $(function(){
}
});
Select.defaults = $.extend({}, $.fn.editableform.types.list.defaults, {
Select.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <select></select>
@@ -62,6 +62,6 @@ $(function(){
tpl:'<select></select>'
});
$.fn.editableform.types.select = Select;
$.fn.editabletypes.select = Select;
}(window.jQuery));

View File

@@ -20,18 +20,18 @@ $(function(){
this.init('text', options, Text.defaults);
};
$.fn.editableform.utils.inherit(Text, $.fn.editableform.types.abstract);
$.fn.editableutils.inherit(Text, $.fn.editabletypes.abstract);
$.extend(Text.prototype, {
activate: function() {
if(this.$input.is(':visible')) {
this.$input.focus();
$.fn.editableform.utils.setCursorPosition(this.$input.get(0), this.$input.val().length);
$.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
}
}
});
Text.defaults = $.extend({}, $.fn.editableform.types.abstract.defaults, {
Text.defaults = $.extend({}, $.fn.editabletypes.abstract.defaults, {
/**
@property tpl
@default <input type="text">
@@ -47,6 +47,6 @@ $(function(){
placeholder: null
});
$.fn.editableform.types.text = Text;
$.fn.editabletypes.text = Text;
}(window.jQuery));

View File

@@ -21,7 +21,7 @@ $(function(){
this.init('textarea', options, Textarea.defaults);
};
$.fn.editableform.utils.inherit(Textarea, $.fn.editableform.types.abstract);
$.fn.editableutils.inherit(Textarea, $.fn.editabletypes.abstract);
$.extend(Textarea.prototype, {
render: function () {
@@ -60,13 +60,13 @@ $(function(){
activate: function() {
if(this.$input.is(':visible')) {
$.fn.editableform.utils.setCursorPosition(this.$input.get(0), this.$input.val().length);
$.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
this.$input.focus();
}
}
});
Textarea.defaults = $.extend({}, $.fn.editableform.types.abstract.defaults, {
Textarea.defaults = $.extend({}, $.fn.editabletypes.abstract.defaults, {
/**
@property tpl
@default <textarea></textarea>
@@ -87,6 +87,6 @@ $(function(){
placeholder: null
});
$.fn.editableform.types.textarea = Textarea;
$.fn.editabletypes.textarea = Textarea;
}(window.jQuery));
}(window.jQuery));