gemboree 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,6 +47,10 @@ User access levels can be accessed with the following commands:
47
47
 
48
48
  current_user.remove_role(name)
49
49
 
50
+ current_user.role_name
51
+
52
+ current_user.change_role(name)
53
+
50
54
  Modify access restrictions normally using the built in {cancan}[https://github.com/ryanb/cancan] gem.
51
55
  The ability.rb class has already been created for you.
52
56
 
@@ -0,0 +1,13 @@
1
+ module FormHelper
2
+
3
+ def link_to_add_fields(name, f, association)
4
+ new_object = f.object.class.reflect_on_association(association).klass.new
5
+ fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
6
+ render(association.to_s.singularize + "_fields", :f => builder)
7
+ end
8
+ link_to_function(name,
9
+ "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")",
10
+ class: 'create-new')
11
+ end
12
+
13
+ end
@@ -21,6 +21,10 @@ module Gemboree
21
21
  access_level >= level
22
22
  end
23
23
 
24
+ def has_role_access?(name)
25
+ has_access?(Role.find_by_name(name).access_level)
26
+ end
27
+
24
28
  def has_role?(name)
25
29
  roles.find_by_name(name)
26
30
  end
@@ -1,3 +1,3 @@
1
1
  module Gemboree
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -5,7 +5,7 @@
5
5
  <table class="table table-condensed">
6
6
  <tr>
7
7
  <% attributes.each do |attribute| -%>
8
- <th><%%= sortable '<%= attribute.name %>' %></th>
8
+ <th><%%= sortable '<%= attribute.name %>' %></th>
9
9
  <% end -%>
10
10
  <th></th>
11
11
  <th></th>
@@ -14,7 +14,7 @@
14
14
 
15
15
  <%%= content_tag_for(:tr, @<%= plural_table_name %>) do |<%= singular_table_name %>| %>
16
16
  <% attributes.each do |attribute| -%>
17
- <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
17
+ <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
18
18
  <% end -%>
19
19
  <td><%%= link_to 'Show', <%= singular_table_name %> %></td>
20
20
  <td><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'btn btn-edit' %></td>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemboree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-29 00:00:00.000000000 Z
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -125,6 +125,7 @@ files:
125
125
  - app/assets/stylesheets/gemboree.css
126
126
  - app/assets/stylesheets/navspace.css
127
127
  - app/assets/stylesheets/scaffolds.css
128
+ - app/helpers/form_helper.rb
128
129
  - app/helpers/nav_helper.rb
129
130
  - app/helpers/sortable_helper.rb
130
131
  - app/models/role.rb
@@ -172,18 +173,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
173
  - - ! '>='
173
174
  - !ruby/object:Gem::Version
174
175
  version: '0'
175
- segments:
176
- - 0
177
- hash: 4602070994799047194
178
176
  required_rubygems_version: !ruby/object:Gem::Requirement
179
177
  none: false
180
178
  requirements:
181
179
  - - ! '>='
182
180
  - !ruby/object:Gem::Version
183
181
  version: '0'
184
- segments:
185
- - 0
186
- hash: 4602070994799047194
187
182
  requirements: []
188
183
  rubyforge_project:
189
184
  rubygems_version: 1.8.24