diff --git a/Gemfile b/Gemfile index b60d02f..c6727ee 100644 --- a/Gemfile +++ b/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' diff --git a/Gemfile.lock b/Gemfile.lock index 793a84b..81f0e8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 646c5ab..3c7188e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -12,4 +12,5 @@ // //= require jquery //= require jquery_ujs +//= require materialize-sprockets //= require_tree . diff --git a/app/assets/javascripts/layout.coffee b/app/assets/javascripts/layout.coffee new file mode 100644 index 0000000..c23f125 --- /dev/null +++ b/app/assets/javascripts/layout.coffee @@ -0,0 +1,2 @@ +$ -> + $(".button-collapse").sideNav() diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.scss similarity index 96% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.scss index f9cd5b3..ccab52e 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.scss @@ -13,3 +13,4 @@ *= require_tree . *= require_self */ +@import 'materialize'; diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index e44cfcb..9cd1f9a 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -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 diff --git a/app/views/application/_flash_messages.html.slim b/app/views/application/_flash_messages.html.slim new file mode 100644 index 0000000..8d58f1d --- /dev/null +++ b/app/views/application/_flash_messages.html.slim @@ -0,0 +1,3 @@ +- flash.each do |type, message| + javascript: + Materialize.toast('#{message}', 5000) diff --git a/app/views/application/_navbar.html.slim b/app/views/application/_navbar.html.slim new file mode 100644 index 0000000..eb19bfa --- /dev/null +++ b/app/views/application/_navbar.html.slim @@ -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' diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 447a43f..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,20 +0,0 @@ - - -
-<%= link_to 'Logout', logout_path, method: :delete %>
- <% else %> - - <% end %> - -<%= yield %> - - - diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim new file mode 100644 index 0000000..9598aa6 --- /dev/null +++ b/app/views/layouts/application.html.slim @@ -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