From 19be668221194fd48c8174bc4d79a2240db93e30 Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 28 Aug 2014 11:52:02 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.=E4=BF=AE=E6=AD=A3RImagic=E4=BF=9D?= =?UTF-8?q?=E5=AD=98gif=E6=A0=BC=E5=BC=8F=E5=9B=BE=E7=89=87=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=E4=BF=AE=E6=AD=A3=E8=AF=BE=E7=A8=8B=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/avatar_controller.rb | 17 ++++++++++------- app/controllers/courses_controller.rb | 9 +++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index fa7eb6052..b7dec5453 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -55,17 +55,20 @@ 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 - + respond_to do |format| format.js format.api { diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 38ae662fc..aa5e2c2a6 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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'] From bdeb2e59471e6940a7b4981194ae617504ba2785 Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 28 Aug 2014 14:02:14 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=90=AF=E7=94=A8=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84wiki=E7=BC=96=E8=BE=91=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 1 + db/schema.rb | 84 +++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 7 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f3ab77603..c0561bd1c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -594,6 +594,7 @@ class ProjectsController < ApplicationController "show_news" => true, "show_bids" => true, "show_contests" => true, + "show_wiki_edits"=>true, "show_journals_for_messages" => true } @date_to ||= Date.today + 1 diff --git a/db/schema.rb b/db/schema.rb index 82a6ad97b..b4dab9094 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -177,6 +177,58 @@ ActiveRecord::Schema.define(:version => 20140826072838) do add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true + create_table "code_review_assignments", :force => true do |t| + t.integer "issue_id" + t.integer "change_id" + t.integer "attachment_id" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.string "action_type" + t.integer "changeset_id" + end + + create_table "code_review_project_settings", :force => true do |t| + t.integer "project_id" + t.integer "tracker_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "updated_by" + t.boolean "hide_code_review_tab", :default => false + t.integer "auto_relation", :default => 1 + t.integer "assignment_tracker_id" + t.text "auto_assign" + t.integer "lock_version", :default => 0, :null => false + t.boolean "tracker_in_review_dialog", :default => false + end + + create_table "code_review_user_settings", :force => true do |t| + t.integer "user_id", :default => 0, :null => false + t.integer "mail_notification", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "code_reviews", :force => true do |t| + t.integer "project_id" + t.integer "change_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "line" + t.integer "updated_by_id" + t.integer "lock_version", :default => 0, :null => false + t.integer "status_changed_from" + t.integer "status_changed_to" + t.integer "issue_id" + t.string "action_type" + t.string "file_path" + t.string "rev" + t.string "rev_to" + t.integer "attachment_id" + t.integer "file_count", :default => 0, :null => false + t.boolean "diff_all" + end + create_table "comments", :force => true do |t| t.string "commented_type", :limit => 30, :default => "", :null => false t.integer "commented_id", :default => 0, :null => false @@ -385,9 +437,9 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.string "web_title" t.string "title" t.text "description" - t.string "page_type" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "page_type" t.integer "sort_type" t.integer "image_width", :default => 107 t.integer "image_height", :default => 63 @@ -406,6 +458,26 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.datetime "updated_at", :null => false 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| t.integer "group_id", :null => false t.integer "user_id", :null => false @@ -911,10 +983,11 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.string "url" t.string "title" t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.integer "project_id" t.integer "user_id" + t.string "description" end create_table "softapplications", :force => true do |t| @@ -1020,8 +1093,8 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.integer "zip_code" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.integer "identity" t.string "technical_title" + t.integer "identity" t.string "student_id" t.string "teacher_realname" t.string "student_realname" @@ -1079,9 +1152,6 @@ ActiveRecord::Schema.define(:version => 20140826072838) do t.integer "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.integer "level" - t.integer "file" - t.integer "issue" end create_table "user_statuses", :force => true do |t| From 51b21000a79f71c63c44e36789c7c5456e0fb602 Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 28 Aug 2014 14:35:42 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E9=99=90=E5=AE=9A=E4=B8=BA=E5=85=A8=E5=B1=80=E5=94=AF?= =?UTF-8?q?=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 260069f94..5680f05a7 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -39,7 +39,8 @@ class Repository < ActiveRecord::Base validates_length_of :password, :maximum => 255, :allow_nil => 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_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) # donwcase letters, digits, dashes, underscores but not digits only validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true