egov_utils 0.1.33 → 0.1.35
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/assets/javascripts/egov_utils/eGovUtilities.coffee.erb +14 -0
- data/app/controllers/egov_utils/users_controller.rb +8 -2
- data/app/views/layouts/egov_utils/_messages.html.haml +1 -1
- data/config/locales/cs.yml +7 -5
- data/lib/bootstrap_form/check_box_patch.rb +49 -0
- data/lib/bootstrap_form/custom_file_field.rb +1 -1
- data/lib/egov_utils/engine.rb +5 -3
- data/lib/egov_utils/routes/admin_constraint.rb +9 -0
- data/lib/egov_utils/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c4dbda3371757f34c4093f2e58f05ba21c6750c567d27962577f6002aa894b6
|
4
|
+
data.tar.gz: a43a27f761857247f2b001225dc2a8222a47e317d870fef7ace360ec0e3b682f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68e8a489421ebaca129737565cc70f0c0f2a5c4a03bbc8a6b62c623f1ad425acf2e553127aaf03e90f81a320a055ce6499b71936d7207fa3a213108f19643f0a
|
7
|
+
data.tar.gz: 57b1603c7b2f9e99a91deb4da0faa5f9d10c5e3a84d05b473221488d5267884530251dcf526b4d9cbca9a0c446a717856c6d12b8f5a357be3e961c119993aeec
|
@@ -17,16 +17,30 @@ window.eGovUtilities =
|
|
17
17
|
close: 'fa fa-close'
|
18
18
|
}
|
19
19
|
|
20
|
+
$(document).on 'change', '.custom-file-input:file', ()->
|
21
|
+
$input = $(this)
|
22
|
+
numFiles = if this.files then this.files.length else 1
|
23
|
+
label = $input.val().replace(/\\/g, '/').replace(/.*\//, '')
|
24
|
+
$input.trigger('fileselect', [numFiles, label])
|
25
|
+
$input.parent().find('.custom-file-control').text(label);
|
26
|
+
|
20
27
|
|
21
28
|
initPage: ($container)->
|
22
29
|
$container ||= $(document)
|
23
30
|
eGovUtilities.initDatepickers($container)
|
24
31
|
eGovUtilities.initSelect2($container)
|
32
|
+
eGovUtilities.initFileFields($container)
|
25
33
|
|
26
34
|
clearBeforeCache: ($container)->
|
27
35
|
$container ||= $(document)
|
28
36
|
eGovUtilities.destroySelect2($container)
|
29
37
|
|
38
|
+
initFileFields: ($container)->
|
39
|
+
$('.custom-file-input:file').each ()->
|
40
|
+
$input = $(this)
|
41
|
+
label = $input.val().replace(/\\/g, '/').replace(/.*\//, '')
|
42
|
+
$input.parent().find('.custom-file-control').text(label);
|
43
|
+
|
30
44
|
initDatepickers: ($container)->
|
31
45
|
$container ||= $(document)
|
32
46
|
if !Modernizr.inputtypes.date
|
@@ -21,8 +21,13 @@ module EgovUtils
|
|
21
21
|
@user.mail ||= @user.login
|
22
22
|
respond_to do |format|
|
23
23
|
if @user.save
|
24
|
-
|
25
|
-
|
24
|
+
if EgovUtils::Settings.allow_register? && !current_user.logged?
|
25
|
+
UserMailer.confirmation_email(@user).deliver_later
|
26
|
+
flash[:notice] = t('notice_signeup_with_mail')
|
27
|
+
else
|
28
|
+
flash[:notice] = t('activerecord.successful.messages.created', model: User.model_name.human)
|
29
|
+
end
|
30
|
+
format.html{ redirect_to main_app.root_path }
|
26
31
|
format.json{ render json: @user, status: :created }
|
27
32
|
else
|
28
33
|
format.html{ render 'new' }
|
@@ -47,6 +52,7 @@ module EgovUtils
|
|
47
52
|
render_404 and return unless @user || @user.active? || @user.updated_at < (Time.now - 24.hours)
|
48
53
|
@user.update(active: true)
|
49
54
|
logged_user = @user
|
55
|
+
flash[:notice] = t('success_user_confirm')
|
50
56
|
redirect_to('/')
|
51
57
|
end
|
52
58
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
- flash.each do |name, msg|
|
2
2
|
- if msg.is_a?(String)
|
3
|
-
%div{:class => "alert alert-#{name.to_s == 'notice' ? "info" : (name.to_s == 'error' ? "
|
3
|
+
%div{:class => "alert alert-#{name.to_s == 'notice' ? "info" : (name.to_s == 'error' ? "danger" : name.to_s)} alert-dismissible fade show", "role" => "alert"}
|
4
4
|
%button.close{'type' => 'button', 'data-dismiss' => 'alert'}
|
5
5
|
%span{'aria-hidden' => 'true'}= raw '×'
|
6
6
|
= msg
|
data/config/locales/cs.yml
CHANGED
@@ -21,6 +21,8 @@ cs:
|
|
21
21
|
notice_account_pending: Váš účet čeká na schválení/ověření
|
22
22
|
notice_account_locked: Váš účet byl uzamčen správcem aplikace
|
23
23
|
notice_logout: Byl/a jste úspěšně odhlášen/a
|
24
|
+
notice_signeup_with_mail: Registrace proběhla úspěšně, byl Vám odeslán potvrovací e-mail, prosím zkontrolujte svou poštu.
|
25
|
+
success_user_confirm: Váše e-mailová adresa byla potvrzena. Nyní se již můžete přihlásit.
|
24
26
|
|
25
27
|
label_approve: Schválit
|
26
28
|
label_new: Nový
|
@@ -40,13 +42,13 @@ cs:
|
|
40
42
|
|
41
43
|
|
42
44
|
models: &my_models
|
43
|
-
egov_utils
|
45
|
+
egov_utils/user:
|
44
46
|
one: Uživatel
|
45
|
-
|
46
|
-
egov_utils
|
47
|
+
other: Uživatelé
|
48
|
+
egov_utils/group:
|
47
49
|
one: Skupina
|
48
|
-
|
49
|
-
egov_utils
|
50
|
+
other: Skupiny
|
51
|
+
egov_utils/address:
|
50
52
|
one: Adresa
|
51
53
|
other: Adresy
|
52
54
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module BootstrapForm
|
2
|
+
module CheckBoxPatch
|
3
|
+
|
4
|
+
# TODO: post to upstream
|
5
|
+
def check_box(name, options = {}, checked_value = "1", unchecked_value = "0", &block)
|
6
|
+
options = options.symbolize_keys!
|
7
|
+
check_box_options = options.except(:label, :label_class, :wrapper_class, :help, :inline)
|
8
|
+
|
9
|
+
label_classes = [options[:label_class], 'form-check-label']
|
10
|
+
unless options.delete(:skip_required)
|
11
|
+
label_classes << "required" if required_attribute?(object, name)
|
12
|
+
end
|
13
|
+
options[:label_class] = label_classes.compact.join(' ')
|
14
|
+
|
15
|
+
|
16
|
+
check_box_options[:class] = ['form-check-input', check_box_options[:class]].compact.join(' ')
|
17
|
+
|
18
|
+
|
19
|
+
html = check_box_without_bootstrap(name, check_box_options, checked_value, unchecked_value)
|
20
|
+
label_content = block_given? ? capture(&block) : options[:label]
|
21
|
+
html.concat(' ').concat(label_content || (object && object.class.human_attribute_name(name)) || name.to_s.humanize)
|
22
|
+
|
23
|
+
label_name = name
|
24
|
+
# label's `for` attribute needs to match checkbox tag's id,
|
25
|
+
# IE sanitized value, IE
|
26
|
+
# https://github.com/rails/rails/blob/c57e7239a8b82957bcb07534cb7c1a3dcef71864/actionview/lib/action_view/helpers/tags/base.rb#L116-L118
|
27
|
+
if options[:multiple]
|
28
|
+
label_name =
|
29
|
+
"#{name}_#{checked_value.to_s.gsub(/\s/, "_").gsub(/[^-\w]/, "").downcase}"
|
30
|
+
end
|
31
|
+
|
32
|
+
disabled_class = " disabled" if options[:disabled]
|
33
|
+
label_class = options[:label_class]
|
34
|
+
|
35
|
+
if options[:inline]
|
36
|
+
label_class = " #{label_class}" if label_class
|
37
|
+
label(label_name, html, class: "checkbox-inline#{disabled_class}#{label_class}")
|
38
|
+
else
|
39
|
+
wrapper_class = ['form-checkbox', options[:wrapper_class]]
|
40
|
+
wrapper_class << error_class if has_error?(name)
|
41
|
+
wrapper_class = wrapper_class.compact.join(' ')
|
42
|
+
content_tag(:div, class: "#{wrapper_class}#{disabled_class}") do
|
43
|
+
label(label_name, html, class: label_class).concat(generate_help(name, options[:help]))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -6,7 +6,7 @@ module BootstrapForm
|
|
6
6
|
args << options
|
7
7
|
form_group_builder(name, options.reverse_merge(control_class: nil)) do
|
8
8
|
html = file_field_without_bootstrap(name, options.merge(class: 'custom-file-input')) + " " + content_tag('span', '', class: ['custom-file-control', options[:class]].compact.join(' '))
|
9
|
-
label(
|
9
|
+
label(name, html, class: "custom-file form-control")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
data/lib/egov_utils/engine.rb
CHANGED
@@ -82,10 +82,9 @@ module EgovUtils
|
|
82
82
|
require 'bootstrap_form'
|
83
83
|
|
84
84
|
require 'bootstrap_form/helpers/bootstrap4'
|
85
|
-
|
85
|
+
# TODO: should be included in Helper, to support every submit tag
|
86
86
|
BootstrapForm::FormBuilder.__send__(:prepend, BootstrapForm::Helpers::Bootstrap4)
|
87
|
-
|
88
|
-
|
87
|
+
|
89
88
|
require 'bootstrap_form/datetimepicker'
|
90
89
|
require 'bootstrap_form/fileuid'
|
91
90
|
require 'bootstrap_form/select2'
|
@@ -99,6 +98,9 @@ module EgovUtils
|
|
99
98
|
BootstrapForm::FormBuilder.__send__(:prepend, BootstrapForm::Select2)
|
100
99
|
BootstrapForm::FormBuilder.__send__(:prepend, BootstrapForm::CustomFileField)
|
101
100
|
|
101
|
+
require 'bootstrap_form/check_box_patch'
|
102
|
+
BootstrapForm::FormBuilder.__send__(:prepend, BootstrapForm::CheckBoxPatch)
|
103
|
+
|
102
104
|
require 'egov_utils/helpers/tags/datetime_field_patch'
|
103
105
|
ActionView::Helpers::Tags::DatetimeField.prepend(EgovUtils::Helpers::Tags::DatetimeFieldPatch)
|
104
106
|
|
data/lib/egov_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egov_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -429,6 +429,7 @@ files:
|
|
429
429
|
- db/migrate/20171103141234_add_birth_place_and_residence_to_people.rb
|
430
430
|
- db/migrate/20171109172909_add_external_uid_to_groups.rb
|
431
431
|
- db/migrate/20171115142450_add_confirmation_code_to_users.rb
|
432
|
+
- lib/bootstrap_form/check_box_patch.rb
|
432
433
|
- lib/bootstrap_form/custom_file_field.rb
|
433
434
|
- lib/bootstrap_form/datetimepicker.rb
|
434
435
|
- lib/bootstrap_form/fileuid.rb
|
@@ -442,6 +443,7 @@ files:
|
|
442
443
|
- lib/egov_utils/helpers/form_helper.rb
|
443
444
|
- lib/egov_utils/helpers/tags/datetime_field_patch.rb
|
444
445
|
- lib/egov_utils/helpers/tags/fileuid_field.rb
|
446
|
+
- lib/egov_utils/routes/admin_constraint.rb
|
445
447
|
- lib/egov_utils/settings.rb
|
446
448
|
- lib/egov_utils/test_utils/controller_helpers.rb
|
447
449
|
- lib/egov_utils/user_utils/application_controller_patch.rb
|