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 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/app/assets/javascripts/so_tech_sha.coffee b/app/assets/javascripts/so_tech_sha.coffee new file mode 100644 index 000000000..24f83d18b --- /dev/null +++ b/app/assets/javascripts/so_tech_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/so_tech_sha.scss b/app/assets/stylesheets/so_tech_sha.scss new file mode 100644 index 000000000..62da2af4f --- /dev/null +++ b/app/assets/stylesheets/so_tech_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/so_tech_sha_controller.rb b/app/controllers/so_tech_sha_controller.rb new file mode 100644 index 000000000..8ad748dc4 --- /dev/null +++ b/app/controllers/so_tech_sha_controller.rb @@ -0,0 +1,6 @@ +class SoTechShaController < ApplicationController + 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/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 %> 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/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/config/routes.rb b/config/routes.rb index 779609d99..ac3094310 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 CoderDojo Book + 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/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 diff --git a/db/test b/db/test new file mode 100644 index 000000000..ee89cfdf9 Binary files /dev/null and b/db/test differ diff --git a/test/controllers/so_tech_sha_controller_test.rb b/test/controllers/so_tech_sha_controller_test.rb new file mode 100644 index 000000000..86682ecbc --- /dev/null +++ b/test/controllers/so_tech_sha_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SoTechShaControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end 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