Skip to content

Commit

Permalink
Finish message filtering feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Gao committed Jun 29, 2017
1 parent fc7b9e3 commit 60c8808
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void addSubscription(string userId){
_allUserIds.Add(userId);
}
public void removeSubscription(string userId){
_userIds.RemoveAt(_userIds.IndexOf(userId));
_userIds.Remove(userId);
_store.Remove(userId);
_shouldUpdateStore.Remove(userId);
_nextStartStore.Remove(userId);
Expand Down
24 changes: 15 additions & 9 deletions Views/User/Show.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<h3>All Users</h3>
<div class="col-md-3 contact-list-column">
<h3 class="subsection-header">群用户列表</h3>
<ul class="list-group" id="users-list"></ul>
</div>
<div class="col-md-4">
<h3>@ViewBag.Username 工作主页</h3>
<div class="col-md-5 work-table-column">
<h3 class="subsection-header">@ViewBag.Username 工作主页</h3>

<br/>
<h4>快捷功能</h4>
Expand All @@ -18,7 +18,7 @@
</form>

<hr/>
<h4>群内发言</h4>
<h4 class="subsection-header">群内发言</h4>
<form class="form-horizontal" id="work-log-form">
<input class="form-control" id="work-log" type="text" />
<br/>
Expand All @@ -30,8 +30,8 @@


</div>
<div class="col-md-4">
<h3>Message Box</h3>
<div class="col-md-4 message-column">
<h3 class="subsection-header">全部活动</h3>
<ul class="list-group" id="information-list"></ul>
</div>
</div>
Expand Down Expand Up @@ -78,11 +78,14 @@
function bindSilenceButtons(){
$(".silence-button").on("click", (e) => {
e.preventDefault();
var targetId = e.currentTarget.parentElement.dataset.targetid;
$(e.currentTarget).attr("disabled", true);
$.ajax({
url: "silence/id=" + dataStore.userId + "&targetId=" + targetId,
method: "POST",
success: function(response){
getUserStatus();
debugger;
},
error: function(response){
Expand All @@ -93,11 +96,14 @@
}
function bindUnsilenceButtons(){
$(".unsilence-button").on("click", (e) => {
e.preventDefault();
var targetId = e.currentTarget.parentElement.dataset.targetid;
$(e.currentTarget).attr("disabled", true);
$.ajax({
url: "unsilence/id=" + dataStore.userId + "&targetId=" + targetId,
method: "POST",
success: function(response){
getUserStatus();
debugger;
},
error: function(response){
Expand All @@ -116,8 +122,8 @@
$("#users-list").html("");
for(var i = 0; i < response.length; i++){
var responseFields = response[i].split(";");
$("#users-list").append("<li class='list-group-item' data-targetId='" + responseFields[0] + "'>" + responseFields[0] + " <button class='silence-button'>Silence</button><button class='unsilence-button'>Unsilence</button></li>");
var btn = responseFields[2] == "Silence" ? "<button class='silence-button btn btn-default'>静音</button>" : "<button class='unsilence-button btn btn-default'>收信</button>";
$("#users-list").append("<li class='list-group-item' data-targetId='" + responseFields[0] + "'>" + responseFields[0] + " " + btn + " </li>");
}
bindSilenceButtons();
bindUnsilenceButtons();
Expand Down
Binary file modified bin/Debug/netcoreapp1.1/AdminAPI.dll
Binary file not shown.
Binary file modified bin/Debug/netcoreapp1.1/AdminAPI.pdb
Binary file not shown.
Binary file modified obj/Debug/netcoreapp1.1/AdminAPI.dll
Binary file not shown.
Binary file modified obj/Debug/netcoreapp1.1/AdminAPI.pdb
Binary file not shown.
58 changes: 58 additions & 0 deletions wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,62 @@
}
#logout-form{
display: inline-block;
}
.silence-button, .unsilence-button{
position: absolute;
border-radius: 0px;
border: none;
height: 100%;
right: 0px;
width: 30%;
font-size: 1vw;
text-align: center;
top: 0px;
color: white;
}
.silence-button{
background-color: red;
}
.unsilence-button{
background-color: green;
}
.subsection-header{
text-align: center;
}
.container, .container-fluid{
width: 100% !important;
padding-left: 0px !important;
padding-right: 0px !important;
}
.col-md-4, .col-md-3, .col-md-5{
padding: 0px;
}
.navbar{
margin-bottom: 0px !important;
}
.contact-list-column{
padding-left: 2vw;
padding-right: 2vw;
padding-top: 2vw;
min-height: 150vh;
background-color: #0a1a51;
}
.contact-list-column > h3{
color: white;
}
.message-column > h3{
}
.work-table-column{
padding-left: 2vw;
padding-right: 2vw;
padding-top: 2vw;
min-height: 150vh;
background-color: white;
}
.message-column{
padding-left: 2vw;
padding-right: 2vw;
padding-top: 2vw;
min-height: 150vh;
background-color: #ffecb1;
}

0 comments on commit 60c8808

Please sign in to comment.