Adjust comment and qrcode feature

This commit is contained in:
yafeilee 2016-04-24 00:43:05 +08:00
parent c749707d98
commit 033339182b
10 changed files with 33 additions and 26 deletions

View File

@ -1,6 +1,13 @@
$(document).on 'turbolinks:load', -> $(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 if $('#image-tag').length > 0
$('#image-tag').empty()
new QRCode( $('#image-tag')[0], $('#image-tag').data('url') ) new QRCode( $('#image-tag')[0], $('#image-tag').data('url') )
$('#qrcode-link').click (event)-> $('#qrcode-link').click (event)->
event.preventDefault() event.preventDefault()
$('.social-share').toggle() $('.social-share').toggle()

View File

@ -60,6 +60,10 @@
padding-left: 0rem; padding-left: 0rem;
} }
#qrcode-home {
padding: 1rem 2rem 1rem 0;
}
.qrcode { .qrcode {
display: inline-block; display: inline-block;
float: right; float: right;
@ -69,10 +73,6 @@
} }
} }
.social-share {
display: none;
}
.qrcode-wrapper { .qrcode-wrapper {
float: right; float: right;
margin-top: -2rem; margin-top: -2rem;
@ -85,6 +85,10 @@
} }
} }
.social-share {
display: none;
}
.subscribe-ul { .subscribe-ul {
list-style-type: none; list-style-type: none;
margin-left: 0; margin-left: 0;

View File

@ -47,14 +47,17 @@
color: #b3b3b3; color: #b3b3b3;
} }
.comment-content { .comment-content {
padding-bottom: 2.275rem; padding-bottom: 1rem;
padding-left: 0.275rem; padding-left: 0.275rem;
border-bottom: 1px dashed #8a8a8a; border-bottom: 1px dashed #8a8a8a;
margin-bottom: 0; margin-bottom: 0;
white-space: pre;
p {
margin-bottom: 0.325rem;
}
} }
.name { .name {
padding-top: 0.5rem; padding-top: 1rem;
padding-left: 0.275rem; padding-left: 0.275rem;
} }
} }
@ -79,7 +82,7 @@
} }
.comment-wrapper { .comment-wrapper {
margin-bottom: 0.5rem;
&:hover { &:hover {
background-color: #444444; background-color: #444444;
} }
@ -91,7 +94,6 @@
.comment-content { .comment-content {
word-wrap: break-word; word-wrap: break-word;
color: #DDDDDD; color: #DDDDDD;
white-space: pre-wrap;
word-break: break-all; word-break: break-all;
} }

View File

@ -1,4 +1,5 @@
#image-tag { #image-tag {
float: right; float: right;
width: 200px; width: 200px;
margin-bottom: 1rem;
} }

View File

@ -20,7 +20,7 @@ class BlogsController < ApplicationController
@post = Post.find(params[:id]) @post = Post.find(params[:id])
@post.visited @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: :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) @comments = @post.comments.order(created_at: :desc)
@likes_count = @post.likes.count @likes_count = @post.likes.count
respond_to do |format| respond_to do |format|

View File

@ -18,7 +18,7 @@
td td
= mail_to comment.email = mail_to comment.email
td td
p.pre #{comment.content} = simple_format(comment.content)
td td
= format_time(comment.created_at) = format_time(comment.created_at)

View File

@ -27,20 +27,11 @@
.row.ng-cloak ng-controller='AboutController' .row.ng-cloak ng-controller='AboutController'
.small-12.medium-6.large-12.columns .small-12.medium-6.large-12.columns
ul.subscribe-ul ul.subscribe-ul
- if ENV['MAIL_SERVER'].present?
li li
= link_to t('subscribes.email'), '', "ng-click"=>"click('email')" a data-toggle="qrcode-home" #{t('subscribes.wechat') }
.email-subscribe ng-show="type == 'email'" #qrcode-home.weixin-subscribe.hide data-toggler='hide' data-url=root_url
= 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 li
= link_to t('subscribes.wechat'), '', "ng-click"=>"click('weixin')" a data-toggle="rss-home" #{t('subscribes.rss') }
.weixin-subscribe ng-show="type == 'weixin'" #rss-home.rss-subscribe.hide data-toggler='hide'
= render partial: "qrcode", locals: { str: root_url }
li
= link_to t('subscribes.rss'), '', "ng-click"=>"click('rss')"
.rss-subscribe ng-show="type == 'rss'"
= link_to rss_blogs_path do = link_to rss_blogs_path do
- image_tag('rss.png') - image_tag('rss.png')

View File

@ -9,6 +9,7 @@
= render partial: "post", :locals=> { post: @post } = render partial: "post", :locals=> { post: @post }
.comment-field .comment-field
= render partial: 'comment', locals: { comments: @comments, post: @post } = render partial: 'comment', locals: { comments: @comments, post: @post }
p
.row .row
.small-12.large-9.large-centered.columns .small-12.large-9.large-centered.columns
- if @prev - if @prev

View File

@ -6,5 +6,4 @@
| #{" • "} | #{" • "}
span.created-at span.created-at
| #{format_time(comment.created_at) } | #{format_time(comment.created_at) }
/ ignore "white-space: pre" 's effect = render partial: 'comments/comment_pre', locals: { comment: comment }
<p class=comment-content>#{comment.content}</p>

View File

@ -0,0 +1,2 @@
.comment-content
= simple_format(comment.content)