alchemy-crop-image 0.1.0

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.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +15 -0
  6. data/Gemfile.lock +289 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +37 -0
  9. data/Rakefile +32 -0
  10. data/alchemy-crop-image.gemspec +42 -0
  11. data/app/assets/config/alchemy_crop_image_manifest.js +2 -0
  12. data/app/assets/images/alchemy/crop/image/.keep +0 -0
  13. data/app/assets/javascripts/alchemy/crop/image/application.js +4 -0
  14. data/app/assets/javascripts/alchemy/crop/image/cropping.js +277 -0
  15. data/app/assets/javascripts/alchemy/crop/image/routes.js.erb +1 -0
  16. data/app/assets/stylesheets/alchemy/crop/image/application.scss +17 -0
  17. data/app/assets/stylesheets/alchemy/crop/image/cropping.scss +144 -0
  18. data/app/controllers/alchemy/admin/pictures/crops_controller.rb +46 -0
  19. data/app/helpers/alchemy/crop/image/application_helper.rb +8 -0
  20. data/app/jobs/alchemy/crop/image/application_job.rb +8 -0
  21. data/app/mailers/alchemy/crop/image/application_mailer.rb +10 -0
  22. data/app/views/alchemy/admin/pictures/_cropping.html.erb +93 -0
  23. data/app/views/alchemy/admin/pictures/show.html.erb +44 -0
  24. data/app/views/layouts/alchemy/crop/image/application.html.erb +15 -0
  25. data/bin/rails +14 -0
  26. data/config/initializers/assets.rb +1 -0
  27. data/config/locales/en.yml +30 -0
  28. data/config/locales/it.yml +30 -0
  29. data/config/routes.rb +13 -0
  30. data/lib/alchemy/crop/image/configuration.rb +23 -0
  31. data/lib/alchemy/crop/image/engine.rb +13 -0
  32. data/lib/alchemy/crop/image/version.rb +7 -0
  33. data/lib/alchemy/crop/image.rb +9 -0
  34. data/lib/generators/alchemy/crop/image/install_generator.rb +26 -0
  35. data/lib/tasks/alchemy/crop/image_tasks.rake +4 -0
  36. metadata +203 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ead09c1459c3dbef7c7474d1d1520fde104926a2e210cc1091cb907d4287b049
