添加课程资源文件new视图

This commit is contained in:
nwb 2014-06-09 14:27:31 +08:00
parent 2f3d9b1795
commit 54e3fdba3f
2 changed files with 55 additions and 5 deletions

View File

@ -16,31 +16,31 @@
           
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label> <label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"), <%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
:onchange => "attachmenttypes_searchex(this.value)" %> :onchange => "course_attachmenttypes_searchex(this.value)" %>
<% end %> <% end %>
<% if sufixtypes.any? %> <% if sufixtypes.any? %>
&nbsp; &nbsp;
<label for="attach_sufix_browse_label"><%= l(:attachment_sufix_browse) %></label> <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 => "attachment_contenttypes_searchex(this.value)" %> :onchange => "course_attachment_contenttypes_searchex(this.value)" %>
<% end %> <% end %>
<div id="upload_file_div" class="relation_file_div hidden"> <div id="upload_file_div" class="relation_file_div hidden">
<%= render :partial => 'new', locals: {course: @course} %> <%= render :partial => 'course_new', locals: {course: @course} %>
</div> </div>
<div id="relation_file_div" class="relation_file_div hidden"> <div id="relation_file_div" class="relation_file_div hidden">
<fieldset> <fieldset>
<legend>搜索</legend> <legend>搜索</legend>
<%= form_tag( <%= form_tag(
attachments_autocomplete_path(:format => 'js'), course_attachments_autocomplete_path(:format => 'js'),
:remote => true, :remote => true,
:method => :post) do %> :method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %> <%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %> <%= text_field_tag(:attach_search) %>
<%#= submit_tag("Search") %> <%#= submit_tag("Search") %>
<% end -%> <% end -%>
<%= form_tag attach_relation_path(:format => 'js'), <%= form_tag course_attach_relation_path(:format => 'js'),
method: :post, method: :post,
remote: true, remote: true,
id: "relation_file_form", id: "relation_file_form",

View File

@ -0,0 +1,50 @@
<h3><%=l(:label_attachment_new)%></h3>
<% attachmenttypes = course.attachmenttypes %>
<%= error_messages_for 'attachment' %>
<%= form_tag(course_files_path(course), :multipart => true,:remote => false,:method => :post,:name=>"upload_form", :class => "tabular") do %>
<div class="box">
<p>
<table>
<tr>
<% if attachmenttypes.any? %>
<td><%= l(:attachment_type) %></label></td>
<td>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
</td>
<% end %>
</tr>
</table>
</p>
<p><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</div>
<%= submit_tag l(:button_add) %>
<% end %>
<div class="line_under" style="margin:20px 0px;"></div>
<script type='text/javascript'>
function tagAddClick(id,objId,objTag)
{
alert("OK");
$.ajax({
type :"POST",
url :'<%= users_tag_saveEx_path%>',
data: {
tagname: $('tag_name').value,
obj_id: encodeURIComponent(objId),
obj_flag:encodeURIComponent(objTag)
},
success: function(data, textStatus){
alert("OK");
$(id).empty();
$(id).html('123');
$("#" + id + " #name").val("");
}
})
}
</script>