rev |
line source |
bsw@75
|
1 slot.put_into("title", _"Developer settings")
|
bsw@10
|
2
|
bsw@10
|
3 slot.select("actions", function()
|
bsw@10
|
4 ui.link{
|
bsw@10
|
5 content = function()
|
bsw@10
|
6 ui.image{ static = "icons/16/cancel.png" }
|
bsw@10
|
7 slot.put(_"Cancel")
|
bsw@10
|
8 end,
|
bsw@10
|
9 module = "member",
|
bsw@10
|
10 view = "settings"
|
bsw@10
|
11 }
|
bsw@10
|
12 end)
|
bsw@10
|
13
|
bsw@51
|
14 local setting_key = "liquidfeedback_frontend_developer_features"
|
bsw@51
|
15 local setting = Setting:by_pk(app.session.member.id, setting_key)
|
bsw@51
|
16
|
bsw@51
|
17 if setting then
|
bsw@51
|
18 ui.form{
|
bsw@51
|
19 attr = { class = "vertical" },
|
bsw@51
|
20 module = "member",
|
bsw@51
|
21 action = "update_stylesheet_url",
|
bsw@51
|
22 routing = {
|
bsw@51
|
23 ok = {
|
bsw@51
|
24 mode = "redirect",
|
bsw@51
|
25 module = "index",
|
bsw@51
|
26 view = "index"
|
bsw@51
|
27 }
|
bsw@51
|
28 },
|
bsw@51
|
29 content = function()
|
bsw@51
|
30 local setting_key = "liquidfeedback_frontend_stylesheet_url"
|
bsw@51
|
31 local setting = Setting:by_pk(app.session.member.id, setting_key)
|
bsw@51
|
32 local value = setting and setting.value
|
bsw@51
|
33 ui.field.text{
|
bsw@51
|
34 label = _"Stylesheet URL",
|
bsw@51
|
35 name = "stylesheet_url",
|
bsw@51
|
36 value = value
|
bsw@51
|
37 }
|
bsw@51
|
38 ui.submit{ value = _"Set URL" }
|
bsw@51
|
39 end
|
bsw@10
|
40 }
|
bsw@51
|
41 end
|
bsw@51
|
42
|
bsw@514
|
43 ui.heading{ content = _"API keys" }
|
bsw@514
|
44
|
bsw@517
|
45 -- util.help("member.developer_settings.api_key", _"API key")
|
bsw@51
|
46
|
bsw@514
|
47 local member_applications = MemberApplication:new_selector()
|
bsw@514
|
48 :add_where{ "member_id = ?", app.session.member.id }
|
bsw@514
|
49 :add_order_by("name, id")
|
bsw@514
|
50 :exec()
|
bsw@514
|
51
|
bsw@514
|
52 if #member_applications > 0 then
|
bsw@514
|
53
|
bsw@514
|
54 ui.list{
|
bsw@514
|
55 records = member_applications,
|
bsw@514
|
56 columns = {
|
bsw@514
|
57 {
|
bsw@514
|
58 name = "name",
|
bsw@514
|
59 label = _"Name"
|
bsw@514
|
60 },
|
bsw@514
|
61 {
|
bsw@514
|
62 name = "access_level",
|
bsw@514
|
63 label = _"Access level"
|
bsw@514
|
64 },
|
bsw@514
|
65 {
|
bsw@514
|
66 name = "key",
|
bsw@514
|
67 label = _"API Key"
|
bsw@514
|
68 },
|
bsw@514
|
69 {
|
bsw@514
|
70 name = "last_usage",
|
bsw@514
|
71 label = "Last usage"
|
bsw@514
|
72 },
|
bsw@514
|
73 {
|
bsw@514
|
74 content = function(member_application)
|
bsw@514
|
75 ui.link{
|
bsw@514
|
76 text = _"Delete",
|
bsw@514
|
77 module = "member", action = "update_api_key", id = member_application.id,
|
bsw@514
|
78 params = { delete = true },
|
bsw@514
|
79 routing = {
|
bsw@514
|
80 default = {
|
bsw@514
|
81 mode = "redirect",
|
bsw@514
|
82 module = "member",
|
bsw@514
|
83 view = "developer_settings"
|
bsw@514
|
84 }
|
bsw@514
|
85 }
|
bsw@514
|
86 }
|
bsw@514
|
87 end
|
bsw@514
|
88 },
|
bsw@51
|
89 }
|
bsw@10
|
90 }
|
bsw@514
|
91
|
bsw@51
|
92 else
|
bsw@514
|
93
|
bsw@51
|
94 slot.put(_"Currently no API key is set.")
|
bsw@51
|
95 slot.put(" ")
|
bsw@51
|
96 ui.link{
|
bsw@51
|
97 text = _"Generate API key",
|
bsw@51
|
98 module = "member",
|
bsw@51
|
99 action = "update_api_key",
|
bsw@51
|
100 routing = {
|
bsw@51
|
101 default = {
|
bsw@51
|
102 mode = "redirect",
|
bsw@51
|
103 module = "member",
|
bsw@51
|
104 view = "developer_settings"
|
bsw@51
|
105 }
|
bsw@51
|
106 }
|
bsw@51
|
107 }
|
bsw@10
|
108 end
|