forked from shaba/openuds
Started dashboard permissions edit
This commit is contained in:
parent
9920af9c59
commit
48df4390bd
@ -120,6 +120,7 @@ gui.providers.link = (event) ->
|
||||
"edit"
|
||||
"delete"
|
||||
"xls"
|
||||
"permissions"
|
||||
]
|
||||
onEdit: gui.methods.typedEdit(services, gettext("Edit service"), gettext("Service creation error"))
|
||||
onNew: gui.methods.typedNew(services, gettext("New service"), gettext("Service saving error"))
|
||||
@ -167,6 +168,7 @@ gui.providers.link = (event) ->
|
||||
}
|
||||
"delete"
|
||||
"xls"
|
||||
"permissions"
|
||||
]
|
||||
onNew: gui.methods.typedNew(gui.providers, gettext("New services provider"), gettext("Services provider creation error"), testButton)
|
||||
onEdit: gui.methods.typedEdit(gui.providers, gettext("Edit services provider"), gettext("Services Provider saving error"), testButton)
|
||||
|
@ -259,9 +259,18 @@
|
||||
sel = @fnGetSelectedData()
|
||||
enable = (if sel.length is 1 then onCheck("delete", sel) else false)
|
||||
if enable
|
||||
$(btn).removeClass("disabled").addClass "btn3d-warning"
|
||||
$(btn).removeClass("disabled").addClass "btn3d-danger"
|
||||
else
|
||||
$(btn).removeClass("btn3d-warning").addClass "disabled"
|
||||
$(btn).removeClass("btn3d-danger").addClass "disabled"
|
||||
return
|
||||
|
||||
permissionsSelected = (btn, obj, node) ->
|
||||
sel = @fnGetSelectedData()
|
||||
enable = (if sel.length is 1 then onCheck("delete", sel) else false)
|
||||
if enable
|
||||
$(btn).removeClass("disabled").addClass "btn3d-success"
|
||||
else
|
||||
$(btn).removeClass("btn3d-success").addClass "disabled"
|
||||
return
|
||||
|
||||
$.each tblParams.buttons, (index, value) -> # Iterate through button definition
|
||||
@ -319,6 +328,14 @@
|
||||
sButtonText: gui.config.dataTableButtons.refresh.text
|
||||
fnClick: refreshFnc
|
||||
sButtonClass: gui.config.dataTableButtons.refresh.css
|
||||
when "permissions"
|
||||
if api.config.admin
|
||||
btn =
|
||||
sExtends: "text"
|
||||
sButtonText: gui.config.dataTableButtons.permissions.text
|
||||
fnSelect: permissionsSelected
|
||||
fnClick: clickHandlerFor(gui.permissions, "permissions")
|
||||
sButtonClass: gui.config.dataTableButtons.permissions.css
|
||||
when "xls"
|
||||
btn =
|
||||
sExtends: "text"
|
||||
@ -326,7 +343,6 @@
|
||||
fnClick: -> # Export to excel
|
||||
api.spreadsheet.tableToExcel(tableId, title)
|
||||
return
|
||||
|
||||
# End export to excell
|
||||
sButtonClass: gui.config.dataTableButtons.xls.css
|
||||
else # Custom button, this has to be
|
||||
|
2
server/src/uds/static/adm/js/gui-permissions.coffee
Normal file
2
server/src/uds/static/adm/js/gui-permissions.coffee
Normal file
@ -0,0 +1,2 @@
|
||||
gui.permissions = () ->
|
||||
gui.launchModal gettext("Permissions"), "Content"
|
@ -45,6 +45,10 @@
|
||||
text: "<span class=\"fa fa-trash-o\"></span> <span class=\"label-tbl-button\">" + gettext("Delete") + "</span>"
|
||||
css: "btn disabled btn3d-default btn3d btn3d-tables"
|
||||
|
||||
permissions:
|
||||
text: "<span class=\"fa fa-save\"></span> <span class=\"label-tbl-button\">" + gettext("Permissions") + "</span>"
|
||||
css: "btn disabled btn3d-default btn3d btn3d-tables"
|
||||
|
||||
xls:
|
||||
text: "<span class=\"fa fa-save\"></span> <span class=\"label-tbl-button\">" + gettext("Xls") + "</span>"
|
||||
css: "btn btn3d-info btn3d btn3d-tables"
|
||||
@ -94,8 +98,6 @@
|
||||
footer: options.footer
|
||||
button1: options.closeButton
|
||||
button2: options.actionButton
|
||||
|
||||
|
||||
|
||||
# As previous, this creates the modal and shows it. in this case, the id of the modal returned already has '#'
|
||||
gui.launchModal = (title, content, options) ->
|
||||
|
@ -52,6 +52,7 @@
|
||||
(function(api){
|
||||
api.config = {
|
||||
token: "{% auth_token %}",
|
||||
admin: {{ request.user.is_admin|lower }},
|
||||
auth_header: "{% auth_token_header %}",
|
||||
lang: "{{ LANGUAGE_CODE }}",
|
||||
base_url: "{% url 'REST' '' %}",
|
||||
@ -114,6 +115,7 @@
|
||||
<script type="text/coffeescript" charset="utf-8" src="{% get_static_prefix %}adm/js/gui.coffee"></script>
|
||||
<script type="text/coffeescript" charset="utf-8" src="{% get_static_prefix %}adm/js/gui-tools.coffee"></script>
|
||||
<script type="text/coffeescript" charset="utf-8" src="{% get_static_prefix %}adm/js/gui-form.coffee"></script>
|
||||
<script type="text/coffeescript" charset="utf-8" src="{% get_static_prefix %}adm/js/gui-permissions.coffee"></script>
|
||||
<script type="text/coffeescript" charset="utf-8" src="{% get_static_prefix %}adm/js/gui-element.coffee"></script>
|
||||
|
||||
<!-- user interface management -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user