superuser 0.2.6 → 0.3.1

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.
@@ -3,7 +3,6 @@
3
3
  <%= "<% if #{resource}.errors.any? %%>" %>
4
4
  <div id="error_explanation" class="alert alert-danger">
5
5
  <h3 class="error_title"><%= "<%= pluralize(#{resource}.errors.count, 'error') %%>" %> prohibited this resource from being saved:</h3>
6
-
7
6
  <ul>
8
7
  <%= "<% #{resource}.errors.full_messages.each do |message| %%>" %>
9
8
  <li><%= "<%= message %%>" %></li>
@@ -19,7 +18,6 @@
19
18
  </div>
20
19
  <% end -%>
21
20
 
22
- <%= "<%= f.submit (#{resource}.new_record? ? 'Create ' + #{resource}.class.name : 'Update ' + #{resource}.class.name), class: 'btn btn-info btn-lg' %%>" %>
23
-
21
+ <%= "<%= f.submit (#{resource}.new_record? ? 'Create #{resource}' : 'Update #{resource}'), class: 'btn btn-info btn-lg' %%>" %>
24
22
 
25
23
  <%= "<% end %%>" %>
@@ -1,31 +1,28 @@
1
1
  <div class="card p-2 p-md-4">
2
2
 
3
- <div class="card-title">
4
- Search :
5
- </div>
6
-
7
- <div class="text-center">
8
-
9
- <%= "<%= form_tag [:superuser, obj], method: :get, class: 'search_form' do %%>" %>
10
-
11
- <span class="condition-label">Condition :</span>
12
-
13
- <%= """
14
- <%
15
- options = []
16
- obj.classify.constantize.column_names.each do |column_name|
17
- options << column_name
18
- end
19
- %%>
20
- """ %>
21
- <%= "<%= hidden_field_tag :search, 'true' %%>" %>
22
- <%= "<%= select_tag :search_field, options_for_select(options, params[:search_field]), class: 'form-control d-inline-block' %%>" %>
23
- <%= "<%= select_tag :operator, options_for_select({'Equal': 'equal', 'Like': 'like', '>': 'gt', '<': 'lt', '>=': 'gte', '<=': 'lte'}, params[:operator]), class: 'form-control d-inline-block' %%>" %>
24
- <%= "<%= text_field_tag :search_value, params[:search_value], placeholder: 'Search Value...', class: 'form-control d-inline-block' %%>" %>
25
- <%= "<%= submit_tag :Search, class: 'btn btn-success' %%>" %>
26
-
27
- <%= "<% end %%>" %>
28
-
29
-
30
- </div>
3
+ <div class="card-title">
4
+ Search :
5
+ </div>
6
+
7
+ <div class="text-center">
8
+ <%= "<%= form_tag [:superuser, obj], method: :get, class: 'search_form' do %%>" %>
9
+
10
+ <span class="condition-label">Condition :</span>
11
+
12
+ <%= """
13
+ <%
14
+ options = []
15
+ obj.classify.constantize.column_names.each do |column_name|
16
+ options << column_name
17
+ end
18
+ %%>
19
+ """ %>
20
+ <%= "<%= hidden_field_tag :search, 'true' %%>" %>
21
+ <%= "<%= select_tag :search_field, options_for_select(options, params[:search_field]), class: 'form-control d-inline-block' %%>" %>
22
+ <%= "<%= select_tag :operator, options_for_select({'Equal': 'equal', 'Like': 'like', '>': 'gt', '<': 'lt', '>=': 'gte', '<=': 'lte'}, params[:operator]), class: 'form-control d-inline-block' %%>" %>
23
+ <%= "<%= text_field_tag :search_value, params[:search_value], placeholder: 'Search Value...', class: 'form-control d-inline-block' %%>" %>
24
+ <%= "<%= submit_tag :Search, class: 'btn btn-success' %%>" %>
25
+
26
+ <%= "<% end %%>" %>
27
+ </div>
31
28
  </div>
@@ -1 +1 @@
1
- <h1>Welcome to your Dashboard</h1>
1
+ <h1>Dashboard</h1>
@@ -3,9 +3,8 @@
3
3
  <%= "<%= render 'form', #{resource}: @#{resource} %%>" %>
