From 9c52d753640f21653106b288733e51c633b57435 Mon Sep 17 00:00:00 2001 From: tomoko Date: Thu, 24 Nov 2016 18:11:19 +0900 Subject: [PATCH 1/8] =?UTF-8?q?=E8=A9=B3=E7=B4=B0=E3=83=9A=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=81=AB=E7=94=BB=E9=9D=A2=E3=81=8B=E3=82=89=E3=83=91?= =?UTF-8?q?=E3=83=BC=E3=83=9E=E3=83=AA=E3=83=B3=E3=82=AF=E3=81=8C=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blog_post_page/details.html.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/blog_post_page/details.html.erb b/app/views/blog_post_page/details.html.erb index c28b0daa5..66d9ad914 100644 --- a/app/views/blog_post_page/details.html.erb +++ b/app/views/blog_post_page/details.html.erb @@ -1,3 +1,7 @@ +<%= scrivito_details_for 'Permalink' do %> + <%= scrivito_tag :div, @obj, :_permalink %> +<% end %> + <%= scrivito_medium_dialog do %> <%= scrivito_details_for "Title" do %> <%= scrivito_tag :div, @obj, :title %> From 19d355b5da6da5841d39fe49d7e2ec1eb5319e07 Mon Sep 17 00:00:00 2001 From: tomoko Date: Thu, 1 Dec 2016 12:53:42 +0800 Subject: [PATCH 2/8] =?UTF-8?q?sotech=5Fsha=E3=82=B3=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=83=A9=E3=83=BC=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=20#18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 書籍からのアクセスをリダイレクトするためのコントローラを追加した。 その他 ・blog_post_pageの画像にclass追加 --- app/assets/javascripts/sotech_sha.coffee | 3 + app/assets/stylesheets/sotech_sha.scss | 3 + app/controllers/sotech_sha_controller.rb | 6 ++ app/helpers/sotech_sha_helper.rb | 2 + app/views/blog_post_page/index.html.erb | 2 +- config/routes.rb | 56 +------------------ .../controllers/sotech_sha_controller_test.rb | 7 +++ 7 files changed, 24 insertions(+), 55 deletions(-) create mode 100644 app/assets/javascripts/sotech_sha.coffee create mode 100644 app/assets/stylesheets/sotech_sha.scss create mode 100644 app/controllers/sotech_sha_controller.rb create mode 100644 app/helpers/sotech_sha_helper.rb create mode 100644 test/controllers/sotech_sha_controller_test.rb diff --git a/app/assets/javascripts/sotech_sha.coffee b/app/assets/javascripts/sotech_sha.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/sotech_sha.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/ diff --git a/app/assets/stylesheets/sotech_sha.scss b/app/assets/stylesheets/sotech_sha.scss new file mode 100644 index 000000000..0fcdbb9b6 --- /dev/null +++ b/app/assets/stylesheets/sotech_sha.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the sotechSha controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/sotech_sha_controller.rb b/app/controllers/sotech_sha_controller.rb new file mode 100644 index 000000000..f37c6877f --- /dev/null +++ b/app/controllers/sotech_sha_controller.rb @@ -0,0 +1,6 @@ +class SotechShaController < ApplicationController + def index + chapter = params[:chapter] + redirect_to "/#{chapter}" + end +end diff --git a/app/helpers/sotech_sha_helper.rb b/app/helpers/sotech_sha_helper.rb new file mode 100644 index 000000000..a289c7efe --- /dev/null +++ b/app/helpers/sotech_sha_helper.rb @@ -0,0 +1,2 @@ +module SotechShaHelper +end diff --git a/app/views/blog_post_page/index.html.erb b/app/views/blog_post_page/index.html.erb index 658f18d09..90686e3ba 100644 --- a/app/views/blog_post_page/index.html.erb +++ b/app/views/blog_post_page/index.html.erb @@ -7,5 +7,5 @@ <%= scrivito_tag :h1, @obj, :title %> <%= scrivito_tag(:div, @obj, :abstract) %> <%= scrivito_tag(:div, @obj, :created) %> -<%= scrivito_image_tag(@obj, :image) %> +<%= scrivito_image_tag(@obj, :image ,:class => "img-responsive")%> <%= scrivito_tag :div, @obj, :body %> diff --git a/config/routes.rb b/config/routes.rb index 779609d99..dbccaf439 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,58 +1,6 @@ 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 + # Accsess from CoderdojoBook + get '/sotech_sha/:chapter', to: 'sotech_sha#index' # Default Scrivito routes. Adapt them to change the routing of CMS objects. # See the documentation of 'scrivito_route' for a detailed description. diff --git a/test/controllers/sotech_sha_controller_test.rb b/test/controllers/sotech_sha_controller_test.rb new file mode 100644 index 000000000..b065fdd4b --- /dev/null +++ b/test/controllers/sotech_sha_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SotechShaControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end From 1d850b453eaeed91d4ead7e83bf7942556a54337 Mon Sep 17 00:00:00 2001 From: Yohei YASUKAWA Date: Fri, 2 Dec 2016 17:18:34 +0800 Subject: [PATCH 3/8] Specify Ruby 2.3.1 by rbenv --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 000000000..2bf1c1ccf --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.3.1 From 007dd87166965145f4aafee027d103b7e7c9ac0c Mon Sep 17 00:00:00 2001 From: Yohei YASUKAWA Date: Fri, 2 Dec 2016 17:41:44 +0800 Subject: [PATCH 4/8] Change routing and refactor controller: sotech_sha -> SoTechSha --- .../{sotech_sha_controller.rb => so_tech_sha_controller.rb} | 2 +- config/routes.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename app/controllers/{sotech_sha_controller.rb => so_tech_sha_controller.rb} (62%) diff --git a/app/controllers/sotech_sha_controller.rb b/app/controllers/so_tech_sha_controller.rb similarity index 62% rename from app/controllers/sotech_sha_controller.rb rename to app/controllers/so_tech_sha_controller.rb index f37c6877f..3ca8a471f 100644 --- a/app/controllers/sotech_sha_controller.rb +++ b/app/controllers/so_tech_sha_controller.rb @@ -1,4 +1,4 @@ -class SotechShaController < ApplicationController +class SoTechShaController < ApplicationController def index chapter = params[:chapter] redirect_to "/#{chapter}" diff --git a/config/routes.rb b/config/routes.rb index dbccaf439..6d19a7535 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ Rails.application.routes.draw do - # Accsess from CoderdojoBook - get '/sotech_sha/:chapter', to: 'sotech_sha#index' + # Accsess from CoderDojo Book + get '/sotechsha/:chapter', to: 'so_tech_sha#index' # Default Scrivito routes. Adapt them to change the routing of CMS objects. # See the documentation of 'scrivito_route' for a detailed description. From db47fc5aeda0ff91771bd85f436ac2c5f8d9bf2a Mon Sep 17 00:00:00 2001 From: Yohei YASUKAWA Date: Fri, 2 Dec 2016 17:43:18 +0800 Subject: [PATCH 5/8] Add db/schema.rb --- db/schema.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 db/schema.rb diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 000000000..4dfbb1680 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,16 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 0) do + +end From a7915f9d8f768802133c33933a8b9019ce818679 Mon Sep 17 00:00:00 2001 From: Yohei YASUKAWA Date: Fri, 2 Dec 2016 17:57:37 +0800 Subject: [PATCH 6/8] Rename: SotechSha->SoTechSha and Chapter->Quiz --- .../javascripts/{sotech_sha.coffee => so_tech_sha.coffee} | 0 .../stylesheets/{sotech_sha.scss => so_tech_sha.scss} | 2 +- app/controllers/so_tech_sha_controller.rb | 6 +++--- app/helpers/so_tech_sha_helper.rb | 2 ++ app/helpers/sotech_sha_helper.rb | 2 -- config/routes.rb | 2 +- ...ha_controller_test.rb => so_tech_sha_controller_test.rb} | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename app/assets/javascripts/{sotech_sha.coffee => so_tech_sha.coffee} (100%) rename app/assets/stylesheets/{sotech_sha.scss => so_tech_sha.scss} (64%) create mode 100644 app/helpers/so_tech_sha_helper.rb delete mode 100644 app/helpers/sotech_sha_helper.rb rename test/controllers/{sotech_sha_controller_test.rb => so_tech_sha_controller_test.rb} (56%) diff --git a/app/assets/javascripts/sotech_sha.coffee b/app/assets/javascripts/so_tech_sha.coffee similarity index 100% rename from app/assets/javascripts/sotech_sha.coffee rename to app/assets/javascripts/so_tech_sha.coffee diff --git a/app/assets/stylesheets/sotech_sha.scss b/app/assets/stylesheets/so_tech_sha.scss similarity index 64% rename from app/assets/stylesheets/sotech_sha.scss rename to app/assets/stylesheets/so_tech_sha.scss index 0fcdbb9b6..62da2af4f 100644 --- a/app/assets/stylesheets/sotech_sha.scss +++ b/app/assets/stylesheets/so_tech_sha.scss @@ -1,3 +1,3 @@ -// Place all the styles related to the sotechSha controller here. +// Place all the styles related to the SoTechSha controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/so_tech_sha_controller.rb b/app/controllers/so_tech_sha_controller.rb index 3ca8a471f..8ad748dc4 100644 --- a/app/controllers/so_tech_sha_controller.rb +++ b/app/controllers/so_tech_sha_controller.rb @@ -1,6 +1,6 @@ class SoTechShaController < ApplicationController - def index - chapter = params[:chapter] - redirect_to "/#{chapter}" + def quiz + quiz = params[:quiz] + redirect_to "/#{quiz}" end end diff --git a/app/helpers/so_tech_sha_helper.rb b/app/helpers/so_tech_sha_helper.rb new file mode 100644 index 000000000..a33604254 --- /dev/null +++ b/app/helpers/so_tech_sha_helper.rb @@ -0,0 +1,2 @@ +module SoTechShaHelper +end diff --git a/app/helpers/sotech_sha_helper.rb b/app/helpers/sotech_sha_helper.rb deleted file mode 100644 index a289c7efe..000000000 --- a/app/helpers/sotech_sha_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module SotechShaHelper -end diff --git a/config/routes.rb b/config/routes.rb index 6d19a7535..ac3094310 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ Rails.application.routes.draw do # Accsess from CoderDojo Book - get '/sotechsha/:chapter', to: 'so_tech_sha#index' + get '/sotechsha/:quiz', to: 'so_tech_sha#quiz' # Default Scrivito routes. Adapt them to change the routing of CMS objects. # See the documentation of 'scrivito_route' for a detailed description. diff --git a/test/controllers/sotech_sha_controller_test.rb b/test/controllers/so_tech_sha_controller_test.rb similarity index 56% rename from test/controllers/sotech_sha_controller_test.rb rename to test/controllers/so_tech_sha_controller_test.rb index b065fdd4b..86682ecbc 100644 --- a/test/controllers/sotech_sha_controller_test.rb +++ b/test/controllers/so_tech_sha_controller_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class SotechShaControllerTest < ActionController::TestCase +class SoTechShaControllerTest < ActionController::TestCase # test "the truth" do # assert true # end From bd38640af8022f3390be9011c7da7a75e7c4c2e0 Mon Sep 17 00:00:00 2001 From: Yohei YASUKAWA Date: Fri, 2 Dec 2016 23:17:42 +0800 Subject: [PATCH 7/8] Use sqlite3 for development and test env --- Gemfile | 13 +++++++++---- config/database.yml | 6 +++--- db/test | Bin 0 -> 12288 bytes 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 db/test diff --git a/Gemfile b/Gemfile index 993da9d29..cf1c98bae 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,6 @@ source 'https://rubygems.org' ruby '2.3.1' -gem 'pg', '~> 0.18.4' - gem 'rails', '4.2.6' gem 'scrivito', '~> 1.3.0' @@ -20,7 +18,14 @@ gem 'sdoc', '~> 0.4.0', group: :doc gem 'uglifier', '>= 1.3.0' group :development do + gem 'web-console', '~> 2.0' gem 'spring', '1.7.1' +end + +group :development, :test do gem 'sqlite3', '1.3.11' - gem 'web-console', '~> 2.0' -end \ No newline at end of file +end + +group :production do + gem 'pg', '~> 0.18.4' +end diff --git a/config/database.yml b/config/database.yml index ad2ffe6c0..f07124cae 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,14 +5,12 @@ # gem 'sqlite3' # default: &default - adapter: postgresql pool: 5 timeout: 5000 development: + <<: *default adapter: sqlite3 - pool: 5 - timeout: 5000 database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and @@ -20,8 +18,10 @@ development: # Do not set this db to the same as development or production. test: <<: *default + adapter: sqlite3 database: db/test production: <<: *default + adapter: postgresql database: db/production diff --git a/db/test b/db/test new file mode 100644 index 0000000000000000000000000000000000000000..ee89cfdf9ea3812c5272e126ee94ca476dc65606 GIT binary patch literal 12288 zcmeI#K}*9h6u|MM9aINWZ@WHvatGG@48U8AbQOlX!?x1V-#r^;I4woGvfB*srAbb`(l*< literal 0 HcmV?d00001 From e4c087afbf590f22352caf2c1808b43051f75e34 Mon Sep 17 00:00:00 2001 From: Yohei YASUKAWA Date: Fri, 2 Dec 2016 23:31:29 +0800 Subject: [PATCH 8/8] Add redirect test for 6 quizzes on the book --- test/integration/so_tech_sha_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/integration/so_tech_sha_test.rb diff --git a/test/integration/so_tech_sha_test.rb b/test/integration/so_tech_sha_test.rb new file mode 100644 index 000000000..5f14b7153 --- /dev/null +++ b/test/integration/so_tech_sha_test.rb @@ -0,0 +1,15 @@ +require 'test_helper' + +class SoTechShaTest < ActionDispatch::IntegrationTest + def setup + # Quizzes on the book + @quizzes = (1..6).to_a + end + + test "Quizzes should be redirected" do + @quizzes.each do |num| + get "/sotechsha/#{num}" + assert_redirected_to "/#{num}" + end + end +end