eac_rails_base0 0.34.0 → 0.37.0

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
  SHA256:
3
- metadata.gz: a08e10dc66beebfc0b0e7c1e92b68914f5d786573496423ad3aaf5cabec097c5
4
- data.tar.gz: 2d3d82fce567e1c8078676405ec68e49d5fb7708e61922d4eb827194657c5833
3
+ metadata.gz: a432acee9af945b984da1ec653f7904a5c5cde7f7898694ff28d79cba1f822c9
4
+ data.tar.gz: 69566b474eeb22d328188427864200a2c7402044e809d0388eda856a3c8f2b4b
5
5
  SHA512:
6
- metadata.gz: b08d8d458effd18839577dcef7ecf500b08d673c1c214a372e2ddff7ae04ef745d4aed7a7a691b83408a00e13823412babc56753cd25991ab86ed2c924d7836f
7
- data.tar.gz: 34c1a05dbbd9071f6b6deb069a54d83cffad84e281518e31ea5fdfa29309999094f8cf4cf2b687cead29e39de40734c748fe7733ec396b211fad7d6adc3deee3
6
+ metadata.gz: e6c423c9e11901c72137a2a8b3b9e81ea7b7db8052f66a7a0dd215cf936137ce8f217a058a9557f59864846ecb4a2cf9f3c3a8fec19f99f5609ee2addbc23fa8
7
+ data.tar.gz: '0099a466e95273bb5dc658cc14ba537490b7286f364d5290f4c9614b3da26d1b4d2241b3aa2704211dc29a838506d769752a8f3498875e6f8beee45e0db52033'
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRailsBase0
4
+ module PanelDefaultHelper
5
+ def panel_default(title, &block)
6
+ content_tag(:div, class: 'container') do
7
+ content_tag(:div, class: 'panel panel-default') do
8
+ panel_heading(title) << panel_body(block)
9
+ end
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def panel_heading(title)
16
+ content_tag(:div, class: 'panel-heading') do
17
+ content_tag(:h2, class: 'panel-title') do
18
+ title
19
+ end
20
+ end
21
+ end
22
+
23
+ def panel_body(block)
24
+ content_tag(:div, class: 'panel-body') do
25
+ block ? block.call : ''
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ <!--
2
+ f.email_field :email, autofocus: true, autocomplete: "email",
3
+ value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email)
4
+ -->
5
+ <%= panel_default t('devise.confirmation_resend') do %>
6
+ <%= common_form(resource, as: resource_name, url: confirmation_path(resource_name),
7
+ html: { method: :post }, :submit_label => t('devise.confirmation_resend_submit')) do |f| %>
8
+ <%= f.email_field :email, required: true %>
9
+ <% end %>
10
+ <%= render "devise/shared/links" %>
11
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <p>Olá <%= @email %>!</p>
2
+ <p>Você pode confirmar sua conta de usuário através do link abaixo:</p>
3
+ <p>
4
+ <%= link_to 'Confirmar minha conta', confirmation_url(@resource, confirmation_token: @token) %>
5
+ </p>
@@ -0,0 +1,9 @@
1
+ <p>Olá <%= @resource.email %>!</p>
2
+ <p>Alguém solicitou a recuperação de sua senha. Você pode fazer isso
3
+ através do link abaixo.</p>
4
+ <p><%= link_to 'Alterar minha senha',
5
+ edit_password_url(@resource, reset_password_token: @token) %></p>
6
+ <p>Se você não efetuou esta solicitação, por favor, ignore este
7
+ e-mail.</p>
8
+ <p>Sua senha não será alterada até que você acesse o link acima e
9
+ recadastre-a.</p>
@@ -0,0 +1,10 @@
1
+ <%= panel_default t('devise.update_password') do %>
2
+ <%= common_form(resource, as: resource_name,
3
+ url: password_path(resource_name), submit_label: t('devise.update_password_submit'),
4
+ html: { method: :put }
5
+ ) do |f| %>
6
+ <%= f.hidden_field :reset_password_token %>
7
+ <%= f.password_field :password, label: t('devise.new_password'), required: true %>
8
+ <%= f.password_field :password_confirmation, required: true %>
9
+ <% end %>
10
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%= panel_default t('devise.forgot_password') do %>
2
+ <%= common_form(resource, as: resource_name, url: password_path(resource_name),
3
+ submit_label: t('devise.forgot_password_submit'),
4
+ html: { method: :post }) do |f| %>
5
+ <%= f.email_field :email, class: 'form-control' %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= panel_default t('devise.update_password') do %>
2
+ <%= common_form(resource, as: resource_name, url: registration_path(resource_name),
3
+ submit_label: t('devise.update_password_submit'), html: { method: :put, role: "form" }) do |f| %>
4
+ <p>Preencha os campos abaixo se deseja alterar sua senha.</p>
5
+ <%= f.password_field :current_password, label: 'Senha atual', required: true %>
6
+ <%= f.password_field :password, label: 'Nova senha', required: false %>
7
+ <%= f.password_field :password_confirmation, label: 'Confirmação de senha' %>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= panel_default t('devise.sign_up') do %>
2
+ <%= common_form(resource, as: resource_name, url: registration_path(resource_name),
3
+ submit_label: t('devise.sign_up_submit'), html: { role: "form" }) do |f| %>
4
+ <%= f.email_field :email %>
5
+ <%= f.password_field :password, required: true %>
6
+ <%= f.password_field :password_confirmation, required: true %>
7
+ <% end %>
8
+ <%= render "devise/shared/links" %>
9
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= panel_default t('devise.log_in') do %>
2
+ <%= common_form(resource, as: resource_name, url: session_path(resource_name),
3
+ :submit_label => t('devise.log_in')) do |f| %>
4
+ <%= f.email_field :email, required: true %>
5
+ <%= f.password_field :password, required: true %>
6
+ <%= f.check_box_field :remember_me %>
7
+ <% end %>
8
+ <%= render "devise/shared/links" %>
9
+ <% end %>
@@ -0,0 +1,37 @@
1
+ <%
2
+ links = [{
3
+ condition: controller_name != 'sessions',
4
+ label: t('devise.log_in'),
5
+ url: -> { new_session_path(resource_name) }
6
+ },{
7
+ condition: devise_mapping.registerable? && controller_name != 'registrations',
8
+ label: t('devise.sign_up'),
9
+ url: -> {new_registration_path(resource_name) }
10
+ },{
11
+ condition: devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations',
12
+ label: t('devise.forgot_password'),
13
+ url: -> {new_password_path(resource_name) }
14
+ },{
15
+ condition: devise_mapping.confirmable? && controller_name != 'confirmations',
16
+ label: t('devise.unreceived_confirmation'),
17
+ url: -> {new_confirmation_path(resource_name) }
18
+ },{
19
+ condition: devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks',
20
+ label: t('devise.unreceived_unlock'),
21
+ url: -> { new_unlock_path(resource_name) }
22
+ }]
23
+ if devise_mapping.omniauthable?
24
+ links += resource_class.omniauth_providers.map do |provider|
25
+ {
26
+ condition: true,
27
+ label: t("devise.log_in_with", provider: ::OmniAuth::Utils.camelize(provider)),
28
+ url: -> { omniauth_authorize_path(resource_name, provider) }
29
+ }
30
+ end
31
+ end
32
+ %>
33
+ <% links.each do |link| %>
34
+ <% if link.fetch(:condition) %>
35
+ <%= link_to link.fetch(:label), link.fetch(:url).call %><br/>
36
+ <% end %>
37
+ <% end %>
@@ -17,7 +17,7 @@
17
17
  #
