socialforge/app/views/files/_new.html.erb

64 lines
2.4 KiB
Plaintext

<h3><%=l(:label_attachment_new)%></h3>
<% versions = project.versions.sort %>
<% attachmenttypes = project.attachmenttypes %>
<%= error_messages_for 'attachment' %>
<%= form_tag(project_files_path(project), :multipart => true,:remote => true,:method => :post,:name=>"upload_form", :class => "tabular") do %>
<div class="box">
<p>
<table>
<tr>
<% if versions.any? %>
<td><p style="padding-left: 50px;"><%= l(:field_version) %></p></td>
<td>
<%= select_tag "version_id", content_tag('option', '') +
options_from_collection_for_select(versions, "id", "name"), {style: 'width:230px'} %>
</td>
<% 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 %>
<% else %>
<p>
<% if attachmenttypes.any? %>
<%= l(:attachment_type) %></label>
<%= select_tag "attachment_type",
options_from_collection_for_select(attachmenttypes, "id",
"typeName", 2), {style: 'width:100px'} %>
<% end %>
</p>
<% end %>
</tr>
</table>
<p style="padding-left: 54px;"> <%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form', locals: {project: project} %></p>
</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>