mirror of
https://github.com/wahyd4/Libr.git
synced 2026-08-09 04:46:07 +10:00
update view
This commit is contained in:
@@ -20,14 +20,14 @@ class UserController < ApplicationController
|
||||
|
||||
def books
|
||||
query = params[:query]
|
||||
user = User.find_by_id params[:id]
|
||||
@user = User.find_by_id params[:id]
|
||||
case query
|
||||
when 'borrowed'
|
||||
@books = user.borrowed_and_not_returned_books
|
||||
@books = @user.borrowed_and_not_returned_books
|
||||
when 'wanted'
|
||||
@books = nil
|
||||
else
|
||||
@books = user.books.order 'id DESC'
|
||||
@books = @user.books.order 'id DESC'
|
||||
end
|
||||
@query = query
|
||||
render :books
|
||||
@@ -44,4 +44,8 @@ class UserController < ApplicationController
|
||||
redirect_to :back,:notice => @message
|
||||
end
|
||||
|
||||
def view
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ html
|
||||
ul.nav.pull-right
|
||||
-if @current_user != nil
|
||||
li
|
||||
a href="#"
|
||||
a href="/users/#{@current_user.id}"
|
||||
img.img-circle style="max-width:82%;margin:-5px" src="#{@current_user.avatar}" title="#{@current_user.name}"
|
||||
li
|
||||
a href="/logout" 注销
|
||||
|
||||
@@ -5,5 +5,6 @@ div.row style="margin-top:2em;"
|
||||
a href="/books/#{book.id}"
|
||||
img.cover src="#{book.image}"
|
||||
p.title style="font-size:0.9em;" =book.name
|
||||
= form_tag("borrowedbooks/#{book.id}", method:'put') do
|
||||
input.btn.btn-warning.btn-mini.my-borrow-btn type="submit" value="归还"
|
||||
-if @user == @current_user
|
||||
= form_tag("borrowedbooks/#{book.id}", method:'put') do
|
||||
input.btn.btn-warning.btn-mini.my-borrow-btn type="submit" value="归还"
|
||||
@@ -12,6 +12,7 @@ Libr::Application.routes.draw do
|
||||
get '/logout' => 'user#logout'
|
||||
get '/login/douban' => 'user#auth_douban'
|
||||
get '/douban_callback' =>'home#douban_callback'
|
||||
get '/users/:id' => 'user#view'
|
||||
|
||||
# The priority is based upon order of creation:
|
||||
# first created -> highest priority.
|
||||
|
||||
Reference in New Issue
Block a user