18
18
  # config.autoload_paths << Rails.root.join('lib')
19
19
  #
20
- if (PG::VERSION != '0.21.0') || (ActiveRecord.version.to_s != '4.2.11.1')
20
+ if (PG::VERSION != '0.21.0') || (ActiveRecord.version.to_s != '4.2.11.3')
21
21
  ::Rails.logger.warn(<<~MSG)
22
22
  -----------------------------------------------------------------------------------
23
23
  The pg and/or activerecord gem version has changed, meaning deprecated pg constants
@@ -4,18 +4,27 @@ pt-BR:
4
4
  default: '%d/%m/%Y'
5
5
  picker: '%d/%m/%Y'
6
6
  short: '%d/%m/%y'
7
+ devise:
8
+ confirmation_resend: Reenvio de instruções de confirmação
9
+ confirmation_resend_submit: Reenviar
10
+ forgot_password: Esqueceu sua senha?
11
+ forgot_password_submit: Envie-me as instruções de recuperação de senha
12
+ log_in: Entrar
13
+ log_in_with: Entrar com %{provider}
14
+ log_out: Sair
15
+ new_password: Nova senha
16
+ sign_up: Cadastrar-se
17
+ sign_up_submit: Cadastrar
18
+ unreceived_confirmation: Não recebeu as instruções de confirmação?
19
+ unreceived_unlock: Não recebeu as instruções de desbloqueio de conta?
20
+ update_password: Alteração de senha
21
+ update_password_submit: Alterar minha senha
7
22
  time:
8
23
  formats:
9
24
  default: "%d/%m/%Y %H:%M"
10
25
  picker: '%d/%m/%Y %H:%M'
11
26
  short: '%d/%m/%y %H:%M'
12
27
  eac_rails_base0:
13
- links:
14
- delete_confirm: Confirma a remoção de "%{label}"?
15
- delete_object: Remover "%{label}".
16
- edit_object: Editar "%{label}".
17
- goto_url: Ir para %{url}.
18
- show_object: Mostrar "%{label}".
19
28
  main_menu:
20
29
  admin:
21
30
  aranha: Aranha
@@ -14,19 +14,40 @@ module EacRailsBase0
14
14
  administrator_rules(user)
15
15
  end
16
16
 
17
+ def devise_confirmation_rules(user)
18
+ return unless user.new_record?
19
+
20
+ can :create, 'Devise::Confirmation'
21
+ end
22
+
23
+ def devise_invitable_rules(user)
24
+ can :create, 'Devise::Invitation' if user.administrator?
25
+ can :update, 'Devise::Invitation'
26
+ if user.new_record?
27
+ can :create, 'DeviseInvitable::Registration'
28
+ else
29
+ can :update, 'DeviseInvitable::Registration'
30
+ end
31
+ end
32
+
17
33
  def devise_password_rules(user)
18
34
  return unless user.new_record?
19
35
 
20
36
  can :manage, 'Devise::Password'
21
37
  end
22
38
 
39
+ def devise_registration_rules(user)
40
+ can :create, 'Devise::Registration' if user.new_record?
41
+ can :update, 'Devise::Registration' unless user.new_record?
42
+ end
43
+
23
44
  def devise_session_rules(user)
24
45
  can :destroy, 'Devise::Session' unless user.new_record?
25
46
  can :create, 'Devise::Session'
26
47
  end
27
48
 
28
49
  def devise_rules(user)
29
- %w[password session].each do |devise_module|
50
+ %w[confirmation invitable password registration session].each do |devise_module|
30
51
  send("devise_#{devise_module}_rules", user)
31
52
  end
32
53
  end
@@ -6,9 +6,11 @@ module EacRailsBase0
6
6
  include CanCanDry::AbilityMapping
7
7
  include CanCanDry::AbilityMappingSets::ActiveScaffold
8
8
  include CanCanDry::AbilityMappingSets::Devise
9
+ include CanCanDry::AbilityMappingSets::DeviseInvitable
9
10
 
10
11
  def initialize
11
12
  map_devise
13
+ map_devise_invitable
12
14
  map_controller 'EacUsersSupport::Admin::Users', :manage, ::EacUsersSupport::User
13
15
  map_controller 'Aranha::Addresses', :manage, ::Aranha::Address
14
16
  map_controller 'BrRailties::FederalUnits', :manage, ::BrRailties::FederalUnit
@@ -50,5 +50,8 @@ module EacRailsBase0App
50
50
  env.logger
51
51
  )
52
52
  end
