bsw@564: ui.title(_"Developer settings") bsw@564: bsw@1045: execute.view { bsw@1045: module = "member", view = "_sidebar_whatcanido", params = { bsw@1045: member = app.session.member bsw@1045: } bsw@1045: } bsw@10: bsw@564: local setting_key = "liquidfeedback_frontend_developer_features" bsw@564: local setting = Setting:by_pk(app.session.member.id, setting_key) bsw@51: bsw@1068: if setting then bsw@1045: ui.section( function() bsw@1045: ui.sectionHead( function () bsw@1045: ui.heading{ content = "CSS development settings" } bsw@1045: end ) bsw@1045: bsw@1045: ui.sectionRow( function() bsw@1045: ui.form{ bsw@1045: attr = { class = "vertical" }, bsw@1045: module = "member", bsw@1045: action = "update_stylesheet_url", bsw@1045: routing = { bsw@1045: ok = { bsw@1045: mode = "redirect", bsw@1045: module = "member", bsw@1045: view = "show", bsw@1045: id = app.session.member_id bsw@1045: } bsw@1045: }, bsw@1045: content = function() bsw@1045: local setting_key = "liquidfeedback_frontend_stylesheet_url" bsw@1045: local setting = Setting:by_pk(app.session.member.id, setting_key) bsw@1045: local value = setting and setting.value bsw@1045: ui.field.text{ bsw@1045: label = "stylesheet URL", bsw@1045: name = "stylesheet_url", bsw@1045: value = value bsw@1045: } bsw@1045: ui.submit{ value = _"Set URL" } bsw@1045: end bsw@564: } bsw@1045: end ) bsw@1045: end ) bsw@564: end bsw@564: bsw@1045: ui.section( function() bsw@1045: ui.sectionHead( function () bsw@1045: ui.heading{ content = "API keys" } bsw@1045: end ) bsw@51: bsw@1045: ui.sectionRow( function() bsw@1045: local member_applications = MemberApplication:new_selector() bsw@1045: :add_where{ "member_id = ?", app.session.member.id } bsw@1045: :add_order_by("name, id") bsw@1045: :exec() bsw@1045: bsw@1045: if #member_applications > 0 then bsw@514: bsw@1045: ui.list{ bsw@1045: records = member_applications, bsw@1045: columns = { bsw@1045: { bsw@1045: name = "name", bsw@1045: label = "Name" bsw@1045: }, bsw@1045: { bsw@1045: name = "access_level", bsw@1045: label = "Access level" bsw@1045: }, bsw@1045: { bsw@1045: name = "key", bsw@1045: label = "API Key" bsw@1045: }, bsw@1045: { bsw@1045: name = "last_usage", bsw@1045: label = "Last usage" bsw@1045: }, bsw@1045: { bsw@1045: content = function(member_application) bsw@1045: ui.link{ bsw@1045: text = "delete", bsw@1045: module = "member", action = "update_api_key", id = member_application.id, bsw@1045: params = { delete = true }, bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = "member", bsw@1045: view = "developer_settings" bsw@1045: } bsw@1045: } bsw@514: } bsw@1045: end bsw@1045: }, bsw@1045: } bsw@1045: } bsw@564: bsw@1045: else bsw@1045: bsw@1045: slot.put(_"Currently no API key is set.") bsw@1045: slot.put(" ") bsw@1045: ui.link{ bsw@1045: text = _"Generate API key", bsw@564: module = "member", bsw@1045: action = "update_api_key", bsw@1045: routing = { bsw@1045: default = { bsw@1045: mode = "redirect", bsw@1045: module = "member", bsw@1045: view = "developer_settings" bsw@1045: } bsw@1045: } bsw@51: } bsw@1045: end bsw@1045: end ) bsw@1045: end )