ishapi 0.1.8.189 → 0.1.8.191

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: e7b88652fb9949a0f69a25a7a2972f569ebeb2353014464aee3622de87c0ba5f
4
- data.tar.gz: 175c76708f9cd360743a0752d22dcb8fc2a47dcc022e4ea1be7bec30044b5d97
3
+ metadata.gz: 6810b728f6c15f3cbe1033a35e6f63bf46fa5407b6949195b838423862c2f7a9
4
+ data.tar.gz: 50353e0c352130b314da53a9a250aaed054c28af118dc9c53e233ed5f8b7a99b
5
5
  SHA512:
6
- metadata.gz: 5b16b8d679909aea31a2bf1fefd6e325b350d8f3acf326190e595c4aab8a229cab56a9f5914c9603cd21fa94501362c8507ef8f0d6584ace1d5f187db2fa5b78
7
- data.tar.gz: ca30eabd8eeb8f25476f2ee400ce1a278e6e738bc5bf28714da8caeeeca700c12906c48211e3b51d2520f6a997561dc9891211f0378eb678cd5264f645da276a
6
+ metadata.gz: ee30b8a0815c5eecf6c9e8bd74896212c7006e85083982fc44831b3228bee1837c2336ddf17fef4a73e108b0cf2446bd6a149b529b3549a90c972b3d0bd3a116
7
+ data.tar.gz: 2f1836cd62c6d6cb1351dfb6022b9a803dcf92c8f4dca78735e951035deb8f7541d24f004b82f4a27950553349ec6eb61bfc0dad2f09f879996617d33001f4e4
@@ -10,12 +10,11 @@ class Ishapi::MapsController < Ishapi::ApplicationController
10
10
  @map = @location.map || @location
11
11
 
12
12
  authorize! :show, @map
13
- @newsitems = @location.newsitems
14
13
 
15
- @markers = @map.markers.permitted_to(@current_user.profile).order_by(ordering: :asc)
16
-
17
- @tags = @map.tags
14
+ @newsitems = @location.newsitems.page( params[:newsitems_page]
15
+ ).per( @location.newsitems_page_size )
18
16
 
17
+ @markers = @map.markers.permitted_to(@current_user.profile).order_by(ordering: :asc)
19
18
  # case @map.ordering_type
20
19
  # when ::Gameui::Map::ORDERING_TYPE_ALPHABETIC
21
20
  # @markers = @markers.order_by( name: :asc )
@@ -23,6 +22,15 @@ class Ishapi::MapsController < Ishapi::ApplicationController
23
22
  # @markers = @markers.order_by( ordering: :asc )
24
23
  # end
25
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
+
26
34
  end
27
35
 
28
36
  def show_marker
@@ -0,0 +1,11 @@
1
+
2
+ ## From: https://gist.github.com/be9/6446051
3
+
4
+ current, total, per_page = collection.current_page, collection.total_pages, collection.limit_value
5
+
6
+ json.current current
7
+ json.previous (current > 1 ? (current - 1) : nil)
8
+ json.next (current == total ? nil : (current + 1))
9
+ json.per_page per_page
10
+ json.pages total
11
+ json.count collection.total_count
@@ -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
17
- json.map_type map.map_type
15
+ # json.x map.x
16
+ # json.y map.y
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
@@ -19,14 +18,16 @@ json.markers do
19
18
  json.asset3d_path marker.asset3d ? marker.asset3d.object.url : ''
20
19
 
21
20
  ## @TODO: this is copy-pasted and should be abstracted.
22
- 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
27
- if destination.is_premium
28
- if current_user && current_user.profile
29
- json.is_purchased current_user.profile.has_premium_purchase( destination )
21
+ if destination = marker.destination
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
+ if destination.is_premium
28
+ if current_user && current_user.profile
29
+ json.is_purchased current_user.profile.has_premium_purchase( destination )
30
+ end
30
31
  end
31
32
  end
32
33
 
@@ -2,8 +2,11 @@
2
2
  # ishapi / newsitems / _index
3
3
  #
4
4
 
5
- json.n_newsitems newsitems.count
5
+ json.newsitems_pagination do
6
+ json.partial! "ishapi/application/pagination", collection: newsitems
7
+ end
6
8
  json.newsitems do
9
+
7
10
  json.array! newsitems do |item|
8
11
  json.newsitem_id item.id.to_s
9
12
  json.name item.name
@@ -46,7 +49,6 @@ json.newsitems do
46
49
  json.id item.report_id.to_s
47
50
  json.item_type item.report.class.name
48
51
  json.name item.report.name
49
- json.reportname item.report.slug # @TODO: @deprecated, remove
50
52
  json.slug item.report.slug
51
53
  json.subhead item.report.subhead
52
54
  json.username item.report.user_profile.name if item.report.user_profile
@@ -23,7 +23,13 @@ json.cache! key do
23
23
  json.username @report.user_profile.name if @report.user_profile
24
24
  json.cityname @report.city.cityname if @report.city
25
25
  json.subhead @report.subhead
26
- json.description @report.descr
26
+
27
+ case @report.item_type
28
+ when 'wordpress'
29
+ json.raw_json JSON.parse(@report.raw_json)
30
+ else
31
+ json.description @report.descr
32
+ end
27
33
 
28
34
  if @report.photo
29
35
  json.photo do
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.189
4
+ version: 0.1.8.191
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-18 00:00:00.000000000 Z
11
+ date: 2022-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -299,6 +299,7 @@ files:
299
299
  - app/models/ishapi/ability.rb
300
300
  - app/views/ishapi/addresses/_show.jbuilder
301
301
  - app/views/ishapi/application/_meta.jbuilder
302
+ - app/views/ishapi/application/_pagination.jbuilder
302
303
  - app/views/ishapi/articles/_form.html.erb
303
304
  - app/views/ishapi/articles/edit.html.erb
304
305
  - app/views/ishapi/articles/index.html.erb
@@ -326,6 +327,7 @@ files:
326
327
  - app/views/ishapi/maps/_show_lite.jbuilder-trash
327
328
  - app/views/ishapi/maps/index.jbuilder
328
329
  - app/views/ishapi/maps/show.jbuilder
330
+ - app/views/ishapi/maps/show_restricted.jbuilder
329
331
  - app/views/ishapi/markers/_index.jbuilder
330
332
  - app/views/ishapi/my/videos/index.jbuilder
331
333
  - app/views/ishapi/newsitems/_index.jbuilder