New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review #3

Open
wants to merge 11 commits into
base: master
from
View
@@ -0,0 +1,18 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
["transform-class-properties", { "spec": true }]
]
}
View
@@ -20,4 +20,8 @@
.byebug_history
*.DS_Store
.idea
.idea/inspectionProfiles
/public/packs
/public/packs-test
/node_modules
View
@@ -0,0 +1,3 @@
plugins:
postcss-smart-import: {}
postcss-cssnext: {}
View
@@ -1 +1 @@
2.3.4
2.4.1
View
23 Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
ruby '2.3.4'
ruby '2.4.1'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
@@ -15,22 +15,27 @@ gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
# gem 'sass-rails', '~> 5.0'
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
# gem 'coffee-rails', '~> 4.2'
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# パスワード暗号化
gem 'bcrypt', '~> 3.1.7'
gem 'font-awesome-rails'
gem 'webpacker', github: 'rails/webpacker'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
@@ -52,7 +57,7 @@ group :development do
# gem 'spring-watcher-listen', '~> 2.0.0'
end
group :production, :staging do
# Heroku用に動作させるgemらしい
gem 'rails_12factor'
end
# group :production, :staging do
# # Heroku用に動作させるgemらしい => いらない
# gem 'rails_12factor'
# end
View
@@ -1,3 +1,12 @@
GIT
remote: https://github.com/rails/webpacker.git
revision: 691389f343b6805aee7e27d2e222d81a78180464
specs:
webpacker (2.0)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
GEM
remote: https://rubygems.org/
specs:
@@ -39,14 +48,25 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (8.0.0)
bcrypt (3.1.11)
builder (3.2.3)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
erubi (1.6.1)
execjs (2.7.0)
ffi (1.9.18)
font-awesome-rails (4.7.0.2)
railties (>= 3.2, < 5.2)
globalid (0.4.0)
activesupport (>= 4.2.0)
i18n (0.8.6)
libv8 (3.16.14.19)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
@@ -67,6 +87,8 @@ GEM
pg (0.21.0)
puma (3.10.0)
rack (2.0.3)
rack-proxy (0.6.2)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.1.3)
@@ -86,11 +108,6 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.1.3)
actionpack (= 5.1.3)
activesupport (= 5.1.3)
@@ -101,7 +118,19 @@ GEM
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
ref (2.0.0)
ruby_dep (1.5.0)
sass (3.5.1)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
spring (2.0.2)
activesupport (>= 4.2)
sprockets (3.7.1)
@@ -111,8 +140,12 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.3)
@@ -128,17 +161,22 @@ PLATFORMS
ruby
DEPENDENCIES
bcrypt (~> 3.1.7)
coffee-rails (~> 4.2)
font-awesome-rails
listen (>= 3.0.5, < 3.2)
pg (~> 0.18)
puma (~> 3.7)
rails (~> 5.1.3)
rails_12factor
sass-rails (~> 5.0)
spring
therubyracer
turbolinks (~> 5)
uglifier (>= 1.3.0)
webpacker!
RUBY VERSION
ruby 2.3.4p301
ruby 2.4.1p111
BUNDLED WITH
1.15.4
View
@@ -0,0 +1 @@
web: bundle exec puma -p $PORT
View
@@ -1,61 +1,5 @@
# ExpertTodo
[Rails中級者向け勉強会Step-to-Rails-Expert.rb](https://step-to-rails-expert-rb.connpass.com/)のtodoアプリを作成しレビューしあう企画の元リポジトリです。
企画についての詳しい説明は、[説明ページ](http://biibiebisuke.hatenablog.com/entry/2017/08/08/173906)をご覧ください。
[Rails中級者向け勉強会Step-to-Rails-Expert.rb](https://step-to-rails-expert-rb.connpass.com/)
## アプリ名について
ExpertTodoという名前を使用すると環境にHerokuを使う場合など、アプリ名をurlに使う場合重複してしまい使用できない可能性があるので、任意のアプリ名を考えるか、`${account_name}-expert-todo`のアプリ名としてください。
## 開発の流れ
### 初めての方
- 本リポジトリをforkする
- 初回はmasterブランチにてrails newを行いcommit
- その後、reviewブランチを切ってそこで作業(reviewブランチから任意でブランチを切っても良い)
- レビューはreviewブランチにあるソースに対して行われる
### 途中参加の方
- 他の参加者のアプリをforkしてから実装してもOK
## ルール
- GitHub上でコードを公開する
- 常に動作確認できる環境を作る
- 他の人が簡単に動作確認できるようにするため
- Heroku, AWS, ...etc
- 開発環境の構築手順を README に書く
- 基本は bin/setup で構築できるようにする
- CI環境の構築
- テストの量は自由
- 使用するCIサービスは自由
- コミットメッセージの日本語、英語はどちらでも可
- UIに関しては、各々の裁量に任せる(ただし、使う上でソースを読まないと使えないものはダメ)
- データの整合性(既存データの保存を保証する)は任意。
## 仕様
### 最小機能(初期機能)
- ユーザー認証ができる(email認証)
- タスクを登録、更新、削除できる
- タスクに期限日・説明を設定できる
## 環境構築方法
こちらに環境構築方法を記載してください。
### rails new するまでの個人的メモ
- fork
- git clone https://github.com/ippomihosanpo/expert-todo.git
- bundle init
- Gemfile編集
```
source 'https://rubygems.org'
gem 'rails'
```
- bundle install --path vendor/bundle --jobs=4
- bundle exec rails new -B -d postgresql .
- Overwrite ~~/expert-todo/README.md? (enter "h" for help) [Ynaqdh] n
- Overwrite ~~/expert-todo/Gemfile? (enter "h" for help) [Ynaqdh] Y
- Gemfileごにょる(いらないもの、いるもの)
- bundle install --path vendor/bundle --jobs=4
- (Herokuが吐くログレベルを下げる heroku config:add LOG_LEVEL=DEBUG)
### 環境構築方法
- (brew install postgresql)
- (rbenv install 2.3.4)
- (rbenv local 2.3.4)
- bin/setup
## デモURL
https://ippomihosanpo-expert-todo.herokuapp.com
@@ -11,5 +11,7 @@
// about supported directives.
//
//= require rails-ujs
//= require jquery
//= require turbolinks
//= require bootstrap-sass/assets/javascripts/bootstrap
//= require_tree .
@@ -0,0 +1,18 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
$(document).ready ->
$(document).on 'click', 'div.task .panel-body', (e)->
task_id = $(this).parent().data('task-id')
$.ajax
url: '/tasks/' + task_id + '/edit'
dataType: 'script'
$(document).on {
'mouseenter': ->
$(this).addClass('fa-check-circle')
$(this).removeClass('fa-check-circle-o')
return
'mouseleave': ->
$(this).addClass('fa-check-circle-o')
$(this).removeClass('fa-check-circle')
return
}, 'a i'
@@ -0,0 +1,2 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
@@ -2,8 +2,8 @@
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
* vendor/assets/stylesheets directory can be referenced here using a relative path.
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
@@ -12,4 +12,20 @@
*
*= require_tree .
*= require_self
*/
*= require font-awesome
*/
// Bootstrap Sass
@import 'bootstrap-sass/assets/stylesheets/bootstrap';
body{
padding-top: 70px;
}
.field_with_errors {
@extend .has-error;
}
.form-control.datetime-column{
display: inline-block;
width: 55px;
}
@@ -0,0 +1,17 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/
div#todo-list div.task {
height: 200px;
div.panel-body {
height: 100%;
}
i {
font-size: 150%;
position: absolute;
top: 10px;
right: 30px;
color: #ccc;
}
}
@@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/
@@ -1,3 +1,23 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :check_logged_in
# ログインチェック
def check_logged_in
@current_user = User.find_by(id: session[:user])
unless @current_user
# ログインしてなければ、ログイン画面に飛ばす
# ログイン後、リクエストされたページに戻れるようにリファラを渡しとく
logout
flash[:referrer] = request.fullpath
redirect_to "/sessions"
end
end
# セッションのリセット(ログアウト)
def logout
session[:user] = nil
@current_user = nil
end
end
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.