Skip to content

Commit

Permalink
create controller flow, stock
Browse files Browse the repository at this point in the history
  • Loading branch information
tadyjp committed Mar 10, 2014
1 parent 248183a commit ef38b17
Show file tree
Hide file tree
Showing 21 changed files with 143 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/flow.js.coffee
@@ -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/javascripts/stock.js.coffee
@@ -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/flow.css.scss
@@ -0,0 +1,3 @@
// Place all the styles related to the flow controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/stock.css.scss
@@ -0,0 +1,3 @@
// Place all the styles related to the stock controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
7 changes: 7 additions & 0 deletions app/controllers/flow_controller.rb
@@ -0,0 +1,7 @@
class FlowController < ApplicationController
before_action :require_login

def show
@posts = Post.order(updated_at: :desc).limit(20)
end
end
6 changes: 6 additions & 0 deletions app/controllers/stock_controller.rb
@@ -0,0 +1,6 @@
class StockController < ApplicationController
before_action :require_login

def show
end
end
13 changes: 13 additions & 0 deletions app/decorators/flow_decorator.rb
@@ -0,0 +1,13 @@
class FlowDecorator < Draper::Decorator
delegate_all

# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end

end
13 changes: 13 additions & 0 deletions app/decorators/stock_decorator.rb
@@ -0,0 +1,13 @@
class StockDecorator < Draper::Decorator
delegate_all

# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end

end
2 changes: 2 additions & 0 deletions app/helpers/flow_helper.rb
@@ -0,0 +1,2 @@
module FlowHelper
end
2 changes: 2 additions & 0 deletions app/helpers/stock_helper.rb
@@ -0,0 +1,2 @@
module StockHelper
end
11 changes: 11 additions & 0 deletions app/views/flow/show.html.slim
@@ -0,0 +1,11 @@
/! view:flow/show
.row
.col-xs-8 role="navigation"
#tab-list.tab-pane.active
.list-group
- @posts.each_with_index do |post, i|
a.list-group-item.post-list data-post-id=post.id href="#" = post.title

.col-xs-4
#list_post
p#posts-placeholder style="color:#aaa;font-size:30px" &lt;-- Select a post...
2 changes: 2 additions & 0 deletions app/views/stock/show.html.erb
@@ -0,0 +1,2 @@
<h1>Stock#show</h1>
<p>Find me in app/views/stock/show.html.erb</p>
3 changes: 3 additions & 0 deletions config/routes.rb
Expand Up @@ -5,6 +5,9 @@

root 'home#top', as: 'root'

get 'stock' => 'stock#show', as: 'stock'
get 'flow' => 'flow#show', as: 'flow'

get 'posts/:id/fork' => 'posts#fork', as: 'fork_post'
post 'posts/:id/mail' => 'posts#mail', as: 'mail_post'
post 'posts/:id/comment' => 'posts#comment', as: 'comment_post'
Expand Down
12 changes: 12 additions & 0 deletions spec/controllers/flow_controller_spec.rb
@@ -0,0 +1,12 @@
require 'spec_helper'

describe FlowController do

describe "GET 'show'" do
it "returns http success" do
get 'show'
response.should be_success
end
end

end
12 changes: 12 additions & 0 deletions spec/controllers/stock_controller_spec.rb
@@ -0,0 +1,12 @@
require 'spec_helper'

describe StockController do

describe "GET 'show'" do
it "returns http success" do
get 'show'
response.should be_success
end
end

end
4 changes: 4 additions & 0 deletions spec/decorators/flow_decorator_spec.rb
@@ -0,0 +1,4 @@
require 'spec_helper'

describe FlowDecorator do
end
4 changes: 4 additions & 0 deletions spec/decorators/stock_decorator_spec.rb
@@ -0,0 +1,4 @@
require 'spec_helper'

describe StockDecorator do
end
15 changes: 15 additions & 0 deletions spec/helpers/flow_helper_spec.rb
@@ -0,0 +1,15 @@
require 'spec_helper'

# Specs in this file have access to a helper object that includes
# the FlowHelper. For example:
#
# describe FlowHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe FlowHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
15 changes: 15 additions & 0 deletions spec/helpers/stock_helper_spec.rb
@@ -0,0 +1,15 @@
require 'spec_helper'

# Specs in this file have access to a helper object that includes
# the StockHelper. For example:
#
# describe StockHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe StockHelper do
pending "add some examples to (or delete) #{__FILE__}"
end
5 changes: 5 additions & 0 deletions spec/views/flow/show.html.erb_spec.rb
@@ -0,0 +1,5 @@
require 'spec_helper'

describe "flow/show.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end
5 changes: 5 additions & 0 deletions spec/views/stock/show.html.erb_spec.rb
@@ -0,0 +1,5 @@
require 'spec_helper'

describe "stock/show.html.erb" do
pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit ef38b17

Please sign in to comment.