superuser 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca5f9b99d69ab6be91c64b8b59d81a8c3e6c4b09d6a339371e3fa8c30db8175c
4
- data.tar.gz: c006c02556167bf7271cf35419f9715fdcc26c75ac94860678cc3e3ec50870e9
3
+ metadata.gz: 37ba17de48a89db27bfd4cc1a10b09224f357abe34af8fd460b67b16335ed6e8
4
+ data.tar.gz: 819e3904403516ea5e17dc57262a4feef66c55bee5c97df0c4e23e855330ebc0
5
5
  SHA512:
6
- metadata.gz: b5af5cc4a9b5bfcf1e162fd6e3d52f1fa2b50b873c20d306dabae5e11d7758d788e7fc745f0741ff7995b968ac88141e2b2713c186fb18f422d09240facde2f9
7
- data.tar.gz: a766b2a731841dad2bbbffc95e779543322f88fa0172e5c1c79f5a213f7d816f398ed589cf44dad5286d0f3703a42ad3f6e2b4ddd3ac96878cdc70dc1fb2b296
6
+ metadata.gz: 2916b5fb284d9d7d7a0564a6cbf795dcfdce93bcff8f0d2bc2c8da34d5ca44de67770c1c33a5b3ce34fb66821cb4320afd44d7970213bafd8e464e5da40bbdca
7
+ data.tar.gz: 2df66f5f8edb5d244d6d0a069559f7a42d14f52f77f51e8d0d62b8157698bf090a271e73add5abf2524df0c5449b78356f355c5fde6b3e6ee7db5c180e2a2fd8
@@ -1,8 +1,21 @@
1
1
  Description:
2
- Explain the generator
2
+ Generate scaffolding for you rails admin area using the command "rails g superuser name_of_your_resource"
3
3
 
4
4
  Example:
5
- rails generate superuser Thing
5
+ rails generate superuser users
6
6
 
7
7
  This will create:
8
- what/will/it/create
8
+ controllers/superuser/users_controller.rb
9
+ views/superuser/index.html.erb
10
+ views/superuser/new.html.erb
11
+ views/superuser/show.html.erb
12
+ views/superuser/edit.html.erb
13
+ views/superuser/_form.html.erb
14
+
15
+ + will create some base/shared files if they don't exists:
16
+ assets/javascripts/superuser/application.js
17
+ assets/stylesheets/superuser/application.scss
18
+ controllers/superuser/base_controller.rb
19
+ controllers/superuser/dashboard_controller.rb
20
+ views/layouts/superuser/application.html.erb
21
+ views/shared/_search.html.erb
@@ -5,7 +5,7 @@ class SuperuserGenerator < Rails::Generators::Base
5
5
  attr_accessor :attributes
6
6
 
7
7
  # NOTE: the order of the following methods is important!
8
-
8
+
9
9
  def generate_css_file
10
10
 
11
11
  if !File.exist?("app/assets/stylesheets/superuser/application.scss")
@@ -69,7 +69,7 @@ class SuperuserGenerator < Rails::Generators::Base
69
69
 
70
70
  def generate_search_form
71
71
 
72
- template "views/_search.html.erb", "app/views/shared/_search.html.erb"
72
+ template "views/_search.html.erb", "app/views/shared/superuser/_search.html.erb"
73
73
 
74
74
  end
75
75
 
@@ -4,7 +4,7 @@ module Superuser
4
4
 
5
5
  # List all the (only) actions so it won't be applied to user's custom actions
6
6
 
7
- before_action :set_resource, only: [:show, :edit, :update, :destroy]
7
+ before_action :set_<%= resource %>, only: [:show, :edit, :update, :destroy]
8
8
 
9
9
  # GET /<%= resources %>
10
10
  def index
@@ -41,7 +41,7 @@ module Superuser
41
41
  # POST /<%= resources %>
42
42
  def create
43
43
 
44
- @<%= resource %> = <%= get_model %>.new(resource_params)
44
+ @<%= resource %> = <%= get_model %>.new(<%= resource %>_params)
45
45
 
46
46
  if @<%= resource %>.save
47
47
 
@@ -58,7 +58,7 @@ module Superuser
58
58
  # PATCH/PUT /<%= resources %>/1
59
59
  def update
60
60
 
61
- if @<%= resource %>.update(resource_params)
61
+ if @<%= resource %>.update(<%= resource %>_params)
62
62
 
63
63
  redirect_to [:superuser, @<%= resource %>], notice: "<%= resource %> was successfully updated."
64
64
 
@@ -84,14 +84,14 @@ module Superuser
84
84
 
85
85
 
86
86
  # Only allow a trusted parameter "white list" through.
87
- def resource_params
87
+ def <%= resource %>_params
88
88
 
89
89
  params.require(:<%= resource %>).permit(<%= editable_attributes.map { |a| ":" + a[:name] }.join(', ') %>)
90
90
 
91
91
  end
92
92
 
93
93
 
94
- def set_resource
94
+ def set_<%= resource %>
95
95
 
96
96
  @<%= resource %> = <%= get_model %>.find(params[:id])
97
97
 
@@ -3,7 +3,7 @@
3
3
  <%#= without method_messing available as helper, it should be [main_app, :new, :superuser, @model.table_name.singularize] %>
4
4
  <%= "<%= link_to 'Add new #{resource}', [:new, :superuser, :#{resource}], class: 'btn btn-info float-sm-right' %%>" %>
5
5
 
6
- <%= "<%= render 'shared/search', obj: '#{resources}' %%>" %>
6
+ <%= "<%= render 'shared/superuser/search', obj: '#{resources}' %%>" %>
7
7
 
8
8
  <div class="table-responsive">
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Superuser
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superuser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mody