cloudrider 0.3.21 → 0.3.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/generica/Gemfile +1 -1
- data/generica/Gemfile.lock +91 -51
- data/generica/app/assets/javascripts/components/product-display.js.em +4 -1
- data/generica/app/assets/javascripts/components/product-listing.js.em +4 -1
- data/generica/app/assets/javascripts/components/site-footer.js.em +12 -0
- data/generica/app/assets/javascripts/components/site-nav.js.em +15 -0
- data/generica/app/assets/javascripts/config/router.js.ls +18 -2
- data/generica/app/assets/javascripts/controllers/modals/fork_controller.js.em +4 -0
- data/generica/app/assets/javascripts/controllers/modals/login_controller.js.em +1 -4
- data/generica/app/assets/javascripts/controllers/modals/register_controller.js.em +1 -1
- data/generica/app/assets/javascripts/controllers/users/contact/edit_controller.js.em +16 -0
- data/generica/app/assets/javascripts/controllers/users/contacts/index_controller.js.em +21 -0
- data/generica/app/assets/javascripts/controllers/users/contacts/new_controller.js.em +16 -0
- data/generica/app/assets/javascripts/controllers/users/index_controller.js.em +19 -0
- data/generica/app/assets/javascripts/models/contact.js.em +11 -0
- data/generica/app/assets/javascripts/routes/users/contact_route.js.em +3 -0
- data/generica/app/assets/javascripts/routes/users/contacts/index_route.js.em +7 -0
- data/generica/app/assets/javascripts/routes/users/contacts/new_route.js.em +3 -0
- data/generica/app/assets/javascripts/routes/users/index_route.js.em +3 -0
- data/generica/app/assets/javascripts/templates/components/site-footer.emblem +18 -9
- data/generica/app/assets/javascripts/templates/users.emblem +11 -3
- data/generica/app/assets/javascripts/templates/users/contact/edit.emblem +16 -0
- data/generica/app/assets/javascripts/templates/users/contacts/_form-core.emblem +19 -0
- data/generica/app/assets/javascripts/templates/users/contacts/index.emblem +62 -0
- data/generica/app/assets/javascripts/templates/users/contacts/new.emblem +16 -0
- data/generica/app/assets/javascripts/templates/users/index.emblem +36 -2
- data/generica/app/assets/stylesheets/apiv1/components/_product-display.css.scss +7 -2
- data/generica/app/assets/stylesheets/apiv1/shared/_constants.css.scss +3 -0
- data/generica/app/controllers/apiv1/contacts/create_controller.rb +26 -0
- data/generica/app/controllers/apiv1/contacts/destroy_controller.rb +9 -0
- data/generica/app/controllers/apiv1/contacts/index_controller.rb +27 -0
- data/generica/app/controllers/apiv1/contacts/show_controller.rb +9 -0
- data/generica/app/controllers/apiv1/contacts/update_controller.rb +51 -0
- data/generica/app/controllers/apiv1/products/destroy_controller.rb +1 -1
- data/generica/app/models/admin/user.rb +20 -1
- data/generica/app/models/apiv1/user_contact.rb +51 -0
- data/generica/app/varissets/javascripts/templates/components/product-display.emblem.erb +34 -40
- data/generica/app/varissets/javascripts/templates/components/product-listing.emblem.erb +24 -16
- data/generica/app/varissets/javascripts/templates/components/site-nav.emblem.erb +12 -2
- data/generica/app/varissets/stylesheets/apiv1/components/_product-display.css.scss.erb +68 -31
- data/generica/app/varissets/stylesheets/apiv1/components/_product-listing.css.scss.erb +52 -14
- data/generica/config/routes.rb +5 -0
- data/generica/db/migrate/20141209185352_create_apiv1_user_contacts.rb +14 -0
- data/generica/spec/controllers/apiv1/contacts/update_controller_spec.rb +59 -0
- data/generica/spec/factories/admin/user_factory.rb +22 -4
- data/generica/spec/models/apiv1/user_contact_spec.rb +70 -0
- data/lib/cloudrider/version.rb +1 -1
- metadata +25 -2
data/generica/config/routes.rb
CHANGED
@@ -28,6 +28,11 @@ Rails.application.routes.draw do
|
|
28
28
|
resources :offers, only: [:show], controller: 'offers/show'
|
29
29
|
resources :offers, only: [:destroy], controller: 'offers/destroy'
|
30
30
|
resources :offers, only: [:index], controller: 'offers/index'
|
31
|
+
resources :contacts, only: [:create], controller: 'contacts/create'
|
32
|
+
resources :contacts, only: [:update], controller: 'contacts/update'
|
33
|
+
resources :contacts, only: [:destroy], controller: 'contacts/destroy'
|
34
|
+
resources :contacts, only: [:index], controller: 'contacts/index'
|
35
|
+
resources :contacts, only: [:show], controller: 'contacts/show'
|
31
36
|
end
|
32
37
|
|
33
38
|
namespace :users do
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateApiv1UserContacts < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :apiv1_user_contacts do |t|
|
4
|
+
t.references :user, index: true
|
5
|
+
t.string :name
|
6
|
+
t.string :phone
|
7
|
+
t.string :email
|
8
|
+
t.string :address
|
9
|
+
t.datetime :made_primary_at
|
10
|
+
t.datetime :deleted_at
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Apiv1::Contacts::UpdateController do
|
4
|
+
let(:user) { Admin::UserFactory.mock }
|
5
|
+
let(:contact) { user.raw_contacts.create! @contact_params }
|
6
|
+
before do
|
7
|
+
@contact_params = {
|
8
|
+
name: 'The Dog',
|
9
|
+
phone: '123 41234',
|
10
|
+
email: 'doggie@rat.co',
|
11
|
+
address: '654 Doggie Lane'
|
12
|
+
}
|
13
|
+
controller.auto_login user
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#update' do
|
17
|
+
before do
|
18
|
+
time = DateTime.now
|
19
|
+
@update_params = {
|
20
|
+
name: 'End of Disc 3',
|
21
|
+
phone: 'Disc 4',
|
22
|
+
email: 'curious@yes.there',
|
23
|
+
address: 'come across somthing',
|
24
|
+
made_primary_at: time
|
25
|
+
}
|
26
|
+
@expected = {
|
27
|
+
id: contact.id,
|
28
|
+
user_id: user.id,
|
29
|
+
name: 'End of Disc 3',
|
30
|
+
phone: 'Disc 4',
|
31
|
+
email: 'curious@yes.there',
|
32
|
+
address: 'come across somthing'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
let(:update) { -> { put :update, contact: @update_params, id: contact.id } }
|
36
|
+
context 'contact' do
|
37
|
+
before { update.call }
|
38
|
+
subject { JSON.parse(response.body)["contact"].permit("id", "user_id", "name", "phone", "email", "address") }
|
39
|
+
specify { should eq @expected.stringify_keys }
|
40
|
+
end
|
41
|
+
context 'primary' do
|
42
|
+
let(:contact_fetcher) { -> { Admin::User.find(user.id).primary_contact } }
|
43
|
+
subject { update }
|
44
|
+
specify { should change(contact_fetcher, :call).from(nil).to(contact) }
|
45
|
+
end
|
46
|
+
context 'change' do
|
47
|
+
before { update.call }
|
48
|
+
let(:cont) { Apiv1::UserContact.find contact.id }
|
49
|
+
context 'name' do
|
50
|
+
subject { cont.name }
|
51
|
+
specify { should eq @expected[:name] }
|
52
|
+
end
|
53
|
+
context 'status' do
|
54
|
+
subject { cont.made_primary_at.to_formatted_s(:db) }
|
55
|
+
specify { should > @update_params[:made_primary_at].to_formatted_s(:db) }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -10,13 +10,31 @@
|
|
10
10
|
# updated_at :datetime
|
11
11
|
# remember_me_token :string(255)
|
12
12
|
# remember_me_token_expires_at :datetime
|
13
|
+
# user_rank :string(255)
|
14
|
+
# company_name :string(255)
|
15
|
+
# phone_number :string(255)
|
16
|
+
# about_me :text
|
17
|
+
# address :string(255)
|
13
18
|
#
|
14
19
|
|
15
20
|
class Admin::UserFactory < Apiv1::BaseFactory
|
21
|
+
class << self
|
22
|
+
def mock
|
23
|
+
Admin::User.new(attributes).tap(&:save!)
|
24
|
+
end
|
25
|
+
def attributes
|
26
|
+
{
|
27
|
+
email: Faker::Internet.email,
|
28
|
+
password: "asdf123",
|
29
|
+
password_confirmation: "asdf123",
|
30
|
+
company_name: Faker::Company.name,
|
31
|
+
phone_number: '554654',
|
32
|
+
address: Faker::AddressUS.street_address,
|
33
|
+
user_rank: 'admin'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
16
37
|
def attributes
|
17
|
-
|
18
|
-
email: Faker::Internet.email,
|
19
|
-
password: "asdf123"
|
20
|
-
}
|
38
|
+
self.class.attributes
|
21
39
|
end
|
22
40
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# == Schema Information
|
2
|
+
#
|
3
|
+
# Table name: apiv1_user_contacts
|
4
|
+
#
|
5
|
+
# id :integer not null, primary key
|
6
|
+
# user_id :integer
|
7
|
+
# name :string(255)
|
8
|
+
# phone :string(255)
|
9
|
+
# email :string(255)
|
10
|
+
# address :string(255)
|
11
|
+
# made_primary_at :datetime
|
12
|
+
# deleted_at :datetime
|
13
|
+
# created_at :datetime
|
14
|
+
# updated_at :datetime
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'rails_helper'
|
18
|
+
|
19
|
+
RSpec.describe Apiv1::UserContact do
|
20
|
+
let(:user) { Admin::UserFactory.mock }
|
21
|
+
let(:contact) { user.contacts.new @contact_params }
|
22
|
+
before do
|
23
|
+
@contact_params = {
|
24
|
+
name: 'Harold Hardcastle Co.',
|
25
|
+
phone: 'Devonture 314',
|
26
|
+
email: 'hardcastle@police.co.uk',
|
27
|
+
address: '44 Wilbehelm Crescent, Devonture England',
|
28
|
+
status: 'primary'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
context '#to_ember_hash' do
|
32
|
+
before { contact.save! }
|
33
|
+
context 'ownership' do
|
34
|
+
subject { contact.user }
|
35
|
+
specify { should eq user }
|
36
|
+
end
|
37
|
+
context 'equality' do
|
38
|
+
before do
|
39
|
+
@expected = {
|
40
|
+
id: user.id,
|
41
|
+
email: contact.email,
|
42
|
+
user_rank: user.user_rank,
|
43
|
+
company_name: contact.name,
|
44
|
+
phone_number: contact.phone,
|
45
|
+
address: contact.address,
|
46
|
+
about_me: nil
|
47
|
+
}
|
48
|
+
end
|
49
|
+
subject { user.to_ember_hash }
|
50
|
+
specify { should eq @expected }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
describe '#make_primary!' do
|
54
|
+
let(:alt_contact) { user.contacts.create! @alt_params }
|
55
|
+
let(:contact_fetcher) { -> { Admin::User.find(user.id).primary_contact } }
|
56
|
+
before do
|
57
|
+
@alt_params = {
|
58
|
+
name: 'Following Day',
|
59
|
+
phone: '23 23423',
|
60
|
+
email: 'american@sharp.co',
|
61
|
+
address: 'stuff where nowhere'
|
62
|
+
}
|
63
|
+
@contact_fetcher = -> { Apiv1::UserContact.find(contact.id).status }
|
64
|
+
contact.save!
|
65
|
+
end
|
66
|
+
subject { -> { alt_contact.make_primary! } }
|
67
|
+
specify { should change(contact_fetcher, :call).from(contact).to(alt_contact) }
|
68
|
+
specify { should change(@contact_fetcher, :call).from('primary').to(nil) }
|
69
|
+
end
|
70
|
+
end
|
data/lib/cloudrider/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudrider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -197,11 +197,16 @@ files:
|
|
197
197
|
- generica/app/assets/javascripts/controllers/application_controller.js.em
|
198
198
|
- generica/app/assets/javascripts/controllers/index_controller.js.em
|
199
199
|
- generica/app/assets/javascripts/controllers/messages/new_controller.js.em
|
200
|
+
- generica/app/assets/javascripts/controllers/modals/fork_controller.js.em
|
200
201
|
- generica/app/assets/javascripts/controllers/modals/login_controller.js.em
|
201
202
|
- generica/app/assets/javascripts/controllers/modals/register_controller.js.em
|
202
203
|
- generica/app/assets/javascripts/controllers/products/index_controller.js.em
|
203
204
|
- generica/app/assets/javascripts/controllers/products/product/offers/new_controller.js.em
|
204
205
|
- generica/app/assets/javascripts/controllers/products/product/show_controller.js.em
|
206
|
+
- generica/app/assets/javascripts/controllers/users/contact/edit_controller.js.em
|
207
|
+
- generica/app/assets/javascripts/controllers/users/contacts/index_controller.js.em
|
208
|
+
- generica/app/assets/javascripts/controllers/users/contacts/new_controller.js.em
|
209
|
+
- generica/app/assets/javascripts/controllers/users/index_controller.js.em
|
205
210
|
- generica/app/assets/javascripts/controllers/users/offers/index_controller.js.em
|
206
211
|
- generica/app/assets/javascripts/controllers/users/product/edit_controller.js.em
|
207
212
|
- generica/app/assets/javascripts/controllers/users/products/index_controller.js.em
|
@@ -224,6 +229,7 @@ files:
|
|
224
229
|
- generica/app/assets/javascripts/models/admin/session.js.em
|
225
230
|
- generica/app/assets/javascripts/models/admin/taxon.js.em
|
226
231
|
- generica/app/assets/javascripts/models/attachment.js.em
|
232
|
+
- generica/app/assets/javascripts/models/contact.js.em
|
227
233
|
- generica/app/assets/javascripts/models/employee.js.em
|
228
234
|
- generica/app/assets/javascripts/models/listing.js.em
|
229
235
|
- generica/app/assets/javascripts/models/message.js.em
|
@@ -259,6 +265,10 @@ files:
|
|
259
265
|
- generica/app/assets/javascripts/routes/products/index_route.js.em
|
260
266
|
- generica/app/assets/javascripts/routes/products/product/offers/new_route.js.em
|
261
267
|
- generica/app/assets/javascripts/routes/products_route.js.em
|
268
|
+
- generica/app/assets/javascripts/routes/users/contact_route.js.em
|
269
|
+
- generica/app/assets/javascripts/routes/users/contacts/index_route.js.em
|
270
|
+
- generica/app/assets/javascripts/routes/users/contacts/new_route.js.em
|
271
|
+
- generica/app/assets/javascripts/routes/users/index_route.js.em
|
262
272
|
- generica/app/assets/javascripts/routes/users/offers/index_route.js.em
|
263
273
|
- generica/app/assets/javascripts/routes/users/product_route.js.em
|
264
274
|
- generica/app/assets/javascripts/routes/users/products/index_route.js.em
|
@@ -334,6 +344,10 @@ files:
|
|
334
344
|
- generica/app/assets/javascripts/templates/products/product/offers/new.emblem
|
335
345
|
- generica/app/assets/javascripts/templates/products/product/show.emblem
|
336
346
|
- generica/app/assets/javascripts/templates/users.emblem
|
347
|
+
- generica/app/assets/javascripts/templates/users/contact/edit.emblem
|
348
|
+
- generica/app/assets/javascripts/templates/users/contacts/_form-core.emblem
|
349
|
+
- generica/app/assets/javascripts/templates/users/contacts/index.emblem
|
350
|
+
- generica/app/assets/javascripts/templates/users/contacts/new.emblem
|
337
351
|
- generica/app/assets/javascripts/templates/users/index.emblem
|
338
352
|
- generica/app/assets/javascripts/templates/users/offers/index.emblem
|
339
353
|
- generica/app/assets/javascripts/templates/users/offers/slice.emblem
|
@@ -395,6 +409,11 @@ files:
|
|
395
409
|
- generica/app/controllers/admin/sessions/create_controller.rb
|
396
410
|
- generica/app/controllers/admin/sessions/destroy_controller.rb
|
397
411
|
- generica/app/controllers/admin/taxons/create_controller.rb
|
412
|
+
- generica/app/controllers/apiv1/contacts/create_controller.rb
|
413
|
+
- generica/app/controllers/apiv1/contacts/destroy_controller.rb
|
414
|
+
- generica/app/controllers/apiv1/contacts/index_controller.rb
|
415
|
+
- generica/app/controllers/apiv1/contacts/show_controller.rb
|
416
|
+
- generica/app/controllers/apiv1/contacts/update_controller.rb
|
398
417
|
- generica/app/controllers/apiv1/employees/destroy_controller.rb
|
399
418
|
- generica/app/controllers/apiv1/employees/index_controller.rb
|
400
419
|
- generica/app/controllers/apiv1/home_controller.rb
|
@@ -460,6 +479,7 @@ files:
|
|
460
479
|
- generica/app/models/apiv1/taxon.rb
|
461
480
|
- generica/app/models/apiv1/translation.rb
|
462
481
|
- generica/app/models/apiv1/translation_machine.rb
|
482
|
+
- generica/app/models/apiv1/user_contact.rb
|
463
483
|
- generica/app/models/apiv1/users/product_factory.rb
|
464
484
|
- generica/app/models/apiv1/users/product_relationship.rb
|
465
485
|
- generica/app/models/concerns/.keep
|
@@ -570,6 +590,7 @@ files:
|
|
570
590
|
- generica/db/migrate/20141116235808_add_deleted_at_to_apiv1_attachments.rb
|
571
591
|
- generica/db/migrate/20141127230304_create_apiv1_email_requests.rb
|
572
592
|
- generica/db/migrate/20141127230455_create_apiv1_email_objects.rb
|
593
|
+
- generica/db/migrate/20141209185352_create_apiv1_user_contacts.rb
|
573
594
|
- generica/db/schema.rb
|
574
595
|
- generica/db/seeds.rb
|
575
596
|
- generica/db/seeds/dimensions.rb
|
@@ -614,6 +635,7 @@ files:
|
|
614
635
|
- generica/spec/controllers/admin/products/update_controller_spec.rb
|
615
636
|
- generica/spec/controllers/admin/sessions/create_controller_spec.rb
|
616
637
|
- generica/spec/controllers/admin/taxons/create_controller_spec.rb
|
638
|
+
- generica/spec/controllers/apiv1/contacts/update_controller_spec.rb
|
617
639
|
- generica/spec/controllers/apiv1/messages/index_controller_spec.rb
|
618
640
|
- generica/spec/controllers/apiv1/pictures/destroy_controller_spec.rb
|
619
641
|
- generica/spec/controllers/apiv1/taxons/index_controller_spec.rb
|
@@ -640,6 +662,7 @@ files:
|
|
640
662
|
- generica/spec/models/apiv1/products/offer_message_factory_spec.rb
|
641
663
|
- generica/spec/models/apiv1/products_machine_spec.rb
|
642
664
|
- generica/spec/models/apiv1/translation_spec.rb
|
665
|
+
- generica/spec/models/apiv1/user_contact_spec.rb
|
643
666
|
- generica/spec/models/apiv1/users/product_factory_spec.rb
|
644
667
|
- generica/spec/models/i18n/backend/active_record_spec.rb
|
645
668
|
- generica/spec/models/users/products/offer_factory_spec.rb
|