mirror of
https://github.com/wahyd4/Libr.git
synced 2026-08-09 04:46:07 +10:00
add user center
This commit is contained in:
@@ -98,3 +98,23 @@ div.span2{
|
||||
.my-borrow-btn{
|
||||
margin-top:-20px;
|
||||
}
|
||||
|
||||
.container-narrow{
|
||||
margin: 0 auto;
|
||||
max-width: 700px;
|
||||
min-height: 500px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #9EAA99;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 4px rgba(0,0,0,.25);
|
||||
margin-top: 20px;
|
||||
}
|
||||
.cool-border{
|
||||
border: 1px solid #9EAA99;
|
||||
box-shadow: 0 0 4px rgba(0,0,0,.25);
|
||||
}
|
||||
.record-info{
|
||||
color: #c67605;
|
||||
font-size: 25px;
|
||||
line-height: 35px;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ class UserController < ApplicationController
|
||||
|
||||
def return_book
|
||||
instance = BookInstance.find_by_id params[:instance_id]
|
||||
puts "---------------------" +instance.to_s + " -------"+params[:instance_id]
|
||||
if @current_user.borrowed_and_not_returned_books.include? instance
|
||||
@current_user.return_book instance
|
||||
@message = 'Return book success.'
|
||||
@@ -53,7 +52,10 @@ class UserController < ApplicationController
|
||||
end
|
||||
|
||||
def view
|
||||
@user = User.find_by_id params[:id]
|
||||
|
||||
@total_borrowed_books = @user.borrowed_books
|
||||
@total_books = @user.book_instances
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -25,7 +25,7 @@ html
|
||||
li
|
||||
a href="/users/#{@current_user.id}/books" 我的书架
|
||||
li
|
||||
a href="/users" 我的记录
|
||||
a href="/users/#{@current_user.id}" 个人中心
|
||||
ul.nav.pull-right
|
||||
-if @current_user != nil
|
||||
li
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
div.container-narrow style="text-align:center;"
|
||||
div style="margin-top:-25px;"
|
||||
img.img-circle.cool-border src="#{@user.avatar}"
|
||||
h3 =@user.name
|
||||
div.record-info
|
||||
p 近一个月借书#{0}本
|
||||
p
|
||||
p 近一年借书#{0}本
|
||||
p
|
||||
p 至今共借书#{@total_borrowed_books.count}本
|
||||
p
|
||||
p 共拥有图书#{@total_books.count}本
|
||||
|
||||
|
||||
Reference in New Issue
Block a user