Skip to content

Commit

Permalink
Finish styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymond Gao committed Jun 28, 2017
1 parent 3ccdba6 commit e13f94b
Show file tree
Hide file tree
Showing 19 changed files with 165 additions and 159 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions AdminAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="1.1.1" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public UserController(UserContext context)
[HttpGet("show", Name="Show")]
public ActionResult Show(){
if(Request.Cookies["admin-api-session-token"] == null){
return RedirectToAction("Login", "Session");
return RedirectToAction("Login", "User");
}
var users = _context.Users.Where(u => u.SessionToken == Request.Cookies["admin-api-session-token"]);

Expand Down Expand Up @@ -140,9 +140,9 @@ public List<string> Fetch(string id){

[HttpPost("post/id={userId}&content={content}", Name="Post")]
public void Post(string userId, string content){
if(!Globals.pushStore.isSubscribed(userId)){
Globals.pushStore.addSubscription(userId);
}
// if(!Globals.pushStore.isSubscribed(userId)){
// Globals.pushStore.addSubscription(userId);
// }

Globals.pushStore.addInfo(userId, content);
}
Expand Down
7 changes: 4 additions & 3 deletions Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public void removeSubscription(string userId){
public void addInfo(string userId, string newInfo){
List<string> entry;
for(int i = 0; i < _userIds.Count; i++){
if(userId == _userIds[i]){
continue;
}
// if(userId == _userIds[i]){
// continue;
// }
entry = _store[_userIds[i]] as List<string>;
entry.Add(newInfo);
_shouldUpdateStore[_userIds[i]] = true;
Expand Down Expand Up @@ -101,6 +101,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
loggerFactory.AddDebug();

app.UseMvc();
app.UseStaticFiles();
}
}
}
Binary file modified Views/.DS_Store
Binary file not shown.
4 changes: 1 addition & 3 deletions Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
</environment>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
</div>
<div class="navbar-collapse collapse">
</div>
</div>
</nav>
<div class="container body-content">
Expand Down
24 changes: 13 additions & 11 deletions Views/User/Login.cshtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<h1>Login Here</h1>

<form id="login-form" method="post" enctype="multipart/form-data" asp-controller="User" asp-action="CreateSession">
<label>Username:</label>
<input type="text" name="username" required autocomplete="off"/>
<br/>
<label>Password:</label>
<input type="password" name="password" required autocomplete="off"/>
<br/>
<input type="submit" value="submit" />
</form>
<div class="col-md-6">
<form class="form-horizontal" id="login-form" method="post" enctype="multipart/form-data" asp-controller="User" asp-action="CreateSession">
<h3>登录账户</h3>
<br/>
<label>用户名:</label>
<input class="form-control" type="text" name="username" required autocomplete="off"/>
<br/>
<label>密码:</label>
<input class="form-control" type="password" name="password" required autocomplete="off"/>
<br/>
<input class="btn btn-default" type="submit" value="submit" />
</form>
</div>
32 changes: 17 additions & 15 deletions Views/User/New.cshtml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<h1>Register</h1>
<div class="col-md-6">
<form class="form-horizontal" id="registration-form" method="post" enctype="multipart/form-data" asp-controller="user" asp-action="create">
<h3>新用户注册</h3>
<br/>
<label>用户名:</label>
<input class="form-control" type="text" name="username" required autocomplete="off"/>
<br/>

<form id="registration-form" method="post" enctype="multipart/form-data" asp-controller="user" asp-action="create">
<label>Username:</label>
<input type="text" name="username" required autocomplete="off"/>
<br/>
<label>密码:</label>
<input class="form-control" type="password" name="password" minlength="6" required autocomplete="off"/>
<br/>

<label>Password:</label>
<input type="password" name="password" minlength="6" required autocomplete="off"/>
<br/>

<label>Password Confirmation:</label>
<input type="password" required autocomplete="off"/>
<br/>

<input type="submit" value="submit" />
</form>
<label>重复密码:</label>
<input class="form-control" type="password" required autocomplete="off"/>
<br/>

<input class="btn btn-default" type="submit" value="submit" />
</form>
</div>
130 changes: 47 additions & 83 deletions Views/User/Show.cshtml
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
<h1>主页</h1>
<form id="logout-form" method="post" enctype="multipart/form-data" asp-controller="user" asp-action="DeleteSession">
<input type="submit" value="logout" />
</form>

<form id="work-log-form">
<h3>@ViewBag.Username 工作日志</h3>
<input id="work-log" type="text" />
<input type="submit" class="btn" value="提交" />
</form>

<hr/>
<div class="container">
<div class="col-md-6">
<h3>@ViewBag.Username 工作主页</h3>

<br/>
<h4>快捷功能</h4>
<button class="btn btn-default" id="food-button">找人外出觅食</button>
<button class="btn btn-default" id="unbrella-button">寻人借伞</button>
<form id="logout-form" method="post" enctype="multipart/form-data" asp-controller="user" asp-action="DeleteSession">
<input class="btn btn-default" type="submit" value="登出" />
</form>

<hr/>
<h4>群内发言</h4>
<form class="form-horizontal" id="work-log-form">
<input class="form-control" id="work-log" type="text" />
<br/>
<input class="btn btn-default" type="submit" value="提交" />
</form>

<hr/>



</div>
<div class="col-md-6">
<ul class="list-group" id="information-list"></ul>
</div>
</div>

<button class="btn" id="food-button">外出觅食</button>
<button class="btn" id="unbrella-button">寻人借伞</button>

<ul id="information-list"></ul>

<script>
function randomString(length) {
Expand All @@ -41,7 +57,7 @@
success: function(newInfo){
dataStore.information = dataStore.information.concat(newInfo);
for(var i = 0; i < newInfo.length; i++){
$("#information-list").append("<li>" + newInfo[i] + "</li>");
$("#information-list").append("<li class='list-group-item'>" + newInfo[i] + "</li>");
}
longPolling();
Expand Down Expand Up @@ -77,28 +93,14 @@
$(function(){
longPolling();
$("#for-button").on("click", (e) => {
e.preventDefault();
makeAjax("用户(" + dataStore.userId + ")投了赞同票。")();
})
$("#against-button").on("click", (e) => {
e.preventDefault();
makeAjax("用户(" + dataStore.userId + ")投了反对票。")();
})
$("#refusal-form").on("submit", (e) => {
e.preventDefault();
makeAjax("用户(" + dataStore.userId + ")拒答并表示‘" + $("#reason-of-refusal").val() + "’。" )();
$("#reason-of-refusal").val("");
})
$("#work-log-form").on("submit", (e) => {
e.preventDefault();
makeAjax("用户(" + dataStore.userId + "日志发言:" + $("#work-log").val() + "" )();
makeAjax("用户(" + dataStore.userId + "群内发言: " + $("#work-log").val() + "" )();
$("#work-log").val("");
})
$("#food-button").on("click", (e) => {
e.preventDefault();
makeAjax("用户(" + dataStore.userId + "已外出就餐")();
makeAjax("用户(" + dataStore.userId + "正在组队外出就餐")();
})
$("#unbrella-button").on("click", (e) => {
e.preventDefault();
Expand All @@ -111,58 +113,20 @@
makeAjax("用户(" + dataStore.userId + ")上线了。")();
})
$(document).addEventListener("unload", (e) => {
$(document).on("unload", (e) => {
$.ajax({
url: "delete/id=" + dataStore.userId,
method: "DELETE",
dataType: "JSON",
data: JSON.stringify({
userId: dataStore.userId
}),
success: function(response){
console.log(response);
},
error: function(err){
debugger;
}
});
url: "delete/id=" + dataStore.userId,
method: "DELETE",
dataType: "JSON",
data: JSON.stringify({
userId: dataStore.userId
}),
success: function(response){
console.log(response);
},
error: function(err){
debugger;
}
});
})
</script>

<style>
#for-button, #against-button{
background-color: green;
font-size: 2rem;
padding: 1rem;
color: white;
font-weight: bold;
border: none;
outline: none;
cursor: pointer;
}
#against-button{
background-color: red;
}
.btn{
font-size: 1.5rem;
padding: 1rem;
outline: none;
border: none;
background-color: white;
color: black;
border: 1px solid black;
cursor: pointer;
}
#work-log-form{
padding: 2rem;
font-size: 1.5rem;
border: 1px solid black;
}
#work-log{
height: 3rem;
font-size: 1.5rem;
width: 50vw;
}
</style>
</script>
26 changes: 25 additions & 1 deletion bin/Debug/netcoreapp1.1/AdminAPI.deps.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v1.1",
"signature": "7146fa175a32823e8455c2279b393ff6fcef9d20"
"signature": "0727e882cc5723acda07ec3742c07fb176fcac2f"
},
"compilationOptions": {
"defines": [
Expand All @@ -25,6 +25,7 @@
"dependencies": {
"Microsoft.AspNetCore": "1.1.2",
"Microsoft.AspNetCore.Mvc": "1.1.3",
"Microsoft.AspNetCore.StaticFiles": "1.1.2",
"Microsoft.EntityFrameworkCore.InMemory": "1.1.1",
"Microsoft.Extensions.Logging.Debug": "1.1.2",
"Microsoft.NETCore.App": "1.1.2"
Expand Down Expand Up @@ -644,6 +645,22 @@
"lib/netstandard1.3/Microsoft.AspNetCore.Server.Kestrel.dll": {}
}
},
"microsoft.aspnetcore.staticfiles/1.1.2": {
"dependencies": {
"Microsoft.AspNetCore.Hosting.Abstractions": "1.1.2",
"Microsoft.AspNetCore.Http.Extensions": "1.1.2",
"Microsoft.Extensions.FileProviders.Abstractions": "1.1.1",
"Microsoft.Extensions.Logging.Abstractions": "1.1.2",
"Microsoft.Extensions.WebEncoders": "1.1.2",
"NETStandard.Library": "1.6.1"
},
"runtime": {
"lib/netstandard1.3/Microsoft.AspNetCore.StaticFiles.dll": {}
},
"compile": {
"lib/netstandard1.3/Microsoft.AspNetCore.StaticFiles.dll": {}
}
},
"microsoft.aspnetcore.webutilities/1.1.2": {
"dependencies": {
"Microsoft.Extensions.Primitives": "1.1.1",
Expand Down Expand Up @@ -3241,6 +3258,13 @@
"path": "microsoft.aspnetcore.server.kestrel/1.1.2",
"hashPath": "microsoft.aspnetcore.server.kestrel.1.1.2.nupkg.sha512"
},
"microsoft.aspnetcore.staticfiles/1.1.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Gyu747KkxcjeiQynlfG3ClLXhgjIGx6To2VLIHov7OiwGZlWRC18y7JoHRRInuEG2IRefXmBImUwKvTN8Ti1GQ==",
"path": "microsoft.aspnetcore.staticfiles/1.1.2",
"hashPath": "microsoft.aspnetcore.staticfiles.1.1.2.nupkg.sha512"
},
"microsoft.aspnetcore.webutilities/1.1.2": {
"type": "package",
"serviceable": true,
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.
2 changes: 1 addition & 1 deletion obj/Debug/netcoreapp1.1/CoreCompileInputs.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
83ed4a545bf8b47ed1b3ee562d08a27023561939
438412a513e8f7d8733b7f381528234dbd50c9d0
Loading

0 comments on commit e13f94b

Please sign in to comment.