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'] diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 4d4f78d5b..031f78277 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -57,36 +57,45 @@ class FilesController < ApplicationController elsif params[:course_id] @isproject = false + sort = "" if params[:sort] - if params[:sort].include?":" - @orderBy = params[:sort].split(":")[0] - @orderType = params[:sort].split(":")[1].split(",")[0] - else - @orderBy = params[:sort].split(",")[0] - @orderType = "asc" + params[:sort].split(",").each do |sort_type| + order_by = sort_type.split(":") + + case order_by[0] + when "filename" + attribute = "filename" + when "size" + attribute = "filesize" + when "attach_type" + attribute = "attachtype" + when "content_type" + attribute = "created_on" + when "field_file_dense" + attribute = "is_public" + when "downloads" + attribute = "downloads" + when "created_on" + attribute = "created_on" + end + + if order_by.count == 1 + sort += "#{Attachment.table_name}.#{attribute} desc " + elsif order_by.count == 2 + sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " + end + if sort_type != params[:sort].split(",").last + sort += "," + end end end - - if @orderBy=="size" - @orderBy="filesize" - elsif @orderBy=="field_file_dense" - @orderBy="is_public" - elsif @orderBy=="attach_type" - @orderBy="attachtype" - elsif @orderBy=="content_type" - @orderBy="attachtype" - end - - if @orderBy - @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)] - else - @containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)] - end + @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers render :layout => 'base_courses' end + end def new 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/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 315a86340..637c92db3 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -326,7 +326,7 @@ module IssuesHelper if detail.property == 'attr' && detail.prop_key == 'description' s = l(:text_journal_changed_no_detail, :label => label) unless no_html - diff_link = link_to 'diff', + diff_link = link_to l(:label_diff), {:controller => 'journals', :action => 'diff', :id => detail.journal_id, :detail_id => detail.id, :only_path => options[:only_path]}, :title => l(:label_view_diff) 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 diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index bfecb5304..f93d57f90 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -22,15 +22,22 @@ <%= error_messages_for 'bid' %>

<%= l(:label_homeworks_form_new_description) %>

-

<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %>

+

+ <%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onblur => "regexName();" %> -

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

+

+

+ +

<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %>

<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %> -

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}",:readonly => "readonly") %><%= calendar_for('bid_deadline')%> +

<%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %><%= calendar_for('bid_deadline')%> + + +

<%= f.select :is_evaluation, is_evaluation_option %>

diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index b3fff9e5f..e339db2d7 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -1,9 +1,60 @@ + +

<%=l(:label_course_new_homework)%>

<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<%= render :partial => 'homework_form', :locals => { :f => f } %> - <%= submit_tag l(:button_create), :class => "enterprise" %> + <%= javascript_tag "$('#bid_name').focus();" %> <% end %>
\ No newline at end of file diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index f5018fc94..2446c4e3d 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -37,21 +37,21 @@ - <%= textilizable act, :description %> + <%= textAreailizable act, :description %> @@ -314,7 +314,7 @@ <% end %> -

<%= h act.description %>

+

<%= textAreailizable act, :description %>

@@ -384,7 +384,7 @@ -

<%= textilizable e.notes %>

+

<%= textAreailizable e.notes %>

diff --git a/app/views/users/user_activities.html.erb b/app/views/users/user_activities.html.erb index 2b4cf8819..080e772a1 100644 --- a/app/views/users/user_activities.html.erb +++ b/app/views/users/user_activities.html.erb @@ -13,7 +13,7 @@ <%# end -%> <%# end -%> - + <%# end %> --> diff --git a/app/views/wiki/diff.html.erb b/app/views/wiki/diff.html.erb index c1062924c..ef26c570c 100644 --- a/app/views/wiki/diff.html.erb +++ b/app/views/wiki/diff.html.erb @@ -22,6 +22,6 @@ %>, <%= format_time(@diff.content_to.updated_on) %>)

-
+
<%= simple_format_without_paragraph @diff.to_html %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 14f57e34f..2fb7ef2bf 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1214,7 +1214,7 @@ zh: notice_issue_successful_create: 问题 %{id} 已创建。 label_between: 介于 setting_issue_group_assignment: 允许问题被分配给组 - label_diff: diff + label_diff: 查看差别 description_query_sort_criteria_direction: 排序方式 description_project_scope: 搜索范围 description_filter: 过滤器 diff --git a/db/schema.rb b/db/schema.rb index db51ddd37..1307dd913 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -437,14 +437,14 @@ 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 t.integer "show_course", :default => 1 t.integer "show_contest", :default => 1 + t.integer "image_width", :default => 107 + t.integer "image_height", :default => 63 end create_table "forums", :force => true do |t| @@ -458,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