Skip to content

Commit fe15e4d

Browse files
committed
Various changes and tweaks to WebUI
1 parent a67d577 commit fe15e4d

5 files changed

Lines changed: 52 additions & 22 deletions

File tree

cloudbot/web/static/css/style.css

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,20 @@ body {
88
}
99

1010
#about-dialog {
11-
top:20%;
11+
top: 20%;
12+
}
13+
14+
footer {
15+
margin: 5em 0;
16+
}
17+
18+
footer li {
19+
float: left;
20+
margin-right: 1.5em;
21+
margin-bottom: 1.5em
22+
}
23+
24+
footer p {
25+
clear: left;
26+
margin-bottom: 0
1227
}

cloudbot/web/templates/commands.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44
{% block content %}
55
<div class="row">
66
<div class="col-lg-12">
7+
78
<div class="page-header">
89
<h2 id="container">Command List</h2>
910
</div>
11+
1012
<p class="lead">{{ bot_name }} has a large selection of commands that can do all kinds of useful tasks.
1113
Below is an automatically-generated list of every command the bot currently knows.</p>
14+
<div class="alert alert-dismissible alert-warning">
15+
<button type="button" class="close" data-dismiss="alert">×</button>
16+
<h4>Under Construction!</h4>
17+
<p>This page is still under construction, and may provide incorrect data.</p>
18+
</div>
1219
<table class="table table-striped sortable" id="commands">
1320
<thead>
1421
<tr>
@@ -26,11 +33,11 @@ <h2 id="container">Command List</h2>
2633
<i class ="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="left" title="{{ perm }}"></i>
2734
</td>
2835
{% else %}
29-
<td data-value="zzzz"></td>
36+
<td class="hidden-phone hidden-tablet"a data-value="zz"></td>
3037
{% endif %}
3138
</tr>
3239
{% endfor %}
3340
</table>
3441
</div>
3542
</div>
36-
{% endblock %}
43+
{% endblock %}glyphicon glyphicon-th-large

cloudbot/web/templates/layout.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@
4242
<span class="icon-bar"></span>
4343
<span class="icon-bar"></span>
4444
</button>
45-
<a class="navbar-brand" data-toggle="tooltip" data-placement="bottom" title="Return to top" onclick="$('html,body').animate({scrollTop:0},'slow');return false;">{{ bot_name }}</a>
45+
<a class="navbar-brand" data-toggle="tooltip" data-placement="bottom" title="Return to top"
46+
onclick="$('html,body').animate({scrollTop:0},'slow');return false;">{{ bot_name }}</a>
4647
</div>
4748
<div id="navbar" class="collapse navbar-collapse">
4849
<ul class="nav navbar-nav">
@@ -54,6 +55,10 @@
5455
<ul class="nav navbar-nav navbar-right">
5556
<li>
5657
<a href="#" data-toggle="modal" data-target="#about-dialog">About</a>
58+
59+
</li>
60+
<li>
61+
<a data-container="body" data-toggle="popover" data-placement="bottom" data-content="todo admin" class="glyphicon glyphicon-tasks"></a>
5762
</li>
5863
</ul>
5964
</div>
@@ -62,6 +67,7 @@
6267
</nav>
6368

6469
<div class="container">
70+
6571
{% block content %}{% endblock %}
6672
</div>
6773

@@ -83,6 +89,7 @@ <h4 class="modal-title">About Me</h4>
8389
</div>
8490
</div>
8591

92+
8693
<!-- javascript -->
8794
{% block scripts %}
8895
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
@@ -91,7 +98,8 @@ <h4 class="modal-title">About Me</h4>
9198
<script src="/s/js/bootstrap-sortable.js"></script>
9299
<script>
93100
$(function () {
94-
$('[data-toggle="tooltip"]').tooltip()
101+
$('[data-toggle="tooltip"]').tooltip();
102+
$('[data-toggle="popover"]').popover();
95103
})
96104
</script>
97105
{% endblock %}

plugins/utility.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,56 +90,56 @@ def qrcode(text):
9090

9191
# basic text tools
9292

93-
@hook.command("capitalise", "capitalize")
93+
@hook.command("capitalize", "capitalise")
9494
def capitalize(text):
95-
"""capitalize <string> -- Capitalizes <string>.
95+
"""<string> -- Capitalizes <string>.
9696
:type text: str
9797
"""
9898
return ". ".join([sentence.capitalize() for sentence in text.split(". ")])
9999

100100

101101
@hook.command
102102
def upper(text):
103-
"""upper <string> -- Convert string to uppercase."""
103+
"""<string> -- Convert string to uppercase."""
104104
return text.upper()
105105

106106

107107
@hook.command
108108
def lower(text):
109-
"""lower <string> -- Convert string to lowercase."""
109+
"""<string> -- Convert string to lowercase."""
110110
return text.lower()
111111

112112

113113
@hook.command
114114
def titlecase(text):
115-
"""title <string> -- Convert string to title case."""
115+
"""<string> -- Convert string to title case."""
116116
return text.title()
117117

118118

119119
@hook.command
120120
def swapcase(text):
121-
"""swapcase <string> -- Swaps the capitalization of <string>."""
121+
"""<string> -- Swaps the capitalization of <string>."""
122122
return text.swapcase()
123123

124124

125125
# encoding
126126

127127
@hook.command("rot13")
128128
def rot13_encode(text):
129-
"""rot13 <string> -- Encode <string> with rot13."""
129+
"""<string> -- Encode <string> with rot13."""
130130
encoder = codecs.getencoder("rot-13")
131131
return encoder(text)[0]
132132

133133

134134
@hook.command("base64")
135135
def base64_encode(text):
136-
"""base64 <string> -- Encode <string> with base64."""
136+
"""<string> -- Encode <string> with base64."""
137137
return base64.b64encode(text.encode()).decode()
138138

139139

140140
@hook.command("debase64", "unbase64")
141141
def base64_decode(text, notice):
142-
"""unbase64 <string> -- Decode <string> with base64."""
142+
"""<string> -- Decode <string> with base64."""
143143
try:
144144
return base64.b64decode(text.encode()).decode()
145145
except binascii.Error:
@@ -148,7 +148,7 @@ def base64_decode(text, notice):
148148

149149
@hook.command("isbase64", "checkbase64")
150150
def base64_check(text):
151-
"""isbase64 <string> -- Checks if <string> is a valid base64 encoded string"""
151+
"""<string> -- Checks if <string> is a valid base64 encoded string"""
152152
try:
153153
base64.b64decode(text.encode())
154154
except binascii.Error:
@@ -159,14 +159,14 @@ def base64_check(text):
159159

160160
@hook.command
161161
def unescape(text):
162-
"""unescape <string> -- Unicode unescapes <string>."""
162+
"""<string> -- Unicode unescapes <string>."""
163163
decoder = codecs.getdecoder("unicode_escape")
164164
return decoder(text)[0]
165165

166166

167167
@hook.command
168168
def escape(text):
169-
"""escape <string> -- Unicode escapes <string>."""
169+
"""<string> -- Unicode escapes <string>."""
170170
encoder = codecs.getencoder("unicode_escape")
171171
return encoder(text)[0].decode()
172172

@@ -176,7 +176,7 @@ def escape(text):
176176

177177
@hook.command
178178
def length(text):
179-
"""length <string> -- Gets the length of <string>"""
179+
"""<string> -- Gets the length of <string>"""
180180
return "The length of that string is {} characters.".format(len(text))
181181

182182

@@ -185,7 +185,7 @@ def length(text):
185185

186186
@hook.command
187187
def reverse(text):
188-
"""reverse <string> -- Reverses <string>."""
188+
"""<string> -- Reverses <string>."""
189189
return text[::-1]
190190

191191

@@ -194,7 +194,7 @@ def reverse(text):
194194

195195
@hook.command("hash")
196196
def hash_command(text):
197-
"""hash <string> -- Returns hashes of <string>."""
197+
"""<string> -- Returns hashes of <string>."""
198198
return ', '.join(x + ": " + getattr(hashlib, x)(text.encode("utf-8")).hexdigest()
199199
for x in ['md5', 'sha1', 'sha256'])
200200

@@ -218,7 +218,7 @@ def leet(text):
218218
# Based on plugin by FurCode - <https://github.com/FurCode/RoboCop2>
219219
@hook.command
220220
def derpify(text):
221-
"""derpify <text> - returns some amusing responses from your input."""
221+
"""<text> - returns some amusing responses from your input."""
222222
string = text.upper()
223223
pick_the = random.choice(["TEH", "DA"])
224224
pick_e = random.choice(["E", "3", "A"])

plugins/wolframalpha.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@hook.command("wolframalpha", "wa", "calc", "ca", "math")
1818
def wolframalpha(text, bot):
19-
"""w<query> -- Computes <query> using Wolfram Alpha."""
19+
"""<query> -- Computes <query> using Wolfram Alpha."""
2020
api_key = bot.config.get("api_keys", {}).get("wolframalpha", None)
2121
if not api_key:
2222
return "error: missing api key"

0 commit comments

Comments
 (0)