logo图标替换

This commit is contained in:
huang 2016-04-01 20:10:28 +08:00
parent 218a6b9358
commit ac1b3338c5
3 changed files with 12 additions and 37 deletions

View File

@ -629,32 +629,16 @@ class FilesController < ApplicationController
# redirect_to org_subfield_files_url(@org_subfield)
# }
end
elsif @organization
# 组织添加附件,为了修改图片
elsif params[:organization_id]
@organization = Organization.find(params[:organization_id])
@addTag=false
attachments = Attachment.attach_filesex(@organization, params[:attachments], params[:org_attachment_type])
if params[:org_attachment_type] && params[:org_attachment_type].is_a?(Array)
params[:org_attachment_type].each do |type|
tag_name = get_tag_name_by_type_number type
if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name)
attachment.save
end
end
end
# atttchment_type = 0为logo 1为banner
if params[:logo]
attachments = Attachment.attach_filesex(@organization, params[:attachments], false)
else
if params[:org_attachment_type] && params[:org_attachment_type] != "5"
tag_name = get_tag_name_by_type_number params[:org_attachment_type]
if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name)
attachment.save
end
end
end
attachments = Attachment.attach_filesex(@organization, params[:attachments], true)
end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",

View File

@ -1,11 +1,11 @@
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
<h2 style="text-align: center">更换Logo</h2>
<div class="upload_box">
<p>尺寸最好55*33</p>
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(organization_files_path(org, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<%= form_tag(organization_files_path(org, :in_org => params[:in_org], :logo => true), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
<%= render :partial => 'files/org_subfield_upload_attachment_list', :locals => {:container => org}%>
<div class="cl"></div>

View File

@ -66,18 +66,9 @@ $("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_
<% end %>
<% end %>
<% elsif @organization %> //组织单独处理
<% if params[:in_org] %>
window.location.href = '<%= organization_files_path @organization %>';
<%else %>
hideModal();
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
// var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
// $("#org_subfield_list").prepend(div);
// setTimeout( function(){div.remove();},3000);
<% end %>
<% end %>
window.location.href = '<%= organization_path @organization %>';
<% end %>
<% end %>
$(document).ready(img_thumbnails);