4
4
 
5
5
  <br>
6
-
7
6
  <hr>
8
7
 
9
8
  <div class="text-center">
10
- <%= "<%= link_to 'Back', [:superuser, :#{resources}], class: 'btn btn-outline-secondary' %%>" %>
9
+ <%= "<%= link_to 'Back', [:superuser, :#{resources}], class: 'btn btn-outline-secondary' %%>" %>
11
10
  </div>
@@ -8,48 +8,39 @@
8
8
  <div class="table-responsive">
9
9
 
10
10
  <table class="table my-3">
11
-
12
11
  <thead class="thead-light">
13
-
14
12
  <tr>
15
- <% editable_attributes.each do |attribute| -%>
16
- <th><%= attribute[:name] %></th>
17
- <% end -%>
18
- <th></th>
19
-
13
+ <% editable_attributes.each do |attribute| -%>
14
+ <th><%= attribute[:name] %></th>
15
+ <% end -%>
16
+ <th></th>
20
17
  </tr>
21
-
22
18
  </thead>
23
19
 
24
20
  <tbody>
25
21
 
26
- <%= "<% @#{resources}.each do |#{resource}| %%>" %>
27
-
28
- <tr>
29
-
30
- <% editable_attributes.each do |attribute| -%>
31
- <td><%= "<%= #{resource}[:#{attribute[:name]}] %%>" %></td>
32
- <% end -%>
33
-
34
- <td class="text-right">
35
-
36
-
37
- <div class="dropdown">
38
- <button class="btn btn-secondary dropdown-toggle p-1 px-2" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
39
- Actions
40
- </button>
41
- <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
42
- <div><%= "<%= link_to 'Show', [:superuser, #{resource}], class: 'dropdown-item' %%>" %></div>
43
- <div><%= "<%= link_to 'Edit', [:edit, :superuser, #{resource}], class: 'dropdown-item' %%>" %></div>
44
- <div><%= "<%= link_to 'Delete', [:superuser, #{resource}], method: :delete, data: { confirm: 'Are you sure?' }, class: 'dropdown-item' %%>" %></div>
45
- </div>
46
- </div>
47
-
48
- </td>
49
-
50
- </tr>
51
-
52
- <%= '<% end %%>' %>
22
+ <%= "<% @#{resources}.each do |#{resource}| %%>" %>
23
+
24
+ <tr>
25
+ <% editable_attributes.each do |attribute| -%>
26
+ <td><%= "<%= #{resource}[:#{attribute[:name]}] %%>" %></td>
27
+ <% end -%>
28
+
29
+ <td class="text-right">
30
+ <div class="dropdown">
31
+ <button class="btn btn-secondary dropdown-toggle p-1 px-2" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
32
+ Actions
33
+ </button>
34
+ <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
35
+ <div><%= "<%= link_to 'Show', [:superuser, #{resource}], class: 'dropdown-item' %%>" %></div>
36
+ <div><%= "<%= link_to 'Edit', [:edit, :superuser, #{resource}], class: 'dropdown-item' %%>" %></div>
37
+ <div><%= "<%= link_to 'Delete', [:superuser, #{resource}], method: :delete, data: { confirm: 'Are you sure?' }, class: 'dropdown-item' %%>" %></div>
38
+ </div>
39
+ </div>
40
+ </td>
41
+ </tr>
42
+
43
+ <%= '<% end %%>' %>
53
44
 
54
45
  </tbody>
55
46
 
@@ -59,6 +50,6 @@
59
50
 
60
51
  <hr class="mb-4">
61
52
 
62
- <div class="kaminari_pagination text-center">
63
- <%= "<%= paginate @#{resources} %%>" %>
53
+ <div class="pagy_pagination text-center">
54
+ <%= "<%== pagy_bootstrap_nav(@pagy) %%>" %>
64
55
  </div>
@@ -1,61 +1,67 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
 
4
- <head>
4
+ <head>
5
5
  <title>Super User <%= '<%= controller_name %%>' %>#<%= '<%= action_name %%>' %></title>
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
7
 
