don't count expired snippets
This commit is contained in:
parent
000c032482
commit
325b84545c
|
@ -23,6 +23,7 @@ class Snippet < ActiveRecord::Base
|
||||||
:length => { :within => 0..10000 }
|
:length => { :within => 0..10000 }
|
||||||
|
|
||||||
scope :fresh, order("created_at DESC")
|
scope :fresh, order("created_at DESC")
|
||||||
|
scope :non_expired, where(["expires_at IS NULL OR expires_at > ?", Time.current])
|
||||||
|
|
||||||
def self.content_types
|
def self.content_types
|
||||||
[
|
[
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
= link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do
|
= link_to project_snippets_path(@project), :class => (controller.controller_name == "snippets") ? "current" : nil do
|
||||||
Snippets
|
Snippets
|
||||||
- if @project.snippets.count > 0
|
- if @project.snippets.count > 0
|
||||||
%span{ :class => "top_menu_count" }= @project.snippets.count
|
%span{ :class => "top_menu_count" }= @project.snippets.non_expired.count
|
||||||
|
|
||||||
- if @commit
|
- if @commit
|
||||||
%span= link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil
|
%span= link_to truncate(commit_name(@project,@commit), :length => 15), project_commit_path(@project, :id => @commit.id), :class => current_page?(:controller => "commits", :action => "show", :project_id => @project, :id => @commit.id) ? "current" : nil
|
||||||
|
|
Loading…
Reference in a new issue