Depreciation 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +23 -0
  3. data/Gemfile +54 -0
  4. data/Gemfile.lock +237 -0
  5. data/README.md +24 -0
  6. data/Rakefile +6 -0
  7. data/app/assets/config/manifest.js +3 -0
  8. data/app/assets/images/.keep +0 -0
  9. data/app/assets/javascripts/application.js +17 -0
  10. data/app/assets/javascripts/brands.coffee +3 -0
  11. data/app/assets/javascripts/cable.js +13 -0
  12. data/app/assets/javascripts/channels/.keep +0 -0
  13. data/app/assets/stylesheets/application.css.scss +17 -0
  14. data/app/assets/stylesheets/brands.scss +3 -0
  15. data/app/channels/application_cable/channel.rb +4 -0
  16. data/app/channels/application_cable/connection.rb +4 -0
  17. data/app/controllers/application_controller.rb +3 -0
  18. data/app/controllers/brands_controller.rb +43 -0
  19. data/app/controllers/concerns/.keep +0 -0
  20. data/app/helpers/application_helper.rb +2 -0
  21. data/app/helpers/brands_helper.rb +2 -0
  22. data/app/jobs/application_job.rb +2 -0
  23. data/app/mailers/application_mailer.rb +4 -0
  24. data/app/models/application_record.rb +3 -0
  25. data/app/models/brand.rb +5 -0
  26. data/app/models/concerns/.keep +0 -0
  27. data/app/models/user.rb +6 -0
  28. data/app/models/variant.rb +3 -0
  29. data/app/views/brands/_form.html.erb +4 -0
  30. data/app/views/brands/edit.html.erb +3 -0
  31. data/app/views/brands/index.html.erb +5 -0
  32. data/app/views/brands/new.html.erb +2 -0
  33. data/app/views/brands/show.html.erb +36 -0
  34. data/app/views/devise/confirmations/new.html.erb +16 -0
  35. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  36. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  37. data/app/views/devise/mailer/password_change.html.erb +3 -0
  38. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  39. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  40. data/app/views/devise/passwords/edit.html.erb +19 -0
  41. data/app/views/devise/passwords/new.html.erb +15 -0
  42. data/app/views/devise/registrations/edit.html.erb +27 -0
  43. data/app/views/devise/registrations/new.html.erb +78 -0
  44. data/app/views/devise/sessions/new.html.erb +36 -0
  45. data/app/views/devise/shared/_links.html.erb +25 -0
  46. data/app/views/devise/unlocks/new.html.erb +16 -0
  47. data/app/views/layouts/application.html.erb +34 -0
  48. data/app/views/layouts/mailer.html.erb +13 -0
  49. data/app/views/layouts/mailer.text.erb +1 -0
  50. data/bin/bundle +3 -0
  51. data/bin/rails +4 -0
  52. data/bin/rake +4 -0
  53. data/bin/setup +38 -0
  54. data/bin/update +29 -0
  55. data/bin/yarn +11 -0
  56. data/config.ru +5 -0
  57. data/config/application.rb +18 -0
  58. data/config/boot.rb +3 -0
  59. data/config/cable.yml +10 -0
  60. data/config/database.yml +25 -0
  61. data/config/environment.rb +5 -0
  62. data/config/environments/development.rb +56 -0
  63. data/config/environments/production.rb +91 -0
  64. data/config/environments/test.rb +42 -0
  65. data/config/initializers/application_controller_renderer.rb +8 -0
  66. data/config/initializers/assets.rb +14 -0
  67. data/config/initializers/backtrace_silencers.rb +7 -0
  68. data/config/initializers/cookies_serializer.rb +5 -0
  69. data/config/initializers/devise.rb +283 -0
  70. data/config/initializers/filter_parameter_logging.rb +4 -0
  71. data/config/initializers/inflections.rb +16 -0
  72. data/config/initializers/mime_types.rb +4 -0
  73. data/config/initializers/simple_form.rb +170 -0
  74. data/config/initializers/simple_form_bootstrap.rb +155 -0
  75. data/config/initializers/wrap_parameters.rb +14 -0
  76. data/config/locales/devise.en.yml +64 -0
  77. data/config/locales/en.yml +33 -0
  78. data/config/locales/simple_form.en.yml +31 -0
  79. data/config/puma.rb +56 -0
  80. data/config/routes.rb +8 -0
  81. data/config/secrets.yml +32 -0
  82. data/db/migrate/20180405123506_create_brands.rb +9 -0
  83. data/db/migrate/20180405124007_create_variants.rb +18 -0
  84. data/db/migrate/20180405142003_devise_create_users.rb +44 -0
  85. data/db/schema.rb +83 -0
  86. data/db/seeds.rb +22 -0
  87. data/lib/assets/.keep +0 -0
  88. data/lib/tasks/.keep +0 -0
  89. data/lib/templates/erb/scaffold/_form.html.erb +14 -0
  90. data/log/.keep +0 -0
  91. data/package.json +7 -0
  92. data/public/404.html +67 -0
  93. data/public/422.html +67 -0
  94. data/public/500.html +66 -0
  95. data/public/apple-touch-icon-precomposed.png +0 -0
  96. data/public/apple-touch-icon.png +0 -0
  97. data/public/favicon.ico +0 -0
  98. data/public/robots.txt +1 -0
  99. data/test/application_system_test_case.rb +5 -0
  100. data/test/controllers/.keep +0 -0
  101. data/test/controllers/brands_controller_test.rb +7 -0
  102. data/test/fixtures/.keep +0 -0
  103. data/test/fixtures/brands.yml +7 -0
  104. data/test/fixtures/files/.keep +0 -0
  105. data/test/fixtures/users.yml +11 -0
  106. data/test/fixtures/variants.yml +23 -0
  107. data/test/helpers/.keep +0 -0
  108. data/test/integration/.keep +0 -0
  109. data/test/mailers/.keep +0 -0
  110. data/test/models/.keep +0 -0
  111. data/test/models/brand_test.rb +7 -0
  112. data/test/models/user_test.rb +7 -0
  113. data/test/models/variant_test.rb +7 -0
  114. data/test/system/.keep +0 -0
  115. data/test/test_helper.rb +10 -0
  116. data/tmp/.keep +0 -0
  117. data/vendor/.keep +0 -0
  118. metadata +120 -4
data/db/schema.rb ADDED
@@ -0,0 +1,83 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20180414204123) do
14
+
15
+ create_table "advertisements", force: :cascade do |t|
16
+ t.string "condition"
17
+ t.string "year"
18
+ t.string "regno"
19
+ t.float "kmdriven"
20
+ t.integer "ownercount"
21
+ t.float "price"
22
+ t.integer "users_id"
23
+ t.integer "variant_id"
24
+ t.datetime "created_at", null: false
25
+ t.datetime "updated_at", null: false
26
+ t.index ["users_id"], name: "index_advertisements_on_users_id"
27
+ t.index ["variant_id"], name: "index_advertisements_on_variant_id"
28
+ end
29
+
30
+ create_table "age_depreciations", force: :cascade do |t|
31
+ t.integer "age"
32
+ t.integer "depreciation"
33
+ t.datetime "created_at", null: false
34
+ t.datetime "updated_at", null: false
35
+ end
36
+
37
+ create_table "brands", force: :cascade do |t|
38
+ t.string "name"
39
+ t.datetime "created_at", null: false
40
+ t.datetime "updated_at", null: false
41
+ end
42
+
43
+ create_table "mileage_depreciations", force: :cascade do |t|
44
+ t.integer "kms"
45
+ t.integer "depreciation"
46
+ t.datetime "created_at", null: false
47
+ t.datetime "updated_at", null: false
48
+ end
49
+
50
+ create_table "users", force: :cascade do |t|
51
+ t.string "email", default: "", null: false
52
+ t.string "encrypted_password", default: "", null: false
53
+ t.string "reset_password_token"
54
+ t.datetime "reset_password_sent_at"
55
+ t.datetime "remember_created_at"
56
+ t.integer "sign_in_count", default: 0, null: false
57
+ t.datetime "current_sign_in_at"
58
+ t.datetime "last_sign_in_at"
59
+ t.string "current_sign_in_ip"
60
+ t.string "last_sign_in_ip"
61
+ t.datetime "created_at", null: false
62
+ t.datetime "updated_at", null: false
63
+ t.index ["email"], name: "index_users_on_email", unique: true
64
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
65
+ end
66
+
67
+ create_table "variants", force: :cascade do |t|
68
+ t.string "name"
69
+ t.integer "enginecap"
70
+ t.integer "year"
71
+ t.string "fueltype"
72
+ t.string "gearshift"
73
+ t.integer "fuelcap"
74
+ t.integer "seating"
75
+ t.float "mileage"
76
+ t.float "price"
77
+ t.integer "brand_id"
78
+ t.datetime "created_at", null: false
79
+ t.datetime "updated_at", null: false
80
+ t.index ["brand_id"], name: "index_variants_on_brand_id"
81
+ end
82
+
83
+ end
data/db/seeds.rb ADDED
@@ -0,0 +1,22 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
+ # Character.create(name: 'Luke', movie: movies.first)
8
+ <<-DOC
9
+ age_dep = [100,75,65,60,50,45,35,28,22,20,18,15,12,10,8,8,7,7,6,6,5]
10
+ kms_dep = [100,80,75,70,67,65,60,55,53,50,48,44,40,36,34,30,28,26,24,22,20,19,18,17,16,15,14,13,12,11,10]
11
+ i = 0
12
+ while i < kms_dep.length
13
+ MileageDepreciation.create(id: i+1, kms: i, depreciation: kms_dep[i])
14
+ i = i+1
15
+ end
16
+ i = 0
17
+ while i < age_dep.length do
18
+ AgeDepreciation.create(id: i+1, age: i, depreciation: age_dep[i])
19
+ i = i+1
20
+ end
21
+
22
+ DOC
data/lib/assets/.keep ADDED
File without changes
data/lib/tasks/.keep ADDED
File without changes
@@ -0,0 +1,14 @@
1
+ <%# frozen_string_literal: true %>
2
+ <%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
3
+ <%%= f.error_notification %>
4
+
5
+ <div class="form-inputs">
6
+ <%- attributes.each do |attribute| -%>
7
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
8
+ <%- end -%>
9
+ </div>
10
+
11
+ <div class="form-actions">
12
+ <%%= f.button :submit %>
13
+ </div>
14
+ <%% end %>
data/log/.keep ADDED
File without changes
data/package.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "carZone",
3
+ "private": true,
4
+ "dependencies": {
5
+ "uikit": "file:uikit"
6
+ }
7
+ }
data/public/404.html ADDED
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
data/public/422.html ADDED
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
data/public/500.html ADDED
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
File without changes
File without changes
data/public/robots.txt ADDED
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
@@ -0,0 +1,5 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class BrandsControllerTest < ActionDispatch::IntegrationTest
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ name: MyString
5
+
6
+ two:
7
+ name: MyString
File without changes
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,23 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ name: MyString
5
+ enginecap: 1
6
+ year: 1
7
+ fueltype: MyString
8
+ gearshift: MyString
9
+ fuelcap: 1
10
+ seating: 1
11
+ mileage: 1.5
12
+ price: 1.5
13
+
14
+ two:
15
+ name: MyString
16
+ enginecap: 1
17
+ year: 1
18
+ fueltype: MyString
19
+ gearshift: MyString
20
+ fuelcap: 1
21
+ seating: 1
22
+ mileage: 1.5
23
+ price: 1.5
File without changes
File without changes
File without changes
data/test/models/.keep ADDED
File without changes
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class BrandTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end