collapsible api keys

This commit is contained in:
Paul Liverman III 2018-04-24 10:20:50 -07:00
parent 13c564d49e
commit f7b08a112c
4 changed files with 45 additions and 7 deletions

View File

@ -19,6 +19,9 @@ class extends Widget
link rel: "stylesheet", href: "https://cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css" link rel: "stylesheet", href: "https://cdn.rawgit.com/milligram/milligram/master/dist/milligram.min.css"
-- JQuery -- JQuery
script src: "https://code.jquery.com/jquery-3.3.1.min.js", integrity: "sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=", crossorigin: "anonymous" script src: "https://code.jquery.com/jquery-3.3.1.min.js", integrity: "sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=", crossorigin: "anonymous"
-- custom JS/CSS
script src: "/static/main.js"
link rel: "stylesheet", href: "/static/main.css"
body -> body ->
div class: "container", -> div class: "container", ->
@content_for "inner" @content_for "inner"

19
static/main.css Normal file
View File

@ -0,0 +1,19 @@
.collapsible {
cursor: pointer;
width: 100%;
/*border: none;*/
/*text-align: left;*/
/*outline: none;*/
/*font-size: 15px;*/
}
/*.active, .collapsible:hover {
background-color: #ccc;
}*/
.content {
/*padding: 0 18px;*/
display: none;
overflow: hidden;
/*background-color: #f1f1f1;*/
}

15
static/main.js Normal file
View File

@ -0,0 +1,15 @@
$(document).ready(function() {
let c = document.getElementsByClassName("collapsible");
for (let i = 0; i < c.length; i++) {
c[i].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
});

View File

@ -5,13 +5,14 @@ class LoggedIn extends Widget
script -> raw "var API_KEY = '#{@keys[1].key}';" script -> raw "var API_KEY = '#{@keys[1].key}';"
script src: "/static/index.js" script src: "/static/index.js"
p "API Keys:" button class: "collapsible", "API Keys"
ul -> div class: "content", ->
if @keys ul ->
for key in *@keys if @keys
li key.key for key in *@keys
li id: "new-api-key", -> li key.key
button onclick: "new_api_key()", "+" li id: "new-api-key", ->
button onclick: "new_api_key()", "New API Key"
p "Tasks:" p "Tasks:"
ul -> ul ->