ishapi 0.1.8.73 → 0.1.8.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/ishapi/invoices_controller.rb +1 -2
  3. data/app/controllers/ishapi/order_items_controller.rb +6 -16
  4. data/app/controllers/ishapi/orders_controller.rb +0 -9
  5. data/app/models/ishapi/ability.rb +4 -4
  6. data/app/views/ishapi/measurements/_show.jbuilder +1 -11
  7. data/app/views/ishapi/orders/_item.jbuilder +0 -1
  8. data/app/views/ishapi/orders/_show.jbuilder +1 -3
  9. data/app/views/ishapi/reports/_index.jbuilder +0 -9
  10. data/app/views/ishapi/reports/index.jbuilder +1 -6
  11. data/app/views/ishapi/reports/show.jbuilder +0 -17
  12. data/app/views/ishapi/tags/show.jbuilder +4 -4
  13. data/app/views/ishapi/users/show.jbuilder +2 -2
  14. data/app/views/ishapi/venues/_index.jbuilder +0 -2
  15. data/config/routes.rb +3 -5
  16. metadata +2 -38
  17. data/app/controllers/ishapi/api_controller.rb~ +0 -62
  18. data/app/controllers/ishapi/cities_controller.rb~ +0 -72
  19. data/app/controllers/ishapi/galleries_controller.rb~ +0 -20
  20. data/app/controllers/ishapi/measurements_controller.rb +0 -26
  21. data/app/controllers/ishapi/my/my_controller.rb~ +0 -5
  22. data/app/controllers/ishapi/my/reports_controller.rb~ +0 -7
  23. data/app/controllers/ishapi/newsitems_controller.rb~ +0 -10
  24. data/app/controllers/ishapi/products_controller.rb +0 -12
  25. data/app/controllers/ishapi/reports_controller.rb~ +0 -16
  26. data/app/controllers/ishapi/sites_controller.rb~ +0 -16
  27. data/app/controllers/ishapi/users_controller.rb~ +0 -43
  28. data/app/controllers/ishapi/venues_controller.rb~ +0 -23
  29. data/app/models/ishapi/ability.rb~ +0 -14
  30. data/app/views/ishapi/application/_meta.jbuilder~ +0 -11
  31. data/app/views/ishapi/cities/show.jbuilder~ +0 -13
  32. data/app/views/ishapi/galleries/_index.jbuilder~ +0 -10
  33. data/app/views/ishapi/galleries/_show.jbuilder~ +0 -9
  34. data/app/views/ishapi/galleries/index.jbuilder~ +0 -2
  35. data/app/views/ishapi/galleries/show.jbuilder~ +0 -22
  36. data/app/views/ishapi/my/reports/index.jbuilder~ +0 -2
  37. data/app/views/ishapi/newsitems/_index.jbuilder~ +0 -5
  38. data/app/views/ishapi/photos/_index.jbuilder~ +0 -10
  39. data/app/views/ishapi/photos/_show.jbuilder~ +0 -7
  40. data/app/views/ishapi/products/show.jbuilder +0 -9
  41. data/app/views/ishapi/reports/_index.jbuilder~ +0 -12
  42. data/app/views/ishapi/reports/index.jbuilder~ +0 -2
  43. data/app/views/ishapi/reports/show.jbuilder~ +0 -4
  44. data/app/views/ishapi/sites/show.jbuilder~ +0 -14
  45. data/app/views/ishapi/users/_index.jbuilder~ +0 -7
  46. data/app/views/ishapi/users/show.jbuilder~ +0 -9
  47. data/app/views/ishapi/venues/_index.haml~ +0 -13
  48. data/app/views/ishapi/venues/_index.jbuilder~ +0 -14
  49. data/app/views/ishapi/venues/show.jbuilder~ +0 -12
  50. data/app/views/ishapi/videos/_index.jbuilder~ +0 -8
  51. data/app/views/ishapi/videos/_show.jbuilder~ +0 -15
  52. data/config/initializers/koala.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 12af39c1280346d903a873c8346053ac03fc90f1
4
- data.tar.gz: cd8c25a451178205fa63e5a2af2e318e234e0137
3
+ metadata.gz: 4fac47d3eaf34f9148446b344c0500078806ddb9
4
+ data.tar.gz: e0c0533d160f720fdf43da7aa03e5380a495b488
5
5
  SHA512:
