diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 98a77263f..ecae745d4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,12 +1,12 @@ module ApplicationHelper - def menu_item where - if where[:controller] == root_path - destination = root_path - else - destination = (root_path = "/" ? where[:controller] : root_path + "/" + where[:controller]) + def menu_item title, where + li_class = "" + link = link_to_unless_current(title, where) do + li_class = " class=\"topmenu-active\"" + title end - - "
  • #{link_to(where[:title], destination)}
  • " + "#{link}" + #"
  • #{link_to(where[:title], destination)}
  • " end def tab_link tab @@ -141,4 +141,16 @@ def is_current_menu_item? item def is_current_tab? tab true if params[:action] == tab.downcase end + + def current_page + params[:page].blank? ? 1 : params[:page].to_i + end + + def next_page + current_page + 1 + end + + def previous_page + current_page <= 2 ? 1 : current_page - 1 + end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f53c080dc..e96ee738c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -36,12 +36,12 @@ <%= link_to image_tag("graylog.png", :id => "toplogo"), (permitted_to?(:index, :messages) ? messages_path : streams_path)%> <% message_count_interval = Setting.get_message_count_interval(current_user) %> diff --git a/app/views/messages/_table.html.erb b/app/views/messages/_table.html.erb index 10c1cf623..2f401ea5f 100644 --- a/app/views/messages/_table.html.erb +++ b/app/views/messages/_table.html.erb @@ -33,20 +33,14 @@ -<% - params[:page].blank? ? current_page = 1 : current_page = params[:page].to_i; - next_page = current_page+1; - current_page <= 1 ? previous_page = 1 : previous_page = current_page-1; -%> - <% unless defined? @inline_version %>
    <% unless current_page <= 1 %> - previous page + <%= link_to "previous page", {:page => previous_page}, {:class => "previous-page"} %> <% end %> <% if total_messages > (Message::LIMIT*current_page) %> - next page + <%= link_to "next page", {:page => next_page}, {:class => "next-page"} %> <% end %>
    diff --git a/app/views/streams/show.html.erb b/app/views/streams/show.html.erb index 9cc0d2a74..f5125e5cd 100644 --- a/app/views/streams/show.html.erb +++ b/app/views/streams/show.html.erb @@ -70,7 +70,7 @@ » Show statistics - +<%= link_to raw("» back"), :back %>