merge dev_zanle branch

Signed-off-by: alan <547533434@qq.com>
memcached_alan
alan 11 years ago
parent 7710af316d
commit 3484fd34bb

@ -1,11 +1,11 @@
<%# Link to the "First" page <%# Link to the "First" page
- available local variables - available local variables
url: url to the first page url: url to the first page
current_page: a page object for the currently displayed page current_page: a page object for the currently displayed page
total_pages: total number of pages total_pages: total number of pages
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
-%> -%>
<%= link_to_unless current_page.first?, l('views.pagination.first').html_safe, url, :remote => remote %> <%= link_to_unless current_page.first?, l('views.pagination.first').html_safe, url, :remote => remote %>

@ -1,8 +1,8 @@
<%# Non-link tag that stands for skipped pages... <%# Non-link tag that stands for skipped pages...
- available local variables - available local variables
current_page: a page object for the currently displayed page current_page: a page object for the currently displayed page
total_pages: total number of pages total_pages: total number of pages
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
-%> -%>

@ -1,11 +1,11 @@
<%# Link to the "Last" page <%# Link to the "Last" page
- available local variables - available local variables
url: url to the last page url: url to the last page
current_page: a page object for the currently displayed page current_page: a page object for the currently displayed page
total_pages: total number of pages total_pages: total number of pages
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
-%> -%>
<%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %> <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %>

@ -1,11 +1,11 @@
<%# Link to the "Next" page <%# Link to the "Next" page
- available local variables - available local variables
url: url to the next page url: url to the next page
current_page: a page object for the currently displayed page current_page: a page object for the currently displayed page
total_pages: total number of pages total_pages: total number of pages
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
-%> -%>
<%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote %> <%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote %>

@ -1,13 +1,13 @@
<%# Link showing page number <%# Link showing page number
- available local variables - available local variables
page: a page object for "this" page page: a page object for "this" page
url: url to this page url: url to this page
current_page: a page object for the currently displayed page current_page: a page object for the currently displayed page
total_pages: total number of pages total_pages: total number of pages
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
<%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} <%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
-%> -%>
<%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> <%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>

@ -1,23 +1,23 @@
<%# The container tag <%# The container tag
- available local variables - available local variables
current_page: a page object for the currently displayed page current_page: a page object for the currently displayed page
total_pages: total number of pages total_pages: total number of pages
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
paginator: the paginator that renders the pagination tags inside paginator: the paginator that renders the pagination tags inside
-%> -%>
<%= paginator.render do -%> <%= paginator.render do -%>
<div class="pagination"> <div class="pagination">
<%= first_page_tag unless current_page.first? %> <%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %> <%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%> <% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%> <% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %> <%= page_tag page %>
<% elsif !page.was_truncated? -%> <% elsif !page.was_truncated? -%>
<%= gap_tag %> <%= gap_tag %>
<% end -%> <% end -%>
<% end -%> <% end -%>
<%= next_page_tag unless current_page.last? %> <%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %> <%= last_page_tag unless current_page.last? %>
</div> </div>
<% end -%> <% end -%>

@ -1,11 +1,11 @@
<%# Link to the "Previous" page <%# Link to the "Previous" page
- available local variables - available local variables
url: url to the previous page url: url to the previous page
current_page: a page object for the currently displayed page current_page: a page object for the currently displayed page
total_pages: total number of pages total_pages: total number of pages
per_page: number of items to fetch per page per_page: number of items to fetch per page
remote: data-remote remote: data-remote
-%> -%>
<%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote %> <%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote %>

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

@ -1,32 +1,32 @@
# Time 2015-01-30 17:04:12 # Time 2015-01-30 17:04:12
# Author lizanle # Author lizanle
# Description kaminari配置文件 # Description kaminari配置文件
# <%= paginate @users, :window => 2 %> # <%= paginate @users, :window => 2 %>
# 则展示页会像 5 6 7 8 9 当7是当前页的时候 # 则展示页会像 5 6 7 8 9 当7是当前页的时候
# <%= paginate @users, :outer_window => 3 %> # <%= paginate @users, :outer_window => 3 %>
# 分页展示会像 1 2 3 4 ...(snip)... 17 18 19 20 当总共有20个页面的时候 # 分页展示会像 1 2 3 4 ...(snip)... 17 18 19 20 当总共有20个页面的时候
# <%= paginate @users, :left => 1, :right => 3 %> # <%= paginate @users, :left => 1, :right => 3 %>
# 分页展示会像 1 ...(snip)... 18 19 20 当总共有20个页面的时候 # 分页展示会像 1 ...(snip)... 18 19 20 当总共有20个页面的时候
# <%= paginate @users, :param_name => :pagina %> # <%= paginate @users, :param_name => :pagina %>
# 这样子会将每个链接传进去一个参数 :pagina # 这样子会将每个链接传进去一个参数 :pagina
# <%= paginate @users, :params => {:controller => 'foo', :action => 'bar'} %> # <%= paginate @users, :params => {:controller => 'foo', :action => 'bar'} %>
# 这样子将会修改每个链接的控制器和动作. :controller and :action # 这样子将会修改每个链接的控制器和动作. :controller and :action
# <%= paginate @users, :remote => true %> # <%= paginate @users, :remote => true %>
# 这将会使每个链接使用ajax方式极其简单非常完美的工作。data-remote="true" # 这将会使每个链接使用ajax方式极其简单非常完美的工作。data-remote="true"
#更多知识详见 https://github.com/honwlee/kaminari #更多知识详见 https://github.com/honwlee/kaminari
Kaminari.configure do |config| Kaminari.configure do |config|
# config.default_per_page = 25 # config.default_per_page = 25
# config.max_per_page = nil # config.max_per_page = nil
# config.window = 4 # config.window = 4
# config.outer_window = 3 # config.outer_window = 3
# config.left = 0 # config.left = 0
# config.right = 0 # config.right = 0
# config.page_method_name = :page # config.page_method_name = :page
# config.param_name = :page # config.param_name = :page
end end

@ -1,22 +1,22 @@
# Time 2015-01-30 17:02:41 # Time 2015-01-30 17:02:41
# Author lizanle # Author lizanle
# Description 打开redmine\ruby\lib\ruby\gems\1.9.1\gems\actionpack-3.2.13\lib\action_view\helpers\UrlHelper重写link_to_unless方法 # Description 打开redmine\ruby\lib\ruby\gems\1.9.1\gems\actionpack-3.2.13\lib\action_view\helpers\UrlHelper重写link_to_unless方法
# 如果是当前页则给当前页添加样式class=>'current-page' # 如果是当前页则给当前页添加样式class=>'current-page'
module ActionView module ActionView
# = Action View URL Helpers # = Action View URL Helpers
module Helpers #:nodoc: module Helpers #:nodoc:
# Provides a set of methods for making links and getting URLs that # Provides a set of methods for making links and getting URLs that
# depend on the routing subsystem (see ActionDispatch::Routing). # depend on the routing subsystem (see ActionDispatch::Routing).
# This allows you to use the same format for links in views # This allows you to use the same format for links in views
# and controllers. # and controllers.
module UrlHelper module UrlHelper
def link_to_unless(condition, name, options = {}, html_options = {}, &block) def link_to_unless(condition, name, options = {}, html_options = {}, &block)
if condition if condition
link_to(name, options, html_options.merge(:class => 'current-page')) link_to(name, options, html_options.merge(:class => 'current-page'))
else else
link_to(name, options, html_options) link_to(name, options, html_options)
end end
end end
end end
end end
end end
Loading…
Cancel
Save