diff --git a/Gemfile b/Gemfile index 299af4509..34e81cef6 100644 --- a/Gemfile +++ b/Gemfile @@ -25,8 +25,10 @@ gem 'rufus-scheduler' #gem 'dalli', path: 'lib/dalli-2.7.2' group :development do gem 'grape-swagger' - gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' + #gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' #gem 'puma' + gem 'pry-rails' + gem 'pry-byebug' gem 'better_errors', path: 'lib/better_errors' gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler' end @@ -50,8 +52,8 @@ group :test do #end end - gem 'rspec-rails' , '2.13.1' - gem 'guard-rspec','2.5.0' + # gem 'rspec-rails' , '2.13.1' + # gem 'guard-rspec','2.5.0' # Gems used only for assets and not required # in production environments by default. group :assets do @@ -95,7 +97,7 @@ if File.exist?(database_file) adapters.each do |adapter| case adapter when 'mysql2' - gem "mysql2", "= 0.3.11", :platforms => [:mri, :mingw] + gem "mysql2", "= 0.3.18", :platforms => [:mri, :mingw] gem "activerecord-jdbcmysql-adapter", :platforms => :jruby when 'mysql' gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw] diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index ccab34283..72f4bdd92 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -97,12 +97,10 @@ class AttachmentsController < ApplicationController end if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download - if stale?(:etag => @attachment.digest) - # images are sent inline send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), :type => detect_content_type(@attachment), - :disposition => (@attachment.image? ? 'inline' : 'attachment') + :disposition => 'attachment' #inline can open in browser end else diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 42fd40606..28156ac0c 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -145,11 +145,16 @@ class FilesController < ApplicationController end end - @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] - @containers += @project.versions.includes(:attachments).reorder(sort).all + @containers = [ Project.includes(:attachments).find(@project.id)] + @containers += @project.versions.includes(:attachments).all - show_attachments @containers + ids = [] + @containers.each do |c| + ids += c.attachments.pluck(:id) + end + @containers = [Struct.new(:attachments).new(Attachment.where('id in (?)',ids).reorder(sort))] + show_attachments @containers respond_to do |format| format.html diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f1f026029..44e5fd8a3 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -338,12 +338,12 @@ class ProjectsController < ApplicationController email = params[:mail] Mailer.send_invite_in_project(email, @project, User.current).deliver @is_zhuce =false - flash[:notice] = l(:notice_successful_update) + flash[:notice] = l(:notice_email_sent, :value => email) else @is_zhuce = true end respond_to do |format| - format.js + format.html{redirect_to invite_members_by_mail_project_url(@project)} end end #发送邮件邀请新用户 diff --git a/app/models/project.rb b/app/models/project.rb index 313652bf4..07854822e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -41,7 +41,7 @@ class Project < ActiveRecord::Base has_many :principals, :through => :member_principals, :source => :principal has_many :enabled_modules, :dependent => :delete_all has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position" - has_many :issues, :dependent => :destroy, :include => [:status, :tracker],:order => "id ASC" + has_many :issues, :dependent => :destroy, :include => [:status, :tracker],:order => "issues.id ASC" has_many :issue_changes, :through => :issues, :source => :journals has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC" has_many :time_entries, :dependent => :delete_all diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 1d637919c..0949899dd 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -1,6 +1,6 @@ <% if defined?(container) && container && container.saved_attachments %> - <% container.attachments.each_with_index do |attachment, i| %> + <% container.saved_attachments.each_with_index do |attachment, i| %> <%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%> <%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 989ed776d..8913febd0 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -34,7 +34,8 @@ <%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id}, :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, - :class => 'delete', + :class => 'delete delete-homework-icon', + :remote => true, :title => l(:button_delete) %> <% else %> <%= link_to image_tag('delete.png'), attachment_path(attachment), diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index f1cae8b21..42a27376b 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -1,11 +1,26 @@

邀请加入

@@ -23,8 +38,9 @@
<%= render :partial => 'regested', locals: { :isregisted => false} %>
- <%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get',:remote=>true) do %> - <%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email) %> + <%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %> + + <%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onblur => "verifyAddress();" %>
diff --git a/config/locales/projects/en.yml b/config/locales/projects/en.yml index a7c88eb19..bc4395df0 100644 --- a/config/locales/projects/en.yml +++ b/config/locales/projects/en.yml @@ -82,7 +82,16 @@ en: # # 邀请 # - notice_registed_success: 您输入的邮箱为空或者该邮箱已被注册! + label_invite_new_user: "发送邮件邀请新用户" + label_invite_join: 邀请加入 + label_invite_email_tips: 输入好友邮箱地址,Trustie会自动为该邮箱注册用户! + label_email: 邮箱 + notice_registed_success: 您所填写的电子邮件格式不正确或者该邮箱已被注册! + label_send_email_free: 免费发送 + label_email_format_error: 您所填写的电子邮件格式不正确 + + + label_invite_trustie_user: "邀请Trustie注册用户" # diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index be99953b9..d6e03fc14 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -58,8 +58,7 @@ zh: project_module_code_review: 代码审查 project_module_calendar: 日历 project_module_gantt: 甘特图 - project_module_documents: 文档 - project_module_files: 资源库 + project_module_documents: 文档 label_project_tool_response: 用户反馈 label_module_share: DTS测试工具 @@ -84,12 +83,14 @@ zh: # 邀请 # label_invite_new_user: "发送邮件邀请新用户" - label_invite_trustie_user: "邀请Trustie注册用户" label_invite_join: 邀请加入 label_invite_email_tips: 输入好友邮箱地址,Trustie会自动为该邮箱注册用户! notice_registed_success: 您输入的邮箱为空或者该邮箱已被注册! + label_send_email_free: 免费发送 + label_email_format_error: 您所填写的电子邮件格式不正确 + - + label_invite_trustie_user: "邀请Trustie注册用户" # # 项目托管平台 diff --git a/db/migrate/20150227085333_add_data_to_project_issues_indexs_in_issue.rb b/db/migrate/20150227085333_add_data_to_project_issues_indexs_in_issue.rb index a5e227808..d69450625 100644 --- a/db/migrate/20150227085333_add_data_to_project_issues_indexs_in_issue.rb +++ b/db/migrate/20150227085333_add_data_to_project_issues_indexs_in_issue.rb @@ -1,9 +1,11 @@ class AddDataToProjectIssuesIndexsInIssue < ActiveRecord::Migration def change - for i in 1 ... 1000 do i - Issue.page(i).per(10).each do |e| - index = e.project.issues.index(e).to_i + 1 - execute("update issues set project_issues_index = #{index} where id = #{e.id}") + transaction do + for i in 1 ... 1000 do i + Issue.page(i).per(10).each do |e| + index = e.project.issues.index(e).to_i + 1 + execute("update issues set project_issues_index = #{index} where id = #{e.id}") + end end end end diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 4345f8c31..9e9bc9859 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -480,7 +480,7 @@ function observeAutocompleteField(fieldId, url, options) { $('#'+fieldId).autocomplete($.extend({ source: url, select: function(e,ui){self.location="/issues/"+ui.item.value;}, - minLength: 2, + minLength: 1, search: function(){$('#'+fieldId).addClass('ajax-loading');}, response: function(){$('#'+fieldId).removeClass('ajax-loading'); } @@ -850,3 +850,13 @@ function HS_setDate(inputObj){ function redo() { window.location.reload() } + + +//// 作业附件删除 +$(function(){ + $('.attachments a.delete-homework-icon').bind('ajax:complete', //this will work + function(event, data, status, xhr) { //note parametes + $(this).parent('p').remove(); + console.log("delete complete."); + }); +});