6
- metadata.gz: 17b858b804c775c9d76b814df944ad3af6ec8cb72365b93c7095c050d512d05d10ea2fbab9b12dead041d860ebffb7b0bf8e86a36145fb1ee562e6d99641afb1
7
- data.tar.gz: ce1925d071148e73eca801e1e6d237b72e3350b18ac9454363425b0d87e7616c39ac78f6fcac8dbbbf341b3af60f640f27e4c52f9415d089f5fc4691e60e469d
6
+ metadata.gz: 90dc18a9da6a19f8545bd074536d6d94e0aac6b6529baedd172c01eb84b4643c104e5bd15cca36dcf5a05c85d3749fda3404334e21926c7e4db965681940803d
7
+ data.tar.gz: 5f3e19fea79a69014f2e43159796f5d167e13cdae74640fbc3101a0e929adc035fc5c4ff901fffdb95e39c7d7f6df918dd779e797509d45a6a8ef2a10ba96e2b
@@ -5,9 +5,8 @@ module Ishapi
5
5
  def search
6
6
  authorize! :open_permission, ::Ishapi
7
7
  begin
8
- p = IshModels::UserProfile.find_by( :email => params[:email] )
9
8
  i = Ish::Invoice.find_by( :number => params[:number] )
10
- if i.profile == p && i.amount == params[:amount].to_f && i.payments.count == 0
9
+ if i.email == params[:email] && i.amount == params[:amount].to_f && i.payments.count == 0
11
10
  render :json => { :status => :ok }
12
11
  else
13
12
  render :status => 404, :json => {} # :json => { :status => 404, :code => 404, :message => 'Not Found1' }
@@ -6,32 +6,22 @@ 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 )
9
10
  @order_item = CoTailors::OrderItem.new params['order_item'].permit( :quantity, :kind, :fabric )
10
11
  @order_item.order_id = @current_order.id
11
12
  @order_item.measurement = @measurement
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
13
+ @measurement.order_item_id = @order_item.id
14
+ @measurement.save
23
15
 
24
16
  if params[:order_item][:saveMeasurement]
25
- m = @current_profile.measurement || CoTailors::ProfileMeasurement.create( :profile => @current_profile )
17
+ m = @current_profile.measurements[0] || CoTailors::ProfileMeasurement.create( :profile => @current_profile )
26
18
  flag = m.update_attributes( measurement_params )
27
- if !flag
28
- render :json => { :statuc => :not_ok, :error => m.errors.messages }
29
- return
30
- end
19
+ render :json => { :statuc => :not_ok, :error => m.errors.messages } and return if !flag
31
20
  end
32
21
 
33
22
  flag = @order_item.save
34
23
  if flag
24
+ puts! @order_item.measurement, 'ok'
35
25
  render :json => { :status => :ok, :message => 'Successfully put an order item' }
36
26
  else
37
27
  render :json => { :status => :not_ok, :error => @order_item.errors.messages }
@@ -16,15 +16,6 @@ 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
-
28
19
  flag = @order.save
29
20
  if flag
30
21
  render :json => { :status => :ok, :message => 'Successfully placed the order' }
@@ -17,11 +17,12 @@ class Ishapi::Ability
17
17
  gallery.user == user
18
18
  end
19
19
 
20
+
20
21
  can [ :update ], ::CoTailors::Address do |address|
21
22
  puts [ user.inspect, address.inspect ], '+++ user in cancancan'
22
23
  true
23
24
  end
24
-
25
+
25
26
  end
26
27
  #
27
28
  # anonymous user
@@ -32,9 +33,8 @@ class Ishapi::Ability
32
33
 
33
34
  can [ :update ], ::CoTailors::Address
34
35
  can [ :add ], ::CoTailors::OrderItem
35
- can [ :create, :update_measurements ], ::CoTailors::Order
36
- can [ :show ], ::CoTailors::Product
37
-
36
+ can [ :create ], ::CoTailors::Order
37
+
38
38
  can [ :index, :show ], Event
39
39
 
40
40
  can [ :index ], Gallery
@@ -1,14 +1,4 @@
1
1
 
