ishapi 0.1.8.74 → 0.1.8.75
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ishapi/measurements_controller.rb +26 -0
- data/app/controllers/ishapi/order_items_controller.rb +16 -6
- data/app/controllers/ishapi/orders_controller.rb +9 -0
- data/app/controllers/ishapi/products_controller.rb +12 -0
- data/app/models/ishapi/ability.rb +4 -4
- data/app/views/ishapi/measurements/_show.jbuilder +11 -1
- data/app/views/ishapi/orders/_item.jbuilder +1 -0
- data/app/views/ishapi/orders/_show.jbuilder +3 -1
- data/app/views/ishapi/products/show.jbuilder +9 -0
- data/app/views/ishapi/reports/_index.jbuilder +9 -0
- data/app/views/ishapi/reports/index.jbuilder +6 -1
- data/app/views/ishapi/reports/show.jbuilder +17 -0
- data/app/views/ishapi/users/show.jbuilder +2 -2
- data/app/views/ishapi/venues/_index.jbuilder +2 -0
- data/config/routes.rb +5 -3
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aea33948dc0597f370cec2f06610fa20a092ab0e
|
4
|
+
data.tar.gz: b31f137e9c80e29389c89f921cf7196242b9aeda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f57e3ad0855e726c9f28dd42b3fb540ad7d87486054127887e7fea599c5247e4b8e976d04cb76ba23327f3049310a9dfe732df69dd6f41c7fc7c5105f495094d
|
7
|
+
data.tar.gz: dc72d641ae76ddede37645d63874fb992713fcd11194f746f547dc7752dd843d806e8fe51251ee95de6adea5b32d4d49a5dff6e537766ca6821507a85412cdfd
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
|
3
|
+
module Ishapi
|
4
|
+
class MeasurementsController < ApplicationController
|
5
|
+
before_action :check_profile, :only => [ :update ]
|
6
|
+
|
7
|
+
def update
|
8
|
+
authorize! :update_measurements, CoTailors::Order
|
9
|
+
flag = @current_profile.measurement.update_attributes params[:measurement].permit( CoTailors::Order::MEASUREMENT_PARAMS )
|
10
|
+
|
11
|
+
# byebug
|
12
|
+
|
13
|
+
if flag
|
14
|
+
render :json => { :status => :ok }
|
15
|
+
else
|
16
|
+
render :json => { :status => :not_ok, :error => @current_profile.measurement.errors.messages }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# private
|
22
|
+
#
|
23
|
+
private
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -6,22 +6,32 @@ module Ishapi
|
|
6
6
|
|
7
7
|
def create
|
8
8
|
authorize! :add, CoTailors::OrderItem
|
9
|
-
@measurement = CoTailors::ProfileMeasurement.create params['order_item'].permit( :neck_around )
|
10
9
|
@order_item = CoTailors::OrderItem.new params['order_item'].permit( :quantity, :kind, :fabric )
|
11
10
|
@order_item.order_id = @current_order.id
|
12
11
|
@order_item.measurement = @measurement
|
13
|
-
@
|
14
|
-
|
12
|
+
@order_item.cost = case params[:order_item][:kind]
|
13
|
+
when CoTailors::OrderItem::KIND_SHIRT
|
14
|
+
CoTailors::Product.where( :kind => 'shirt' ).first.cost
|
15
|
+
when CoTailors::OrderItem::KIND_PANTS
|
16
|
+
CoTailors::Product.where( :kind => 'pants' ).first.cost
|
17
|
+
when CoTailors::OrderItem::KIND_SUIT
|
18
|
+
CoTailors::Product.where( :kind => 'suit' ).first.cost
|
19
|
+
end
|
20
|
+
@order_item.measurement = CoTailors::ProfileMeasurement.create params['order_item'].permit( CoTailors::Order::MEASUREMENT_PARAMS )
|
21
|
+
|
22
|
+
# byebug
|
15
23
|
|
16
24
|
if params[:order_item][:saveMeasurement]
|
17
|
-
m = @current_profile.
|
25
|
+
m = @current_profile.measurement || CoTailors::ProfileMeasurement.create( :profile => @current_profile )
|
18
26
|
flag = m.update_attributes( measurement_params )
|
19
|
-
|
27
|
+
if !flag
|
28
|
+
render :json => { :statuc => :not_ok, :error => m.errors.messages }
|
29
|
+
return
|
30
|
+
end
|
20
31
|
end
|
21
32
|
|
22
33
|
flag = @order_item.save
|
23
34
|
if flag
|
24
|
-
puts! @order_item.measurement, 'ok'
|
25
35
|
render :json => { :status => :ok, :message => 'Successfully put an order item' }
|
26
36
|
else
|
27
37
|
render :json => { :status => :not_ok, :error => @order_item.errors.messages }
|
@@ -16,6 +16,15 @@ params = {"token"=>{"id"=>"tok_1BoLkRDpn3WurCccVNQK4pfV", "object"=>"token", "ca
|
|
16
16
|
|
17
17
|
@order = CoTailors::Order.where( :profile_id => @current_profile.id, :submitted_at => nil ).first
|
18
18
|
@order.submitted_at = Time.now
|
19
|
+
|
20
|
+
Stripe.api_key = STRIPE_SK
|
21
|
+
charge = Stripe::Charge.create :amount => @order.grand_total, :currency => 'usd', :source => params['token']['id']
|
22
|
+
flag = charge.outcome[:type] == 'authorized'
|
23
|
+
if !flag
|
24
|
+
render :json => { :status => :not_ok, :message => "Something went wrong with the charge: " + charge.outcome.to_s }
|
25
|
+
return
|
26
|
+
end
|
27
|
+
|
19
28
|
flag = @order.save
|
20
29
|
if flag
|
21
30
|
render :json => { :status => :ok, :message => 'Successfully placed the order' }
|
@@ -17,12 +17,11 @@ class Ishapi::Ability
|
|
17
17
|
gallery.user == user
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
20
|
can [ :update ], ::CoTailors::Address do |address|
|
22
21
|
puts [ user.inspect, address.inspect ], '+++ user in cancancan'
|
23
22
|
true
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
end
|
27
26
|
#
|
28
27
|
# anonymous user
|
@@ -33,8 +32,9 @@ class Ishapi::Ability
|
|
33
32
|
|
34
33
|
can [ :update ], ::CoTailors::Address
|
35
34
|
can [ :add ], ::CoTailors::OrderItem
|
36
|
-
can [ :create ], ::CoTailors::Order
|
37
|
-
|
35
|
+
can [ :create, :update_measurements ], ::CoTailors::Order
|
36
|
+
can [ :show ], ::CoTailors::Product
|
37
|
+
|
38
38
|
can [ :index, :show ], Event
|
39
39
|
|
40
40
|
can [ :index ], Gallery
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
# _vp_ 20180309
|
3
|
+
# MEASUREMENT_PARAMS = [ :neck_around, :chest_around, :waist_around, :sleeve_length, :shoulder_width, :shirt_length, :bicep_around ]
|
4
|
+
#
|
5
|
+
|
2
6
|
json.measurement do
|
3
|
-
json.neck_around
|
7
|
+
json.neck_around measurement.neck_around
|
8
|
+
json.chest_around measurement.chest_around
|
9
|
+
json.waist_around measurement.waist_around
|
10
|
+
json.sleeve_length measurement.sleeve_length
|
11
|
+
json.shoulder_width measurement.shoulder_width
|
12
|
+
json.shirt_length measurement.shirt_length
|
13
|
+
json.bicep_around measurement.bicep_around
|
4
14
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
|
2
2
|
# ishapi / orders / _show
|
3
3
|
|
4
|
-
json.n_items
|
4
|
+
json.n_items order.items.length
|
5
|
+
json.order_total order.items.map { |i| i.cost }.reduce( :+ )
|
6
|
+
|
5
7
|
json.order do
|
6
8
|
json.array! order.items do |item|
|
7
9
|
json.partial! 'ishapi/orders/item', :item => item
|
@@ -11,5 +11,14 @@ json.reports do
|
|
11
11
|
json.name report.name
|
12
12
|
json.reportname report.name_seo
|
13
13
|
json.description report.descr
|
14
|
+
|
15
|
+
if report.photo
|
16
|
+
json.photo do
|
17
|
+
json.thumb_url report.photo.photo.url :thumb
|
18
|
+
json.small_url report.photo.photo.url :small
|
19
|
+
json.large_url report.photo.photo.url :large
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
14
23
|
end
|
15
24
|
end
|
@@ -11,7 +11,12 @@ json.array! @reports do |report|
|
|
11
11
|
json.subhead report.subhead
|
12
12
|
json.description report.descr
|
13
13
|
if report.photo
|
14
|
-
json.photo report.photo.photo.url( :thumb )
|
14
|
+
json.photo report.photo.photo.url( :thumb ) # @deprecated 20180417
|
15
|
+
json.photos do
|
16
|
+
json.thumb_url report.photo.photo.url( :thumb )
|
17
|
+
json.small_url report.photo.photo.url( :small )
|
18
|
+
json.large_url report.photo.photo.url( :large )
|
19
|
+
end
|
15
20
|
end
|
16
21
|
end
|
17
22
|
|
@@ -24,6 +24,23 @@ json.cache! key do
|
|
24
24
|
|
25
25
|
json.subhead @report.subhead
|
26
26
|
json.description @report.descr
|
27
|
+
|
28
|
+
if @report.photo
|
29
|
+
json.photo do
|
30
|
+
json.thumb_url @report.photo.photo.url :thumb
|
31
|
+
json.small_url @report.photo.photo.url :small
|
32
|
+
json.large_url @report.photo.photo.url :large
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
27
36
|
|
37
|
+
# @deprecated, but specs use this _vp_ 20180423
|
38
|
+
if @report.photo
|
39
|
+
json.photo do
|
40
|
+
json.thumb_url @report.photo.photo.url :thumb
|
41
|
+
json.small_url @report.photo.photo.url :small
|
42
|
+
json.large_url @report.photo.photo.url :large
|
43
|
+
end
|
28
44
|
end
|
45
|
+
|
29
46
|
end
|
@@ -19,8 +19,8 @@ if @current_profile.addresses[0]
|
|
19
19
|
json.partial! 'ishapi/addresses/show', :address => @current_profile.addresses[0]
|
20
20
|
end
|
21
21
|
|
22
|
-
if @current_profile.
|
23
|
-
json.partial! 'ishapi/measurements/show', :measurement => @current_profile.
|
22
|
+
if @current_profile.measurement
|
23
|
+
json.partial! 'ishapi/measurements/show', :measurement => @current_profile.measurement
|
24
24
|
end
|
25
25
|
|
26
26
|
json.partial! 'ishapi/orders/show', :order => @current_order
|
@@ -9,9 +9,11 @@ json.venues do
|
|
9
9
|
json.id venue.id.to_s
|
10
10
|
json.name venue.name
|
11
11
|
json.name_seo venue.name_seo
|
12
|
+
json.subhead venue.subhead
|
12
13
|
json.description venue.descr
|
13
14
|
json.x venue.x
|
14
15
|
json.y venue.y
|
15
16
|
json.photo venue.profile_photo.photo.url( :thumb ) if venue.profile_photo
|
17
|
+
json.partial! 'ishapi/tags/index', :tags => venue.tags
|
16
18
|
end
|
17
19
|
end
|
data/config/routes.rb
CHANGED
@@ -7,9 +7,11 @@ Ishapi::Engine.routes.draw do
|
|
7
7
|
get 'cities', :to => 'cities#index'
|
8
8
|
get 'cities/view/:cityname', :to => 'cities#show'
|
9
9
|
get 'cities/features', :to => 'cities#features'
|
10
|
-
|
11
|
-
post 'co_tailors/orders',
|
12
|
-
post 'co_tailors/order_items',
|
10
|
+
|
11
|
+
post 'co_tailors/orders', :to => 'orders#create'
|
12
|
+
post 'co_tailors/order_items', :to => 'order_items#create'
|
13
|
+
post 'co_tailors/measurements', :to => 'measurements#update'
|
14
|
+
get 'co_tailors/products/by-kind/:kind', :to => 'products#show'
|
13
15
|
namespace :co_tailors do
|
14
16
|
end
|
15
17
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ishapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.75
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
@@ -188,12 +188,14 @@ files:
|
|
188
188
|
- app/controllers/ishapi/events_controller.rb
|
189
189
|
- app/controllers/ishapi/galleries_controller.rb
|
190
190
|
- app/controllers/ishapi/invoices_controller.rb
|
191
|
+
- app/controllers/ishapi/measurements_controller.rb
|
191
192
|
- app/controllers/ishapi/my/my_controller.rb
|
192
193
|
- app/controllers/ishapi/my/reports_controller.rb
|
193
194
|
- app/controllers/ishapi/newsitems_controller.rb
|
194
195
|
- app/controllers/ishapi/order_items_controller.rb
|
195
196
|
- app/controllers/ishapi/orders_controller.rb
|
196
197
|
- app/controllers/ishapi/payments_controller.rb
|
198
|
+
- app/controllers/ishapi/products_controller.rb
|
197
199
|
- app/controllers/ishapi/reports_controller.rb
|
198
200
|
- app/controllers/ishapi/sites_controller.rb
|
199
201
|
- app/controllers/ishapi/tags_controller.rb
|
@@ -234,6 +236,7 @@ files:
|
|
234
236
|
- app/views/ishapi/orders/_show.jbuilder
|
235
237
|
- app/views/ishapi/photos/_index.jbuilder
|
236
238
|
- app/views/ishapi/photos/_show.jbuilder
|
239
|
+
- app/views/ishapi/products/show.jbuilder
|
237
240
|
- app/views/ishapi/reports/_index.jbuilder
|
238
241
|
- app/views/ishapi/reports/index.jbuilder
|
239
242
|
- app/views/ishapi/reports/show.jbuilder
|