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,12 +145,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 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/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 0119f53c2..383b53288 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -13,7 +13,7 @@ }
-

<%= l(:label_invite_join)%>

+

邀请加入

@@ -21,18 +21,21 @@
-

<%= l(:label_invite_new_user)%>

+

发送邮件邀请新用户

- <%= l(:label_invite_email_tips)%> + 输入好友邮箱地址,Trustie会自动为该邮箱注册用户!

<%= 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', l(:label_email), :class => "fb_item fl" %>

-
-
- <%= submit_tag l(:label_send_email_free), :onclick => "verifyAddress(this);" , :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: 请输入邮箱地址 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."); + }); +}); 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;}