This commit is contained in:
z9hang 2014-08-16 15:08:38 +08:00
commit c77a1fc2ef
3 changed files with 109 additions and 25 deletions

View File

@ -13,16 +13,17 @@
<% end %> <% end %>
</span> </span>
<script type='text/javascript'> <script type='text/javascript'>
function CompatibleSend() // function CompatibleSend()
{ // {
var obj=document.getElementById("_file"); // var obj=document.getElementById("_file");
var file= $(obj).clone(); // var file= $(obj).clone();
file.click(); // file.click();
} // }
</script> </script>
<span class="add_attachment"> <span class="add_attachment">
<%= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%--> <!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()" %>
<%= file_field_tag 'attachments[dummy][file]', <%= file_field_tag 'attachments[dummy][file]',
:id => '_file', :id => '_file',
:class => 'file_selector', :class => 'file_selector',

View File

@ -1,12 +1,98 @@
<%#= error_messages_for 'softapplication' %> <%#= 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())
{
alert("123123123123");
$("#new_softapplication").submit();
}
}
</script>
<%= form_for Softapplication.new, :url => softapplications_path do |f| %> <%= form_for Softapplication.new, :url => softapplications_path do |f| %>
<fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" > <fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" >
<%= hidden_field_tag 'contest_id', @contest.id %> <%= hidden_field_tag 'contest_id', @contest.id %>
<tr style="width:700px; margin-left: -10px;"> <tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></span> <span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:350px;" %></td> <td><%= f.text_field :name, :required => true, :size => 60, :style => "width:320px;", :onblur => "regexName();" %></td>
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span> <span style="font-size: 10px;" id="spane_name_notice">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr> </tr>
<br/> <br/>
<br/> <br/>
@ -16,9 +102,9 @@
<span><%= l(:label_running_platform) %></span> <span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td style="width: 100px"> <td style="width: 100px">
<%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %> <%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:320px;", :onblur=>"regexWorkdescription();"%>
</td> </td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span> <span style="font-size: 10px" id="spane_workdescription_notice">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr> </tr>
<br/> <br/>
<br/> <br/>
@ -31,12 +117,12 @@
<span> <span>
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %> <%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
</span> </span>
<%= f.select :app_type_name,work_type_opttion, {},{:style => "width:358px;",:onchange => "selectChange(this)"} %> <%= 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;" %> <%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
</td> </td>
<span style="font-size: 10px;display: none" id="other_span"> <span style="font-size: 10px;display: none" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %> <%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 100px;" id="other_input" name = "other_input"/> <input type="text" style="width: 120px;" id="other_input" name = "other_input"/>
</span> </span>
</tr> </tr>
<br/> <br/>
@ -46,7 +132,7 @@
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_work_description) %></span> <span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:350px;" %></td> <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--> <!--span style="font-size: 10px">(<%#= l(:label_workdescription_lengthlimit) %>)</span-->
</tr> </tr>
<br/> <br/>
@ -56,8 +142,8 @@
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span> <span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>: <span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %></td> <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:320px;", :onblur => 'regexDevelopers();' %></td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span> <span style="font-size: 10px" id="span_softapplication_application_developers">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr> </tr>
<br/> <br/>
<br/> <br/>
@ -65,7 +151,7 @@
<tr style="width:800px;"> <tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span> <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:358px;" %></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) --> <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> </tr>
<br/> <br/>
@ -90,7 +176,8 @@
</fieldset> </fieldset>
</fieldset></br> </fieldset></br>
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px"> <div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<%= submit_tag l(:button_create) %> <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();", <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'", :type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %> :onmouseover => "this.style.backgroundPosition = 'left -30px'" %>

View File

@ -25,13 +25,9 @@
</span> </span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %> <%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %>
<div class="activity_description info-break" style="font-size: 13px;"> <div class="activity_description info-break" style="font-size: 13px;width: 100%;word-break: break-all;">
<div class="issue-list-description"> <%= textAreailizable e,:event_description %>
<div class="wiki"> <%#= h(truncate(strip_tags(e.event_description).gsub(/&nbsp;/, ' '), length: 30, omission: '...')) %>
<%#= textilizable e.event_url,:description %>
</div>
</div>
<%= h(truncate(strip_tags(e.event_description).gsub(/&nbsp;/, ' '), length: 30, omission: '...')) %>
</div> </div>
<div class="activity_status" style="position:relative; padding-top: 3px;"> <div class="activity_status" style="position:relative; padding-top: 3px;">
<span class="font_lighter"> <%= l :label_activity_time %> <span class="font_lighter"> <%= l :label_activity_time %>