bhf 0.7.1 → 0.7.2

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: aeb67ca0285c67ab14c38924a9155bb202501b5b
4
- data.tar.gz: cdaabaadf3e5efcd91d5a4064e76895fa2db1f64
3
+ metadata.gz: 2bc3e48804cadcd8f1238bf2e2c7ba8af1c341dd
4
+ data.tar.gz: eaab323959a550d24df7c3926d5dec7f61ebfe7c
5
5
  SHA512:
6
- metadata.gz: 3881d098482897fd0d275067eff3820e4365516c3563e1cda9215a4e0874d6e6fe40d6ffe91e1cd284acbdd09f0eba66eb98f4b3e85bae11b2a1fe3bbda4ea57
7
- data.tar.gz: 9ba56eea1635a5655f812ca33c9882a6a888a935aef98303f7bae1602831e8969f74a7e1cfca0841708fd078f016f054eb97339f4bd4bd28c54d9249277a9764
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.default_page_title',
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.default_page_title', title: @app_title)
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
- = node f, field do
2
- - file = f.object.send(field.name)
3
- - if file.file?
4
- - if ['image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/tif', 'image/gif'].include?(f.object.send("#{field.name}_content_type"))
5
- = image_tag file.url, class: 'uploaded_image'
6
- - else
7
- = link_to f.object.send("#{field.name}_file_name"), file.url, class: 'uploaded_file'
8
- .file_delete
9
- = f.check_box "#{field.name}_destroy"
10
- = f.label "#{field.name}_destroy", t('bhf.helpers.file.delete')
11
- - unless @quick_edit
12
- = f.file_field field.name
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
@@ -1,8 +1,8 @@
1
1
  en:
2
2
  bhf:
3
- default_page_title: "%{title} &ndash; Admin"
3
+ page_title: "%{title} &ndash; Admin"
4
4
  areas:
5
- default_page_title: "%{area} &ndash; %{title} &ndash; Admin"
5
+ page_title: "%{area} &ndash; %{title} &ndash; Admin"
6
6
  helpers:
7
7
  boolean:
8
8
  a: yes
data/lib/bhf.rb CHANGED
@@ -41,7 +41,6 @@ module Bhf
41
41
  end
42
42
 
43
43
  require 'bhf/active_record/active_record'
44
- require 'bhf/active_record/upload'
45
44
  require 'bhf/mongoid/document'
46
45
  require 'bhf/data'
47
46
  require 'bhf/platform'
@@ -8,6 +8,7 @@ Kaminari::Helpers::Tag.class_eval do
8
8
  @template.url_for @params.merge(@param_name => (page <= 1 ? 1 : page))
9
9
  end
10
10
  end
11
+ # TODO: monitor https://github.com/amatsuda/kaminari/issues/542#issuecomment-40294388
11
12
 
12
13
  module Bhf
13
14
 
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.1
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-14 00:00:00.000000000 Z
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