diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index cfa2e2bf0..8ba2ce20f 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -234,8 +234,8 @@ class IssuesController < ApplicationController @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) # 给该issue在它所在的项目中所有的issues中所在的位置给一个序号 @issue.project_issues_index = @issue.project.issues.last.nil? ? 1 : @issue.project.issues.last.project_issues_index + 1 + @issue.fixed_version_id = nil if @issue.fixed_version_id == 0 if @issue.save - senduser = User.find(params[:issue][:assigned_to_id]) issue_id = @issue.id issue_title = params[:issue][:subject] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b1007ac8b..107f2ff88 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -27,7 +27,7 @@ class ProjectsController < ApplicationController menu_item :feedback, :only => :feedback menu_item :share, :only => :share - before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] + before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project, :forked_pop] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar] @@ -533,7 +533,7 @@ class ProjectsController < ApplicationController @project.update_attribute(:is_public, 1) end end - # by young + # include CoursesHelper def member # 消息"同意加入项目" @@ -597,6 +597,10 @@ class ProjectsController < ApplicationController end + def member_forked + @members_forked = User.find_by_sql("SELECT u.* FROM `projects` p,`users` u where p.user_id = u.id and p.forked_from_project_id = #{@project.id} ;") + end + def update_message_status(user, project) # 更新加入项目消息 project__messages = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'JoinProject', 'RemoveFromProject') and user_id =? and project_id =? ", user, project) @@ -756,6 +760,13 @@ class ProjectsController < ApplicationController redirect_to admin_projects_url(:status => params[:status]) end + # 资源库fork弹框 + def forked_pop + respond_to do |format| + format.js + end + end + def close @project.close redirect_to project_url(@project) @@ -942,5 +953,4 @@ class ProjectsController < ApplicationController return projects end #gcmend - end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index bd6c67f58..0e8ca71c0 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -40,7 +40,7 @@ class RepositoriesController < ApplicationController # before_filter :connect_gitlab, :only => [:quality_analysis, :commit_diff] before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue] - before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :project_archive, :quality_analysis] + before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :project_archive, :quality_analysis, :commit_diff] # 版本库新增权限 # before_filter :show_rep, :only => [:show, :stats, :revisions, :revision, :diff, :commit_diff ] accept_rss_auth :revisions @@ -87,35 +87,34 @@ class RepositoriesController < ApplicationController end def forked - @project = Project.find(params[:id]) - @repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab") - # 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项 - unless has_forked?(@project, User.current) - project = project_from_current_project(@project.id, User.current.id) - redirect_to project_path(project) - else - # 自己不能fork自己的项目 - if User.current.id == @project.user_id - flash[:notice] = l(:project_gitlab_fork_own) - redirect_to repository_url(@repository) - else - g = Gitlab.client - if User.current.gid.nil? - begin - g.sync_user(User.current) - ensure - logger.error "Synv user failed ==>#{User.current.id}" + @project = Project.find(params[:id]) + @repository = Repository.where("project_id =? and type =?", @project.id, "Repository::Gitlab") + # 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项 + unless has_forked?(@project, User.current) + project = project_from_current_project(@project.id, User.current.id) + redirect_to project_path(project) + else + # 自己不能fork自己的项目 + if User.current.id == @project.user_id + flash[:notice] = l(:project_gitlab_fork_own) + redirect_to repository_url(@repository) + else + g = Gitlab.client + if User.current.gid.nil? + begin + g.sync_user(User.current) + ensure + logger.error "Synv user failed ==>#{User.current.id}" + end + end + gproject = g.fork(@project.gpid, User.current.gid) + if gproject + copy_project(@project, gproject) + forked_count = @project.forked_count.to_i + 1 + @project.update_attributes(:forked_count => forked_count) + end end end - gproject = g.fork(@project.gpid, User.current.gid) - if gproject - copy_project(@project, gproject) - forked_count = @project.forked_count.to_i + 1 - @project.update_attributes(:forked_count => forked_count) - end - end - end - end # 一键ZIP下载 @@ -262,6 +261,7 @@ update end @repository.project = @project @repository.type = 'Repository::Gitlab' + @repository.identifier = @repository.identifier.downcase @repository.url = @repository.identifier if request.post? && @repository.save s = Trustie::Gitlab::Sync.new @@ -477,8 +477,14 @@ update end def entry + # 顶部导航 + @project_menu_type = 5 + entry_and_raw(false) @content = @repository.cat(@path, @rev) + @changesets_latest_coimmit = @g.commit(@project.gpid, @entry.try(:lastrev)) + # 总的提交数 + @changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count if is_entry_text_data?(@content, @path) render :layout => 'base_projects' end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c95366835..b1d458d49 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1137,7 +1137,7 @@ class UsersController < ApplicationController def user_import_resource @user = User.current user_course_ids = @user.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{@user.id} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @homework_id = params[:homework_id] @@ -1156,26 +1156,22 @@ class UsersController < ApplicationController #引入资源列表根据类型过滤 def user_resource_type - if User.current.id.to_i != params[:id].to_i - render_403 - return - end user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" - @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + @attachments = get_course_resources(User.current.id, user_course_ids, @order, @score) elsif params[:status] == "3" - @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + @attachments = get_project_resources(User.current.id, user_project_ids, @order, @score) elsif params[:status] == "4" - @attachments = get_attch_resources(params[:id], @order, @score) + @attachments = get_attch_resources(User.current.id, @order, @score) elsif params[:status] == "5" - @attachments = get_principal_resources(params[:id], @order, @score) + @attachments = get_principal_resources(User.current.id, @order, @score) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(User.current.id, user_course_ids, user_project_ids, @order, @score) end elsif params[:type] == "6" # 公共资源 if params[:status] == "2" @@ -1207,11 +1203,7 @@ class UsersController < ApplicationController #引入资源列表根据关键词过滤 - def user_ref_resource_search - if User.current.id.to_i != params[:id].to_i - render_403 - return - end + def user_ref_resource_searc @resource_id = params[:mul_id] @resource_type = params[:mul_type] @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" @@ -1225,7 +1217,7 @@ class UsersController < ApplicationController user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} - @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search) + @attachments = get_my_resources_search(User.current.id, user_course_ids, user_project_ids, @order, @score, search) elsif (params[:type].blank? || params[:type] == "6") # 公共资源 # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search) @@ -2041,7 +2033,7 @@ class UsersController < ApplicationController user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} - @user = User.find(params[:id]) + @user = User.current # 保存文件 attach = Attachment.attach_filesex_public(@user, params[:attachments], params[:attachment_type], is_public = true) @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" @@ -2050,16 +2042,16 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" - @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + @attachments = get_course_resources(@user.id, user_course_ids, @order, @score) elsif params[:status] == "3" - @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + @attachments = get_project_resources(@user.id, user_project_ids, @order, @score) elsif params[:status] == "4" - @attachments = get_attch_resources(params[:id], @order, @score) + @attachments = get_attch_resources(@user.id, @order, @score) elsif params[:status] == "5" - @attachments = get_principal_resources(params[:id], @order, @score) + @attachments = get_principal_resources(@user.id, @order, @score) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(@user.id, user_course_ids, user_project_ids, @order, @score) end elsif params[:type] == "6" # 公共资源 if params[:status] == "2" @@ -2109,16 +2101,16 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" - @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + @attachments = get_course_resources(@user.id, user_course_ids, @order, @score) elsif params[:status] == "3" - @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + @attachments = get_project_resources(@user.id, user_project_ids, @order, @score) elsif params[:status] == "4" - @attachments = get_attch_resources(params[:id], @order, @score) + @attachments = get_attch_resources(@user.id, @order, @score) elsif params[:status] == "5" - @attachments = get_principal_resources(params[:id], @order, @score) + @attachments = get_principal_resources(@user.id, @order, @score) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(@user.id, user_course_ids, user_project_ids, @order, @score) end elsif params[:type] == "6" # 公共资源 if params[:status] == "2" @@ -2248,16 +2240,16 @@ class UsersController < ApplicationController if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" - @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + @attachments = get_course_resources(User.current.id, user_course_ids, @order, @score) elsif params[:status] == "3" - @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + @attachments = get_project_resources(User.current.id, user_project_ids, @order, @score) elsif params[:status] == "4" - @attachments = get_attch_resources(params[:id], @order, @score) + @attachments = get_attch_resources(User.current.id, @order, @score) elsif params[:status] == "5" - @attachments = get_principal_resources(params[:id], @order, @score) + @attachments = get_principal_resources(User.current.id, @order, @score) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(User.current.id, user_course_ids, user_project_ids, @order, @score) end elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @@ -2408,16 +2400,16 @@ class UsersController < ApplicationController if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" - @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + @attachments = get_course_resources(User.current.id, user_course_ids, @order, @score) elsif params[:status] == "3" - @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + @attachments = get_project_resources(User.current.id, user_project_ids, @order, @score) elsif params[:status] == "4" - @attachments = get_attch_resources(params[:id], @order, @score) + @attachments = get_attch_resources(User.current.id, @order, @score) elsif params[:status] == "5" - @attachments = get_principal_resources(params[:id], @order, @score) + @attachments = get_principal_resources(User.current.id, @order, @score) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(User.current.id, user_course_ids, user_project_ids, @order, @score) end elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @@ -2549,16 +2541,16 @@ class UsersController < ApplicationController if(params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" - @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + @attachments = get_course_resources(User.current.id, user_course_ids, @order, @score) elsif params[:status] == "3" - @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + @attachments = get_project_resources(User.current.id, user_project_ids, @order, @score) elsif params[:status] == "4" - @attachments = get_attch_resources(params[:id], @order, @score) + @attachments = get_attch_resources(User.current.id, @order, @score) elsif params[:status] == "5" - @attachments = get_principal_resources(params[:id], @order, @score) + @attachments = get_principal_resources(User.current.id, @order, @score) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(User.current.id, user_course_ids, user_project_ids, @order, @score) end elsif (params[:type].blank? || params[:type] == "6") # 公共资源 if params[:status] == "2" @@ -3061,16 +3053,16 @@ class UsersController < ApplicationController if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 if params[:status] == "2" - @attachments = get_course_resources(params[:id], user_course_ids, @order, @score) + @attachments = get_course_resources(User.current.id, user_course_ids, @order, @score) elsif params[:status] == "3" - @attachments = get_project_resources(params[:id], user_project_ids, @order, @score) + @attachments = get_project_resources(User.current.id, user_project_ids, @order, @score) elsif params[:status] == "4" - @attachments = get_attch_resources(params[:id], @order, @score) + @attachments = get_attch_resources(User.current.id, @order, @score) elsif params[:status] == "5" - @attachments = get_principal_resources(params[:id], @order, @score) + @attachments = get_principal_resources(User.current.id, @order, @score) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(User.current.id, user_course_ids, user_project_ids, @order, @score) end elsif (params[:type] == "6") # 公共资源 if params[:status] == "2" @@ -3115,11 +3107,6 @@ class UsersController < ApplicationController # 导入资源 def import_resources - # 别人的资源库是没有权限去看的 - if User.current.id != params[:id].to_i - render_403 - return - end @resource_id = params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id] @resource_type = params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project" @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" @@ -3128,7 +3115,7 @@ class UsersController < ApplicationController user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} if(params[:type].blank? || params[:type] == "1") # 我的资源 # 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源 - @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score) + @attachments = get_my_resources(User.current.id, user_course_ids, user_project_ids, @order, @score) elsif params[:type] == "6" # 公共资源 # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) @@ -3149,10 +3136,6 @@ class UsersController < ApplicationController end def import_resources_search - if User.current.id.to_i != params[:id].to_i - render_403 - return - end @resource_id = params[:mul_id] @resource_type = params[:mul_type] @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc" @@ -3166,7 +3149,7 @@ class UsersController < ApplicationController user_course_ids = User.current.courses.map { |c| c.is_delete == 0 && c.id} user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } # user_org_ids = User.current.organizations.map {|o| o.id} - @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search) + @attachments = get_my_resources_search(User.current.id, user_course_ids, user_project_ids, @order, @score, search) elsif params[:type] == "6" # 公共资源 # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search) @@ -3253,16 +3236,16 @@ class UsersController < ApplicationController user_project_ids = User.current.projects.map {|p| p.status != 9 && p.id } if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') # 全部 if params[:status] == "2" - @attachments = get_course_resources_search(params[:id], user_course_ids, @order, @score, search) + @attachments = get_course_resources_search(User.current.id, user_course_ids, @order, @score, search) elsif params[:status] == "3" - @attachments = get_project_resources_search(params[:id], user_project_ids, @order, @score, search) + @attachments = get_project_resources_search(User.current.id, user_project_ids, @order, @score, search) elsif params[:status] == "4" - @attachments = get_attch_resources_search(params[:id], @order, @score, search) + @attachments = get_attch_resources_search(User.current.id, @order, @score, search) elsif params[:status] == "5" - @attachments = get_principal_resources_search(params[:id], @order, @score, search) + @attachments = get_principal_resources_search(User.current.id, @order, @score, search) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search) + @attachments = get_my_resources_search(User.current.id, user_course_ids, user_project_ids, @order, @score, search) end elsif params[:type] == "6" # 公共资源 if params[:status] == "2" diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cf90e58a6..c32f6c175 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -67,12 +67,12 @@ module ApplicationHelper end # 重置user_path,目的是将id转换成用户名 - # def user_path(resource, parameters = {}) - # if Fixnum === resource - # resource = User.find(resource) - # end - # super - # end + def user_path(resource, parameters = {}) + if Fixnum === resource + resource = User.find(resource) + end + super + end # 历史数据(老版本库数据)处理完则可以修改该放放 def get_rep_identifier_by_project project diff --git a/app/models/user.rb b/app/models/user.rb index c226e2a52..8f7939bb3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -322,9 +322,9 @@ class User < Principal end # id 转换成 登录名 - # def to_param - # self.login.to_i > 0 ? id : login - # end + def to_param + self.login.to_i > 0 ? id : login + end def my_blogs_count diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index f302190b2..f5b5692f3 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -2,63 +2,6 @@ input.is_public,input.is_public_checkbox{height:12px;} input.is_public_checkbox{margin-left:4px;margin-right:4px;} -
- -<% if defined?(container) && container && container.saved_attachments %> - <% container.attachments.each_with_index do |attachment, i| %> - - <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly', :readonly => 'readonly', :style=>'border:none;') %> - <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %> - - <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> - <%= if attachment.id.nil? - #待补充代码 - else - link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') - end - %> - <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> - - <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> - -
- <% end %> - -<% end %> -
- <% project = project %> -
- - <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - - <%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> - <%= file_field_tag 'attachments[dummy][file]', - :id => '_file', - :class => 'file_selector', - :multiple => true, - :onchange => 'addInputFiles(this);', - :style => ie8? ? '' : 'display:none', - :data => { - :max_file_size => Setting.attachment_max_size.to_i.kilobytes, - :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), - :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, - :upload_path => uploads_path(:format => 'js', :project => project), - :description_placeholder => l(:label_optional_description), - :field_is_public => l(:field_is_public), - :are_you_sure => l(:text_are_you_sure), - :file_count => l(:label_file_count), - :lebel_file_uploding => l(:lebel_file_uploding), - :delete_all_files => l(:text_are_you_sure_all) - } %> - - <%= l(:label_no_file_uploaded) %> - - (<%= l(:label_max_size) %>: - <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) - - - <% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> - <% end %> -
- +
+ <%= render :partial=>'attachments/form_attachments', :locals => { :container => container }%> +
\ No newline at end of file diff --git a/app/views/attachments/_form_attachments.html.erb b/app/views/attachments/_form_attachments.html.erb new file mode 100644 index 000000000..db4ba070c --- /dev/null +++ b/app/views/attachments/_form_attachments.html.erb @@ -0,0 +1,58 @@ + +<% if defined?(container) && container && container.saved_attachments %> + <% container.attachments.each_with_index do |attachment, i| %> + + <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly hidden', :readonly => 'readonly', :style=>'border:none; width:460px;') %> + + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %> + <%= if attachment.id.nil? + #待补充代码 + else + link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') + end + %> + <%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %> + + <%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
+ <% end %> + +<% end %> +
+<% project = project %> +
+ + <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> + + <%= button_tag "上传附件", :id => "upload_attachments", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => 'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => ie8? ? '' : 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js', :project => project), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> + + <%= l(:label_no_file_uploaded) %> + + (<%= l(:label_max_size) %>: + <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) + + +<% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> +<% end %> \ No newline at end of file diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb index 97d3fd3ec..8bb2ab2cc 100644 --- a/app/views/attachments/destroy.js.erb +++ b/app/views/attachments/destroy.js.erb @@ -12,6 +12,10 @@ $("#attachment_history_popub").html('<%= escape_javascript( render :partial => ' $("#attachment_history_popub").html('<%= escape_javascript( render :partial => 'files/attachment_history_popub') %>'); <% end %> +<% if params[:attachment_id] %> +$("#issue_upload_attachments").html('<%= escape_javascript( render :partial => 'attachments/form_attachments', :locals => { :container => @attachment.container }) %>'); +<% end %> + <% if @is_destroy%> $("#attachment_<%= @attachment.id%>").remove(); if(document.getElementById("revise_attachment_div_<%= @attachment.id%>")) { @@ -49,4 +53,4 @@ $("#attachment_history_popub").html('<%= escape_javascript( render :partial => ' $("#choose_revise_attach").attr("onclick","_file.click();"); } //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end -<% end%> \ No newline at end of file +<% end%> diff --git a/app/views/common/_file.html.erb b/app/views/common/_file.html.erb index 8818d8ac0..7aafff19a 100644 --- a/app/views/common/_file.html.erb +++ b/app/views/common/_file.html.erb @@ -1,5 +1,5 @@
- +
<% line_num = 1 %> <% syntax_highlight_lines(filename, Redmine::CodesetUtil.to_utf8_by_setting(content)).each do |line| %> diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb index 99a93c6ae..2fb6dd876 100644 --- a/app/views/files/_resource_detail.html.erb +++ b/app/views/files/_resource_detail.html.erb @@ -48,7 +48,7 @@ <% end %> <% else %> -
+
资源描述:<% if file.description.blank? %>未添加<% else %><%= file.description %><% end %>
<% end %> diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index f9c6c1666..e1a7c6e60 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -10,7 +10,7 @@ <%= k%> x<%= v%> <% else%> - + <%= k%> x<%= v%> diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index f97804806..649965b97 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -1,14 +1,5 @@ <%= labelled_fields_for :issue, @issue do |f| %>
    -
  • - <% if @issue.safe_attribute? 'tracker_id' %> - - <%= f.select :tracker_id, @issue.project.trackers.collect { |t| [t.name, t.id] }, - {:required => true, :no_label => true}, - #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", - :class => "w90" %> - <% end %> -
  • <% if @issue.safe_attribute? 'subject' %> @@ -36,19 +27,28 @@ <%#= wikitoolbar_for 'issue_description' %> <% end %>
  • -
  • - +
  • + <% if @issue.safe_attribute? 'tracker_id' %> + + <%= f.select :tracker_id, @issue.project.trackers.collect { |t| [t.name, t.id] }, + {:required => true, :no_label => true}, + #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", + :class => "w110" %> + <% end %> +
  • +
  • + <%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> <%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }), - {:no_label => true}, - :class => "w150" %> + {:no_label => true}, + :class => "w110" %>
  • -
  • - +
  • + <% if @issue.safe_attribute? 'priority_id' %> <%= f.select :priority_id, (@priorities.collect { |p| [p.name, p.id] }), - {:required => true, :no_label => true}, :disabled => !@issue.leaf?, - :class => "w150" %> + {:required => true, :no_label => true}, :disabled => !@issue.leaf?, + :class => "w110" %> <% end %>
  • @@ -86,7 +86,7 @@
  • <%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, - {:onchange => "change_milestone_tip();",:class => "w150"} %> + {:onchange => "change_milestone_tip();", :class => "w150"} %>
  • <%= @issue.fixed_version.nil? ? "无里程碑" : "已指派里程碑" %> @@ -97,7 +97,8 @@
  • <% if @issue.safe_attribute? 'start_date' %> <%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, - :required => @issue.required_attribute?('start_date'), :onchange=>"issue_start_date_change();", :class=>"fl calendar_input", :style=>"width:170px;" %> + :required => @issue.required_attribute?('start_date'), :onchange=>"issue_start_date_change();", + :class=>"fl calendar_input", :style=>"width:170px;" %> <%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %> <% end %>
  • @@ -108,20 +109,22 @@ <% if @issue.safe_attribute? 'due_date' %> <%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, - :required => @issue.required_attribute?('due_date'), :onchange=>"issue_end_date_change();", :class=>"fl calendar_input",:style=>"width: 170px;" %> + :required => @issue.required_attribute?('due_date'), :onchange=>"issue_end_date_change();", + :class=>"fl calendar_input",:style=>"width: 170px;", :placeholder=> "请选择结束日期" %> <%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %> <% end %>
  • <%= @issue.due_date.nil? ? "未选择结束日期" : "已选择结束日期" %>
  • -
  • <%= l(:field_estimated_hours) %>
  • <% if @issue.safe_attribute? 'estimated_hours' %> - <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('estimated_hours') %> + <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, + :required => @issue.required_attribute?('estimated_hours'), :placeholder=> "请填写预计工时" %> <% end %>
  • -
  • 完成度
  • +
  • <%= l(:field_estimated_hours) %>
  • +
  • <% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %> <%= f.select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), @@ -129,6 +132,7 @@ :onchange => "PrecentChange(this.value)", :class => "w150" %> <% end %> +
  • 完成度
