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