add color command
Allow room managers to set the colors of rooms. Change-Id: I252d52db0cdf6c25e7c9be95c0debb49bd983cbd Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
985dd4bd0b
commit
9dc9d866ac
10
README.rst
10
README.rst
|
@ -21,6 +21,7 @@ You have to have voice in the channel (+v) to send commands to the ptgbot.
|
|||
Commands follow the following format::
|
||||
|
||||
#ROOMNAME [now|next] TOPIC
|
||||
#ROOMNAME [color] CSS_COLOR_SPECIFIER
|
||||
|
||||
Please note that:
|
||||
|
||||
|
@ -32,14 +33,23 @@ Please note that:
|
|||
wipes out any "next" entry for the same room. You might want to refresh
|
||||
those after entering a "now" topic.
|
||||
|
||||
* The color command only sets the background color for the room
|
||||
name. The foreground is always white. Colors can be specified in any
|
||||
form supported by the CSS attribute background-color.
|
||||
|
||||
Example::
|
||||
|
||||
#swift now discussing ring placement
|
||||
#swift color blue
|
||||
#swift next at 2pm we plan to discuss #glance support
|
||||
#swift next around 3pm we plan to cover cold storage features
|
||||
...
|
||||
#swift now discussing #glance support, come over!
|
||||
#swift next at 3pm we plan to cover cold storage features
|
||||
...
|
||||
#oslo now discussing oslo.config drivers
|
||||
#oslo color #42f4c5
|
||||
#oslo next after lunch we plan to discuss auto-generating config reference docs
|
||||
|
||||
You can also remove all entries related to your room by issuing the following
|
||||
command::
|
||||
|
|
|
@ -16,12 +16,19 @@
|
|||
</div>
|
||||
|
||||
<script id="PTGtemplate" type="text/x-handlebars-template">
|
||||
<style>
|
||||
{{#each colors as |color room|}}
|
||||
.{{room}} {
|
||||
background-color: {{color}};
|
||||
}
|
||||
{{/each}}
|
||||
</style>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h3 class="panel-title">Currently playing...</h3></div>
|
||||
<table class="table">
|
||||
{{#each now}}
|
||||
<tr>
|
||||
<td class="col-sm-1"><span class="label label-primary">{{@key}}</span></td>
|
||||
<td class="col-sm-1"><span class="label label-primary {{@key}}">{{@key}}</span></td>
|
||||
<td>{{#hashtag}}{{this}}{{/hashtag}}</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
|
@ -34,7 +41,7 @@
|
|||
<table class="table">
|
||||
{{#each next as |sessions room|}}
|
||||
<tr>
|
||||
<td class="col-sm-1"><span class="label label-primary">{{room}}</span></td>
|
||||
<td class="col-sm-1"><span class="label label-primary {{room}}">{{room}}</span></td>
|
||||
<td>
|
||||
{{#each sessions}}
|
||||
{{#hashtag}}{{this}}{{/hashtag}}<br/>
|
||||
|
|
|
@ -135,6 +135,8 @@ class PTGBot(irc.bot.SingleServerIRCBot):
|
|||
self.data.add_next(room, session)
|
||||
elif adverb == 'clean':
|
||||
self.data.clean_rooms([room])
|
||||
elif adverb == 'color':
|
||||
self.data.add_color(room, session)
|
||||
else:
|
||||
self.send(chan, "%s: unknown directive '%s'" % (nick, adverb))
|
||||
self.usage(chan)
|
||||
|
|
|
@ -21,7 +21,7 @@ import datetime
|
|||
|
||||
class PTGDataBase():
|
||||
|
||||
BASE = {'rooms': [], 'ethercalc': [], 'now': {}, 'next': {}}
|
||||
BASE = {'rooms': [], 'ethercalc': [], 'now': {}, 'next': {}, 'colors': {}}
|
||||
|
||||
def __init__(self, filename, ethercalc):
|
||||
self.filename = filename
|
||||
|
@ -39,6 +39,10 @@ class PTGDataBase():
|
|||
del self.data['next'][room]
|
||||
self.save()
|
||||
|
||||
def add_color(self, room, color):
|
||||
self.data['colors'][room] = color
|
||||
self.save()
|
||||
|
||||
def add_next(self, room, session):
|
||||
if room not in self.data['next']:
|
||||
self.data['next'][room] = []
|
||||
|
|
Loading…
Reference in New Issue