Skip to content

Commit a67d577

Browse files
committed
Add column for permissions
1 parent 8abd878 commit a67d577

3 files changed

Lines changed: 46 additions & 28 deletions

File tree

cloudbot/web/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ def get(self):
6464
doc = "Command has no documentation.".format(command)
6565

6666
if plugin.permissions:
67-
doc += " (Permission required: {})\n\n".format(", ".join(plugin.permissions))
67+
perm = ", ".join(plugin.permissions)
68+
else:
69+
perm = None
6870

69-
commands.append((cmd, doc))
71+
commands.append((cmd, doc, perm))
7072

7173
args = {
7274
'bot_name': wi.config.get('bot_name', 'CloudBot'),

cloudbot/web/templates/commands.html

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,32 @@
55
<div class="row">
66
<div class="col-lg-12">
77
<div class="page-header">
8-
<h2 id="container">Commands</h2>
8+
<h2 id="container">Command List</h2>
99
</div>
10-
<!--<p class="lead">How to use {{ bot_name }} commands.</p>-->
11-
<table class="table table-striped sortable">
10+
<p class="lead">{{ bot_name }} has a large selection of commands that can do all kinds of useful tasks.
11+
Below is an automatically-generated list of every command the bot currently knows.</p>
12+
<table class="table table-striped sortable" id="commands">
1213
<thead>
1314
<tr>
14-
<th class='az' data-defaultsign="nospan" data-defaultsort="asc"><i class="fa fa-map-marker fa-fw"></i>Command</th>
15+
<th class='az' data-defaultsign="nospan" data-defaultsort="asc">Command</th>
1516
<th data-defaultsort='disabled'>Description</th>
17+
<th><i class ="glyphicon glyphicon-lock"></i></th>
1618
</tr>
1719
</thead>
18-
{% for cmd, doc in commands %}
20+
{% for cmd, doc, perm in commands %}
1921
<tr>
2022
<td>{{ cmd | e }}</td>
2123
<td>{{ doc | e }}</td>
24+
{% if perm %}
25+
<td data-value="{{ perm|truncate(6, True, '') }}">
26+
<i class ="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="left" title="{{ perm }}"></i>
27+
</td>
28+
{% else %}
29+
<td data-value="zzzz"></td>
30+
{% endif %}
2231
</tr>
2332
{% endfor %}
2433
</table>
2534
</div>
2635
</div>
27-
{% endblock %}
36+
{% endblock %}

cloudbot/web/templates/layout.html

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<span class="icon-bar"></span>
4343
<span class="icon-bar"></span>
4444
</button>
45-
<a class="navbar-brand" href="#">{{ bot_name }}</a>
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>
4646
</div>
4747
<div id="navbar" class="collapse navbar-collapse">
4848
<ul class="nav navbar-nav">
@@ -55,7 +55,7 @@
5555
<li>
5656
<a href="#" data-toggle="modal" data-target="#about-dialog">About</a>
5757
</li>
58-
</ul>
58+
</ul>
5959
</div>
6060
<!--/.nav-collapse -->
6161
</div>
@@ -66,28 +66,35 @@
6666
</div>
6767

6868
<div class="modal fade" id="about-dialog">
69-
<div class="modal-dialog">
70-
<div class="modal-content">
71-
<div class="modal-header">
72-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
73-
<h4 class="modal-title">About Me</h4>
74-
</div>
75-
<div class="modal-body">
76-
<p><strong>{{ bot_name }}</strong> is running version <strong>{{ bot_version }}</strong> of CloudBot.
77-
</p>
78-
</div>
79-
<div class="modal-footer">
80-
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
81-
</div>
69+
<div class="modal-dialog">
70+
<div class="modal-content">
71+
<div class="modal-header">
72+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
73+
<h4 class="modal-title">About Me</h4>
74+
</div>
75+
<div class="modal-body">
76+
<p><strong>{{ bot_name }}</strong> is running version <strong>{{ bot_version }}</strong> of CloudBot.
77+
</p>
78+
</div>
79+
<div class="modal-footer">
80+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
81+
</div>
82+
</div>
8283
</div>
83-
</div>
8484
</div>
8585

8686
<!-- javascript -->
87-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
88-
<script src="/s/js/bootstrap.min.js"></script>
89-
<script src="/s/js/moment.min.js"></script>
90-
<script src="/s/js/bootstrap-sortable.js"></script>
87+
{% block scripts %}
88+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
89+
<script src="/s/js/bootstrap.min.js"></script>
90+
<script src="/s/js/moment.min.js"></script>
91+
<script src="/s/js/bootstrap-sortable.js"></script>
92+
<script>
93+
$(function () {
94+
$('[data-toggle="tooltip"]').tooltip()
95+
})
96+
</script>
97+
{% endblock %}
9198
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
9299
<script src="/s/js/ie10-viewport-bug-workaround.js"></script>
93100
</body>

0 commit comments

Comments
 (0)