Commit cc5440e82a396fe4967a0b31322d9bb67ee70057
1 parent
68b601f6
Exists in
master
and in
4 other branches
Use navless layout for snippets page
Showing
4 changed files
with
19 additions
and
24 deletions
Show diff stats
app/controllers/snippets_controller.rb
@@ -7,8 +7,12 @@ class SnippetsController < ApplicationController | @@ -7,8 +7,12 @@ class SnippetsController < ApplicationController | ||
7 | # Allow destroy snippet | 7 | # Allow destroy snippet |
8 | before_filter :authorize_admin_snippet!, only: [:destroy] | 8 | before_filter :authorize_admin_snippet!, only: [:destroy] |
9 | 9 | ||
10 | + before_filter :set_title | ||
11 | + | ||
10 | respond_to :html | 12 | respond_to :html |
11 | 13 | ||
14 | + layout 'navless' | ||
15 | + | ||
12 | def index | 16 | def index |
13 | @snippets = Snippet.public.fresh.non_expired.page(params[:page]).per(20) | 17 | @snippets = Snippet.public.fresh.non_expired.page(params[:page]).per(20) |
14 | end | 18 | end |
@@ -98,4 +102,8 @@ class SnippetsController < ApplicationController | @@ -98,4 +102,8 @@ class SnippetsController < ApplicationController | ||
98 | def authorize_admin_snippet! | 102 | def authorize_admin_snippet! |
99 | return render_404 unless can?(current_user, :admin_personal_snippet, @snippet) | 103 | return render_404 unless can?(current_user, :admin_personal_snippet, @snippet) |
100 | end | 104 | end |
105 | + | ||
106 | + def set_title | ||
107 | + @title = 'Snippets' | ||
108 | + end | ||
101 | end | 109 | end |
app/views/layouts/snippets.html.haml
@@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
1 | -!!! 5 | ||
2 | -%html{ lang: "en"} | ||
3 | - = render "layouts/head", title: "Snipepts" | ||
4 | - %body{class: "#{app_theme} application", :'data-page' => body_data_page} | ||
5 | - = render "layouts/head_panel", title: "Snippets" | ||
6 | - = render "layouts/flash" | ||
7 | - %nav.main-nav | ||
8 | - .container | ||
9 | - %ul | ||
10 | - = nav_link(path: 'snippets#user_index', html_options: {class: 'home'}) do | ||
11 | - = link_to user_snippets_path(current_user), title: "My Snippets" do | ||
12 | - %i.icon-home | ||
13 | - = nav_link(path: 'snippets#new') do | ||
14 | - = link_to new_snippet_path do | ||
15 | - New snippet | ||
16 | - = nav_link(path: 'snippets#index') do | ||
17 | - = link_to snippets_path do | ||
18 | - Discover snippets | ||
19 | - .container | ||
20 | - .content= yield |
app/views/snippets/current_user_index.html.haml
1 | %h3.page_title | 1 | %h3.page_title |
2 | My Snippets | 2 | My Snippets |
3 | %small share code pastes with others out of git repository | 3 | %small share code pastes with others out of git repository |
4 | - = link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do | ||
5 | - Add new snippet | 4 | + .pull-right |
5 | + = link_to new_snippet_path, class: "btn btn-small add_new grouped btn-primary", title: "New Snippet" do | ||
6 | + Add new snippet | ||
7 | + = link_to snippets_path, class: "btn btn-small grouped" do | ||
8 | + Discover snippets | ||
6 | 9 | ||
7 | %hr | 10 | %hr |
8 | 11 |
app/views/snippets/index.html.haml
1 | %h3.page_title | 1 | %h3.page_title |
2 | Public snippets | 2 | Public snippets |
3 | %small share code pastes with others out of git repository | 3 | %small share code pastes with others out of git repository |
4 | - = link_to new_snippet_path, class: "btn btn-small add_new pull-right", title: "New Snippet" do | ||
5 | - Add new snippet | 4 | + |
5 | + .pull-right | ||
6 | + = link_to new_snippet_path, class: "btn btn-small add_new grouped btn-primary", title: "New Snippet" do | ||
7 | + Add new snippet | ||
8 | + = link_to user_snippets_path(current_user), class: "btn btn-small grouped" do | ||
9 | + My snippets | ||
6 | 10 | ||
7 | %hr | 11 | %hr |
8 | .row | 12 | .row |