ish_manager 0.1.8.9 → 0.1.8.10

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: 901029e3f6d4612a252f5fbd3d349cbb4ce58253
4
- data.tar.gz: 9e9352d4d5b67da94470a20ea1ed40ef07f70a6d
3
+ metadata.gz: d1d990fd48fcd8ef39eac0dd229a13a644d5e92b
4
+ data.tar.gz: 0ebf2a2e28ccd6022d0897666d3ddd1f4e81aaed
5
5
  SHA512:
6
- metadata.gz: 26375f5a9fd90bdc1314e9aee94bb057f9b41d22f3ac0ed932b90b1c951ce7ec476b0166adfc278b19cd7ed7f3c017660688f7bb33548dcecdaa17f3ee436337
7
- data.tar.gz: 39ba566e4c4c9f84639c58c8a36518b49e7574e87b0539c84be5f76f6da62a623a89ce7ae68d3e5ad21069ae10ba9ca97936e396f55f218c0afefefaca0b54f5
6
+ metadata.gz: 81669a4f219f60e289822868b66c3eccb9dec1f9409cadcc2d2120b8ab13846fd144deafe33eb2e963b3905103e91346f32324ceebdce7d7a8b0dd327e41e374
7
+ data.tar.gz: e1e658273b2abb0f75712b5957093274aecf9821774474243f26b74e938883356b271d7a3190c0347e5563e5692e0f29c65c57f9d5bbf9b9391de4a0fe7d305d
@@ -26,15 +26,16 @@ class IshManager::PhotosController < IshManager::ApplicationController
26
26
  authorize! :create, @photo
27
27
  @photo.is_public = true
28
28
 
29
+ # find this gallery
29
30
  if params[:galleryname]
30
31
  gallery = Gallery.unscoped.where( :galleryname => params[:galleryname] ).first
31
- @photo.gallery_id = gallery.id
32
- elsif params[:gallery_id]
33
- gallery = Gallery.unscoped.where( :galleryname => params[:gallery_id] ).first
34
- gallery ||= Gallery.unscoped.find( params[:gallery_id] )
35
- @photo.gallery_id = gallery.id
32
+ gallery ||= Gallery.unscoped.find params[:galleryname]
33
+ elsif params[:gallery_id] # this one, let's normalize on id everywhere in manager.
34
+ gallery = Gallery.unscoped.find( params[:gallery_id] )
35
+ gallery ||= Gallery.unscoped.where( :galleryname => params[:gallery_id] ).first
36
36
  end
37
-
37
+ @photo.gallery = gallery
38
+
38
39
  # cache
39
40
  @photo.gallery.site.touch if @photo.gallery.site
40
41
  @photo.gallery.city.touch if @photo.gallery.city
@@ -4,4 +4,4 @@
4
4
  .small-12.columns
5
5
  %h3.center Add Photos
6
6
  %ul{ :id => 'photos', :class => 'thumbnails' }
7
- %input{ :id => 'fileupload', :type => 'file', :name => 'photo[photo]', 'data-url' => gallery_multiadd_path( gallery.galleryname ), :multiple => '' }
7
+ %input{ :id => 'fileupload', :type => 'file', :name => 'photo[photo]', 'data-url' => gallery_multiadd_path( gallery.id ), :multiple => '' }
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.9
4
+ version: 0.1.8.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -131,7 +131,6 @@ 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#
135
134
  - app/controllers/ish_manager/application_controller.rb
136
135
  - app/controllers/ish_manager/cities_controller.rb
137
136
  - app/controllers/ish_manager/features_controller.rb
@@ -1,56 +0,0 @@
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
-