bhf 1.0.0.beta5 → 1.0.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +16 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/bhf/application.js +41 -2
- data/app/assets/stylesheets/bhf/application.sass +36 -0
- data/app/controllers/bhf/entries_controller.rb +0 -1
- data/app/views/bhf/form/column/_activestorage_attachment.html.haml +15 -0
- data/app/views/bhf/form/column/_activestorage_attachments.html.haml +0 -0
- data/bhf.gemspec +6 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c26c3ad729a39cd85f94a612e4cb86ceb12c89610cd562be456d62b7a52f8d30
|
4
|
+
data.tar.gz: 4c5b490079bc1becc59558889ae34fdec158b4b2481d65157a32f3eabcfdda7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2fcedb7a29c96e25a0a211e3b71b3f2a007ebb274183a8a50c7e0abbc5992caa6ab8952bec5201805b505cc004b4fdeddccdc450d70dcd964a74a22e757cd3b
|
7
|
+
data.tar.gz: bc8619175852035abd0192234bbe30b1cd570fc8f2c2a11774605e6985af3bd3ff968cae1122c33710b4199ad5fe861803dc03f9214a88f53d885943314d473b
|
data/.editorconfig
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# editorconfig.org
|
2
|
+
root = true
|
3
|
+
|
4
|
+
[*]
|
5
|
+
indent_style = space
|
6
|
+
indent_size = 2
|
7
|
+
end_of_line = lf
|
8
|
+
charset = utf-8
|
9
|
+
trim_trailing_whitespace = true
|
10
|
+
insert_final_newline = true
|
11
|
+
|
12
|
+
[*.js]
|
13
|
+
indent_style = tab
|
14
|
+
|
15
|
+
[*.{md,haml}]
|
16
|
+
trim_trailing_whitespace = false
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.beta6
|
@@ -1,4 +1,5 @@
|
|
1
1
|
//= require turbolinks
|
2
|
+
//= require activestorage
|
2
3
|
//= require ./mootools-core-1.5.0-full-compat.js
|
3
4
|
//= require ./mootools-more-1.5.0.js
|
4
5
|
//= require ./mootools_ujs
|
@@ -384,20 +385,58 @@
|
|
384
385
|
});
|
385
386
|
|
386
387
|
ajaxNote.success();
|
388
|
+
|
389
|
+
|
390
|
+
// direct_uploads.js
|
391
|
+
mainScope.addEventListener("direct-upload:initialize", event => {
|
392
|
+
const { target, detail } = event
|
393
|
+
const { id, file } = detail
|
394
|
+
target.insertAdjacentHTML("beforebegin", `
|
395
|
+
<div id="direct-upload-${id}" class="direct-upload direct-upload--pending">
|
396
|
+
<div id="direct-upload-progress-${id}" class="direct-upload__progress" style="width: 0%"></div>
|
397
|
+
<span class="direct-upload__filename">${file.name}</span>
|
398
|
+
</div>
|
399
|
+
`)
|
400
|
+
})
|
401
|
+
|
402
|
+
mainScope.addEventListener("direct-upload:start", event => {
|
403
|
+
const { id } = event.detail
|
404
|
+
const element = document.getElementById(`direct-upload-${id}`)
|
405
|
+
element.classList.remove("direct-upload--pending")
|
406
|
+
})
|
407
|
+
|
408
|
+
mainScope.addEventListener("direct-upload:progress", event => {
|
409
|
+
const { id, progress } = event.detail
|
410
|
+
const progressElement = document.getElementById(`direct-upload-progress-${id}`)
|
411
|
+
progressElement.style.width = `${progress}%`
|
412
|
+
})
|
413
|
+
|
414
|
+
mainScope.addEventListener("direct-upload:error", event => {
|
415
|
+
event.preventDefault()
|
416
|
+
const { id, error } = event.detail
|
417
|
+
const element = document.getElementById(`direct-upload-${id}`)
|
418
|
+
element.classList.add("direct-upload--error")
|
419
|
+
element.setAttribute("title", error)
|
420
|
+
})
|
421
|
+
|
422
|
+
mainScope.addEventListener("direct-upload:end", event => {
|
423
|
+
const { id } = event.detail
|
424
|
+
const element = document.getElementById(`direct-upload-${id}`)
|
425
|
+
element.classList.add("direct-upload--complete")
|
426
|
+
})
|
387
427
|
});
|
388
428
|
|
389
429
|
|
390
430
|
var bodyCallback = function () {
|
391
431
|
window.fireEvent('bhfDomChunkReady', [document.body]);
|
392
432
|
};
|
393
|
-
var scopeCallback = function(scope){
|
433
|
+
var scopeCallback = function (scope) {
|
394
434
|
window.fireEvent('bhfDomChunkReady', [scope]);
|
395
435
|
};
|
396
436
|
document.addEventListener('turbolinks:request-start', function () {
|
397
437
|
ajaxNote.loading();
|
398
438
|
});
|
399
439
|
document.addEventListener('turbolinks:load', bodyCallback);
|
400
|
-
window.addEvent('domready', bodyCallback);
|
401
440
|
window.addEvent('platformUpdate', scopeCallback);
|
402
441
|
window.addEvent('quickEditFormInject', scopeCallback);
|
403
442
|
}());
|
@@ -1241,3 +1241,39 @@ input[type="submit"].alt_button,
|
|
1241
1241
|
.icon
|
1242
1242
|
background-image: image-url('bhf/pictos_2x.png')
|
1243
1243
|
background-size: 510px 280px
|
1244
|
+
|
1245
|
+
|
1246
|
+
.direct-upload
|
1247
|
+
display: inline-block
|
1248
|
+
position: relative
|
1249
|
+
padding: 2px 4px
|
1250
|
+
margin: 0 3px 3px 0
|
1251
|
+
border: 1px solid rgba(0, 0, 0, 0.3)
|
1252
|
+
border-radius: 3px
|
1253
|
+
font-size: 11px
|
1254
|
+
line-height: 13px
|
1255
|
+
|
1256
|
+
|
1257
|
+
.direct-upload--pending
|
1258
|
+
opacity: 0.6
|
1259
|
+
|
1260
|
+
|
1261
|
+
.direct-upload__progress
|
1262
|
+
position: absolute
|
1263
|
+
top: 0
|
1264
|
+
left: 0
|
1265
|
+
bottom: 0
|
1266
|
+
opacity: 0.2
|
1267
|
+
background: $b1
|
1268
|
+
transition: width 120ms ease-out, opacity 60ms 60ms ease-in
|
1269
|
+
transform: translate3d(0, 0, 0)
|
1270
|
+
|
1271
|
+
.direct-upload--complete .direct-upload__progress
|
1272
|
+
opacity: 0.4
|
1273
|
+
|
1274
|
+
.direct-upload--error
|
1275
|
+
border-color: $r1
|
1276
|
+
|
1277
|
+
|
1278
|
+
input[type=file][data-direct-upload-url][disabled]
|
1279
|
+
display: none
|
@@ -54,7 +54,6 @@ class Bhf::EntriesController < Bhf::ApplicationController
|
|
54
54
|
|
55
55
|
before_save
|
56
56
|
if @object.update_attributes(@permited_params)
|
57
|
-
puts 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
58
57
|
manage_relations
|
59
58
|
after_save
|
60
59
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= node f, field do
|
2
|
+
- file = f.object.send(field.name)
|
3
|
+
- if file.present? && file.attachment.present?
|
4
|
+
- file_blob_url = main_app.route_for(:rails_service_blob, file.blob.signed_id, file.blob.filename)
|
5
|
+
- if file.blob.image?
|
6
|
+
= link_to image_tag(main_app.route_for(:rails_representation, file.variant(resize: "200>")), class: 'uploaded_image'), file_blob_url
|
7
|
+
- else
|
8
|
+
= link_to file.blob.filename.to_s, file_blob_url, class: 'uploaded_file'
|
9
|
+
|
10
|
+
- if f.object.respond_to?(:"#{field.name}_destroy")
|
11
|
+
.file_delete
|
12
|
+
= f.check_box "#{field.name}_destroy"
|
13
|
+
= f.label "#{field.name}_destroy", t('bhf.helpers.file.delete')
|
14
|
+
|
15
|
+
= f.file_field field.name, direct_upload: true, data: {:'direct-upload-url' => main_app.rails_direct_uploads_url}
|
File without changes
|
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 1.0.0.
|
5
|
+
# stub: bhf 1.0.0.beta6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bhf".freeze
|
9
|
-
s.version = "1.0.0.
|
9
|
+
s.version = "1.0.0.beta6"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Anton Pawlik".freeze]
|
14
|
-
s.date = "2018-05-
|
14
|
+
s.date = "2018-05-31"
|
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.".freeze
|
16
16
|
s.email = "anton.pawlik@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
"README.md"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
|
+
".editorconfig",
|
22
23
|
"Gemfile",
|
23
24
|
"Gemfile.lock",
|
24
25
|
"LICENSE.txt",
|
@@ -80,6 +81,8 @@ Gem::Specification.new do |s|
|
|
80
81
|
"app/views/bhf/form/belongs_to/_radio.html.haml",
|
81
82
|
"app/views/bhf/form/belongs_to/_select.html.haml",
|
82
83
|
"app/views/bhf/form/belongs_to/_static.html.haml",
|
84
|
+
"app/views/bhf/form/column/_activestorage_attachment.html.haml",
|
85
|
+
"app/views/bhf/form/column/_activestorage_attachments.html.haml",
|
83
86
|
"app/views/bhf/form/column/_array.html.haml",
|
84
87
|
"app/views/bhf/form/column/_boolean.html.haml",
|
85
88
|
"app/views/bhf/form/column/_date.html.haml",
|
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: 1.0.0.
|
4
|
+
version: 1.0.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Pawlik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -160,6 +160,7 @@ extra_rdoc_files:
|
|
160
160
|
- LICENSE.txt
|
161
161
|
- README.md
|
162
162
|
files:
|
163
|
+
- ".editorconfig"
|
163
164
|
- Gemfile
|
164
165
|
- Gemfile.lock
|
165
166
|
- LICENSE.txt
|
@@ -221,6 +222,8 @@ files:
|
|
221
222
|
- app/views/bhf/form/belongs_to/_radio.html.haml
|
222
223
|
- app/views/bhf/form/belongs_to/_select.html.haml
|
223
224
|
- app/views/bhf/form/belongs_to/_static.html.haml
|
225
|
+
- app/views/bhf/form/column/_activestorage_attachment.html.haml
|
226
|
+
- app/views/bhf/form/column/_activestorage_attachments.html.haml
|
224
227
|
- app/views/bhf/form/column/_array.html.haml
|
225
228
|
- app/views/bhf/form/column/_boolean.html.haml
|
226
229
|
- app/views/bhf/form/column/_date.html.haml
|