diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb index ec2c75026..a732013b7 100644 --- a/app/views/kaminari/_first_page.html.erb +++ b/app/views/kaminari/_first_page.html.erb @@ -1,11 +1,11 @@ -<%# Link to the "First" page - - available local variables - url: url to the first page - current_page: a page object for the currently displayed page - total_pages: total number of pages - per_page: number of items to fetch per page - remote: data-remote --%> - - <%= link_to_unless current_page.first?, l('views.pagination.first').html_safe, url, :remote => remote %> - +<%# Link to the "First" page + - available local variables + url: url to the first page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.first?, l('views.pagination.first').html_safe, url, :remote => remote %> + diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb index 258fd29b2..a45dfdaa0 100644 --- a/app/views/kaminari/_gap.html.erb +++ b/app/views/kaminari/_gap.html.erb @@ -1,8 +1,8 @@ -<%# Non-link tag that stands for skipped pages... - - available local variables - current_page: a page object for the currently displayed page - total_pages: total number of pages - per_page: number of items to fetch per page - remote: data-remote --%> - +<%# Non-link tag that stands for skipped pages... + - available local variables + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb index 410d05c55..d1a9089d1 100644 --- a/app/views/kaminari/_last_page.html.erb +++ b/app/views/kaminari/_last_page.html.erb @@ -1,11 +1,11 @@ -<%# Link to the "Last" page - - available local variables - url: url to the last page - current_page: a page object for the currently displayed page - total_pages: total number of pages - per_page: number of items to fetch per page - remote: data-remote --%> - - <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %> - +<%# Link to the "Last" page + - available local variables + url: url to the last page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %> + diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb index d119475ff..59c3d0a21 100644 --- a/app/views/kaminari/_next_page.html.erb +++ b/app/views/kaminari/_next_page.html.erb @@ -1,11 +1,11 @@ -<%# Link to the "Next" page - - available local variables - url: url to the next page - current_page: a page object for the currently displayed page - total_pages: total number of pages - per_page: number of items to fetch per page - remote: data-remote --%> - - <%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote %> - +<%# Link to the "Next" page + - available local variables + url: url to the next page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + remote: data-remote +-%> + + <%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote %> + diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb index 91aa63a46..0b5e68075 100644 --- a/app/views/kaminari/_page.html.erb +++ b/app/views/kaminari/_page.html.erb @@ -1,13 +1,13 @@ -<%# Link showing page number - - available local variables - page: a page object for "this" page - url: url to this page - current_page: a page object for the currently displayed page - total_pages: total number of pages - per_page: number of items to fetch per page - 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 showing page number + - available local variables + page: a page object for "this" page + url: url to this page + current_page: a page object for the currently displayed page + total_pages: total number of pages + per_page: number of items to fetch per page + 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} %> + diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb index 04f03c02c..5250cd1a0 100644 --- a/app/views/kaminari/_paginator.html.erb +++ b/app/views/kaminari/_paginator.html.erb @@ -1,23 +1,23 @@ -<%# The container tag - - available local variables - current_page: a page object for the currently displayed page - total_pages: total number of pages - per_page: number of items to fetch per page - remote: data-remote - paginator: the paginator that renders the pagination tags inside --%> -<%= paginator.render do -%> -
<%= l(:label_course_practice) %> | -<%= l(:label_user_location) %> : | -- <% 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) %> | - <% end %> - <% end %> - -
-
- <%= 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 %>
-
- |
-
<%= link_to request.host() + "/projects", :controller => 'projects', :action => 'course', :project_type => 1 %> | -<%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course', :project_type => 1 %> | -
- <%= l(:label_project_deposit) %> - | -- <%= l(:label_user_location) %> : - | -- <% 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 %> - | -
-
-
- <%= 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 %>
-
- <%= l(:label_search)%>
-
-
- - - |
-
- - <%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %> - - | -- <%=link_to l(:field_homepage), home_path %> > - <%=link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %> - | -
- <%= l(:label_my_projects) %> -
-<% 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 %> -- <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %> -
-<% end %> -<% end %> - -<% html_title(l(:label_project_plural)) -%> +<% @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 %> +<%= l(:label_course_practice) %> | +<%= l(:label_user_location) %> : | ++ <% 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) %> | + <% end %> + <% end %> + +
+
+ <%= 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 %>
+
+ |
+
<%= link_to request.host() + "/projects", :controller => 'projects', :action => 'course', :project_type => 1 %> | +<%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course', :project_type => 1 %> | +
+ <%= l(:label_project_deposit) %> + | ++ <%= l(:label_user_location) %> : + | ++ <% 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 %> + | +
+
+
+ <%= 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 %>
+
+ <%= l(:label_search)%>
+
+
+ + + |
+
+ + <%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %> + + | ++ <%=link_to l(:field_homepage), home_path %> > + <%=link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %> + | +
+ <%= l(:label_my_projects) %> +
+<% 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 %> ++ <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %> +
+<% end %> +<% end %> + +<% html_title(l(:label_project_plural)) -%> diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb index 63e6b7f9b..2ae42e414 100644 --- a/config/initializers/kaminari_config.rb +++ b/config/initializers/kaminari_config.rb @@ -1,32 +1,32 @@ -# Time 2015-01-30 17:04:12 -# Author lizanle -# Description kaminari配置文件 -# <%= paginate @users, :window => 2 %> -# 则展示页会像 5 6 7 8 9 ,当7是当前页的时候 - -# <%= paginate @users, :outer_window => 3 %> -# 分页展示会像 1 2 3 4 ...(snip)... 17 18 19 20 当总共有20个页面的时候 - -# <%= paginate @users, :left => 1, :right => 3 %> -# 分页展示会像 1 ...(snip)... 18 19 20 当总共有20个页面的时候 - -# <%= paginate @users, :param_name => :pagina %> -# 这样子会将每个链接传进去一个参数 :pagina - -# <%= paginate @users, :params => {:controller => 'foo', :action => 'bar'} %> -# 这样子将会修改每个链接的控制器和动作. :controller and :action - -# <%= paginate @users, :remote => true %> -# 这将会使每个链接使用ajax方式,极其简单,非常完美的工作。data-remote="true" - -#更多知识详见 https://github.com/honwlee/kaminari -Kaminari.configure do |config| - # config.default_per_page = 25 - # config.max_per_page = nil - # config.window = 4 - # config.outer_window = 3 - # config.left = 0 - # config.right = 0 - # config.page_method_name = :page - # config.param_name = :page -end +# Time 2015-01-30 17:04:12 +# Author lizanle +# Description kaminari配置文件 +# <%= paginate @users, :window => 2 %> +# 则展示页会像 5 6 7 8 9 ,当7是当前页的时候 + +# <%= paginate @users, :outer_window => 3 %> +# 分页展示会像 1 2 3 4 ...(snip)... 17 18 19 20 当总共有20个页面的时候 + +# <%= paginate @users, :left => 1, :right => 3 %> +# 分页展示会像 1 ...(snip)... 18 19 20 当总共有20个页面的时候 + +# <%= paginate @users, :param_name => :pagina %> +# 这样子会将每个链接传进去一个参数 :pagina + +# <%= paginate @users, :params => {:controller => 'foo', :action => 'bar'} %> +# 这样子将会修改每个链接的控制器和动作. :controller and :action + +# <%= paginate @users, :remote => true %> +# 这将会使每个链接使用ajax方式,极其简单,非常完美的工作。data-remote="true" + +#更多知识详见 https://github.com/honwlee/kaminari +Kaminari.configure do |config| + # config.default_per_page = 25 + # config.max_per_page = nil + # config.window = 4 + # config.outer_window = 3 + # config.left = 0 + # config.right = 0 + # config.page_method_name = :page + # config.param_name = :page +end diff --git a/config/initializers/url_helper.rb b/config/initializers/url_helper.rb index 7c4b68be9..7f54df604 100644 --- a/config/initializers/url_helper.rb +++ b/config/initializers/url_helper.rb @@ -1,22 +1,22 @@ -# Time 2015-01-30 17:02:41 -# Author lizanle -# 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' -module ActionView - # = Action View URL Helpers - module Helpers #:nodoc: - # Provides a set of methods for making links and getting URLs that - # depend on the routing subsystem (see ActionDispatch::Routing). - # This allows you to use the same format for links in views - # and controllers. - module UrlHelper - def link_to_unless(condition, name, options = {}, html_options = {}, &block) - if condition - link_to(name, options, html_options.merge(:class => 'current-page')) - else - link_to(name, options, html_options) - end - end - end - end +# Time 2015-01-30 17:02:41 +# Author lizanle +# 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' +module ActionView + # = Action View URL Helpers + module Helpers #:nodoc: + # Provides a set of methods for making links and getting URLs that + # depend on the routing subsystem (see ActionDispatch::Routing). + # This allows you to use the same format for links in views + # and controllers. + module UrlHelper + def link_to_unless(condition, name, options = {}, html_options = {}, &block) + if condition + link_to(name, options, html_options.merge(:class => 'current-page')) + else + link_to(name, options, html_options) + end + end + end + end end \ No newline at end of file