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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b17095e9f9209c16c8d641d36dfee75381a06469
4
- data.tar.gz: 3cbc41e1c106775a84a1916d68d4e82772855e9d
3
+ metadata.gz: c6af04f0ddd2109f8688af7c8130368781645d83
4
+ data.tar.gz: 816f4033c96f1c871b20ef85845bb7bc105afbac
5
5
  SHA512:
6
- metadata.gz: 548ee9b0d86567b06061097ef2651eb20308b0af1059c566d80d5c02a74acbe613c59feb044880a0e28c9d57a0093e941da81152483c392e484b417beedfe52c
7
- data.tar.gz: 987451cd55ffe78f4b7af5855253a208b62c4044e143461bf299285566530eb9369aadfcdb544164151240bd384f9c9b2f178751312fa4103be31859c0e55b10
6
+ metadata.gz: d5105668ea3683a077fe1b5492af48bbede58f11e9f938964b1976966561f2f1a829846dd3248cc8344f003558df8f0a644bf38e992415f4a9914ca928d1edfe
7
+ data.tar.gz: 9a8797a854f7cdc93fcbc4d5da0e7a67c832c28bd52c3dbc207560453ee22ef3dc40b6c8d584c00240b69ac5450ab2fe86c76e6a043c9e2028feadf7154fd081
@@ -7,3 +7,4 @@ require "faalis/generators/concerns/resource_fields"
7
7
  require "faalis/generators/concerns/resource_name"
8
8
  require "faalis/generators/concerns/angular"
9
9
  require "faalis/generators/concerns/tabs"
10
+ require "faalis/generators/concerns/model"
@@ -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
@@ -15,6 +15,7 @@ module Faalis
15
15
  include Faalis::Generators::Concerns::Parent
16
16
  include Faalis::Generators::Concerns::Angular
17
17
  include Faalis::Generators::Concerns::Tabs
18
+ include Faalis::Generators::Concerns::Model
18
19
 
19
20
 
20
21
  # Do not install specs
@@ -18,5 +18,5 @@
18
18
  # -----------------------------------------------------------------------------
19
19
 
20
20
  module Faalis
21
- VERSION = "0.18.0"
21
+ VERSION = "0.18.1"
22
22
  end
@@ -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 %> = ::<%= resource %>.new(resource_params)
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="'<%= resource %>'" objects="<%= resource.pluralize.underscore %>" title-attribute="'<%= options[:title_field] %>'" details-template="details_template" item-per-page="10" on_delete="on_delete" column_defs="columns">
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: "<%= resource.classify %>"
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: "<%= resource.classify %>"
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: "<%= resource.classify %>"
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.0
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