ishapi 0.1.8.190 → 0.1.8.192

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f891100a3a85dcf7b3b9dfaae2582cbd897c62707c8a461cb7db2028180a3746
4
- data.tar.gz: 2a8abf11cff24eb963e1a58c09e97521c5bfbdc0b5e2b2f71a7f1ae9f4a9a18a
3
+ metadata.gz: 9f5c1ad68578b52733f865cb38d3c39f284cd292397013ef86d6f85180a73429
4
+ data.tar.gz: 22bbef87fec502ec568cffc8f16d8f0de2c3517cc78eb6cfa47c769e8b85fe1a
5
5
  SHA512:
6
- metadata.gz: 4b450ae541f0ccb3a85865af3c3fd41133cc280b20985c002a87756b7ea4dad7063546237a2c3dd6c4f4f15be05003e361141768b9b7f6ed56736d02dbc73c81
7
- data.tar.gz: bee01f4ad4dc3715fffebe4f18894333df46141c923347ef1fcff0eb6cbd5eeef5115fe105313ddd738fcb17f5deef12d5203d82c879f4142d731560f53e28a4
6
+ metadata.gz: 0ae933fdaacbf915a46bed4ae172d1831e63754ddad5dee9ee130966e35e20739ac65bd7ead6119e514ef6907b9a09b82b4bfdbd85e10ae1ce311c46b7526a17
7
+ data.tar.gz: d8cda98e7fabb820f051178563a616bce7d623179bfc9df0875edb633d02b7322bddc92c26726d27abe4710a293b77ddedf80a0536b4fa93511c88b19b1e2c1b
@@ -15,9 +15,6 @@ class Ishapi::MapsController < Ishapi::ApplicationController
15
15
  ).per( @location.newsitems_page_size )
16
16
 
17
17
  @markers = @map.markers.permitted_to(@current_user.profile).order_by(ordering: :asc)
18
-
19
- @tags = @map.tags
20
-
21
18
  # case @map.ordering_type
22
19
  # when ::Gameui::Map::ORDERING_TYPE_ALPHABETIC
23
20
  # @markers = @markers.order_by( name: :asc )
@@ -25,6 +22,15 @@ class Ishapi::MapsController < Ishapi::ApplicationController
25
22
  # @markers = @markers.order_by( ordering: :asc )
26
23
  # end
27
24
 
25
+ @tags = @map.tags
26
+
27
+ if @map.is_premium && !@current_user.profile.has_premium_purchase( @map )
28
+ render 'show_restricted'
29
+ else
30
+ render 'show'
31
+ end
32
+
33
+
28
34
  end
29
35
 
30
36
  def show_marker
@@ -0,0 +1,13 @@
1
+ require_dependency "ishapi/application_controller"
2
+
3
+ class Ishapi::PhotosController < Ishapi::ApplicationController
4
+
5
+ # before_action :soft_check_long_term_token, only: [ :show ]
6
+ before_action :check_jwt
7
+
8
+ def show
9
+ @photo = Photo.find params[:id]
10
+ authorize! :show, @photo
11
+ end
12
+
13
+ end
@@ -71,6 +71,11 @@ class Ishapi::Ability
71
71
  m.is_public
72
72
  end
73
73
 
74
+ #
75
+ # P
76
+ #
77
+ can [ :show ], Photo
78
+
74
79
  #
75
80
  # R
76
81
  #
@@ -12,15 +12,17 @@ json.cache! this_key do
12
12
  json.description map.description
13
13
  json.w map.w
14
14
  json.h map.h
15
- json.x map.x
16
- json.y map.y
15
+ # json.x map.x
16
+ # json.y map.y
17
17
  # json.map_type map.map_type
18
18
  json.img_path map.image.image.url(:original)
19
19
  json.updated_at map.updated_at
20
20
  json.rated map.rated
21
21
  json.name map.name
22
+
22
23
  json.premium_tier map.premium_tier
23
24
  json.is_premium map.is_premium
25
+ json.is_purchased current_user&.profile&.has_premium_purchase( map )
24
26
 
25
27
  json.breadcrumbs do
26
28
  json.array! map.breadcrumbs do |b|
@@ -0,0 +1,44 @@
1
+ #
2
+ # ishapi / maps / show_restricted
3
+ #
4
+ map = @map
5
+
6
+ this_key = [ map.id, map.updated_at ]
7
+ json.cache! this_key do
8
+
9
+ json.map do
10
+ json.id map.id.to_s
11
+ json.slug map.slug
12
+ json.parent_slug map.parent_slug
13
+ json.updated_at map.updated_at
14
+ json.rated map.rated
15
+ json.name map.name
16
+ json.premium_tier map.premium_tier
17
+ json.is_premium map.is_premium
18
+
19
+ json.breadcrumbs do
20
+ json.array! map.breadcrumbs do |b|
21
+ json.name b[:name]
22
+ json.slug b[:slug]
23
+ json.link b[:link]
24
+ end
25
+ end
26
+
27
+ ## _vp_ 2021-10-14 I removed json parsing from here!
28
+ ## _vp_ 2021-10-19 I added json parsing here!
29
+ ## _vp_ 2022-09-13 Must use my own config, example: 3D -> geodesic. Parent is MapPanelNoZoom, but self is ThreePanelV1
30
+ ## Maybe it's if map_slug is present, rather than parent_slug?
31
+ if map.map_slug.present?
32
+ json.config JSON.parse map.map.config
33
+ json.labels JSON.parse map.map.labels
34
+ else
35
+ json.config JSON.parse map.config
36
+ json.labels JSON.parse map.labels
37
+ end
38
+
39
+ # json.map({ config: {} })
40
+
41
+ end
42
+ end
43
+
44
+
@@ -5,7 +5,6 @@
5
5
  json.markers do
6
6
  json.array! markers do |marker|
7
7
  json.name marker.name
8
- json.slug marker.slug
9
8
  json.x marker.x
10
9
  json.y marker.y
11
10
  json.w marker.w
@@ -20,10 +19,11 @@ json.markers do
20
19
 
21
20
  ## @TODO: this is copy-pasted and should be abstracted.
22
21
  if destination = marker.destination
23
- json.destination_slug destination.slug
24
- json.premium_tier destination.premium_tier
25
- json.is_premium destination.is_premium
26
- json.id destination.id.to_s
22
+ json.destination_slug destination.slug # @TODO: this looks obsolete, if I'm using slug instead. _vp_ 2022-09-23
23
+ json.slug destination.slug
24
+ json.premium_tier destination.premium_tier
25
+ json.is_premium destination.is_premium
26
+ json.id destination.id.to_s
27
27
  if destination.is_premium
28
28
  if current_user && current_user.profile
29
29
  json.is_purchased current_user.profile.has_premium_purchase( destination )
@@ -0,0 +1,6 @@
1
+
2
+ json.photo do
3
+ json.partial! 'ishapi/photos/show', photo: @photo
4
+ json.item_type 'Photo'
5
+ end
6
+
data/config/routes.rb CHANGED
@@ -41,6 +41,7 @@ Ishapi::Engine.routes.draw do
41
41
  post 'payments/unlock', to: 'payments#unlock' # do_purchase
42
42
  post 'stripe_confirm', to: 'payments#stripe_confirm' # @TODO: test-drive
43
43
 
44
+ get 'photos/view/:id', to: 'photos#show'
44
45
  get 'profiles/view/:username', :to => 'user_profiles#show'
45
46
 
46
47
  get 'reports', :to => 'reports#index'
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.190
4
+ version: 0.1.8.192
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-20 00:00:00.000000000 Z
11
+ date: 2022-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -282,6 +282,7 @@ files:
282
282
  - app/controllers/ishapi/order_items_controller.rb
283
283
  - app/controllers/ishapi/orders_controller.rb
284
284
  - app/controllers/ishapi/payments_controller.rb
285
+ - app/controllers/ishapi/photos_controller.rb
285
286
  - app/controllers/ishapi/reports_controller.rb
286
287
  - app/controllers/ishapi/sites_controller.rb
287
288
  - app/controllers/ishapi/stock_watches_controller.rb
@@ -327,6 +328,7 @@ files:
327
328
  - app/views/ishapi/maps/_show_lite.jbuilder-trash
328
329
  - app/views/ishapi/maps/index.jbuilder
329
330
  - app/views/ishapi/maps/show.jbuilder
331
+ - app/views/ishapi/maps/show_restricted.jbuilder
330
332
  - app/views/ishapi/markers/_index.jbuilder
331
333
  - app/views/ishapi/my/videos/index.jbuilder
332
334
  - app/views/ishapi/newsitems/_index.jbuilder
@@ -335,6 +337,7 @@ files:
335
337
  - app/views/ishapi/orders/_show.jbuilder
336
338
  - app/views/ishapi/photos/_index.jbuilder
337
339
  - app/views/ishapi/photos/_show.jbuilder
340
+ - app/views/ishapi/photos/show.jbuilder
338
341
  - app/views/ishapi/products/show.jbuilder
339
342
  - app/views/ishapi/reports/_index.jbuilder
340
343
  - app/views/ishapi/reports/index.jbuilder