fix comments bugs and modify some style css

This commit is contained in:
lovelyzhang 2016-12-22 23:23:22 +08:00
parent ff5f2f6ea3
commit 6fc7ec9d88
9 changed files with 6515 additions and 23 deletions

View File

@ -37,7 +37,6 @@ module ChatHelper
recieve_user: [user.id, chat_with.id]) recieve_user: [user.id, chat_with.id])
if messages.length >= 1 if messages.length >= 1
p "==================================="
messages = messages.order(create_time: :asc) messages = messages.order(create_time: :asc)
messages.each do |message| messages.each do |message|
if message.send_user == user.id if message.send_user == user.id

View File

@ -2,7 +2,7 @@ module CommentsHelper
def get_micropost_comments micropost_id def get_micropost_comments micropost_id
comments_array = Array.new() comments_array = Array.new()
micropost = MicroPost.find_by(id: micropost_id) micropost = MicroPost.find_by(id: micropost_id)
comments = micropost.comments comments = micropost.comments.order(comment_time: :desc)
if !comments.empty? if !comments.empty?
comments.each do |com| comments.each do |com|
temp = Hash.new() temp = Hash.new()

View File

@ -1,6 +1,3 @@
<!--自定义CSS文件-->
<link href="stylesheets/mystyle.css" media="all" rel="stylesheet" type="text/css"/>
<!--自定义CSS文件-->
<!--引入文件--> <!--引入文件-->
<link href="stylesheets/bootstrap.min.css" media="all" rel="stylesheet" type="text/css"/> <link href="stylesheets/bootstrap.min.css" media="all" rel="stylesheet" type="text/css"/>
@ -71,4 +68,9 @@
<script src="javascripts/jquery.sparkline.min.js" type="text/javascript"></script> <script src="javascripts/jquery.sparkline.min.js" type="text/javascript"></script>
<script src="javascripts/main.js" type="text/javascript"></script> <script src="javascripts/main.js" type="text/javascript"></script>
<script src="javascripts/respond.js" type="text/javascript"></script> <script src="javascripts/respond.js" type="text/javascript"></script>
<!--自定义CSS文件-->
<link href="stylesheets/mystyle.css" media="all" rel="stylesheet" type="text/css"/>
<!--自定义CSS文件-->
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">

View File

@ -112,14 +112,12 @@
'src=' + 'src=' +
userpic + userpic +
'/>' + '/>' +
'<div class="profile-details clearfix">' +
'<a class="user-name">' + '<a class="user-name">' +
username + username +
'</a>' + '</a>' +
'<p class="content">' + '<p>' +
comment + comment +
'</p>' + '</p>' +
'</div>' +
'</div>'; '</div>';
return commentElem; return commentElem;
@ -137,7 +135,7 @@
comments.find(".comment").remove(); comments.find(".comment").remove();
comments.find("p").remove(); comments.find("p").remove();
if (data["comments"].length == 0) { if (data["comments"].length == 0) {
comments.prepend("<p style='text-align: center'>无评论</p>"); comments.prepend("<p class='text-center'>无评论</p>");
} }
else { else {
var comments_array = data["comments"]; var comments_array = data["comments"];
@ -168,6 +166,9 @@
$(".makecomment").bind("keyup", function (e) { $(".makecomment").bind("keyup", function (e) {
var inputText = $(this).val(); var inputText = $(this).val();
if ( inputText.length <= 0 ) {
return;
}
var username = ""; var username = "";
var userpic = ""; var userpic = "";
var enterObject = $(this); var enterObject = $(this);
@ -181,8 +182,10 @@
url: '/newcomment', url: '/newcomment',
success: function (data, textStatus, jqXHR) { success: function (data, textStatus, jqXHR) {
if (data["username"] && data["userpic"]) { if (data["username"] && data["userpic"]) {
enterObject.parent().children("p").remove();
enterObject.before(comment_process(data["username"], data["userpic"], inputText)); enterObject.before(comment_process(data["username"], data["userpic"], inputText));
} }
$(".makecomment").val("");
} }
}); });
} }

View File

@ -37,9 +37,9 @@
<div class="form-group"> <div class="form-group">
<div class="col-md-12"> <div class="col-md-12">
<p> <div id="image-upload">
图片 上传图片占位符
</p> </div>
</div> </div>
</div> </div>

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -37,18 +37,10 @@
height: 100px; height: 100px;
} }
.col-md-12.text-center {
margin-top: 15px;
}
.form-group .btn { .form-group .btn {
margin: 0px 0px 0px 0px; margin: 0px 0px 0px 0px;
} }
.form-group textarea {
margin-top: 5px;
}
.btn.btn-default-outline.btn-block { .btn.btn-default-outline.btn-block {
margin: 3px 0 3px 0px; margin: 3px 0 3px 0px;
} }
@ -97,8 +89,8 @@
.col-lg-4 .widget-container { .col-lg-4 .widget-container {
margin-top: 15px; margin-top: 15px;
margin-left: 25px; margin-left: 20px;
margin-right: 25px; margin-right: 20px;
} }
.alert.alert-info { .alert.alert-info {
@ -110,4 +102,20 @@
#user-page { #user-page {
margin-left: 50px; margin-left: 50px;
margin-right: 50px; margin-right: 50px;
} }
.col-md-12.text-center {
margin-top: 15px;
margin-bottom: 15px;
}
#image-upload {
text-align: center;
}
.alert {
margin-bottom: 0;
}
/*.social-wrapper .social-container .social-entry .profile-details {*/
/*display: none;*/
/*}*/