This commit is contained in:
sw 2014-08-28 14:39:48 +08:00
commit 594d3364ac
5 changed files with 43 additions and 9 deletions

View File

@ -55,12 +55,15 @@ class AvatarController < ApplicationController
# saved = @avatar.save # saved = @avatar.save
begin begin
f = Magick::ImageList.new(diskfile) f = Magick::ImageList.new(diskfile)
# gif格式不再做大小处理
if f.format != 'GIF'
width = 300.0 width = 300.0
proportion = (width/f[0].columns) proportion = (width/f[0].columns)
height = (f[0].rows*proportion) height = (f[0].rows*proportion)
f.resize_to_fill!(width,height) f.resize_to_fill!(width,height)
# f.scale!(width,height)
f.write(diskfile) f.write(diskfile)
end
rescue Exception => e rescue Exception => e
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}" logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
end end

View File

@ -605,6 +605,15 @@ class CoursesController < ApplicationController
events = @activity.events(@date_from, @date_to, :is_public => 1) events = @activity.events(@date_from, @date_to, :is_public => 1)
end 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}) @offset, @limit = api_offset_and_limit({:limit => 10})
@events_count = events.count @events_count = events.count
@events_pages = Paginator.new @events_count, @limit, params['page'] @events_pages = Paginator.new @events_count, @limit, params['page']

View File

@ -594,6 +594,7 @@ class ProjectsController < ApplicationController
"show_news" => true, "show_news" => true,
"show_bids" => true, "show_bids" => true,
"show_contests" => true, "show_contests" => true,
"show_wiki_edits"=>true,
"show_journals_for_messages" => true "show_journals_for_messages" => true
} }
@date_to ||= Date.today + 1 @date_to ||= Date.today + 1

View File

@ -39,7 +39,8 @@ class Repository < ActiveRecord::Base
validates_length_of :password, :maximum => 255, :allow_nil => true validates_length_of :password, :maximum => 255, :allow_nil => true
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true #validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_uniqueness_of :identifier, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only # donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true

View File

@ -437,9 +437,9 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.string "web_title" t.string "web_title"
t.string "title" t.string "title"
t.text "description" t.text "description"
t.string "page_type"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "page_type"
t.integer "sort_type" t.integer "sort_type"
t.integer "show_course", :default => 1 t.integer "show_course", :default => 1
t.integer "show_contest", :default => 1 t.integer "show_contest", :default => 1
@ -458,6 +458,26 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
create_table "gitlab_projects", :force => true do |t|
t.integer "gitlab_project_id"
t.integer "project_id"
t.string "repository_url"
t.string "web_url"
t.string "localfile_url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "gitlab_users", :force => true do |t|
t.integer "gitlab_user_id"
t.integer "user_id"
t.string "email"
t.string "password"
t.string "login", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups_users", :id => false, :force => true do |t| create_table "groups_users", :id => false, :force => true do |t|
t.integer "group_id", :null => false t.integer "group_id", :null => false
t.integer "user_id", :null => false t.integer "user_id", :null => false