bhf 0.7.1 → 0.7.2
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 +4 -4
- data/app/controllers/bhf/application_controller.rb +2 -2
- data/app/views/bhf/entries/_form.haml +1 -1
- data/app/views/bhf/entries/form/column/_paperclip.haml +17 -12
- data/app/views/bhf/pages/macro/column/_paperclip.haml +5 -0
- data/config/locales/en.yml +2 -2
- data/lib/bhf.rb +0 -1
- data/lib/bhf/pagination.rb +1 -0
- metadata +3 -4
- data/app/views/bhf/entries/form/column/_upload_file.haml +0 -22
- data/lib/bhf/active_record/upload.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bc3e48804cadcd8f1238bf2e2c7ba8af1c341dd
|
4
|
+
data.tar.gz: eaab323959a550d24df7c3926d5dec7f61ebfe7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f247f71c9f92453185f0e9af2883a8e7dccc76bf5fa3e2735a1d1abed743be8ef279c6c0831c2cdc4c3dacb5100efc7dda26b31f6daa7024286946e801de8be0
|
7
|
+
data.tar.gz: 40e10a43e86556a4fe52573a3268af39cc008ef43e1e59ae15021cea99d5961ee32d7bd0b8d4a10dd09c2a4d822635a9cf92d91475a2511389925f5bdf77a522
|
@@ -65,13 +65,13 @@ class Bhf::ApplicationController < ActionController::Base
|
|
65
65
|
t("bhf.areas.page_title.#{params[:bhf_area]}",
|
66
66
|
area: params[:bhf_area],
|
67
67
|
title: @app_title,
|
68
|
-
default: t('bhf.areas.
|
68
|
+
default: t('bhf.areas.page_title',
|
69
69
|
title: @app_title,
|
70
70
|
area: t("bhf.areas.links.#{params[:bhf_area]}", default: params[:bhf_area])
|
71
71
|
)
|
72
72
|
)
|
73
73
|
else
|
74
|
-
t('bhf.
|
74
|
+
t('bhf.page_title', title: @app_title)
|
75
75
|
end
|
76
76
|
end.html_safe
|
77
77
|
end
|
@@ -17,5 +17,5 @@
|
|
17
17
|
.node
|
18
18
|
.label
|
19
19
|
.input
|
20
|
-
= f.submit f.object.new_record? ? new_t(@platform) : edit_t(@platform)
|
20
|
+
= f.submit t('bhf.helpers.form.submit.button', default: f.object.new_record? ? new_t(@platform) : edit_t(@platform))
|
21
21
|
= link_to t('bhf.helpers.entry.cancel'), page_path(@platform.page_name), class: 'cancel'
|
@@ -1,12 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
- # no file upload on ajax submit :(
|
2
|
+
- unless @quick_edit
|
3
|
+
= node f, field do
|
4
|
+
- file = f.object.send(field.name)
|
5
|
+
- if file.file?
|
6
|
+
- if ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/tif', 'image/gif'].include?(f.object.send("#{field.name}_content_type"))
|
7
|
+
= image_tag file.url, class: 'uploaded_image'
|
8
|
+
- else
|
9
|
+
= link_to f.object.send("#{field.name}_file_name"), file.url, class: 'uploaded_file'
|
10
|
+
|
11
|
+
- if f.object.respond_to?(:"#{field.name}_destroy")
|
12
|
+
.file_delete
|
13
|
+
= f.check_box "#{field.name}_destroy"
|
14
|
+
= f.label "#{field.name}_destroy", t('bhf.helpers.file.delete')
|
15
|
+
|
16
|
+
- unless @quick_edit
|
17
|
+
= f.file_field field.name
|
@@ -0,0 +1,5 @@
|
|
1
|
+
- unless object.send(column.name).blank?
|
2
|
+
- if ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/tif', 'image/gif'].include?(object.send("#{column.name}_content_type"))
|
3
|
+
= image_tag object.send(column.name), alt: object.send(column.name), class: 'preview_image'
|
4
|
+
- else
|
5
|
+
= link_to object.send("#{column.name}_file_name"), object.send(column.name).url
|
data/config/locales/en.yml
CHANGED
data/lib/bhf.rb
CHANGED
data/lib/bhf/pagination.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bhf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
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-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -153,7 +153,6 @@ files:
|
|
153
153
|
- app/views/bhf/entries/form/column/_static.haml
|
154
154
|
- app/views/bhf/entries/form/column/_string.haml
|
155
155
|
- app/views/bhf/entries/form/column/_text.haml
|
156
|
-
- app/views/bhf/entries/form/column/_upload_file.haml
|
157
156
|
- app/views/bhf/entries/form/column/_wysiwyg.haml
|
158
157
|
- app/views/bhf/entries/form/embeds_many/_static.haml
|
159
158
|
- app/views/bhf/entries/form/embeds_one/_static.haml
|
@@ -183,6 +182,7 @@ files:
|
|
183
182
|
- app/views/bhf/pages/macro/column/_hash.haml
|
184
183
|
- app/views/bhf/pages/macro/column/_image.haml
|
185
184
|
- app/views/bhf/pages/macro/column/_number.haml
|
185
|
+
- app/views/bhf/pages/macro/column/_paperclip.haml
|
186
186
|
- app/views/bhf/pages/macro/column/_primary_key.haml
|
187
187
|
- app/views/bhf/pages/macro/column/_string.haml
|
188
188
|
- app/views/bhf/pages/macro/column/_text.haml
|
@@ -204,7 +204,6 @@ files:
|
|
204
204
|
- config/routes.rb
|
205
205
|
- lib/bhf.rb
|
206
206
|
- lib/bhf/active_record/active_record.rb
|
207
|
-
- lib/bhf/active_record/upload.rb
|
208
207
|
- lib/bhf/config_parser.rb
|
209
208
|
- lib/bhf/data.rb
|
210
209
|
- lib/bhf/form.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
- # no file upload on ajax submit :(
|
2
|
-
- unless @quick_edit
|
3
|
-
= node f, field do
|
4
|
-
= f.fields_for field.name do |f_file|
|
5
|
-
- file = f.object.send(:read_attribute, field.name)
|
6
|
-
- if file.is_a? Hash
|
7
|
-
%p.warning= t('bhf.helpers.file.reselect')
|
8
|
-
- else
|
9
|
-
- file = f.object.send(field.name)
|
10
|
-
- if file.is_a? ActionDispatch::Http::UploadedFile
|
11
|
-
- file = f.object.send("#{field.name}_was")
|
12
|
-
- if file.is_a?(String)
|
13
|
-
- if is_image?(file)
|
14
|
-
= image_tag file, class: 'uploaded_image'
|
15
|
-
- else
|
16
|
-
= link_to file, file, class: 'uploaded_file'
|
17
|
-
- unless file.blank?
|
18
|
-
.file_delete
|
19
|
-
= f_file.check_box :delete
|
20
|
-
= f_file.label :delete, t('bhf.helpers.file.delete')
|
21
|
-
|
22
|
-
= f_file.file_field :file
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Bhf
|
2
|
-
module ActiveRecord
|
3
|
-
module Upload
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
before_save :bhf_upload
|
8
|
-
cattr_accessor :bhf_upload_settings
|
9
|
-
end
|
10
|
-
|
11
|
-
def bhf_upload
|
12
|
-
self.class.bhf_upload_settings.each do |settings|
|
13
|
-
name_was = send("#{settings[:name]}_was")
|
14
|
-
param_name = read_attribute(settings[:name]) || send(settings[:name])
|
15
|
-
next if param_name.blank? or param_name.is_a?(String)
|
16
|
-
file_string = if param_name && param_name[:delete].to_i != 0
|
17
|
-
# File.delete(settings[:path] + name_was.to_s) if File.exist?(settings[:path] + name_was.to_s)
|
18
|
-
nil
|
19
|
-
else
|
20
|
-
file = param_name && param_name[:file]
|
21
|
-
if file.is_a? ActionDispatch::Http::UploadedFile
|
22
|
-
# File.delete(settings[:path] + name_was.to_s) if File.exist?(settings[:path] + name_was.to_s)
|
23
|
-
|
24
|
-
filename = Time.now.to_i.to_s+'_'+file.original_filename.downcase.gsub(/[^\w\.\-]/, '_')
|
25
|
-
path = File.join(settings[:path], filename)
|
26
|
-
File.open(path, 'wb') { |f| f.write(file.read) }
|
27
|
-
filename
|
28
|
-
else
|
29
|
-
name_was
|
30
|
-
end
|
31
|
-
end
|
32
|
-
write_attribute settings[:name], file_string
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
module ClassMethods
|
37
|
-
def setup_upload(settings)
|
38
|
-
self.bhf_upload_settings = settings.each_with_object([]) do |s, obj|
|
39
|
-
obj << {path: '', name: :file}.merge(s)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|