From c893a2d99b861afa3b51d298c70d56b03be921e9 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 9 Mar 2015 16:25:41 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E5=8E=9F=E6=9D=A5=E9=9C=80=E8=A6=811800=E7=A7=92?= =?UTF-8?q?=EF=BC=8C=E7=8E=B0=E5=8F=AA=E9=9C=80800=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...85333_add_data_to_project_issues_indexs_in_issue.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 From 5d1a5a0b11c76472d857e6ab2aaccb7d5ea4fe9f Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 10 Mar 2015 11:50:27 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=20#1738=20=E4=BF=AE=E5=A4=8D=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=B8=8B=E8=BD=BD=E6=AC=A1=E6=95=B0=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 10 ++++++---- app/controllers/attachments_controller.rb | 4 +--- 2 files changed, 7 insertions(+), 7 deletions(-) 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 252d823e9..ccc879c1c 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 From 31351bc9e8782db7b01404570952873d12b9def7 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 10 Mar 2015 15:39:14 +0800 Subject: [PATCH 3/8] =?UTF-8?q?#1095=20=E5=9C=A8issue=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E8=BE=931=E4=B8=AA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=BF=9B=E8=A1=8C=E6=90=9C=E7=B4=A2=EF=BC=8C?= =?UTF-8?q?500=E9=94=99=E8=AF=AF=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/project.rb | 2 +- public/javascripts/application.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 099870bc7..ec193cdfe 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/public/javascripts/application.js b/public/javascripts/application.js index 4345f8c31..2ca1a048b 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'); } From fd676f13b59961b8a762de07790fee26ca968e8b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 10 Mar 2015 21:50:47 +0800 Subject: [PATCH 4/8] =?UTF-8?q?#994=20=20=E4=BD=9C=E5=93=81=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=EF=BC=9A=E8=B5=84=E6=BA=90=E6=8E=92=E5=BA=8F=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 474f199a2..7638949ba 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -143,12 +143,17 @@ 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 + + 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 format.js From e5e46819b427c4caac6501cb836335801962076c Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 10 Mar 2015 22:35:36 +0800 Subject: [PATCH 5/8] =?UTF-8?q?#867=20=E6=96=B0=E5=BB=BA=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=EF=BC=9A=E6=A0=A1=E9=AA=8C=E5=A4=B1=E8=B4=A5=E4=B9=9F=E8=A6=81?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;") %> From 38c3b40ca1e6389dbc4118a5926b0e529938ac6a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 11 Mar 2015 10:52:09 +0800 Subject: [PATCH 6/8] =?UTF-8?q?#1701=20=E4=BF=AE=E5=A4=8D=E5=9C=A8?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BD=9C=E4=B8=9A=E6=97=B6=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=BC=9A=E5=AF=BC=E8=87=B4=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=86=85=E5=AE=B9=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_links.html.erb | 3 ++- public/javascripts/application.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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/public/javascripts/application.js b/public/javascripts/application.js index 2ca1a048b..9e9bc9859 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -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."); + }); +}); From 362bad594f54e270e1644e0eb5f360f449c4c12c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 12 Mar 2015 17:18:18 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=82=AE=E4=BB=B6=E9=82=80=E8=AF=B7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F=EF=BC=8C=E4=BB=A5=E5=8F=8A=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/invite_members_by_mail.html.erb | 11 +++++++---- config/locales/zh.yml | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index e0ba05f18..f1cae8b21 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -24,10 +24,13 @@ <%= 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" %> -
-
- <%= submit_tag '免费发送', :style => "display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;" %> + <%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email) %> +
+
+ + <%= l(:label_send_email)%> + + <%#= submit_tag '免费发送', :style => "display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;" %> <% end %> \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 94e8cf31e..8858b0a38 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2082,4 +2082,6 @@ zh: label_recently_updated_courseware: 最近更新了课件 label_no_courses: 您没有参与任何课程,请搜索课程、加入课程,或者创建课程吧! label_end_time: 截止时间 + label_send_email: 免费发送 + label_input_email: 请输入邮箱地址 From 96b2627fda8e681c61134874b7f7d75b793f31ca Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 12 Mar 2015 17:22:52 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=B1=85=E4=B8=AD=E6=A0=B7=E5=BC=8F=E5=8F=8A=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 1 + public/stylesheets/application.css | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4f84212b4..f1f026029 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -338,6 +338,7 @@ 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) else @is_zhuce = true end diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index c24091605..e0ab6f711 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -101,7 +101,7 @@ a:hover.more{ color:#64bdd9;} .box_close:hover{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} /*邮件邀请*/ .box_main{ width:345px; margin:0 auto;padding-left:40px;} -.box_h3{ color:#15bccf; text-align:center; font-size:16px;} +.box_h3{ color:#15bccf; text-align:center; font-size:16px;margin-right:40px;} .box_p{ color:#404040; margin-bottom:5px;} .fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:10px; padding-left:5px; width:290px;} .icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;}