ishapi 0.1.8.188 → 0.1.8.190

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: 71793ea6c179dcdd89798221461806ee5bcd00ba94e9e5f92ed378b33e473622
4
- data.tar.gz: fc078c97af8060dba19c745b19a329d05be1e56bd4c831e907aba983316a9442
3
+ metadata.gz: f891100a3a85dcf7b3b9dfaae2582cbd897c62707c8a461cb7db2028180a3746
4
+ data.tar.gz: 2a8abf11cff24eb963e1a58c09e97521c5bfbdc0b5e2b2f71a7f1ae9f4a9a18a
5
5
  SHA512:
6
- metadata.gz: 65a6de0c6777c0bda32fa51ff9e2f222dc06535a5fda670dc428fab3cf8b4d097b963cc11f10c1921203cf8653241d09a145880d94c29b8cd9ce98862e1122ad
7
- data.tar.gz: b63c594ff9530cce12c6338c1458fb274554f3f0115e3a008c6f6674346bb77847e31593c4d8ff3a623c55ad7289fea2b4e1662774efa175f755cdebe3b456e7
6
+ metadata.gz: 4b450ae541f0ccb3a85865af3c3fd41133cc280b20985c002a87756b7ea4dad7063546237a2c3dd6c4f4f15be05003e361141768b9b7f6ed56736d02dbc73c81
7
+ data.tar.gz: bee01f4ad4dc3715fffebe4f18894333df46141c923347ef1fcff0eb6cbd5eeef5115fe105313ddd738fcb17f5deef12d5203d82c879f4142d731560f53e28a4
@@ -10,9 +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)
14
+ @newsitems = @location.newsitems.page( params[:newsitems_page]
15
+ ).per( @location.newsitems_page_size )
16
+
17
+ @markers = @map.markers.permitted_to(@current_user.profile).order_by(ordering: :asc)
16
18
 
17
19
  @tags = @map.tags
18
20
 
@@ -23,14 +25,6 @@ class Ishapi::MapsController < Ishapi::ApplicationController
23
25
  # @markers = @markers.order_by( ordering: :asc )
24
26
  # end
25
27
 
26
- # ## @TODO: figure this out eventually
27
- # if city = City.where( cityname: @map.slug ).first
28
- # # @newsitems = city.newsitems
29
- # @galleries = city.galleries
30
- # @reports = city.reports
31
- # @videos = city.videos
32
- # end
33
-
34
28
  end
35
29
 
36
30
  def show_marker
@@ -10,6 +10,7 @@ class Ishapi::Users::SessionsController < Devise::SessionsController
10
10
  # respond_with resource, location: after_sign_in_path_for(resource)
11
11
 
12
12
  ## Send the jwt to client
13
+ @current_user = resource
13
14
  @jwt_token = encode(user_id: @current_user.id.to_s)
14
15
  @profile = @current_user.profile
15
16
  render 'ishapi/users/login', format: :json, layout: false
@@ -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
@@ -14,7 +14,7 @@ json.cache! this_key do
14
14
  json.h map.h
15
15
  json.x map.x
16
16
  json.y map.y
17
- json.map_type map.map_type
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
@@ -19,13 +19,15 @@ json.markers do
19
19
  json.asset3d_path marker.asset3d ? marker.asset3d.object.url : ''
20
20
 
21
21
  ## @TODO: this is copy-pasted and should be abstracted.
22
- destination = marker.destination
23
- json.premium_tier destination.premium_tier
24
- json.is_premium destination.is_premium
25
- json.id destination.id.to_s
26
- if destination.is_premium
27
- if current_user && current_user.profile
28
- json.is_purchased current_user.profile.has_premium_purchase( destination )
22
+ 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
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
29
31
  end
30
32
  end
31
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.188
4
+ version: 0.1.8.190
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-15 00:00:00.000000000 Z
11
+ date: 2022-09-20 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