Setup slim layout
This commit is contained in:
parent
fa05d6cc91
commit
fb390b7e00
10 changed files with 42 additions and 23 deletions
1
Gemfile
1
Gemfile
|
@ -10,6 +10,7 @@ gem 'jquery-rails'
|
|||
gem 'jbuilder', '~> 2.0'
|
||||
gem 'sdoc', '~> 0.4.0', group: :doc
|
||||
|
||||
gem 'materialize-sass'
|
||||
gem 'slim-rails'
|
||||
|
||||
gem 'omniauth-reddit', :git => 'git://github.com/jackdempsey/omniauth-reddit.git'
|
||||
|
|
|
@ -86,6 +86,8 @@ GEM
|
|||
nokogiri (>= 1.5.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
materialize-sass (0.97.1)
|
||||
sass (~> 3.3)
|
||||
mime-types (2.6.2)
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.8.1)
|
||||
|
@ -189,6 +191,7 @@ DEPENDENCIES
|
|||
dotenv-rails
|
||||
jbuilder (~> 2.0)
|
||||
jquery-rails
|
||||
materialize-sass
|
||||
omniauth-reddit!
|
||||
quiet_assets
|
||||
rails (= 4.2.4)
|
||||
|
|
|
@ -12,4 +12,5 @@
|
|||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require materialize-sprockets
|
||||
//= require_tree .
|
||||
|
|
2
app/assets/javascripts/layout.coffee
Normal file
2
app/assets/javascripts/layout.coffee
Normal file
|
@ -0,0 +1,2 @@
|
|||
$ ->
|
||||
$(".button-collapse").sideNav()
|
|
@ -13,3 +13,4 @@
|
|||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
@import 'materialize';
|
|
@ -3,9 +3,6 @@ class SessionsController < ApplicationController
|
|||
user = User.create_with_omniauth(env['omniauth.auth'])
|
||||
session[:user_id] = user.id
|
||||
|
||||
require 'pp'
|
||||
pp env['omniauth.auth']
|
||||
|
||||
redirect_to root_path, notice: 'You are now logged in'
|
||||
end
|
||||
|
||||
|
|
3
app/views/application/_flash_messages.html.slim
Normal file
3
app/views/application/_flash_messages.html.slim
Normal file
|
@ -0,0 +1,3 @@
|
|||
- flash.each do |type, message|
|
||||
javascript:
|
||||
Materialize.toast('#{message}', 5000)
|
13
app/views/application/_navbar.html.slim
Normal file
13
app/views/application/_navbar.html.slim
Normal file
|
@ -0,0 +1,13 @@
|
|||
nav
|
||||
.container
|
||||
.nav-wrapper
|
||||
a href="#" class="brand-logo" DBZDokkan
|
||||
a href="#" data-activates="mobile" class="button-collapse"
|
||||
i class="material-icons" menu
|
||||
ul.right.hide-on-med-and-down
|
||||
ul#mobile.side-nav
|
||||
ul.right
|
||||
- if logged_in?
|
||||
li= link_to 'Logout', logout_path, method: :delete
|
||||
- else
|
||||
li= link_to 'Login', '/auth/reddit'
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>DbzdokkanRails</title>
|
||||
<%= stylesheet_link_tag 'application', media: 'all' %>
|
||||
<%= javascript_include_tag 'application' %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<% if logged_in? %>
|
||||
<p><%= link_to 'Logout', logout_path, method: :delete %></p>
|
||||
<% else %>
|
||||
<p><a href="/auth/reddit">Login</a></p>
|
||||
<% end %>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
</body>
|
||||
</html>
|
18
app/views/layouts/application.html.slim
Normal file
18
app/views/layouts/application.html.slim
Normal file
|
@ -0,0 +1,18 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
meta charset="utf-8"
|
||||
meta http-equiv="X-UA-Compatible" content="IE=edge"
|
||||
meta name="viewport" content="width=device-width, initial-scale=1"
|
||||
title DBZDokkan
|
||||
= stylesheet_link_tag 'application', media: 'all'
|
||||
= stylesheet_link_tag 'http://fonts.googleapis.com/icon?family=Material+Icons'
|
||||
= javascript_include_tag 'application'
|
||||
= csrf_meta_tags
|
||||
|
||||
body
|
||||
== render 'navbar'
|
||||
|
||||
.container
|
||||
== render 'flash_messages', flash: flash
|
||||
= yield
|
Loading…
Reference in a new issue