4
+ data.tar.gz: d28b42580582443f15d7fa6363b1d8eb5a7b8ef45c74978cf02a1f0f3b0661c5
5
+ SHA512:
6
+ metadata.gz: 90d878fe7e48b57a9f27992cdbfd04d613aceab50425a1540c560e9a2977c8848ea7e050a763f14d55c4c9f1b5b1a9c95be44576801f39a22015056e27bd6c48
7
+ data.tar.gz: '08d313e8942f30251e6d46db946e0c2994ff4440523970409d98e2f7d82d8db417ab726767b0858858fd188cd0cc891d15bca0619affbe09cc3f2afb2e5e72be'
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/db/*.sqlite3-*
7
+ test/dummy/log/*.log
8
+ test/dummy/storage/
9
+ test/dummy/tmp/
10
+ test/dummy/node_modules/
11
+ test/dummy/uploads/
12
+ .idea/
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ alchemy-crop-image
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.7.0
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Declare your gem's dependencies in alchemy-crop-image.gemspec.
5
+ # Bundler will treat runtime dependencies like base dependencies, and
6
+ # development dependencies will be added by default to the :development group.
7
+ gemspec
8
+
9
+ # Declare any dependencies that are still in development here instead of in
10
+ # your gemspec. These might include edge Rails or gems from your path or
11
+ # Git. Remember to move these dependencies to your gemspec before releasing
12
+ # your gem to rubygems.org.
13
+
14
+ # To use a debugger
15
+ # gem 'byebug', group: [:development, :test]
data/Gemfile.lock ADDED
@@ -0,0 +1,289 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ alchemy-crop-image (0.1.0)
5
+ alchemy_cms (>= 4.1)
6
+ js-routes (~> 1.4, >= 1.4.9)
7
+ rails (>= 5.2.0, < 7.0.0)
8
+ sprockets-rails (>= 2.0.0)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actioncable (6.0.2.2)
14
+ actionpack (= 6.0.2.2)
15
+ nio4r (~> 2.0)
16
+ websocket-driver (>= 0.6.1)
17
+ actionmailbox (6.0.2.2)
18
+ actionpack (= 6.0.2.2)
19
+ activejob (= 6.0.2.2)
20
+ activerecord (= 6.0.2.2)
21
+ activestorage (= 6.0.2.2)
22
+ activesupport (= 6.0.2.2)
23
+ mail (>= 2.7.1)
24
+ actionmailer (6.0.2.2)
25
+ actionpack (= 6.0.2.2)
26
+ actionview (= 6.0.2.2)
27
+ activejob (= 6.0.2.2)
28
+ mail (~> 2.5, >= 2.5.4)
29
+ rails-dom-testing (~> 2.0)
30
+ actionpack (6.0.2.2)
31
+ actionview (= 6.0.2.2)
32
+ activesupport (= 6.0.2.2)
33
+ rack (~> 2.0, >= 2.0.8)
34
+ rack-test (>= 0.6.3)
35
+ rails-dom-testing (~> 2.0)
36
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
+ actiontext (6.0.2.2)
38
+ actionpack (= 6.0.2.2)
39
+ activerecord (= 6.0.2.2)
40
+ activestorage (= 6.0.2.2)
41
+ activesupport (= 6.0.2.2)
42
+ nokogiri (>= 1.8.5)
43
+ actionview (6.0.2.2)
44
+ activesupport (= 6.0.2.2)
45
+ builder (~> 3.1)
46
+ erubi (~> 1.4)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
+ active_model_serializers (0.10.10)
50
+ actionpack (>= 4.1, < 6.1)
51
+ activemodel (>= 4.1, < 6.1)
52
+ case_transform (>= 0.2)
53
+ jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
54
+ activejob (6.0.2.2)
55
+ activesupport (= 6.0.2.2)
56
+ globalid (>= 0.3.6)
57
+ activemodel (6.0.2.2)
58
+ activesupport (= 6.0.2.2)
59
+ activerecord (6.0.2.2)
60
+ activemodel (= 6.0.2.2)
61
+ activesupport (= 6.0.2.2)
62
+ activestorage (6.0.2.2)
63
+ actionpack (= 6.0.2.2)
64
+ activejob (= 6.0.2.2)
65
+ activerecord (= 6.0.2.2)
66
+ marcel (~> 0.3.1)
67
+ activesupport (6.0.2.2)
68
+ concurrent-ruby (~> 1.0, >= 1.0.2)
69
+ i18n (>= 0.7, < 2)
70
+ minitest (~> 5.1)
71
+ tzinfo (~> 1.1)
72
+ zeitwerk (~> 2.2)
73
+ acts_as_list (1.0.1)
74
+ activerecord (>= 4.2)
75
+ addressable (2.7.0)
76
+ public_suffix (>= 2.0.2, < 5.0)
77
+ alchemy-devise (4.5.0)
78
+ alchemy_cms (>= 4.1.0, < 5.1)
79
+ devise (>= 4.7.1, < 5)
80
+ alchemy_cms (4.5.0)
81
+ active_model_serializers (~> 0.10.0)
82
+ acts_as_list (>= 0.3, < 2)
83
+ awesome_nested_set (~> 3.1)
84
+ cancancan (>= 2.1, < 4.0)
85
+ coffee-rails (~> 4.0, < 5.0)
86
+ dragonfly (~> 1.0, >= 1.0.7)
87
+ dragonfly_svg (~> 0.0.4)
88
+ gutentag (~> 2.2, >= 2.2.1)
89
+ handlebars_assets (~> 0.23)
90
+ jquery-rails (~> 4.0, >= 4.0.4)
91
+ jquery-ui-rails (~> 6.0)
92
+ kaminari (~> 1.1)
93
+ non-stupid-digest-assets (~> 1.0.8)
94
+ originator (~> 3.1)
95
+ rails (>= 5.0.0, < 6.1)
96
+ ransack (>= 1.8, < 3.0)
97
+ request_store (~> 1.2)
98
+ responders (>= 2.0, < 4.0)
99
+ sassc-rails (~> 2.1)
100
+ select2-rails (>= 3.5.9.1, < 4.0)
101
+ simple_form (>= 4.0, < 6)
102
+ sprockets (>= 3.0, < 5)
103
+ turbolinks (>= 2.5)
104
+ awesome_nested_set (3.2.0)
105
+ activerecord (>= 4.0.0, < 7.0)
106
+ bcrypt (3.1.13)
107
+ builder (3.2.4)
108
+ cancancan (3.1.0)
109
+ case_transform (0.2)
110
+ activesupport
111
+ coffee-rails (4.2.2)
112
+ coffee-script (>= 2.2.0)
113
+ railties (>= 4.0.0)
114
+ coffee-script (2.4.1)
115
+ coffee-script-source
116
+ execjs
117
+ coffee-script-source (1.12.2)
118
+ concurrent-ruby (1.1.6)
119
+ crass (1.0.6)
120
+ devise (4.7.1)
121
+ bcrypt (~> 3.0)
122
+ orm_adapter (~> 0.1)
123
+ railties (>= 4.1.0)
124
+ responders
125
+ warden (~> 1.2.3)
126
+ dragonfly (1.2.0)
127
+ addressable (~> 2.3)
128
+ multi_json (~> 1.0)
129
+ rack (>= 1.3)
130
+ dragonfly_svg (0.0.4)
131
+ dragonfly (~> 1.0)
132
+ nokogiri
133
+ erubi (1.9.0)
134
+ execjs (2.7.0)
135
+ ffi (1.12.2)
136
+ globalid (0.4.2)
137
+ activesupport (>= 4.2.0)
138
+ gutentag (2.5.2)
139
+ activerecord (>= 3.2.0)
140
+ handlebars_assets (0.23.8)
141
+ execjs (~> 2.0)
142
+ sprockets (>= 2.0.0)
143
+ tilt (>= 1.2)
144
+ i18n (1.8.2)
145
+ concurrent-ruby (~> 1.0)
146
+ jquery-rails (4.3.5)
147
+ rails-dom-testing (>= 1, < 3)
148
+ railties (>= 4.2.0)
149
+ thor (>= 0.14, < 2.0)
150
+ jquery-ui-rails (6.0.1)
151
+ railties (>= 3.2.16)
152
+ js-routes (1.4.9)
153
+ railties (>= 4)
154
+ sprockets-rails
155
+ jsonapi-renderer (0.2.2)
156
+ kaminari (1.2.0)
157
+ activesupport (>= 4.1.0)
158
+ kaminari-actionview (= 1.2.0)
159
+ kaminari-activerecord (= 1.2.0)
160
+ kaminari-core (= 1.2.0)
161
+ kaminari-actionview (1.2.0)
162
+ actionview
163
+ kaminari-core (= 1.2.0)
164
+ kaminari-activerecord (1.2.0)
165
+ activerecord
166
+ kaminari-core (= 1.2.0)
167
+ kaminari-core (1.2.0)
168
+ loofah (2.5.0)
169
+ crass (~> 1.0.2)
170
+ nokogiri (>= 1.5.9)
171
+ mail (2.7.1)
172
+ mini_mime (>= 0.1.1)
173
+ marcel (0.3.3)
174
+ mimemagic (~> 0.3.2)
175
+ method_source (1.0.0)
176
+ mimemagic (0.3.10)
177
+ nokogiri (~> 1)
178
+ rake
179
+ mini_mime (1.0.2)
180
+ mini_portile2 (2.4.0)
181
+ minitest (5.14.0)
182
+ multi_json (1.14.1)
183
+ nio4r (2.5.2)
184
+ nokogiri (1.10.9)
185
+ mini_portile2 (~> 2.4.0)
186
+ non-stupid-digest-assets (1.0.9)
187
+ sprockets (>= 2.0)
188
+ originator (3.1)
189
+ actionpack (>= 4.0)
190
+ activerecord (>= 4.0)
191
+ orm_adapter (0.5.0)
192
+ polyamorous (2.3.2)
193
+ activerecord (>= 5.2.1)
194
+ public_suffix (4.0.4)
195
+ puma (3.12.4)
196
+ rack (2.2.2)
197
+ rack-proxy (0.6.5)
198
+ rack
199
+ rack-test (1.1.0)
200
+ rack (>= 1.0, < 3)
201
+ rails (6.0.2.2)
202
+ actioncable (= 6.0.2.2)
203
+ actionmailbox (= 6.0.2.2)
204
+ actionmailer (= 6.0.2.2)
205
+ actionpack (= 6.0.2.2)
206
+ actiontext (= 6.0.2.2)
207
+ actionview (= 6.0.2.2)
208
+ activejob (= 6.0.2.2)
209
+ activemodel (= 6.0.2.2)
210
+ activerecord (= 6.0.2.2)
211
+ activestorage (= 6.0.2.2)
212
+ activesupport (= 6.0.2.2)
213
+ bundler (>= 1.3.0)
214
+ railties (= 6.0.2.2)
215
+ sprockets-rails (>= 2.0.0)
216
+ rails-dom-testing (2.0.3)
217
+ activesupport (>= 4.2.0)
218
+ nokogiri (>= 1.6)
219
+ rails-html-sanitizer (1.3.0)
220
+ loofah (~> 2.3)
221
+ railties (6.0.2.2)
222
+ actionpack (= 6.0.2.2)
223
+ activesupport (= 6.0.2.2)
224
+ method_source
225
+ rake (>= 0.8.7)
226
+ thor (>= 0.20.3, < 2.0)
227
+ rake (13.0.1)
228
+ ransack (2.3.2)
229
+ activerecord (>= 5.2.1)
230
+ activesupport (>= 5.2.1)
231
+ i18n
232
+ polyamorous (= 2.3.2)
233
+ request_store (1.5.0)
234
+ rack (>= 1.4)
235
+ responders (3.0.0)
236
+ actionpack (>= 5.0)
237
+ railties (>= 5.0)
238
+ sassc (2.2.1)
239
+ ffi (~> 1.9)
240
+ sassc-rails (2.1.2)
241
+ railties (>= 4.0.0)
242
+ sassc (>= 2.0)
243
+ sprockets (> 3.0)
244
+ sprockets-rails
245
+ tilt
246
+ select2-rails (3.5.10)
247
+ thor (~> 0.14)
248
+ simple_form (5.0.2)
249
+ actionpack (>= 5.0)
250
+ activemodel (>= 5.0)
251
+ sprockets (3.7.2)
252
+ concurrent-ruby (~> 1.0)
253
+ rack (> 1, < 3)
254
+ sprockets-rails (2.3.3)
255
+ actionpack (>= 3.0)
256
+ activesupport (>= 3.0)
257
+ sprockets (>= 2.8, < 4.0)
258
+ sqlite3 (1.4.2)
259
+ thor (0.20.3)
260
+ thread_safe (0.3.6)
261
+ tilt (2.0.10)
262
+ turbolinks (5.2.1)
263
+ turbolinks-source (~> 5.2)
264
+ turbolinks-source (5.2.0)
265
+ tzinfo (1.2.7)
266
+ thread_safe (~> 0.1)
267
+ warden (1.2.8)
268
+ rack (>= 2.0.6)
269
+ webpacker (4.2.2)
270
+ activesupport (>= 4.2)
271
+ rack-proxy (>= 0.6.1)
272
+ railties (>= 4.2)
273
+ websocket-driver (0.7.1)
274
+ websocket-extensions (>= 0.1.0)
275
+ websocket-extensions (0.1.4)
276
+ zeitwerk (2.3.0)
277
+
278
+ PLATFORMS
279
+ ruby
280
+
281
+ DEPENDENCIES
282
+ alchemy-crop-image!
283
+ alchemy-devise (~> 4.5)
284
+ puma (~> 3.11)
285
+ sqlite3
286
+ webpacker (~> 4.0)
287
+
288
+ BUNDLED WITH
289
+ 2.1.2
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2020 Alessandro Baccanelli
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Alchemy::Crop::Image
2
+ With this gem you can add cropping functionality into Alchemy Cms Image library
3
+
4
+ ## Usage
5
+ In Alchemy Image Library, when you click on an image, on the left you can see a botton: enable editor.
6
+ You can click on this button that enable editor panel.
7
+ You can crop, zoom in and zoom out the image and save as new image.
8
+ When the new image is saved, a tag with its size is added.
9
+ The original image tags are kept
10
+
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'alchemy-crop-image', github: 'ArchimediaZerogroup/alchemy-crop-image', branch: 'master'
18
+ ```
19
+
20
+ And then execute:
21
+ ```bash
22
+ $ bundle
23
+ ```
24
+
25
+ Run the generator
26
+ ```bash
27
+ $ bin/rails g alchemy:crop:image:install
28
+ ```
29
+
30
+ ## Next development steps
31
+ * Add tests with rspec
32
+
33
+ ## Contributing
34
+ You can contribute by forking the project and making merge requests
35
+
36
+ ## License
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Alchemy::Crop::Image'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test
@@ -0,0 +1,42 @@
1
+ $:.push File.expand_path("lib", __dir__)
2
+
3
+ # Maintain your gem's version:
4
+ require "alchemy/crop/image/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "alchemy-crop-image"
9
+ spec.version = Alchemy::Crop::Image::VERSION
10
+ spec.authors = ["Alessandro Baccanelli"]
11
+ spec.email = ["alessandro.baccanelli@archimedianet.it"]
12
+ spec.homepage = "https://github.com/ArchimediaZerogroup/alchemy-crop-image"
13
+ spec.summary = "A gem for enable image cropping in Alchemy Library"
14
+ spec.description = "With this gem you can crop and resize images directly in Alchemy Library and create a new verison of image"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
23
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
24
+ if spec.respond_to?(:metadata)
25
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
26
+ else
27
+ raise "RubyGems 2.0 or newer is required to protect against " \
28
+ "public gem pushes."
29
+ end
30
+
31
+
32
+
33
+ spec.add_dependency "rails", ">= 5.2.0", "< 7.0.0"
34
+ spec.add_dependency "alchemy_cms",">= 4.1"
35
+ spec.add_dependency "sprockets-rails", ">= 2.0.0"
36
+ spec.add_dependency 'js-routes', '~> 1.4', '>= 1.4.9'
37
+
38
+ spec.add_development_dependency "sqlite3"
39
+ spec.add_development_dependency 'alchemy-devise', '~> 4.5'
40
+ spec.add_development_dependency 'puma', '~> 3.11'
41
+ spec.add_development_dependency 'webpacker', '~> 4.0'
42
+ end
@@ -0,0 +1,2 @@
1
+ //= link_directory ../stylesheets/alchemy/crop/image .scss
2
+ //= link_directory ../javascripts/alchemy/crop/image .js
File without changes
@@ -0,0 +1,4 @@
1
+
2
+ //= require ./routes
3
+ //= require cropperjs/dist/cropper
4
+ //= require ./cropping