ishapi 0.1.8.149 → 0.1.8.154

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: 9cd7a53ae8d95d217a973a346a43735501330d08ff96705fe24ebf42014a10ba
4
- data.tar.gz: 1d85e34875c2f3c3b026e92eda83e21d4a4409aada61d57cbd9bf3c547c08c02
3
+ metadata.gz: 3ea85f1095f4e6b36f17cdf09ca7df8bc74b42bde53e25b55b9ef99b1ed96694
4
+ data.tar.gz: 24e3d614854cf2b338b1feb4817b0f32de3faa6a9d65a88a09b1091662b0345f
5
5
  SHA512:
6
- metadata.gz: 629a76c8e71f990c024cc5968ab41572216d852c73ababc8101327e74dceb998a28a3a480c8a9d657aa4c8cbe531400b8859830e0d8a5ca853fa2510cd36ee9b
7
- data.tar.gz: 89da2fef64a91d1560b6a76da8403573ad43978fe22da94a4385c014e74ed5aa36da38a58380f0a00397d97ace7062756eee3473611a8eef1e0aa915943510c6
6
+ metadata.gz: a7bad7a0b0452a1da5ba93c9b75270dd7ab041873bf159d9f39540f69616a6bf1b6e8e7d89babd4f49f00f78e6d9952cebc7d76388f973fa202d7e93ff8a928a
7
+ data.tar.gz: 18fcd94cef51deb507f136e5d6cc21a881d0c04fd4061b546d11105aa7a8d7e1c59d43d01c933ed357fd91799294f3f03de24f15dc3d0ef684516d36324208fc
@@ -4,10 +4,12 @@ module Ishapi
4
4
 
5
5
  before_action :check_profile, only: [ :show ]
6
6
 
7
+ =begin
7
8
  def index
8
9
  authorize! :index, ::Gameui::Map
9
10
  @maps = ::Gameui::Map.all
10
11
  end
12
+ =end
11
13
 
12
14
  def show
13
15
  @map = ::Gameui::Map.find_by slug: params[:slug]
@@ -21,12 +23,16 @@ module Ishapi
21
23
  @markers = @markers.order_by( ordering: :asc )
22
24
  end
23
25
 
26
+ # @TODO: move to models
24
27
  if city = City.where( cityname: @map.slug ).first
25
28
  @newsitems = city.newsitems
26
29
  @galleries = city.galleries
27
30
  @reports = city.reports
28
31
  @videos = city.videos
29
32
  end
33
+
34
+ puts! @map, 'prod map'
35
+
30
36
  authorize! :show, @map
31
37
  end
32
38
 
@@ -1,7 +1,6 @@
1
1
 
2
- class Ishapi::My::GalleriesController < Ishapi::My::MyController
2
+ class Ishapi::My::GalleriesController < Ishapi::ApplicationController
3
3
 
4
- ## expects params[:jwt_token]
5
4
  def index
6
5
  authorize! :my_index, Gallery
7
6
  @galleries = @current_user.profile.galleries.unscoped.where( is_trash: false ).order_by( created_at: :desc ).limit(20)
@@ -3,19 +3,20 @@ module Ishapi
3
3
  module My
4
4
  class MyController < Ishapi::ApplicationController
5
5
 
6
- # before_action :set_profile # this is DoS on FB - disabled
7
- # before_action :do_login
8
6
  before_action :check_profile
9
7
 
8
+ # @TODO: move to users_controller
10
9
  def account
11
10
  @profile = current_user&.profile
12
11
  authorize! :show, @profile
12
+ render 'ishapi/users/account'
13
13
  rescue CanCan::AccessDenied
14
14
  render json: {
15
15
  status: :not_ok,
16
16
  }, status: 401
17
17
  end
18
18
 
19
+ =begin
19
20
  private
20
21
 
21
22
  def do_login
@@ -33,6 +34,7 @@ module Ishapi
33
34
  return
