From 5bd9c52f925f8b702c87a907b20d196488e8a9d0 Mon Sep 17 00:00:00 2001 From: Jalil Arfaoui Date: Thu, 5 Mar 2015 02:12:56 +0000 Subject: [PATCH] Bootstrap and HTML/CSS initial setup --- .idea/Debats.iml | 27 ++++- .idea/dataSources.ids | 13 ++ .idea/dataSources.local.xml | 7 ++ .idea/dataSources.xml | 19 +++ .../runConfigurations/Development__Debats.xml | 24 ++++ .../runConfigurations/Production__Debats.xml | 24 ++++ .idea/runConfigurations/spec__Debats.xml | 22 ++++ .idea/runConfigurations/test__Debats.xml | 24 ++++ Gemfile | 10 ++ Gemfile.lock | 65 +++++++++- Guardfile | 113 ++++++++++++++++++ app/assets/javascripts/static_pages.coffee | 3 + app/assets/stylesheets/debats.css.scss | 25 ++++ app/assets/stylesheets/footer.scss | 30 +++++ app/assets/stylesheets/header.scss | 18 +++ app/assets/stylesheets/static_pages.scss | 3 + app/assets/stylesheets/typo.scss | 27 +++++ app/controllers/static_pages_controller.rb | 5 + app/helpers/application_helper.rb | 11 ++ app/helpers/static_pages_helper.rb | 2 + app/views/layouts/_footer.html.erb | 14 +++ app/views/layouts/_header.html.erb | 13 ++ app/views/layouts/_shim.html.erb | 4 + app/views/layouts/application.html.erb | 10 +- app/views/static_pages/a_propos.html.erb | 13 ++ config/initializers/backtrace_silencers.rb | 1 + config/routes.rb | 3 + .../static_pages_controller_test.rb | 14 +++ test/test_helper.rb | 2 + 29 files changed, 541 insertions(+), 5 deletions(-) create mode 100644 .idea/dataSources.ids create mode 100644 .idea/dataSources.local.xml create mode 100644 .idea/dataSources.xml create mode 100644 .idea/runConfigurations/Development__Debats.xml create mode 100644 .idea/runConfigurations/Production__Debats.xml create mode 100644 .idea/runConfigurations/spec__Debats.xml create mode 100644 .idea/runConfigurations/test__Debats.xml create mode 100644 Guardfile create mode 100644 app/assets/javascripts/static_pages.coffee create mode 100644 app/assets/stylesheets/debats.css.scss create mode 100644 app/assets/stylesheets/footer.scss create mode 100644 app/assets/stylesheets/header.scss create mode 100644 app/assets/stylesheets/static_pages.scss create mode 100644 app/assets/stylesheets/typo.scss create mode 100644 app/controllers/static_pages_controller.rb create mode 100644 app/helpers/static_pages_helper.rb create mode 100644 app/views/layouts/_footer.html.erb create mode 100644 app/views/layouts/_header.html.erb create mode 100644 app/views/layouts/_shim.html.erb create mode 100644 app/views/static_pages/a_propos.html.erb create mode 100644 test/controllers/static_pages_controller_test.rb diff --git a/.idea/Debats.iml b/.idea/Debats.iml index 1d73682..234f85b 100644 --- a/.idea/Debats.iml +++ b/.idea/Debats.iml @@ -111,32 +111,51 @@ + + + + + - + + + + + + + + + + + + + + + @@ -147,10 +166,14 @@ + + + + @@ -158,11 +181,13 @@ + + diff --git a/.idea/dataSources.ids b/.idea/dataSources.ids new file mode 100644 index 0000000..49fe777 --- /dev/null +++ b/.idea/dataSources.ids @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml new file mode 100644 index 0000000..8558e6a --- /dev/null +++ b/.idea/dataSources.local.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..04f26fe --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,19 @@ + + + + + sqlite.xerial + true + org.sqlite.JDBC + jdbc:sqlite:C:\Users\Jalil\Documents\Projets\Perso\Debats.fr\web\Debats\db\development.sqlite3 + + + + sqlite.xerial + true + org.sqlite.JDBC + jdbc:sqlite:C:\Users\Jalil\Documents\Projets\Perso\Debats.fr\web\Debats\db\test.sqlite3 + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Development__Debats.xml b/.idea/runConfigurations/Development__Debats.xml new file mode 100644 index 0000000..4c563a8 --- /dev/null +++ b/.idea/runConfigurations/Development__Debats.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Production__Debats.xml b/.idea/runConfigurations/Production__Debats.xml new file mode 100644 index 0000000..04d814f --- /dev/null +++ b/.idea/runConfigurations/Production__Debats.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/spec__Debats.xml b/.idea/runConfigurations/spec__Debats.xml new file mode 100644 index 0000000..c8c9a0d --- /dev/null +++ b/.idea/runConfigurations/spec__Debats.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/test__Debats.xml b/.idea/runConfigurations/test__Debats.xml new file mode 100644 index 0000000..9052742 --- /dev/null +++ b/.idea/runConfigurations/test__Debats.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Gemfile b/Gemfile index 2e479e9..3d34255 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,7 @@ gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.1.0' +gem 'coffee-script-source', '1.8.0' # Problem with Coffee-script-source 1.9.0 on Windows # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby @@ -21,6 +22,8 @@ gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc +gem 'bootstrap-sass' + # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' @@ -41,6 +44,13 @@ group :development, :test do gem 'sqlite3' end +group :test do + gem 'minitest-reporters' + gem 'mini_backtrace' + gem 'guard' + gem 'guard-minitest' +end + group :production do gem 'pg','0.17.1' gem 'rails_12factor','0.0.2' diff --git a/Gemfile.lock b/Gemfile.lock index af9a451..9e342ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,29 +36,55 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + ansi (1.5.0) arel (6.0.0) + autoprefixer-rails (5.1.7) + execjs + json binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) + bootstrap-sass (3.3.3) + autoprefixer-rails (>= 5.0.0.1) + sass (>= 3.2.19) builder (3.2.2) byebug (3.5.1) columnize (~> 0.8) debugger-linecache (~> 1.2) slop (~> 3.6) + celluloid (0.16.0) + timers (~> 4.0.0) + coderay (1.1.0) coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.9.1) + coffee-script-source (1.8.0) columnize (0.9.0) debug_inspector (0.0.2) debugger-linecache (1.2.0) erubis (2.7.0) execjs (2.3.0) + ffi (1.9.6-x64-mingw32) + formatador (0.2.5) globalid (0.3.3) activesupport (>= 4.1.0) + guard (2.12.4) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-minitest (2.4.4) + guard-compat (~> 1.2) + minitest (>= 3.0) hike (1.2.3) + hitimes (1.2.2) i18n (0.7.0) jbuilder (2.2.9) activesupport (>= 3.0.0, < 5) @@ -68,17 +94,40 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.2) + listen (2.8.5) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) loofah (2.0.1) nokogiri (>= 1.5.9) + lumberjack (1.0.9) mail (2.6.3) mime-types (>= 1.16, < 3) + method_source (0.8.2) mime-types (2.4.3) + mini_backtrace (0.1.3) + minitest (> 1.2.0) + rails (>= 2.3.3) mini_portile (0.6.2) minitest (5.5.1) + minitest-reporters (1.0.11) + ansi + builder + minitest (>= 5.0) + ruby-progressbar multi_json (1.11.0) + nenv (0.2.0) nokogiri (1.6.6.2-x64-mingw32) mini_portile (~> 0.6.0) + notiffany (0.0.6) + nenv (~> 0.1) + shellany (~> 0.0) pg (0.17.1-x64-mingw32) + pry (0.10.1-x64-mingw32) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + win32console (~> 1.3) rack (1.6.0) rack-test (0.6.3) rack (>= 1.0) @@ -112,8 +161,12 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.4.2) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) rdoc (4.2.0) json (~> 1.4) + ruby-progressbar (1.7.1) sass (3.4.13) sass-rails (5.0.1) railties (>= 4.0.0, < 5.0) @@ -124,6 +177,7 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + shellany (0.0.1) slop (3.6.0) sprockets (2.12.3) hike (~> 1.2) @@ -138,6 +192,8 @@ GEM thor (0.19.1) thread_safe (0.3.4) tilt (1.4.1) + timers (4.0.1) + hitimes turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) @@ -152,15 +208,22 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) + win32console (1.3.2) PLATFORMS x64-mingw32 DEPENDENCIES + bootstrap-sass byebug coffee-rails (~> 4.1.0) + coffee-script-source (= 1.8.0) + guard + guard-minitest jbuilder (~> 2.0) jquery-rails + mini_backtrace + minitest-reporters pg (= 0.17.1) rails (= 4.2.0) rails_12factor (= 0.0.2) diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..7d14ba4 --- /dev/null +++ b/Guardfile @@ -0,0 +1,113 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +## Uncomment and set this to only include directories you want to watch +# directories %w(app lib config test spec features) + +## Uncomment to clear the screen before every task +# clearing :on + +## Guard internally checks for changes in the Guardfile and exits. +## If you want Guard to automatically start up again, run guard in a +## shell loop, e.g.: +## +## $ while bundle exec guard; do echo "Restarting Guard..."; done +## +## Note: if you are using the `directories` clause above and you are not +## watching the project directory ('.'), then you will want to move +## the Guardfile to a watched dir and symlink it back, e.g. +# +# $ mkdir config +# $ mv Guardfile config/ +# $ ln -s config/Guardfile . +# +# and, you'll have to watch "config/Guardfile" instead of "Guardfile" + +guard :minitest, all_on_start:true do + +=begin + + ####################### From RailsTutorial.org 3.42 ######################### + + watch(%r{^test/(.*)/?(.*)_test\.rb$}) + watch('test/test_helper.rb') { 'test' } + watch('config/routes.rb') { integration_tests } + watch(%r{^app/models/(.*?)\.rb$}) do |matches| + "test/models/#{matches[1]}_test.rb" + end + watch(%r{^app/controllers/(.*?)_controller\.rb$}) do |matches| + resource_tests(matches[1]) + end + watch(%r{^app/views/([^/]*?)/.*\.html\.erb$}) do |matches| + ["test/controllers/#{matches[1]}_controller_test.rb"] + + integration_tests(matches[1]) + end + watch(%r{^app/helpers/(.*?)_helper\.rb$}) do |matches| + integration_tests(matches[1]) + end + watch('app/views/layouts/application.html.erb') do + 'test/integration/site_layout_test.rb' + end + watch('app/helpers/sessions_helper.rb') do + integration_tests << 'test/helpers/sessions_helper_test.rb' + end + watch('app/controllers/sessions_controller.rb') do + ['test/controllers/sessions_controller_test.rb', + 'test/integration/users_login_test.rb'] + end + watch('app/controllers/account_activations_controller.rb') do + 'test/integration/users_signup_test.rb' + end + watch(%r{app/views/users/*}) do + resource_tests('users') + + ['test/integration/microposts_interface_test.rb'] + end +end + +# Returns the integration tests corresponding to the given resource. +def integration_tests(resource = :all) + if resource == :all + Dir["test/integration/*"] + else + Dir["test/integration/#{resource}_*.rb"] + end +end + +# Returns the controller tests corresponding to the given resource. +def controller_test(resource) + "test/controllers/#{resource}_controller_test.rb" +end + +# Returns all tests for the given resource. +def resource_tests(resource) + integration_tests(resource) << controller_test(resource) +end + + # with Minitest::Unit + ### watch(%r{^test/(.*)\/?test_(.*)\.rb$}) + ### watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" } + ### watch(%r{^test/test_helper\.rb$}) { 'test' } + + # with Minitest::Spec + # watch(%r{^spec/(.*)_spec\.rb$}) + # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + # watch(%r{^spec/spec_helper\.rb$}) { 'spec' } + + # Rails 4 + # watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } + # watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' } + # watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" } + # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" } + # watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" } + # watch(%r{^test/.+_test\.rb$}) + # watch(%r{^test/test_helper\.rb$}) { 'test' } + + # Rails < 4 + # watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" } + # watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" } + # watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" } +### end + +=end + + end \ No newline at end of file diff --git a/app/assets/javascripts/static_pages.coffee b/app/assets/javascripts/static_pages.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/static_pages.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/debats.css.scss b/app/assets/stylesheets/debats.css.scss new file mode 100644 index 0000000..095a81c --- /dev/null +++ b/app/assets/stylesheets/debats.css.scss @@ -0,0 +1,25 @@ +@import "bootstrap-sprockets"; +@import "bootstrap"; + +/* Universal */ + +body { + padding-top: 60px; +} + +section { + overflow: auto; +} + +textarea { + resize: vertical; +} + +.center { + text-align: center; +} + +.center h1 { + margin-bottom: 10px; +} + diff --git a/app/assets/stylesheets/footer.scss b/app/assets/stylesheets/footer.scss new file mode 100644 index 0000000..3e4acf7 --- /dev/null +++ b/app/assets/stylesheets/footer.scss @@ -0,0 +1,30 @@ +/* footer */ + +footer { + margin-top: 45px; + padding-top: 5px; + border-top: 1px solid #eaeaea; + color: #777; +} + +footer a { + color: #555; +} + +footer a:hover { + color: #222; +} + +footer small { + float: left; +} + +footer ul { + float: right; + list-style: none; +} + +footer ul li { + float: left; + margin-left: 15px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/header.scss b/app/assets/stylesheets/header.scss new file mode 100644 index 0000000..2bf327c --- /dev/null +++ b/app/assets/stylesheets/header.scss @@ -0,0 +1,18 @@ + +/* header */ + +#logo { + float: left; + margin-right: 10px; + font-size: 1.7em; + color: #fff; + text-transform: uppercase; + letter-spacing: -1px; + padding-top: 9px; + font-weight: bold; +} + +#logo:hover { + color: #fff; + text-decoration: none; +} \ No newline at end of file diff --git a/app/assets/stylesheets/static_pages.scss b/app/assets/stylesheets/static_pages.scss new file mode 100644 index 0000000..d55836c --- /dev/null +++ b/app/assets/stylesheets/static_pages.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the StaticPages controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/typo.scss b/app/assets/stylesheets/typo.scss new file mode 100644 index 0000000..204dd7d --- /dev/null +++ b/app/assets/stylesheets/typo.scss @@ -0,0 +1,27 @@ +/* typography */ + +h1, h2, h3, h4, h5, h6 { + line-height: 1; +} + +h1 { + font-size: 3em; + letter-spacing: -2px; + margin-bottom: 30px; + text-align: center; +} + +h2 { + font-size: 1.2em; + letter-spacing: -1px; + margin-bottom: 30px; + text-align: center; + font-weight: normal; + color: #777; +} + +p { + font-size: 1.1em; + line-height: 1.7em; +} + diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb new file mode 100644 index 0000000..9c48608 --- /dev/null +++ b/app/controllers/static_pages_controller.rb @@ -0,0 +1,5 @@ +class StaticPagesController < ApplicationController + def a_propos + + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..649cdf5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,13 @@ module ApplicationHelper + + # Returns the full title of the page + def full_title(page_title = '') + base_title = "Débats.fr" + if page_title.empty? + base_title + else + "#{page_title} | #{base_title}" + end + end + end diff --git a/app/helpers/static_pages_helper.rb b/app/helpers/static_pages_helper.rb new file mode 100644 index 0000000..2d63e79 --- /dev/null +++ b/app/helpers/static_pages_helper.rb @@ -0,0 +1,2 @@ +module StaticPagesHelper +end diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb new file mode 100644 index 0000000..4fba2ce --- /dev/null +++ b/app/views/layouts/_footer.html.erb @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb new file mode 100644 index 0000000..ad2c043 --- /dev/null +++ b/app/views/layouts/_header.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/views/layouts/_shim.html.erb b/app/views/layouts/_shim.html.erb new file mode 100644 index 0000000..4a895f7 --- /dev/null +++ b/app/views/layouts/_shim.html.erb @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 24953c7..7c72ce8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,14 +1,18 @@ - Debats + <%= full_title(yield(:title)) %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> + <%= render 'layouts/shim' %> - -<%= yield %> +<%= render 'layouts/header' %> +
+ <%= yield %> + <%= render 'layouts/footer' %> +
diff --git a/app/views/static_pages/a_propos.html.erb b/app/views/static_pages/a_propos.html.erb new file mode 100644 index 0000000..131fc8a --- /dev/null +++ b/app/views/static_pages/a_propos.html.erb @@ -0,0 +1,13 @@ +<% provide(:title,"À propos") %> +
+

À propos

+

+Pourquoi Débats.fr ? +

+

+ Description du projet +

+

+ <%= link_to "Créer un compte", '#', class: "btn btn-lg btn-primary" %> +

+
\ No newline at end of file diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cd..0b5e530 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -2,6 +2,7 @@ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } +Rails.backtrace_cleaner.add_silencer { |line| line =~ /Ruby21-x64/} # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers! diff --git a/config/routes.rb b/config/routes.rb index 3f66539..2a2aa9a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,7 @@ Rails.application.routes.draw do + root 'static_pages#a_propos' + get 'static_pages/a_propos' + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb new file mode 100644 index 0000000..066c70e --- /dev/null +++ b/test/controllers/static_pages_controller_test.rb @@ -0,0 +1,14 @@ +require 'test_helper' + +class StaticPagesControllerTest < ActionController::TestCase + + def setup + @base_title = " | Débats.fr" + end + + test "should get a_propos" do + get :a_propos + assert_response :success + assert_select "title","À propos#{@base_title}" + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 92e39b2..13e3561 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,6 +1,8 @@ ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' +require 'minitest/reporters' +Minitest::Reporters.use! class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.