ksk 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ba89b85e998d5a247ec3430b491f4101781cf6e
4
- data.tar.gz: 7186043f16771af0c6ae982d1ec746859b912790
3
+ metadata.gz: 1f1117bfa072fc86f0d4a0e0804dafc783600877
4
+ data.tar.gz: e9960d1cde7f3371527b898cc66d5f977a4a15ca
5
5
  SHA512:
6
- metadata.gz: 5460018dc72567d5d246f8fad5e2c5a51768a5799d89620c9f2d4a403ff64b5ffd6491526542d2c3194a8915d84f6400792cea692c201b14aab45758f1342ca1
7
- data.tar.gz: 4efbcb388ba61312e55efe1c59e4f3abfd270150e6044242c77ca8323367ec0b6bdff4e56445a408e0d8bc6248d388a2ae7038e18d3cfc04e983741945a3e6b7
6
+ metadata.gz: c3b6ae16f1866b3ee7fc377e1f4d505d1b9b1d038e87f4478180ddb6c4b2ec9a5bc5cedb7c10187ec16e15694f62c994be2a33bf09994258c5c01a3f818cb774
7
+ data.tar.gz: f298664be559d2b119ca43ab8832582f316a77e5fa150c5c3a820b3e4676b93a2085fe898ae16939e6a3b500b33a322d3e9e8cf42e99fa40984e55533d3b09ff
@@ -111,4 +111,6 @@ table.navigation_capiton
111
111
  .alt_button
112
112
  margin-right: 0
113
113
 
114
-
114
+
115
+ .jcrop-holder
116
+ background-color: white !important
@@ -36,9 +36,10 @@ module Ksk
36
36
  def place_content(text, files, type, &html)
37
37
  t = text
38
38
  (text || '').scan(Apdown.parse_regex(type)).each do |match|
39
- if asset = files[match[1].to_i-1]
40
- t = t.gsub(match[0], html.call(asset, match[2]))
39
+ relpace = if asset = files[match[1].to_i-1]
40
+ html.call(asset, match[2])
41
41
  end
42
+ t = t.gsub(match[0], relpace.to_s)
42
43
  end
43
44
  t.html_safe
44
45
  end
@@ -7,14 +7,15 @@
7
7
  = a.check_box :_destroy
8
8
  = a.label :_destroy, t(asset.is_image? ? 'bhf.helpers.image.delete' : 'bhf.helpers.file.delete')
9
9
 
10
+ - return_to = {return_to: (edit_entry_path(@platform.name, f.object) unless @platform.return_to == false)}
10
11
  - if asset.is_image?
11
12
  = image_tag(asset.file.url(:medium), class: 'uploaded_image float_left')
12
- = link_to t('ksk.asset.image_preview.button.edit'), edit_entry_path('assets', asset.id), class: 'alt_button float_right'
13
+ = link_to t('ksk.asset.image_preview.button.edit'), edit_entry_path('assets', asset.id, return_to), class: 'alt_button float_right'
13
14
  - else
14
15
  = link_to asset.file_file_name, asset.file.url, class: 'uploaded_file float_left'
15
16
  - if asset.has_preview?
16
- = link_to t('ksk.asset.file_preview.button.edit'), edit_entry_path('previews', asset.preview), class: 'alt_button float_right'
17
+ = link_to t('ksk.asset.file_preview.button.edit'), edit_entry_path('previews', asset.preview, return_to), class: 'alt_button float_right'
17
18
  - else
18
- = link_to t('ksk.asset.file_preview.button.create'), new_entry_path('previews', asset_id: asset.id), class: 'alt_button float_right'
19
+ = link_to t('ksk.asset.file_preview.button.create'), new_entry_path('previews', {asset_id: asset.id}.merge(return_to)), class: 'alt_button float_right'
19
20
 
20
21
  .clear
data/lib/actives/asset.rb CHANGED
@@ -16,7 +16,7 @@ module Ksk
16
16
  before_save :crop_thumbs, if: :cropping?
17
17
 
18
18
  IMGTYPE = ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/tif', 'image/gif']
19
- validates_attachment_content_type :file, :content_type => /.*/
19
+ do_not_validate_attachment_file_type :file
20
20
 
21
21
  scope :only_images, -> {where(file_content_type: IMGTYPE)}
22
22
  scope :first_image, -> {only_images.limit(1)}
@@ -1,4 +1,3 @@
1
- # encoding: UTF-8
2
1
  module Ksk
3
2
  module Navigation
4
3
  extend ActiveSupport::Concern
@@ -14,8 +13,8 @@ module Ksk
14
13
 
15
14
  belongs_to :static
16
15
  belongs_to :navigation_type
17
- belongs_to :parent, :foreign_key => 'parent_id', :class_name => 'Navigation'
18
- has_many :children, :foreign_key => 'parent_id', :class_name => 'Navigation', :dependent => :delete_all
16
+ belongs_to :parent, foreign_key: 'parent_id', class_name: 'Navigation'
17
+ has_many :children, foreign_key: 'parent_id', class_name: 'Navigation', dependent: :delete_all
19
18
 
20
19
  scope :top_level, -> {where(parent_id: 0)}
21
20
 
@@ -8,7 +8,7 @@ module Ksk
8
8
  include Apdown
9
9
 
10
10
  has_one :navigation
11
- has_many :assets, :as => :fileable
11
+ has_many :assets, as: :fileable
12
12
  # TODO: needs on_delete hook to destroy navigation if Navigation is availible for this object
13
13
 
14
14
  accepts_nested_attributes_for :assets, allow_destroy: true
@@ -2,7 +2,7 @@ module Paperclip
2
2
 
3
3
  class KskCrop < Processor
4
4
 
5
- def initialize file, options = {}, attachment = nil
5
+ def initialize(file, options = {}, attachment = nil)
6
6
  super
7
7
  @crop = options
8
8
  @format = File.extname(@file.path)
@@ -13,18 +13,23 @@ module Paperclip
13
13
  src = @file
14
14
  dst = Tempfile.new([@basename, @format])
15
15
  dst.binmode
16
+
17
+ parameters = []
18
+ parameters << ":source"
19
+ parameters << "-crop '#{@crop[2]}x#{@crop[3]}+#{@crop[0]}+#{@crop[1]}'"
20
+ parameters << ":dest"
16
21
 
17
- parameters = []
18
- parameters << ":source"
19
- parameters << "-crop '#{@crop[2]}x#{@crop[3]}+#{@crop[0]}+#{@crop[1]}'"
20
- parameters << ":dest"
21
-
22
- parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")
23
-
24
- success = Paperclip.run("convert", parameters, :source => "#{File.expand_path(src.path)}[0]", :dest => File.expand_path(dst.path))
22
+ parameters = parameters.flatten.compact.join(' ').strip.squeeze(' ')
23
+
24
+ path = if @file.options && @file.options[:storage] == :s3
25
+ src.url
26
+ else
27
+ File.expand_path(src.path)
28
+ end
29
+ success = Paperclip.run('convert', parameters, source: path, dest: File.expand_path(dst.path))
25
30
 
26
31
  dst
27
32
  end
28
33
 
29
34
  end
30
- end
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ksk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Pawlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-20 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bhf