Skip to content

Commit 2d3c427

Browse files
committed
Share permission form control styles
1 parent 56b818f commit 2d3c427

3 files changed

Lines changed: 39 additions & 62 deletions

File tree

datasette/templates/_permission_ui_styles.html

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,55 @@
66
padding: 1.5em;
77
margin-bottom: 2em;
88
}
9+
.permission-form form {
10+
max-width: 60rem;
11+
}
912
.form-section {
10-
margin-bottom: 1em;
13+
margin-bottom: 1.25em;
1114
}
1215
.form-section label {
1316
display: block;
1417
margin-bottom: 0.3em;
1518
font-weight: bold;
1619
}
1720
.form-section input[type="text"],
18-
.form-section select {
19-
width: 100%;
20-
max-width: 500px;
21-
padding: 0.5em;
21+
.form-section select,
22+
.permission-textarea {
23+
background-color: #fff;
24+
border: 1px solid #aaa;
25+
border-radius: 4px;
2226
box-sizing: border-box;
23-
border: 1px solid #ccc;
24-
border-radius: 3px;
27+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
28+
color: #222;
29+
font-family: inherit;
30+
font-size: 1rem;
31+
line-height: 1.4;
32+
max-width: none;
33+
width: 100%;
34+
}
35+
.form-section input[type="text"] {
36+
padding: 0.6rem 0.75rem;
37+
}
38+
.form-section select {
39+
min-height: 2.75rem;
40+
padding: 0.6rem 0.75rem;
41+
}
42+
.permission-textarea {
43+
font-family: monospace;
44+
min-height: 12rem;
45+
padding: 0.75rem;
46+
resize: vertical;
2547
}
2648
.form-section input[type="text"]:focus,
27-
.form-section select:focus {
28-
outline: 2px solid #0066cc;
49+
.form-section select:focus,
50+
.permission-textarea:focus {
2951
border-color: #0066cc;
52+
box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.18);
53+
outline: none;
3054
}
3155
.form-section small {
3256
display: block;
33-
margin-top: 0.3em;
57+
margin-top: 0.45em;
3458
color: #666;
3559
}
3660
.form-actions {

datasette/templates/allow_debug.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@
33
{% block title %}Debug allow rules{% endblock %}
44

55
{% block extra_head %}
6+
{% include "_permission_ui_styles.html" %}
67
<style>
7-
textarea {
8-
height: 10em;
9-
width: 95%;
10-
box-sizing: border-box;
11-
padding: 0.5em;
12-
border: 2px dotted black;
13-
}
148
.two-col {
159
display: inline-block;
1610
width: 48%;
@@ -41,11 +35,11 @@ <h1>Debug allow rules</h1>
4135
<form class="core" action="{{ urls.path('-/allow-debug') }}" method="get" style="margin-bottom: 1em">
4236
<div class="two-col">
4337
<p><label>Allow block</label></p>
44-
<textarea name="allow">{{ allow_input }}</textarea>
38+
<textarea class="permission-textarea" name="allow">{{ allow_input }}</textarea>
4539
</div>
4640
<div class="two-col">
4741
<p><label>Actor</label></p>
48-
<textarea name="actor">{{ actor_input }}</textarea>
42+
<textarea class="permission-textarea" name="actor">{{ actor_input }}</textarea>
4943
</div>
5044
<div style="margin-top: 1em;">
5145
<input type="submit" value="Apply allow block to actor">

datasette/templates/debug_check.html

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,6 @@
77
{% include "_permission_ui_styles.html" %}
88
{% include "_debug_common_functions.html" %}
99
<style>
10-
.permission-check-form form {
11-
max-width: 60rem;
12-
}
13-
.permission-check-form .form-section {
14-
margin-bottom: 1.25em;
15-
}
16-
.permission-check-form .form-section select,
17-
.permission-check-form .form-section input[type="text"],
18-
#actor {
19-
background-color: #fff;
20-
border: 1px solid #aaa;
21-
border-radius: 4px;
22-
box-sizing: border-box;
23-
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
24-
color: #222;
25-
font-family: inherit;
26-
font-size: 1rem;
27-
line-height: 1.4;
28-
max-width: none;
29-
width: 100%;
30-
}
31-
.permission-check-form .form-section select {
32-
min-height: 2.75rem;
33-
padding: 0.6rem 0.75rem;
34-
}
35-
#actor {
36-
font-family: monospace;
37-
min-height: 12rem;
38-
padding: 0.75rem;
39-
resize: vertical;
40-
}
41-
.permission-check-form .form-section select:focus,
42-
.permission-check-form .form-section input[type="text"]:focus,
43-
#actor:focus {
44-
border-color: #0066cc;
45-
box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.18);
46-
outline: none;
47-
}
48-
.permission-check-form .form-section small {
49-
margin-top: 0.45em;
50-
}
5110
#output {
5211
margin-top: 2em;
5312
padding: 1em;
@@ -154,11 +113,11 @@ <h1>Explain a permission decision</h1>
154113

155114
<p>Test an actor, action and resource. The result explains which rules matched, which specificity level won, and whether actor restrictions or required actions changed the verdict.</p>
156115

157-
<div class="permission-form permission-check-form">
116+
<div class="permission-form">
158117
<form id="check-form" method="get" action="{{ urls.path('-/check') }}">
159118
<div class="form-section">
160119
<label for="actor">Actor JSON:</label>
161-
<textarea id="actor" name="actor">{{ actor_json }}</textarea>
120+
<textarea class="permission-textarea" id="actor" name="actor">{{ actor_json }}</textarea>
162121
<small>Use <code>null</code> for an anonymous actor. This actor is simulated; it does not change who you are signed in as.</small>
163122
</div>
164123

0 commit comments

Comments
 (0)