组织banner上传功能
This commit is contained in:
parent
b94c483d21
commit
2162d7d4b8
|
@ -660,8 +660,10 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
|
||||
def has_login
|
||||
unless @attachment && @attachment.container_type == "PhoneAppVersion"
|
||||
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
|
||||
unless @attachment.container_type == "Organization"
|
||||
unless @attachment && @attachment.container_type == "PhoneAppVersion"
|
||||
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2104,6 +2104,8 @@ module ApplicationHelper
|
|||
attachment.container.board.course
|
||||
course = attachment.container.board.course
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif attachment.container.class.to_s=="Organization"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="HomeworkAttach"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="StudentWorksScore"
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
|
||||
<div class="upload_con">
|
||||
<h2 style="text-align: center">更换背景图片</h2>
|
||||
<div class="upload_box">
|
||||
<%= 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 %>
|
||||
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
|
||||
<%= render :partial => 'files/org_upload_attachment_list', :locals => {:container => org}%>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_org_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function submit_resource()
|
||||
{
|
||||
$('#submit_org_resource').parent().submit();
|
||||
}
|
||||
</script>
|
|
@ -71,6 +71,16 @@
|
|||
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function orge_new_files_banner_upload()
|
||||
{
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_org_new_files_banner',:locals => {:org => @organization, :org_attachment_type => 1}) %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
</script>
|
||||
<body onload="prettyPrint();">
|
||||
<div class="cl"></div>
|
||||
|
@ -97,7 +107,6 @@
|
|||
</a>
|
||||
<% end %>
|
||||
|
||||
|
||||
<%# 登录 %>
|
||||
<%= render :partial => 'organizations/org_logined_header' %>
|
||||
</div>
|
||||
|
@ -131,7 +140,30 @@
|
|||
</div><!--nav end-->
|
||||
|
||||
<div class="banner">
|
||||
<h2><%= @organization.name %></h2>
|
||||
<div class="banner-inner">
|
||||
<% if User.current.admin_of_org?(@organization) %>
|
||||
<a href="javascript:void(0);" onclick="orge_new_files_banner_upload();">
|
||||
<!--"/files/uploads/image#{iamge_path}"-->
|
||||
<% if @org_banner_attchment.blank? %>
|
||||
<img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
|
||||
<% else %>
|
||||
<img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
|
||||
<% end %>
|
||||
</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" onclick="orge_new_files_banner_upload();">
|
||||
<!--"/files/uploads/image#{iamge_path}"-->
|
||||
<% if @org_banner_attchment.blank? %>
|
||||
<img class="banner-img" src="/images/org_new_style/banner.jpg" alt=""/>
|
||||
<% else %>
|
||||
<img src="/attachments/<%= @org_banner_attchment.id %>/<%= @org_banner_attchment.filename %>" class="banner-img">
|
||||
<% end %>
|
||||
</a>
|
||||
<% end %>
|
||||
<div class="banner-txt">
|
||||
<h1><%= @organization.name %></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -140,6 +140,7 @@ module Redmine
|
|||
if file && file.size > 0
|
||||
a = Attachment.create(:file => file, :author => author)
|
||||
elsif token
|
||||
# 通过token值找到对应的attachment
|
||||
a = Attachment.find_by_token_only(token)
|
||||
if a
|
||||
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
||||
|
|
|
@ -40,8 +40,13 @@ a:hover.search-icon{ background:url(../images/org_new_style/icons.png) -387px -8
|
|||
.searchbox:hover{ background:#999999; color:#fff;}
|
||||
|
||||
/* banner */
|
||||
.banner{ width:100%; height:234px; background:#070317 url(../images/org_new_style/banner.jpg) 0 0 no-repeat; color:#fff; text-align:center; padding-top:70px; line-height:2.4;}
|
||||
.banner h2{ font-size:42px; }
|
||||
.banner{ width:100%; height:304px; background:#070317; color:#fff; text-align:center; line-height:2.4;}
|
||||
.banner-inner{ width:1500px; margin:0 auto; position:relative; text-align:center;}
|
||||
.banner-img{ height:304px;}
|
||||
.banner-txt{position:absolute; top:30%; left:0%; width:1500px; margin:0 auto;}
|
||||
.banner h1{ font-size:42px;}
|
||||
.banner a{font-size:28px; color:#fff;}
|
||||
.banner a:hover{ text-decoration:underline;}
|
||||
.banner p{ font-size:18px;}
|
||||
.banner span{ font-size:16px;}
|
||||
|
||||
|
@ -274,3 +279,5 @@ div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display:
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue