faalis 0.18.0 → 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/faalis/generators/concerns.rb +1 -0
- data/lib/faalis/generators/concerns/model.rb +29 -0
- data/lib/faalis/generators/dashboard_scaffold.rb +1 -0
- data/lib/faalis/version.rb +1 -1
- data/lib/generators/faalis/templates/api/controller.rb.erb +3 -3
- data/lib/generators/faalis/templates/js/list_view/index.html.erb +1 -1
- data/lib/generators/faalis/templates/js/list_view/module.js.erb +4 -4
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6af04f0ddd2109f8688af7c8130368781645d83
|
4
|
+
data.tar.gz: 816f4033c96f1c871b20ef85845bb7bc105afbac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5105668ea3683a077fe1b5492af48bbede58f11e9f938964b1976966561f2f1a829846dd3248cc8344f003558df8f0a644bf38e992415f4a9914ca928d1edfe
|
7
|
+
data.tar.gz: 9a8797a854f7cdc93fcbc4d5da0e7a67c832c28bd52c3dbc207560453ee22ef3dc40b6c8d584c00240b69ac5450ab2fe86c76e6a043c9e2028feadf7154fd081
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Faalis
|
2
|
+
module Generators
|
3
|
+
module Concerns
|
4
|
+
module Model
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
# Fields to use in in bulk edit, comma separated
|
8
|
+
base.class_option :model, :type => :string, :default => "", :desc => "Model name to use"
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def model_specified?
|
15
|
+
not options[:model].empty?
|
16
|
+
end
|
17
|
+
|
18
|
+
def model
|
19
|
+
if model_specified?
|
20
|
+
options[:model]
|
21
|
+
else
|
22
|
+
""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/faalis/version.rb
CHANGED
@@ -3,9 +3,9 @@ class API::V1::<%= resource.pluralize %>Controller < APIController
|
|
3
3
|
<% if parent? %><% all_parents = parents %><% prev = all_parents.shift %>
|
4
4
|
load_and_authorize_resource :<%= prev.singularize %>, :except => [:destory]
|
5
5
|
<% all_parents.each do |p| %>load_and_authorize_resource :<%= p.singularize %>, :through => :<%= prev.singularize %>, :except => [:destory]<% prev = p %>
|
6
|
-
<% end %>load_and_authorize_resource :through => :<%= prev.singularize %>, :except => [:destory]
|
6
|
+
<% end %>load_and_authorize_resource :through => :<%= prev.singularize %>, :except => [:destory]<% if model_specified? %>, :class => "<%= model %>"<% end %>
|
7
7
|
<% else %>
|
8
|
-
load_and_authorize_resource :except => [:destory]
|
8
|
+
load_and_authorize_resource :except => [:destory]<% if model_specified? %>, :class => "<%= model %>"<% end %>
|
9
9
|
<% end %>
|
10
10
|
# GET /api/v1/<%= resource.pluralize.underscore %>
|
11
11
|
def index
|
@@ -51,7 +51,7 @@ class API::V1::<%= resource.pluralize %>Controller < APIController
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def build_resource
|
54
|
-
@<%= resource.underscore %> =
|
54
|
+
@<%= resource.underscore %> = <% if model_specified? %><%= model %><% else %>::<%= resource %><% end %>.new(resource_params)
|
55
55
|
<% if parent? %>@<%= resource.underscore %>.<%= parents.last.singularize %> = <%= parents.last.singularize.camelize %>.find(params[:<%= parents.last.singularize %>_id])<% end %>
|
56
56
|
end
|
57
57
|
|
@@ -55,7 +55,7 @@
|
|
55
55
|
</div>
|
56
56
|
</div>
|
57
57
|
<% end %>
|
58
|
-
<list-view buttons="buttons" model="'
|
58
|
+
<list-view buttons="buttons" model="'<% if model_specified? %><%= model %><% else %><%= resource %><% end %>'" objects="<%= resource.pluralize.underscore %>" title-attribute="'<%= options[:title_field] %>'" details-template="details_template" item-per-page="10" on_delete="on_delete" column_defs="columns">
|
59
59
|
<div class="small-6 column text-left clearpadding">
|
60
60
|
<h3><i class="fa fa-group"></i> <span translate><%= resource.underscore.pluralize.humanize %></span></h3>
|
61
61
|
</div>
|
@@ -51,7 +51,7 @@ var <%= resource.pluralize %> = angular.module("<%= resource %>", ["ListView", "
|
|
51
51
|
$scope.<%= options[:parent] %>_id = $routeParams.<%= options[:parent] %>_id;
|
52
52
|
<% end %>
|
53
53
|
<% unless options[:no_filter] %>$scope.filter_config = {
|
54
|
-
list: API.all("<%= resource.pluralize.underscore %>")
|
54
|
+
list: <% if parent? %>API.<% parents.each do |parent| %>one("<%= parent %>", $scope.<%= parent %>_id)<% end %>.all("<%= resource.pluralize.underscore %>")<% else %>API.all("<%= resource.pluralize.underscore %>")<% end %>
|
55
55
|
};
|
56
56
|
$scope.<%= resource.pluralize.underscore %> = [];<% end %>
|
57
57
|
<% unless options[:no_bulk] %>// Cache object for each field name possible values
|
@@ -96,7 +96,7 @@ var <%= resource.pluralize %> = angular.module("<%= resource %>", ["ListView", "
|
|
96
96
|
classes: "btn tiny green",
|
97
97
|
permission: {
|
98
98
|
name: "create",
|
99
|
-
model: "
|
99
|
+
model: "<% if model_specified? %><%= model %><% else %><%= resource.classify %><% end %>"
|
100
100
|
},
|
101
101
|
route: "#<% parents.each do |p| %>/<%= p %>/" + $scope.<%= p %>_id + "<% end %>/<%= resource_url %>/new"
|
102
102
|
|
@@ -107,7 +107,7 @@ var <%= resource.pluralize %> = angular.module("<%= resource %>", ["ListView", "
|
|
107
107
|
classes: "btn tiny yellow",
|
108
108
|
permission: {
|
109
109
|
name: "update",
|
110
|
-
model: "
|
110
|
+
model: "<% if model_specified? %><%= model %><% else %><%= resource.classify %><% end %>"
|
111
111
|
},
|
112
112
|
action: function(){
|
113
113
|
$scope.$apply("bulk_edit = ! bulk_edit");
|
@@ -120,7 +120,7 @@ var <%= resource.pluralize %> = angular.module("<%= resource %>", ["ListView", "
|
|
120
120
|
classes: "btn tiny red",
|
121
121
|
permission: {
|
122
122
|
name: "create",
|
123
|
-
model: "
|
123
|
+
model: "<% if model_specified? %><%= model %><% else %><%= resource.classify %><% end %>"
|
124
124
|
},
|
125
125
|
action: function(){
|
126
126
|
var selected = _.find($scope.<%= resource.pluralize.underscore %>, function(x){
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faalis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sameer Rahmani
|
@@ -639,6 +639,7 @@ files:
|
|
639
639
|
- lib/faalis/generators/concerns/tabs.rb
|
640
640
|
- lib/faalis/generators/concerns/parent.rb
|
641
641
|
- lib/faalis/generators/concerns/resource_fields.rb
|
642
|
+
- lib/faalis/generators/concerns/model.rb
|
642
643
|
- lib/faalis/generators/concerns/required.rb
|
643
644
|
- lib/faalis/generators/concerns/menu.rb
|
644
645
|
- lib/faalis/omniauth/callbacks.rb
|