parent
c7caa08c70
commit
19be668221
|
@ -55,12 +55,15 @@ class AvatarController < ApplicationController
|
|||
# saved = @avatar.save
|
||||
begin
|
||||
f = Magick::ImageList.new(diskfile)
|
||||
width = 300.0
|
||||
proportion = (width/f[0].columns)
|
||||
height = (f[0].rows*proportion)
|
||||
f.resize_to_fill!(width,height)
|
||||
# f.scale!(width,height)
|
||||
f.write(diskfile)
|
||||
# gif格式不再做大小处理
|
||||
if f.format != 'GIF'
|
||||
width = 300.0
|
||||
proportion = (width/f[0].columns)
|
||||
height = (f[0].rows*proportion)
|
||||
f.resize_to_fill!(width,height)
|
||||
f.write(diskfile)
|
||||
end
|
||||
|
||||
rescue Exception => e
|
||||
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
|
||||
end
|
||||
|
|
|
@ -605,6 +605,15 @@ class CoursesController < ApplicationController
|
|||
events = @activity.events(@date_from, @date_to, :is_public => 1)
|
||||
end
|
||||
|
||||
# 无新动态时,显示老动态
|
||||
if events.count == 0
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events
|
||||
else
|
||||
events = @activity.events(:is_public => 1)
|
||||
end
|
||||
end
|
||||
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@events_count = events.count
|
||||
@events_pages = Paginator.new @events_count, @limit, params['page']
|
||||
|
|
Loading…
Reference in New Issue