ecm_user_area2 2.0.0 → 2.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 614c956b50107960ff26d10c3148f25a91960933
4
- data.tar.gz: bdce50d41b9fd97e8077fbd79fafd412a7f00d18
3
+ metadata.gz: 3628ffd41c3d078ca73eeab43e6f0fae541c141e
4
+ data.tar.gz: 2d73ad9b91a6a9894ea24571d12f3e295ae79819
5
5
  SHA512:
6
- metadata.gz: b0c568b9acbc9beb2c69257a8cb934bb61660eeffc1a1202e371ec13661e2733f02a39b4ac8475b7b4c8ccaebaefa87ad5ee90ff56eac2a9bd6816cb3adff7ca
7
- data.tar.gz: 7139e1fbdc13d7e152ef91906d21d26d3fd36f5a3b5943cea355640b8a1f6c80269b881f7e706866fcf0bb95ec7843113ce88bc5d28aa24a53eafe40fcabbf46
6
+ metadata.gz: bae90e472c7a6fe4b701c481da73cf9cf44f6927f951a5baf2649dad053949dc5a8ffa311a1357988ff46884058409805e3587715b566479a4f38c19f4e10b3f
7
+ data.tar.gz: 60002ccb82b0a05aff68fc27728dd0fa604157051b78884737be8c0eb0c14e62c00fc7cff2ab15aabfc78fecc8d1600f049dc689d9deeafc1f7fa0fa8b71ccbf
@@ -0,0 +1,21 @@
1
+ module Controller
2
+ module StoreCurrentUserConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ before_action :store_current_user_id
7
+ before_action :store_current_user
8
+ end
9
+
10
+ private
11
+
12
+ def store_current_user_id
13
+ RequestLocals.store[:current_user_id] = current_user.try(:id)
14
+ end
15
+
16
+
17
+ def store_current_user
18
+ RequestLocals.store[:current_user] = current_user
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  module Ecm::UserArea
2
- class UsersController < Users::BaseController
2
+ class CurrentUsersController < Users::BaseController
3
3
  def self.resource_class
4
4
  User
5
5
  end
@@ -24,7 +24,7 @@ module Ecm::UserArea
24
24
  redirect_to(new_user_session_path)
25
25
  return
26
26
  end
27
- respond_with @resource, location: edit_user_path
27
+ respond_with @resource, location: edit_current_user_path
28
28
  end
29
29
 
30
30
  private
@@ -19,7 +19,7 @@ module Ecm
19
19
  validates :user, presence: true
20
20
 
21
21
  before_validation :load_user
22
- after_validation :delete_error_on_user, if: ->() { errors.get(:email).present? }
22
+ after_validation :delete_error_on_user, if: ->() { errors.has_key?(:email) }
23
23
 
24
24
  def save
25
25
  return unless valid?
@@ -8,9 +8,9 @@
8
8
  %span.caret
9
9
  %ul.dropdown-menu
10
10
  - if user_signed_in?
11
- %li= link_to t('.edit'), ecm_user_area.edit_user_path
11
+ %li= link_to t('.edit'), ecm_user_area.edit_current_user_path
12
12
  %li= link_to t('.sign_out'), ecm_user_area.user_session_path, method: :delete
13
13
  - else
14
14
  %li= link_to t('.sign_in'), ecm_user_area.new_user_session_path
15
15
  - if Ecm::UserArea::Configuration.enable_registrations
16
- %li= link_to t('.new'), ecm_user_area.new_user_path
16
+ %li= link_to t('.new'), ecm_user_area.new_current_user_path
@@ -2,14 +2,14 @@
2
2
  .panel-heading
3
3
  %h1= t('.title', inflections)
4
4
  .panel-body
5
- = simple_form_for(@resource, url: user_path) do |f|
5
+ = simple_form_for(@resource, url: current_user_path) do |f|
6
6
  = render partial: 'form_errors', locals: { resource: f.object }
7
7
  = render 'form', form: f
8
8
  = f.button :submit, class: 'btn btn-success'
9
9
  .panel-footer
10
10
 
11
11
  .well.well-sm
12
- = link_to user_path, class: 'btn btn-primary btn-responsive' do
12
+ = link_to current_user_path, class: 'btn btn-primary btn-responsive' do
13
13
  %span.glyphicon.glyphicon-eye-open
14
14
  %span.btn-text= t('.show')