34
35
  end
35
36
  end
37
+ =end
36
38
 
37
39
  end
38
40
  end
@@ -1,14 +1,11 @@
1
1
 
2
- module Ishapi
3
- module My
4
- class ReportsController < Ishapi::My::MyController
5
2
 
6
- def index
7
- authorize! :my_index, Report
8
- @reports = @profile.reports
9
- end
3
+ class Ishapi::My::ReportsController < Ishapi::ApplicationController
10
4
 
11
- end
5
+ def index
6
+ authorize! :my_index, Report
7
+ @reports = @profile.reports
12
8
  end
9
+
13
10
  end
14
11
 
@@ -1,14 +1,10 @@
1
1
 
2
- module Ishapi
3
- module My
4
- class VideosController < Ishapi::My::MyController
2
+ class Ishapi::My::VideosController < Ishapi::ApplicationController
5
3
 
6
- def index
7
- authorize! :my_index, Video
8
- @videos = @current_user.profile.videos.unscoped.where( is_trash: false ).order_by( created_at: :desc ).limit(20)
9
- end
10
-
11
- end
4
+ def index
5
+ authorize! :my_index, Video
6
+ @videos = @current_user.profile.videos.unscoped.where( is_trash: false ).order_by( created_at: :desc ).limit(20)
12
7
  end
8
+
13
9
  end
14
10
 
@@ -2,9 +2,20 @@ require_dependency "ishapi/application_controller"
2
2
 
3
3
  module Ishapi
4
4
  class UsersController < ApplicationController
5
- before_action :set_profile, :only => [ :fb_sign_in, :show ]
6
5
 
7
- skip_authorization_check only: %i| login |
6
+ skip_authorization_check only: %i| fb_sign_in login |
7
+
8
+ before_action :check_profile, only: %i| account |
9
+
10
+ def account
11
+ @profile = current_user&.profile
12
+ authorize! :show, @profile
13
+ render 'ishapi/users/account'
14
+ rescue CanCan::AccessDenied
15
+ render json: {
16
+ status: :not_ok,
17
+ }, status: 401
18
+ end
8
19
 
9
20
  def fb_sign_in
10
21
  authorize! :fb_sign_in, Ishapi
@@ -12,10 +23,6 @@ module Ishapi
12
23
  render :action => 'show'
13
24
  end
14
25
 
15
- def show
16
- authorize! :fb_sign_in, Ishapi
17
- end
18
-
19
26
  def login
20
27
  @current_user = User.where( email: params[:email] ).first
21
28
  if !@current_user
@@ -27,12 +34,16 @@ module Ishapi
27
34
 
28
35
  # send the jwt to client
29
36
  @jwt_token = encode(user_id: @current_user.id.to_s)
37
+ @profile = @current_user.profile
38
+
39
+ =begin
30
40
  render json: {
31
41
  email: @current_user.email,
32
42
  jwt_token: @jwt_token,
33
- long_term_token: @long_term_token,
34
43
  n_unlocks: @current_user.profile.n_unlocks,
35
44
  }
45
+ =end
46
+
36
47
  end
37
48
  end
38
49
 
@@ -14,7 +14,7 @@ if item.city
14
14
  json.name item.city.name
15
15
  json.slug item.city.cityname
16
16
  end
17
- json.cityname item.city.cityname
17
+ json.cityname item.city.cityname
18
18
  end
19
19
  json.subhead item.subhead
20
20
  json.description item.descr
@@ -1,8 +1,11 @@
1
1
  #
2
2
  # ishapi / galleries / _show
3
3
  #
4
+
5
+ # @TODO: remove this file, this looks like a newsitem
6
+
4
7
  json.id gallery.id.to_s
5
- json.item_type 'gallery'
8
+ json.item_type gallery.class.name
6
9
  json.name gallery.name
7
10
  json.galleryname gallery.galleryname
8
11
  json.description gallery.description