53
+
54
+ migrate_deprecated_dir = ::Rails.root.join('db', 'migrate_deprecated')
55
+ config.paths['db/migrate'] << migrate_deprecated_dir if migrate_deprecated_dir.directory?
53
56
  end
54
57
  end
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'aranha/engine'
4
+ require 'br_railties/engine'
5
+ require 'eac_rails_utils/engine'
6
+ require 'eac_users_support/engine'
7
+
3
8
  module EacRailsBase0
4
9
  class Engine < ::Rails::Engine
5
10
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsBase0
4
- VERSION = '0.34.0'
4
+ VERSION = '0.37.0'
5
5
  end
@@ -22,15 +22,6 @@ namespace :eac_rails_base0 do
22
22
 
23
23
  desc 'Minitest and RSpec for application'
24
24
  task test: ['test', 'eac_rails_base0:rspec']
25
-
26
- namespace :gems do
27
- desc 'Minitest and RSpec for application and local gems'
28
- task test_all: :environment do
29
- require 'eac_ruby_gems_utils/tests/multiple'
30
- tests = ::EacRubyGemsUtils::Tests::Multiple.new(::EacRailsBase0::Gems.all)
31
- raise 'Some test did not pass' unless tests.ok?
32
- end
33
- end
34
25
  end
35
26
 
36
27
  Rake::Task['default'].clear
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :eac_rails_base0 do
4
+ namespace :gems do
5
+ desc <<~DESCRIPTION
6
+ Minitest and RSpec for application and local gems.
7
+
8
+ Use GEMS environment variable to test only selected gems. Example:
9
+
10
+ rake eac_rails_base0:gems:test_all GEMS=gem1_name,gem2_name
11
+ DESCRIPTION
12
+ task test_all: :environment do
13
+ require 'eac_ruby_gems_utils/tests/multiple'
14
+ gems = ::EacRailsBase0::Gems.all
15
+ ENV['GEMS'].if_present { |v| v.to_s.split(',').map(&:strip) }.if_present do |gem_names|
16
+ gems = gems.select { |gem| gem_names.include?(gem.to_s) }
17
+ end
18
+ tests = ::EacRubyGemsUtils::Tests::Multiple.new(gems)
19
+ raise 'Some test did not pass' unless tests.ok?
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.0
4
+ version: 0.37.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-08 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.14'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.14.2
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.14'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.14.2
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bootstrap-sass
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -510,7 +516,17 @@ files:
510
516
  - app/assets/stylesheets/eac_rails_base0/default_configuration.scss
511
517
  - app/controllers/eac_rails_base0/application_controller.rb
512
518
  - app/helpers/eac_rails_base0/layout_helper.rb
519
+ - app/helpers/eac_rails_base0/panel_default_helper.rb
513
520
  - app/uploaders/eac_rails_base0/default_file_uploader.rb
521
+ - app/views/devise/confirmations/new.html.erb
522
+ - app/views/devise/mailer/confirmation_instructions.html.erb
523
+ - app/views/devise/mailer/reset_password_instructions.html.erb
524
+ - app/views/devise/passwords/edit.html.erb
525
+ - app/views/devise/passwords/new.html.erb
526
+ - app/views/devise/registrations/edit.html.erb
527
+ - app/views/devise/registrations/new.html.erb
528
+ - app/views/devise/sessions/new.html.erb
529
+ - app/views/devise/shared/_links.html.erb
514
530
  - app/views/layouts/eac_rails_base0/_flash.html.erb
515
531
  - app/views/layouts/eac_rails_base0/_main_menu.html.erb
516
532
  - app/views/layouts/eac_rails_base0/_navbar_user.html.erb
@@ -583,6 +599,7 @@ files:
583
599
  - lib/generators/eac_rails_base0/testers/testers_generator.rb
584
600
  - lib/generators/eac_rails_base0_generator.rb
585
601
  - lib/tasks/eac_rails_base0.rake
602
+ - lib/tasks/eac_rails_base0/gems.rake
586
603
  homepage: https://github.com/esquilo-azul/eac_rails_base0
587
604
  licenses:
588
605
  - MIT