summaryrefslogtreecommitdiffstats
path: root/module/webui/themes/default/js/sources/admin.coffee
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-08-27 15:22:39 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-08-27 15:22:39 +0200
commit4c8a6401abe2ee3752d8a30402e74e882042352f (patch)
tree64e14f3147bb60ade00aeb21a9fa97a8f862733c /module/webui/themes/default/js/sources/admin.coffee
parentRe-apply 8446e16346ece5a934550f69e81d0cad528f7fba (diff)
downloadpyload-4c8a6401abe2ee3752d8a30402e74e882042352f.tar.xz
[webui] Restructure file tree + convert tabs to 2 whitespaces + remove setup.html
Diffstat (limited to 'module/webui/themes/default/js/sources/admin.coffee')
-rw-r--r--module/webui/themes/default/js/sources/admin.coffee58
1 files changed, 58 insertions, 0 deletions
diff --git a/module/webui/themes/default/js/sources/admin.coffee b/module/webui/themes/default/js/sources/admin.coffee
new file mode 100644
index 000000000..c4ab86911
--- /dev/null
+++ b/module/webui/themes/default/js/sources/admin.coffee
@@ -0,0 +1,58 @@
+root = this
+
+window.addEvent "domready", ->
+
+ root.passwordDialog = new MooDialog {destroyOnHide: false}
+ root.passwordDialog.setContent $ 'password_box'
+
+ $("login_password_reset").addEvent "click", (e) -> root.passwordDialog.close()
+ $("login_password_button").addEvent "click", (e) ->
+
+ newpw = $("login_new_password").get("value")
+ newpw2 = $("login_new_password2").get("value")
+
+ if newpw is newpw2
+ form = $("password_form")
+ form.set "send", {
+ onSuccess: (data) ->
+ root.notify.alert "Success", {
+ 'className': 'success'
+ }
+ onFailure: (data) ->
+ root.notify.alert "Error", {
+ 'className': 'error'
+ }
+ }
+
+ form.send()
+
+ root.passwordDialog.close()
+ else
+ alert '{{_("Passwords did not match.")}}'
+
+ e.stop()
+
+ for item in $$(".change_password")
+ id = item.get("id")
+ user = id.split("|")[1]
+ $("user_login").set("value", user)
+ item.addEvent "click", (e) -> root.passwordDialog.open()
+
+ $('quit-pyload').addEvent "click", (e) ->
+ new MooDialog.Confirm "{{_('You are really sure you want to quit pyLoad?')}}", ->
+ new Request.JSON({
+ url: '/api/kill'
+ method: 'get'
+ }).send()
+ , ->
+ e.stop()
+
+ $('restart-pyload').addEvent "click", (e) ->
+ new MooDialog.Confirm "{{_('Are you sure you want to restart pyLoad?')}}", ->
+ new Request.JSON({
+ url: '/api/restart'
+ method: 'get'
+ onSuccess: (data) -> alert "{{_('pyLoad restarted')}}"
+ }).send()
+ , ->
+ e.stop()