neofiles 1.1.0 → 1.1.1

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: 6e96aa097e34ac97047248c698a3aeb9b64bc9ab
4
- data.tar.gz: 66851a10940c7c14edd2eef83354815c857328e2
3
+ metadata.gz: 000a738365e7b626c34bc40b447836f062e2c5b3
4
+ data.tar.gz: 28187e344683d1a16cd3c9ddea1ad4569f0fba3c
5
5
  SHA512:
6
- metadata.gz: d1d781c8139d2f9618f10a5b32f13b195053c722e3a3c5c4b38068870a780ecffe10dc801f63f73f26d6b532c96bd7f6273e350f8ba4f97d30c992aa9f197825
7
- data.tar.gz: 348b856a3802607b95ab7f0df75b1ed4ed2270e1c82965969134417d3cbf03dd49f6cd99a7ddb6925a64fc2c1a021dcf841824efaad085dc5c0c99eb741aa373
6
+ metadata.gz: 806acf4cd5ded5efd0b716df22b9c2b81a338e08892bbe24aee47d958db39a0a12d512c919f858f0bd45e317a63e98c5be8ac6c06501dc452d8c32eec62c5227
7
+ data.tar.gz: 8b29970f16a7bfb674f0bfb678a806fb4cd07ecded43b289ad01ae22ad748efea05f7431505165ef8538bfbab896ebf797fdbb81d1acd64e928bed6eacb3a97d
@@ -33,6 +33,7 @@ class Neofiles::AdminController < ApplicationController
33
33
  # request[:disabled] - only show file, not allow anything to be edited (default '0')
34
34
  # request[:multiple] - allow uploading of multiple files at once (default '0')
35
35
  # request[:with_desc] - show short file description (default '0')
36
+ # request[:no_wm] - disable adding a watermark (default '0')
36
37
  #
37
38
  # Parameters clear_remove & append_create are used to organize Albums — technically a collection of single files.
38
39
  #
@@ -54,6 +55,7 @@ class Neofiles::AdminController < ApplicationController
54
55
  @disabled = request[:disabled].present? && request[:disabled] != '0'
55
56
  @multiple = request[:multiple].present? && request[:multiple] != '0'
56
57
  @with_desc = request[:with_desc].present? && request[:with_desc] != '0'
58
+ @no_wm = request[:no_wm].present? && request[:no_wm] != '0'
57
59
  @error ||= ''
58
60
 
59
61
  if fake_request
@@ -87,6 +89,7 @@ class Neofiles::AdminController < ApplicationController
87
89
  file_class = Neofiles::File.class_by_file_object(uploaded_file)
88
90
  file = file_class.new do |f|
89
91
  f.description = data[:description].presence || old_file.try(:description)
92
+ f.no_wm = data[:no_wm].present? && data[:no_wm] != '0'
90
93
  f.file = uploaded_file
91
94
  end
92
95
 
@@ -62,7 +62,7 @@ class Neofiles::ImagesController < ActionController::Metal
62
62
  resize_image convert, width, height, crop_requested, need_resize_without_crop if resizing
63
63
 
64
64
  unless nowm?(image_file)
65
- wm_width, wm_height = Neofiles::resized_image_dimensions image_file, width, height, params
65
+ wm_width, wm_height = resizing ? Neofiles::resized_image_dimensions(image_file, width, height, params) : [image_file.width, image_file.height]
66
66
  add_watermark convert, image, wm_width, wm_height if wm_width && wm_height
67
67
  end
68
68
 
@@ -29,11 +29,11 @@
29
29
  - file_options << "#{file.dimensions.join('×').html_safe} px"
30
30
  - file_options << "#{number_to_human_size file.length, precision: 0}"
31
31
  %p= file_options.join(', ')
32
-
32
+
33
33
  - if file.owner_type.present? || file.owner_id.present?
34
34
  %p #{t 'neofiles.views.owner'}: #{file.owner_type}#{file.owner_id}
35
35
 
36
- - if file.respond_to? :no_wm
36
+ - if file.respond_to?(:no_wm) && !no_wm
37
37
  %p.checkbox
38
38
  - uniq_name = "#{widget_id}_no_wm"
39
39
  %label(for=uniq_name)
@@ -72,6 +72,8 @@
72
72
  = hidden_field_tag 'neofiles[append_create]', file ? 0 : (append_create ? 1 : 0), common_options
73
73
  = hidden_field_tag 'neofiles[multiple]', multiple ? 1 : 0, common_options
74
74
  = hidden_field_tag 'neofiles[with_desc]', with_desc ? 1 : 0, common_options
75
+ - if no_wm
76
+ = hidden_field_tag 'neofiles[no_wm]', 1, common_options
75
77
 
76
78
  = file_field_tag 'neofiles[file][]', id: nil, class: 'neofiles-image-compact-file', disabled: disabled, multiple: multiple && !file
77
79
 
@@ -81,5 +83,5 @@
81
83
  });
82
84
 
83
85
  - if append_create and file
84
- = render partial: 'file_compact', locals: {file: nil, input_name: input_name, widget_id: widget_id + '_ap', clean_remove: clean_remove, append_create: true, error: nil, disabled: disabled, multiple: multiple, with_desc: with_desc}
86
+ = render partial: 'file_compact', locals: {file: nil, input_name: input_name, widget_id: widget_id + '_ap', clean_remove: clean_remove, append_create: true, error: nil, disabled: disabled, multiple: multiple, with_desc: with_desc, no_wm: no_wm}
85
87
 
@@ -1 +1 @@
1
- = render partial: 'file_compact', locals: {file: @file, widget_id: @widget_id, input_name: @input_name, error: @error, clean_remove: @clean_remove, append_create: @append_create, disabled: @disabled, multiple: @multiple, with_desc: @with_desc}
1
+ = render partial: 'file_compact', locals: {file: @file, widget_id: @widget_id, input_name: @input_name, error: @error, clean_remove: @clean_remove, append_create: @append_create, disabled: @disabled, multiple: @multiple, with_desc: @with_desc, no_wm: @no_wm}
@@ -1,3 +1,3 @@
1
1
  module Neofiles
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neofiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konanykhin Ilya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-03 00:00:00.000000000 Z
11
+ date: 2017-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails