effective_developer 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f41039ceac09c55fe7ae821452bc2d570bb2279c
4
- data.tar.gz: 4078bf19bfc90c29a6e67253ed1cbb3d54cef519
3
+ metadata.gz: a7cf57c2a6d450e95f10d7b78b614bc4a1b3f6a6
4
+ data.tar.gz: a9d76503a9e842f76aa89969ef51f17b58e9d01d
5
5
  SHA512:
6
- metadata.gz: e776f703a4753b14d2b507be9c1beb72e7024879241fbfd2016dd0879efce73355f18a779a7fd8b9b782d3eb9ab675f8bcd243eb9e4ef6d6bc71b0c1077e3bc5
7
- data.tar.gz: 46fcc829aa004135e7412f919e385335ae5e33a6102551674d3a7034a3ec32fd034ae4944b188e6f191cdd6ec6b6dc1f55ce701f38794f8d1d8de153b4f8e8ca
6
+ metadata.gz: 446d3d327210b316c3b65e707f4ad541921b0b69029c880522469eef72a3c0521e07927613e45140b1b38fb407edd81a3c32258586f7c892474958a251eb8dde
7
+ data.tar.gz: c16dc301b6e0e62a3dee3a49a6580b8c63252b52ca318261ff71cf22d2e408e96fde4ad576e9f48a2c0bf16852f759ec46ab139d958e15264878544b16ef25c3
@@ -1,3 +1,3 @@
1
1
  module EffectiveDeveloper
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.2.4'.freeze
3
3
  end
@@ -43,6 +43,8 @@ module Effective
43
43
  resource.nested_resources.each do |nested_resource|
44
44
  @nested_resource = nested_resource
45
45
  template 'forms/tabpanel/_tab_nested_resource.html.haml', resource.view_file("form_#{nested_resource.plural_name}", partial: true)
46
+
47
+ @nested_resource = Effective::Resource.new(nested_resource)
46
48
  template 'forms/fields/_nested_resource_fields.html.haml', File.join('app/views', resource.namespace.to_s, (resource.namespace.present? ? '' : resource.class_path), nested_resource.name.to_s.underscore.pluralize, '_fields.html.haml')
47
49
  end
48
50
  end
@@ -10,7 +10,7 @@ class <%= resource.namespaced_class_name.pluralize %>Controller < <%= [resource.
10
10
  @page_title = '<%= resource.plural_name.titleize %>'
11
11
  authorize! :index, <%= resource.class_name %>
12
12
 
13
- @datatable = <%= resource.namespaced_class_name.pluralize %>Datatable.new(params[:scopes])
13
+ @datatable = <%= resource.namespaced_class_name.pluralize %>Datatable.new(self)
14
14
  end
15
15
 
16
16
  <% end -%>
@@ -1,42 +1,40 @@
1
1
  class <%= resource.namespaced_class_name.pluralize %>Datatable < Effective::Datatable
2
2
  <% if resource.scopes.present? -%>
3
- scopes do<% ([:all] + resource.scopes).uniq.each_with_index do |scope, index| %>
3
+ filters do<% ([:all] + resource.scopes).uniq.each_with_index do |scope, index| %>
4
4
  scope :<%= scope -%><%= ', default: true' if index == 0 -%>
5
5
  <% end %>
6
6
  end
7
7
 
8
8
  <% end -%>
9
9
  datatable do
10
- default_order :<%= (attributes.find { |att| att.name == 'updated_at' } || attributes.first).name -%>, :desc
10
+ order :<%= (attributes.find { |att| att.name == 'updated_at' } || attributes.first).name -%>, :desc
11
11
 
12
12
  <% resource.belong_tos.each do |reference| -%>
13
- table_column :<%= reference.name %>
13
+ col :<%= reference.name %>
14
14
  <% end -%>
15
15
 
16
16
  <% attributes.each do |attribute| -%>
17
- table_column :<%= attribute.name %>
17
+ col :<%= attribute.name %>
18
18
  <% end -%>
19
19
 
20
20
  <% if non_crud_actions.present? -%>
21
- actions_column do |<%= singular_name %>|
21
+ actions_col do |<%= singular_name %>|
22
22
  <% non_crud_actions.each_with_index do |action, index| -%>
23
23
  glyphicon_to('ok', <%= resource.action_path_helper(action, at: false) %>, title: '<%= action.titleize %>')<%= ' +' if (index+1) < (invoked_actions - crud_actions).length %>
24
24
  <% end -%>
25
25
  end
26
26
  <% else -%>
27
- actions_column
27
+ actions_col
28
28
  <% end -%>
29
29
  end
30
30
 
31
31
  <% if resource.scopes.blank? -%>
32
- def collection
32
+ collection do
33
33
  <%= resource.class_name %>.all
34
34
  end
35
35
  <% else -%>
36
- def collection
37
- col = <%= resource.class_name %>.all
38
- col = col.send(current_scope) if current_scope
39
- col
36
+ collection do
37
+ <%= resource.class_name %>.all
40
38
  end
41
39
  <% end -%>
42
40
 
@@ -10,7 +10,7 @@
10
10
  <% if defined?(EffectiveResources) -%>
11
11
  = simple_form_submit(f)
12
12
  <% else -%>
13
- f.button :submit, 'Save', data: { disable_with: 'Saving...' }
14
- f.button :submit, 'Save and Continue', data: { disable_with: 'Saving...' }
15
- f.button :submit, 'Save and Add New', data: { disable_with: 'Saving...' }
13
+ = f.button :submit, 'Save', data: { disable_with: 'Saving...' }
14
+ = f.button :submit, 'Save and Continue', data: { disable_with: 'Saving...' }
15
+ = f.button :submit, 'Save and Add New', data: { disable_with: 'Saving...' }
16
16
  <% end -%>
@@ -8,4 +8,4 @@
8
8
  = link_to_add_association(f, :<%= nested_resource.plural_name %>, partial: '<%= [resource.namespace.presence, nested_resource.plural_name].compact.join('/') %>/fields') do
9
9
  %button.btn.btn-success
10
10
  %span.glyphicon.glyphicon-plus-sign
11
- Add another <%= nested_resource.name.titleize.downcase %>
11
+ Add another <%= nested_resource.name.to_s.titleize.downcase %>
@@ -1,3 +1,3 @@
1
- %p There are #{pluralize(f.object.<%= nested_resource.plural_name %>.length, '<%= nested_resource.name.titleize.downcase %>')}.
1
+ %p There are #{pluralize(f.object.<%= nested_resource.plural_name %>.length, '<%= nested_resource.name.to_s.titleize.downcase %>')}.
2
2
 
3
3
  <%= render_field(nested_resource) %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_developer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-03 00:00:00.000000000 Z
11
+ date: 2017-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails