2019-04-17 23:15:03 +02:00
|
|
|
###
|
|
|
|
LemonLDAP::NG Favorite Applications script
|
|
|
|
###
|
|
|
|
|
|
|
|
# FavApps function (launched by "star" icon)
|
2019-04-24 12:15:49 +02:00
|
|
|
FavApps = (star) ->
|
2019-04-17 23:15:03 +02:00
|
|
|
$.ajax
|
|
|
|
type: "POST"
|
|
|
|
url: "#{portal}favapps"
|
|
|
|
data:
|
2019-04-24 12:15:49 +02:00
|
|
|
app: star.attr 'appuri'
|
|
|
|
logo: star.attr 'logo'
|
|
|
|
desc: star.attr 'desc'
|
|
|
|
title: star.attr 'title'
|
2019-04-17 23:15:03 +02:00
|
|
|
dataType: 'json'
|
|
|
|
success: (resp) ->
|
|
|
|
if resp.error
|
2019-04-24 23:29:56 +02:00
|
|
|
console.log 'Max number reached'
|
2019-04-24 12:15:49 +02:00
|
|
|
switchStar star, 0
|
2019-04-17 23:15:03 +02:00
|
|
|
else if resp.result
|
2019-04-24 12:15:49 +02:00
|
|
|
console.log 'App. registered'
|
|
|
|
switchStar star, 1
|
2019-04-17 23:15:03 +02:00
|
|
|
else
|
2019-04-24 12:15:49 +02:00
|
|
|
console.log 'App. unregistered'
|
|
|
|
switchStar star, 0
|
2019-04-17 23:15:03 +02:00
|
|
|
#error: switchStar star, '0'
|
|
|
|
|
|
|
|
switchStar = (star, status) ->
|
2019-04-24 12:15:49 +02:00
|
|
|
star.attr('src', "#{window.staticPrefix}common/icons/star#{status}.png")
|
2019-04-17 23:15:03 +02:00
|
|
|
|
|
|
|
# Switch "star" events
|
|
|
|
$(document).ready ->
|
2019-04-24 12:15:49 +02:00
|
|
|
$('body').on 'click', '.star', () -> FavApps $(this)
|