ishapi 0.1.8.148 → 0.1.8.153

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: a6b93828545b3f0c63df48d764a930c0ce189a7b6c56d80ad8d71d22c12ff6af
4
- data.tar.gz: 16ada34a0d549ced6d4bd3cb7103ddd074dac990bcc382f37ab48fa9753d4502
3
+ metadata.gz: 754fefba120e1ee7f87e94a2b3da3a450e07c86e7bd135055cb2240d7ccb5ef7
4
+ data.tar.gz: ff7748716f5c58c458f6635386a77164c943d30b792f1c854a4d8b6977744e9d
5
5
  SHA512:
6
- metadata.gz: 8d950587452e9e0521ea2d5631aa26d7e46929ffe3ba24e31cf1b47c15f4811b089b3e5c67a0c7040ba507f5cc6e47dec914de37b3c90241601f8c5f301857c1
7
- data.tar.gz: 0a1776f2adfaad26e1122efe3a38f19d5685ed8daa454512206f67dd9835fefe8b3ddfea921ad75f221647259a086285daabb08b863819b1d0cc93932aca3f66
6
+ metadata.gz: b44159ee3983c79213b8e2ab0d98c1aaec009268b1d701d276e99475bde50235c233d03a249c03f80158d0507565f06c50aeb9cd4dcb4ac431274d07d0772abe
7
+ data.tar.gz: 92ff67762868d928066fc0fb4d15602f0166da0f7ba74b552c46fd5261bc0a9d26f134768067f1c42ec87872418ff5c983561dc90e975c1e15d5c9db9f3c3f71
@@ -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
 
@@ -0,0 +1,22 @@
1
+ #
2
+ # ishapi / maps / _show
3
+ #
4
+
5
+ this_key = [ map, params.permit! ]
6
+ json.cache! this_key do
7
+ json.map do
8
+ json.id map.id.to_s
9
+ json.slug map.slug
10
+ json.parent_slug map.parent_slug
11
+ json.description map.description
12
+ json.w map.w
13
+ json.h map.h
14
+ json.img_path map.image.image.url(:original)
15
+ json.updated_at map.updated_at
16
+
17
+ json.partial! 'ishapi/markers/index', map: map
18
+
19
+ end
20
+ end
21
+
22
+
@@ -11,9 +11,13 @@ 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
+ if @map.map
18
+ json.partial! 'ishapi/maps/show', map: @map.map
19
+ end
20
+
17
21
  json.breadcrumbs do
18
22
  json.array! @map.breadcrumbs do |b|
19
23
  json.name b[:name]
@@ -22,19 +26,7 @@ json.cache! this_key do
22
26
  end
23
27
  end
24
28
 
25
- json.markers do
26
- json.array! @markers do |marker|
27
- json.name marker.name
28
- json.slug marker.slug
29
- json.x marker.x
30
- json.y marker.y
31
- json.w marker.w
32
- json.h marker.h
33
- json.img_path marker.img_path
34
- json.title_img_path marker.title_img_path
35
- json.item_type marker.item_type
36
- end
37
- end
29
+ json.partial! 'ishapi/markers/index', map: @map
38
30
 
39
31
  if @newsitems
40
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'
@@ -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.148
4
+ version: 0.1.8.153
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-09-28 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
@@ -247,10 +247,10 @@ files:
247
247
  - app/views/ishapi/galleries/show.jbuilder
248
248
  - app/views/ishapi/galleries/show_premium_locked.jbuilder
249
249
  - app/views/ishapi/galleries/show_premium_unlocked.jbuilder
250
+ - app/views/ishapi/maps/_show.jbuilder
250
251
  - app/views/ishapi/maps/index.jbuilder
251
252
  - app/views/ishapi/maps/show.jbuilder
252
- - app/views/ishapi/measurements/_show.jbuilder
253
- - app/views/ishapi/my/my/account.jbuilder
253
+ - app/views/ishapi/markers/_index.jbuilder
254
254
  - app/views/ishapi/my/videos/index.jbuilder
255
255
  - app/views/ishapi/newsitems/_index.jbuilder
256
256
  - app/views/ishapi/newsitems/index.jbuilder
@@ -268,7 +268,10 @@ files:
268
268
  - app/views/ishapi/tags/index.jbuilder
269
269
  - app/views/ishapi/tags/show.jbuilder
270
270
  - app/views/ishapi/user_profiles/show.jbuilder
271
+ - app/views/ishapi/users/_account.jbuilder
271
272
  - app/views/ishapi/users/_index.jbuilder
273
+ - app/views/ishapi/users/account.jbuilder
274
+ - app/views/ishapi/users/login.jbuilder
272
275
  - app/views/ishapi/users/show.jbuilder
273
276
  - app/views/ishapi/venues/_index.jbuilder
274
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