diff --git a/.gitignore b/.gitignore index dcc5b36..416f2fc 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ /yarn-error.log .byebug_history +.DS_Store diff --git a/Gemfile b/Gemfile index d35de94..fcd8638 100644 --- a/Gemfile +++ b/Gemfile @@ -6,10 +6,18 @@ git_source(:github) do |repo_name| end + +gem 'bootstrap-sass' + +gem 'simple_form' +gem 'geocoder' +gem 'carrierwave', '~> 1.0' + +gem 'stripe' +gem 'cloudinary' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.4' -# Use sqlite3 as the database for Active Record -gem 'sqlite3' + # Use Puma as the app server gem 'puma', '~> 3.7' # Use SCSS for stylesheets @@ -18,7 +26,7 @@ gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby - +gem 'devise' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks @@ -39,6 +47,8 @@ group :development, :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13' gem 'selenium-webdriver' + # Use sqlite3 as the database for Active Record + gem 'sqlite3' end group :development do @@ -46,5 +56,8 @@ group :development do gem 'web-console', '>= 3.3.0' end +group :production do + gem 'pg' +end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 1500572..452197a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,7 +41,15 @@ GEM addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) arel (8.0.0) + autoprefixer-rails (7.1.5) + execjs + aws_cf_signer (0.1.3) + bcrypt (3.1.11) + bcrypt (3.1.11-x64-mingw32) bindex (0.5.0) + bootstrap-sass (3.3.7) + autoprefixer-rails (>= 5.2.1) + sass (>= 3.3.4) builder (3.2.3) byebug (9.1.0) capybara (2.15.4) @@ -51,8 +59,15 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) + carrierwave (1.2.1) + activemodel (>= 4.0.0) + activesupport (>= 4.0.0) + mime-types (>= 1.16) childprocess (0.8.0) ffi (~> 1.0, >= 1.0.11) + cloudinary (1.8.1) + aws_cf_signer + rest-client coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) @@ -62,11 +77,25 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.0.5) crass (1.0.2) + devise (4.3.0) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 5.2) + responders + warden (~> 1.2.3) + domain_name (0.5.20170404) + unf (>= 0.0.5, < 1.0.0) erubi (1.7.0) execjs (2.7.0) + faraday (0.13.1) + multipart-post (>= 1.2, < 3) + ffi (1.9.18) ffi (1.9.18-x64-mingw32) + geocoder (1.4.4) globalid (0.4.0) activesupport (>= 4.2.0) + http-cookie (1.0.3) + domain_name (~> 0.5) i18n (0.9.0) concurrent-ruby (~> 1.0) jbuilder (2.7.0) @@ -85,9 +114,16 @@ GEM mini_portile2 (2.3.0) minitest (5.10.3) multi_json (1.12.2) + multipart-post (2.0.0) + netrc (0.11.0) nio4r (2.1.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) nokogiri (1.8.1-x64-mingw32) mini_portile2 (~> 2.3.0) + orm_adapter (0.5.0) + pg (0.21.0) + pg (0.21.0-x64-mingw32) public_suffix (3.0.0) puma (3.10.0) rack (2.0.3) @@ -120,6 +156,18 @@ GEM rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) + rest-client (2.0.2) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) + rest-client (2.0.2-x64-mingw32) + ffi (~> 1.9) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) rubyzip (1.2.1) sass (3.5.2) sass-listen (~> 4.0.0) @@ -135,6 +183,9 @@ GEM selenium-webdriver (3.6.0) childprocess (~> 0.5) rubyzip (~> 1.0) + simple_form (3.5.0) + actionpack (> 4, < 5.2) + activemodel (> 4, < 5.2) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -142,7 +193,10 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + sqlite3 (1.3.13) sqlite3 (1.3.13-x64-mingw32) + stripe (3.6.0) + faraday (~> 0.10) thor (0.20.0) thread_safe (0.3.6) tilt (2.0.8) @@ -155,6 +209,12 @@ GEM tzinfo (>= 1.0.0) uglifier (3.2.0) execjs (>= 0.3.0, < 3) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.4) + unf_ext (0.0.7.4-x64-mingw32) + warden (1.2.7) + rack (>= 1.0) web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) @@ -167,22 +227,31 @@ GEM nokogiri (~> 1.3) PLATFORMS + ruby x64-mingw32 DEPENDENCIES + bootstrap-sass byebug capybara (~> 2.13) + carrierwave (~> 1.0) + cloudinary coffee-rails (~> 4.2) + devise + geocoder jbuilder (~> 2.5) + pg puma (~> 3.7) rails (~> 5.1.4) sass-rails (~> 5.0) selenium-webdriver + simple_form sqlite3 + stripe turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) web-console (>= 3.3.0) BUNDLED WITH - 1.16.0.pre.2 + 1.16.0.pre.3 diff --git a/OnlineStore b/OnlineStore new file mode 160000 index 0000000..3faa00c --- /dev/null +++ b/OnlineStore @@ -0,0 +1 @@ +Subproject commit 3faa00c3be93e801c7b852d3961ad96f3d5303b4 diff --git a/README.md b/README.md index 7db80e4..65037e4 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,77 @@ # README +Art House -This README would normally document whatever steps are necessary to get the -application up and running. +A one-sided online store that provides users with the ability to view, inspect and +purchase art posted by various potential sellers. -Things you may want to cover: +Tests -* Ruby version +There are several tests within the test.rb file .e.g. -* System dependencies +require 'test_helper' -* Configuration +class CustomersControllerTest < ActionDispatch::IntegrationTest + setup do + @customer = customers(:one) + end -* Database creation + test "should get index" do + get customers_url + assert_response :success + end -* Database initialization + test "should get new" do + get new_customer_url + assert_response :success + end -* How to run the test suite + test "should create customer" do + assert_difference('Customer.count') do + post customers_url, params: { customer: { email: @customer.email, login: @customer.login, name: @customer.name } } + end -* Services (job queues, cache servers, search engines, etc.) + assert_redirected_to customer_url(Customer.last) + end -* Deployment instructions + test "should show customer" do + get customer_url(@customer) + assert_response :success + end -* ... + This allowed for extensive debugging and resolution of conflicts within the source code. + + + + +Built With + +Ruby on Rails - The web framework used +Ruby Gems - Dependency Management +Stripe - To generate payments. +Contributing + + +Versioning + +We use Github as our primary source of version control. https://github.com/HackStoreCode/OnlineStore + +Authors + +Gregory Parkes-skelly +Alex Pham +Ali Ansari + +License + +This project is licensed under the MIT License - see the LICENSE.md file for details + +Acknowledgments + +Hat tip to anyone who's code was used +Inspiration +etc + + +* ERD + * +![alt tag](https://raw.githubusercontent.com/https://github.com/HackStoreCode/OnlineStore/master/erd/erd.png) diff --git a/app/assets/javascripts/charges.coffee b/app/assets/javascripts/charges.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/charges.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/javascripts/customers.coffee b/app/assets/javascripts/customers.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/customers.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/javascripts/home.coffee b/app/assets/javascripts/home.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/home.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/javascripts/order_groups.coffee b/app/assets/javascripts/order_groups.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/order_groups.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/javascripts/orders.coffee b/app/assets/javascripts/orders.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/orders.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/javascripts/payments.coffee b/app/assets/javascripts/payments.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/payments.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/javascripts/products.coffee b/app/assets/javascripts/products.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/products.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/javascripts/users.coffee b/app/assets/javascripts/users.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/users.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/application.css b/app/assets/stylesheets/application.scss similarity index 84% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.scss index d05ea0f..71e7b58 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.scss @@ -10,6 +10,16 @@ * files in this directory. Styles in this file should be added after the last require_* statement. * It is generally better to create a new file per style scope. * + *= require_tree . *= require_self */ +@import "bootstrap-sprockets"; +@import "bootstrap"; + +html, body { + max-width: 100%; + overflow-x: hidden; +.container {margin: 4% + +} diff --git a/app/assets/stylesheets/charges.scss b/app/assets/stylesheets/charges.scss new file mode 100644 index 0000000..3ef2d76 --- /dev/null +++ b/app/assets/stylesheets/charges.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the charges 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/customers.scss b/app/assets/stylesheets/customers.scss new file mode 100644 index 0000000..892b0ad --- /dev/null +++ b/app/assets/stylesheets/customers.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the customers 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/home.css b/app/assets/stylesheets/home.css new file mode 100644 index 0000000..8b9461e --- /dev/null +++ b/app/assets/stylesheets/home.css @@ -0,0 +1,5 @@ +// Place all the styles related to the home controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ + +.body {background-image: url(/assets/images/bi.jpg);} diff --git a/app/assets/stylesheets/order_groups.scss b/app/assets/stylesheets/order_groups.scss new file mode 100644 index 0000000..7fc32c9 --- /dev/null +++ b/app/assets/stylesheets/order_groups.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the OrderGroups 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/orders.scss b/app/assets/stylesheets/orders.scss new file mode 100644 index 0000000..7415069 --- /dev/null +++ b/app/assets/stylesheets/orders.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Orders 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/payments.scss b/app/assets/stylesheets/payments.scss new file mode 100644 index 0000000..09456e2 --- /dev/null +++ b/app/assets/stylesheets/payments.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Payments 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/products.scss b/app/assets/stylesheets/products.scss new file mode 100644 index 0000000..12a047c --- /dev/null +++ b/app/assets/stylesheets/products.scss @@ -0,0 +1,107 @@ +// Place all the styles related to the Products controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +@import url('https://fonts.googleapis.com/css?family=Raleway:100,400,700'); + +// Variables +$font: 'Raleway', sans-serif; +$white: #fff; +$black: #212129; +$max: 100%; + +* { + margin: 0; + padding: 0; + font-family: $font; + text-decoration: none; + outline: none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + -o-box-sizing: border-box; + box-sizing: border-box; +} + +img { + max-width: $max; +} + +html, body { + height: 100vh; +} + +body { + background: $white; +} + +.container { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + .flex-block { + margin: 10px; + // border: 1px solid #000; + border-radius: 5px; + box-shadow: 0px 0px 8px 1px $black; + padding: 10px; + a { + display: block; + background: $white; + color: $white; + text-align: center; + padding: 5px; + margin-top: 10px; + text-transform: uppercase; + letter-spacing: 0.1em; + border-radius: 3px; + transition: 300ms; + &:hover { + box-shadow: 0px 0px 8px 1px $black; + transition: 300ms; + } + } + } +} + +@media screen and(max-width: 1020px) { + .container { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + flex-wrap: wrap; + .flex-block { + position: relative; + max-width: 400px; + } + } +} + +@media screen and(max-width: 858px) { + .container { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + flex-wrap: wrap; + .flex-block { + position: relative; + max-width: 350px; + } + } +} + +@media screen and(max-width: 758px) { + .container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + flex-wrap: wrap; + .flex-block { + position: relative; + max-width: 100%; + } + } +} diff --git a/app/assets/stylesheets/scaffolds.scss b/app/assets/stylesheets/scaffolds.scss new file mode 100644 index 0000000..6045188 --- /dev/null +++ b/app/assets/stylesheets/scaffolds.scss @@ -0,0 +1,84 @@ +body { + background-color: #fff; + color: #333; + margin: 33px; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; + + &:visited { + color: #666; + } + + &:hover { + color: #fff; + background-color: #000; + } +} + +th { + padding-bottom: 5px; +} + +td { + padding: 0 5px 7px; +} + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px 7px 0; + margin-bottom: 20px; + background-color: #f0f0f0; + + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px -7px 0; + background-color: #c00; + color: #fff; + } + + ul li { + font-size: 12px; + list-style: square; + } +} + +label { + display: block; +} diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss new file mode 100644 index 0000000..1efc835 --- /dev/null +++ b/app/assets/stylesheets/users.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the users 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/charges_controller.rb b/app/controllers/charges_controller.rb new file mode 100644 index 0000000..264f666 --- /dev/null +++ b/app/controllers/charges_controller.rb @@ -0,0 +1,27 @@ +class ChargesController < ApplicationController + +def new +end + +def create + # Amount in cents + @amount = 500 + + customer = Stripe::Customer.create( + :email => params[:stripeEmail], + :source => params[:stripeToken] + ) + + charge = Stripe::Charge.create( + :customer => customer.id, + :amount => @amount, + :description => 'Rails Stripe customer', + :currency => 'usd' + ) + +rescue Stripe::CardError => e + flash[:error] = e.message + redirect_to new_charge_path +end + +end diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb new file mode 100644 index 0000000..a07c656 --- /dev/null +++ b/app/controllers/customers_controller.rb @@ -0,0 +1,74 @@ +class CustomersController < ApplicationController + before_action :set_customer, only: [:show, :edit, :update, :destroy] + + # GET /customers + # GET /customers.json + def index + @customers = Customer.all + end + + # GET /customers/1 + # GET /customers/1.json + def show + end + + # GET /customers/new + def new + @customer = Customer.new + end + + # GET /customers/1/edit + def edit + end + + # POST /customers + # POST /customers.json + def create + @customer = Customer.new(customer_params) + + respond_to do |format| + if @customer.save + format.html { redirect_to @customer, notice: 'Customer was successfully created.' } + format.json { render :show, status: :created, location: @customer } + else + format.html { render :new } + format.json { render json: @customer.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /customers/1 + # PATCH/PUT /customers/1.json + def update + respond_to do |format| + if @customer.update(customer_params) + format.html { redirect_to @customer, notice: 'Customer was successfully updated.' } + format.json { render :show, status: :ok, location: @customer } + else + format.html { render :edit } + format.json { render json: @customer.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /customers/1 + # DELETE /customers/1.json + def destroy + @customer.destroy + respond_to do |format| + format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_customer + @customer = Customer.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def customer_params + params.require(:customer).permit(:name, :email, :login) + end +end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..95f2992 --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,4 @@ +class HomeController < ApplicationController + def index + end +end diff --git a/app/controllers/order_groups_controller.rb b/app/controllers/order_groups_controller.rb new file mode 100644 index 0000000..3f3463e --- /dev/null +++ b/app/controllers/order_groups_controller.rb @@ -0,0 +1,74 @@ +class OrderGroupsController < ApplicationController + before_action :set_order_group, only: [:show, :edit, :update, :destroy] + + # GET /order_groups + # GET /order_groups.json + def index + @order_groups = OrderGroup.all + end + + # GET /order_groups/1 + # GET /order_groups/1.json + def show + end + + # GET /order_groups/new + def new + @order_group = OrderGroup.new + end + + # GET /order_groups/1/edit + def edit + end + + # POST /order_groups + # POST /order_groups.json + def create + @order_group = OrderGroup.new(order_group_params) + + respond_to do |format| + if @order_group.save + format.html { redirect_to @order_group, notice: 'Order group was successfully created.' } + format.json { render :show, status: :created, location: @order_group } + else + format.html { render :new } + format.json { render json: @order_group.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /order_groups/1 + # PATCH/PUT /order_groups/1.json + def update + respond_to do |format| + if @order_group.update(order_group_params) + format.html { redirect_to @order_group, notice: 'Order group was successfully updated.' } + format.json { render :show, status: :ok, location: @order_group } + else + format.html { render :edit } + format.json { render json: @order_group.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /order_groups/1 + # DELETE /order_groups/1.json + def destroy + @order_group.destroy + respond_to do |format| + format.html { redirect_to order_groups_url, notice: 'Order group was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_order_group + @order_group = OrderGroup.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def order_group_params + params.require(:order_group).permit(:order_date, :user_id) + end +end diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb new file mode 100644 index 0000000..5659462 --- /dev/null +++ b/app/controllers/orders_controller.rb @@ -0,0 +1,74 @@ +class OrdersController < ApplicationController + before_action :set_order, only: [:show, :edit, :update, :destroy] + + # GET /orders + # GET /orders.json + def index + @orders = Order.all + end + + # GET /orders/1 + # GET /orders/1.json + def show + end + + # GET /orders/new + def new + @order = Order.new + end + + # GET /orders/1/edit + def edit + end + + # POST /orders + # POST /orders.json + def create + @order = Order.new(order_params) + + respond_to do |format| + if @order.save + format.html { redirect_to @order, notice: 'Order was successfully created.' } + format.json { render :show, status: :created, location: @order } + else + format.html { render :new } + format.json { render json: @order.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /orders/1 + # PATCH/PUT /orders/1.json + def update + respond_to do |format| + if @order.update(order_params) + format.html { redirect_to @order, notice: 'Order was successfully updated.' } + format.json { render :show, status: :ok, location: @order } + else + format.html { render :edit } + format.json { render json: @order.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /orders/1 + # DELETE /orders/1.json + def destroy + @order.destroy + respond_to do |format| + format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_order + @order = Order.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def order_params + params.require(:order).permit(:order_date, :product_id, :ordergroup_id) + end +end diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb new file mode 100644 index 0000000..22c9d59 --- /dev/null +++ b/app/controllers/payments_controller.rb @@ -0,0 +1,74 @@ +class PaymentsController < ApplicationController + before_action :set_payment, only: [:show, :edit, :update, :destroy] + + # GET /payments + # GET /payments.json + def index + @payments = Payment.all + end + + # GET /payments/1 + # GET /payments/1.json + def show + end + + # GET /payments/new + def new + @payment = Payment.new + end + + # GET /payments/1/edit + def edit + end + + # POST /payments + # POST /payments.json + def create + @payment = Payment.new(payment_params) + + respond_to do |format| + if @payment.save + format.html { redirect_to @payment, notice: 'Payment was successfully created.' } + format.json { render :show, status: :created, location: @payment } + else + format.html { render :new } + format.json { render json: @payment.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /payments/1 + # PATCH/PUT /payments/1.json + def update + respond_to do |format| + if @payment.update(payment_params) + format.html { redirect_to @payment, notice: 'Payment was successfully updated.' } + format.json { render :show, status: :ok, location: @payment } + else + format.html { render :edit } + format.json { render json: @payment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /payments/1 + # DELETE /payments/1.json + def destroy + @payment.destroy + respond_to do |format| + format.html { redirect_to payments_url, notice: 'Payment was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_payment + @payment = Payment.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def payment_params + params.require(:payment).permit(:payment_date, :description, :total_amount, :ordergroup_id) + end +end diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb new file mode 100644 index 0000000..0238376 --- /dev/null +++ b/app/controllers/products_controller.rb @@ -0,0 +1,80 @@ +class ProductsController < ApplicationController + before_action :set_product, only: [:show, :edit, :update, :destroy] + + # GET /products + # GET /products.json + def index + @products = Product.all + end + + # GET /products/1 + # GET /products/1.json + def show + end + + # GET /products/new + def new + @product = Product.new + end + + # GET /products/1/edit + def edit + end + + # POST /products + # POST /products.json + def create + @product = Product.new(product_params) + + @product.user_id = current_user.id + + respond_to do |format| + if @product.save + format.html { redirect_to @product, notice: 'Product was successfully created.' } + format.json { render :show, status: :created, location: @product } + else + format.html { render :new } + format.json { render json: @product.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /products/1 + # PATCH/PUT /products/1.json + def update + respond_to do |format| + if @product.update(product_params) + format.html { redirect_to @product, notice: 'Product was successfully updated.' } + format.json { render :show, status: :ok, location: @product } + else + format.html { render :edit } + format.json { render json: @product.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /products/1 + # DELETE /products/1.json + def destroy + @product.destroy + respond_to do |format| + format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_product + @product = Product.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def product_params + + params.require(:product).permit(:name, :price, :description, :available, :image) + + params.require(:product).permit(:description, :price, :image, :user_id) + + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..3544e08 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,74 @@ +class UsersController < ApplicationController + before_action :set_user, only: [:show, :edit, :update, :destroy] + + # GET /users + # GET /users.json + def index + @users = User.all + end + + # GET /users/1 + # GET /users/1.json + def show + end + + # GET /users/new + def new + @user = User.new + end + + # GET /users/1/edit + def edit + end + + # POST /users + # POST /users.json + def create + @user = User.new(user_params) + + respond_to do |format| + if @user.save + format.html { redirect_to @user, notice: 'User was successfully created.' } + format.json { render :show, status: :created, location: @user } + else + format.html { render :new } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /users/1 + # PATCH/PUT /users/1.json + def update + respond_to do |format| + if @user.update(user_params) + format.html { redirect_to @user, notice: 'User was successfully updated.' } + format.json { render :show, status: :ok, location: @user } + else + format.html { render :edit } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /users/1 + # DELETE /users/1.json + def destroy + @user.destroy + respond_to do |format| + format.html { redirect_to users_url, notice: 'User was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_user + @user = User.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def user_params + params.require(:user).permit(:name, :email, :login) + end +end diff --git a/app/helpers/charges_helper.rb b/app/helpers/charges_helper.rb new file mode 100644 index 0000000..414ee90 --- /dev/null +++ b/app/helpers/charges_helper.rb @@ -0,0 +1,2 @@ +module ChargesHelper +end diff --git a/app/helpers/customers_helper.rb b/app/helpers/customers_helper.rb new file mode 100644 index 0000000..a07ce29 --- /dev/null +++ b/app/helpers/customers_helper.rb @@ -0,0 +1,2 @@ +module CustomersHelper +end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100644 index 0000000..23de56a --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,2 @@ +module HomeHelper +end diff --git a/app/helpers/order_groups_helper.rb b/app/helpers/order_groups_helper.rb new file mode 100644 index 0000000..68e9e15 --- /dev/null +++ b/app/helpers/order_groups_helper.rb @@ -0,0 +1,2 @@ +module OrderGroupsHelper +end diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb new file mode 100644 index 0000000..443227f --- /dev/null +++ b/app/helpers/orders_helper.rb @@ -0,0 +1,2 @@ +module OrdersHelper +end diff --git a/app/helpers/payments_helper.rb b/app/helpers/payments_helper.rb new file mode 100644 index 0000000..c1b884f --- /dev/null +++ b/app/helpers/payments_helper.rb @@ -0,0 +1,2 @@ +module PaymentsHelper +end diff --git a/app/helpers/products_helper.rb b/app/helpers/products_helper.rb new file mode 100644 index 0000000..ab5c42b --- /dev/null +++ b/app/helpers/products_helper.rb @@ -0,0 +1,2 @@ +module ProductsHelper +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb new file mode 100644 index 0000000..5710e02 --- /dev/null +++ b/app/mailers/user_mailer.rb @@ -0,0 +1,9 @@ +class UserMailer < ApplicationMailer + default from: 'notifications@example.com' + + def welcome_email(user) + @user = user + @url = 'http//:example.com/login' + mail(to: @user.email, subject: 'Welcome to my Awesome Site ') + end +end diff --git a/app/mailers/welcome_email.html.erb b/app/mailers/welcome_email.html.erb new file mode 100644 index 0000000..a42058a --- /dev/null +++ b/app/mailers/welcome_email.html.erb @@ -0,0 +1,23 @@ + + + + + + + +

Welcome to example.com, <%= @user.name %>

+ +

+ You have successfully signed up to example.com,your username is: + <%= @user.login %>.
+

+ +

+ To login to the site, just follow this link: + <%= @url %>. +

+ +

Thanks for joining and have a great day!

+ + + diff --git a/app/models/customer.rb b/app/models/customer.rb new file mode 100644 index 0000000..0b52773 --- /dev/null +++ b/app/models/customer.rb @@ -0,0 +1,2 @@ +class Customer < ApplicationRecord +end diff --git a/app/models/order.rb b/app/models/order.rb new file mode 100644 index 0000000..b494acc --- /dev/null +++ b/app/models/order.rb @@ -0,0 +1,4 @@ +class Order < ApplicationRecord + belongs_to :product + belongs_to :ordergroup +end diff --git a/app/models/order_group.rb b/app/models/order_group.rb new file mode 100644 index 0000000..2369624 --- /dev/null +++ b/app/models/order_group.rb @@ -0,0 +1,3 @@ +class OrderGroup < ApplicationRecord + belongs_to :user +end diff --git a/app/models/payment.rb b/app/models/payment.rb new file mode 100644 index 0000000..5ccb3fa --- /dev/null +++ b/app/models/payment.rb @@ -0,0 +1,3 @@ +class Payment < ApplicationRecord + belongs_to :ordergroup +end diff --git a/app/models/product.rb b/app/models/product.rb new file mode 100644 index 0000000..ba5a4ab --- /dev/null +++ b/app/models/product.rb @@ -0,0 +1,3 @@ +class Product < ApplicationRecord + mount_uploader :image, ProductImageUploader +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..989875d --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,7 @@ +class User < ApplicationRecord + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + has_many :products +end diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb new file mode 100644 index 0000000..836a047 --- /dev/null +++ b/app/uploaders/image_uploader.rb @@ -0,0 +1,49 @@ +class ImageUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + # include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url(*args) + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process scale: [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process resize_to_fit: [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_whitelist + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end diff --git a/app/uploaders/product_image_uploader.rb b/app/uploaders/product_image_uploader.rb new file mode 100644 index 0000000..ce37d4e --- /dev/null +++ b/app/uploaders/product_image_uploader.rb @@ -0,0 +1,49 @@ +class ProductImageUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + # include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url(*args) + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process scale: [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process resize_to_fit: [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_whitelist + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end diff --git a/app/views/charges/create.html.erb b/app/views/charges/create.html.erb new file mode 100644 index 0000000..7d9db94 --- /dev/null +++ b/app/views/charges/create.html.erb @@ -0,0 +1 @@ +

Thanks, you paid $5.00!

diff --git a/app/views/charges/new.html.erb b/app/views/charges/new.html.erb new file mode 100644 index 0000000..ccf5735 --- /dev/null +++ b/app/views/charges/new.html.erb @@ -0,0 +1,18 @@ +<%= form_tag charges_path do %> +
+ <% if flash[:error].present? %> +
+

<%= flash[:error] %>

+
+ <% end %> + +
+ + +<% end %> diff --git a/app/views/customers/_customer.json.jbuilder b/app/views/customers/_customer.json.jbuilder new file mode 100644 index 0000000..79ab40d --- /dev/null +++ b/app/views/customers/_customer.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! customer, :id, :name, :email, :login, :created_at, :updated_at +json.url customer_url(customer, format: :json) diff --git a/app/views/customers/_form.html.erb b/app/views/customers/_form.html.erb new file mode 100644 index 0000000..1fdd468 --- /dev/null +++ b/app/views/customers/_form.html.erb @@ -0,0 +1,17 @@ +<%= simple_form_for(@customer) do |f| %> + <%= f.error_notification %> + +
+ + <%= f.input :name %> + + <%= f.input :email %> + + <%= f.input :login %> + +
+ +
+ <%= f.button :submit %> +
+<% end %> diff --git a/app/views/customers/edit.html.erb b/app/views/customers/edit.html.erb new file mode 100644 index 0000000..baafc6f --- /dev/null +++ b/app/views/customers/edit.html.erb @@ -0,0 +1,6 @@ +

Editing Customer

+ +<%= render 'form', customer: @customer %> + +<%= link_to 'Show', @customer %> | +<%= link_to 'Back', customers_path %> diff --git a/app/views/customers/index.html.erb b/app/views/customers/index.html.erb new file mode 100644 index 0000000..288a8b2 --- /dev/null +++ b/app/views/customers/index.html.erb @@ -0,0 +1,31 @@ +

<%= notice %>

+ +

Customers

+ + + + + + + + + + + + + <% @customers.each do |customer| %> + + + + + + + + + <% end %> + +
NameEmailLogin
<%= customer.name %><%= customer.email %><%= customer.login %><%= link_to 'Show', customer %><%= link_to 'Edit', edit_customer_path(customer) %><%= link_to 'Destroy', customer, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Customer', new_customer_path %> diff --git a/app/views/customers/index.json.jbuilder b/app/views/customers/index.json.jbuilder new file mode 100644 index 0000000..f5a2f21 --- /dev/null +++ b/app/views/customers/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @customers, partial: 'customers/customer', as: :customer diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb new file mode 100644 index 0000000..1088183 --- /dev/null +++ b/app/views/customers/new.html.erb @@ -0,0 +1,5 @@ +

New Customer

+ +<%= render 'form', customer: @customer %> + +<%= link_to 'Back', customers_path %> diff --git a/app/views/customers/show.html.erb b/app/views/customers/show.html.erb new file mode 100644 index 0000000..e39b515 --- /dev/null +++ b/app/views/customers/show.html.erb @@ -0,0 +1,19 @@ +

<%= notice %>

+ +

+ Name: + <%= @customer.name %> +

+ +

+ Email: + <%= @customer.email %> +

+ +

+ Login: + <%= @customer.login %> +

+ +<%= link_to 'Edit', edit_customer_path(@customer) %> | +<%= link_to 'Back', customers_path %> diff --git a/app/views/customers/show.json.jbuilder b/app/views/customers/show.json.jbuilder new file mode 100644 index 0000000..14cfc83 --- /dev/null +++ b/app/views/customers/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "customers/customer", customer: @customer diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..949b172 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,16 @@ +

Resend confirmation instructions

+ +<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> + <%= f.error_notification %> + <%= f.full_error :confirmation_token %> + +
+ <%= f.input :email, required: true, autofocus: true %> +
+ +
+ <%= f.button :submit, "Resend confirmation instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..dc55f64 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @email %>!

+ +

You can confirm your account email through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/devise/mailer/email_changed.html.erb b/app/views/devise/mailer/email_changed.html.erb new file mode 100644 index 0000000..32f4ba8 --- /dev/null +++ b/app/views/devise/mailer/email_changed.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @email %>!

+ +<% if @resource.try(:unconfirmed_email?) %> +

We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

+<% else %> +

We're contacting you to notify you that your email has been changed to <%= @resource.email %>.

+<% end %> diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb new file mode 100644 index 0000000..b41daf4 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.erb @@ -0,0 +1,3 @@ +

Hello <%= @resource.email %>!

+ +

We're contacting you to notify you that your password has been changed.

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password. You can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..a938930 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,19 @@ +

Change your password

+ +<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> + <%= f.error_notification %> + + <%= f.input :reset_password_token, as: :hidden %> + <%= f.full_error :reset_password_token %> + +
+ <%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %> + <%= f.input :password_confirmation, label: "Confirm your new password", required: true %> +
+ +
+ <%= f.button :submit, "Change my password" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..d1503e7 --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,15 @@ +

Forgot your password?

+ +<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, required: true, autofocus: true %> +
+ +
+ <%= f.button :submit, "Send me reset password instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..5db350b --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,27 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, required: true, autofocus: true %> + + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +

Currently waiting confirmation for: <%= resource.unconfirmed_email %>

+ <% end %> + + <%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %> + <%= f.input :password_confirmation, required: false %> + <%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %> +
+ +
+ <%= f.button :submit, "Update" %> +
+<% end %> + +

Cancel my account

+ +

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..34b4279 --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,17 @@ +

Sign up

+ +<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> + <%= f.error_notification %> + +
+ <%= f.input :email, required: true, autofocus: true %> + <%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %> + <%= f.input :password_confirmation, required: true %> +
+ +
+ <%= f.button :submit, "Sign up" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..31f8a4d --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,15 @@ +

Log in

+ +<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> +
+ <%= f.input :email, required: false, autofocus: true %> + <%= f.input :password, required: false %> + <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %> +
+ +
+ <%= f.button :submit, "Log in" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb new file mode 100644 index 0000000..e6a3e41 --- /dev/null +++ b/app/views/devise/shared/_links.html.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Log in", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%> +<% end -%> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..788f62e --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,16 @@ +

Resend unlock instructions

+ +<%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> + <%= f.error_notification %> + <%= f.full_error :unlock_token %> + +
+ <%= f.input :email, required: true, autofocus: true %> +
+ +
+ <%= f.button :submit, "Resend unlock instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb new file mode 100644 index 0000000..b5ba335 --- /dev/null +++ b/app/views/home/index.html.erb @@ -0,0 +1,16 @@ +

+ + + + +

+
+

Hello,

+

This is a simple front store app

+
+

Use the menu to access Gallery or put your art to show

+

+ + + SignUp +

diff --git a/app/views/layouts/_nav.html.erb b/app/views/layouts/_nav.html.erb new file mode 100644 index 0000000..f183f6c --- /dev/null +++ b/app/views/layouts/_nav.html.erb @@ -0,0 +1,12 @@ +<% if user_signed_in? %> +
  • + <%= link_to('Logout', destroy_user_session_path, method: :delete) %> +
  • +<% else %> +
  • + <%= link_to('Login', new_user_session_path) %> +
  • +
  • + <%= link_to "Register", new_user_registration_path %> +
  • +<% end %> diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb new file mode 100644 index 0000000..1f745ac --- /dev/null +++ b/app/views/layouts/_navbar.html.erb @@ -0,0 +1,34 @@ + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 60a2314..751fd4c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,6 +9,15 @@ - <%= yield %> +
    + <%= render 'layouts/navbar'%> + <%= yield %> +
    + +

    <%= notice %>

    +

    <%= alert %>

    + + + diff --git a/app/views/layouts/charges.html.erb b/app/views/layouts/charges.html.erb new file mode 100644 index 0000000..8d51de6 --- /dev/null +++ b/app/views/layouts/charges.html.erb @@ -0,0 +1,10 @@ + + + + + + + + <%= yield %> + + diff --git a/app/views/order_groups/_form.html.erb b/app/views/order_groups/_form.html.erb new file mode 100644 index 0000000..b645404 --- /dev/null +++ b/app/views/order_groups/_form.html.erb @@ -0,0 +1,12 @@ +<%= simple_form_for(@order_group) do |f| %> + <%= f.error_notification %> + +
    + <%= f.input :order_date %> + <%= f.association :user %> +
    + +
    + <%= f.button :submit %> +
    +<% end %> diff --git a/app/views/order_groups/_order_group.json.jbuilder b/app/views/order_groups/_order_group.json.jbuilder new file mode 100644 index 0000000..47c4f50 --- /dev/null +++ b/app/views/order_groups/_order_group.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! order_group, :id, :order_date, :user_id, :created_at, :updated_at +json.url order_group_url(order_group, format: :json) diff --git a/app/views/order_groups/edit.html.erb b/app/views/order_groups/edit.html.erb new file mode 100644 index 0000000..8cea835 --- /dev/null +++ b/app/views/order_groups/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing Order Group

    + +<%= render 'form', order_group: @order_group %> + +<%= link_to 'Show', @order_group %> | +<%= link_to 'Back', order_groups_path %> diff --git a/app/views/order_groups/index.html.erb b/app/views/order_groups/index.html.erb new file mode 100644 index 0000000..d13d255 --- /dev/null +++ b/app/views/order_groups/index.html.erb @@ -0,0 +1,29 @@ +

    <%= notice %>

    + +

    Order Groups

    + + + + + + + + + + + + <% @order_groups.each do |order_group| %> + + + + + + + + <% end %> + +
    Order dateUser
    <%= order_group.order_date %><%= order_group.user %><%= link_to 'Show', order_group %><%= link_to 'Edit', edit_order_group_path(order_group) %><%= link_to 'Destroy', order_group, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New Order Group', new_order_group_path %> diff --git a/app/views/order_groups/index.json.jbuilder b/app/views/order_groups/index.json.jbuilder new file mode 100644 index 0000000..e6ab44a --- /dev/null +++ b/app/views/order_groups/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @order_groups, partial: 'order_groups/order_group', as: :order_group diff --git a/app/views/order_groups/new.html.erb b/app/views/order_groups/new.html.erb new file mode 100644 index 0000000..8e76166 --- /dev/null +++ b/app/views/order_groups/new.html.erb @@ -0,0 +1,5 @@ +

    New Order Group

    + +<%= render 'form', order_group: @order_group %> + +<%= link_to 'Back', order_groups_path %> diff --git a/app/views/order_groups/show.html.erb b/app/views/order_groups/show.html.erb new file mode 100644 index 0000000..f9d4bd6 --- /dev/null +++ b/app/views/order_groups/show.html.erb @@ -0,0 +1,14 @@ +

    <%= notice %>

    + +

    + Order date: + <%= @order_group.order_date %> +

    + +

    + User: + <%= @order_group.user %> +

    + +<%= link_to 'Edit', edit_order_group_path(@order_group) %> | +<%= link_to 'Back', order_groups_path %> diff --git a/app/views/order_groups/show.json.jbuilder b/app/views/order_groups/show.json.jbuilder new file mode 100644 index 0000000..43b08c1 --- /dev/null +++ b/app/views/order_groups/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "order_groups/order_group", order_group: @order_group diff --git a/app/views/orders/_form.html.erb b/app/views/orders/_form.html.erb new file mode 100644 index 0000000..11536b8 --- /dev/null +++ b/app/views/orders/_form.html.erb @@ -0,0 +1,13 @@ +<%= simple_form_for(@order) do |f| %> + <%= f.error_notification %> + +
    + <%= f.input :order_date %> + <%= f.association :product %> + <%= f.association :ordergroup %> +
    + +
    + <%= f.button :submit %> +
    +<% end %> diff --git a/app/views/orders/_order.json.jbuilder b/app/views/orders/_order.json.jbuilder new file mode 100644 index 0000000..d4c8d12 --- /dev/null +++ b/app/views/orders/_order.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! order, :id, :order_date, :product_id, :ordergroup_id, :created_at, :updated_at +json.url order_url(order, format: :json) diff --git a/app/views/orders/edit.html.erb b/app/views/orders/edit.html.erb new file mode 100644 index 0000000..e23883c --- /dev/null +++ b/app/views/orders/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing Order

    + +<%= render 'form', order: @order %> + +<%= link_to 'Show', @order %> | +<%= link_to 'Back', orders_path %> diff --git a/app/views/orders/index.html.erb b/app/views/orders/index.html.erb new file mode 100644 index 0000000..01313d1 --- /dev/null +++ b/app/views/orders/index.html.erb @@ -0,0 +1,31 @@ +

    <%= notice %>

    + +

    Orders

    + + + + + + + + + + + + + <% @orders.each do |order| %> + + + + + + + + + <% end %> + +
    Order dateProductOrdergroup
    <%= order.order_date %><%= order.product %><%= order.ordergroup %><%= link_to 'Show', order %><%= link_to 'Edit', edit_order_path(order) %><%= link_to 'Destroy', order, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New Order', new_order_path %> diff --git a/app/views/orders/index.json.jbuilder b/app/views/orders/index.json.jbuilder new file mode 100644 index 0000000..9916098 --- /dev/null +++ b/app/views/orders/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @orders, partial: 'orders/order', as: :order diff --git a/app/views/orders/new.html.erb b/app/views/orders/new.html.erb new file mode 100644 index 0000000..d4e1de2 --- /dev/null +++ b/app/views/orders/new.html.erb @@ -0,0 +1,5 @@ +

    New Order

    + +<%= render 'form', order: @order %> + +<%= link_to 'Back', orders_path %> diff --git a/app/views/orders/show.html.erb b/app/views/orders/show.html.erb new file mode 100644 index 0000000..4b0bff8 --- /dev/null +++ b/app/views/orders/show.html.erb @@ -0,0 +1,19 @@ +

    <%= notice %>

    + +

    + Order date: + <%= @order.order_date %> +

    + +

    + Product: + <%= @order.product %> +

    + +

    + Ordergroup: + <%= @order.ordergroup %> +

    + +<%= link_to 'Edit', edit_order_path(@order) %> | +<%= link_to 'Back', orders_path %> diff --git a/app/views/orders/show.json.jbuilder b/app/views/orders/show.json.jbuilder new file mode 100644 index 0000000..2ddef40 --- /dev/null +++ b/app/views/orders/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "orders/order", order: @order diff --git a/app/views/payments/_form.html.erb b/app/views/payments/_form.html.erb new file mode 100644 index 0000000..932e0ce --- /dev/null +++ b/app/views/payments/_form.html.erb @@ -0,0 +1,14 @@ +<%= simple_form_for(@payment) do |f| %> + <%= f.error_notification %> + +
    + <%= f.input :payment_date %> + <%= f.input :description %> + <%= f.input :total_amount %> + <%= f.association :ordergroup %> +
    + +
    + <%= f.button :submit %> +
    +<% end %> diff --git a/app/views/payments/_payment.json.jbuilder b/app/views/payments/_payment.json.jbuilder new file mode 100644 index 0000000..f9eb523 --- /dev/null +++ b/app/views/payments/_payment.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! payment, :id, :payment_date, :description, :total_amount, :ordergroup_id, :created_at, :updated_at +json.url payment_url(payment, format: :json) diff --git a/app/views/payments/edit.html.erb b/app/views/payments/edit.html.erb new file mode 100644 index 0000000..f5a2d64 --- /dev/null +++ b/app/views/payments/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing Payment

    + +<%= render 'form', payment: @payment %> + +<%= link_to 'Show', @payment %> | +<%= link_to 'Back', payments_path %> diff --git a/app/views/payments/index.html.erb b/app/views/payments/index.html.erb new file mode 100644 index 0000000..680f86a --- /dev/null +++ b/app/views/payments/index.html.erb @@ -0,0 +1,33 @@ +

    <%= notice %>

    + +

    Payments

    + + + + + + + + + + + + + + <% @payments.each do |payment| %> + + + + + + + + + + <% end %> + +
    Payment dateDescriptionTotal amountOrdergroup
    <%= payment.payment_date %><%= payment.description %><%= payment.total_amount %><%= payment.ordergroup %><%= link_to 'Show', payment %><%= link_to 'Edit', edit_payment_path(payment) %><%= link_to 'Destroy', payment, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New Payment', new_payment_path %> diff --git a/app/views/payments/index.json.jbuilder b/app/views/payments/index.json.jbuilder new file mode 100644 index 0000000..06272d3 --- /dev/null +++ b/app/views/payments/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @payments, partial: 'payments/payment', as: :payment diff --git a/app/views/payments/new.html.erb b/app/views/payments/new.html.erb new file mode 100644 index 0000000..7505d7b --- /dev/null +++ b/app/views/payments/new.html.erb @@ -0,0 +1,5 @@ +

    New Payment

    + +<%= render 'form', payment: @payment %> + +<%= link_to 'Back', payments_path %> diff --git a/app/views/payments/show.html.erb b/app/views/payments/show.html.erb new file mode 100644 index 0000000..4579334 --- /dev/null +++ b/app/views/payments/show.html.erb @@ -0,0 +1,24 @@ +

    <%= notice %>

    + +

    + Payment date: + <%= @payment.payment_date %> +

    + +

    + Description: + <%= @payment.description %> +

    + +

    + Total amount: + <%= @payment.total_amount %> +

    + +

    + Ordergroup: + <%= @payment.ordergroup %> +

    + +<%= link_to 'Edit', edit_payment_path(@payment) %> | +<%= link_to 'Back', payments_path %> diff --git a/app/views/payments/show.json.jbuilder b/app/views/payments/show.json.jbuilder new file mode 100644 index 0000000..da088d8 --- /dev/null +++ b/app/views/payments/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "payments/payment", payment: @payment diff --git a/app/views/products/_form.html.erb b/app/views/products/_form.html.erb new file mode 100644 index 0000000..2585800 --- /dev/null +++ b/app/views/products/_form.html.erb @@ -0,0 +1,14 @@ +<%= simple_form_for(@product) do |f| %> + <%= f.error_notification %> + +
    + <%= f.input :description %> + <%= f.input :price %> + + <%= f.input :image, as: :file %> +
    + +
    + <%= f.button :submit %> +
    +<% end %> diff --git a/app/views/products/_product.json.jbuilder b/app/views/products/_product.json.jbuilder new file mode 100644 index 0000000..7bdbc17 --- /dev/null +++ b/app/views/products/_product.json.jbuilder @@ -0,0 +1,6 @@ +<<<<<<< HEAD +json.extract! product, :id, :name, :price, :description, :available, :created_at, :updated_at +======= +json.extract! product, :id, :description, :price, :image, :user_id, :created_at, :updated_at +>>>>>>> 52866adece2ba5d573a87ea1be8b3d53c6e7dc4f +json.url product_url(product, format: :json) diff --git a/app/views/products/edit.html.erb b/app/views/products/edit.html.erb new file mode 100644 index 0000000..fc16e13 --- /dev/null +++ b/app/views/products/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing Product

    + +<%= render 'form', product: @product %> + +<%= link_to 'Show', @product %> | +<%= link_to 'Back', products_path %> diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb new file mode 100644 index 0000000..985de80 --- /dev/null +++ b/app/views/products/index.html.erb @@ -0,0 +1,13 @@ +

    <%= notice %>

    + + +<% @products.each do |product| %> +
    +
    + <%=image_tag(product.image_url, class: "img-responsive")%> + + <%= link_to '🏞 ', product_path(product.id) %> +
    + +
    +<% end %> diff --git a/app/views/products/index.json.jbuilder b/app/views/products/index.json.jbuilder new file mode 100644 index 0000000..4eec33e --- /dev/null +++ b/app/views/products/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @products, partial: 'products/product', as: :product diff --git a/app/views/products/new.html.erb b/app/views/products/new.html.erb new file mode 100644 index 0000000..06a545c --- /dev/null +++ b/app/views/products/new.html.erb @@ -0,0 +1,5 @@ + + +<%= render 'form', product: @product %> + +<%#= link_to 'Back', products_path %> diff --git a/app/views/products/show.html.erb b/app/views/products/show.html.erb new file mode 100644 index 0000000..2bb5ae6 --- /dev/null +++ b/app/views/products/show.html.erb @@ -0,0 +1,23 @@ +

    <%= notice %>

    + + +
    +
    +
    +
    +
    + <%= image_tag(@product.image_url) %> +

    + Description: + <%= @product.description %> +

    +

    + Price ($): + <%= @product.price %> +

    + <%= link_to 'Back', products_path %> +
    +
    +
    +
    +
    diff --git a/app/views/products/show.json.jbuilder b/app/views/products/show.json.jbuilder new file mode 100644 index 0000000..03b16ec --- /dev/null +++ b/app/views/products/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "products/product", product: @product diff --git a/app/views/user_mailer/welcome_email.html.erb b/app/views/user_mailer/welcome_email.html.erb new file mode 100644 index 0000000..ab7f025 --- /dev/null +++ b/app/views/user_mailer/welcome_email.html.erb @@ -0,0 +1,22 @@ + + + + + + + +

    + Welcome to ArtHouse., <%= @user.name %> +

    +

    + You have successfully subscribed ot ArtHouse. Your one + stop shop for your inner artist. Your username is:, <%= @user.name %> +

    +

    + To login just click on the link: <%= url %>. +

    +

    + Thank you for subscibing our store. +

    + + diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb new file mode 100644 index 0000000..1e6526c --- /dev/null +++ b/app/views/users/_form.html.erb @@ -0,0 +1,13 @@ +<%= simple_form_for(@user) do |f| %> + <%= f.error_notification %> + +
    + <%= f.input :name %> + <%= f.input :email %> + <%= f.input :login %> +
    + +
    + <%= f.button :submit %> +
    +<% end %> diff --git a/app/views/users/_user.json.jbuilder b/app/views/users/_user.json.jbuilder new file mode 100644 index 0000000..4873b48 --- /dev/null +++ b/app/views/users/_user.json.jbuilder @@ -0,0 +1,2 @@ +json.extract! user, :id, :name, :email, :login, :created_at, :updated_at +json.url user_url(user, format: :json) diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 0000000..1a5c2a6 --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,6 @@ +

    Editing User

    + +<%= render 'form', user: @user %> + +<%= link_to 'Show', @user %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..c0e075d --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,31 @@ +

    <%= notice %>

    + +

    Users

    + + + + + + + + + + + + + <% @users.each do |user| %> + + + + + + + + + <% end %> + +
    NameEmailLogin
    <%= user.name %><%= user.email %><%= user.login %><%= link_to 'Show', user %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %>
    + +
    + +<%= link_to 'New User', new_user_path %> diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder new file mode 100644 index 0000000..2faf5af --- /dev/null +++ b/app/views/users/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @users, partial: 'users/user', as: :user diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 0000000..844c39b --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,5 @@ +

    New User

    + +<%= render 'form', user: @user %> + +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..2b95bbd --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,19 @@ +

    <%= notice %>

    + +

    + Name: + <%= @user.name %> +

    + +

    + Email: + <%= @user.email %> +

    + +

    + Login: + <%= @user.login %> +

    + +<%= link_to 'Edit', edit_user_path(@user) %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder new file mode 100644 index 0000000..ff40bb9 --- /dev/null +++ b/app/views/users/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "users/user", user: @user diff --git a/config/environments/development.rb b/config/environments/development.rb index 55d8c9e..8f58a2d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -36,7 +36,7 @@ # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load - + config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb new file mode 100644 index 0000000..441ae03 --- /dev/null +++ b/config/initializers/devise.rb @@ -0,0 +1,283 @@ +# Use this hook to configure devise mailer, warden hooks and so forth. +# Many of these configuration options can be set straight in your model. +Devise.setup do |config| + # The secret key used by Devise. Devise uses this key to generate + # random tokens. Changing this key will render invalid all existing + # confirmation, reset password and unlock tokens in the database. + # Devise will use the `secret_key_base` as its `secret_key` + # by default. You can change it below and use your own secret key. + + # config.secret_key = '2b4133716a6b44742ba58872cd8f15858f7cb13b0d8f2fdb3ddb657dc85a022173fd8fa6f49d48512362a6293cbd0335e229510bde4b6669a61757edd934b68a' + + + # ==> Mailer Configuration + # Configure the e-mail address which will be shown in Devise::Mailer, + # note that it will be overwritten if you use your own mailer class + # with default "from" parameter. + config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' + + # Configure the class responsible to send e-mails. + # config.mailer = 'Devise::Mailer' + + # Configure the parent class responsible to send e-mails. + # config.parent_mailer = 'ActionMailer::Base' + + # ==> ORM configuration + # Load and configure the ORM. Supports :active_record (default) and + # :mongoid (bson_ext recommended) by default. Other ORMs may be + # available as additional gems. + require 'devise/orm/active_record' + + # ==> Configuration for any authentication mechanism + # Configure which keys are used when authenticating a user. The default is + # just :email. You can configure it to use [:username, :subdomain], so for + # authenticating a user, both parameters are required. Remember that those + # parameters are used only when authenticating and not when retrieving from + # session. If you need permissions, you should implement that in a before filter. + # You can also supply a hash where the value is a boolean determining whether + # or not authentication should be aborted when the value is not present. + # config.authentication_keys = [:email] + + # Configure parameters from the request object used for authentication. Each entry + # given should be a request method and it will automatically be passed to the + # find_for_authentication method and considered in your model lookup. For instance, + # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. + # The same considerations mentioned for authentication_keys also apply to request_keys. + # config.request_keys = [] + + # Configure which authentication keys should be case-insensitive. + # These keys will be downcased upon creating or modifying a user and when used + # to authenticate or find a user. Default is :email. + config.case_insensitive_keys = [:email] + + # Configure which authentication keys should have whitespace stripped. + # These keys will have whitespace before and after removed upon creating or + # modifying a user and when used to authenticate or find a user. Default is :email. + config.strip_whitespace_keys = [:email] + + # Tell if authentication through request.params is enabled. True by default. + # It can be set to an array that will enable params authentication only for the + # given strategies, for example, `config.params_authenticatable = [:database]` will + # enable it only for database (email + password) authentication. + # config.params_authenticatable = true + + # Tell if authentication through HTTP Auth is enabled. False by default. + # It can be set to an array that will enable http authentication only for the + # given strategies, for example, `config.http_authenticatable = [:database]` will + # enable it only for database authentication. The supported strategies are: + # :database = Support basic authentication with authentication key + password + # config.http_authenticatable = false + + # If 401 status code should be returned for AJAX requests. True by default. + # config.http_authenticatable_on_xhr = true + + # The realm used in Http Basic Authentication. 'Application' by default. + # config.http_authentication_realm = 'Application' + + # It will change confirmation, password recovery and other workflows + # to behave the same regardless if the e-mail provided was right or wrong. + # Does not affect registerable. + # config.paranoid = true + + # By default Devise will store the user in session. You can skip storage for + # particular strategies by setting this option. + # Notice that if you are skipping storage for all authentication paths, you + # may want to disable generating routes to Devise's sessions controller by + # passing skip: :sessions to `devise_for` in your config/routes.rb + config.skip_session_storage = [:http_auth] + + # By default, Devise cleans up the CSRF token on authentication to + # avoid CSRF token fixation attacks. This means that, when using AJAX + # requests for sign in and sign up, you need to get a new CSRF token + # from the server. You can disable this option at your own risk. + # config.clean_up_csrf_token_on_authentication = true + + # When false, Devise will not attempt to reload routes on eager load. + # This can reduce the time taken to boot the app but if your application + # requires the Devise mappings to be loaded during boot time the application + # won't boot properly. + # config.reload_routes = true + + # ==> Configuration for :database_authenticatable + # For bcrypt, this is the cost for hashing the password and defaults to 11. If + # using other algorithms, it sets how many times you want the password to be hashed. + # + # Limiting the stretches to just one in testing will increase the performance of + # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use + # a value less than 10 in other environments. Note that, for bcrypt (the default + # algorithm), the cost increases exponentially with the number of stretches (e.g. + # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). + config.stretches = Rails.env.test? ? 1 : 11 + + # Set up a pepper to generate the hashed password. +# <<<<<<< HEAD + # config.pepper = 'a5bc2edcce20b9107cda18c3a7eafcbcfcfaa7b97c3701ab37666ca65908cef43a0d84d3151d3b479ea8630acdb47d52ef8e11cad5465bb9715c1cce9e287e73' +# ======= + # config.pepper = '221eb425d1884fad97f0d01355c7beb7268b633adc622147dfe952e60d99efa0aeb57ccca72e76123ab7dbaa81b17656d1a3f5c4333809313d348bb276aa8cad' +# >>>>>>> 3dc2964e82f2370ca014ece1c789bdc394dc1a33 + + # Send a notification to the original email when the user's email is changed. + # config.send_email_changed_notification = false + + # Send a notification email when the user's password is changed. + # config.send_password_change_notification = false + + # ==> Configuration for :confirmable + # A period that the user is allowed to access the website even without + # confirming their account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming their account, + # access will be blocked just in the third day. Default is 0.days, meaning + # the user cannot access the website without confirming their account. + # config.allow_unconfirmed_access_for = 2.days + + # A period that the user is allowed to confirm their account before their + # token becomes invalid. For example, if set to 3.days, the user can confirm + # their account within 3 days after the mail was sent, but on the fourth day + # their account can't be confirmed with the token any more. + # Default is nil, meaning there is no restriction on how long a user can take + # before confirming their account. + # config.confirm_within = 3.days + + # If true, requires any email changes to be confirmed (exactly the same way as + # initial account confirmation) to be applied. Requires additional unconfirmed_email + # db field (see migrations). Until confirmed, new email is stored in + # unconfirmed_email column, and copied to email column on successful confirmation. + config.reconfirmable = true + + # Defines which key will be used when confirming an account + # config.confirmation_keys = [:email] + + # ==> Configuration for :rememberable + # The time the user will be remembered without asking for credentials again. + # config.remember_for = 2.weeks + + # Invalidates all the remember me tokens when the user signs out. + config.expire_all_remember_me_on_sign_out = true + + # If true, extends the user's remember period when remembered via cookie. + # config.extend_remember_period = false + + # Options to be passed to the created cookie. For instance, you can set + # secure: true in order to force SSL only cookies. + # config.rememberable_options = {} + + # ==> Configuration for :validatable + # Range for password length. + config.password_length = 6..128 + + # Email regex used to validate email formats. It simply asserts that + # one (and only one) @ exists in the given string. This is mainly + # to give user feedback and not to assert the e-mail validity. + config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ + + # ==> Configuration for :timeoutable + # The time you want to timeout the user session without activity. After this + # time the user will be asked for credentials again. Default is 30 minutes. + # config.timeout_in = 30.minutes + + # ==> Configuration for :lockable + # Defines which strategy will be used to lock an account. + # :failed_attempts = Locks an account after a number of failed attempts to sign in. + # :none = No lock strategy. You should handle locking by yourself. + # config.lock_strategy = :failed_attempts + + # Defines which key will be used when locking and unlocking an account + # config.unlock_keys = [:email] + + # Defines which strategy will be used to unlock an account. + # :email = Sends an unlock link to the user email + # :time = Re-enables login after a certain amount of time (see :unlock_in below) + # :both = Enables both strategies + # :none = No unlock strategy. You should handle unlocking by yourself. + # config.unlock_strategy = :both + + # Number of authentication tries before locking an account if lock_strategy + # is failed attempts. + # config.maximum_attempts = 20 + + # Time interval to unlock the account if :time is enabled as unlock_strategy. + # config.unlock_in = 1.hour + + # Warn on the last attempt before the account is locked. + # config.last_attempt_warning = true + + # ==> Configuration for :recoverable + # + # Defines which key will be used when recovering the password for an account + # config.reset_password_keys = [:email] + + # Time interval you can reset your password with a reset password key. + # Don't put a too small interval or your users won't have the time to + # change their passwords. + config.reset_password_within = 6.hours + + # When set to false, does not sign a user in automatically after their password is + # reset. Defaults to true, so a user is signed in automatically after a reset. + # config.sign_in_after_reset_password = true + + # ==> Configuration for :encryptable + # Allow you to use another hashing or encryption algorithm besides bcrypt (default). + # You can use :sha1, :sha512 or algorithms from others authentication tools as + # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 + # for default behavior) and :restful_authentication_sha1 (then you should set + # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). + # + # Require the `devise-encryptable` gem when using anything other than bcrypt + # config.encryptor = :sha512 + + # ==> Scopes configuration + # Turn scoped views on. Before rendering "sessions/new", it will first check for + # "users/sessions/new". It's turned off by default because it's slower if you + # are using only default views. + # config.scoped_views = false + + # Configure the default scope given to Warden. By default it's the first + # devise role declared in your routes (usually :user). + # config.default_scope = :user + + # Set this configuration to false if you want /users/sign_out to sign out + # only the current scope. By default, Devise signs out all scopes. + # config.sign_out_all_scopes = true + + # ==> Navigation configuration + # Lists the formats that should be treated as navigational. Formats like + # :html, should redirect to the sign in page when the user does not have + # access, but formats like :xml or :json, should return 401. + # + # If you have any extra navigational formats, like :iphone or :mobile, you + # should add them to the navigational formats lists. + # + # The "*/*" below is required to match Internet Explorer requests. + # config.navigational_formats = ['*/*', :html] + + # The default HTTP method used to sign out a resource. Default is :delete. + config.sign_out_via = :delete + + # ==> OmniAuth + # Add a new OmniAuth provider. Check the wiki for more information on setting + # up on your models and hooks. + # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' + + # ==> Warden configuration + # If you want to use other strategies, that are not supported by Devise, or + # change the failure app, you can configure them inside the config.warden block. + # + # config.warden do |manager| + # manager.intercept_401 = false + # manager.default_strategies(scope: :user).unshift :some_external_strategy + # end + + # ==> Mountable engine configurations + # When using Devise inside an engine, let's call it `MyEngine`, and this engine + # is mountable, there are some extra configurations to be taken into account. + # The following options are available, assuming the engine is mounted as: + # + # mount MyEngine, at: '/my_engine' + # + # The router that invoked `devise_for`, in the example above, would be: + # config.router_name = :my_engine + # + # When using OmniAuth, Devise cannot automatically set OmniAuth path, + # so you need to do it manually. For the users scope, it would be: + # config.omniauth_path_prefix = '/my_engine/users/auth' +end diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb new file mode 100644 index 0000000..f306c19 --- /dev/null +++ b/config/initializers/simple_form.rb @@ -0,0 +1,169 @@ +# Use this setup block to configure all options available in SimpleForm. +SimpleForm.setup do |config| + # Wrappers are used by the form builder to generate a + # complete input. You can remove any component from the + # wrapper, change the order or even add your own to the + # stack. The options given below are used to wrap the + # whole input. + config.wrappers :default, class: :input, + hint_class: :field_with_hint, error_class: :field_with_errors do |b| + ## Extensions enabled by default + # Any of these extensions can be disabled for a + # given input by passing: `f.input EXTENSION_NAME => false`. + # You can make any of these extensions optional by + # renaming `b.use` to `b.optional`. + + # Determines whether to use HTML5 (:email, :url, ...) + # and required attributes + b.use :html5 + + # Calculates placeholders automatically from I18n + # You can also pass a string as f.input placeholder: "Placeholder" + b.use :placeholder + + ## Optional extensions + # They are disabled unless you pass `f.input EXTENSION_NAME => true` + # to the input. If so, they will retrieve the values from the model + # if any exists. If you want to enable any of those + # extensions by default, you can change `b.optional` to `b.use`. + + # Calculates maxlength from length validations for string inputs + # and/or database column lengths + b.optional :maxlength + + # Calculate minlength from length validations for string inputs + b.optional :minlength + + # Calculates pattern from format validations for string inputs + b.optional :pattern + + # Calculates min and max from length validations for numeric inputs + b.optional :min_max + + # Calculates readonly automatically from readonly attributes + b.optional :readonly + + ## Inputs + b.use :label_input + b.use :hint, wrap_with: { tag: :span, class: :hint } + b.use :error, wrap_with: { tag: :span, class: :error } + + ## full_messages_for + # If you want to display the full error message for the attribute, you can + # use the component :full_error, like: + # + # b.use :full_error, wrap_with: { tag: :span, class: :error } + end + + # The default wrapper to be used by the FormBuilder. + config.default_wrapper = :default + + # Define the way to render check boxes / radio buttons with labels. + # Defaults to :nested for bootstrap config. + # inline: input + label + # nested: label > input + config.boolean_style = :nested + + # Default class for buttons + config.button_class = 'btn' + + # Method used to tidy up errors. Specify any Rails Array method. + # :first lists the first message for each field. + # Use :to_sentence to list all errors for each field. + # config.error_method = :first + + # Default tag used for error notification helper. + config.error_notification_tag = :div + + # CSS class to add for error notification helper. + config.error_notification_class = 'error_notification' + + # ID to add for error notification helper. + # config.error_notification_id = nil + + # Series of attempts to detect a default label method for collection. + # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] + + # Series of attempts to detect a default value method for collection. + # config.collection_value_methods = [ :id, :to_s ] + + # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. + # config.collection_wrapper_tag = nil + + # You can define the class to use on all collection wrappers. Defaulting to none. + # config.collection_wrapper_class = nil + + # You can wrap each item in a collection of radio/check boxes with a tag, + # defaulting to :span. + # config.item_wrapper_tag = :span + + # You can define a class to use in all item wrappers. Defaulting to none. + # config.item_wrapper_class = nil + + # How the label text should be generated altogether with the required text. + # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } + + # You can define the class to use on all labels. Default is nil. + # config.label_class = nil + + # You can define the default class to be used on forms. Can be overriden + # with `html: { :class }`. Defaulting to none. + # config.default_form_class = nil + + # You can define which elements should obtain additional classes + # config.generate_additional_classes_for = [:wrapper, :label, :input] + + # Whether attributes are required by default (or not). Default is true. + # config.required_by_default = true + + # Tell browsers whether to use the native HTML5 validations (novalidate form option). + # These validations are enabled in SimpleForm's internal config but disabled by default + # in this configuration, which is recommended due to some quirks from different browsers. + # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, + # change this configuration to true. + config.browser_validations = false + + # Collection of methods to detect if a file type was given. + # config.file_methods = [ :mounted_as, :file?, :public_filename ] + + # Custom mappings for input types. This should be a hash containing a regexp + # to match as key, and the input type that will be used when the field name + # matches the regexp as value. + # config.input_mappings = { /count/ => :integer } + + # Custom wrappers for input types. This should be a hash containing an input + # type as key and the wrapper that will be used for all inputs with specified type. + # config.wrapper_mappings = { string: :prepend } + + # Namespaces where SimpleForm should look for custom input classes that + # override default inputs. + # config.custom_inputs_namespaces << "CustomInputs" + + # Default priority for time_zone inputs. + # config.time_zone_priority = nil + + # Default priority for country inputs. + # config.country_priority = nil + + # When false, do not use translations for labels. + # config.translate_labels = true + + # Automatically discover new inputs in Rails' autoload path. + # config.inputs_discovery = true + + # Cache SimpleForm inputs discovery + # config.cache_discovery = !Rails.env.development? + + # Default class for inputs + # config.input_class = nil + + # Define the default class of the input wrapper of the boolean input. + config.boolean_label_class = 'checkbox' + + # Defines if the default input wrapper class should be included in radio + # collection wrappers. + # config.include_default_input_wrapper_class = true + + # Defines which i18n scope will be used in Simple Form. + # config.i18n_scope = 'simple_form' +end diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb new file mode 100644 index 0000000..c7705e8 --- /dev/null +++ b/config/initializers/simple_form_bootstrap.rb @@ -0,0 +1,154 @@ +# Use this setup block to configure all options available in SimpleForm. +SimpleForm.setup do |config| + config.error_notification_class = 'alert alert-danger' + config.button_class = 'btn btn-default' + config.boolean_label_class = nil + + config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.use :placeholder + b.optional :maxlength + b.optional :minlength + b.optional :pattern + b.optional :min_max + b.optional :readonly + b.use :label, class: 'control-label' + + b.use :input, class: 'form-control' + b.use :error, wrap_with: { tag: 'span', class: 'help-block' } + b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + + config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.use :placeholder + b.optional :maxlength + b.optional :minlength + b.optional :readonly + b.use :label, class: 'control-label' + + b.use :input + b.use :error, wrap_with: { tag: 'span', class: 'help-block' } + b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + + config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.optional :readonly + + b.wrapper tag: 'div', class: 'checkbox' do |ba| + ba.use :label_input + end + + b.use :error, wrap_with: { tag: 'span', class: 'help-block' } + b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + + config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.optional :readonly + b.use :label, class: 'control-label' + b.use :input + b.use :error, wrap_with: { tag: 'span', class: 'help-block' } + b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + + config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.use :placeholder + b.optional :maxlength + b.optional :minlength + b.optional :pattern + b.optional :min_max + b.optional :readonly + b.use :label, class: 'col-sm-3 control-label' + + b.wrapper tag: 'div', class: 'col-sm-9' do |ba| + ba.use :input, class: 'form-control' + ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } + ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + end + + config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.use :placeholder + b.optional :maxlength + b.optional :minlength + b.optional :readonly + b.use :label, class: 'col-sm-3 control-label' + + b.wrapper tag: 'div', class: 'col-sm-9' do |ba| + ba.use :input + ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } + ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + end + + config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.optional :readonly + + b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr| + wr.wrapper tag: 'div', class: 'checkbox' do |ba| + ba.use :label_input + end + + wr.use :error, wrap_with: { tag: 'span', class: 'help-block' } + wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + end + + config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.optional :readonly + + b.use :label, class: 'col-sm-3 control-label' + + b.wrapper tag: 'div', class: 'col-sm-9' do |ba| + ba.use :input + ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } + ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + end + + config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.use :placeholder + b.optional :maxlength + b.optional :minlength + b.optional :pattern + b.optional :min_max + b.optional :readonly + b.use :label, class: 'sr-only' + + b.use :input, class: 'form-control' + b.use :error, wrap_with: { tag: 'span', class: 'help-block' } + b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + + config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| + b.use :html5 + b.optional :readonly + b.use :label, class: 'control-label' + b.wrapper tag: 'div', class: 'form-inline' do |ba| + ba.use :input, class: 'form-control' + ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } + ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + end + # Wrappers for forms and inputs using the Bootstrap toolkit. + # Check the Bootstrap docs (http://getbootstrap.com) + # to learn about the different styles for forms and inputs, + # buttons and other elements. + config.default_wrapper = :vertical_form + config.wrapper_mappings = { + check_boxes: :vertical_radio_and_checkboxes, + radio_buttons: :vertical_radio_and_checkboxes, + file: :vertical_file_input, + boolean: :vertical_boolean, + datetime: :multi_select, + date: :multi_select, + time: :multi_select + } +end diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb new file mode 100644 index 0000000..bf6c2e4 --- /dev/null +++ b/config/initializers/stripe.rb @@ -0,0 +1,6 @@ +Rails.configuration.stripe = { + :publishable_key => ENV['PUBLISHABLE_KEY'], + :secret_key => ENV['SECRET_KEY'] +} + +Stripe.api_key = Rails.configuration.stripe[:secret_key] diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml new file mode 100644 index 0000000..0b8f130 --- /dev/null +++ b/config/locales/devise.en.yml @@ -0,0 +1,64 @@ +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n + +en: + devise: + confirmations: + confirmed: "Your email address has been successfully confirmed." + send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." + failure: + already_authenticated: "You are already signed in." + inactive: "Your account is not activated yet." + invalid: "Invalid %{authentication_keys} or password." + locked: "Your account is locked." + last_attempt: "You have one more attempt before your account is locked." + not_found_in_database: "Invalid %{authentication_keys} or password." + timeout: "Your session expired. Please sign in again to continue." + unauthenticated: "You need to sign in or sign up before continuing." + unconfirmed: "You have to confirm your email address before continuing." + mailer: + confirmation_instructions: + subject: "Confirmation instructions" + reset_password_instructions: + subject: "Reset password instructions" + unlock_instructions: + subject: "Unlock instructions" + email_changed: + subject: "Email Changed" + password_change: + subject: "Password Changed" + omniauth_callbacks: + failure: "Could not authenticate you from %{kind} because \"%{reason}\"." + success: "Successfully authenticated from %{kind} account." + passwords: + no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." + send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." + send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." + updated: "Your password has been changed successfully. You are now signed in." + updated_not_active: "Your password has been changed successfully." + registrations: + destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." + signed_up: "Welcome! You have signed up successfully." + signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." + signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." + signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." + updated: "Your account has been updated successfully." + sessions: + signed_in: "Signed in successfully." + signed_out: "Signed out successfully." + already_signed_out: "Signed out successfully." + unlocks: + send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." + send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." + unlocked: "Your account has been unlocked successfully. Please sign in to continue." + errors: + messages: + already_confirmed: "was already confirmed, please try signing in" + confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" + expired: "has expired, please request a new one" + not_found: "not found" + not_locked: "was not locked" + not_saved: + one: "1 error prohibited this %{resource} from being saved:" + other: "%{count} errors prohibited this %{resource} from being saved:" diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml new file mode 100644 index 0000000..2374383 --- /dev/null +++ b/config/locales/simple_form.en.yml @@ -0,0 +1,31 @@ +en: + simple_form: + "yes": 'Yes' + "no": 'No' + required: + text: 'required' + mark: '*' + # You can uncomment the line below if you need to overwrite the whole required html. + # When using html, text and mark won't be used. + # html: '*' + error_notification: + default_message: "Please review the problems below:" + # Examples + # labels: + # defaults: + # password: 'Password' + # user: + # new: + # email: 'E-mail to sign in.' + # edit: + # email: 'E-mail.' + # hints: + # defaults: + # username: 'User name to sign in.' + # password: 'No special characters, please.' + # include_blanks: + # defaults: + # age: 'Rather not say' + # prompts: + # defaults: + # age: 'Select your age' diff --git a/config/routes.rb b/config/routes.rb index 787824f..f89387c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,11 @@ Rails.application.routes.draw do + resources :products + devise_for :users + + + resources :users + resources :charges + + root to: "home#index" # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end diff --git a/db/migrate/20171019064222_devise_create_users.rb b/db/migrate/20171019064222_devise_create_users.rb new file mode 100644 index 0000000..1b13133 --- /dev/null +++ b/db/migrate/20171019064222_devise_create_users.rb @@ -0,0 +1,50 @@ +class DeviseCreateUsers < ActiveRecord::Migration[5.1] + def change + create_table :users do |t| + #ensure create table instead of change because change translates to ALTEr. If trying to change something that doesn't exist it will not migrate the table. + ## Database authenticatable + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, default: 0, null: false + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + + # Uncomment below if timestamps were not included in your original model. + t.timestamps null: false + end + + add_index :users, :email, unique: true + add_index :users, :reset_password_token, unique: true + # add_index :users, :confirmation_token, unique: true + # add_index :users, :unlock_token, unique: true + end + + def self.down + # By default, we don't want to make any assumption about how to roll back a migration when your + # model already existed. Please edit below which fields you would like to remove in this migration. + raise ActiveRecord::IrreversibleMigration + end +end diff --git a/db/migrate/20171019084148_create_products.rb b/db/migrate/20171019084148_create_products.rb new file mode 100644 index 0000000..b9c1579 --- /dev/null +++ b/db/migrate/20171019084148_create_products.rb @@ -0,0 +1,12 @@ +class CreateProducts < ActiveRecord::Migration[5.1] + def change + create_table :products do |t| + t.text :description + t.string :price + t.text :image + t.references :user, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20171019111840_create_order_groups.rb b/db/migrate/20171019111840_create_order_groups.rb new file mode 100644 index 0000000..e094269 --- /dev/null +++ b/db/migrate/20171019111840_create_order_groups.rb @@ -0,0 +1,10 @@ +class CreateOrderGroups < ActiveRecord::Migration[5.1] + def change + create_table :order_groups do |t| + t.datetime :order_date + t.references :user, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20171019113935_create_orders.rb b/db/migrate/20171019113935_create_orders.rb new file mode 100644 index 0000000..c553eb4 --- /dev/null +++ b/db/migrate/20171019113935_create_orders.rb @@ -0,0 +1,11 @@ +class CreateOrders < ActiveRecord::Migration[5.1] + def change + create_table :orders do |t| + t.datetime :order_date + t.references :product, foreign_key: true + t.references :ordergroup, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20171019120826_create_payments.rb b/db/migrate/20171019120826_create_payments.rb new file mode 100644 index 0000000..4f03639 --- /dev/null +++ b/db/migrate/20171019120826_create_payments.rb @@ -0,0 +1,12 @@ +class CreatePayments < ActiveRecord::Migration[5.1] + def change + create_table :payments do |t| + t.datetime :payment_date + t.text :description + t.float :total_amount + t.references :ordergroup, foreign_key: true + + t.timestamps + end + end +end diff --git a/db/migrate/20171019223736_create_customers.rb b/db/migrate/20171019223736_create_customers.rb new file mode 100644 index 0000000..737383f --- /dev/null +++ b/db/migrate/20171019223736_create_customers.rb @@ -0,0 +1,11 @@ +class CreateCustomers < ActiveRecord::Migration[5.1] + def change + create_table :customers do |t| + t.string :name + t.string :email + t.string :login + + t.timestamps + end + end +end diff --git a/db/migrate/20171019225502_add_latitude_and_longitude_to_model.rb b/db/migrate/20171019225502_add_latitude_and_longitude_to_model.rb new file mode 100644 index 0000000..4074510 --- /dev/null +++ b/db/migrate/20171019225502_add_latitude_and_longitude_to_model.rb @@ -0,0 +1,6 @@ +class AddLatitudeAndLongitudeToModel < ActiveRecord::Migration[5.1] + def create + add_column :models, :latitude, :float + add_column :models, :longitude, :float + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..436f13c --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,40 @@ +# 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: 20171019225502) do + + create_table "users", force: :cascade do |t| + t.string "name" + t.string "email" + t.string "login" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "users", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", default: 0, null: false + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + end + +end diff --git a/erd/erd.png b/erd/erd.png new file mode 100644 index 0000000..82f8a2c Binary files /dev/null and b/erd/erd.png differ diff --git a/lib/templates/erb/scaffold/_form.html.erb b/lib/templates/erb/scaffold/_form.html.erb new file mode 100644 index 0000000..201a069 --- /dev/null +++ b/lib/templates/erb/scaffold/_form.html.erb @@ -0,0 +1,13 @@ +<%%= simple_form_for(@<%= singular_table_name %>) do |f| %> + <%%= f.error_notification %> + +
    + <%- attributes.each do |attribute| -%> + <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> + <%- end -%> +
    + +
    + <%%= f.button :submit %> +
    +<%% end %> diff --git a/public/uploads/Ash_Tree_-_geograph.org.uk_-_590710.jpg b/public/uploads/Ash_Tree_-_geograph.org.uk_-_590710.jpg new file mode 100644 index 0000000..2a8614b Binary files /dev/null and b/public/uploads/Ash_Tree_-_geograph.org.uk_-_590710.jpg differ diff --git a/public/uploads/download.jpeg b/public/uploads/download.jpeg new file mode 100644 index 0000000..ce49a8d Binary files /dev/null and b/public/uploads/download.jpeg differ diff --git a/public/uploads/product/image/1/Ash_Tree_-_geograph.org.uk_-_590710.jpg b/public/uploads/product/image/1/Ash_Tree_-_geograph.org.uk_-_590710.jpg new file mode 100644 index 0000000..2a8614b Binary files /dev/null and b/public/uploads/product/image/1/Ash_Tree_-_geograph.org.uk_-_590710.jpg differ diff --git a/public/uploads/product/image/2/download.jpeg b/public/uploads/product/image/2/download.jpeg new file mode 100644 index 0000000..ce49a8d Binary files /dev/null and b/public/uploads/product/image/2/download.jpeg differ diff --git a/public/uploads/summer-tree.jpg b/public/uploads/summer-tree.jpg new file mode 100644 index 0000000..3bfcc9c Binary files /dev/null and b/public/uploads/summer-tree.jpg differ diff --git a/public/uploads/tmp/1508403197-39107-0001-3403/download.jpeg b/public/uploads/tmp/1508403197-39107-0001-3403/download.jpeg new file mode 100644 index 0000000..ce49a8d Binary files /dev/null and b/public/uploads/tmp/1508403197-39107-0001-3403/download.jpeg differ diff --git a/public/uploads/tmp/1508403378-39663-0001-2184/download.jpeg b/public/uploads/tmp/1508403378-39663-0001-2184/download.jpeg new file mode 100644 index 0000000..ce49a8d Binary files /dev/null and b/public/uploads/tmp/1508403378-39663-0001-2184/download.jpeg differ diff --git a/public/uploads/tmp/1508451249-43112-0001-2043/Ash_Tree_-_geograph.org.uk_-_590710.jpg b/public/uploads/tmp/1508451249-43112-0001-2043/Ash_Tree_-_geograph.org.uk_-_590710.jpg new file mode 100644 index 0000000..2a8614b Binary files /dev/null and b/public/uploads/tmp/1508451249-43112-0001-2043/Ash_Tree_-_geograph.org.uk_-_590710.jpg differ diff --git a/test/controllers/charges_controller_test.rb b/test/controllers/charges_controller_test.rb new file mode 100644 index 0000000..0499567 --- /dev/null +++ b/test/controllers/charges_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ChargesControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/customers_controller_test.rb b/test/controllers/customers_controller_test.rb new file mode 100644 index 0000000..edaf4ac --- /dev/null +++ b/test/controllers/customers_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class CustomersControllerTest < ActionDispatch::IntegrationTest + setup do + @customer = customers(:one) + end + + test "should get index" do + get customers_url + assert_response :success + end + + test "should get new" do + get new_customer_url + assert_response :success + end + + test "should create customer" do + assert_difference('Customer.count') do + post customers_url, params: { customer: { email: @customer.email, login: @customer.login, name: @customer.name } } + end + + assert_redirected_to customer_url(Customer.last) + end + + test "should show customer" do + get customer_url(@customer) + assert_response :success + end + + test "should get edit" do + get edit_customer_url(@customer) + assert_response :success + end + + test "should update customer" do + patch customer_url(@customer), params: { customer: { email: @customer.email, login: @customer.login, name: @customer.name } } + assert_redirected_to customer_url(@customer) + end + + test "should destroy customer" do + assert_difference('Customer.count', -1) do + delete customer_url(@customer) + end + + assert_redirected_to customers_url + end +end diff --git a/test/controllers/home_controller_test.rb b/test/controllers/home_controller_test.rb new file mode 100644 index 0000000..6013b68 --- /dev/null +++ b/test/controllers/home_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class HomeControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get home_index_url + assert_response :success + end + +end diff --git a/test/controllers/order_groups_controller_test.rb b/test/controllers/order_groups_controller_test.rb new file mode 100644 index 0000000..877caf5 --- /dev/null +++ b/test/controllers/order_groups_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class OrderGroupsControllerTest < ActionDispatch::IntegrationTest + setup do + @order_group = order_groups(:one) + end + + test "should get index" do + get order_groups_url + assert_response :success + end + + test "should get new" do + get new_order_group_url + assert_response :success + end + + test "should create order_group" do + assert_difference('OrderGroup.count') do + post order_groups_url, params: { order_group: { order_date: @order_group.order_date, user_id: @order_group.user_id } } + end + + assert_redirected_to order_group_url(OrderGroup.last) + end + + test "should show order_group" do + get order_group_url(@order_group) + assert_response :success + end + + test "should get edit" do + get edit_order_group_url(@order_group) + assert_response :success + end + + test "should update order_group" do + patch order_group_url(@order_group), params: { order_group: { order_date: @order_group.order_date, user_id: @order_group.user_id } } + assert_redirected_to order_group_url(@order_group) + end + + test "should destroy order_group" do + assert_difference('OrderGroup.count', -1) do + delete order_group_url(@order_group) + end + + assert_redirected_to order_groups_url + end +end diff --git a/test/controllers/orders_controller_test.rb b/test/controllers/orders_controller_test.rb new file mode 100644 index 0000000..1daada0 --- /dev/null +++ b/test/controllers/orders_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class OrdersControllerTest < ActionDispatch::IntegrationTest + setup do + @order = orders(:one) + end + + test "should get index" do + get orders_url + assert_response :success + end + + test "should get new" do + get new_order_url + assert_response :success + end + + test "should create order" do + assert_difference('Order.count') do + post orders_url, params: { order: { order_date: @order.order_date, ordergroup_id: @order.ordergroup_id, product_id: @order.product_id } } + end + + assert_redirected_to order_url(Order.last) + end + + test "should show order" do + get order_url(@order) + assert_response :success + end + + test "should get edit" do + get edit_order_url(@order) + assert_response :success + end + + test "should update order" do + patch order_url(@order), params: { order: { order_date: @order.order_date, ordergroup_id: @order.ordergroup_id, product_id: @order.product_id } } + assert_redirected_to order_url(@order) + end + + test "should destroy order" do + assert_difference('Order.count', -1) do + delete order_url(@order) + end + + assert_redirected_to orders_url + end +end diff --git a/test/controllers/payments_controller_test.rb b/test/controllers/payments_controller_test.rb new file mode 100644 index 0000000..0461575 --- /dev/null +++ b/test/controllers/payments_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class PaymentsControllerTest < ActionDispatch::IntegrationTest + setup do + @payment = payments(:one) + end + + test "should get index" do + get payments_url + assert_response :success + end + + test "should get new" do + get new_payment_url + assert_response :success + end + + test "should create payment" do + assert_difference('Payment.count') do + post payments_url, params: { payment: { description: @payment.description, ordergroup_id: @payment.ordergroup_id, payment_date: @payment.payment_date, total_amount: @payment.total_amount } } + end + + assert_redirected_to payment_url(Payment.last) + end + + test "should show payment" do + get payment_url(@payment) + assert_response :success + end + + test "should get edit" do + get edit_payment_url(@payment) + assert_response :success + end + + test "should update payment" do + patch payment_url(@payment), params: { payment: { description: @payment.description, ordergroup_id: @payment.ordergroup_id, payment_date: @payment.payment_date, total_amount: @payment.total_amount } } + assert_redirected_to payment_url(@payment) + end + + test "should destroy payment" do + assert_difference('Payment.count', -1) do + delete payment_url(@payment) + end + + assert_redirected_to payments_url + end +end diff --git a/test/controllers/products_controller_test.rb b/test/controllers/products_controller_test.rb new file mode 100644 index 0000000..e751d67 --- /dev/null +++ b/test/controllers/products_controller_test.rb @@ -0,0 +1,52 @@ +require 'test_helper' + +class ProductsControllerTest < ActionDispatch::IntegrationTest + setup do + @product = products(:one) + end + + test "should get index" do + get products_url + assert_response :success + end + + test "should get new" do + get new_product_url + assert_response :success + end + + test "should create product" do + assert_difference('Product.count') do + + post products_url, params: { product: { available: @product.available, description: @product.description, name: @product.name, price: @product.price } } + + end + + assert_redirected_to product_url(Product.last) + end + + test "should show product" do + get product_url(@product) + assert_response :success + end + + test "should get edit" do + get edit_product_url(@product) + assert_response :success + end + + test "should update product" do + + patch product_url(@product), params: { product: { available: @product.available, description: @product.description, name: @product.name, price: @product.price } } + + assert_redirected_to product_url(@product) + end + + test "should destroy product" do + assert_difference('Product.count', -1) do + delete product_url(@product) + end + + assert_redirected_to products_url + end +end diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb new file mode 100644 index 0000000..78b426a --- /dev/null +++ b/test/controllers/users_controller_test.rb @@ -0,0 +1,48 @@ +require 'test_helper' + +class UsersControllerTest < ActionDispatch::IntegrationTest + setup do + @user = users(:one) + end + + test "should get index" do + get users_url + assert_response :success + end + + test "should get new" do + get new_user_url + assert_response :success + end + + test "should create user" do + assert_difference('User.count') do + post users_url, params: { user: { email: @user.email, login: @user.login, name: @user.name } } + end + + assert_redirected_to user_url(User.last) + end + + test "should show user" do + get user_url(@user) + assert_response :success + end + + test "should get edit" do + get edit_user_url(@user) + assert_response :success + end + + test "should update user" do + patch user_url(@user), params: { user: { email: @user.email, login: @user.login, name: @user.name } } + assert_redirected_to user_url(@user) + end + + test "should destroy user" do + assert_difference('User.count', -1) do + delete user_url(@user) + end + + assert_redirected_to users_url + end +end diff --git a/test/fixtures/customers.yml b/test/fixtures/customers.yml new file mode 100644 index 0000000..5b855a9 --- /dev/null +++ b/test/fixtures/customers.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + email: MyString + login: MyString + +two: + name: MyString + email: MyString + login: MyString diff --git a/test/fixtures/models.yml b/test/fixtures/models.yml new file mode 100644 index 0000000..80aed36 --- /dev/null +++ b/test/fixtures/models.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/order_groups.yml b/test/fixtures/order_groups.yml new file mode 100644 index 0000000..90dc1e5 --- /dev/null +++ b/test/fixtures/order_groups.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + order_date: 2017-10-19 22:18:40 + user: one + +two: + order_date: 2017-10-19 22:18:40 + user: two diff --git a/test/fixtures/orders.yml b/test/fixtures/orders.yml new file mode 100644 index 0000000..096cd5a --- /dev/null +++ b/test/fixtures/orders.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + order_date: 2017-10-19 22:39:35 + product: one + ordergroup: one + +two: + order_date: 2017-10-19 22:39:35 + product: two + ordergroup: two diff --git a/test/fixtures/payments.yml b/test/fixtures/payments.yml new file mode 100644 index 0000000..72039bc --- /dev/null +++ b/test/fixtures/payments.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + payment_date: 2017-10-19 23:08:26 + description: MyText + total_amount: 1.5 + ordergroup: one + +two: + payment_date: 2017-10-19 23:08:26 + description: MyText + total_amount: 1.5 + ordergroup: two diff --git a/test/fixtures/products.yml b/test/fixtures/products.yml new file mode 100644 index 0000000..72f7054 --- /dev/null +++ b/test/fixtures/products.yml @@ -0,0 +1,13 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + price: 1.5 + description: MyText + available: false + +two: + name: MyString + price: 1.5 + description: MyText + available: false diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..5b855a9 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyString + email: MyString + login: MyString + +two: + name: MyString + email: MyString + login: MyString diff --git a/test/mailers/previews/user_mailer_preview.rb b/test/mailers/previews/user_mailer_preview.rb new file mode 100644 index 0000000..957e12b --- /dev/null +++ b/test/mailers/previews/user_mailer_preview.rb @@ -0,0 +1,4 @@ +# Preview all emails at http://localhost:3000/rails/mailers/user_mailer +class UserMailerPreview < ActionMailer::Preview + +end diff --git a/test/mailers/user_mailer_test.rb b/test/mailers/user_mailer_test.rb new file mode 100644 index 0000000..67a1629 --- /dev/null +++ b/test/mailers/user_mailer_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserMailerTest < ActionMailer::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/customer_test.rb b/test/models/customer_test.rb new file mode 100644 index 0000000..0ec4c76 --- /dev/null +++ b/test/models/customer_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class CustomerTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/model_test.rb b/test/models/model_test.rb new file mode 100644 index 0000000..57645aa --- /dev/null +++ b/test/models/model_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ModelTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/order_group_test.rb b/test/models/order_group_test.rb new file mode 100644 index 0000000..bf1dc3e --- /dev/null +++ b/test/models/order_group_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class OrderGroupTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/order_test.rb b/test/models/order_test.rb new file mode 100644 index 0000000..15b8ed1 --- /dev/null +++ b/test/models/order_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class OrderTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/payment_test.rb b/test/models/payment_test.rb new file mode 100644 index 0000000..13cc3cf --- /dev/null +++ b/test/models/payment_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class PaymentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/product_test.rb b/test/models/product_test.rb new file mode 100644 index 0000000..211cdd0 --- /dev/null +++ b/test/models/product_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ProductTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/system/customers_test.rb b/test/system/customers_test.rb new file mode 100644 index 0000000..2a1282e --- /dev/null +++ b/test/system/customers_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class CustomersTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit customers_url + # + # assert_selector "h1", text: "Customer" + # end +end diff --git a/test/system/order_groups_test.rb b/test/system/order_groups_test.rb new file mode 100644 index 0000000..e4a216d --- /dev/null +++ b/test/system/order_groups_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class OrderGroupsTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit order_groups_url + # + # assert_selector "h1", text: "OrderGroup" + # end +end diff --git a/test/system/orders_test.rb b/test/system/orders_test.rb new file mode 100644 index 0000000..6146812 --- /dev/null +++ b/test/system/orders_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class OrdersTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit orders_url + # + # assert_selector "h1", text: "Order" + # end +end diff --git a/test/system/payments_test.rb b/test/system/payments_test.rb new file mode 100644 index 0000000..aebf31a --- /dev/null +++ b/test/system/payments_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class PaymentsTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit payments_url + # + # assert_selector "h1", text: "Payment" + # end +end diff --git a/test/system/products_test.rb b/test/system/products_test.rb new file mode 100644 index 0000000..a05fbb6 --- /dev/null +++ b/test/system/products_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class ProductsTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit products_url + # + # assert_selector "h1", text: "Product" + # end +end diff --git a/test/system/users_test.rb b/test/system/users_test.rb new file mode 100644 index 0000000..99d1e21 --- /dev/null +++ b/test/system/users_test.rb @@ -0,0 +1,9 @@ +require "application_system_test_case" + +class UsersTest < ApplicationSystemTestCase + # test "visiting the index" do + # visit users_url + # + # assert_selector "h1", text: "User" + # end +end