diff options
| author | Nihad Abbasov <narkoz.2008@gmail.com> | 2011-10-27 12:14:50 +0500 |
|---|---|---|
| committer | Nihad Abbasov <narkoz.2008@gmail.com> | 2011-10-27 12:14:50 +0500 |
| commit | 000c032482dbe2fe882f3b2583fe1a481edf460a (patch) | |
| tree | ffe12c9a33dda815d233fffcc558e1e14df4507b | |
| parent | 5e584ee6264962cc60d9074c33141a28b4100607 (diff) | |
| download | gitlab-ce-000c032482dbe2fe882f3b2583fe1a481edf460a.tar.gz | |
display recent snippets at top
| -rw-r--r-- | app/models/snippet.rb | 2 | ||||
| -rw-r--r-- | app/views/snippets/index.html.haml | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index acffc76cf0d..44cb88872a9 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -22,6 +22,8 @@ class Snippet < ActiveRecord::Base :presence => true, :length => { :within => 0..10000 } + scope :fresh, order("created_at DESC") + def self.content_types [ ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java", diff --git a/app/views/snippets/index.html.haml b/app/views/snippets/index.html.haml index fe5e617044b..3f2610004bf 100644 --- a/app/views/snippets/index.html.haml +++ b/app/views/snippets/index.html.haml @@ -8,7 +8,7 @@ %th Title %th File name %th - = render @snippets + = render @snippets.fresh :javascript $('.delete-snippet').live('ajax:success', function() { $(this).closest('tr').fadeOut(); }); |
