service-switch 前端

This commit is contained in:
jysperm
2014-07-21 10:35:00 +08:00
parent 32b28ddcd5
commit 7bfd74a175
2 changed files with 15 additions and 18 deletions

View File

@@ -1,4 +1,11 @@
$ ->
$('#service-switch button').click ->
is_enable = if $(@).hasClass 'btn-success' then true else false
$.post "/plugin/#{$(@).data('name')}/switch/", JSON.stringify
enable: is_enable
.success ->
location.reload()
service = $ '#service'
service.find 'button'
.on 'click', (e) ->
@@ -22,14 +29,6 @@ $ ->
ErrorHandle.flushInfo 'success', '修改成功', ->
location.reload()
fpm = $ '#phpfpm'
fpm.on 'click', (e) ->
e.preventDefault()
enable = if fpm.hasClass 'btn-success' then true else false
$.post '/plugin/phpfpm/switch/', JSON.stringify {enable: enable}
.success ->
location.reload()
#nginx
$ '.nginx-edit-btn'
.on 'click', (e) ->
e.preventDefault()
@@ -70,9 +69,6 @@ $ ->
catch e
alert '配置文件格式不正确'
#mysql插件
mysql = $ '#mysql-input'
mysql.find 'button'
.on 'click', (e) ->

View File

@@ -48,13 +48,14 @@ block content
else
button.btn.btn-success.btn-sm= t('plan.subscribe')
#service-switch.row
header 服务开关
for name in switch_buttons
if account.attribute.plugin[name].is_enable
button(data-name= name).btn.btn-danger 关闭 #{t('plugins.' + name + '.name')}
else
button(data-name= name).btn.btn-success 开启 #{t('plugins.' + name + '.name')}
if switch_buttons.length
#service-switch.row
header 服务开关
for name in switch_buttons
if account.attribute.plugin[name].is_enable
button(data-name= name).btn.btn-danger 关闭 #{t('plugins.' + name + '.name')}
else
button(data-name= name).btn.btn-success 开启 #{t('plugins.' + name + '.name')}
for widget in widgets
.row