2
- # _vp_ 20180309
3
- # MEASUREMENT_PARAMS = [ :neck_around, :chest_around, :waist_around, :sleeve_length, :shoulder_width, :shirt_length, :bicep_around ]
4
- #
5
-
6
2
  json.measurement do
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
3
+ json.neck_around measurement.neck_around
14
4
  end
@@ -2,7 +2,6 @@
2
2
  json.kind item.kind
3
3
  json.fabric item.fabric
4
4
  json.quantity item.quantity
5
- json.cost item.cost
6
5
  if item.measurement
7
6
  json.neck_around item.measurement.neck_around
8
7
  end
@@ -1,9 +1,7 @@
1
1
 
2
2
  # ishapi / orders / _show
3
3
 
4
- json.n_items order.items.length
5
- json.order_total order.items.map { |i| i.cost }.reduce( :+ )
6
-
4
+ json.n_items order.items.length
7
5
  json.order do
8
6
  json.array! order.items do |item|
9
7
  json.partial! 'ishapi/orders/item', :item => item
@@ -11,14 +11,5 @@ 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
-
23
14
  end
24
15
  end
@@ -11,12 +11,7 @@ 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 ) # @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
14
+ json.photo report.photo.photo.url( :thumb )
20
15
  end
21
16
  end
22
17
 
@@ -24,23 +24,6 @@ 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
36
27
 
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
44
28
  end
45
-
46
29
  end
@@ -8,7 +8,7 @@ json.id @tag.id.to_s
8
8
  json.name @tag.name
9
9
  json.tagname @tag.tagname
10
10
 
11
- json.partial! 'ishapi/newsitems/index', :newsitems => @tag.newsitems.page( params[:newsitems_page] ).per( 25 )
12
- json.partial! 'ishapi/reports/index', :reports => @tag.reports.page( params[:reports_page] ).per(25)
13
- json.partial! 'ishapi/galleries/index', :galleries => @tag.galleries.page( params[:galleries_page] ).per(25)
14
- json.partial! 'ishapi/videos/index', :videos => @tag.videos.page( params[:videos_page] ).per(25)
11
+ json.partial! 'ishapi/newsitems/index', :newsitems => @tag.newsitems.page( params[:newsitems_page] ).per( params[:newsitems_per] || 25 )
12
+ json.partial! 'ishapi/reports/index', :reports => @tag.reports.page( params[:reports_page] ).per( params[:reports_per] || 25 )
13
+ json.partial! 'ishapi/galleries/index', :galleries => @tag.galleries.page( params[:galleries_page] ).per( params[:galleries_per] || 25 )
14
+ json.partial! 'ishapi/videos/index', :videos => @tag.videos.page( params[:videos_page] ).per( params[:videos_per] || 25 )
@@ -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.measurement
23
- json.partial! 'ishapi/measurements/show', :measurement => @current_profile.measurement
22
+ if @current_profile.measurements[0]
23
+ json.partial! 'ishapi/measurements/show', :measurement => @current_profile.measurements[0]
24
24
  end
25
25
 
26
26
  json.partial! 'ishapi/orders/show', :order => @current_order
@@ -9,11 +9,9 @@ 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
13
12
  json.description venue.descr
14
13
  json.x venue.x
15
14
  json.y venue.y
16
15
  json.photo venue.profile_photo.photo.url( :thumb ) if venue.profile_photo
17
- json.partial! 'ishapi/tags/index', :tags => venue.tags
18
16
  end
19
17
  end
data/config/routes.rb CHANGED
@@ -7,11 +7,9 @@ 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', :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'
10
+
11
+ post 'co_tailors/orders', :to => 'orders#create'
12
+ post 'co_tailors/order_items', :to => 'order_items#create'
15
13
  namespace :co_tailors do
16
14
  end
17
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ishapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.73
4
+ version: 0.1.8.74
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-27 00:00:00.000000000 Z
11
+ date: 2018-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -182,48 +182,34 @@ files:
182
182
  - app/assets/stylesheets/scaffold.css
183
183
  - app/controllers/ishapi/addresses_controller.rb
184
184
  - app/controllers/ishapi/api_controller.rb
185
- - app/controllers/ishapi/api_controller.rb~
186
185
  - app/controllers/ishapi/application_controller.rb
187
186
  - app/controllers/ishapi/articles_controller.rb
188
187
  - app/controllers/ishapi/cities_controller.rb
189
- - app/controllers/ishapi/cities_controller.rb~
190
188
  - app/controllers/ishapi/events_controller.rb
191
189
  - app/controllers/ishapi/galleries_controller.rb
192
- - app/controllers/ishapi/galleries_controller.rb~
193
190
  - app/controllers/ishapi/invoices_controller.rb
194
- - app/controllers/ishapi/measurements_controller.rb
195
191
  - app/controllers/ishapi/my/my_controller.rb
196
- - app/controllers/ishapi/my/my_controller.rb~
197
192
  - app/controllers/ishapi/my/reports_controller.rb
198
- - app/controllers/ishapi/my/reports_controller.rb~
199
193
  - app/controllers/ishapi/newsitems_controller.rb
200
- - app/controllers/ishapi/newsitems_controller.rb~
201
194
  - app/controllers/ishapi/order_items_controller.rb
202
195
  - app/controllers/ishapi/orders_controller.rb
203
196
  - app/controllers/ishapi/payments_controller.rb
204
- - app/controllers/ishapi/products_controller.rb
205
197
  - app/controllers/ishapi/reports_controller.rb
206
- - app/controllers/ishapi/reports_controller.rb~
207
198
  - app/controllers/ishapi/sites_controller.rb
208
- - app/controllers/ishapi/sites_controller.rb~
209
199
  - app/controllers/ishapi/tags_controller.rb
210
200
  - app/controllers/ishapi/user_profiles_controller.rb
211
201
  - app/controllers/ishapi/users_controller.rb
212
- - app/controllers/ishapi/users_controller.rb~
213
202
  - app/controllers/ishapi/venues_controller.rb
214
- - app/controllers/ishapi/venues_controller.rb~
215
203
  - app/controllers/ishapi/videos_controller.rb
216
204
  - app/helpers/ishapi/application_helper.rb
217
205
  - app/helpers/ishapi/articles_helper.rb
218
206
  - app/jobs/ishapi/application_job.rb
219
207
  - app/mailers/ishapi/application_mailer.rb
220
208
  - app/models/ishapi/ability.rb
221
- - app/models/ishapi/ability.rb~
222
209
  - app/models/ishapi/application_record.rb
223
210
  - app/models/ishapi/article.rb
224
211
  - app/views/ishapi/addresses/_show.jbuilder
225
212
  - app/views/ishapi/application/_meta.jbuilder
226
- - app/views/ishapi/application/_meta.jbuilder~
227
213
  - app/views/ishapi/articles/_form.html.erb
228
214
  - app/views/ishapi/articles/edit.html.erb
229
215
  - app/views/ishapi/articles/index.html.erb
@@ -233,61 +219,39 @@ files:
233
219
  - app/views/ishapi/cities/features.jbuilder
234
220
  - app/views/ishapi/cities/index.jbuilder
235
221
  - app/views/ishapi/cities/show.jbuilder
236
- - app/views/ishapi/cities/show.jbuilder~
237
222
  - app/views/ishapi/events/_index.jbuilder
238
223
  - app/views/ishapi/events/show.jbuilder
239
224
  - app/views/ishapi/features/_index.jbuilder
240
225
  - app/views/ishapi/galleries/_index.jbuilder
241
- - app/views/ishapi/galleries/_index.jbuilder~
242
226
  - app/views/ishapi/galleries/_show.jbuilder
243
- - app/views/ishapi/galleries/_show.jbuilder~
244
227
  - app/views/ishapi/galleries/index.jbuilder
245
- - app/views/ishapi/galleries/index.jbuilder~
246
228
  - app/views/ishapi/galleries/show.jbuilder
247
- - app/views/ishapi/galleries/show.jbuilder~
248
229
  - app/views/ishapi/measurements/_show.jbuilder
249
230
  - app/views/ishapi/my/reports/index.jbuilder
250
- - app/views/ishapi/my/reports/index.jbuilder~
251
231
  - app/views/ishapi/newsitems/_index.jbuilder
252
- - app/views/ishapi/newsitems/_index.jbuilder~
253
232
  - app/views/ishapi/newsitems/index.jbuilder
254
233
  - app/views/ishapi/orders/_item.jbuilder
