sudo_mode 0.0.1 → 1.0.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.
data/README.md CHANGED
@@ -4,8 +4,32 @@ Sudo Mode helps you easily require a password confirmation before any controller
4
4
 
5
5
  This is inspired (heavily) by [Github's implementation](https://github.com/blog/1513-introducing-github-sudo-mode).
6
6
 
7
+ ## Installation
8
+
9
+ Add `sudo_mode` to your Gemfile:
10
+
11
+ ```ruby
12
+ gem "sudo_mode"
13
+ ```
14
+
15
+ And install:
16
+
17
+ ```bash
18
+ $ bundle install
19
+ ```
20
+
7
21
  ## Usage
8
22
 
23
+ ##### Mount the confirmation page in your routes
24
+ ```ruby
25
+ Foo::Application.routes.draw do
26
+ mount SudoMode::Engine => '/sudo' # You can replace '/sudo' with any other prefix
27
+
28
+ # ...
29
+ end
30
+ ```
31
+
32
+ ##### And pick a controller action to protect
9
33
  ```ruby
10
34
  class FooController
11
35
  require_password_confirmation_for :destroy
@@ -26,6 +50,7 @@ sudo_mode:
26
50
  new:
27
51
  confirmation_heading: "Confirm your Password"
28
52
  check_password_button: "Check"
53
+ warning_message: "Are you sure you want to delete this?"
29
54
  ```
30
55
 
31
56
  ## Limitations
@@ -33,7 +58,10 @@ sudo_mode:
33
58
  - Requires [`has_secure_password`](http://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html)
34
59
  - Requires `ApplicationController` to have a `current_user` method
35
60
  - Styling for the confirmation page is not taken care of
61
+ - All helper method calls in `application.html.erb` (and the partials it renders) must be explicitly called on `main_app`
36
62
 
37
63
  ## Credits
38
64
 
65
+ This gem was extracted from work on [ashoka-survey-web](http://github.com/nilenso/ashoka-survey-web).
66
+
39
67
  [![Nilenso](https://s3.amazonaws.com/nilenso/nilenso.png)](http://nilenso.com)
@@ -3,6 +3,7 @@
3
3
  </header>
4
4
 
5
5
  <div class="confirmation">
6
+ <p class="warning-message"><%= t(".warning_message") %></p>
6
7
  <%= form_tag @submit_path, :class => "confirmation-form", :method => @method do %>
7
8
  <div class="confirmation-fieldset">
8
9
  <%= label_tag :password, "Password", :class => "confirmation-label" %>
@@ -4,4 +4,5 @@ en:
4
4
  new:
5
5
  confirmation_heading: "Confirm your Password"
6
6
  check_password_button: "Authorize"
7
+ warning_message: "Are you sure you want to perform this action?"
7
8
 
@@ -1,3 +1,3 @@
1
1
  module SudoMode
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sudo_mode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-27 00:00:00.000000000 Z
13
+ date: 2013-07-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: -4507150748124203788
69
+ hash: -305159130120719749
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: -4507150748124203788
78
+ hash: -305159130120719749
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.23