devisable 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/devisable.gemspec +5 -3
- data/lib/generators/devisable/devisable_generator.rb +11 -3
- data/lib/generators/devisable/templates/partials/_permission_manage_jquery.js +21 -0
- data/lib/generators/devisable/templates/partials/_permission_manage_prototype.js +22 -0
- data/pkg/devisable-0.1.3.gem +0 -0
- metadata +6 -4
- data/lib/generators/devisable/templates/partials/_permission_manage.js +0 -18
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/devisable.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{devisable}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Scott Sampson", "Jeremiah Hemphill"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-18}
|
13
13
|
s.description = %q{Generates initial code for a devise install. Gives the options for oauth, using cancan, and creating a user tool to manage the users.}
|
14
14
|
s.email = %q{scott@cloudspace.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -68,7 +68,8 @@ Gem::Specification.new do |s|
|
|
68
68
|
"lib/generators/devisable/templates/partials/_migration_up.rb",
|
69
69
|
"lib/generators/devisable/templates/partials/_oauth_user_table_fields.erb",
|
70
70
|
"lib/generators/devisable/templates/partials/_permission_equals.rb",
|
71
|
-
"lib/generators/devisable/templates/partials/
|
71
|
+
"lib/generators/devisable/templates/partials/_permission_manage_jquery.js",
|
72
|
+
"lib/generators/devisable/templates/partials/_permission_manage_prototype.js",
|
72
73
|
"lib/generators/devisable/templates/partials/_role_permission.rb",
|
73
74
|
"lib/generators/devisable/templates/partials/_roles_index_delete.erb",
|
74
75
|
"lib/generators/devisable/templates/partials/_user_model_methods.erb",
|
@@ -81,6 +82,7 @@ Gem::Specification.new do |s|
|
|
81
82
|
"pkg/devisable-0.1.0.gem",
|
82
83
|
"pkg/devisable-0.1.1.gem",
|
83
84
|
"pkg/devisable-0.1.2.gem",
|
85
|
+
"pkg/devisable-0.1.3.gem",
|
84
86
|
"pkg/devise_generator-0.1.0.gem",
|
85
87
|
"test/helper.rb",
|
86
88
|
"test/test_devise_generator.rb"
|
@@ -29,7 +29,8 @@ class DevisableGenerator < Rails::Generators::Base
|
|
29
29
|
'extra' => [],
|
30
30
|
'new' => false,
|
31
31
|
'sudo' => false,
|
32
|
-
'url' => 'http://localhost:3000'
|
32
|
+
'url' => 'http://localhost:3000',
|
33
|
+
'jslibrary' => ''
|
33
34
|
}
|
34
35
|
|
35
36
|
|
@@ -91,6 +92,13 @@ class DevisableGenerator < Rails::Generators::Base
|
|
91
92
|
opts.on("-C", "--cucumber [string]", String, "Include cucumber tests") do |v|
|
92
93
|
@@actual_configuration_options['cucumber'] = true
|
93
94
|
end
|
95
|
+
opts.on("-j", "--jslibrary (jquery|prototype)", String, "write out using the jquery or prototype libraries") do |j|
|
96
|
+
if j =~ /jquery/i
|
97
|
+
@@actual_configuration_options['jslibrary'] = 'jquery'
|
98
|
+
elsif j =~ /prototype/i
|
99
|
+
@@actual_configuration_options['jslibrary'] = 'prototype'
|
100
|
+
end
|
101
|
+
end
|
94
102
|
end.parse!
|
95
103
|
execute
|
96
104
|
end
|
@@ -100,7 +108,7 @@ class DevisableGenerator < Rails::Generators::Base
|
|
100
108
|
def throw_error(error = '')
|
101
109
|
puts error
|
102
110
|
exit();
|
103
|
-
end
|
111
|
+
end
|
104
112
|
|
105
113
|
#replaces the last string 'end' in a file with the value of rep_str
|
106
114
|
#
|
@@ -400,7 +408,7 @@ class DevisableGenerator < Rails::Generators::Base
|
|
400
408
|
|
401
409
|
#adds the javascript for the role permissions checkboxes
|
402
410
|
def add_javascript
|
403
|
-
rep_str = load_erb_string('partials/
|
411
|
+
rep_str = load_erb_string('partials/_permission_manage_' + @@actual_configuration_options['jslibrary'] + '.js')
|
404
412
|
append_to_file "public/javascripts/application.js", rep_str
|
405
413
|
end
|
406
414
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/*
|
2
|
+
* Devisable -- Permissions Edit-Add Form
|
3
|
+
* route: /roles/:id/edit
|
4
|
+
*/
|
5
|
+
$(document).ready(function() {
|
6
|
+
function use_permission_clicked(obj) {
|
7
|
+
var controller = $(obj).attr('id').split('_')[1]
|
8
|
+
var disabled_val = $(obj).is(':checked')
|
9
|
+
$('#permission_' + controller + '_read').attr('disabled',disabled_val)
|
10
|
+
$('#permission_' + controller + '_create').attr('disabled',disabled_val)
|
11
|
+
$('#permission_' + controller + '_update').attr('disabled',disabled_val)
|
12
|
+
$('#permission_' + controller + '_destroy').attr('disabled',disabled_val)
|
13
|
+
}
|
14
|
+
|
15
|
+
$('.permission_manage').each(function(ind,pm) {
|
16
|
+
$('.permission_manage').click(function() {
|
17
|
+
use_permission_clicked($(this))
|
18
|
+
})
|
19
|
+
use_permission_clicked(pm)
|
20
|
+
})
|
21
|
+
})
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/*
|
2
|
+
* Devisable -- Permissions Edit-Add Form
|
3
|
+
* route: /roles/:id/edit
|
4
|
+
*/
|
5
|
+
document.observe("dom:loaded", function() {
|
6
|
+
$$('.permission_manage').each(function(pm) {
|
7
|
+
pm.observe('click', function(event) {
|
8
|
+
use_permission_clicked(event.element())
|
9
|
+
});
|
10
|
+
use_permission_clicked(pm)
|
11
|
+
});
|
12
|
+
|
13
|
+
function use_permission_clicked(obj) {
|
14
|
+
var controller = obj.id.split('_')[1]
|
15
|
+
var disabled_val = obj.checked ? 'disabled' : false;
|
16
|
+
$('permission_' + controller + '_read').disabled = disabled_val;
|
17
|
+
$('permission_' + controller + '_create').disabled = disabled_val;
|
18
|
+
$('permission_' + controller + '_update').disabled = disabled_val;
|
19
|
+
$('permission_' + controller + '_destroy').disabled = disabled_val;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
|
Binary file
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: devisable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Scott Sampson
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-08-
|
14
|
+
date: 2011-08-18 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -119,7 +119,8 @@ files:
|
|
119
119
|
- lib/generators/devisable/templates/partials/_migration_up.rb
|
120
120
|
- lib/generators/devisable/templates/partials/_oauth_user_table_fields.erb
|
121
121
|
- lib/generators/devisable/templates/partials/_permission_equals.rb
|
122
|
-
- lib/generators/devisable/templates/partials/
|
122
|
+
- lib/generators/devisable/templates/partials/_permission_manage_jquery.js
|
123
|
+
- lib/generators/devisable/templates/partials/_permission_manage_prototype.js
|
123
124
|
- lib/generators/devisable/templates/partials/_role_permission.rb
|
124
125
|
- lib/generators/devisable/templates/partials/_roles_index_delete.erb
|
125
126
|
- lib/generators/devisable/templates/partials/_user_model_methods.erb
|
@@ -132,6 +133,7 @@ files:
|
|
132
133
|
- pkg/devisable-0.1.0.gem
|
133
134
|
- pkg/devisable-0.1.1.gem
|
134
135
|
- pkg/devisable-0.1.2.gem
|
136
|
+
- pkg/devisable-0.1.3.gem
|
135
137
|
- pkg/devise_generator-0.1.0.gem
|
136
138
|
- test/helper.rb
|
137
139
|
- test/test_devise_generator.rb
|
@@ -149,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
151
|
requirements:
|
150
152
|
- - ">="
|
151
153
|
- !ruby/object:Gem::Version
|
152
|
-
hash:
|
154
|
+
hash: 839733348115812984
|
153
155
|
segments:
|
154
156
|
- 0
|
155
157
|
version: "0"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
document.observe("dom:loaded", function() {
|
2
|
-
$$('.permission_manage').each(function(pm) {
|
3
|
-
pm.observe('click', function(event) {
|
4
|
-
use_permission_clicked(event.element())
|
5
|
-
});
|
6
|
-
use_permission_clicked(pm)
|
7
|
-
});
|
8
|
-
|
9
|
-
function use_permission_clicked(obj) {
|
10
|
-
var controller = obj.id.split('_')[1]
|
11
|
-
var disabled_val = obj.checked ? 'disabled' : false;
|
12
|
-
$('permission_' + controller + '_read').disabled = disabled_val;
|
13
|
-
$('permission_' + controller + '_create').disabled = disabled_val;
|
14
|
-
$('permission_' + controller + '_update').disabled = disabled_val;
|
15
|
-
$('permission_' + controller + '_destroy').disabled = disabled_val;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
|