255
234
  - app/views/ishapi/orders/_show.jbuilder
256
235
  - app/views/ishapi/photos/_index.jbuilder
257
- - app/views/ishapi/photos/_index.jbuilder~
258
236
  - app/views/ishapi/photos/_show.jbuilder
259
- - app/views/ishapi/photos/_show.jbuilder~
260
- - app/views/ishapi/products/show.jbuilder
261
237
  - app/views/ishapi/reports/_index.jbuilder
262
- - app/views/ishapi/reports/_index.jbuilder~
263
238
  - app/views/ishapi/reports/index.jbuilder
264
- - app/views/ishapi/reports/index.jbuilder~
265
239
  - app/views/ishapi/reports/show.jbuilder
266
- - app/views/ishapi/reports/show.jbuilder~
267
240
  - app/views/ishapi/sites/show.jbuilder
268
- - app/views/ishapi/sites/show.jbuilder~
269
241
  - app/views/ishapi/tags/_index.jbuilder
270
242
  - app/views/ishapi/tags/_widget.jbuilder
271
243
  - app/views/ishapi/tags/index.jbuilder
272
244
  - app/views/ishapi/tags/show.jbuilder
273
245
  - app/views/ishapi/user_profiles/show.jbuilder
274
246
  - app/views/ishapi/users/_index.jbuilder
275
- - app/views/ishapi/users/_index.jbuilder~
276
247
  - app/views/ishapi/users/show.jbuilder
277
- - app/views/ishapi/users/show.jbuilder~
278
- - app/views/ishapi/venues/_index.haml~
279
248
  - app/views/ishapi/venues/_index.jbuilder
280
- - app/views/ishapi/venues/_index.jbuilder~
281
249
  - app/views/ishapi/venues/index.jbuilder
282
250
  - app/views/ishapi/venues/show.jbuilder
283
- - app/views/ishapi/venues/show.jbuilder~
284
251
  - app/views/ishapi/videos/_index.jbuilder
285
- - app/views/ishapi/videos/_index.jbuilder~
286
252
  - app/views/ishapi/videos/_show.jbuilder
287
- - app/views/ishapi/videos/_show.jbuilder~
288
253
  - app/views/ishapi/videos/index.jbuilder
289
254
  - app/views/layouts/ishapi/application.html.erb
290
- - config/initializers/koala.rb
291
255
  - config/routes.rb
292
256
  - lib/ishapi.rb
293
257
  - lib/ishapi/engine.rb
@@ -1,62 +0,0 @@
1
- require_dependency "ishapi/application_controller"
2
-
3
- module Ishapi
4
- class ArticlesController < ApplicationController
5
- before_action :set_article, only: [:show, :edit, :update, :destroy]
6
-
7
- # GET /articles
8
- def index
9
- @articles = Article.all
10
- end
11
-
12
- # GET /articles/1
13
- def show
14
- end
15
-
16
- # GET /articles/new
17
- def new
18
- @article = Article.new
19
- end
20
-
21
- # GET /articles/1/edit
22
- def edit
23
- end
24
-
25
- # POST /articles
26
- def create
27
- @article = Article.new(article_params)
28
-
29
- if @article.save
30
- redirect_to @article, notice: 'Article was successfully created.'
31
- else
32
- render :new
33
- end
34
- end
35
-
36
- # PATCH/PUT /articles/1
37
- def update
38
- if @article.update(article_params)
39
- redirect_to @article, notice: 'Article was successfully updated.'
40
- else
41
- render :edit
42
- end
43
- end
44
-
45
- # DELETE /articles/1
46
- def destroy
47
- @article.destroy
48
- redirect_to articles_url, notice: 'Article was successfully destroyed.'
49
- end
50
-
51
- private
52
- # Use callbacks to share common setup or constraints between actions.
53
- def set_article
54
- @article = Article.find(params[:id])
55
- end
56
-
57
- # Only allow a trusted parameter "white list" through.
58
- def article_params
59
- params.require(:article).permit(:title, :text)
60
- end
61
- end
62
- end
@@ -1,72 +0,0 @@
1
-
2
- require_dependency "ishapi/application_controller"
3
-
4
- module Ishapi
5
- class ApiController < ApplicationController
6
-
7
- def home
8
- render :json => { :status => :ok, :message => 'Ishapi::ApiController.home',
9
- :n_reports => Report.count, :n_cities => City.count }
10
- end
11
-
12
- =begin
13
- before_action :set_article, only: [:show, :edit, :update, :destroy]
14
-
15
- # GET /articles
16
- def index
17
- @articles = Article.all
18
- end
19
-
20
- # GET /articles/1
21
- def show
22
- end
23
-
24
- # GET /articles/new
25
- def new
26
- @article = Article.new
27
- end
28
-
29
- # GET /articles/1/edit
30
- def edit
31
- end
32
-
33
- # POST /articles
34
- def create
35
- @article = Article.new(article_params)
36
-
37
- if @article.save
38
- redirect_to @article, notice: 'Article was successfully created.'
39
- else
40
- render :new
41
- end
42
- end
43
-
44
- # PATCH/PUT /articles/1
45
- def update
46
- if @article.update(article_params)
47
- redirect_to @article, notice: 'Article was successfully updated.'
48
- else
49
- render :edit
50
- end
51
- end
52
-
53
- # DELETE /articles/1
54
- def destroy
55
- @article.destroy
56
- redirect_to articles_url, notice: 'Article was successfully destroyed.'
57
- end
58
-
59
- private
60
- # Use callbacks to share common setup or constraints between actions.
61
- def set_article
62
- @article = Article.find(params[:id])
63
- end
64
-
65
- # Only allow a trusted parameter "white list" through.
66
- def article_params
67
- params.require(:article).permit(:title, :text)
68
- end
69
- =end
70
-
71
- end
72
- end
@@ -1,20 +0,0 @@
1
- require_dependency "ishapi/application_controller"
2
- module Ishapi
3
- class SitesController < ApplicationController
4
-
5
- def index
6
- @sites = ::Site.all
7
- end
8
-
9
- def show
10
- if params[:domain].include?(".json")
11
- domain = params[:domain][0...-5]
12
- else
13
- domain = params[:domain]
14
- end
15
- @site = ::Site.find_by :domain => domain, :lang => :en
16
- @newsitems = @site.newsitems.limit(10)
17
- end
18
-
19
- end
20
- end
@@ -1,26 +0,0 @@
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
@@ -1,5 +0,0 @@
1
-
2
- class My::MyController < IshApi::ApplicationController
3
-
4
-
5
- end
@@ -1,7 +0,0 @@
1
-
2
- class Ishapi::My::ReportsController < My::MyController
3
-
4
- def index
5
- end
6
-
7
- end
@@ -1,10 +0,0 @@
1
- require_dependency "ishapi/application_controller"
2
-
3
- module Ishapi
4
- class CitiesController < ApplicationController
5
-
6
- def index
7
- end
8
-
9
- end
10
- end
@@ -1,12 +0,0 @@
1
- require_dependency "ishapi/application_controller"
2
- module Ishapi
3
- class ProductsController < ApplicationController
4
-
5
- def show
6
- @product = ::CoTailors::Product.where( :kind => params[:kind] ).first
7
- authorize! :show, @product
8
- end
9
-
10
- end
11
- end
12
-
@@ -1,16 +0,0 @@
1
-
2
- require_dependency "ishapi/application_controller"
3
-
4
- module Ishapi
5
- class CitiesController < ApplicationController
6
-
7
- def index
8
- @cities = City.all
9
- end
10
-
11
- def show
12
- @city = City.find_by :cityname => params[:cityname]
13
- end
14
-
15
- end
16
- end
@@ -1,16 +0,0 @@
1
-
2
- require_dependency "ishapi/application_controller"
3
-
4
- module Ishapi
5
- class CitiesController < ApplicationController
6
-
7
- def index
8
- @cities = City.all
9
- end
10
-
11
- def show
12
- @city = City.find_by :cityname => params[:cityname]
13
- end
14
-
15
- end
16
- end
@@ -1,43 +0,0 @@
1
- require_dependency "ishapi/application_controller"
2
-
3
- module Ishapi
4
- class UsersController < ApplicationController
5
-
6
- def fb_sign_in
7
- authorize! :fb_sign_in, Ishapi
8
-
9
- params.permit!
10
-
11
- access_token = params[:accessToken]
12
- email = params[:email]
13
- name = params[:name]
14
- user = User.where( :email => email ).first
15
-
16
- u = IshModels::UserProfile.find_or_create_by :email => email
17
- u.fb_access_token = access_token
18
- u.name ||= name
19
- u.user = user
20
- u.user ||= User.create( :email => email, :password => (0..8).map { "#{rand(100)}" }.join("#{rand(100)}") )
21
-
22
- if u.save
23
- render :json => { :status => :ok }
24
- else
25
- render :json => { :status => :not_ok, :errors => u.errors.messages }
26
- end
27
- end
28
-
29
- def show
30
- puts! params, 'params'
31
-
32
- # @oauth = Koala::Facebook::OAuth.new # ( app_id, app_secret )
33
- # @oauth.get_user_info_from_cookies(cookies)
34
-
35
- access_token = params[:access_token]
36
- # @graph = Koala::Facebook::Api.new( access_token )
37
- # puts! @graph.get_object 'me'
38
-
39
- raise 'not implemented'
40
- end
41
-
42
- end
43
- end
@@ -1,23 +0,0 @@
1
- require_dependency "ishapi/application_controller"
2
- module Ishapi
3
- class SitesController < ApplicationController
4
-
5
- def index
6
- authorize! :index, ::Site
7
- @sites = ::Site.all
8
- end
9
-
10
- def show
11
- if params[:domain].include?(".json")
12
- domain = params[:domain][0...-5]
13
- else
14
- domain = params[:domain]
15
- end
16
- @site = ::Site.find_by :domain => domain, :lang => :en
17
- authorize! :show, @site
18
-
19
- @newsitems = @site.newsitems.limit(10)
20
- end
21
-
22
- end
23
- end
@@ -1,14 +0,0 @@
1
-
2
- class Ishapi::Ability
3
- include ::CanCan::Ability
4
-
5
- def initialize user
6
- user ||= User.new
7
-
8
- if user.profile && user.profile.manager?
9
- can :manage, :all
10
- else
11
- can :read, :all
12
- end
13
- end
14
- end
@@ -1,11 +0,0 @@
1
-
2
- #
3
- # ishapi / application / _meta
4
- #
5
-
6
- if item.gallery.city
7
- json.city_name item.gallery.city.name
8
- end
9
- if item.gallery.tag
10
- json.tag_name item.gallery.tag.name
11
- end
@@ -1,13 +0,0 @@
1
-
2
- #
3
- # ishapi / cities / show
4
- #
5
-
6
- puts "+++ +++ params are:", params
7
- json.cache! [ @city, params ] do
8
- json.city do
9
- json.id @city.id.to_s
10
- json.name @city.name
11
- json.cityname @city.cityname
12
- end
13
- end
@@ -1,10 +0,0 @@
1
-
2
- #
3
- # ishapi / galleries / _index
4
- #
5
-
6
- json.galleries do
7
- json.array! @city.galleries do |gallery|
8
- json.partial! 'ishapi/galleries/show', :gallery => gallery
9
- end
10
- end
@@ -1,9 +0,0 @@
1
-
2
- #
3
- # ishapi / galleries / _show
4
- #
5
-
6
- json.id gallery.id.to_s
7
- json.name gallery.name
8
- json.galleryname gallery.galleryname
9
- json.partial! 'ishapi/photos/index', :photos => gallery.photos
@@ -1,2 +0,0 @@
1
-
2
- json.a 'b'
@@ -1,22 +0,0 @@
1
-
2
- #
3
- # ishapi / galleries / show
4
- #
5
-
6
- this_key = [ @gallery, params.permit! ]
7
- json.cache! this_key do
8
- json.gallery do
9
- json.id @gallery.id.to_s
10
- json.name @gallery.name
11
- json.galleryname @gallery.galleryname
12
- json.photos do
13
- json.array! @gallery.photos do |photo|
14
- json.photo do
15
- json.thumb_url photo.photo.url( :thumb )
16
- json.large_url photo.photo.url( :large )
17
- end
18
- end
19
- end
20
- end
21
- end
22
-
@@ -1,2 +0,0 @@
1
-
2
- json.a 'b'
@@ -1,5 +0,0 @@
1
-
2
- #
3
- # ishapi / newsitems / _index
4
- #
5
-
@@ -1,10 +0,0 @@
1
-
2
- #
3
- # ishapi / photos / _index
4
- #
5
-
6
- json.photos do
7
- json.array! item.gallery.photos do |photo|
8
- json.partial! 'ishapi/photos/show', :photo => photo
9
- end
10
- end
@@ -1,7 +0,0 @@
1
-
2
- #
3
- # ishapi / photos / _show
4
- #
5
-
6
- json.thumb_url photo.photo.url( :thumb )
7
- json.large_url photo.photo.url( :large )
@@ -1,9 +0,0 @@
1
-
2
- params.permit!
3
- json.cache! [ params, @product ] do
4
- json.cost @product.cost
5
- json.title @product.title
6
- json.description @product.description
7
- json.kind @product.kind
8
- end
9
-
@@ -1,12 +0,0 @@
1
-
2
- #
3
- # ishapi / reports / _index
4
- #
5
-
6
- json.reports do
7
- json.array! reports do |report|
8
- json.id report.id.to_s
9
- json.name report.name
10
- json.description report.descr
11
- end
12
- end
@@ -1,2 +0,0 @@
1
-
2
- json.a 'b'
@@ -1,4 +0,0 @@
1
-
2
- json.report do
3
- json.a 'b'
4
- end
@@ -1,14 +0,0 @@
1
-
2
- #
3
- # ishapi / sites / show
4
- #
5
-
6
- key = [ @site, params.permit! ]
7
- json.cache! key do
8
- json.id @site.id.to_s
9
- json.domain @site.domain
10
- json.lang @site.lang
11
- json.newsitems @site.newsitems
12
-
13
- # json.reports @site.reports
14
- end
@@ -1,7 +0,0 @@
1
-
2
- json.users do
3
- json.array! users do |user|
4
- json.id user.id.to_s
5
- json.email user.email
6
- end
7
- end
@@ -1,9 +0,0 @@
1
-
2
- #
3
- # ishapi / users / _show.jbuilder
4
- #
5
-
6
- json.current_city do
7
- json.id @user_profile.current_city_id.to_s
8
- json.name @user_profile.current_city.name
9
- end
@@ -1,13 +0,0 @@
1
-
2
- #
3
- # ishapi / reports / _index
4
- #
5
-
6
- json.reports do
7
- json.array! reports do |report|
8
- json.id report.id.to_s
9
- json.name report.name
10
- json.reportname report.name_seo
11
- json.description report.descr
12
- end
13
- end
@@ -1,14 +0,0 @@
1
-
2
- #
3
- # ishapi / venues / _index
4
- #
5
-
6
- json.venues do
7
- json.array! venues do |venue|
8
- json.id venue.id.to_s
9
- json.name venue.name
10
- json.description venue.descr
11
- json.x venue.x
12
- json.y venue.y
13
- end
14
- end
@@ -1,12 +0,0 @@
1
-
2
- #
3
- # ishapi / venues / show
4
- #
5
-
6
- key = [ @venue, params.permit! ]
7
- json.cache! key do
8
- json.name @venue.name
9
- json.venuename @venue.name_seo
10
- json.description @venue.descr
11
- end
12
-
@@ -1,8 +0,0 @@
1
-
2
- #
3
- # ishapi / videos / _index
4
- #
5
-
6
- json.videos videos do |v|
7
- json.youtube_id v.youtube_id
8
- end
@@ -1,15 +0,0 @@
1
-
2
- json.id video.id.to_s
3
- json.youtube_id video.youtube_id
4
- json.name video.name
5
- json.description video.descr
6
- json.x video.x
7
- json.y video.y
8
-
9
- if video.city
10
- json.city_name video.city.name
11
- end
12
-
13
- if video.user
14
- json.username video.user.username
15
- end
@@ -1,15 +0,0 @@
1
-
2
- FB = {
3
- '_default' => {
4
- :app => 'trahs',
5
- :secret => 'trhas'
6
- },
7
- 'travel-guide.mobi' => {
8
- :app => '123014244977505',
9
- :secret => 'd74e685795a9ef2427fd586fbca99335'
10
- },
11
- 'colombia-tailors.com' => {
12
- :app => '2005729719751456',
13
- :secret => '7650b1e11ef22318ff5fa33e06b322ee'
14
- }
15
- }