二维码功能添加

This commit is contained in:
yafeilee 2014-04-01 09:34:51 +08:00
parent 9dc1ad2ad9
commit 3843ffa9fc
6 changed files with 45 additions and 0 deletions

View File

@ -25,6 +25,7 @@ gem 'html_truncator'
gem 'nokogiri'
gem 'angularjs-rails'
gem 'figaro'
gem 'rqrcode-with-patches', require: 'rqrcode'
group :development do
gem 'quiet_assets'

View File

@ -0,0 +1,3 @@
@app.controller 'QRCodesController', ($scope)->
$scope.show = ->
$scope.qrcode = true

View File

@ -51,3 +51,12 @@
border-bottom: 1px solid #dddddd;
}
}
.qrcode {
display: inline-block;
float: right;
margin-top: -5.5rem;
i {
margin-right: 0.5rem;
}
}

View File

@ -0,0 +1,20 @@
.qrcode-image {
table {
border-width: 0;
border-style: none;
border-color: #0000ff;
border-collapse: collapse;
}
td {
border-width: 0;
border-style: none;
border-color: #0000ff;
border-collapse: collapse;
padding: 0;
margin: 0;
width: 10px;
height: 10px;
}
td.black { background-color: #000; }
td.white { background-color: #fff; }
}

View File

@ -19,3 +19,12 @@ p ng-controller="LikesController"
button.like-button ng-show=" is_liked " ng-click="cancel()"
|{{ count }}
span Liked
div ng-controller = "QRCodesController"
.qrcode
i.fi-link
a href="#" ng-model="qrcode" ng-init="qrcode=false" ng-click="show()" 二维码
.social-share ng-show='qrcode'
= debug blog_url(post)
= render partial: "qrcode", locals: { str: blog_url(post) }

View File

@ -0,0 +1,3 @@
.qrcode-image
- qr = RQRCode::QRCode.new(str)
== qr.as_html