15
15
  = link_to main_app.root_path, class: 'btn btn-default btn-responsive pull-right' do
@@ -2,7 +2,7 @@
2
2
  %div.panel-heading
3
3
  %h1= t('.title', inflections)
4
4
  %div.panel-body
5
- = simple_form_for(@resource, url: user_path) do |f|
5
+ = simple_form_for(@resource, url: current_user_path) do |f|
6
6
  = render partial: 'form_errors', locals: { resource: f.object }
7
7
  = render 'form', form: f
8
8
  = f.button :submit, class: 'btn btn-success'
@@ -8,7 +8,7 @@
8
8
  #page-actions.btn-container-right
9
9
  - if Ecm::UserArea::Configuration.allow_users_to_destroy_self
10
10
  .pull-right
11
- = link_to(ecm_user_area.user_path, method: :delete, class: 'btn btn-danger btn-responsive', 'data-confirm': I18n.t('confirmations.delete')) do
11
+ = link_to(ecm_user_area.current_user_path, method: :delete, class: 'btn btn-danger btn-responsive', 'data-confirm': I18n.t('confirmations.delete')) do
12
12
  %span.glyphicon.glyphicon-fire
13
13
  %span.btn-text= t('.destroy')
14
14
 
@@ -22,7 +22,10 @@
22
22
  = render 'show_extras', resource: @resource
23
23
 
24
24
  .well.well-sm
25
- = link_to(ecm_user_area.edit_user_path, class: 'btn btn-primary btn-responsive') do
25
+ = link_to(ecm_user_area.user_session_path, class: 'btn btn-warning btn-responsive', method: :delete) do
26
+ %span.glyphicon.glyphicon-pencil
27
+ %span.btn-text= t('.sign_out')
28
+ = link_to(ecm_user_area.edit_current_user_path, class: 'btn btn-primary btn-responsive') do
26
29
  %span.glyphicon.glyphicon-pencil
27
30
  %span.btn-text= t('.edit')
28
31
  = link_to main_app.root_path, class: 'btn btn-default btn-responsive pull-right' do
@@ -57,20 +57,23 @@ de:
57
57
  title: Einloggen
58
58
  password:
59
59
  new: 'Passwort vergessen'
60
+ current_users:
61
+ edit:
62
+ back: Zurück
63
+ show: Anzeigen
64
+ title: Mein Account
65
+ new:
66
+ back: Zurück
67
+ title: Registrieren
68
+ show:
69
+ back: Zurück
70
+ destroy: 'Löschen'
71
+ edit: 'Bearbeiten'
72
+ sign_out: Ausloggen
60
73
  users:
61
74
  base:
62
- edit:
63
- back: Zurück
64
- show: Anzeigen
65
- title: Mein Account
66
- new:
67
- back: Zurück
68
- title: Registrieren
69
75
  show:
70
- back: Zurück
71
- destroy: 'Löschen'
72
- edit: 'Bearbeiten'
73
- flash:
76
+ sign_out: Ausloggen
74
77
  ecm:
75
78
  user_area:
76
79
  user_password_resets:
@@ -85,9 +88,9 @@ de:
85
88
  create: 'Weiter'
86
89
  user_session:
87
90
  create: 'Einloggen'
88
- user:
89
- create: 'Registrieren'
90
- update: 'Aktualisieren'
91
+ # user:
92
+ # create: 'Registrieren'
93
+ # update: 'Aktualisieren'
91
94
  messages:
92
95
  confirmations:
93
96
  ecm_user_area:
@@ -101,7 +104,7 @@ de:
101
104
  authentication_failed: 'Sie müssen sich anmelden oder registrieren, bevor Sie fortfahren können.'
102
105
  perishable_token_invalid: 'Es konnte kein Benutzer mit dem eingegebenen Token gefunden werden oder ihr Token ist zu alt.'
103
106
  routes:
104
- ecm_user_area: benutzer
105
- users: profil
107
+ ecm_user_area_engine: benutzer
108
+ current_user: profil
106
109
  user_password_reset_request: passwort-reset
107
110
  user_session: session
@@ -36,26 +36,30 @@ en:
36
36
  title: Sign in
37
37
  password:
38
38
  new: Forgot password
