aboutsummaryrefslogtreecommitdiffstats
path: root/webclient/lib/jquery.forms.js
diff options
context:
space:
mode:
authorZaran <zaran.krleza@gmail.com>2012-04-06 21:53:52 -0400
committerZaran <zaran.krleza@gmail.com>2012-04-06 21:53:52 -0400
commit8a83f72870bd4a291fdcf78d5ac17727b0a7618b (patch)
treeeafed45b4ed45f38fa307658ec19a8f33fb96e72 /webclient/lib/jquery.forms.js
parent05f8a92e9f90f58a637501b38de7b4c8b6b60619 (diff)
downloadalias-8a83f72870bd4a291fdcf78d5ac17727b0a7618b.tar.gz
Basic style for the roster.
Remove JavascriptMVC code in the angular branch
Diffstat (limited to 'webclient/lib/jquery.forms.js')
-rw-r--r--webclient/lib/jquery.forms.js71
1 files changed, 0 insertions, 71 deletions
diff --git a/webclient/lib/jquery.forms.js b/webclient/lib/jquery.forms.js
deleted file mode 100644
index e9a5258..0000000
--- a/webclient/lib/jquery.forms.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Form manipulation with jQuery
- */
-(function( $ ){
-
- var methods = {
-
- render: function(){
- var result = $('<form></form>');
- if ( this.find('title').length !== 0 ){
- result.append('<p class="title">' + this.find('title') + '</p>');
- }
-
- if ( this.find('instructions').length !== 0 ){
- result.append('<p class="instructions">'
- + this.find('instructions') + '</p>');
- }
-
- this.find('field').each(function(index){
- var type = $(this).attr("type");
- var name = $(this).attr("var");
- var required = $(this).find('required').length !== 0;
-
- if ( $(this).find('desc').length !== 0 ){
- result.append('<p class="description">'
- + $(this).find('desc').text()
- + '</p>');
- }
-
- if ( $(this).attr('label') !== undefined ){
- result.append('<label for="form-' + name + '">'
- + $(this).attr('label')
- + (required ? ' (*): ' : ': ')
- + '</label>');
- }
-
- switch(type){
- case("text-single"):
- var input = $('<input/>');
- input.attr('type', 'text');
- input.attr('name', name);
- input.attr('id', 'form-' + name);
-
- if ( $(this).find('value').length !== 0 ){
- input.attr('value', $(this).find('value').text());
- }
- result.append(input);
- result.append('<br/>');
- }
- });
- return result;
- }
- };
-
- /*
- * Register the 'xmppForm' method to the jQuery objects
- * the first argument of this method is the submethod
- * you want to call
- */
- $.fn.xmppForm = function(method) {
- if ( methods[method] ) {
- return methods[method].apply(this, Array.prototype.slice
- .call(arguments, 1));
- } else if ( typeof method === 'object' || !method ) {
- return methods.init.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.xmppForm');
- }
- };
-
-})(jQuery); \ No newline at end of file