Add 'My Channels' to prevent silly people from forgetting which rooms they own
This commit is contained in:
parent
6d37c63a3d
commit
b53ac91a61
4 changed files with 82 additions and 3 deletions
|
|
@ -47,6 +47,7 @@
|
|||
<li><a href="javascript:void(0)" id="pwreset">Reset Password</a></li>
|
||||
<li><a href="javascript:void(0)" id="profile">Edit Profile</a></li>
|
||||
<li><a href="javascript:void(0)" id="email">Change Email</a></li>
|
||||
<li><a href="javascript:void(0)" id="channels">My Channels</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span7">
|
||||
|
|
@ -208,6 +209,16 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="span7" id="channelspane" style="display: none">
|
||||
<h1>My Channels</h1>
|
||||
<table id="channellist" class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
<div class="push"></div>
|
||||
|
|
|
|||
|
|
@ -70,6 +70,33 @@ $("#profile").click(function() {
|
|||
});
|
||||
}
|
||||
});
|
||||
$("#channels").click(makeTabCallback("#channels", "#channelspane"));
|
||||
$("#channels").click(function () {
|
||||
if(!loggedin) {
|
||||
var error = $("<div/>").addClass("alert alert-error")
|
||||
.text("You must be logged in to view this page")
|
||||
.insertBefore($("#channellist"));
|
||||
$("<button/>").addClass("close pull-right").click(function () {
|
||||
error.remove();
|
||||
}).html("×").prependTo(error);
|
||||
return;
|
||||
}
|
||||
|
||||
$.getJSON(api + "listuserchannels?name=" + encodeURIComponent(uname) +
|
||||
"&session=" + session + "&callback=?", function(data) {
|
||||
$("#channellist tbody").remove();
|
||||
data.channels.forEach(function (chan) {
|
||||
var tr = $("<tr/>").appendTo($("#channellist"));
|
||||
var td = $("<td/>").appendTo(tr);
|
||||
$("<a/>").attr("href", "./r/" + chan.name)
|
||||
.attr("target", "_blank")
|
||||
.text(chan.name)
|
||||
.appendTo(td);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#registerbtn").click(function() {
|
||||
$("#registerpane").find(".alert-error").remove();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue