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

228 lines
8.6 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" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
//验证作品名称
function regexName()
{
var name = $.trim($("#softapplication_name").val());
if(name.length == 0)
{
$("#spane_name_notice").text("<%= l(:label_no_softapplication_name) %>");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
else if(name.length <= 25)
{
$("#spane_name_notice").text("<%= l(:label_field_correct) %>");
$("#spane_name_notice").css('color','#008000');
return true;
}
else
{
$("#spane_name_notice").text("<%= l(:label_work_name_condition) %>");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
}
// added by longjun
//验证作品简介
function regexDescription()
{
var name = $.trim($("#softapplication_description").val());
if(name.length ==0)
{
$("#span_sofapplication_description").text("<%= l(:label_no_softapplication_description) %>");
$("#span_sofapplication_description").css('color','#ff0000');
$("#span_sofapplication_description").focus();
return false;
}
else if(name.length <= 500)
{
$("#span_sofapplication_description").text("<%= l(:label_field_correct) %>");
$("#span_sofapplication_description").css('color','#008000');
return true;
}
else
{
$("#span_sofapplication_description").text("<%= l(:label_work_description_condition) %>");
$("#span_sofapplication_description").css('color','#ff0000');
$("#span_sofapplication_description").focus();
return false;
}
}
//验证运行平台
function regexWorkdescription()
{
var workDescription = $.trim($("#softapplication_android_min_version_available").val());
if(workDescription.length ==0)
{
$("#spane_workdescription_notice").text("<%= l(:label_no_softapplication_platform) %>");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#spane_workdescription_notice").text("<%= l(:label_field_correct) %>");
$("#spane_workdescription_notice").css('color','#008000');
return true;
}
else
{
$("#spane_workdescription_notice").text("<%= l(:label_work_platform_condition) %>");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
}
//验证开发人员
function regexDevelopers()
{
var workDescription = $.trim($("#softapplication_application_developers").val());
if(workDescription.length ==0)
{
$("#span_softapplication_application_developers").text("<%= l(:label_no_softapplication_developers) %>");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#span_softapplication_application_developers").text("<%= l(:label_field_correct) %>");
$("#span_softapplication_application_developers").css('color','#008000');
return true;
}
else
{
$("#span_softapplication_application_developers").text("<%= l(:label_softapplication_developers_condition) %>");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
}
//提交验证
function submit_new_softapplication()
{
if(regexName() && regexDescription() && 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>:
<%= f.text_field :name,
:required => true,
:size => 60,
:style => "width:320px;",
:onkeyup => "regexName();"
%>
<span style="font-size: 10px;" id="spane_name_notice">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px; padding-bottom: 30px;">
<span style="margin-top: 5px; float: left; display: block;"><%= l(:label_work_description) %>&nbsp;</span>
<span style="margin-top: 5px;float: left; display: block;" class="contest-star"> * </span>
<span style="margin-top: 5px; float: left; display: block;"> &nbsp;:&nbsp;</span>
<!-- modified by longjun 将单行输入框改成多行-->
<%= f.text_area :description,
:required => true,
:size => 60,
:rows => 3,
:onkeyup => 'regexDescription();',
:style => "width:320px; "
%>
<span style="font-size: 10px;" id="span_sofapplication_description">(<%= l(:label_work_description_lengthlimit) %>)</span>
<!--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>:
<%= f.text_field :application_developers,
:required => true,
:size => 60,
:style => "width:320px;",
:onkeyup => 'regexDevelopers();'
%>
<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>
<!-- modified by longjun -->
<%= link_to l(:label_create_new_projects),
new_project_path(:course => 0, :project_type => 0, :host => Setting.project_domain),
:target => '_blank'
%>
<!-- end longjun -->
</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;line-height:normal;">
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 %>