Conflicts:
	app/views/projects/invite_members_by_mail.html.erb
This commit is contained in:
whimlex 2015-03-12 17:50:15 +08:00
commit 18422ecf6a
12 changed files with 50 additions and 26 deletions

10
Gemfile
View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= 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;") %>

View File

@ -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),

View File

@ -13,7 +13,7 @@
}
</script>
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_invite_join)%></h2>
<h2 class="project_h2">邀请加入</h2>
</div>
<div class="floatbox" style="margin:130px;">
<div >
@ -21,18 +21,21 @@
</div>
<div class="cl"></div>
<div class="box_main">
<h3 class="box_h3"><%= l(:label_invite_new_user)%></h3>
<h3 class="box_h3">发送邮件邀请新用户</h3>
<p class="box_p">
<%= l(:label_invite_email_tips)%>
输入好友邮箱地址Trustie会自动为该邮箱注册用户
</p>
<div id="is_registed">
<%= render :partial => 'regested', locals: { :isregisted => false} %>
</div>
<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get',:remote=>true) do %>
<p><span id="valid_email"></span></span><%= text_field_tag 'mail', l(:label_email), :class => "fb_item fl" %></p>
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email) %>
<div class="cl"></div>
<div class="cl"></div>
<%= 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;" %>
<a href="#" class="btn_free" onclick="$(this).parent().submit();">
<%= l(:label_send_email)%>
</a>
<%#= submit_tag '免费发送', :style => "display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;" %>
<% end %>
</div>
</div>

View File

@ -2082,4 +2082,6 @@ zh:
label_recently_updated_courseware: 最近更新了课件
label_no_courses: 您没有参与任何课程,请搜索课程、加入课程,或者创建课程吧!
label_end_time: 截止时间
label_send_email: 免费发送
label_input_email: 请输入邮箱地址

View File

@ -1,5 +1,6 @@
class AddDataToProjectIssuesIndexsInIssue < ActiveRecord::Migration
def change
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
@ -8,3 +9,4 @@ class AddDataToProjectIssuesIndexsInIssue < ActiveRecord::Migration
end
end
end
end

View File

@ -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.");
});
});

View File

@ -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;}