竞赛搜索项为空时给出提示

This commit is contained in:
nwb 2014-07-07 14:31:21 +08:00
parent bc179fbc39
commit b4ee106ce9
3 changed files with 14 additions and 5 deletions

View File

@ -28,6 +28,9 @@ class ContestsController < ApplicationController
@offset, @limit = api_offset_and_limit({:limit => 10}) @offset, @limit = api_offset_and_limit({:limit => 10})
@contests = Contest.visible @contests = Contest.visible
@contests = @contests.like(params[:name]) if params[:name].present? @contests = @contests.like(params[:name]) if params[:name].present?
if params[:contests_search]
(redirect_to contests_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
end
@contest_count = @contests.count @contest_count = @contests.count
@contest_pages = Paginator.new @contest_count, @limit, params['page'] @contest_pages = Paginator.new @contest_count, @limit, params['page']

View File

@ -15,7 +15,7 @@
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %> <%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -3,9 +3,15 @@
<div class="box ph10_5"> <div class="box ph10_5">
<!--[form:message]--> <!--[form:message]-->
<% unless replying %>
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br/> <p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br/>
<%= f.text_field :subject,:size => 60, :style => "width: 99%;", :id => "message_subject",:readonly=>true %><!--by young--> <%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject" %><!--by young-->
</p> </p>
<% else %>
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> *&nbsp;&nbsp;</span></label><br/>
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
</p>
<% end %>
<p> <p>
<% unless replying %> <% unless replying %>
<% if @message.safe_attribute? 'sticky' %> <% if @message.safe_attribute? 'sticky' %>