@@ -5,7 +5,10 @@
5
5
  this_key = [ @gallery, params.permit! ]
6
6
  json.cache! this_key do
7
7
  json.gallery do
8
- json.message "This is premium content - please purchase it to view!"
8
+
9
+ json.id @gallery.id.to_s
10
+ json.item_type @gallery.class.name
11
+
9
12
  json.premium_tier @gallery.premium_tier
10
13
  json.is_premium @gallery.is_premium
11
14
  json.is_purchased false
@@ -13,5 +16,6 @@ json.cache! this_key do
13
16
  # json.partial! 'ishapi/galleries/show', gallery: @gallery
14
17
  # json.partial! 'ishapi/photos/index', :photos => [ @gallery.photos[0] ]
15
18
  end
19
+ json.message "This is premium content - please purchase it to view!"
16
20
  end
17
21
 
@@ -11,22 +11,10 @@ json.cache! this_key do
11
11
  json.description map.description
12
12
  json.w map.w
13
13
  json.h map.h
14
- json.img_path map.img_path
14
+ json.img_path map.image.image.url(:original)
15
15
  json.updated_at map.updated_at
16
16
 
17
- json.markers do
18
- json.array! map.markers do |marker|
19
- json.name marker.name
20
- json.slug marker.slug
21
- json.x marker.x
22
- json.y marker.y
23
- json.w marker.w
24
- json.h marker.h
25
- json.img_path marker.img_path
26
- json.title_img_path marker.title_img_path
27
- json.item_type marker.item_type
28
- end
29
- end
17
+ json.partial! 'ishapi/markers/index', map: map
30
18
 
31
19
  end
32
20
  end
@@ -11,7 +11,7 @@ json.cache! this_key do
11
11
  json.description @map.description
12
12
  json.w @map.w
13
13
  json.h @map.h
14
- json.img_path @map.img_path
14
+ json.img_path @map.image.image.url(:original)
15
15
  json.updated_at @map.updated_at
16
16
 
17
17
  if @map.map
@@ -26,19 +26,7 @@ json.cache! this_key do
26
26
  end
27
27
  end
28
28
 
29
- json.markers do
30
- json.array! @markers do |marker|
31
- json.name marker.name
32
- json.slug marker.slug
33
- json.x marker.x
34
- json.y marker.y
35
- json.w marker.w
36
- json.h marker.h
37
- json.img_path marker.img_path
38
- json.title_img_path marker.title_img_path
39
- json.item_type marker.item_type
40
- end
41
- end
29
+ json.partial! 'ishapi/markers/index', map: @map
42
30
 
43
31
  if @newsitems
44
32
  json.partial! 'ishapi/newsitems/index', :newsitems => @newsitems
@@ -0,0 +1,20 @@
1
+ #
2
+ # ishapi / markers / _index
3
+ #
4
+
5
+ json.markers do
6
+ json.array! map.markers do |marker|
7
+ json.name marker.name
8
+ json.slug marker.slug
9
+ json.x marker.x
10
+ json.y marker.y
11
+ json.w marker.w
12
+ json.h marker.h
13
+ json.centerOffsetX marker.centerOffsetX
14
+ json.centerOffsetY marker.centerOffsetY
15
+ json.img_path marker.image.image.url(:original)
16
+ json.title_img_path marker.title_image.image.url(:thumb)
17
+ json.item_type marker.item_type
18
+ json.url marker.url
19
+ end
20
+ end
@@ -5,17 +5,16 @@
5
5
  json.n_newsitems newsitems.count
6
6
  json.newsitems do
7
7
  json.array! newsitems do |item|
8
-
9
- json.id item.id.to_s
10
8
  json.name item.name
11
9
  json.created_at item.created_at
12
10
  json.updated_at item.updated_at
13
11
 
14
12
  if item.gallery
15
- json.item_type 'gallery'
13
+ json.id item.gallery_id.to_s
14
+ json.item_type item.gallery.class.name
16
15
  json.name item.gallery.name
17
16
  json.galleryname item.gallery.galleryname
18
- json.username item.username || item.gallery.username || 'piousbox'
17
+ json.username item.username || item.gallery.username || 'donor-default'
19
18
  json.n_photos item.gallery.photos.length
20
19
  json.slug item.gallery.galleryname
21
20
  json.subhead item.gallery.subhead
@@ -26,16 +25,16 @@ json.newsitems do
26
25
  json.is_purchased current_user&.profile&.has_premium_purchase( item.gallery )
27
26
  json.partial! 'ishapi/photos/index', :photos => [ item.gallery.photos[0] ]
28
27
  else
29
- json.partial! 'ishapi/photos/index', :photos => item.gallery.photos
28
+ json.partial! 'ishapi/photos/index', :photos => item.gallery.photos[0...3]
30
29
  end
31
30
  end
32
31
 
33
32
  if item.report
34
- json.item_type 'report'
33
+ json.id item.report_id.to_s
34
+ json.item_type item.report.class.name
35
35
  json.name item.report.name
36
36
  json.reportname item.report.name_seo
37
37
  json.subhead item.report.subhead
38
- json.report_id item.report_id.to_s
39
38
  json.username item.report.user_profile.name if item.report.user_profile
40
39
 
41
40
  if item.report.photo
@@ -53,11 +52,16 @@ json.newsitems do
53
52
  end
54
53
 
55
54
  if item.video_id
56
- json.partial! 'ishapi/videos/show', :video => Video.unscoped.find( item.video_id )
55
+ json.id item.video_id.to_s
56
+ # @TODO: why this relation is so weird here?!
57
+ video = Video.unscoped.find( item.video_id )
58
+ json.item_type video.class.name
59
+ json.partial! 'ishapi/videos/show', :video => video
57
60
  end
58
61
 
59
62
  if item.photo
60
- json.item_type 'photo'
63
+ json.id item.photo.id.to_s
64
+ json.item_type item.photo.class.name
61
65
  json.partial! 'ishapi/photos/index', :photos => [ item.photo ]
62
66
  end
63
67
 
@@ -8,4 +8,4 @@ json.photos do
8
8
  json.array! photos do |photo|
9
9
  json.partial! 'ishapi/photos/show', :photo => photo
10
10
  end
11
- end
11
+ end
@@ -1,6 +1,7 @@
1
1
 
2
+
2
3
  json.name @profile.name
3
- json.username @profile.username
4
+ # json.username @profile.username
4
5
  json.email @profile.email
5
6
 
6
7
  json.n_reports @profile.reports.count
@@ -14,3 +15,8 @@ if @profile.current_city
14
15
  json.current_city @profile.current_city
15
16
  end
16
17
 
18
+ json.bookmarks @profile.bookmarks do |b|
19
+ json.name b.name
20
+ json.slug b.slug
21
+ end
22
+
@@ -0,0 +1,2 @@
1
+
2
+ json.partial! 'account'
@@ -0,0 +1,5 @@
1
+
2
+ json.email @profile.email
3
+ json.n_unlocks @profile.n_unlocks
4
+ json.jwt_token @jwt_token
5
+ json.partial! 'account'
@@ -7,13 +7,15 @@ json.n_venues venues.count
7
7
  json.venues do
8
8
  json.array! venues do |venue|
9
9
  json.id venue.id.to_s
10
+
11
+ json.address venue.address if venue.address.present?
10
12
  json.name venue.name
11
13
  json.name_seo venue.name_seo
12
14
  json.subhead venue.subhead
13
15
  json.description venue.descr
14
16
  json.x venue.x
15
17
  json.y venue.y
16
- json.photo venue.profile_photo.photo.url( :thumb ) if venue.profile_photo
18
+ json.photo venue.profile_photo ? venue.profile_photo.photo.url( :thumb ) : image_url('missing.png')
17
19
  json.partial! 'ishapi/tags/index', :tags => venue.tags
18
20
  end
19
21
  end
@@ -11,8 +11,7 @@ json.description video.descr
11
11
  json.subhead video.subhead
12
12
  json.x video.x
13
13
  json.y video.y
14
- json.url video.video.url
15
- json.item_type 'video'
14
+ json.url video.video.url
16
15
 
17
16
  if video.city
18
17
  json.cityname video.city.cityname
@@ -40,6 +39,6 @@ if video.is_premium
40
39
  end
41
40
 
42
41
  if video.thumb
43
- json.photo_s169_url video.thumb.url( :s169 )
42
+ json.photo_s169_url video.thumb.url( :s169 )
44
43
  json.photo_thumb2_url video.thumb.url( :thumb2 )
45
44
  end
data/config/routes.rb CHANGED
@@ -27,8 +27,8 @@ Ishapi::Engine.routes.draw do
27
27
  get 'maps', to: 'maps#index'
28
28
  get 'maps/view/:slug', to: 'maps#show'
29
29
  get 'markers/view/:slug', to: 'maps#show_marker'
30
- get "/my/account", to: "my/my#account"
31
- post "/my/account", to: "my/my#account"
30
+ get "/my/account", to: "users#account"
31
+ post "/my/account", to: "users#account"
32
32
  namespace :my do
33
33
  get 'galleries', to: 'galleries#index'
34
34
  get 'newsitems', to: 'newsitems#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.149
4
+ version: 0.1.8.154
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-17 00:00:00.000000000 Z
11
+ date: 2021-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -206,7 +206,7 @@ files:
206
206
  - app/controllers/ishapi/maps_controller.rb
207
207
  - app/controllers/ishapi/measurements_controller.rb
208
208
  - app/controllers/ishapi/my/galleries_controller.rb
209
- - app/controllers/ishapi/my/my_controller.rb
209
+ - app/controllers/ishapi/my/my_controller.rb-trash
210
210
  - app/controllers/ishapi/my/reports_controller.rb
211
211
  - app/controllers/ishapi/my/videos_controller.rb
212
212
  - app/controllers/ishapi/newsitems_controller.rb
@@ -250,8 +250,7 @@ files:
250
250
  - app/views/ishapi/maps/_show.jbuilder
251
251
  - app/views/ishapi/maps/index.jbuilder
252
252
  - app/views/ishapi/maps/show.jbuilder
253
- - app/views/ishapi/measurements/_show.jbuilder
254
- - app/views/ishapi/my/my/account.jbuilder
253
+ - app/views/ishapi/markers/_index.jbuilder
255
254
  - app/views/ishapi/my/videos/index.jbuilder
256
255
  - app/views/ishapi/newsitems/_index.jbuilder
257
256
  - app/views/ishapi/newsitems/index.jbuilder
@@ -269,7 +268,10 @@ files:
269
268
  - app/views/ishapi/tags/index.jbuilder
270
269
  - app/views/ishapi/tags/show.jbuilder
271
270
  - app/views/ishapi/user_profiles/show.jbuilder
271
+ - app/views/ishapi/users/_account.jbuilder
272
272
  - app/views/ishapi/users/_index.jbuilder
273
+ - app/views/ishapi/users/account.jbuilder
274
+ - app/views/ishapi/users/login.jbuilder
273
275
  - app/views/ishapi/users/show.jbuilder
274
276
  - app/views/ishapi/venues/_index.jbuilder
275
277
  - app/views/ishapi/venues/index.jbuilder
@@ -1,14 +0,0 @@
1
-
2
- # _vp_ 20180309
3
- # MEASUREMENT_PARAMS = [ :neck_around, :chest_around, :waist_around, :sleeve_length, :shoulder_width, :shirt_length, :bicep_around ]
4
- #
5
-
6
- 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
14
- end