8
8
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
9
- <%= '<%= stylesheet_link_tag "superuser/application", media: "all" %%>' %>
10
- <%= '<%= javascript_include_tag "superuser/application" %%>' %>
9
+
10
+ <% if for_webpack_native -%>
11
+ <%= '<%= webpack_stylesheet_url "superuser", media: "all", "data-turbolinks-track": "reload" %%>' %>
12
+ <%= '<%= webpack_javascript_url "superuser", "data-turbolinks-track": "reload" %%>' %>
13
+ <% else -%>
14
+ <%= '<%= stylesheet_link_tag "superuser", media: "all", "data-turbolinks-track": "reload" %%>' %>
15
+ <%= '<%= javascript_pack_tag "superuser", "data-turbolinks-track": "reload" %%>' %>
16
+ <% end -%>
17
+
11
18
  <!-- CDN for flatpickr.css -->
12
19
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
13
20
  <!-- end CDN for flatpickr.css -->
14
21
  <%= '<%= csrf_meta_tags %%>' %>
22
+ </head>
15
23
 
16
- </head>
17
-
18
- <body>
24
+ <body class="superuser">
19
25
 
20
26
  <header>
21
- <nav class="navbar navbar-expand-sm navbar-light fixed-top">
22
-
23
- <%= '<%= link_to [:superuser, :root], class: "navbar-brand" do %%>' %>
24
- <span class="logo_part_1">Super</span><span class="logo_part_2">user</span>
25
- <%= '<% end %%>' %>
26
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
27
- <span class="navbar-toggler-icon"></span>
28
- </button>
29
- </nav>
27
+ <nav class="navbar navbar-expand-sm navbar-light fixed-top">
28
+ <%= '<%= link_to [:superuser, :root], class: "navbar-brand" do %%>' %>
29
+ <span class="logo_part_1">Super</span><span class="logo_part_2">user</span>
30
+ <%= '<% end %%>' %>
31
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
32
+ <span class="navbar-toggler-icon"></span>
33
+ </button>
34
+ </nav>
30
35
  </header>
31
36
 
32
37
  <aside class="sidebar">
33
- <div class="">
34
- <h2 class="sidebar_title">Resources</h2>
35
- <div class="sidebar_dashboard_link">
36
- </div>
37
- <div class="sidebar_item">
38
- <%#= link_to resources_name, [:superuser, :resources_name] %>
39
- </div>
38
+ <div class="">
39
+ <h2 class="sidebar_title">Resources</h2>
40
+ <div class="sidebar_dashboard_link">
41
+ </div>
42
+ <div class="sidebar_item">
43
+ <%#= link_to resources_name, [:superuser, :resources_name] %>
40
44
  </div>
45
+ </div>
41
46
  </aside>
42
47
 
43
48
  <div class="main-content">
44
- <div class="container-fluid">
45
- <div class="row">
46
- <div class="col">
47
- <div class="content">
48
- <%= "<% flash.each do |key, value| %%>" %>
49
- <div class="alert alert-<%= '<%= flash_class(key) %%>' %>"><%= '<%= value %%>' %></div>
50
- <%= "<% end %%>" %>
51
- <%= '<%= yield %%>' %>
52
- </div>
49
+ <div class="container-fluid">
50
+ <div class="row">
51
+ <div class="col">
52
+ <div class="content">
53
+ <%= "<% flash.each do |key, value| %%>" %>
54
+ <div class="alert alert-<%= '<%= flash_class(key) %%>' %>">
55
+ <%= '<%= value %%>' %>
53
56
  </div>
57
+ <%= "<% end %%>" %>
58
+ <%= '<%= yield %%>' %>
54
59
  </div>
60
+ </div>
55
61
  </div>
62
+ </div>
56
63
  </div>
57
64
 
58
-
59
65
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
60
66
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
61
67
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
@@ -65,26 +71,21 @@
65
71
  <!-- end CDN for flatpickr.js -->
66
72
 
67
73
  <script type="text/javascript">
68
-
69
- (function() {
70
-
71
- document.querySelector('.navbar-toggler').addEventListener('click', function(){
72
- body = document.getElementsByTagName('body')[0];
73
- body.classList.toggle('open-sidebar');
74
- });
75
-
76
- // if input has class 'isdate' : show flatpickr < date without time >
77
- $(".date-field").flatpickr();
78
- // if input has class 'isdatetime' : show flatpickr < date with time (Hours + Minutes + Seconds) >
79
- $(".datetime-field").flatpickr({
80
- enableTime: true,
81
- enableSeconds: true
82
- });
83
-
84
- })();
85
-
74
+ (function() {
75
+ document.querySelector('.navbar-toggler').addEventListener('click', function(){
76
+ body = document.getElementsByTagName('body')[0];
77
+ body.classList.toggle('open-sidebar');
78
+ });
79
+ // if input has class 'isdate' : show flatpickr < date without time >
80
+ $(".date-field").flatpickr();
81
+ // if input has class 'isdatetime' : show flatpickr < date with time (Hours + Minutes + Seconds) >
82
+ $(".datetime-field").flatpickr({
83
+ enableTime: true,
84
+ enableSeconds: true
85
+ });
86
+ })();
86
87
  </script>
87
88
 
88
- </body>
89
+ </body>
89
90
 
90
91
  </html>
@@ -5,9 +5,8 @@
5
5
  <%= "<%= render 'form', #{resource}: @#{resource} %%>" %>
6
6
 
7
7
  <br>
8
-
9
8
  <hr>
10
9
 
11
10
  <div class="text-center">
12
- <%= "<%= link_to 'Back', [:superuser, :#{resources}], class: 'btn btn-outline-secondary' %%>" %>
11
+ <%= "<%= link_to 'Back', [:superuser, :#{resources}], class: 'btn btn-outline-secondary' %%>" %>
13
12
  </div>
@@ -4,12 +4,11 @@
4
4
 
5
5
  <% editable_attributes.each do |attribute| -%>
6
6
  <div class="attribute-line">
7
- <%= attribute[:name].capitalize %> :
7
+ <%= attribute[:name].capitalize %> :
8
8
  <%= "<%= @#{resource}.#{attribute[:name]} %%>" %>
9
9
  </div>
10
10
  <% end -%>
11
11
 
12
-
13
12
  <hr>
14
13
 
15
14
  <%= "<%= link_to 'Edit', [:edit, :superuser, @#{resource}], class: 'btn btn-primary' %%>" %>
@@ -1,4 +1,5 @@
1
1
  require "superuser/version"
2
+ require "pagy"
2
3
 
3
4
  module Superuser
4
5
  # Your code goes here...
@@ -1,3 +1,3 @@
1
1
  module Superuser
2
- VERSION = "0.2.6"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superuser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mody
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-30 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,28 +30,40 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '12.3'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 12.3.3
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
- version: '10.0'
43
+ version: '12.3'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 12.3.3
41
47
  - !ruby/object:Gem::Dependency
42
- name: kaminari
48
+ name: pagy
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '1.0'
53
+ version: '3.8'
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 3.8.3
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
51
60
  requirements:
52
61
  - - "~>"
53
62
  - !ruby/object:Gem::Version
54
- version: '1.0'
63
+ version: '3.8'
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 3.8.3
55
67
  description: This gem will help you scaffold an admin area very quickly so you can
56
68
  have full control over your code when you need customization
57
69
  email:
@@ -61,6 +73,7 @@ extensions: []
61
73
  extra_rdoc_files: []
62
74
  files:
63
75
  - lib/generators/superuser/USAGE
76
+ - lib/generators/superuser/init_generator.rb
64
77
  - lib/generators/superuser/superuser_generator.rb
65
78
  - lib/generators/superuser/templates/base_controller.rb
66
79
  - lib/generators/superuser/templates/controller_template.rb
@@ -96,8 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
109
  - !ruby/object:Gem::Version
97
110
  version: '0'
98
111
  requirements: []
99
- rubyforge_project:
100
- rubygems_version: 2.7.7
112
+ rubygems_version: 3.1.2
101
113
  signing_key:
102
114
  specification_version: 4
103
115
  summary: Build An Admin Area Easily.