Convert CofeeScript to JavaScript
Compiled using `coffee -c` with CoffeeScript 1.12.6.
This commit is contained in:
34
app/assets/javascripts/managers.js
Normal file
34
app/assets/javascripts/managers.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// Generated by CoffeeScript 1.12.6
|
||||
(function() {
|
||||
"use strict";
|
||||
App.Managers = {
|
||||
generatePassword: function() {
|
||||
var chars, possible_chars;
|
||||
possible_chars = "aAbcdeEfghiJkmnpqrstuUvwxyz23456789";
|
||||
chars = Array.apply(null, {
|
||||
length: 12
|
||||
}).map(function() {
|
||||
var i;
|
||||
i = Math.floor(Math.random() * possible_chars.length);
|
||||
return possible_chars.charAt(i);
|
||||
});
|
||||
return chars.join("");
|
||||
},
|
||||
togglePassword: function(type) {
|
||||
return $("#user_password").prop("type", type);
|
||||
},
|
||||
initialize: function() {
|
||||
$(".generate-random-value").on("click", function() {
|
||||
return $("#user_password").val(App.Managers.generatePassword());
|
||||
});
|
||||
return $(".show-password").on("click", function() {
|
||||
if ($("#user_password").is("input[type='password']")) {
|
||||
return App.Managers.togglePassword("text");
|
||||
} else {
|
||||
return App.Managers.togglePassword("password");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
Reference in New Issue
Block a user