Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
27feeee03f
|
@ -217,6 +217,17 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#删除竞赛作品的附件
|
||||
def delete_softapplications
|
||||
@attachment = Attachment.find params[:id]
|
||||
@softapplication = @attachment.container if @attachment!=nil
|
||||
@attachment.container.attachments.delete(@attachment) if @attachment!=nil
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or edit_softapplication_path(@softapplication) }
|
||||
#format.js
|
||||
end
|
||||
end
|
||||
|
||||
def autocomplete
|
||||
# modify by nwb
|
||||
if params[:project_id]
|
||||
|
|
|
@ -172,8 +172,8 @@ class SoftapplicationsController < ApplicationController
|
|||
# PUT /softapplications/1.json
|
||||
def update
|
||||
# @softapplication = Softapplication.find(params[:id])
|
||||
@softapplication.attachments.map{|attach| attach.destroy }
|
||||
@softapplication.save_attachments(params[:attachments])
|
||||
#@softapplication.attachments.map{|attach| attach.destroy }
|
||||
@softapplication.save_attachments(params[:attachments]) if params[:attachments]
|
||||
#@softapplication.deposit_project = params[:project]
|
||||
@softapplication.project = Project.find_by_id(params[:project])
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
class IssueOverdue < ActiveRecord::Base
|
||||
#缺陷到期后发送邮件提示
|
||||
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
|
||||
def self.mail_issue
|
||||
threads = []
|
||||
issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null")
|
||||
puts issues
|
||||
issues.each do |issue|
|
||||
thread = Thread.new do
|
||||
while true
|
||||
cur_issue = Issue.find issue.id
|
||||
if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
|
||||
break
|
||||
end
|
||||
if Time.now < Time.parse(cur_issue.due_date.to_s)
|
||||
#休眠一个小时。。。
|
||||
puts cur_issue.id.to_s
|
||||
sleep 5
|
||||
else
|
||||
#发邮件
|
||||
puts "11" + issue.id.to_s
|
||||
#Mailer.issue_expire(issue).deliver
|
||||
Mailer.issue_add(issue).deliver
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
threads << thread
|
||||
end
|
||||
puts threads
|
||||
return threads
|
||||
end
|
||||
end
|
|
@ -104,7 +104,7 @@ class Mailer < ActionMailer::Base
|
|||
message_id issue
|
||||
@author = issue.author
|
||||
@issue = issue
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
recipients = issue.recipients
|
||||
cc = issue.watcher_recipients - recipients
|
||||
mail :to => recipients,
|
||||
|
@ -175,7 +175,7 @@ class Mailer < ActionMailer::Base
|
|||
message_id issue
|
||||
@author = issue.author
|
||||
@issue = issue
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
recipients = issue.recipients
|
||||
s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||
mail :to => recipients,
|
||||
|
@ -582,34 +582,7 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
|
||||
#缺陷到期后发送邮件提示
|
||||
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
|
||||
def mail_issue
|
||||
threads = []
|
||||
issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null and due_date > '#{Time.now.to_date}'")
|
||||
issues.each do |issue|
|
||||
thread = Thread.start do
|
||||
while true
|
||||
cur_issue = Issue.find issue.id
|
||||
if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
|
||||
break
|
||||
end
|
||||
if Time.now < Time.parse(cur_issue.due_date.to_s)
|
||||
#休眠一个小时。。。
|
||||
sleep 3600
|
||||
else
|
||||
#发邮件
|
||||
#puts issue.id.to_s
|
||||
Mailer.issue_expire(issue).deliver
|
||||
#Mailer.issue_add(issue).deliver
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
threads << thread
|
||||
end
|
||||
threads
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@ class Softapplication < ActiveRecord::Base
|
|||
belongs_to :project
|
||||
has_many :contests, :through => :contesting_softapplications
|
||||
|
||||
validates_length_of :name, :maximum => 125
|
||||
validates_length_of :application_developers, :maximum => 125
|
||||
validates_length_of :android_min_version_available, :maximum => 125
|
||||
|
||||
def add_jour(user, notes, reference_user_id = 0, options = {})
|
||||
if options.count == 0
|
||||
self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<div class="attachments">
|
||||
<% for attachment in attachments %>
|
||||
<p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
||||
<p style="width: 100%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<span title="<%= attachment.filename%>">
|
||||
<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
|
||||
</span>
|
||||
<% if attachment.is_text? %>
|
||||
<%= link_to image_tag('magnifier.png'),
|
||||
:controller => 'attachments', :action => 'show',
|
||||
|
@ -15,11 +18,20 @@
|
|||
:method => :delete,
|
||||
:class => 'delete',
|
||||
:title => l(:button_delete) %>
|
||||
<%# elsif attachment.container_type == 'Softapplication'%>
|
||||
<%#= link_to image_tag('delete.png'), delete_softapplications_attachments_path(:id => attachment.id),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,
|
||||
:class => 'delete',
|
||||
:remote => true,
|
||||
:title => l(:button_delete) %>
|
||||
<% else %>
|
||||
<%= link_to image_tag('delete.png'), attachment_path(attachment),
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,
|
||||
:class => 'delete',
|
||||
:remote => true,
|
||||
#:id => "attachments_" + attachment.id.to_s,
|
||||
:title => l(:button_delete) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<% options = {:author => true, :deletable => true} %>
|
||||
$("#soft_attachments_links").html('<%= escape_javascript(render(:partial => 'links', :locals => {:attachments => @softapplication.attachments, :options => options} )) %>');
|
|
@ -6,7 +6,7 @@
|
|||
<span><%= l(:label_work_name) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
<!--span style="font-size: 10px">(<%#= l(:label_workname_lengthlimit) %>)</span-->
|
||||
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
|
@ -15,8 +15,10 @@
|
|||
<tr style="width:800px;">
|
||||
<span><%= l(:label_running_platform) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
|
||||
<td style="width: 100px">
|
||||
<%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %>
|
||||
</td>
|
||||
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
|
@ -55,7 +57,7 @@
|
|||
<span><%= l(:label_softapplication_developers) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
|
||||
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<tr style="width:700px; margin-left: -10px">
|
||||
<span><%= l(:label_work_name) %></span>
|
||||
<span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||
<span><%= l(:label_softapplication_name_condition)%></span>
|
||||
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span>
|
||||
</tr><br/>
|
||||
<br />
|
||||
<br />
|
||||
|
@ -40,7 +40,7 @@
|
|||
<tr style="width:800px;">
|
||||
<span><%= l(:label_running_platform) %></span>
|
||||
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||
|
||||
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br />
|
||||
|
@ -73,7 +73,7 @@
|
|||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_description) %></span>
|
||||
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||
<span><%= l(:label_softapplication_description_condition)%></span>
|
||||
<!--<span><%#= l(:label_softapplication_description_condition)%></span>-->
|
||||
</tr>
|
||||
<br/>
|
||||
<br />
|
||||
|
@ -82,7 +82,7 @@
|
|||
<tr style="width:800px;">
|
||||
<span><%= l(:label_softapplication_developers) %></span>
|
||||
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
|
||||
|
||||
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br />
|
||||
|
@ -100,10 +100,17 @@
|
|||
|
||||
|
||||
<fieldset style="width: 500px">
|
||||
<p style="padding-left: 60px">
|
||||
<% options = {:author => true, :deletable => true} %>
|
||||
<span id="soft_attachments_links">
|
||||
<%= render :partial => 'attachments/links',
|
||||
:locals => {:attachments => @softapplication.attachments, :options => options} %>
|
||||
</span>
|
||||
</p>
|
||||
<legend><%=l(:label_upload_softworkpacket_photo)%></legend>
|
||||
<%= render_flash_messages %>
|
||||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
<p style="font-size: 10px">1、<%=l(:label_upload_softapplication_packets_mustpacketed)%><br>2、<%=l(:label_upload_softapplication_photo_condition)%></p>
|
||||
<p style="font-size: 10px; color: red"><%=l(:label_updated_caution)%></p>
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
Mailer.mail_issue.each do |t|
|
||||
t.join
|
||||
end
|
||||
#@threads = IssueOverdue.mail_issue
|
||||
#ii = 1
|
||||
#@threads.each do |t|
|
||||
# t.join
|
||||
#end
|
||||
|
||||
#Thread.new do
|
||||
# if Time.now == Time.
|
||||
#
|
||||
# end
|
||||
#end
|
||||
|
||||
|
|
|
@ -520,6 +520,7 @@ RedmineApp::Application.routes.draw do
|
|||
match "updateType" , via: [:get, :post]
|
||||
match "updateFileDense" , via: [:get, :post]
|
||||
match "renderTag" , via: [:get, :post]
|
||||
match 'delete_softapplications', via: [:get, :post]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class UpdateContestnotificationsDescription < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :contestnotifications, :description, :text
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :contestnotifications, :description, :string
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue