Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
caishi 2018-02-09 16:37:00 +08:00
commit b9a7b47ca4
2 changed files with 17 additions and 14 deletions

View File

@ -88,14 +88,15 @@ class StatisticsController < ApplicationController
respond_to do |format|
if @statistic.update_attributes(params[:statistic])
# @statistic.save_attachments_containers(params[:attachments], User.current, true)
params[:attachments].each_value do |attachment|
temp_attachment = Attachment.where(:id => attachment['attachment_id']).first
if temp_attachment.present? && temp_attachment.container_id.blank?
temp_attachment.update_attributes(:container_id => @statistic.id, :container_type => "Statistic")
if params[:attachments].present?
params[:attachments].each_value do |attachment|
temp_attachment = Attachment.where(:id => attachment['attachment_id']).first
if temp_attachment.present? && temp_attachment.container_id.blank?
temp_attachment.update_attributes(:container_id => @statistic.id, :container_type => "Statistic")
end
end
end
# @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
format.html { redirect_to @statistic, notice: '更新成功' }
format.json { head :no_content }
else

View File

@ -1,12 +1,14 @@
<% if @sub_categories.blank? %>
$("#statistic_sub_category_id").hide();
$('#statistic_sub_category_id option:selected').val('');
<% elsif params[:come_from] == "statistics_index" %>
<% if params[:come_from] == "statistics_index" %>
$("#sub_categories_list").html('<%= j(render :partial => "sub_categories_list") %>');
<% else %>
<% if @sub_categories.present? %>
$("#sub_category").show();
<% if @sub_categories.blank? %>
$("#statistic_sub_category_id").hide();
$('#statistic_sub_category_id option:selected').val('');
<% else %>
<% if @sub_categories.present? %>
$("#sub_category").show();
<% end %>
$("#statistic_sub_category_id").show();
$("#statistic_sub_category_id").html('<%= escape_javascript( render :partial => 'statistics/sub_category') %>');
<% end %>
$("#statistic_sub_category_id").show();
$("#statistic_sub_category_id").html('<%= escape_javascript( render :partial => 'statistics/sub_category') %>');
<% end %>