-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
128 additions
and
10,078 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
(function($, undefined) { | ||
$.web2py.ajax_fields = function(target) { | ||
/* | ||
*this attaches something to a newly loaded fragment/page | ||
* Ideally all events should be bound to the document, so we can avoid calling | ||
* this over and over... all will be bound to the document | ||
*/ | ||
/*adds btn class to buttons*/ | ||
$('button:not([class^="btn"])', target).addClass('btn btn-default'); | ||
$("p.w2p-autocomplete-widget input").addClass('form-control'); | ||
$('form input[type="submit"]:not([class^="btn"]), form input[type="button"]:not([class^="btn"])', target).addClass('btn btn-default'); | ||
/* javascript for PasswordWidget*/ | ||
$('input[type=password][data-w2p_entropy]', target).each(function() { | ||
$.web2py.validate_entropy($(this)); | ||
}); | ||
/* javascript for ListWidget*/ | ||
$('ul.w2p_list', target).each(function() { | ||
function pe(ul, e) { | ||
var new_line = ml(ul); | ||
rel(ul); | ||
if ($(e.target).closest('li').is(':visible')) { | ||
/* make sure we didn't delete the element before we insert after */ | ||
new_line.insertAfter($(e.target).closest('li')); | ||
} else { | ||
/* the line we clicked on was deleted, just add to end of list */ | ||
new_line.appendTo(ul); | ||
} | ||
new_line.find(":text").focus(); | ||
return false; | ||
} | ||
|
||
function rl(ul, e) { | ||
if ($(ul).find('li').length > 1) { | ||
/* only remove if we have more than 1 item so the list is never empty */ | ||
$(e.target).closest('li').remove(); | ||
} | ||
} | ||
|
||
function ml(ul) { | ||
/* clone the first field */ | ||
var line = $(ul).find("li:first").clone(true); | ||
line.find(':text').val(''); | ||
return line; | ||
} | ||
|
||
function rel(ul) { | ||
/* keep only as many as needed*/ | ||
$(ul).find("li").each(function() { | ||
var trimmed = $.trim($(this).find(":text").val()); | ||
if (trimmed == '') $(this).remove(); | ||
else $(this).find(":text").val(trimmed); | ||
}); | ||
} | ||
var ul = this; | ||
$(ul).find(":text").addClass('form-control').wrap("<div class='input-group'></div>").after('<div class="input-group-append"><i class="fa fa-plus-circle"></i></div> <div class="input-group-append"><i class="fa fa-minus-circle"></i></div>').keypress(function(e) { | ||
return (e.which == 13) ? pe(ul, e) : true; | ||
}).next().click(function(e) { | ||
pe(ul, e); | ||
e.preventDefault(); | ||
}).next().click(function(e) { | ||
rl(ul, e); | ||
e.preventDefault(); | ||
}); | ||
}); | ||
} | ||
|
||
$(function() { | ||
$(".nav ul.dropdown-menu").each(function() { | ||
var toggle = jQuery(this).parent(); | ||
if (toggle.parent().hasClass("nav")) { | ||
toggle.attr("data-w2pmenulevel", "l0"); | ||
toggle.children("a") | ||
.addClass("dropdown-toggle") | ||
.append('<span class="caret"> </span>') | ||
.attr("data-toggle", "dropdown"); | ||
} else { | ||
toggle.addClass("dropdown-submenu").removeClass("dropdown"); | ||
}; | ||
}); | ||
}); | ||
|
||
})(jQuery); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.