media_gallery 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +59 -8
  3. data/app/controllers/media_gallery/application_controller.rb +18 -2
  4. data/app/controllers/media_gallery/galleries_controller.rb +1 -0
  5. data/app/controllers/media_gallery/image_infos_controller.rb +45 -10
  6. data/app/controllers/media_gallery/image_scratches_controller.rb +42 -0
  7. data/app/models/media_gallery/image_info.rb +2 -2
  8. data/app/models/media_gallery/image_scratch.rb +6 -0
  9. data/app/models/media_gallery/image_version.rb +7 -0
  10. data/app/uploaders/media_gallery/image_uploader.rb +1 -31
  11. data/app/views/media_gallery/galleries/_full_gallery.json.jbuilder +8 -1
  12. data/app/views/media_gallery/galleries/_partial_gallery.json.jbuilder +4 -0
  13. data/app/views/media_gallery/galleries/index.json.jbuilder +1 -3
  14. data/app/views/media_gallery/image_infos/_full_image_info.json.jbuilder +3 -2
  15. data/app/views/media_gallery/image_infos/_image_versions.json.jbuilder +6 -0
  16. data/app/views/media_gallery/image_infos/index.json.jbuilder +4 -3
  17. data/app/views/media_gallery/image_scratches/create.json.jbuilder +8 -0
  18. data/app/views/media_gallery/image_scratches/index.json.jbuilder +9 -0
  19. data/config/routes.rb +1 -0
  20. data/db/migrate/20180323061055_create_media_gallery_image_versions.rb +10 -0
  21. data/db/migrate/20180323075708_create_media_gallery_image_scratches.rb +9 -0
  22. data/db/migrate/20180327140541_add_name_to_media_gallery_image_infos.rb +19 -0
  23. data/lib/media_gallery.rb +10 -0
  24. data/lib/media_gallery/version.rb +1 -1
  25. metadata +26 -3
  26. data/app/views/media_gallery/image_infos/_image_urls.json.jbuilder +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d443c952fab62c79a265ef111c88f26537f6f79a
4
- data.tar.gz: b0663082367eaad50c7ff4dcaff339636d391a56
3
+ metadata.gz: 238233271366fe9736f4e19fa6f45edc8ee2463e
4
+ data.tar.gz: ec3de21bec7e82a8a80cc117d0e9f8b915364132
5
5
  SHA512:
6
- metadata.gz: d9799352c1beaa08a381758d545331d4d5350fd342e3a31bf7edc2c0b0bf6bbe40d8494338e6f4b9756f2048aec0e8d5be0830e8350746072d69b9c6ef145c1b
7
- data.tar.gz: bef257b487d175170b64da42448b9cc187b5fb0f2ef69309d836eafdf0c01f2ffc860b2b65e5d3447eec9f70518aeb076aedaa10f9215d574fbb7e53d5990ab0
6
+ metadata.gz: f88efceb98ad382ba7d5fdd81848266e876a31aff8184e68bd9eb6f3ffadcfe89164746d84f2ad35024290f514528276916377a409db3f372506376741aa2bf0
7
+ data.tar.gz: abcc22d093e4947a6df4196a414c4e75aa0e5506b15b3d23ac48ace56f6c620be85579f42837510636ec2c4df529c5dbefd4035bf0f5b0d0221a390687a951d0
data/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # MediaGallery
2
- This gem provides a Rails engine allowing for the storage of images on Amazon S3. Images are organized in galleries. All interactions are done through a simple REST API.
2
+ This gem provides a Rails engine that allows for the storage of images on Amazon S3. Images are organized in galleries. All interactions are done through a simple [REST API](https://github.com/mbeauv/media_gallery/wiki/REST-API).
3
3
 
4
4
  ## Usage
5
- As this is a Rails engine, you need to first mount the engine. This can be done by modifying your config/routes.rb file. You should add a mount point, something like:
5
+ As this is a Rails engine, you need to mount it in your app. This can be done by modifying your config/routes.rb file. You can add a line like:
6
6
 
7
7
  ```ruby
8
8
  mount MediaGallery::Engine => "/media_gallery"
9
9
  ```
10
10
 
11
- Next, you need to deal with access control. media_gallery uses cancancan for access_control. It does not make any assumptions as to what sign in strategy you use. It should work fine with Devise if that's what you use. There are two methods in the MediaGallerythat need to be overridden:
11
+ Next, you need to deal with access control. The media_gallery engine uses [cancancan](https://github.com/CanCanCommunity/cancancan) for access_control. It does not make any assumptions as to what library or method you use for sign in. It works fine with [Devise](https://github.com/plataformatec/devise) if that is what you are using. JWT access will also work. You do need to override two methods in the MediaGallery::ApplicationController class. These methods are:
12
12
 
13
- - current_user: This method returns the current user
14
- - create_ability: Returns an Ability class for use in the media_gallery.
13
+ - current_user: Returns the current user
14
+ - create_ability: Returns an cancan Ability class for use in the media_gallery. It can be your app's defined ability.
15
15
 
16
- The recommended approach for this is to create an initializer. You can check out the one in spec/dummy app. It defines something like:
16
+ The recommended approach for this is to create an initializer. You can check out the one defined in the [spec/dummy](https://github.com/mbeauv/media_gallery/blob/master/spec/dummy/config/initializers/media_gallery_initializer.rb) test app. It defines something like:
17
17
 
18
18
  ```ruby
19
19
  MediaGallery::ApplicationController.class_eval do
@@ -27,8 +27,41 @@ MediaGallery::ApplicationController.class_eval do
27
27
  end
28
28
  end
29
29
  ```
30
+ You can also look at an example of how this can be done with Devise [here](https://github.com/mbeauv/media_gallery/wiki/Integration-with-Devise).
30
31
 
31
- You can check some API samples on the wiki page.
32
+ Lastly, media_gallery uses [carrierwave](https://github.com/carrierwaveuploader/carrierwave) to interact with the S3 storage system. Carrierwave needs to be configured appropriately. The way we do it is through another initializer file (e.g. config/initializers/carrierwave_s3.rb) which defines something like:
33
+
34
+ ```ruby
35
+ class FogSettings
36
+
37
+ def self.S3
38
+ {
39
+ :provider => 'AWS',
40
+ :aws_access_key_id => ENV['MEDIA_GALLERY_TEST_AWS_PUBLIC'],
41
+ :aws_secret_access_key => ENV['MEDIA_GALLERY_TEST_AWS_SECRET']
42
+ }
43
+ end
44
+
45
+ def self.directory
46
+ ENV['MEDIA_GALLERY_TEST_AWS_DIR']
47
+ end
48
+
49
+ end
50
+
51
+ CarrierWave.configure do |config|
52
+
53
+ config.fog_credentials = FogSettings.S3
54
+ config.fog_directory = FogSettings.directory
55
+
56
+ #The following is specifically for Heroku. Heroku only allows you to save data
57
+ #in the tmp folder. We therefore make sure that the tmp files are put there.
58
+ #See https://github.com/jnicklas/carrierwave/wiki/How-to%3A-Make-Carrierwave-work-on-Heroku
59
+ config.cache_dir = "#{Rails.root}/tmp/uploads"
60
+
61
+ end
62
+ ```
63
+
64
+ In the previous block, the MEDIA_GALLERY_TEST_AWS... keys are fed from the environment. You can use whatever approach you want. If deploying in Heroku or AWS, it's better to use this approach as your deployed code does not have hardcoded values.
32
65
 
33
66
  ## Installation
34
67
  Add this line to your application's Gemfile:
@@ -54,7 +87,25 @@ bin/rails media_gallery:install:migrations
54
87
  bin/rails db:migrate SCOPE=media_gallery
55
88
  ```
56
89
  ## Contributing
57
- Contribution directions go here.
90
+
91
+ If you want to help out, no problem. The more, the merrier. You can fix issues if you want to or look at the list of outstanding features here.
92
+
93
+ Make sure that you write unit tests. We presently have model and request specs. The request specs require you to have an AWS account with S3 setup correctly. You then need to define three environment variables:
94
+
95
+ - MEDIA_GALLERY_TEST_AWS_PUBLIC
96
+ - MEDIA_GALLERY_TEST_AWS_SECRET
97
+ - MEDIA_GALLERY_TEST_AWS_DIR
98
+
99
+ The rspecs look for these variables in your environment. On Linux or Mac, you can add something like this to you .bash_profile
100
+
101
+ ```bash
102
+ export MEDIA_GALLERY_TEST_AWS_PUBLIC=AJEJEKNJE87JS
103
+ export MEDIA_GALLERY_TEST_AWS_SECRET=Bskljfslkdjflksjflkjslls+sljksjlk
104
+ export MEDIA_GALLERY_TEST_AWS_DIR=gallery2018
105
+ ```
106
+
107
+ (All values provided in the previous block are fake... obviously :-)
108
+
58
109
 
59
110
  ## License
60
111
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -4,11 +4,27 @@ module MediaGallery
4
4
  include CanCan::ControllerAdditions
5
5
 
6
6
  rescue_from CanCan::AccessDenied do |exception|
7
- render json: { message: "Access Denied" }, status: 403
7
+ render json: { message: "Access Denied." }, status: 403
8
8
  end
9
9
 
10
10
  rescue_from ActiveRecord::RecordInvalid do |exception|
11
- render json: { message: exception.to_s }, status: 500
11
+ render json: { message: exception.to_s }, status: 409
12
+ end
13
+
14
+ rescue_from ActionController::ParameterMissing do |exception|
15
+ render json: { message: "Invalid content." }, status: 400
16
+ end
17
+
18
+ rescue_from ActiveRecord::RecordNotFound do |exception|
19
+ render json: { message: "Access Denied." }, status: 403
20
+ end
21
+
22
+ rescue_from MediaGallery::ScratchImageEmpty do |exception|
23
+ render json: { message: 'No scratch image found.' }, status: 400
24
+ end
25
+
26
+ rescue_from MediaGallery::ImageMissing do |exception|
27
+ render json: { message: 'Image missing.' }, status: 400
12
28
  end
13
29
 
14
30
  def current_user
@@ -7,6 +7,7 @@ module MediaGallery
7
7
 
8
8
  # GET /galleries
9
9
  def index
10
+ raise CanCan::AccessDenied.new unless current_user
10
11
  @galleries = Gallery.where(ownable: current_user).order(name: :asc)
11
12
  authorize! :read, @galleries[0] if @galleries.length > 0
12
13
  end
@@ -17,15 +17,9 @@ module MediaGallery
17
17
 
18
18
  # POST /galleries/1/image_infos
19
19
  def create
20
- image_file = MediaGallery::ImageProcessing.create_photo_file(image_info_params['image'], {})
21
- @image_info = ImageInfo.new(
22
- label: image_info_params[:label],
23
- description: image_info_params[:description],
24
- gallery: @gallery,
25
- image: image_file
26
- )
27
- authorize! :create, @image_info
28
- @image_info.save!
20
+ @image_info = use_scratch?(params) ?
21
+ process_with_scratch(params, @gallery) :
22
+ process_with_image(params, @gallery)
29
23
  end
30
24
 
31
25
  # PATCH/PUT /galleries/1/image_infos/1
@@ -41,9 +35,50 @@ module MediaGallery
41
35
 
42
36
  private
43
37
 
38
+ # Verifies if the image version saved in the user's scratch pad should
39
+ # be used.
40
+ def use_scratch?(params)
41
+ params[:use_scratch] && params[:use_scratch] == 'true'
42
+ end
43
+
44
44
  # Only allow a trusted parameter "white list" through.
45
45
  def image_info_params
46
- params.require(:image_info).permit(:label, :description, :image)
46
+ params.require(:image_info).permit(:name, :description, :image)
47
+ end
48
+
49
+ def process_with_image(params, gallery)
50
+ raise MediaGallery::ImageMissing unless image_info_params['image'];
51
+ ActiveRecord::Base.transaction do
52
+ image_info = ImageInfo.create!(
53
+ name: image_info_params[:name],
54
+ description: image_info_params[:description],
55
+ gallery: gallery
56
+ )
57
+ ImageVersion.create!(image: image_info_params['image'], ownable: image_info)
58
+ authorize! :create, image_info
59
+ image_info.save!
60
+ image_info
61
+ end
62
+ end
63
+
64
+ def process_with_scratch(params, gallery)
65
+ image_scratch = ImageScratch.where(ownable: current_user).first
66
+ raise MediaGallery::ScratchImageEmpty unless image_scratch;
67
+
68
+ image_info = ImageInfo.new(
69
+ name: image_info_params[:name],
70
+ description: image_info_params[:description],
71
+ gallery: gallery,
72
+ image_version: image_scratch.image_version
73
+ )
74
+
75
+ ActiveRecord::Base.transaction do
76
+ image_scratch.update(image_version: nil);
77
+ image_scratch.destroy
78
+ authorize! :create, image_info
79
+ image_info.save!
80
+ image_info
81
+ end
47
82
  end
48
83
  end
49
84
  end
@@ -0,0 +1,42 @@
1
+ require_dependency "media_gallery/application_controller"
2
+ require "media_gallery/image_processing"
3
+
4
+ module MediaGallery
5
+ class ImageScratchesController < ApplicationController
6
+
7
+ # GET /image_scratches
8
+ def index
9
+ raise CanCan::AccessDenied.new unless current_user
10
+ @scratches = ImageScratch.where(ownable: current_user).all
11
+ (authorize! :read, @scratches[0]) unless @scratches.empty?
12
+ end
13
+
14
+ # POST /image_scratches
15
+ def create
16
+ ImageScratch.where(ownable: current_user).destroy_all
17
+
18
+ # The persistence code that follows is suboptimal. I'm a bit tired
19
+ # right now. Don't see it. Needs to be fixed. Issue should be raised.
20
+ # TODO Raise issue here.
21
+ ActiveRecord::Base.transaction do
22
+ @scratch = ImageScratch.new(ownable: current_user);
23
+ authorize! :create, @scratch
24
+ @scratch.save!
25
+ @scratch.image_version = ImageVersion.new(image: image_scratch_params[:image], ownable: @scratch);
26
+ @scratch.save!
27
+ end
28
+
29
+ end
30
+
31
+ # DELETE /image_scratches/1
32
+ def destroy
33
+ ImageScratch.destroy_all(ownable: current_user)
34
+ end
35
+
36
+ private
37
+ # Only allow a trusted parameter "white list" through.
38
+ def image_scratch_params
39
+ params.require(:image_scratch).permit(:image)
40
+ end
41
+ end
42
+ end
@@ -2,9 +2,9 @@ module MediaGallery
2
2
  class ImageInfo < ApplicationRecord
3
3
  belongs_to :gallery
4
4
 
5
- mount_uploader :image, ImageUploader
5
+ has_one :image_version, as: :ownable, dependent: :destroy
6
6
 
7
- validates :label, length: { maximum: 256 }, presence: true
7
+ validates :name, length: { maximum: 256 }, uniqueness: { scope: :gallery }, presence: true
8
8
  validates :description, length: { maximum: 1024 }
9
9
 
10
10
  end
@@ -0,0 +1,6 @@
1
+ module MediaGallery
2
+ class ImageScratch < ApplicationRecord
3
+ belongs_to :ownable, polymorphic: true, autosave: true
4
+ belongs_to :image_version, optional: true, autosave: true
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module MediaGallery
2
+ class ImageVersion < ApplicationRecord
3
+ belongs_to :ownable, polymorphic: true
4
+
5
+ mount_base64_uploader :image, ImageUploader
6
+ end
7
+ end
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'carrierwave'
3
+ require 'carrierwave/base64'
3
4
  require 'fog'
4
5
  require 'carrierwave/orm/activerecord'
5
6
 
@@ -35,37 +36,6 @@ module MediaGallery
35
36
  process :resize_to_fill => [80, 80]
36
37
  end
37
38
 
38
- # Provide a default URL as a default if there hasn't been a file uploaded:
39
- # def default_url(*args)
40
- # # For Rails 3.1+ asset pipeline compatibility:
41
- # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
42
- #
43
- # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
44
- # end
45
-
46
- # Process files as they are uploaded:
47
- # process scale: [200, 300]
48
- #
49
- # def scale(width, height)
50
- # # do something
51
- # end
52
-
53
- # Create different versions of your uploaded files:
54
- # version :thumb do
55
- # process resize_to_fit: [50, 50]
56
- # end
57
-
58
- # Add a white list of extensions which are allowed to be uploaded.
59
- # For images you might use something like this:
60
- # def extension_whitelist
61
- # %w(jpg jpeg gif png)
62
- # end
63
-
64
- # Override the filename of the uploaded files:
65
- # Avoid using model.id or version_name here, see uploader/store.rb for details.
66
- # def filename
67
- # "something.jpg" if original_filename
68
- # end
69
39
  end
70
40
 
71
41
  end
@@ -1,5 +1,12 @@
1
1
  json.id gallery.id
2
2
  json.name gallery.name
3
3
  json.description gallery.description
4
- json.nbImages gallery.image_infos.size
5
4
  json.createdAt gallery.created_at
5
+ json.imageInfos do
6
+ json.array! gallery.image_infos do |image_info|
7
+ json.id image_info.id
8
+ json.name image_info.name
9
+ json.url image_info.image_version.image.url(:thumb_tile)
10
+ json.createdAt image_info.created_at
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ json.id gallery.id
2
+ json.name gallery.name
3
+ json.description gallery.description
4
+ json.nbImages gallery.image_infos.size
@@ -1,5 +1,3 @@
1
1
  json.array! @galleries do |gallery|
2
- json.id gallery.id
3
- json.name gallery.name
4
- json.nbImages gallery.image_infos.size
2
+ json.partial! 'partial_gallery', gallery: gallery
5
3
  end
@@ -1,7 +1,8 @@
1
1
  json.id image_info.id
2
- json.label image_info.label
2
+ json.name image_info.name
3
3
  json.galleryId image_info.gallery.id
4
4
  json.galleryName image_info.gallery.name
5
5
  json.description image_info.description
6
6
  json.createdAt image_info.created_at
7
- json.partial! 'image_urls', image_info: image_info
7
+ json.originalUrl image_info.image_version.image.url
8
+ json.partial! 'image_versions', image_info: image_info
@@ -0,0 +1,6 @@
1
+ json.versions do
2
+ json.array! image_info.image_version.image.versions do |key, version|
3
+ json.name key
4
+ json.url version.url
5
+ end
6
+ end
@@ -1,5 +1,6 @@
1
- json.array! @gallery.image_infos.order(label: :asc) do |image_info|
1
+ json.array! @gallery.image_infos.order(name: :asc) do |image_info|
2
2
  json.id image_info.id
3
- json.label image_info.label
4
- json.partial! 'image_urls', image_info: image_info
3
+ json.name image_info.name
4
+ json.originalUrl image_info.image_version.image.url
5
+ json.partial! 'image_versions', image_info: image_info
5
6
  end
@@ -0,0 +1,8 @@
1
+ json.id @scratch.id
2
+ json.imageVersionId @scratch.image_version.id
3
+ json.variants do
4
+ json.array! @scratch.image_version.image.versions do |key, version|
5
+ json.name key
6
+ json.url version.url
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ json.array! @scratches do |scratch|
2
+ json.id scratch.id
3
+ json.versions do
4
+ json.array! scratch.image_version.image.versions do |key, version|
5
+ json.name key
6
+ json.url version.url
7
+ end
8
+ end
9
+ end
@@ -1,4 +1,5 @@
1
1
  MediaGallery::Engine.routes.draw do
2
+ resources :image_scratches, only: [ :create, :index, :destroy ]
2
3
  resources :galleries do
3
4
  resources :image_infos
4
5
  end
@@ -0,0 +1,10 @@
1
+ class CreateMediaGalleryImageVersions < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :media_gallery_image_versions do |t|
4
+ t.references :ownable, polymorphic: true, index: { name: 'image_version_ownable_index' }
5
+ t.string :image
6
+ t.timestamps
7
+ end
8
+ remove_column :media_gallery_image_infos, :image, :string
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ class CreateMediaGalleryImageScratches < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :media_gallery_image_scratches do |t|
4
+ t.references :ownable, polymorphic: true, index: { name: 'image_scratch_ownable_index' }
5
+ t.belongs_to :image_version, foreign_key: { to_table: :media_gallery_image_versions }
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ class AddNameToMediaGalleryImageInfos < ActiveRecord::Migration[5.1]
2
+
3
+ class MediaGallery::ImageInfo < ActiveRecord::Base
4
+ end
5
+
6
+ def self.up
7
+ add_column :media_gallery_image_infos, :name, :string
8
+ remove_column :media_gallery_image_infos, :label
9
+ MediaGallery::ImageInfo.find_each do |info|
10
+ info.name = "name_#{info.id}"
11
+ info.save!
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ remove_column :media_gallery_image_infos, :name
17
+ add_column :media_gallery_image_infos, :label, :string
18
+ end
19
+ end
@@ -3,4 +3,14 @@ require "carrierwave"
3
3
 
4
4
  module MediaGallery
5
5
 
6
+ # Exception generated when the user does not have a scratch image
7
+ # when it is required.
8
+ class ScratchImageEmpty < StandardError
9
+ end
10
+
11
+ # Exception generated when an image needs to be present in the
12
+ # params section of the message (e.g. ImageInfoController::create).
13
+ class ImageMissing < StandardError
14
+ end
15
+
6
16
  end
@@ -1,3 +1,3 @@
1
1
  module MediaGallery
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: media_gallery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Beauvais
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-03 00:00:00.000000000 Z
11
+ date: 2018-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: carrierwave-base64
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: fog
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -136,26 +150,35 @@ files:
136
150
  - app/controllers/media_gallery/application_controller.rb
137
151
  - app/controllers/media_gallery/galleries_controller.rb
138
152
  - app/controllers/media_gallery/image_infos_controller.rb
153
+ - app/controllers/media_gallery/image_scratches_controller.rb
139
154
  - app/jobs/media_gallery/application_job.rb
140
155
  - app/mailers/media_gallery/application_mailer.rb
141
156
  - app/models/media_gallery/application_record.rb
142
157
  - app/models/media_gallery/gallery.rb
143
158
  - app/models/media_gallery/image_info.rb
159
+ - app/models/media_gallery/image_scratch.rb
160
+ - app/models/media_gallery/image_version.rb
144
161
  - app/uploaders/media_gallery/image_uploader.rb
145
162
  - app/views/media_gallery/galleries/_full_gallery.json.jbuilder
163
+ - app/views/media_gallery/galleries/_partial_gallery.json.jbuilder
146
164
  - app/views/media_gallery/galleries/create.json.jbuilder
147
165
  - app/views/media_gallery/galleries/index.json.jbuilder
148
166
  - app/views/media_gallery/galleries/show.json.jbuilder
149
167
  - app/views/media_gallery/galleries/update.json.jbuilder
150
168
  - app/views/media_gallery/image_infos/_full_image_info.json.jbuilder
151
- - app/views/media_gallery/image_infos/_image_urls.json.jbuilder
169
+ - app/views/media_gallery/image_infos/_image_versions.json.jbuilder
152
170
  - app/views/media_gallery/image_infos/create.json.jbuilder
153
171
  - app/views/media_gallery/image_infos/index.json.jbuilder
154
172
  - app/views/media_gallery/image_infos/show.json.jbuilder
155
173
  - app/views/media_gallery/image_infos/update.json.jbuilder
174
+ - app/views/media_gallery/image_scratches/create.json.jbuilder
175
+ - app/views/media_gallery/image_scratches/index.json.jbuilder
156
176
  - config/routes.rb
157
177
  - db/migrate/20180221141600_create_media_gallery_galleries.rb
158
178
  - db/migrate/20180221155739_create_media_gallery_image_infos.rb
179
+ - db/migrate/20180323061055_create_media_gallery_image_versions.rb
180
+ - db/migrate/20180323075708_create_media_gallery_image_scratches.rb
181
+ - db/migrate/20180327140541_add_name_to_media_gallery_image_infos.rb
159
182
  - lib/media_gallery.rb
160
183
  - lib/media_gallery/engine.rb
161
184
  - lib/media_gallery/image_processing.rb
@@ -1,6 +0,0 @@
1
- json.urls do
2
- image = image_info.image
3
- image.versions.keys.each do |key|
4
- json.set! "#{key}", image.versions[key].url
5
- end
6
- end