bhf 0.10.11 → 0.10.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Getting_Started.md +16 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/bhf/application.js +26 -1
- data/app/assets/stylesheets/bhf/application.css.sass +11 -0
- data/app/views/bhf/form/column/_image_file.html.haml +3 -0
- data/app/views/bhf/form/column/_type.html.haml +4 -0
- data/app/views/bhf/table/column/_carrierwave.html.haml +3 -0
- data/app/views/bhf/table/column/_image.html.haml +1 -1
- data/app/views/bhf/table/column/_thumbmail.haml +2 -0
- data/app/views/bhf/table/column/_type.html.haml +2 -0
- data/bhf.gemspec +8 -3
- data/lib/bhf/controller/extension.rb +17 -17
- data/lib/bhf/platform/attribute/column.rb +4 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8c9401f0d24e294ec327afc8b4ed50c00b6fa18
|
4
|
+
data.tar.gz: a92d0e908db50e171a6c88bb51c8e5b2870597b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e1b2debe65e2ed735ba6f8fffc561a3e9e82c32b2508c81902002bc27810a089d6ebdaf780f2e7cdf6282110246b816f8ae65e1cbfe0bd4aba9bcd3d6d841ad
|
7
|
+
data.tar.gz: 38765e54fe9d50831568004e2643bd8cdef1f954e6568a24c85c96be76df53d294b93a56110ca0f45a38dc57392965ff8c91514ffc9512247fea8af8b006f4b7
|
data/Getting_Started.md
CHANGED
@@ -14,3 +14,19 @@ method, to give to `Bhf` the knowledge about weither current user is admin or no
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
|
18
|
+
### Addtional field types
|
19
|
+
|
20
|
+
Additional two fields `file`, and `type` was added for form view. `File` field can be applied,
|
21
|
+
when user have to select, and attach a file, which should be sent to server. The file can be
|
22
|
+
image, etc. If the file is an image, a preview image appeared, when user select input image
|
23
|
+
for `file` field, or when user edits a record with `file` field and the file is an image.
|
24
|
+
`Type` field can be applied, when user the `type` named field should be shewn, and selected in
|
25
|
+
the form. The descendants of the base class is begin enumerated in the select.
|
26
|
+
|
27
|
+
Additional three fields `image`, `carrierwave`, and `type` was added for table view. `Image`
|
28
|
+
field can be applied, when the record has image properties. `Carrierwave` is the same as the `image`
|
29
|
+
but gets the image from `#midem` action for carrierwave uploader. PDF files also can be shewn
|
30
|
+
up as a thumbnail. When user moves a cursor over an image or PDF thumbnail, a preview image
|
31
|
+
is being pop up in table view. `Type` field defines that the spcific records class descendant
|
32
|
+
type name should be shewn for the column. The name is reduced by the base class name itself.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.12
|
@@ -350,7 +350,32 @@ Turbolinks.pagesCached(0);
|
|
350
350
|
mainScope.getElements('.js_submit_form_on_change').addEvent('change', function(e){
|
351
351
|
e.target.getParent('form').submit();
|
352
352
|
});
|
353
|
-
|
353
|
+
|
354
|
+
// picture preview handler on input
|
355
|
+
mainScope.getElements('.preview_input').addEvent('change', function(e) {
|
356
|
+
var img = this.getNext('img');
|
357
|
+
if (img) {
|
358
|
+
img.src = URL.createObjectURL(e.target.files[0]);
|
359
|
+
}
|
360
|
+
});
|
361
|
+
|
362
|
+
// picture preview handler on hover
|
363
|
+
mainScope.getElements('.thumbnail_image').addEvents({
|
364
|
+
mousemove: function(e) {
|
365
|
+
this.getNext('img').setStyles({
|
366
|
+
top: e.page.y - 260,
|
367
|
+
left: e.page.x + 10
|
368
|
+
});
|
369
|
+
},
|
370
|
+
mouseenter: function() {
|
371
|
+
var popup = new Element('img', {'class': 'popped_image', src: this.src});
|
372
|
+
popup.inject(this, 'after');
|
373
|
+
},
|
374
|
+
mouseleave: function() {
|
375
|
+
mainScope.getElements('.popped_image').destroy();
|
376
|
+
}
|
377
|
+
});
|
378
|
+
|
354
379
|
ajaxNote.success();
|
355
380
|
});
|
356
381
|
|
@@ -465,6 +465,15 @@ table.data_table
|
|
465
465
|
max-width: 400px
|
466
466
|
max-height: 200px
|
467
467
|
|
468
|
+
.thumbnail_image
|
469
|
+
&.preview_image
|
470
|
+
max-width: 32px
|
471
|
+
max-height: 32px
|
472
|
+
|
473
|
+
.popped_image
|
474
|
+
height: 250px
|
475
|
+
position: absolute
|
476
|
+
|
468
477
|
.search
|
469
478
|
input[type="text"]
|
470
479
|
@extend .default_input
|
@@ -1216,3 +1225,5 @@ input[type="submit"].alt_button,
|
|
1216
1225
|
.icon
|
1217
1226
|
background-image: image-url('bhf/pictos_2x.png')
|
1218
1227
|
background-size: 440px 260px
|
1228
|
+
|
1229
|
+
|
@@ -1,2 +1,2 @@
|
|
1
1
|
= content_tag link ? :a : :span, class: ('quick_edit' if add_quick_link), href: (link if link) do
|
2
|
-
= image_tag column_value, alt: column_value, class: 'preview_image'
|
2
|
+
= image_tag column_value, alt: column_value, class: 'preview_image'
|
data/bhf.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bhf 0.10.
|
5
|
+
# stub: bhf 0.10.12 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bhf"
|
9
|
-
s.version = "0.10.
|
9
|
+
s.version = "0.10.12"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Anton Pawlik"]
|
14
|
-
s.date = "2015-10-
|
14
|
+
s.date = "2015-10-05"
|
15
15
|
s.description = "A simple to use Rails-Engine-Gem that offers an admin interface for trusted user. Easy integratable and highly configurable and agnostic. Works with ActiveRecord and Mongoid."
|
16
16
|
s.email = "anton.pawlik@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -86,6 +86,7 @@ Gem::Specification.new do |s|
|
|
86
86
|
"app/views/bhf/form/column/_date.html.haml",
|
87
87
|
"app/views/bhf/form/column/_hash.html.haml",
|
88
88
|
"app/views/bhf/form/column/_hidden.html.haml",
|
89
|
+
"app/views/bhf/form/column/_image_file.html.haml",
|
89
90
|
"app/views/bhf/form/column/_mappin.html.haml",
|
90
91
|
"app/views/bhf/form/column/_markdown.html.haml",
|
91
92
|
"app/views/bhf/form/column/_multiple_fields.html.haml",
|
@@ -95,6 +96,7 @@ Gem::Specification.new do |s|
|
|
95
96
|
"app/views/bhf/form/column/_static.html.haml",
|
96
97
|
"app/views/bhf/form/column/_string.html.haml",
|
97
98
|
"app/views/bhf/form/column/_text.html.haml",
|
99
|
+
"app/views/bhf/form/column/_type.html.haml",
|
98
100
|
"app/views/bhf/form/column/_wysiwyg.html.haml",
|
99
101
|
"app/views/bhf/form/embeds_many/_static.html.haml",
|
100
102
|
"app/views/bhf/form/embeds_one/_static.html.haml",
|
@@ -115,6 +117,7 @@ Gem::Specification.new do |s|
|
|
115
117
|
"app/views/bhf/table/belongs_to/_default.html.haml",
|
116
118
|
"app/views/bhf/table/column/_array.html.haml",
|
117
119
|
"app/views/bhf/table/column/_boolean.html.haml",
|
120
|
+
"app/views/bhf/table/column/_carrierwave.html.haml",
|
118
121
|
"app/views/bhf/table/column/_date.html.haml",
|
119
122
|
"app/views/bhf/table/column/_empty.html.haml",
|
120
123
|
"app/views/bhf/table/column/_extern_link.html.haml",
|
@@ -126,6 +129,8 @@ Gem::Specification.new do |s|
|
|
126
129
|
"app/views/bhf/table/column/_primary_key.html.haml",
|
127
130
|
"app/views/bhf/table/column/_string.html.haml",
|
128
131
|
"app/views/bhf/table/column/_text.html.haml",
|
132
|
+
"app/views/bhf/table/column/_thumbmail.haml",
|
133
|
+
"app/views/bhf/table/column/_type.html.haml",
|
129
134
|
"app/views/bhf/table/embeds_many/_default.html.haml",
|
130
135
|
"app/views/bhf/table/embeds_one/_default.html.haml",
|
131
136
|
"app/views/bhf/table/has_and_belongs_to_many/_default.html.haml",
|
@@ -16,11 +16,11 @@ module Bhf
|
|
16
16
|
|
17
17
|
module Instance
|
18
18
|
def index
|
19
|
-
|
19
|
+
|
20
20
|
end
|
21
21
|
|
22
22
|
protected
|
23
|
-
|
23
|
+
|
24
24
|
def check_admin_account
|
25
25
|
if session[Bhf.configuration.session_auth_name.to_s] == true
|
26
26
|
return true
|
@@ -28,7 +28,7 @@ module Bhf
|
|
28
28
|
redirect_to(main_app.send(Bhf.configuration.on_login_fail.to_sym),
|
29
29
|
error: t('bhf.helpers.user.login.error')) and return false
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def setup_current_account
|
33
33
|
if session[Bhf.configuration.session_account_id]
|
34
34
|
@current_account =
|
@@ -39,40 +39,40 @@ module Bhf
|
|
39
39
|
# => User.find(current_account.id)
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def current_account
|
44
44
|
@current_account
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def get_account_roles(area = nil)
|
48
48
|
return unless current_account
|
49
|
-
|
49
|
+
|
50
50
|
if area
|
51
51
|
if current_account.respond_to?(:bhf_area_roles)
|
52
52
|
return current_account.bhf_area_roles(area).collect(&:identifier)
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
if current_account.respond_to?(:bhf_roles)
|
57
57
|
current_account.bhf_roles.collect(&:identifier)
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
def load_settings
|
62
62
|
yaml_parser = Bhf::Settings::YAMLParser.new(get_account_roles(
|
63
63
|
params[:bhf_area]), params[:bhf_area])
|
64
64
|
@settings =
|
65
65
|
Bhf::Settings::Base.new(yaml_parser.settings_hash, current_account)
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
def set_title
|
69
69
|
@app_title = Rails.application.class.to_s.split('::').first
|
70
|
-
|
70
|
+
|
71
71
|
@title = if params[:bhf_area]
|
72
|
-
t("bhf.areas.page_title.#{params[:bhf_area]}",
|
72
|
+
t("bhf.areas.page_title.#{params[:bhf_area]}",
|
73
73
|
area: params[:bhf_area],
|
74
74
|
title: @app_title,
|
75
|
-
default: t('bhf.areas.page_title',
|
75
|
+
default: t('bhf.areas.page_title',
|
76
76
|
title: @app_title,
|
77
77
|
area: t("bhf.areas.links.#{params[:bhf_area]}",
|
78
78
|
default: params[:bhf_area])
|
@@ -82,7 +82,7 @@ module Bhf
|
|
82
82
|
t('bhf.page_title', title: @app_title)
|
83
83
|
end.html_safe
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
def set_areas
|
87
87
|
@areas = []
|
88
88
|
if current_account and current_account.respond_to?(:bhf_areas)
|
@@ -97,22 +97,22 @@ module Bhf
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
def set_message(type, model = nil)
|
102
102
|
key = model && ActiveModel::Naming.singular(model)
|
103
103
|
I18n.t("bhf.activerecord.notices.models.#{key}.#{type}",
|
104
104
|
model: model.model_name.human,
|
105
105
|
default: I18n.t("activerecord.notices.messages.#{type}"))
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
def init_time
|
109
109
|
@start_time = Time.zone.now
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
def find_platform(platform_name)
|
113
113
|
Bhf::Platform::Base.new(@settings.find_platform_settings(platform_name))
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
def redirect_back_or_default(default, msg)
|
117
117
|
redirect_to(params[:return_to] || default, flash: msg)
|
118
118
|
end
|
@@ -25,6 +25,8 @@ module Bhf::Platform::Attribute
|
|
25
25
|
|
26
26
|
if name == @pk || name == 'updated_at' || name == 'created_at'
|
27
27
|
:static
|
28
|
+
elsif name == 'type'
|
29
|
+
:type
|
28
30
|
else
|
29
31
|
supported_types(@type)
|
30
32
|
end
|
@@ -35,6 +37,8 @@ module Bhf::Platform::Attribute
|
|
35
37
|
|
36
38
|
if name == @pk
|
37
39
|
:primary_key
|
40
|
+
elsif name == 'type'
|
41
|
+
:type
|
38
42
|
else
|
39
43
|
supported_types(@type)
|
40
44
|
end
|
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.10.
|
4
|
+
version: 0.10.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Pawlik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- app/views/bhf/form/column/_date.html.haml
|
228
228
|
- app/views/bhf/form/column/_hash.html.haml
|
229
229
|
- app/views/bhf/form/column/_hidden.html.haml
|
230
|
+
- app/views/bhf/form/column/_image_file.html.haml
|
230
231
|
- app/views/bhf/form/column/_mappin.html.haml
|
231
232
|
- app/views/bhf/form/column/_markdown.html.haml
|
232
233
|
- app/views/bhf/form/column/_multiple_fields.html.haml
|
@@ -236,6 +237,7 @@ files:
|
|
236
237
|
- app/views/bhf/form/column/_static.html.haml
|
237
238
|
- app/views/bhf/form/column/_string.html.haml
|
238
239
|
- app/views/bhf/form/column/_text.html.haml
|
240
|
+
- app/views/bhf/form/column/_type.html.haml
|
239
241
|
- app/views/bhf/form/column/_wysiwyg.html.haml
|
240
242
|
- app/views/bhf/form/embeds_many/_static.html.haml
|
241
243
|
- app/views/bhf/form/embeds_one/_static.html.haml
|
@@ -256,6 +258,7 @@ files:
|
|
256
258
|
- app/views/bhf/table/belongs_to/_default.html.haml
|
257
259
|
- app/views/bhf/table/column/_array.html.haml
|
258
260
|
- app/views/bhf/table/column/_boolean.html.haml
|
261
|
+
- app/views/bhf/table/column/_carrierwave.html.haml
|
259
262
|
- app/views/bhf/table/column/_date.html.haml
|
260
263
|
- app/views/bhf/table/column/_empty.html.haml
|
261
264
|
- app/views/bhf/table/column/_extern_link.html.haml
|
@@ -267,6 +270,8 @@ files:
|
|
267
270
|
- app/views/bhf/table/column/_primary_key.html.haml
|
268
271
|
- app/views/bhf/table/column/_string.html.haml
|
269
272
|
- app/views/bhf/table/column/_text.html.haml
|
273
|
+
- app/views/bhf/table/column/_thumbmail.haml
|
274
|
+
- app/views/bhf/table/column/_type.html.haml
|
270
275
|
- app/views/bhf/table/embeds_many/_default.html.haml
|
271
276
|
- app/views/bhf/table/embeds_one/_default.html.haml
|
272
277
|
- app/views/bhf/table/has_and_belongs_to_many/_default.html.haml
|