Skip to content

Commit 184baac

Browse files
authored
Merge pull request #1 from RunnableDemo/sync-styles
Sync styles
2 parents 6012e4c + 6a68e70 commit 184baac

30 files changed

+332
-57
lines changed

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ruby:2.3.1
2+
3+
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
4+
RUN mkdir /app
5+
WORKDIR /app
6+
7+
# Cache Dependency Install
8+
ADD Gemfile /app/Gemfile
9+
ADD Gemfile.lock /app/Gemfile.lock
10+
RUN bundle install
11+
12+
# Add Repository
13+
ADD . /app
14+
15+
# Run Server
16+
EXPOSE 3000
17+
CMD rake db:migrate && rails server -b 0.0.0.0

Gemfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ source 'https://rubygems.org'
33

44
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
55
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
6-
# Use sqlite3 as the database for Active Record
7-
gem 'sqlite3'
6+
gem 'pg'
87
# Use Puma as the app server
98
gem 'puma', '~> 3.0'
109
# Use SCSS for stylesheets
@@ -15,7 +14,7 @@ gem 'uglifier', '>= 1.3.0'
1514
gem 'coffee-rails', '~> 4.2'
1615
# See https://github.com/rails/execjs#readme for more supported runtimes
1716
# gem 'therubyracer', platforms: :ruby
18-
# Bulma CSS
17+
gem 'haml'
1918
gem "bulma-rails", "~> 0.2.3"
2019
# Use jquery as the JavaScript library
2120
gem 'jquery-rails'

Gemfile.lock

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ GEM
5757
ffi (1.9.14)
5858
globalid (0.3.7)
5959
activesupport (>= 4.1.0)
60+
haml (4.0.7)
61+
tilt
6062
i18n (0.7.0)
6163
jbuilder (2.6.0)
6264
activesupport (>= 3.0.0, < 5.1)
@@ -82,6 +84,7 @@ GEM
8284
nio4r (1.2.1)
8385
nokogiri (1.6.8.1)
8486
mini_portile2 (~> 2.1.0)
87+
pg (0.19.0)
8588
puma (3.6.0)
8689
rack (2.0.1)
8790
rack-test (0.6.3)
@@ -132,7 +135,6 @@ GEM
132135
actionpack (>= 4.0)
133136
activesupport (>= 4.0)
134137
sprockets (>= 3.0.0)
135-
sqlite3 (1.3.12)
136138
thor (0.19.1)
137139
thread_safe (0.3.5)
138140
tilt (2.0.5)
@@ -159,19 +161,20 @@ DEPENDENCIES
159161
bulma-rails (~> 0.2.3)
160162
byebug
161163
coffee-rails (~> 4.2)
164+
haml
162165
jbuilder (~> 2.5)
163166
jquery-rails
164167
listen (~> 3.0.5)
168+
pg
165169
puma (~> 3.0)
166170
rails (~> 5.0.0, >= 5.0.0.1)
167171
sass-rails (~> 5.0)
168172
spring
169173
spring-watcher-listen (~> 2.0.0)
170-
sqlite3
171174
turbolinks (~> 5)
172175
tzinfo-data
173176
uglifier (>= 1.3.0)
174177
web-console
175178

176179
BUNDLED WITH
177-
1.12.5
180+
1.13.6

app/assets/images/favicon.png

6.24 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Place all the behaviors and hooks related to the matching controller here.
2+
# All this logic will automatically be available in application.js.
3+
# You can use CoffeeScript in this file: http://coffeescript.org/

app/assets/stylesheets/application.css renamed to app/assets/stylesheets/application.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,28 @@
1313
*= require_tree .
1414
*= require_self
1515
*/
16+
@import "bulma";
17+
18+
.hero {
19+
margin-bottom: 30px;
20+
}
21+
22+
.todo-list {
23+
padding: 30px;
24+
}
25+
26+
.addTodo {
27+
margin-top: 30px;
28+
}
29+
30+
.addTodo input {
31+
width: 100%;
32+
height: 50px;
33+
padding: 10px;
34+
resize: vertical;
35+
font-size: 18px;
36+
}
37+
38+
.addTodo label {
39+
display: none;
40+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#notice {
2+
color: red;
3+
}
4+
5+
.field_with_errors {
6+
padding: 2px;
7+
background-color: red;
8+
display: table;
9+
}
10+
11+
#error_explanation {
12+
width: 450px;
13+
border: 2px solid red;
14+
padding: 7px;
15+
padding-bottom: 0;
16+
margin-bottom: 20px;
17+
background-color: #f0f0f0;
18+
19+
h2 {
20+
text-align: left;
21+
font-weight: bold;
22+
padding: 5px 5px 5px 15px;
23+
font-size: 12px;
24+
margin: -7px;
25+
margin-bottom: 0;
26+
background-color: #c00;
27+
color: #fff;
28+
}
29+
30+
ul li {
31+
font-size: 12px;
32+
list-style: square;
33+
}
34+
}

app/assets/stylesheets/todos.scss

Whitespace-only changes.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
class TodosController < ApplicationController
2+
before_action :set_todo, only: [:show, :edit, :update, :destroy]
3+
4+
# GET /todos
5+
# GET /todos.json
6+
def index
7+
@todos = Todo.all
8+
@todo = Todo.new
9+
end
10+
11+
# GET /todos/1
12+
# GET /todos/1.json
13+
def show
14+
end
15+
16+
# GET /todos/new
17+
def new
18+
@todo = Todo.new
19+
end
20+
21+
# GET /todos/1/edit
22+
def edit
23+
end
24+
25+
# POST /todos
26+
# POST /todos.json
27+
def create
28+
@todo = Todo.new(todo_params)
29+
30+
respond_to do |format|
31+
if @todo.content == ""
32+
format.html { redirect_to todos_path, notice: 'Todo was blank!'}
33+
format.json { render json: { error: 'Blank Todo!' }, status: :unprocessable_entity }
34+
elsif @todo.save
35+
format.html { redirect_to todos_path }
36+
format.json { render :show, status: :created, location: @todo }
37+
else
38+
format.html { render todos_path }
39+
format.json { render json: @todo.errors, status: :unprocessable_entity }
40+
end
41+
end
42+
end
43+
44+
# PATCH/PUT /todos/1
45+
# PATCH/PUT /todos/1.json
46+
def update
47+
respond_to do |format|
48+
if @todo.update(todo_params)
49+
format.html { redirect_to todos_path }
50+
format.json { render :show, status: :ok, location: @todo }
51+
else
52+
format.html { render :edit }
53+
format.json { render json: @todo.errors, status: :unprocessable_entity }
54+
end
55+
end
56+
end
57+
58+
# DELETE /todos/1
59+
# DELETE /todos/1.json
60+
def destroy
61+
@todo.destroy
62+
respond_to do |format|
63+
format.html { redirect_to todos_url, notice: 'Todo was successfully destroyed.' }
64+
format.json { head :no_content }
65+
end
66+
end
67+
68+
private
69+
# Use callbacks to share common setup or constraints between actions.
70+
def set_todo
71+
@todo = Todo.find(params[:id])
72+
end
73+
74+
# Never trust parameters from the scary internet, only allow the white list through.
75+
def todo_params
76+
params.require(:todo).permit(:content)
77+
end
78+
end

app/helpers/todos_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module TodosHelper
2+
end

0 commit comments

Comments
 (0)