tb_core 1.4.beta1 → 1.4.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -8
- data/app/assets/javascripts/tb_core/remote.js +4 -4
- data/lib/generators/spud/module_generator.rb +6 -2
- data/lib/spud_core/engine.rb +1 -0
- data/lib/spud_core/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3e651f6ff813c429d0d61895739a668b1962417
|
4
|
+
data.tar.gz: 9d4675ce88f2341883c9e07634f8896ff0b871e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fbe679221366bfeb8aa9050fc32ff06922ee0e394c1c0be637bd9da5cf424d7ea8947e1ba2b075b1c61b3931249f18fad04a60056e435565fe712f9e5a80a3e
|
7
|
+
data.tar.gz: 20240e4966b8ac2446d36629b60a8b01b641493d01bec75b81c5699bae3332c10ea2acce680392049ee19bfb22be712f0d440add299517f9b779b2eb9a277753
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://semaphoreci.com/api/v1/moser-it/tb_core/branches/dev/shields_badge.svg)](https://semaphoreci.com/moser-it/tb_core)
|
2
|
+
|
1
3
|
Twice Baked Core
|
2
4
|
================
|
3
5
|
|
@@ -37,7 +39,7 @@ The `spud:setup` generator takes care of a few tasks for you. If you missed that
|
|
37
39
|
Configuration
|
38
40
|
-------------
|
39
41
|
|
40
|
-
The core engine provides various configuration options.
|
42
|
+
The core engine provides various configuration options.
|
41
43
|
|
42
44
|
Spud::Core.configure do |config|
|
43
45
|
config.option = value
|
@@ -71,7 +73,7 @@ Then, add your module to the `Spud::Core.config.admin_applications` array. We re
|
|
71
73
|
:name => "Clients",
|
72
74
|
:thumbnail => "spud/admin/clients.png",
|
73
75
|
:url => "/admin/clients",
|
74
|
-
# Optional:
|
76
|
+
# Optional:
|
75
77
|
:badge => ->(user){ Client.where(:is_pending => true).count() }
|
76
78
|
}]
|
77
79
|
|
@@ -96,7 +98,7 @@ Create a file in your app at `app/models/spud_user.rb`, and build a class called
|
|
96
98
|
|
97
99
|
### Adding fields to the add/edit user form
|
98
100
|
|
99
|
-
Create a file in your app at `app/views/admin/users/_form_additions.html.erb`.
|
101
|
+
Create a file in your app at `app/views/admin/users/_form_additions.html.erb`.
|
100
102
|
|
101
103
|
<div class="control-group">
|
102
104
|
<%= f.label :avatar, :class=>"control-label"%>
|
@@ -107,7 +109,7 @@ Create a file in your app at `app/views/admin/users/_form_additions.html.erb`.
|
|
107
109
|
|
108
110
|
### Adding fields to the user show action
|
109
111
|
|
110
|
-
Create a file in your app at `app/views/admin/users/_show_additions.html.erb`.
|
112
|
+
Create a file in your app at `app/views/admin/users/_show_additions.html.erb`.
|
111
113
|
|
112
114
|
<% if @user.avatar_file_name %>
|
113
115
|
<dt>Avatar</dt>
|
@@ -204,8 +206,8 @@ Checking permissions is easy. Each permission has a `tag` which is a unique, nam
|
|
204
206
|
|
205
207
|
Permissions are created one of two ways:
|
206
208
|
|
207
|
-
1. Every dashboard app automatically generates a "Full Access" permission, with a tag of `admin.(app name).full_access`.
|
208
|
-
2. You as the developer may append custom permissions to the `Spud::Core.permissions` array.
|
209
|
+
1. Every dashboard app automatically generates a "Full Access" permission, with a tag of `admin.(app name).full_access`.
|
210
|
+
2. You as the developer may append custom permissions to the `Spud::Core.permissions` array.
|
209
211
|
|
210
212
|
Create custom permissions whenever you need to permit an action that falls outside of the standard "full access to an app" use case; For example, turning on/off the ability for a user to upload an avatar.
|
211
213
|
|
@@ -218,7 +220,7 @@ Create custom permissions whenever you need to permit an action that falls outsi
|
|
218
220
|
<%= link_to 'Upload Avatar', upload_avatar_path %>
|
219
221
|
<% end %>
|
220
222
|
|
221
|
-
Finally, custom permissions may optionally be tied to one or more dashboard apps. A user who has the permission shown below would have access to the the Clients and Projects dashboard apps. After that is is up to you to code your view and controller logic in accorance to what permissions the user has.
|
223
|
+
Finally, custom permissions may optionally be tied to one or more dashboard apps. A user who has the permission shown below would have access to the the Clients and Projects dashboard apps. After that is is up to you to code your view and controller logic in accorance to what permissions the user has.
|
222
224
|
|
223
225
|
// application.rb
|
224
226
|
Spud::Core.permissions += [{
|
@@ -233,7 +235,7 @@ Testing
|
|
233
235
|
Twice Baked uses RSpec for testing. Get the tests running with a few short commands:
|
234
236
|
|
235
237
|
1. Create and migrate the databases:
|
236
|
-
|
238
|
+
|
237
239
|
rake db:create
|
238
240
|
rake db:migrate
|
239
241
|
|
@@ -99,10 +99,10 @@ var onRemoteFormErrors = function(event, jqXHR, textStatus, errorThrown){
|
|
99
99
|
var errorType = $form.data('errors');
|
100
100
|
if(jqXHR.status == 422){
|
101
101
|
if(errorType == 'inline'){
|
102
|
-
displayErrorsInline($form, jqXHR.responseJSON);
|
102
|
+
tb.remote.displayErrorsInline($form, jqXHR.responseJSON);
|
103
103
|
}
|
104
104
|
else{
|
105
|
-
displayErrorsAlert(jqXHR.responseJSON);
|
105
|
+
tb.remote.displayErrorsAlert(jqXHR.responseJSON);
|
106
106
|
}
|
107
107
|
}
|
108
108
|
else if(jqXHR.status == 401 || jqXHR.status == 403){
|
@@ -116,7 +116,7 @@ var onRemoteFormErrors = function(event, jqXHR, textStatus, errorThrown){
|
|
116
116
|
/*
|
117
117
|
* Append error text to form input fields and scroll to the first error
|
118
118
|
*/
|
119
|
-
|
119
|
+
tb.remote.displayErrorsInline = function($form, errors){
|
120
120
|
$form.find('.form-error-inline, .form-error-base').remove();
|
121
121
|
for(var key in errors){
|
122
122
|
var messages = errors[key].messages;
|
@@ -166,7 +166,7 @@ var displayErrorsInline = function($form, errors){
|
|
166
166
|
/*
|
167
167
|
* Display errors in a standard window.alert dialog
|
168
168
|
*/
|
169
|
-
|
169
|
+
tb.remote.displayErrorsAlert = function(errors){
|
170
170
|
var text = "Please correct the following errors:\n";
|
171
171
|
var label, message;
|
172
172
|
var index = 0;
|
@@ -64,8 +64,12 @@ EOF
|
|
64
64
|
|
65
65
|
def create_specs
|
66
66
|
string_attribute = find_first_string_attr()
|
67
|
-
Rails::Generators.invoke 'spud:controller_spec',
|
68
|
-
|
67
|
+
Rails::Generators.invoke 'spud:controller_spec',
|
68
|
+
["#{module_name_formatted}", string_attribute, 0],
|
69
|
+
behavior: behavior
|
70
|
+
Rails::Generators.invoke 'spud:controller_spec',
|
71
|
+
["Admin/#{module_name_formatted}", string_attribute, 1],
|
72
|
+
behavior: behavior
|
69
73
|
end
|
70
74
|
|
71
75
|
def field_for_attribute(type, name)
|
data/lib/spud_core/engine.rb
CHANGED
data/lib/spud_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -140,16 +140,16 @@ dependencies:
|
|
140
140
|
name: bootstrap-sass
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "<"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: '4.0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "<"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '4.0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: sass-rails
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|