39
+ current_users:
40
+ edit:
41
+ back: Back
42
+ show: Show
43
+ title: My Account
44
+ new:
45
+ back: Back
46
+ title: Register
47
+ show:
48
+ back: Back
49
+ destroy: 'Destroy'
50
+ edit: 'Edit'
51
+ sign_out: Sign out
39
52
  users:
40
53
  base:
41
- edit:
42
- back: Back
43
- show: Show
44
- title: My Account
45
- new:
46
- back: Back
47
- title: Register
48
54
  show:
49
- back: Back
50
- destroy: 'Destroy'
51
- edit: 'Edit'
55
+ sign_out: Sign out
52
56
  helpers:
53
57
  submit:
54
58
  user_session:
55
59
  create: 'Sign in'
56
- user:
57
- create: 'Create Account'
58
- update: 'Update Account'
60
+ # user:
61
+ # create: 'Create Account'
62
+ # update: 'Update Account'
59
63
  locales:
60
64
  de: Deutsch
61
65
  en: English
@@ -71,7 +75,7 @@ en:
71
75
  ecm_user_area:
72
76
  authentication_failed: 'You need to sign in or sign up before continuing.'
73
77
  routes:
74
- ecm_user_area: users
75
- user: profile
78
+ ecm_user_area_engine: user
79
+ current_user: profile
76
80
  user_password_reset_request: password-reset
77
81
  user_session: session
data/config/routes.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  Ecm::UserArea::Engine.routes.draw do
2
2
  localized do
3
- scope :ecm_user_area do
4
- resource :user, only: [:show, :edit, :update]
5
- resource :user, only: [:new, :create] if Ecm::UserArea::Configuration.enable_registrations
6
- resource :user, only: [:destroy] if Ecm::UserArea::Configuration.allow_users_to_destroy_self
3
+ scope :ecm_user_area_engine do
4
+ resource :current_user, only: [:show, :edit, :update]
5
+ resource :current_user, only: [:new, :create] if Ecm::UserArea::Configuration.enable_registrations
6
+ resource :current_user, only: [:destroy] if Ecm::UserArea::Configuration.allow_users_to_destroy_self
7
7
  resource :user_password_reset_request, only: [:new, :create]
8
8
 
9
9
  resource :user_password_reset, only: [] do
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module UserArea
3
- VERSION = '2.0.0'
3
+ VERSION = '2.2.0'
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ require 'itsf_services'
5
5
  require 'rails_rad'
6
6
  require 'resource_renderer'
7
7
  require 'simple_form'
8
+ require 'ecm_core'
8
9
 
9
10
  require 'ecm/user_area/engine'
10
11
  require 'ecm/user_area/configuration'
@@ -16,5 +17,21 @@ module Ecm
16
17
  def self.table_name_prefix
17
18
  'ecm_user_area_'
18
19
  end
20
+
21
+ module CurrentUser
22
+ extend ActiveSupport::Concern
23
+
24
+ class_methods do
25
+ def current_user_id
26
+ RequestLocals.fetch(:current_user_id) { nil }
27
+ end
28
+
29
+ def current_user
30
+ RequestLocals.fetch(:current_user) { nil }
31
+ end
32
+ end
33
+ end
34
+
35
+ include CurrentUser
19
36
  end
20
37
  end
@@ -1,5 +1,5 @@
1
1
  # This migration comes from ecm_user_area (originally 20160115181043)
2
- class CreateEcmUserAreaUsers < ActiveRecord::Migration
2
+ class CreateEcmUserAreaUsers < ActiveRecord::Migration[4.2]
3
3
  def change
4
4
  create_table :ecm_user_area_users do |t|
5
5
  # Authlogic::ActsAsAuthentic::Email
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_user_area2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-07 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: ecm_core
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: active_model_serializers
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -400,6 +414,8 @@ files:
400
414
  - Rakefile
401
415
  - app/concerns/controller/current_user_concern.rb
402
416
  - app/concerns/controller/redirect_back_concern.rb
417
+ - app/concerns/controller/store_current_user_concern.rb
418
+ - app/controllers/ecm/user_area/current_users_controller.rb
403
419
  - app/controllers/ecm/user_area/password_reset_requests/base_controller.rb
404
420
  - app/controllers/ecm/user_area/password_resets/base_controller.rb
405
421
  - app/controllers/ecm/user_area/sessions/base_controller.rb
@@ -407,7 +423,6 @@ files:
407
423
  - app/controllers/ecm/user_area/user_password_resets_controller.rb