<% end %> @@ -153,4 +157,7 @@ function issue_end_date_change() { $('#option_end_date_tips').html("已选择结束日期"); } + // 里程碑添加默认选项 + $("#issue_fixed_version_id option[value='']").remove(); + $('#issue_fixed_version_id').prepend("") diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index efa38734e..783aade75 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -119,7 +119,7 @@ <% end %>
- <% @project.shared_versions.each do |version| %> + <% @project.shared_versions.reverse.each do |version| %> <% @version_issue_assigned_name.each do | assigned | %> - + diff --git a/app/views/versions/_new_milestone.html.erb b/app/views/versions/_new_milestone.html.erb index 0fbbb4f03..47c1d2b39 100644 --- a/app/views/versions/_new_milestone.html.erb +++ b/app/views/versions/_new_milestone.html.erb @@ -1,4 +1,4 @@ -
+

新建里程碑

@@ -17,22 +17,22 @@
  • - + <%= f.text_field :description, :maxlength => 60, :class=>"w650", :style=>"height:28px;", :no_label => true %>
  • - - - - - - -
  • - + + +
  • +
  • + <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]},{:no_label => true },{:style=>"height:28px;"} %>
  • - 取消 + 取消 保存 <% end %>
    @@ -46,8 +46,8 @@ { if(popub_regex_version_name()) { - hideModal(); $("#popub_new_project_version_form").submit(); + hideModal(); } } diff --git a/app/views/versions/edit.js.erb b/app/views/versions/edit.js.erb index 377dbeebd..baa20b6cd 100644 --- a/app/views/versions/edit.js.erb +++ b/app/views/versions/edit.js.erb @@ -1,3 +1,7 @@ var htmlvalue = "<%= escape_javascript(render :partial => 'versions/edit') %>"; pop_box_new(htmlvalue,820,316); +var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; +$(function() { $('#version_effective_date2').datepicker(datepickerOptions); +// $('#evaluation_end_time').datepicker(datepickerOptions); +}); diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index e53925ed7..1201ed36e 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -1,3 +1,4 @@ +
    diff --git a/app/views/versions/new.js.erb b/app/views/versions/new.js.erb index ab5ad83aa..437dae2ca 100644 --- a/app/views/versions/new.js.erb +++ b/app/views/versions/new.js.erb @@ -1,2 +1,6 @@ var htmlvalue = "<%= escape_javascript(render :partial => 'versions/new_milestone') %>"; pop_box_new(htmlvalue,820,316); +var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}; +$(function() { $('#version_index_create_name').datepicker(datepickerOptions); +// $('#evaluation_end_time').datepicker(datepickerOptions); +}); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e5a122f19..05dc9be4a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -775,6 +775,7 @@ RedmineApp::Application.routes.draw do get 'member', :to => 'projects#member', :as => 'member' match 'store_mine', :to => 'projects#store_mine', :as => 'store_mine' match 'enshrine', :to => 'projects#enshrine', :as => 'enshrine' + match 'member_forked', :to => 'projects#member_forked', :as => 'member_forked' get 'file', :action => 'file', :as => 'file' get 'statistics', :action => 'statistics', :as => 'statistics' get 'repository_tree_changes', :action => 'repository_tree_changes', :as => 'repository_tree_changes' @@ -794,6 +795,7 @@ RedmineApp::Application.routes.draw do post 'unarchive' post 'close' post 'reopen' + get 'forked_pop' get 'search_public_orgs_not_in_project' match 'copy', :via => [:get, :post] match 'set_public_or_private', :via => [:post] @@ -808,7 +810,6 @@ RedmineApp::Application.routes.draw do match '/file', :to => 'projects#file', :as => 'file', :via => :get match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get match '/watcherlist', :to=>'projects#watcherlist', :as => 'watcherlist', :via => :get #add by huang - resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do collection do get 'autocomplete' diff --git a/config/settings.yml b/config/settings.yml index dc89093f1..c97fd74ca 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -103,7 +103,7 @@ feeds_limit: default: 15 gantt_items_limit: format: int - default: 500 + default: 10000 # Maximum size of files that can be displayed # inline through the file viewer (in KB) file_max_size_displayed: diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 32be436bd..235f8d9e0 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -137,7 +137,7 @@ module Redmine def issues @issues ||= @query.issues( :include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => "#{Project.table_name}.lft ASC, #{Issue.table_name}.id ASC", + :order => "#{Project.table_name}.lft DESC, #{Issue.table_name}.updated_on DESC", :limit => @max_rows ) end @@ -677,15 +677,16 @@ module Redmine # Sorts a collection of issues by start_date, due_date, id for gantt rendering def sort_issues!(issues) - issues.sort! { |a, b| gantt_issue_compare(a, b) } + # issues.sort! { |a, b| gantt_issue_compare(a, b) } + issues end # TODO: top level issues should be sorted by start date def gantt_issue_compare(x, y) if x.root_id == y.root_id - x.lft <=> y.lft + x.updated_on <=> y.updated_on else - x.root_id <=> y.root_id + x.updated_on <=> y.updated_on end end diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index be5bb0654..7c3e513f7 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -103,10 +103,10 @@ function addFile(inputEl, file, eagerUpload,btnId) { fileSpan.append( $('', { 'type': 'text', - 'class': 'upload_filename readonly', + 'class': 'upload_filename readonly hidden', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly', - 'style': 'border:none;' + 'style': 'border:none; width:464px;' }).val(file.name), // $('', { // 'type': 'text', @@ -127,7 +127,8 @@ function addFile(inputEl, file, eagerUpload,btnId) { // }).toggle(!eagerUpload), $(' ').attr({ 'href': "#", - 'class': 'remove-upload' + 'class': 'remove-upload', + 'style': 'vertical-align:top;' }).click(function() { if (confirm($(inputEl).data('areYouSure'))) { removeFile(); diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index a2b577263..12fe8ff14 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -122,6 +122,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .ml36{ margin-left:36px; } .ml38{ margin-left:38px;} .ml40{ margin-left:40px;} +.ml41{ margin-left:41px;} .ml45{ margin-left:45px;} .ml48{ margin-left:48px;} .ml50{ margin-left: 50px;} @@ -182,6 +183,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .mt-20 {margin-top:-20px;} .mt-10 {margin-top:-10px;} .mt-4 {margin-top:-4px;} +.mt-5 {margin-top:-5px;} .mt-2 {margin-top:-2px;} .mt0 {margin-top: 0px !important;} .mt1{margin-top: 1px;} @@ -236,7 +238,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .w80{ width:80px;} .w90{ width:90px;} .w100 {width: 100px;} -.w110{width:110px;} +.w110{width:110px !important;} .w108 {width:108px;} .w125{width:125px;} .w128{ width:128px;} diff --git a/public/stylesheets/css/project.css b/public/stylesheets/css/project.css index cb8e4efaf..09dced2ad 100644 --- a/public/stylesheets/css/project.css +++ b/public/stylesheets/css/project.css @@ -216,9 +216,6 @@ p.percent { float: right; white-space: nowrap; line-height: 1.4em; - padding-left: 10px; - padding-right: 10px; - padding-top: 5px; font-size: 0.9em; } diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index 54fc132ff..9853c16e2 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -289,5 +289,5 @@ li.commit .commit-row-info .committed_ago { } .rep_mail_name{max-width: 150px; overflow: hidden; text-overflow: ellipsis;} a.btn_zipdown{ display:block; height:25px; width:80px; text-align: center; line-height: 25px; border: 1px solid #dddddd; background-image: linear-gradient(#FCFCFC, #EEE); - color: #7f7f7f; -webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; margin-top: 7px; margin-right: 5px;} + color: #7f7f7f; -webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; margin-left: 5px;} a:hover.btn_zipdown{color:#269ac9;} \ No newline at end of file diff --git a/public/stylesheets/scm.css b/public/stylesheets/scm.css index 46761a46e..f9cb2e7c2 100644 --- a/public/stylesheets/scm.css +++ b/public/stylesheets/scm.css @@ -34,7 +34,7 @@ li.change .copied-from:before { content: " - "} #changes-legend { float: right; font-size: 0.8em; margin:0; margin-right: 10px; }/*by young*/ #changes-legend li { float: left; background-position: 5px 0; } -table.filecontent { border: 1px solid #e2e2e2; border-collapse: collapse; width:98%; background-color: #fafafa; } +table.filecontent { border: 1px solid #e2e2e2; border-collapse: collapse; width:99%; background-color: #fafafa; } table.filecontent tbody {font-family:"Liberation Mono", Courier, monospace; font-size:12px;} table.filecontent th { border: 1px solid #e2e2e2; background-color: #eee; } table.filecontent th.filename { background-color: #e4e4d4; text-align: left; padding:5px;}
    <%= User.find(assigned[0]).show_name %><%= User.find(assigned[0]).try(:show_name) %> <%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0]).count %> <%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0], :status_id => 3).count %> <%= Issue.where(:fixed_version_id => @version.id, :assigned_to_id => assigned[0], :status_id => 5).count %>