Skip to content

Commit

Permalink
Use navless layout for snippets page
Browse files Browse the repository at this point in the history
  • Loading branch information
dzaporozhets committed Jun 18, 2013
1 parent 68b601f commit cc5440e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
8 changes: 8 additions & 0 deletions app/controllers/snippets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ class SnippetsController < ApplicationController
# Allow destroy snippet
before_filter :authorize_admin_snippet!, only: [:destroy]

before_filter :set_title

respond_to :html

layout 'navless'

def index
@snippets = Snippet.public.fresh.non_expired.page(params[:page]).per(20)
end
Expand Down Expand Up @@ -98,4 +102,8 @@ def authorize_modify_snippet!
def authorize_admin_snippet!
return render_404 unless can?(current_user, :admin_personal_snippet, @snippet)
end

def set_title
@title = 'Snippets'
end
end
20 changes: 0 additions & 20 deletions app/views/layouts/snippets.html.haml

This file was deleted.

7 changes: 5 additions & 2 deletions app/views/snippets/current_user_index.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
%h3.page_title
My Snippets
%small share code pastes with others out of git repository
= link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do
Add new snippet
.pull-right
= link_to new_snippet_path, class: "btn btn-small add_new grouped btn-primary", title: "New Snippet" do
Add new snippet
= link_to snippets_path, class: "btn btn-small grouped" do
Discover snippets

%hr

Expand Down
8 changes: 6 additions & 2 deletions app/views/snippets/index.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
%h3.page_title
Public snippets
%small share code pastes with others out of git repository
= link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do
Add new snippet

.pull-right
= link_to new_snippet_path, class: "btn btn-small add_new grouped btn-primary", title: "New Snippet" do
Add new snippet
= link_to user_snippets_path(current_user), class: "btn btn-small grouped" do
My snippets

%hr
.row
Expand Down

0 comments on commit cc5440e

Please sign in to comment.