408
424
  - app/controllers/ecm/user_area/user_sessions_controller.rb
409
425
  - app/controllers/ecm/user_area/users/base_controller.rb
410
- - app/controllers/ecm/user_area/users_controller.rb
411
426
  - app/helpers/ecm/user_area_helper.rb
412
427
  - app/mailers/ecm/user_area/user_mailer.rb
413
428
  - app/models/ecm/user_area/user.rb
@@ -418,6 +433,14 @@ files:
418
433
  - app/sessions/ecm/user_area/user_session.rb
419
434
  - app/views/ecm/user_area/_navigation.html.haml
420
435
  - app/views/ecm/user_area/_navigation_dropdown.html.haml
436
+ - app/views/ecm/user_area/current_users/_form.html.haml
437
+ - app/views/ecm/user_area/current_users/_form_errors.html.haml
438
+ - app/views/ecm/user_area/current_users/_head_extras.html.haml
439
+ - app/views/ecm/user_area/current_users/_show.html.haml
440
+ - app/views/ecm/user_area/current_users/_show_extras.html.haml
441
+ - app/views/ecm/user_area/current_users/edit.html.haml
442
+ - app/views/ecm/user_area/current_users/new.html.haml
443
+ - app/views/ecm/user_area/current_users/show.html.haml
421
444
  - app/views/ecm/user_area/password_reset_requests/base/_form.html.haml
422
445
  - app/views/ecm/user_area/password_reset_requests/base/_form_errors.html.haml
423
446
  - app/views/ecm/user_area/password_reset_requests/base/_head_extras.html.haml
@@ -434,14 +457,6 @@ files:
434
457
  - app/views/ecm/user_area/user_mailer/password_reset_email.de.text.erb
435
458
  - app/views/ecm/user_area/user_mailer/password_reset_email.en.html.erb
436
459
  - app/views/ecm/user_area/user_mailer/password_reset_email.en.text.erb
437
- - app/views/ecm/user_area/users/base/_form.html.haml
438
- - app/views/ecm/user_area/users/base/_form_errors.html.haml
439
- - app/views/ecm/user_area/users/base/_head_extras.html.haml
440
- - app/views/ecm/user_area/users/base/_show.html.haml
441
- - app/views/ecm/user_area/users/base/_show_extras.html.haml
442
- - app/views/ecm/user_area/users/base/edit.html.haml
443
- - app/views/ecm/user_area/users/base/new.html.haml
444
- - app/views/ecm/user_area/users/base/show.html.haml
445
460
  - config/locales/authlogic.de.yml
446
461
  - config/locales/de.yml
447
462
  - config/locales/en.yml
@@ -504,8 +519,6 @@ files:
504
519
  - spec/dummy/db/migrate/20160115192220_create_ecm_user_area_users.ecm_user_area.rb
505
520
  - spec/dummy/db/schema.rb
506
521
  - spec/dummy/lib/templates/erb/scaffold/_form.html.erb
507
- - spec/dummy/log/development.log
508
- - spec/dummy/log/test.log
509
522
  - spec/dummy/public/404.html
510
523
  - spec/dummy/public/422.html
511
524
  - spec/dummy/public/500.html
@@ -1034,7 +1047,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1034
1047
  version: '0'
1035
1048
  requirements: []
1036
1049
  rubyforge_project:
1037
- rubygems_version: 2.4.8
1050
+ rubygems_version: 2.6.11
1038
1051
  signing_key:
1039
1052
  specification_version: 4
1040
1053
  summary: ECM User Area.
@@ -1054,8 +1067,6 @@ test_files:
1054
1067
  - spec/dummy/public/404.html
1055
1068
  - spec/dummy/public/500.html
1056
1069
  - spec/dummy/public/favicon.ico
1057
- - spec/dummy/log/development.log
1058
- - spec/dummy/log/test.log
1059
1070
  - spec/dummy/Guardfile
1060
1071
  - spec/dummy/config.ru
1061
1072
  - spec/dummy/tmp/cache/assets/development/sprockets/v3.0/swT4m4l1Wi06EnJ1MEVGW0K0ghSvNw02bA117VCbp9w.cache
@@ -1597,4 +1608,3 @@ test_files:
1597
1608
  - spec/dummy/bin/rails
1598
1609
  - spec/dummy/bin/bundle
1599
1610
  - spec/dummy/bin/setup
1600
- has_rdoc: