Permalink
Browse files

added Blogs controller.

added error messages in shared layout.
Gemfile clean up and added some gems for development.
  • Loading branch information...
yoosee committed Feb 21, 2016
1 parent fbe0a05 commit 1035e66506d60d9a7bd208d53ab8a7f3eb594fd5
View
54 Gemfile
@@ -1,70 +1,64 @@
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'rails', '4.2.2'
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'bootstrap-sass'
gem 'bootstrap-sass' #, '3.2.0.0'
gem 'sprockets'
gem 'bcrypt'
#gem 'faker'
gem 'faker'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Use jquery-ui
gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Markdown renderer
gem 'redcarpet'
# Pagination
gem 'will_paginate'
# Image uploader
gem 'paperclip', "~> 4.3"
# tag model and utility
gem 'acts-as-taggable-on', '~> 3.4'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
gem 'byebug'
gem 'sqlite3'
end
group :test do
gem 'capybara'
gem 'selenium-webdriver'
gem 'factory_girl_rails'
# gem 'capybara'
# gem 'selenium-webdriver'
# gem 'factory_girl_rails'
end
group :development do
# Call 'debugger' anywhere in the code to stop execution and get a debugger console
# gem 'debugger'
gem 'rspec-rails'
# Access an IRB console on exception pages or by using <%= console %> in views
# gem 'rspec-rails'
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'better_errors'
gem 'quiet_assets'
gem 'rails_layout'
end
group :production do
# gem 'pg'
# gem 'rails_12factor'
end
View
@@ -1,68 +1,64 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
actionmailer (4.2.2)
actionpack (= 4.2.2)
actionview (= 4.2.2)
activejob (= 4.2.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
actionpack (4.2.2)
actionview (= 4.2.2)
activesupport (= 4.2.2)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
actionview (4.2.2)
activesupport (= 4.2.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
activejob (4.2.2)
activesupport (= 4.2.2)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
activemodel (4.2.2)
activesupport (= 4.2.2)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
activerecord (4.2.2)
activemodel (= 4.2.2)
activesupport (= 4.2.2)
arel (~> 6.0)
activesupport (4.2.0)
activesupport (4.2.2)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
acts-as-taggable-on (3.5.0)
activerecord (>= 3.2, < 5)
addressable (2.4.0)
arel (6.0.3)
autoprefixer-rails (6.3.2)
autoprefixer-rails (6.3.3)
execjs
json
bcrypt (3.1.10)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.2)
capybara (2.6.2)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
byebug (8.2.2)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
@@ -72,17 +68,8 @@ GEM
coffee-script-source (1.10.0)
concurrent-ruby (1.0.0)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.6.0)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.6.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
faker (1.6.1)
i18n (~> 0.5)
ffi (1.9.10)
globalid (0.3.6)
activesupport (>= 4.1.0)
i18n (0.7.0)
@@ -113,19 +100,21 @@ GEM
cocaine (~> 0.5.5)
mime-types
mimemagic (= 0.3.0)
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
rails (4.2.2)
actionmailer (= 4.2.2)
actionpack (= 4.2.2)
actionview (= 4.2.2)
activejob (= 4.2.2)
activemodel (= 4.2.2)
activerecord (= 4.2.2)
activesupport (= 4.2.2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0)
railties (= 4.2.2)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
@@ -135,33 +124,16 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rails_layout (1.0.29)
railties (4.2.2)
actionpack (= 4.2.2)
activesupport (= 4.2.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.5.0)
rdoc (4.2.2)
json (~> 1.4)
redcarpet (3.3.4)
rspec-core (3.4.2)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-rails (3.4.2)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rubyzip (1.1.7)
sass (3.4.21)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
@@ -172,11 +144,6 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
selenium-webdriver (2.51.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
spring (1.6.3)
sprockets (3.5.2)
concurrent-ruby (~> 1.0)
@@ -201,32 +168,28 @@ GEM
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
websocket (1.2.2)
will_paginate (3.1.0)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
acts-as-taggable-on (~> 3.4)
bcrypt
better_errors
bootstrap-sass
capybara
byebug
coffee-rails (~> 4.1.0)
factory_girl_rails
faker
jbuilder (~> 2.0)
jquery-rails
jquery-ui-rails
paperclip (~> 4.3)
rails (= 4.2.0)
quiet_assets
rails (= 4.2.2)
rails_layout
redcarpet
rspec-rails
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
selenium-webdriver
spring
sprockets
sqlite3
@@ -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/
@@ -0,0 +1,3 @@
// Place all the styles related to the Blogs controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -1,3 +1,4 @@
@import "bootstrap-sprockets";
@import "bootstrap";
/* mixins, valiables, etc. */
@@ -136,3 +137,19 @@ input {
@include box_sizing;
}
/* forms */
#error_explanation {
color: red;
ul {
color: red;
margin: 0 0 30px 0;
}
}
.field_with_errors {
@extend .has-error;
.form-control {
color: $state-danger-text;
}
}
@@ -38,7 +38,7 @@ def create
flash[:success] = "Article saved."
redirect_to @article
else
flash[:error] = "Article could not be saved."
flash[:danger] = "Article could not be saved."
@medium = Medium.new ### better way to keep @medium object in view??
render 'new'
end
@@ -0,0 +1,6 @@
class BlogsController < ApplicationController
def new
end
end
@@ -0,0 +1,5 @@
module BlogsHelper
def blog_initialize
request.base_url
end
end
@@ -1,10 +1,10 @@
<%= form_for @article do |f| %>
<%= render 'shared/error_messages' %>
<%= f.label :title %> <%= f.text_field :title %>
<%= f.label :alt_url %> <%= f.text_field :alt_url %>
<%= f.label :content %> <%= f.text_area :content, :size=>'x20' %>
<%= f.label :status %> <%= f.select :status, Article.statuses.keys.to_a %>
<%= f.label :tag_list, "Tags" %> <%= text_field_tag 'article[tag_list]', @article.tag_list.join(','), "data-role" => "tagsinput" %>
<%= f.label :title %> <%= f.text_field :title, class: 'form-control' %>
<%= f.label :alt_url %> <%= f.text_field :alt_url, class: 'form-control' %>
<%= f.label :content %> <%= f.text_area :content, :size=>'x20', class: 'form-control' %>
<%= f.label :status %> <%= f.select :status, Article.statuses.keys.to_a, class: 'form-control' %>
<%= f.label :tag_list, "Tags" %> <%= text_field_tag 'article[tag_list]', @article.tag_list.join(','), "data-role" => "tagsinput", class: 'form-control' %>
<%= f.submit "Submit", class: "btn btn-large btn-primary" %>
<% end %>
Oops, something went wrong.

0 comments on commit 1035e66

Please sign in to comment.