Adjust comment and qrcode feature
This commit is contained in:
parent
c749707d98
commit
033339182b
|
@ -1,6 +1,13 @@
|
|||
$(document).on 'turbolinks:load', ->
|
||||
|
||||
if $('#qrcode-home').length > 0
|
||||
$('#qrcode-home').empty()
|
||||
new QRCode( $('#qrcode-home')[0], $('#qrcode-home').data('url') )
|
||||
|
||||
if $('#image-tag').length > 0
|
||||
$('#image-tag').empty()
|
||||
new QRCode( $('#image-tag')[0], $('#image-tag').data('url') )
|
||||
|
||||
$('#qrcode-link').click (event)->
|
||||
event.preventDefault()
|
||||
$('.social-share').toggle()
|
||||
|
|
|
@ -60,6 +60,10 @@
|
|||
padding-left: 0rem;
|
||||
}
|
||||
|
||||
#qrcode-home {
|
||||
padding: 1rem 2rem 1rem 0;
|
||||
}
|
||||
|
||||
.qrcode {
|
||||
display: inline-block;
|
||||
float: right;
|
||||
|
@ -69,10 +73,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.social-share {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.qrcode-wrapper {
|
||||
float: right;
|
||||
margin-top: -2rem;
|
||||
|
@ -85,6 +85,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.social-share {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.subscribe-ul {
|
||||
list-style-type: none;
|
||||
margin-left: 0;
|
||||
|
|
|
@ -47,14 +47,17 @@
|
|||
color: #b3b3b3;
|
||||
}
|
||||
.comment-content {
|
||||
padding-bottom: 2.275rem;
|
||||
padding-bottom: 1rem;
|
||||
padding-left: 0.275rem;
|
||||
border-bottom: 1px dashed #8a8a8a;
|
||||
margin-bottom: 0;
|
||||
white-space: pre;
|
||||
|
||||
p {
|
||||
margin-bottom: 0.325rem;
|
||||
}
|
||||
}
|
||||
.name {
|
||||
padding-top: 0.5rem;
|
||||
padding-top: 1rem;
|
||||
padding-left: 0.275rem;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +82,7 @@
|
|||
}
|
||||
|
||||
.comment-wrapper {
|
||||
margin-bottom: 0.5rem;
|
||||
|
||||
&:hover {
|
||||
background-color: #444444;
|
||||
}
|
||||
|
@ -91,7 +94,6 @@
|
|||
.comment-content {
|
||||
word-wrap: break-word;
|
||||
color: #DDDDDD;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#image-tag {
|
||||
float: right;
|
||||
width: 200px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class BlogsController < ApplicationController
|
|||
@post = Post.find(params[:id])
|
||||
@post.visited
|
||||
@prev = Post.where('created_at < ?', @post.created_at).order(created_at: :desc).first
|
||||
@prev = Post.where('created_at > ?', @post.created_at).order(created_at: :asc).first
|
||||
@next = Post.where('created_at > ?', @post.created_at).order(created_at: :asc).first
|
||||
@comments = @post.comments.order(created_at: :desc)
|
||||
@likes_count = @post.likes.count
|
||||
respond_to do |format|
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
td
|
||||
= mail_to comment.email
|
||||
td
|
||||
p.pre #{comment.content}
|
||||
= simple_format(comment.content)
|
||||
td
|
||||
= format_time(comment.created_at)
|
||||
|
||||
|
|
|
@ -27,20 +27,11 @@
|
|||
.row.ng-cloak ng-controller='AboutController'
|
||||
.small-12.medium-6.large-12.columns
|
||||
ul.subscribe-ul
|
||||
- if ENV['MAIL_SERVER'].present?
|
||||
li
|
||||
= link_to t('subscribes.email'), '', "ng-click"=>"click('email')"
|
||||
.email-subscribe ng-show="type == 'email'"
|
||||
= text_field_tag 'email', nil, placeholder: 'your@email.com', 'ng-model'=>'email'
|
||||
button.small ng-click="subscribe()" ng-disabled="! email_validate()" #{t('subscribes.submit')}
|
||||
span.subscribe-success ng-show="subscribe_success" #{t('subscribes.submit_success')}
|
||||
span.subscribe-fail ng-show="subscribe_success == false" {{subscribe_fail_msg}}
|
||||
li
|
||||
= link_to t('subscribes.wechat'), '', "ng-click"=>"click('weixin')"
|
||||
.weixin-subscribe ng-show="type == 'weixin'"
|
||||
= render partial: "qrcode", locals: { str: root_url }
|
||||
a data-toggle="qrcode-home" #{t('subscribes.wechat') }
|
||||
#qrcode-home.weixin-subscribe.hide data-toggler='hide' data-url=root_url
|
||||
li
|
||||
= link_to t('subscribes.rss'), '', "ng-click"=>"click('rss')"
|
||||
.rss-subscribe ng-show="type == 'rss'"
|
||||
a data-toggle="rss-home" #{t('subscribes.rss') }
|
||||
#rss-home.rss-subscribe.hide data-toggler='hide'
|
||||
= link_to rss_blogs_path do
|
||||
- image_tag('rss.png')
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
= render partial: "post", :locals=> { post: @post }
|
||||
.comment-field
|
||||
= render partial: 'comment', locals: { comments: @comments, post: @post }
|
||||
p
|
||||
.row
|
||||
.small-12.large-9.large-centered.columns
|
||||
- if @prev
|
||||
|
|
|
@ -6,5 +6,4 @@
|
|||
| #{" • "}
|
||||
span.created-at
|
||||
| #{format_time(comment.created_at) }
|
||||
/ ignore "white-space: pre" 's effect
|
||||
<p class=comment-content>#{comment.content}</p>
|
||||
= render partial: 'comments/comment_pre', locals: { comment: comment }
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
.comment-content
|
||||
= simple_format(comment.content)
|
Loading…
Reference in New Issue