Signed-off-by: alan <547533434@qq.com>

This commit is contained in:
alan 2014-10-28 22:34:51 +08:00
parent 78af80394a
commit dde40ed3b3
6 changed files with 283 additions and 268 deletions

View File

@ -84,7 +84,7 @@ class FilesController < ApplicationController
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder(sort).all
getattachtype
show_attachments @containers
render :layout => !request.xhr?
@ -122,6 +122,7 @@ class FilesController < ApplicationController
end
end
end
getattachtype
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
@ -275,8 +276,7 @@ class FilesController < ApplicationController
respond_to do |format|
format.js
format.html
end
end
end

View File

@ -2,11 +2,11 @@
<% attachmenttypes = @course.attachmenttypes %>
<% sufixtypes = @course.contenttypes %>
<span class="borad-title">
<%= l(:label_coursefile_sharingarea) %>
</span>
<span class="borad-title"><%= t(:label_user_course) %>资源共享区</span>
<div class="content-title-top">
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @course) %>
<div class="clearfix"></div>
<div id="file_buttons" class="nhidden">
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %>
@ -55,7 +55,7 @@
<% if sufixtypes.any? %>
&nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label>
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') + options_for_select(sufixtypes),
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
<% end %>
</div>
@ -69,4 +69,5 @@
<div id="all_browse_div" class="all_browse_div">
<%= render :partial => 'course_show_all_attachment' %>
</div>
<% html_title(l(:label_course_file)) -%>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -72,4 +72,4 @@
<%= render :partial => 'show_all_attachment' %>
</div>
<% html_title(l(:project_module_files)) -%>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -0,0 +1,13 @@
<% if @attachtype==0 && @contenttype=='0' %>
<% if @project%>
<%= render partial: "show_all_attachment"%>
<% elsif @course%>
<%= render partial: "course_show_all_attachment"%>
<%end%>
<%else%>
<% if @project%>
<%= render partial: "sort_by_attachtypel"%>
<% elsif @course%>
<%= render partial: "course_sort_by_attachtypel"%>
<%end%>;
<%end%>

View File

@ -1,13 +1,13 @@
<% if @attachtype==0 && @contenttype=='0' %>
<% if @project%>
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
<% elsif @course%>
$("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
<%end%>
<%else%>
<% if @project%>
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>')
<% elsif @course%>
$("#all_browse_div").html('<%= j(render partial: "course_sort_by_attachtypel")%>')
<%end%>;
<% if @project%>
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
<% elsif @course%>
$("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
<%end%>
<%else%>
<% if @project%>
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>')
<% elsif @course%>
$("#all_browse_div").html('<%= j(render partial: "course_sort_by_attachtypel")%>')
<%end%>;
<%end%>

View File

@ -54,7 +54,7 @@
if (textStatus == 'success') {
eval(xhr.responseText);
} else if (textStatus == 'error') {
// alert('error');
alert('error');
}
}
@ -105,7 +105,7 @@
}
function course_attachmenttypes_searchex(value) {
<% if @course %>
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
@ -120,15 +120,16 @@
function course_attachment_contenttypes_searchex(value) {
<% if @course%>
$.ajax({
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
$.ajax({
}).complete(eval_ajax);
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
type: "POST",
data: {
type: $('#attachment_browse').val(),
contentType: encodeURIComponent(value)
}
}).complete(eval_ajax);
<%end%>
}
function course_attachtype_edit(value) {