ish_manager 0.1.8.7 → 0.1.8.8

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
  SHA1:
3
- metadata.gz: b23b94a2f137e5e597716c3f33943abf32960ab6
4
- data.tar.gz: 612d34737e9ab14190c84224a7bdda00de3f0d2d
3
+ metadata.gz: b1594e4546b32ebec8c11b0cbbbc1aed8121e3c9
4
+ data.tar.gz: a057abf7cd157cab4a9c747fe833b0bb37e90149
5
5
  SHA512:
6
- metadata.gz: 4d2ecce256a176807daf1364e070dad8d5df1616ef28bd86391421465f72744b9d9ef53325a70994221b2f0866e2ed847d086aae113ac2b338175fb6c0f6e61f
7
- data.tar.gz: add6e01889fc56af6e671c3a123a88986cebcefe81bad112c845b20f82f11e095d11de20cdfefcc77ca1d83e46b55b1ba584356bc2ceab2e4218b70cfdbb2391
6
+ metadata.gz: 96e28f724a493aa8184c9674ace145ef7f73beea80a9744360f45e463b995d901ed8a18be76f0f2a22fd538f20be6cd84433c1b5559353d4d8308b7491838bb7
7
+ data.tar.gz: ec72553038ecd6a931ee261f4bcaf22e3b8ad59f2037eca393c3f46ce3562823f7b07f32c1d8be3b475f5344f96d1b1a3c9e91b9034882c41773bae2f898d13a
@@ -0,0 +1,56 @@
1
+
2
+ class IshManager::PhotosController < IshManager::ApplicationController
3
+
4
+ # @TODO: this is bad? _vp_ 20170513
5
+ skip_authorization_check :only => [ :j_create ]
6
+ protect_from_forgery :except => [ :j_create]
7
+
8
+ def without_gallery
9
+ @photos = Photo.unscoped.where( :gallery => nil, :is_trash => false )
10
+ end
11
+
12
+ def destroy
13
+ @photo = Photo.unscoped.find params[:id]
14
+ authorize! :destroy
15
+ @photo.is_trash = true
16
+ @photo.save
17
+ redirect_to request.referrer
18
+ end
19
+
20
+ def show
21
+ @photo = Photo.unscoped.find params[:id]
22
+ end
23
+
24
+ def j_create
25
+ @photo = Photo.new params[:photo].permit!
26
+ authorize! :create, @photo
27
+ @photo.is_public = true
28
+
29
+ if params[:galleryname]
30
+ gallery = Gallery.unscoped.where( :galleryname => params[:galleryname] ).first
31
+ @photo.gallery_id = gallery.id
32
+ elsif params[:gallery_id]
33
+ gallery = Gallery.find( params[:gallery_id] )
34
+ @photo.gallery_id = gallery.id
35
+ end
36
+
37
+ # @TODO this is badd
38
+ @photo.user = User.where( :username => 'piousbox' ).first
39
+
40
+ if @photo.save
41
+ j = { :name => @photo.photo.original_filename,
42
+ :size => @photo.photo.size,
43
+ :url => @photo.photo.url( :large ),
44
+ :thumbnail_url => @photo.photo.url( :thumb ),
45
+ :delete_url => photo_path(@photo),
46
+ :delete_type => 'DELETE',
47
+ :name => @photo.name
48
+ }
49
+ render :json => [ j ]
50
+ else
51
+ render :json => { "errors" => @photo.errors }
52
+ end
53
+ end
54
+
55
+ end
56
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.7
4
+ version: 0.1.8.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -131,6 +131,7 @@ files:
131
131
  - app/assets/stylesheets/ish_manager/application.css
132
132
  - app/assets/stylesheets/ish_manager/bootstrap.min.css
133
133
  - app/assets/stylesheets/ish_manager/bootstrap.min.css.map
134
+ - app/controllers/ish_manager/#photos_controller.rb#
134
135
  - app/controllers/ish_manager/application_controller.rb
135
136
  - app/controllers/ish_manager/cities_controller.rb
136
137
  - app/controllers/ish_manager/features_controller.rb