Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
594d3364ac
|
@ -55,17 +55,20 @@ class AvatarController < ApplicationController
|
||||||
# saved = @avatar.save
|
# saved = @avatar.save
|
||||||
begin
|
begin
|
||||||
f = Magick::ImageList.new(diskfile)
|
f = Magick::ImageList.new(diskfile)
|
||||||
width = 300.0
|
# gif格式不再做大小处理
|
||||||
proportion = (width/f[0].columns)
|
if f.format != 'GIF'
|
||||||
height = (f[0].rows*proportion)
|
width = 300.0
|
||||||
f.resize_to_fill!(width,height)
|
proportion = (width/f[0].columns)
|
||||||
# f.scale!(width,height)
|
height = (f[0].rows*proportion)
|
||||||
f.write(diskfile)
|
f.resize_to_fill!(width,height)
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
format.api {
|
format.api {
|
||||||
|
|
|
@ -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']
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
22
db/schema.rb
22
db/schema.rb
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue