ishapi 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b12aa0f7a51bb0ae81a76a6f54c0bd200f1fcfe5
4
- data.tar.gz: 8c2ae7b6e33a27aa67d429bd586fa509cca5975f
3
+ metadata.gz: 0bc2551ac0f596f9a00805d21aac56f9b47bcb95
4
+ data.tar.gz: 92906c76403bbedfdfa1c48637ff73c2f47890e2
5
5
  SHA512:
6
- metadata.gz: f8fa6de9dff4045b905f2b04a62b4145aaa2bf6c108ec5430e3d11866a6cde6eb539de67e00ba0da44c6101254b4253b0c3b012221df95822eec7a5cb394567d
7
- data.tar.gz: 674e5c1ebca037b4fa0bddae22c782ef4577416d0af19a93404066c4fcf282ed4a88b2bfe31ab82c03be29211c67f2209f17a546d569e94bb07236bfedf639bb
6
+ metadata.gz: 28f3be37b2755ea3a4369b9938c394cda3f8383be3dff28de75dc1402b54f43b9b187b93d2942809ac10a397615b05e0767cc9c2f8623a45d7b8698c8a19a19c
7
+ data.tar.gz: 3c07240b2b30509bb8eb60feb48a7dbd6d2682bb828829720d29274db762f0b957dbbe488fa1c6b3878ce4eaa30527016223ff732aca36cc101dc3905a8abc36
@@ -2,5 +2,11 @@ module Ishapi
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
4
  layout :false
5
+
6
+ def puts! a, b=''
7
+ puts "+++ +++ #{b}"
8
+ puts a.inspect
9
+ end
10
+
5
11
  end
6
12
  end
@@ -0,0 +1,10 @@
1
+ require_dependency "ishapi/application_controller"
2
+ module Ishapi
3
+ class GalleriesController < ApplicationController
4
+
5
+ def show
6
+ @gallery = ::Gallery.find_by :galleryname => params[:galleryname]
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ require_dependency "ishapi/application_controller"
2
+ module Ishapi
3
+ class SitesController < ApplicationController
4
+
5
+ def index
6
+ @sites = ::Site.all
7
+ end
8
+
9
+ def show
10
+ if params[:domain].include?(".json")
11
+ domain = params[:domain][0...-5]
12
+ else
13
+ domain = params[:domain]
14
+ end
15
+ @site = ::Site.find_by :domain => domain, :lang => :en
16
+ @newsitems = @site.newsitems.limit(10)
17
+ end
18
+
19
+ end
20
+ end
@@ -2,3 +2,12 @@
2
2
  #
3
3
  # ishapi / cities / index
4
4
  #
5
+
6
+ key = [ ::IshModels::CacheKey.one.cities ]
7
+ json.cache! key do
8
+ json.array! @cities do |city|
9
+ json.id city.id.to_s
10
+ json.name city.name
11
+ json.cityname city.cityname
12
+ end
13
+ end
@@ -6,8 +6,14 @@
6
6
  key = [ @city, params.permit! ]
7
7
  json.cache! key do
8
8
  json.city do
9
- json.id @city.id.to_s
10
- json.name @city.name
11
- json.cityname @city.cityname
9
+ json.id @city.id.to_s
10
+ json.name @city.name
11
+ json.cityname @city.cityname
12
+ json.description @city.description
13
+ json.x @city.x
14
+ json.y @city.y
15
+ json.partial! 'ishapi/newsitems/index', :newsitems => @city.newsitems
16
+ json.partial! 'ishapi/galleries/index', :galleries => @city.galleries
17
+ json.partial! 'ishapi/reports/index', :reports => @city.reports
12
18
  end
13
19
  end
