From af827b7e77ba03a895b840932c7abe022aa7a03b Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Sat, 3 Oct 2015 06:38:11 +0200 Subject: [PATCH] setting up first view --- Gemfile | 2 +- Gemfile.lock | 7 +++ app/assets/javascripts/application.js | 1 + app/assets/javascripts/suporters.coffee | 3 - .../{application.css => application.sass} | 2 + app/controllers/suporters_controller.rb | 2 - app/controllers/supporters_controller.rb | 5 ++ app/helpers/suporters_helper.rb | 2 - app/models/supporter.rb | 19 +++---- app/views/layouts/application.html.erb | 14 ----- app/views/layouts/application.html.slim | 9 +++ app/views/supporters/new.slim | 1 + config/routes.rb | 55 +------------------ 13 files changed, 37 insertions(+), 85 deletions(-) delete mode 100644 app/assets/javascripts/suporters.coffee rename app/assets/stylesheets/{application.css => application.sass} (93%) delete mode 100644 app/controllers/suporters_controller.rb create mode 100644 app/controllers/supporters_controller.rb delete mode 100644 app/helpers/suporters_helper.rb delete mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/layouts/application.html.slim create mode 100644 app/views/supporters/new.slim diff --git a/Gemfile b/Gemfile index b2d1b60..3aa501b 100644 --- a/Gemfile +++ b/Gemfile @@ -30,7 +30,7 @@ gem 'sdoc', '~> 0.4.0', group: :doc # gem 'capistrano-rails', group: :development gem 'mongoid', '~> 5.0.0' - +gem 'bootstrap-sass', '~> 3.3.5' gem 'slim' gem 'slim-rails' diff --git a/Gemfile.lock b/Gemfile.lock index c4542cd..0793634 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,8 +37,14 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) + autoprefixer-rails (6.0.3) + execjs + json binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) + bootstrap-sass (3.3.5.1) + autoprefixer-rails (>= 5.0.0.1) + sass (>= 3.3.0) bson (3.2.4) builder (3.2.2) byebug (6.0.2) @@ -183,6 +189,7 @@ PLATFORMS ruby DEPENDENCIES + bootstrap-sass (~> 3.3.5) byebug coffee-rails (~> 4.1.0) jbuilder (~> 2.0) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e07c5a8..7465856 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,4 +13,5 @@ //= require jquery //= require jquery_ujs //= require turbolinks +//= require bootstrap-sprockets //= require_tree . diff --git a/app/assets/javascripts/suporters.coffee b/app/assets/javascripts/suporters.coffee deleted file mode 100644 index 24f83d1..0000000 --- a/app/assets/javascripts/suporters.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# 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/application.css b/app/assets/stylesheets/application.sass similarity index 93% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.sass index f9cd5b3..c12d7f0 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.sass @@ -13,3 +13,5 @@ *= require_tree . *= require_self */ +@import "bootstrap-sprockets" +@import "bootstrap" diff --git a/app/controllers/suporters_controller.rb b/app/controllers/suporters_controller.rb deleted file mode 100644 index f52bc72..0000000 --- a/app/controllers/suporters_controller.rb +++ /dev/null @@ -1,2 +0,0 @@ -class SuportersController < ApplicationController -end diff --git a/app/controllers/supporters_controller.rb b/app/controllers/supporters_controller.rb new file mode 100644 index 0000000..c64d6b2 --- /dev/null +++ b/app/controllers/supporters_controller.rb @@ -0,0 +1,5 @@ +class SupportersController < ApplicationController + def new + @supporter = Supporter.new + end +end diff --git a/app/helpers/suporters_helper.rb b/app/helpers/suporters_helper.rb deleted file mode 100644 index 547372d..0000000 --- a/app/helpers/suporters_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module SuportersHelper -end diff --git a/app/models/supporter.rb b/app/models/supporter.rb index da36516..50fa02b 100644 --- a/app/models/supporter.rb +++ b/app/models/supporter.rb @@ -1,16 +1,15 @@ class Supporter include Mongoid::Document - field :first_name, type: String - field :last_name, type: String - field :street, type: String - field :zip, type: Integer - field :email, type: String - field :support, type: String # Indicates the type of support - field :votable, type: Boolean - + field :first_name, type: String + field :last_name, type: String + field :street, type: String + field :zip, type: Integer + field :email, type: String + field :support, type: String # Indicates the type of support field :age_category, type: String - validates :email, presence: true, uniqueness: true - validates :support, presence: true + validates :email, presence: true, uniqueness: true + validates :support, presence: true + validates :age_category, presence: true end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index cfe8483..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Ch420 - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim new file mode 100644 index 0000000..ab0b302 --- /dev/null +++ b/app/views/layouts/application.html.slim @@ -0,0 +1,9 @@ +html + head + title Ch420 + = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true + = javascript_include_tag 'application', 'data-turbolinks-track' => true + = csrf_meta_tags + body + .container + = yield diff --git a/app/views/supporters/new.slim b/app/views/supporters/new.slim new file mode 100644 index 0000000..b759d9f --- /dev/null +++ b/app/views/supporters/new.slim @@ -0,0 +1 @@ +h1 Test diff --git a/config/routes.rb b/config/routes.rb index 3f66539..3c157d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,56 +1,5 @@ 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". + root 'supporters#new' - # 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 + resources :supporters end