caseadilla 0.0.5 → 0.0.6

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: 0b914dcdc7b9f58aa0b9c41ab59d63b5a369bd09
4
- data.tar.gz: a63d9a71eb406b8977d39992b8ff3e0dacae3c23
3
+ metadata.gz: 3556d4b0a771c289c2ec6a5ebab357a3168072e0
4
+ data.tar.gz: 95baff80f5a592febf62a24d023fc1ed637dcf10
5
5
  SHA512:
6
- metadata.gz: 9ff40348099a07a93080b9fbcbaead20a86764d457e61cfe785625d55c79ae9ce59f8c8f2ebb22a44d2b44334665d4d3f518b5947d9653fbaf0015574465d661
7
- data.tar.gz: 4902c54098be556e28ae6f514f273311596f097e3da34f17899712843eca4d37b4a643a0227f9a5bece7ad56191fb2f16448f652905e8ebdd48b6dd8836f63f2
6
+ metadata.gz: c869bc1bfd6ede6a25b7ca3a9444f17e4041813b6fd1333c7d3d1cb248b97625b841aa818360c223187611b50857c6f0fd2e45ccb9e2de3c3a5c7a483bd2deed
7
+ data.tar.gz: e7a9b05fe061ff40f0a62500f09063abeaeb6ee01136bb9f6c40e6a118d3457c52fc59d3656e985918802f47a39252c2bf9a1e0d23293423780c639a7b9addcb
@@ -51,6 +51,12 @@ module Caseadilla
51
51
  return
52
52
  end
53
53
  end
54
+
55
+ # This action not related to update_password action
56
+ def change_password
57
+ @caseadilla_user = User.find params[:id]
58
+ @caseadilla_page_title = "#{@caseadilla_user.first_name} #{@caseadilla_user.last_name} > Change password"
59
+ end
54
60
 
55
61
  def update_password
56
62
  @caseadilla_user = User.find params[:id]
@@ -111,7 +117,7 @@ module Caseadilla
111
117
  end
112
118
 
113
119
  def caseadilla_user_params
114
- params.require(:user).permit(:email, :first_name, :last_name, :time_zone, :role, :role_id, :password, :password_confirmation)
120
+ params.require(:user).permit(:email, :first_name, :last_name, :time_zone, :role, :role_id, :password, :password_confirmation, :current_password)
115
121
  end
116
122
 
117
123
  end
@@ -0,0 +1,30 @@
1
+ <h2>Change password for <%= @caseadilla_user.name.strip.empty? ? @caseadilla_user.email : @caseadilla_user.name %></h2>
2
+
3
+ <%= simple_form_for(@caseadilla_user, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+
5
+ <div class="row">
6
+ <div class="col-lg-6">
7
+ <%= caseadilla_password_field f, f.object, :password, {caseadilla_label: "New password"} %>
8
+ </div>
9
+ <div class="col-lg-6">
10
+ <%= caseadilla_password_field f, f.object, :password_confirmation, {caseadilla_label: "Confirm password"} %>
11
+ </div>
12
+ </div>
13
+
14
+ <div class="row">
15
+ <div class="col-lg-6">
16
+ <%= caseadilla_password_field f, f.object, :current_password, {caseadilla_label: "Current password"} %>
17
+ </div>
18
+ </div>
19
+
20
+ <p class="submits">
21
+ <%= link_to 'Cancel', :back, :class => 'btn btn-mini btn-danger' %>
22
+ <%= f.submit "Save changes", :class => "btn btn-mini btn-primary" %>
23
+ </p>
24
+ <% end %>
25
+
26
+ <%= content_for :sidebar do %>
27
+ <% if current_user #.is_admin? %>
28
+ <li><%= link_to "#{caseadilla_show_icon('circle-arrow-left')}Back".html_safe, :back %></li>
29
+ <% end %>
30
+ <% end %>
@@ -35,5 +35,8 @@
35
35
  <%= content_for :sidebar do %>
36
36
  <% if current_user #.is_admin? %>
37
37
  <li><%= link_to "#{caseadilla_show_icon('th-list')}Back to list".html_safe, caseadilla_users_path %></li>
38
+ <% if current_user == @caseadilla_user %>
39
+ <li><%= link_to "#{caseadilla_show_icon('pencil')}Change password".html_safe, change_password_caseadilla_user_path %></li>
40
+ <% end %>
38
41
  <% end %>
39
42
  <% end %>
data/config/routes.rb CHANGED
@@ -6,9 +6,10 @@ Rails.application.routes.draw do
6
6
 
7
7
  if Caseadilla::Engine.flavor = :steak
8
8
  resources :users do
9
- # member do
10
- # patch :update_password, :reset_password
11
- # end
9
+ member do
10
+ get :change_password
11
+ # patch :update_password, :reset_password
12
+ end
12
13
  end
13
14
  resources :roles
14
15
 
@@ -1,3 +1,3 @@
1
1
  module Caseadilla
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -105,7 +105,7 @@ module Caseadilla
105
105
  inject_into_file 'config/authorization_rules.rb', after: "authorization do\n" do <<-'RUBY'
106
106
 
107
107
  role :admin do
108
- has_permission_on :caseadilla_users, to: :manage
108
+ has_permission_on :caseadilla_users, to: [:manage, :change_password]
109
109
  has_permission_on :caseadilla_roles, to: :manage
110
110
  end
111
111
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caseadilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Bick
@@ -172,6 +172,7 @@ files:
172
172
  - app/views/caseadilla/roles/index.html.erb
173
173
  - app/views/caseadilla/roles/new.html.erb
174
174
  - app/views/caseadilla/roles/show.html.erb
175
+ - app/views/caseadilla/users/change_password.html.erb
175
176
  - app/views/caseadilla/users/index.html.erb
176
177
  - app/views/caseadilla/users/new.html.erb
177
178
  - app/views/caseadilla/users/show.html.erb