@@ -0,0 +1,7 @@
1
+
2
+ #
3
+ # ishapi / features / _index
4
+ #
5
+
6
+ json.features do
7
+ end
@@ -0,0 +1,10 @@
1
+
2
+ #
3
+ # ishapi / galleries / _index
4
+ #
5
+
6
+ json.galleries do
7
+ json.array! galleries do |gallery|
8
+ json.partial! 'ishapi/galleries/show', :gallery => gallery
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+
2
+ #
3
+ # ishapi / galleries / _index
4
+ #
5
+
6
+ json.galleries do
7
+ json.array! @city.galleries do |gallery|
8
+ json.partial! 'ishapi/galleries/show', :gallery => gallery
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+
2
+ #
3
+ # ishapi / galleries / _show
4
+ #
5
+
6
+ json.id gallery.id.to_s
7
+ json.name gallery.name
8
+ json.galleryname gallery.galleryname
9
+
10
+ json.partial! 'ishapi/photos/index', :photos => gallery.photos
@@ -0,0 +1,9 @@
1
+
2
+ #
3
+ # ishapi / galleries / _show
4
+ #
5
+
6
+ json.id gallery.id.to_s
7
+ json.name gallery.name
8
+ json.galleryname gallery.galleryname
9
+ json.partial! 'ishapi/photos/index', :photos => gallery.photos
@@ -0,0 +1,15 @@
1
+
2
+ #
3
+ # ishapi / galleries / show
4
+ #
5
+
6
+ this_key = [ @gallery, params.permit! ]
7
+ json.cache! this_key do
8
+ json.gallery do
9
+ json.id @gallery.id.to_s
10
+ json.name @gallery.name
11
+ json.galleryname @gallery.galleryname
12
+ json.partial! 'ishapi/photos/index', :photos => @gallery.photos
13
+ end
14
+ end
15
+
@@ -0,0 +1,22 @@
1
+
2
+ #
3
+ # ishapi / galleries / show
4
+ #
5
+
6
+ this_key = [ @gallery, params.permit! ]
7
+ json.cache! this_key do
8
+ json.gallery do
9
+ json.id @gallery.id.to_s
10
+ json.name @gallery.name
11
+ json.galleryname @gallery.galleryname
12
+ json.photos do
13
+ json.array! @gallery.photos do |photo|
14
+ json.photo do
15
+ json.thumb_url photo.photo.url( :thumb )
16
+ json.large_url photo.photo.url( :large )
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,16 @@
1
+
2
+ #
3
+ # ishapi / newsitems / _index
4
+ #
5
+
6
+ json.newsitems do
7
+ json.array! newsitems do |item|
8
+ if item.gallery
9
+ json.item_type 'gallery' #@TODO: should be a constant
10
+ json.name item.gallery.name
11
+ json.galleryname item.gallery.galleryname
12
+ json.partial! 'ishapi/photos/index', :photos => item.gallery.photos
13
+ end
14
+ json.descr item.descr
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+
2
+ #
3
+ # ishapi / newsitems / _index
4
+ #
5
+
@@ -0,0 +1,10 @@
1
+
2
+ #
3
+ # ishapi / photos / _index
4
+ #
5
+
6
+ json.photos do
7
+ json.array! photos do |photo|
8
+ json.partial! 'ishapi/photos/show', :photo => photo
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+
2
+ #
3
+ # ishapi / photos / _index
4
+ #
5
+
6
+ json.photos do
7
+ json.array! item.gallery.photos do |photo|
8
+ json.partial! 'ishapi/photos/show', :photo => photo
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+
2
+ #
3
+ # ishapi / photos / _show
4
+ #
5
+
6
+ json.mini_url photo.photo.url( :mini )
7
+ json.thumb_url photo.photo.url( :thumb )
8
+ json.small_url photo.photo.url( :small )
9
+ json.large_url photo.photo.url( :large )
@@ -0,0 +1,7 @@
1
+
2
+ #
3
+ # ishapi / photos / _show
4
+ #
5
+
6
+ json.thumb_url photo.photo.url( :thumb )
7
+ json.large_url photo.photo.url( :large )
@@ -0,0 +1,13 @@
1
+
2
+ #
3
+ # ishapi / reports / _index
4
+ #
5
+
6
+ json.reports do
7
+ json.array! reports do |report|
8
+ json.id report.id.to_s
9
+ json.name report.name
10
+ json.reportname report.name_seo
11
+ json.description report.descr
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+
2
+ #
3
+ # ishapi / reports / _index
4
+ #
5
+
6
+ json.reports do
7
+ json.array! reports do |report|
8
+ json.id report.id.to_s
9
+ json.name report.name
10
+ json.description report.descr
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+
2
+ #
3
+ # ishapi / reports / show
4
+ #
5
+
6
+ key = [ @report, params.permit! ]
7
+ json.cache! key do
8
+ json.report do
9
+ json.id @report.id.to_s
10
+ json.name @report.name
11
+ json.reportname @report.name_seo
12
+ json.description @report.descr
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+
2
+ json.report do
3
+ json.a 'b'
4
+ end
@@ -9,10 +9,6 @@ json.cache! key do
9
9
  json.id @site.id.to_s
10
10
  json.domain @site.domain
11
11
  json.lang @site.lang
12
- json.newsitems do
13
- json.array! @newsitems do |item|
14
- json.descr item.descr
15
- end
16
- end
12
+ json.partial! 'ishapi/newsitems/index', :newsitems => @newsitems
17
13
  end
18
14
  end
@@ -6,6 +6,8 @@ Ishapi::Engine.routes.draw do
6
6
  get 'cities', :to => 'cities#index'
7
7
  get 'cities/view/:cityname', :to => 'cities#show'
8
8
 
9
+ get 'galleries/view/:galleryname', :to => 'galleries#show'
10
+
9
11
  get 'reports/view/:name_seo', :to => 'reports#show'
10
12
 
11
13
  get 'sites/view/:domain', :to => 'sites#show', :constraints => { :domain => /[^\/]+/ }
@@ -1,3 +1,3 @@
1
1
  module Ishapi
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.6'
3
3
  end
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.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-12 00:00:00.000000000 Z
11
+ date: 2017-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -102,6 +102,8 @@ files:
102
102
  - app/controllers/ishapi/articles_controller.rb
103
103
  - app/controllers/ishapi/cities_controller.rb
104
104
  - app/controllers/ishapi/cities_controller.rb~
105
+ - app/controllers/ishapi/galleries_controller.rb
106
+ - app/controllers/ishapi/galleries_controller.rb~
105
107
  - app/controllers/ishapi/reports_controller.rb
106
108
  - app/controllers/ishapi/reports_controller.rb~
107
109
  - app/controllers/ishapi/sites_controller.rb
@@ -120,6 +122,23 @@ files:
120
122
  - app/views/ishapi/cities/index.jbuilder
121
123
  - app/views/ishapi/cities/show.jbuilder
122
124
  - app/views/ishapi/cities/show.jbuilder~
125
+ - app/views/ishapi/features/_index.jbuilder
126
+ - app/views/ishapi/galleries/_index.jbuilder
127
+ - app/views/ishapi/galleries/_index.jbuilder~
128
+ - app/views/ishapi/galleries/_show.jbuilder
129
+ - app/views/ishapi/galleries/_show.jbuilder~
130
+ - app/views/ishapi/galleries/show.jbuilder
131
+ - app/views/ishapi/galleries/show.jbuilder~
132
+ - app/views/ishapi/newsitems/_index.jbuilder
133
+ - app/views/ishapi/newsitems/_index.jbuilder~
134
+ - app/views/ishapi/photos/_index.jbuilder
135
+ - app/views/ishapi/photos/_index.jbuilder~
136
+ - app/views/ishapi/photos/_show.jbuilder
137
+ - app/views/ishapi/photos/_show.jbuilder~
138
+ - app/views/ishapi/reports/_index.jbuilder
139
+ - app/views/ishapi/reports/_index.jbuilder~
140
+ - app/views/ishapi/reports/show.jbuilder
141
+ - app/views/ishapi/reports/show.jbuilder~
123
142
  - app/views/ishapi/sites/show.jbuilder
124
143
  - app/views/ishapi/sites/show.jbuilder~
125
144
  - app/views/layouts/ishapi/application.html.erb