socialforge/app/views/contests/_new_softapplication.html.erb

184 lines
7.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%#= error_messages_for 'softapplication' %>
<script type="text/javascript">
//验证作品名称
function regexName()
{
var name = $("#softapplication_name").val();
if(name.length ==0)
{
$("#spane_name_notice").text("作品名称不能为空");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
else if(name.length <= 25)
{
$("#spane_name_notice").text("填写正确");
$("#spane_name_notice").css('color','#008000');
return true;
}
else
{
$("#spane_name_notice").text("作品名称超过25个汉字");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
}
//验证运行平台
function regexWorkdescription()
{
var workDescription = $("#softapplication_android_min_version_available").val();
if(workDescription.length ==0)
{
$("#spane_workdescription_notice").text("运行平台不能为空");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#spane_workdescription_notice").text("填写正确");
$("#spane_workdescription_notice").css('color','#008000');
return true;
}
else
{
$("#spane_workdescription_notice").text("运行平台超过125个汉字");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
}
//验证开发人员
function regexDevelopers()
{
var workDescription = $("#softapplication_application_developers").val();
if(workDescription.length ==0)
{
$("#span_softapplication_application_developers").text("开发人员不能为空");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#span_softapplication_application_developers").text("填写正确");
$("#span_softapplication_application_developers").css('color','#008000');
return true;
}
else
{
$("#span_softapplication_application_developers").text("开发人员超过125个汉字");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
}
//提交验证
function submit_new_softapplication()
{
if(regexName() && regexWorkdescription() && regexDevelopers())
{
$("#new_softapplication").submit();
}
}
</script>
<%= form_for Softapplication.new, :url => softapplications_path do |f| %>
<fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" >
<%= hidden_field_tag 'contest_id', @contest.id %>
<tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>:
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:320px;", :onblur => "regexName();" %></td>
<span style="font-size: 10px;" id="spane_name_notice">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:320px;", :onblur=>"regexWorkdescription();"%>
</td>
<span style="font-size: 10px" id="spane_workdescription_notice">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<span>
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
</span>
<%= f.select :app_type_name,work_type_opttion, {},{:style => "width:328px;",:onchange => "selectChange(this)"} %>
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
</td>
<span style="font-size: 10px;display: none" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 120px;" id="other_input" name = "other_input"/>
</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:320px;" %></td>
<!--span style="font-size: 10px">(<%#= l(:label_workdescription_lengthlimit) %>)</span-->
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:320px;", :onblur => 'regexDevelopers();' %></td>
<span style="font-size: 10px" id="span_softapplication_application_developers">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span>
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:328px;" %></span>
<span><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %></span><!-- new_project_path(course: 0, project_type: 0) -->
</tr>
<br/>
<br/>
<br/>
<fieldset style="width: 500px; padding-top: 10px">
<legend>
<%= l(:label_upload_softworkpacket_photo) %>
</legend>
<%#= render_flash_messages %>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
<p style="font-size: 11px">
1、<%= l(:label_upload_softapplication_packets_mustpacketed) %> <br/>
<br>
2、<%= l(:label_upload_softapplication_photo_condition) %>
</p>
</fieldset>
</fieldset></br>
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<input type="button" class="enterprise" value="<%=l(:button_create) %>" onclick="submit_new_softapplication();" >
<%#= submit_tag l(:button_create) %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
</div>
<% end %>