socialforge/app/views/projects/search.html.erb

134 lines
5.7 KiB
Plaintext

<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
<% end %>
<div class="top-content">
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
<% if params[:project_type] == "1" %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_course_practice) %></td>
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2" valign="bottom">
<% if User.current.logged?%>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
<% end %>
<% end %>
</td>
<td rowspan="2" >
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host() + "/projects", :controller => 'projects', :action => 'course', :project_type => 1 %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course', :project_type => 1 %></td>
</tr>
</table>
<% else %>
<table width="940px">
<tr>
<td class="info_font" style="width: 220px; color: #15bccf">
<%= l(:label_project_deposit) %>
</td>
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2" valign="bottom">
<% if User.current.logged? %>
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
<% end %>
</td>
<td rowspan="2" >
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#project_search_form").submit();}
}
</script>
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span" style="float: left"></span>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px">
<a>
<%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %>
</a>
</td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %>
</td>
</tr>
</table>
<% end %>
<% end %>
</div>
<% if @projects.size == 0 %>
<%= render :partial => 'layouts/no_content'%>
<% else %>
<div id="projects-index">
<%= render_project_hierarchy(@projects)%>
</div>
<% end %>
<%= paginate @project_pages %>
<% if User.current.logged? %>
<p style="text-align:right;">
<span class="my-project"><%= l(:label_my_projects) %></span>
</p>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %>
<% content_for :sidebar do %>
<%= form_tag({}, :method => :get) do %>
<h3><%= l(:label_project_plural) %></h3>
<label for="closed"><%= check_box_tag 'closed', 1, params[:closed] %> <%= l(:label_show_closed_projects) %></label>
<p>
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
</p>
<% end %>
<% end %>
<% html_title(l(:label_project_plural)) -%>