Skip to content

Commit

Permalink
Add main controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ogom committed Dec 5, 2015
1 parent 85127cc commit ebfb841
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 55 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/main.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the main controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
4 changes: 4 additions & 0 deletions app/controllers/main_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class MainController < ApplicationController
def index
end
end
7 changes: 7 additions & 0 deletions app/helpers/main_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module MainHelper
def pack_path(path)
url = ""
url = "http://localhost:4000/static/" if Rails.env.development?
url + path
end
end
3 changes: 3 additions & 0 deletions app/views/main/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="main"></div>
<%= stylesheet_link_tag pack_path('app.css') %>
<%= javascript_include_tag pack_path('bundle.js') %>
55 changes: 1 addition & 54 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,56 +1,3 @@
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

# You can have the root of your site routed with "root"
# root 'welcome#index'

# Example of regular route:
# get 'products/:id' => 'catalog#view'

# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products

# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end

# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end

# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end

# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable

# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
root 'main#index'
end
2 changes: 1 addition & 1 deletion private/static/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
],
output: {
path: __dirname + '/static/',
publicPath: '/static/',
publicPath: 'http://localhost:4000/static/',
filename: 'bundle.js',
hot: true
},
Expand Down
9 changes: 9 additions & 0 deletions test/controllers/main_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'test_helper'

class MainControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end

end

0 comments on commit ebfb841

Please sign in to comment.