Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
caf2b5be9b
|
@ -348,6 +348,7 @@ class AttachmentsController < ApplicationController
|
|||
@is_history_delete = true
|
||||
@is_history_destroy = false
|
||||
@attachment_histories = @attachment.attachment_histories
|
||||
@attachment_histories_count = @attachment_histories.count
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
|
@ -667,6 +668,7 @@ class AttachmentsController < ApplicationController
|
|||
def attachment_versions_delete
|
||||
@attachment = Attachment.find(params[:id])
|
||||
@attachment_histories = @attachment.attachment_histories
|
||||
@attachment_histories_count = @attachment_histories.count
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="muban_popup_top">
|
||||
<h3 class="fl">删除资源</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="hideModal();"></a>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="attachment_fresh_for_destroy();"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con" >
|
||||
|
@ -9,3 +9,10 @@
|
|||
<%= render :partial => "files/attachment_history_popub_delete" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function attachment_fresh_for_destroy(){
|
||||
hideModal();
|
||||
$(".re_search").submit();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<th><%= @attachment.downloads %></th>
|
||||
<th><%= @attachment.try(:quotes).to_i %></th>
|
||||
<th><%= format_time(@attachment.created_on) %></th>
|
||||
<th></th>
|
||||
<!--<th></th>-->
|
||||
</tr>
|
||||
<% @attachment_histories.each do |history| %>
|
||||
<tr>
|
||||
|
@ -24,14 +24,14 @@
|
|||
<th><%= history.downloads %></th>
|
||||
<th><%= history.try(:quotes).to_i %></th>
|
||||
<th><%= format_time(history.created_on) %></th>
|
||||
<th>
|
||||
<%= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"),
|
||||
:remote => true,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,
|
||||
:class => "postOptionLink",
|
||||
<!--<th>-->
|
||||
<%#= link_to( '删除资源', attachment_path(history.attachment, :history_id => history, :type => "history"),
|
||||
# :remote => true,
|
||||
# :data => {:confirm => l(:text_are_you_sure)},
|
||||
# :method => :delete,
|
||||
# :class => "postOptionLink",
|
||||
:class => "btn") if allow_to_delete_attachment(history) %>
|
||||
</th>
|
||||
<!--</th>-->
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
@ -52,8 +52,15 @@
|
|||
<div class="cl"></div>
|
||||
<textarea style="resize:none" type="text" placeholder="请在此编辑资源描述" name="description" class="mr15 mb10 muban_textarea" ><%= @attachment.description %></textarea>
|
||||
<div class="clear mb15">
|
||||
<a href="javascript:void(0);" id="upload_files_cancle_btn" class="btn fr" onclick="hideModal();">取消</a>
|
||||
<a href="javascript:void(0);" id="upload_files_cancle_btn" class="btn fr" onclick="attachment_fresh_for_destroy()">取消</a>
|
||||
<%#= submit_tag '确定', :onclick => 'upload_attachment_version(event);', :onfocus => 'this.blur()', :id => 'upload_files_submit_btn', :class => 'btn btn-blue fr mr5' %>
|
||||
<a onclick = "upload_attachment_version(event);" onfocus = 'this.blur()' id = 'upload_files_submit_btn' class = 'btn btn-blue fr mr5' >确定</a>
|
||||
<a href="javascript:void(0);" onclick = "upload_attachment_version(event);" onfocus = 'this.blur()' id = 'upload_files_submit_btn' class = 'btn btn-blue fr mr5' >确定</a>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
function attachment_fresh_for_destroy(){
|
||||
hideModal();
|
||||
$(".re_search").submit();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -39,11 +39,11 @@
|
|||
</table>
|
||||
<div>
|
||||
<% if @attachment.container_type == "Project" %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (is_project_manager?(User.current.id, @attachment.container_id) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<% elsif @attachment.container_type == "Course" %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history_delete => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.allowed_to?(:as_teacher, @attachment.container) || User.current.id == @attachment.author_id || User.current.admin?) %>
|
||||
<% elsif @attachment.container_type == "OrgSubfield" %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => l(:text_history_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
|
||||
<%= link_to( '删除所有资源', attachment_path(@attachment, :history => true), :data => {:confirm => @attachment_histories_count.to_i > 0 ? l(:text_history_are_you_sure) : l(:text_are_you_sure)}, :method => :delete,:class => "fr fontGrey2 mb5", :onclick =>"hideModal();") if (User.current.id == @attachment.author_id || User.current.admin_of_org?(@attachment) || User.current.admin?) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue