customer_vault 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/javascripts/customer_vault/application.js +13 -0
  6. data/app/assets/javascripts/customer_vault/corporations.js +2 -0
  7. data/app/assets/javascripts/customer_vault/people.js +2 -0
  8. data/app/assets/stylesheets/customer_vault/application.css +13 -0
  9. data/app/assets/stylesheets/customer_vault/corporations.css +4 -0
  10. data/app/assets/stylesheets/customer_vault/people.css +4 -0
  11. data/app/assets/stylesheets/scaffold.css +56 -0
  12. data/app/controllers/customer_vault/application_controller.rb +4 -0
  13. data/app/controllers/customer_vault/corporations_controller.rb +62 -0
  14. data/app/controllers/customer_vault/people_controller.rb +62 -0
  15. data/app/helpers/customer_vault/application_helper.rb +4 -0
  16. data/app/helpers/customer_vault/corporations_helper.rb +4 -0
  17. data/app/helpers/customer_vault/people_helper.rb +4 -0
  18. data/app/models/customer_vault/corporation.rb +5 -0
  19. data/app/models/customer_vault/person.rb +6 -0
  20. data/app/views/customer_vault/corporations/_form.html.slim +21 -0
  21. data/app/views/customer_vault/corporations/edit.html.slim +8 -0
  22. data/app/views/customer_vault/corporations/index.html.slim +27 -0
  23. data/app/views/customer_vault/corporations/new.html.slim +5 -0
  24. data/app/views/customer_vault/corporations/show.html.slim +18 -0
  25. data/app/views/customer_vault/people/_form.html.slim +39 -0
  26. data/app/views/customer_vault/people/edit.html.slim +8 -0
  27. data/app/views/customer_vault/people/index.html.slim +39 -0
  28. data/app/views/customer_vault/people/new.html.slim +5 -0
  29. data/app/views/customer_vault/people/show.html.slim +36 -0
  30. data/app/views/layouts/customer_vault/application.html.erb +14 -0
  31. data/config/routes.rb +6 -0
  32. data/db/migrate/20141006095617_create_customer_vault_people.rb +18 -0
  33. data/db/migrate/20141010095816_create_customer_vault_corporations.rb +12 -0
  34. data/lib/customer_vault.rb +4 -0
  35. data/lib/customer_vault/engine.rb +11 -0
  36. data/lib/customer_vault/version.rb +3 -0
  37. data/lib/tasks/customer_vault_tasks.rake +4 -0
  38. data/spec/controllers/customer_vault/corporations_controller_spec.rb +163 -0
  39. data/spec/controllers/customer_vault/people_controller_spec.rb +163 -0
  40. data/spec/dummy/README.rdoc +28 -0
  41. data/spec/dummy/Rakefile +6 -0
  42. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  43. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  44. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  45. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  46. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  47. data/spec/dummy/bin/bundle +3 -0
  48. data/spec/dummy/bin/rails +4 -0
  49. data/spec/dummy/bin/rake +4 -0
  50. data/spec/dummy/config.ru +4 -0
  51. data/spec/dummy/config/application.rb +23 -0
  52. data/spec/dummy/config/boot.rb +5 -0
  53. data/spec/dummy/config/database.yml +25 -0
  54. data/spec/dummy/config/environment.rb +5 -0
  55. data/spec/dummy/config/environments/development.rb +32 -0
  56. data/spec/dummy/config/environments/production.rb +80 -0
  57. data/spec/dummy/config/environments/test.rb +39 -0
  58. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  60. data/spec/dummy/config/initializers/inflections.rb +16 -0
  61. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  62. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  63. data/spec/dummy/config/initializers/session_store.rb +3 -0
  64. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/spec/dummy/config/locales/en.yml +23 -0
  66. data/spec/dummy/config/routes.rb +4 -0
  67. data/spec/dummy/db/development.sqlite3 +0 -0
  68. data/spec/dummy/db/schema.rb +40 -0
  69. data/spec/dummy/db/test.sqlite3 +0 -0
  70. data/spec/dummy/log/development.log +652 -0
  71. data/spec/dummy/log/test.log +5110 -0
  72. data/spec/dummy/public/404.html +58 -0
  73. data/spec/dummy/public/422.html +58 -0
  74. data/spec/dummy/public/500.html +57 -0
  75. data/spec/dummy/public/favicon.ico +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/2b9d45522b3d1f3105e1c33e325dc6de +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/34d14962fde7e4fd6e2671844bcfaa78 +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/47170c4182a8457e8d53507ea76fa76b +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/78ef508640527d1bb135c1077223fb7c +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/a1b854a09ea96f64f07c9d3692d9cd9b +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/a5c73696137ab9dbdda376c8d7ffa3b9 +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/ad1a12f0fbac31c992fbc716a5e504bb +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/b10f86698e41bfdaafc9fb6bbf5bfbd9 +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/c9db74506cdab0aec9f855c956f47726 +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/db5f1ec4fd27d454a95b2824fff064d1 +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/e5782a71fc01b88e6ac0c1c963bf7e3e +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/f516186931f15a3e5c86af1b1632d256 +0 -0
  88. data/spec/factories/customer_vault_corporations.rb +10 -0
  89. data/spec/factories/customer_vault_people.rb +16 -0
  90. data/spec/helpers/customer_vault/corporations_helper_spec.rb +16 -0
  91. data/spec/helpers/customer_vault/people_helper_spec.rb +16 -0
  92. data/spec/models/customer_vault/corporation_spec.rb +7 -0
  93. data/spec/models/customer_vault/person_spec.rb +14 -0
  94. data/spec/rails_helper.rb +54 -0
  95. data/spec/routing/customer_vault/corporations_routing_spec.rb +37 -0
  96. data/spec/routing/customer_vault/people_routing_spec.rb +37 -0
  97. data/spec/spec_helper.rb +86 -0
  98. data/spec/views/customer_vault/corporations/edit.html.slim_spec.rb +29 -0
  99. data/spec/views/customer_vault/corporations/index.html.slim_spec.rb +29 -0
  100. data/spec/views/customer_vault/corporations/new.html.slim_spec.rb +28 -0
  101. data/spec/views/customer_vault/corporations/show.html.slim_spec.rb +21 -0
  102. data/spec/views/customer_vault/people/edit.html.slim_spec.rb +47 -0
  103. data/spec/views/customer_vault/people/index.html.slim_spec.rb +47 -0
  104. data/spec/views/customer_vault/people/new.html.slim_spec.rb +47 -0
  105. data/spec/views/customer_vault/people/show.html.slim_spec.rb +34 -0
  106. metadata +300 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5146a54c834307b6542cbb81515205f2f8f4ebbf
4
+ data.tar.gz: e86575d5410f2b3514c69c3ea6445373921a7401
5
+ SHA512:
6
+ metadata.gz: f567ba0b339bbac6d7bc0ae193a9df1c9a171fcd52f30f6facd485423e4fb10a8f24abb09abe13a41d076e0621d344b56a7cc3f450ec74e9e18030e3c61c444e
7
+ data.tar.gz: 0e06280e18082c67720f6a2efa0158a5e6e13447c47b83c8b7c01d9cc86e1063d9f8a131ea0c8ba23e9d1ab2a1bc463ee8624a25656ef249be4a72e2a9634d12
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = CustomerVault
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'CustomerVault'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ Bundler::GemHelper.install_tasks
22
+
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,4 @@
1
+ module CustomerVault
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "customer_vault/application_controller"
2
+
3
+ module CustomerVault
4
+ class CorporationsController < ApplicationController
5
+ before_action :set_corporation, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /corporations
8
+ def index
9
+ @corporations = Corporation.all
10
+ end
11
+
12
+ # GET /corporations/1
13
+ def show
14
+ end
15
+
16
+ # GET /corporations/new
17
+ def new
18
+ @corporation = Corporation.new
19
+ end
20
+
21
+ # GET /corporations/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /corporations
26
+ def create
27
+ @corporation = Corporation.new(corporation_params)
28
+
29
+ if @corporation.save
30
+ redirect_to @corporation, notice: 'Corporation was successfully created.'
31
+ else
32
+ render action: 'new'
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /corporations/1
37
+ def update
38
+ if @corporation.update(corporation_params)
39
+ redirect_to @corporation, notice: 'Corporation was successfully updated.'
40
+ else
41
+ render action: 'edit'
42
+ end
43
+ end
44
+
45
+ # DELETE /corporations/1
46
+ def destroy
47
+ @corporation.destroy
48
+ redirect_to corporations_url, notice: 'Corporation was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_corporation
54
+ @corporation = Corporation.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def corporation_params
59
+ params.require(:corporation).permit(:name, :email, :phone, :fax)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "customer_vault/application_controller"
2
+
3
+ module CustomerVault
4
+ class PeopleController < ApplicationController
5
+ before_action :set_person, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /people
8
+ def index
9
+ @people = Person.all
10
+ end
11
+
12
+ # GET /people/1
13
+ def show
14
+ end
15
+
16
+ # GET /people/new
17
+ def new
18
+ @person = Person.new
19
+ end
20
+
21
+ # GET /people/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /people
26
+ def create
27
+ @person = Person.new(person_params)
28
+
29
+ if @person.save
30
+ redirect_to @person, notice: 'Person was successfully created.'
31
+ else
32
+ render action: 'new'
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /people/1
37
+ def update
38
+ if @person.update(person_params)
39
+ redirect_to @person, notice: 'Person was successfully updated.'
40
+ else
41
+ render action: 'edit'
42
+ end
43
+ end
44
+
45
+ # DELETE /people/1
46
+ def destroy
47
+ @person.destroy
48
+ redirect_to people_url, notice: 'Person was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_person
54
+ @person = Person.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def person_params
59
+ params.require(:person).permit(:first_name, :last_name, :email, :title, :twitter, :www, :context, :phone, :fax, :mobile)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,4 @@
1
+ module CustomerVault
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module CustomerVault
2
+ module CorporationsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module CustomerVault
2
+ module PeopleHelper
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module CustomerVault
2
+ class Corporation < ActiveRecord::Base
3
+ validates_presence_of :name
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ module CustomerVault
2
+ class Person < ActiveRecord::Base
3
+ validates_presence_of :first_name
4
+ validates_presence_of :last_name
5
+ end
6
+ end
@@ -0,0 +1,21 @@
1
+ = form_for [customer_vault, @corporation] do |f|
2
+ - if @corporation.errors.any?
3
+ #error_explanation
4
+ h2 = "#{pluralize(@corporation.errors.count, "error")} prohibited this corporation from being saved:"
5
+ ul
6
+ - @corporation.errors.full_messages.each do |message|
7
+ li = message
8
+
9
+ .field
10
+ = f.label :name
11
+ = f.text_field :name
12
+ .field
13
+ = f.label :email
14
+ = f.text_field :email
15
+ .field
16
+ = f.label :phone
17
+ = f.text_field :phone
18
+ .field
19
+ = f.label :fax
20
+ = f.text_field :fax
21
+ .actions = f.submit 'Save'
@@ -0,0 +1,8 @@
1
+ h1 Editing corporation
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Show', [customer_vault, @corporation]
6
+ '|
7
+ = link_to 'Back', customer_vault.corporations_path
8
+
@@ -0,0 +1,27 @@
1
+ h1 Listing corporations
2
+
3
+ table
4
+ thead
5
+ tr
6
+ th Name
7
+ th Email
8
+ th Phone
9
+ th Fax
10
+ th
11
+ th
12
+ th
13
+
14
+ tbody
15
+ - @corporations.each do |corporation|
16
+ tr
17
+ td = corporation.name
18
+ td = corporation.email
19
+ td = corporation.phone
20
+ td = corporation.fax
21
+ td = link_to 'Show', [customer_vault, corporation]
22
+ td = link_to 'Edit', customer_vault.edit_corporation_path(corporation)
23
+ td = link_to 'Destroy', [customer_vault, corporation], data: {:confirm => 'Are you sure?'}, :method => :delete
24
+
25
+ br
26
+
27
+ = link_to 'New Corporation', customer_vault.new_corporation_path
@@ -0,0 +1,5 @@
1
+ h1 New corporation
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Back', customer_vault.corporations_path
@@ -0,0 +1,18 @@
1
+ p#notice = notice
2
+
3
+ p
4
+ strong Name:
5
+ = @corporation.name
6
+ p
7
+ strong Email:
8
+ = @corporation.email
9
+ p
10
+ strong Phone:
11
+ = @corporation.phone
12
+ p
13
+ strong Fax:
14
+ = @corporation.fax
15
+
16
+ = link_to 'Edit', customer_vault.edit_corporation_path(@corporation)
17
+ '|
18
+ = link_to 'Back', customer_vault.corporations_path
@@ -0,0 +1,39 @@
1
+ = form_for [customer_vault, @person] do |f|
2
+ - if @person.errors.any?
3
+ #error_explanation
4
+ h2 = "#{pluralize(@person.errors.count, "error")} prohibited this person from being saved:"
5
+ ul
6
+ - @person.errors.full_messages.each do |message|
7
+ li = message
8
+
9
+ .field
10
+ = f.label :first_name
11
+ = f.text_field :first_name
12
+ .field
13
+ = f.label :last_name
14
+ = f.text_field :last_name
15
+ .field
16
+ = f.label :email
17
+ = f.text_field :email
18
+ .field
19
+ = f.label :title
20
+ = f.text_field :title
21
+ .field
22
+ = f.label :twitter
23
+ = f.text_field :twitter
24
+ .field
25
+ = f.label :www
26
+ = f.text_field :www
27
+ .field
28
+ = f.label :context
29
+ = f.text_area :context
30
+ .field
31
+ = f.label :phone
32
+ = f.text_field :phone
33
+ .field
34
+ = f.label :fax
35
+ = f.text_field :fax
36
+ .field
37
+ = f.label :mobile
38
+ = f.text_field :mobile
39
+ .actions = f.submit 'Save'