simple_roles 0.0.5
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/.rspec +1 -0
- data/Gemfile +22 -0
- data/MIT-LICENSE +20 -0
- data/README.md +81 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/app/assets/images/simple_roles/.gitkeep +0 -0
- data/app/assets/javascripts/simple_roles/.gitkeep +0 -0
- data/app/assets/stylesheets/simple_roles/.gitkeep +0 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/helpers/.gitkeep +0 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/role.rb +4 -0
- data/app/models/user_role.rb +4 -0
- data/app/views/.gitkeep +0 -0
- data/config/routes.rb +2 -0
- data/db/migrate/001_create_user_roles.rb +15 -0
- data/db/migrate/002_create_roles.rb +22 -0
- data/lib/simple_roles/base.rb +111 -0
- data/lib/simple_roles/configuration.rb +33 -0
- data/lib/simple_roles/engine.rb +4 -0
- data/lib/simple_roles/macros.rb +13 -0
- data/lib/simple_roles/roles_array.rb +63 -0
- data/lib/simple_roles/version.rb +3 -0
- data/lib/simple_roles.rb +19 -0
- data/lib/tasks/simple_roles_tasks.rake +4 -0
- data/script/rails +6 -0
- data/simple_roles.gemspec +196 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/default.js +2 -0
- data/spec/dummy/app/assets/javascripts/jquery.js +16 -0
- data/spec/dummy/app/assets/javascripts/jquery_ujs.js +169 -0
- data/spec/dummy/app/assets/javascripts/posts.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/assets/stylesheets/default.css +4 -0
- data/spec/dummy/app/assets/stylesheets/posts.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/default_controller.rb +5 -0
- data/spec/dummy/app/controllers/posts_controller.rb +83 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/default_helper.rb +2 -0
- data/spec/dummy/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/models/user.rb +15 -0
- data/spec/dummy/app/views/default/index.html.erb +4 -0
- data/spec/dummy/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/dummy/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/dummy/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/dummy/app/views/devise/registrations/edit.html.erb +25 -0
- data/spec/dummy/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/dummy/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/dummy/app/views/devise/shared/_links.erb +25 -0
- data/spec/dummy/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/posts/_form.html.erb +17 -0
- data/spec/dummy/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/posts/index.html.erb +21 -0
- data/spec/dummy/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/views/posts/show.html.erb +5 -0
- data/spec/dummy/config/application.rb +51 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +26 -0
- data/spec/dummy/config/database_mysql.yml +29 -0
- data/spec/dummy/config/database_pgsql.yml +35 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +24 -0
- data/spec/dummy/config/environments/production.rb +52 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +204 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/simple_roles.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/devise.en.yml +53 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +13 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/010_devise_create_users.rb +29 -0
- data/spec/dummy/db/migrate/20110925210726_create_user_roles.rb +15 -0
- data/spec/dummy/db/migrate/20110925210727_create_roles.rb +22 -0
- data/spec/dummy/db/schema.rb +51 -0
- data/spec/dummy/db/seeds.rb +14 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/test/fixtures/posts.yml +11 -0
- data/spec/dummy/test/fixtures/users.yml +11 -0
- data/spec/dummy/test/functional/default_controller_test.rb +9 -0
- data/spec/dummy/test/functional/posts_controller_test.rb +49 -0
- data/spec/dummy/test/unit/helpers/default_helper_test.rb +4 -0
- data/spec/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/spec/dummy/test/unit/post_test.rb +7 -0
- data/spec/dummy/test/unit/user_test.rb +7 -0
- data/spec/dummy_spec_helper.rb +41 -0
- data/spec/integration/main_spec.rb +7 -0
- data/spec/integration/messages_spec.rb +62 -0
- data/spec/integration/requests/main_spec.rb +21 -0
- data/spec/simple_roles/base_spec.rb +191 -0
- data/spec/simple_roles/macros_spec.rb +25 -0
- data/spec/spec_helper.rb +52 -0
- data/spec/support/aliases.rb +0 -0
- data/spec/support/controller_macros.rb +26 -0
- data/spec/support/database.yml +6 -0
- data/spec/support/factories.rb +22 -0
- data/spec/support/fixtures/models/.gitkeep +0 -0
- data/spec/support/fixtures/models/user.rb +3 -0
- data/spec/support/migrations/010_create_users.rb +14 -0
- data/spec/support/rspec_helpers.rb +22 -0
- metadata +320 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unobtrusive scripting adapter for jQuery
|
|
3
|
+
*
|
|
4
|
+
* Requires jQuery 1.4.3 or later.
|
|
5
|
+
* https://github.com/rails/jquery-ujs
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
(function($) {
|
|
9
|
+
// Make sure that every Ajax request sends the CSRF token
|
|
10
|
+
function CSRFProtection(fn) {
|
|
11
|
+
var token = $('meta[name="csrf-token"]').attr('content');
|
|
12
|
+
if (token) fn(function(xhr) { xhr.setRequestHeader('X-CSRF-Token', token) });
|
|
13
|
+
}
|
|
14
|
+
if ($().jquery == '1.5') { // gruesome hack
|
|
15
|
+
var factory = $.ajaxSettings.xhr;
|
|
16
|
+
$.ajaxSettings.xhr = function() {
|
|
17
|
+
var xhr = factory();
|
|
18
|
+
CSRFProtection(function(setHeader) {
|
|
19
|
+
var open = xhr.open;
|
|
20
|
+
xhr.open = function() { open.apply(this, arguments); setHeader(this) };
|
|
21
|
+
});
|
|
22
|
+
return xhr;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
else $(document).ajaxSend(function(e, xhr) {
|
|
26
|
+
CSRFProtection(function(setHeader) { setHeader(xhr) });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Triggers an event on an element and returns the event result
|
|
30
|
+
function fire(obj, name, data) {
|
|
31
|
+
var event = new $.Event(name);
|
|
32
|
+
obj.trigger(event, data);
|
|
33
|
+
return event.result !== false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Submits "remote" forms and links with ajax
|
|
37
|
+
function handleRemote(element) {
|
|
38
|
+
var method, url, data,
|
|
39
|
+
dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
|
40
|
+
|
|
41
|
+
if (element.is('form')) {
|
|
42
|
+
method = element.attr('method');
|
|
43
|
+
url = element.attr('action');
|
|
44
|
+
data = element.serializeArray();
|
|
45
|
+
// memoized value from clicked submit button
|
|
46
|
+
var button = element.data('ujs:submit-button');
|
|
47
|
+
if (button) {
|
|
48
|
+
data.push(button);
|
|
49
|
+
element.data('ujs:submit-button', null);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
method = element.attr('data-method');
|
|
53
|
+
url = element.attr('href');
|
|
54
|
+
data = null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
$.ajax({
|
|
58
|
+
url: url, type: method || 'GET', data: data, dataType: dataType,
|
|
59
|
+
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
|
60
|
+
beforeSend: function(xhr, settings) {
|
|
61
|
+
if (settings.dataType === undefined) {
|
|
62
|
+
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
|
63
|
+
}
|
|
64
|
+
return fire(element, 'ajax:beforeSend', [xhr, settings]);
|
|
65
|
+
},
|
|
66
|
+
success: function(data, status, xhr) {
|
|
67
|
+
element.trigger('ajax:success', [data, status, xhr]);
|
|
68
|
+
},
|
|
69
|
+
complete: function(xhr, status) {
|
|
70
|
+
element.trigger('ajax:complete', [xhr, status]);
|
|
71
|
+
},
|
|
72
|
+
error: function(xhr, status, error) {
|
|
73
|
+
element.trigger('ajax:error', [xhr, status, error]);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Handles "data-method" on links such as:
|
|
79
|
+
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
|
80
|
+
function handleMethod(link) {
|
|
81
|
+
var href = link.attr('href'),
|
|
82
|
+
method = link.attr('data-method'),
|
|
83
|
+
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
|
84
|
+
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
|
85
|
+
form = $('<form method="post" action="' + href + '"></form>'),
|
|
86
|
+
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
|
87
|
+
|
|
88
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
|
89
|
+
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
form.hide().append(metadata_input).appendTo('body');
|
|
93
|
+
form.submit();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function disableFormElements(form) {
|
|
97
|
+
form.find('input[data-disable-with]').each(function() {
|
|
98
|
+
var input = $(this);
|
|
99
|
+
input.data('ujs:enable-with', input.val())
|
|
100
|
+
.val(input.attr('data-disable-with'))
|
|
101
|
+
.attr('disabled', 'disabled');
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function enableFormElements(form) {
|
|
106
|
+
form.find('input[data-disable-with]').each(function() {
|
|
107
|
+
var input = $(this);
|
|
108
|
+
input.val(input.data('ujs:enable-with')).removeAttr('disabled');
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function allowAction(element) {
|
|
113
|
+
var message = element.attr('data-confirm');
|
|
114
|
+
return !message || (fire(element, 'confirm') && confirm(message));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function requiredValuesMissing(form) {
|
|
118
|
+
var missing = false;
|
|
119
|
+
form.find('input[name][required]').each(function() {
|
|
120
|
+
if (!$(this).val()) missing = true;
|
|
121
|
+
});
|
|
122
|
+
return missing;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
|
|
126
|
+
var link = $(this);
|
|
127
|
+
if (!allowAction(link)) return false;
|
|
128
|
+
|
|
129
|
+
if (link.attr('data-remote') != undefined) {
|
|
130
|
+
handleRemote(link);
|
|
131
|
+
return false;
|
|
132
|
+
} else if (link.attr('data-method')) {
|
|
133
|
+
handleMethod(link);
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
$('form').live('submit.rails', function(e) {
|
|
139
|
+
var form = $(this), remote = form.attr('data-remote') != undefined;
|
|
140
|
+
if (!allowAction(form)) return false;
|
|
141
|
+
|
|
142
|
+
// skip other logic when required values are missing
|
|
143
|
+
if (requiredValuesMissing(form)) return !remote;
|
|
144
|
+
|
|
145
|
+
if (remote) {
|
|
146
|
+
handleRemote(form);
|
|
147
|
+
return false;
|
|
148
|
+
} else {
|
|
149
|
+
// slight timeout so that the submit button gets properly serialized
|
|
150
|
+
setTimeout(function(){ disableFormElements(form) }, 13);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
$('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
|
|
155
|
+
var button = $(this);
|
|
156
|
+
if (!allowAction(button)) return false;
|
|
157
|
+
// register the pressed submit button
|
|
158
|
+
var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
|
|
159
|
+
button.closest('form').data('ujs:submit-button', data);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
$('form').live('ajax:beforeSend.rails', function(event) {
|
|
163
|
+
if (this == event.target) disableFormElements($(this));
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
$('form').live('ajax:complete.rails', function(event) {
|
|
167
|
+
if (this == event.target) enableFormElements($(this));
|
|
168
|
+
});
|
|
169
|
+
})( jQuery );
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
|
5
|
+
*= require_self
|
|
6
|
+
*= require_tree .
|
|
7
|
+
*/
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
|
2
|
+
|
|
3
|
+
body, p, ol, ul, td {
|
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
|
5
|
+
font-size: 13px;
|
|
6
|
+
line-height: 18px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pre {
|
|
10
|
+
background-color: #eee;
|
|
11
|
+
padding: 10px;
|
|
12
|
+
font-size: 11px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
a { color: #000; }
|
|
16
|
+
a:visited { color: #666; }
|
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
|
18
|
+
|
|
19
|
+
div.field, div.actions {
|
|
20
|
+
margin-bottom: 10px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#notice {
|
|
24
|
+
color: green;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.field_with_errors {
|
|
28
|
+
padding: 2px;
|
|
29
|
+
background-color: red;
|
|
30
|
+
display: table;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#error_explanation {
|
|
34
|
+
width: 450px;
|
|
35
|
+
border: 2px solid red;
|
|
36
|
+
padding: 7px;
|
|
37
|
+
padding-bottom: 0;
|
|
38
|
+
margin-bottom: 20px;
|
|
39
|
+
background-color: #f0f0f0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#error_explanation h2 {
|
|
43
|
+
text-align: left;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
padding: 5px 5px 5px 15px;
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
margin: -7px;
|
|
48
|
+
margin-bottom: 0px;
|
|
49
|
+
background-color: #c00;
|
|
50
|
+
color: #fff;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#error_explanation ul li {
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
list-style: square;
|
|
56
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
class PostsController < ApplicationController
|
|
2
|
+
# GET /posts
|
|
3
|
+
# GET /posts.json
|
|
4
|
+
def index
|
|
5
|
+
@posts = Post.all
|
|
6
|
+
|
|
7
|
+
respond_to do |format|
|
|
8
|
+
format.html # index.html.erb
|
|
9
|
+
format.json { render json: @posts }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /posts/1
|
|
14
|
+
# GET /posts/1.json
|
|
15
|
+
def show
|
|
16
|
+
@post = Post.find(params[:id])
|
|
17
|
+
|
|
18
|
+
respond_to do |format|
|
|
19
|
+
format.html # show.html.erb
|
|
20
|
+
format.json { render json: @post }
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# GET /posts/new
|
|
25
|
+
# GET /posts/new.json
|
|
26
|
+
def new
|
|
27
|
+
@post = Post.new
|
|
28
|
+
|
|
29
|
+
respond_to do |format|
|
|
30
|
+
format.html # new.html.erb
|
|
31
|
+
format.json { render json: @post }
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# GET /posts/1/edit
|
|
36
|
+
def edit
|
|
37
|
+
@post = Post.find(params[:id])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# POST /posts
|
|
41
|
+
# POST /posts.json
|
|
42
|
+
def create
|
|
43
|
+
@post = Post.new(params[:post])
|
|
44
|
+
|
|
45
|
+
respond_to do |format|
|
|
46
|
+
if @post.save
|
|
47
|
+
format.html { redirect_to @post, notice: 'Post was successfully created.' }
|
|
48
|
+
format.json { render json: @post, status: :created, location: @post }
|
|
49
|
+
else
|
|
50
|
+
format.html { render action: "new" }
|
|
51
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# PUT /posts/1
|
|
57
|
+
# PUT /posts/1.json
|
|
58
|
+
def update
|
|
59
|
+
@post = Post.find(params[:id])
|
|
60
|
+
|
|
61
|
+
respond_to do |format|
|
|
62
|
+
if @post.update_attributes(params[:post])
|
|
63
|
+
format.html { redirect_to @post, notice: 'Post was successfully updated.' }
|
|
64
|
+
format.json { head :ok }
|
|
65
|
+
else
|
|
66
|
+
format.html { render action: "edit" }
|
|
67
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# DELETE /posts/1
|
|
73
|
+
# DELETE /posts/1.json
|
|
74
|
+
def destroy
|
|
75
|
+
@post = Post.find(params[:id])
|
|
76
|
+
@post.destroy
|
|
77
|
+
|
|
78
|
+
respond_to do |format|
|
|
79
|
+
format.html { redirect_to posts_url }
|
|
80
|
+
format.json { head :ok }
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class User < ActiveRecord::Base
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
simple_roles
|
|
5
|
+
|
|
6
|
+
devise :database_authenticatable, :registerable,
|
|
7
|
+
:recoverable, :rememberable, :trackable, :validatable
|
|
8
|
+
|
|
9
|
+
# Setup accessible (or protected) attributes for your model
|
|
10
|
+
# DEVISE
|
|
11
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me
|
|
12
|
+
|
|
13
|
+
# OTHER
|
|
14
|
+
attr_accessible :name, :username
|
|
15
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
|
2
|
+
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
|
4
|
+
<%= devise_error_messages! %>
|
|
5
|
+
|
|
6
|
+
<p><%= f.label :email %><br />
|
|
7
|
+
<%= f.email_field :email %></p>
|
|
8
|
+
|
|
9
|
+
<p><%= f.submit "Resend confirmation instructions" %></p>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<%= render :partial => "devise/shared/links" %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
|
2
|
+
|
|
3
|
+
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
|
4
|
+
|
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
|
6
|
+
|
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
|
2
|
+
|
|
3
|
+
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
|
|
4
|
+
|
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
|
6
|
+
|
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<h2>Change your password</h2>
|
|
2
|
+
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
|
|
4
|
+
<%= devise_error_messages! %>
|
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
|
6
|
+
|
|
7
|
+
<p><%= f.label :password, "New password" %><br />
|
|
8
|
+
<%= f.password_field :password %></p>
|
|
9
|
+
|
|
10
|
+
<p><%= f.label :password_confirmation, "Confirm new password" %><br />
|
|
11
|
+
<%= f.password_field :password_confirmation %></p>
|
|
12
|
+
|
|
13
|
+
<p><%= f.submit "Change my password" %></p>
|
|
14
|
+
<% end %>
|
|
15
|
+
|
|
16
|
+
<%= render :partial => "devise/shared/links" %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<h2>Forgot your password?</h2>
|
|
2
|
+
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
|
|
4
|
+
<%= devise_error_messages! %>
|
|
5
|
+
|
|
6
|
+
<p><%= f.label :email %><br />
|
|
7
|
+
<%= f.email_field :email %></p>
|
|
8
|
+
|
|
9
|
+
<p><%= f.submit "Send me reset password instructions" %></p>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<%= render :partial => "devise/shared/links" %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
|
2
|
+
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
|
4
|
+
<%= devise_error_messages! %>
|
|
5
|
+
|
|
6
|
+
<p><%= f.label :email %><br />
|
|
7
|
+
<%= f.email_field :email %></p>
|
|
8
|
+
|
|
9
|
+
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
|
10
|
+
<%= f.password_field :password %></p>
|
|
11
|
+
|
|
12
|
+
<p><%= f.label :password_confirmation %><br />
|
|
13
|
+
<%= f.password_field :password_confirmation %></p>
|
|
14
|
+
|
|
15
|
+
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
|
16
|
+
<%= f.password_field :current_password %></p>
|
|
17
|
+
|
|
18
|
+
<p><%= f.submit "Update" %></p>
|
|
19
|
+
<% end %>
|
|
20
|
+
|
|
21
|
+
<h3>Cancel my account</h3>
|
|
22
|
+
|
|
23
|
+
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
|
24
|
+
|
|
25
|
+
<%= link_to "Back", :back %>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<h2>Sign up</h2>
|
|
2
|
+
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
|
4
|
+
<%= devise_error_messages! %>
|
|
5
|
+
|
|
6
|
+
<p><%= f.label :email %><br />
|
|
7
|
+
<%= f.email_field :email %></p>
|
|
8
|
+
|
|
9
|
+
<p><%= f.label :password %><br />
|
|
10
|
+
<%= f.password_field :password %></p>
|
|
11
|
+
|
|
12
|
+
<p><%= f.label :password_confirmation %><br />
|
|
13
|
+
<%= f.password_field :password_confirmation %></p>
|
|
14
|
+
|
|
15
|
+
<p><%= f.submit "Sign up" %></p>
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
<%= render :partial => "devise/shared/links" %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<h2>Sign in</h2>
|
|
2
|
+
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
|
4
|
+
<p><%= f.label :email %><br />
|
|
5
|
+
<%= f.email_field :email %></p>
|
|
6
|
+
|
|
7
|
+
<p><%= f.label :password %><br />
|
|
8
|
+
<%= f.password_field :password %></p>
|
|
9
|
+
|
|
10
|
+
<% if devise_mapping.rememberable? -%>
|
|
11
|
+
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
|
|
12
|
+
<% end -%>
|
|
13
|
+
|
|
14
|
+
<p><%= f.submit "Sign in" %></p>
|
|
15
|
+
<% end %>
|
|
16
|
+
|
|
17
|
+
<%= render :partial => "devise/shared/links" %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
|
2
|
+
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
|
3
|
+
<% end -%>
|
|
4
|
+
|
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
|
6
|
+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
|
7
|
+
<% end -%>
|
|
8
|
+
|
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
|
10
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
|
11
|
+
<% end -%>
|
|
12
|
+
|
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
|
15
|
+
<% end -%>
|
|
16
|
+
|
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
|
19
|
+
<% end -%>
|
|
20
|
+
|
|
21
|
+
<%- if devise_mapping.omniauthable? %>
|
|
22
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
|
23
|
+
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
|
24
|
+
<% end -%>
|
|
25
|
+
<% end -%>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<h2>Resend unlock instructions</h2>
|
|
2
|
+
|
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
|
|
4
|
+
<%= devise_error_messages! %>
|
|
5
|
+
|
|
6
|
+
<p><%= f.label :email %><br />
|
|
7
|
+
<%= f.email_field :email %></p>
|
|
8
|
+
|
|
9
|
+
<p><%= f.submit "Resend unlock instructions" %></p>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<%= render :partial => "devise/shared/links" %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</title>
|
|
5
|
+
<%= stylesheet_link_tag "application" %>
|
|
6
|
+
<%= javascript_include_tag "application" %>
|
|
7
|
+
<%= csrf_meta_tags %>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<%= yield %>
|
|
12
|
+
|
|
13
|
+
<%= link_to 'Sign out', destroy_user_session_path, :method => :delete %>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%= form_for(@post) do |f| %>
|
|
2
|
+
<% if @post.errors.any? %>
|
|
3
|
+
<div id="error_explanation">
|
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
|
8
|
+
<li><%= msg %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div class="actions">
|
|
15
|
+
<%= f.submit %>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<h1>Listing posts</h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
<th></th>
|
|
6
|
+
<th></th>
|
|
7
|
+
<th></th>
|
|
8
|
+
</tr>
|
|
9
|
+
|
|
10
|
+
<% @posts.each do |post| %>
|
|
11
|
+
<tr>
|
|
12
|
+
<td><%= link_to 'Show', post %></td>
|
|
13
|
+
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
|
14
|
+
<td><%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %></td>
|
|
15
|
+
</tr>
|
|
16
|
+
<% end %>
|
|
17
|
+
</table>
|
|
18
|
+
|
|
19
|
+
<br />
|
|
20
|
+
|
|
21
|
+
<%= link_to 'New Post', new_post_path %>
|