beautiful_scaffold 1.0.0.pre → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/CHANGELOG +73 -1
  4. data/Gemfile +25 -17
  5. data/README.rdoc +45 -28
  6. data/Rakefile +29 -0
  7. data/beautiful_scaffold.gemspec +7 -7
  8. data/lib/beautiful_scaffold/version.rb +3 -0
  9. data/lib/generators/USAGE +3 -1
  10. data/lib/generators/beautiful_cancancan_generator.rb +51 -0
  11. data/lib/generators/beautiful_jointable_generator.rb +41 -8
  12. data/lib/generators/beautiful_locale_generator.rb +112 -88
  13. data/lib/generators/beautiful_migration_generator.rb +14 -20
  14. data/lib/generators/beautiful_scaffold_common_methods.rb +92 -25
  15. data/lib/generators/beautiful_scaffold_generator.rb +164 -101
  16. data/lib/generators/beautiful_sorcery_generator.rb +137 -0
  17. data/lib/generators/beautiful_storage_generator.rb +61 -0
  18. data/lib/generators/templates/app/assets/javascripts/application-bs.js +7 -7
  19. data/lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js +70 -47
  20. data/lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js +23 -42
  21. data/lib/generators/templates/app/assets/javascripts/fixed_menu.js +3 -1
  22. data/lib/generators/templates/app/assets/javascripts/jstree.min.js +6 -0
  23. data/lib/generators/templates/app/assets/stylesheets/application-bs.css +14 -6
  24. data/lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss +38 -3
  25. data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/32px.png +0 -0
  26. data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/40px.png +0 -0
  27. data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/style.scss +1146 -0
  28. data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/throbber.gif +0 -0
  29. data/lib/generators/templates/app/assets/stylesheets/themes/default/32px.png +0 -0
  30. data/lib/generators/templates/app/assets/stylesheets/themes/default/40px.png +0 -0
  31. data/lib/generators/templates/app/assets/stylesheets/themes/default/style.scss +1102 -0
  32. data/lib/generators/templates/app/assets/stylesheets/themes/default/throbber.gif +0 -0
  33. data/lib/generators/templates/app/controllers/base.rb +31 -14
  34. data/lib/generators/templates/app/controllers/master_base.rb +55 -47
  35. data/lib/generators/templates/app/controllers/user_sessions_controller.rb +20 -0
  36. data/lib/generators/templates/app/helpers/beautiful_helper.rb +122 -72
  37. data/lib/generators/templates/app/helpers/model_helper.rb +14 -3
  38. data/lib/generators/templates/app/initializers/link_renderer.rb +23 -18
  39. data/lib/generators/templates/app/initializers/ransack.rb +16 -0
  40. data/lib/generators/templates/app/locales/beautiful_scaffold.en.yml +8 -0
  41. data/lib/generators/templates/app/locales/beautiful_scaffold.fr.yml +9 -1
  42. data/lib/generators/templates/app/locales/beautiful_scaffold.ja.yml +9 -2
  43. data/lib/generators/templates/app/mailers/user_mailer.rb +13 -0
  44. data/lib/generators/templates/app/models/ability.rb +39 -0
  45. data/lib/generators/templates/app/models/concerns/caption_concern.rb +1 -1
  46. data/lib/generators/templates/app/models/user.rb +11 -0
  47. data/lib/generators/templates/app/views/_form.html.erb +4 -1
  48. data/lib/generators/templates/app/views/_form_habtm_tag.html.erb +6 -2
  49. data/lib/generators/templates/app/views/_mass_inserting.html.erb +40 -31
  50. data/lib/generators/templates/app/views/_modal_columns.html.erb +4 -4
  51. data/lib/generators/templates/app/views/edit.html.erb +1 -3
  52. data/lib/generators/templates/app/views/index.html.erb +84 -58
  53. data/lib/generators/templates/app/views/layout.html.erb +36 -47
  54. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_needed_email.en.html.erb +16 -0
  55. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_needed_email.en.text.erb +9 -0
  56. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_needed_email.fr.html.erb +16 -0
  57. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_needed_email.fr.text.erb +8 -0
  58. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_success_email.en.html.erb +19 -0
  59. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_success_email.en.text.erb +8 -0
  60. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_success_email.fr.html.erb +19 -0
  61. data/lib/generators/templates/app/views/login_logout/user_mailer/activation_success_email.fr.text.erb +8 -0
  62. data/lib/generators/templates/app/views/login_logout/user_sessions/_form.html.erb +15 -0
  63. data/lib/generators/templates/app/views/login_logout/user_sessions/new.html.erb +3 -0
  64. data/lib/generators/templates/app/views/new.html.erb +0 -2
  65. data/lib/generators/templates/app/views/partials/_forget_password.html.erb +2 -2
  66. data/lib/generators/templates/app/views/partials/_form_field.html.erb +7 -7
  67. data/lib/generators/templates/app/views/partials/_index_batch.html.erb +1 -1
  68. data/lib/generators/templates/app/views/partials/_index_column.html.erb +4 -4
  69. data/lib/generators/templates/app/views/partials/_index_header.html.erb +1 -1
  70. data/lib/generators/templates/app/views/partials/_index_search.html.erb +2 -2
  71. data/lib/generators/templates/app/views/partials/_index_search_default_fields.html.erb +1 -1
  72. data/lib/generators/templates/app/views/partials/_login_logout_register.html.erb +7 -0
  73. data/lib/generators/templates/app/views/partials/_show_field.html.erb +3 -3
  74. data/lib/generators/templates/app/views/show.html.erb +2 -2
  75. data/lib/generators/templates/app/views/treeview.html.erb +8 -5
  76. metadata +41 -26
  77. data/lib/generators/beautiful_devisecancan_generator.rb +0 -128
  78. data/lib/generators/templates/app/assets/javascripts/bootstrap-datepicker.js +0 -834
  79. data/lib/generators/templates/app/assets/javascripts/bootstrap-timepicker.js +0 -797
  80. data/lib/generators/templates/app/assets/javascripts/jquery.jstree.js +0 -4551
  81. data/lib/generators/templates/app/assets/stylesheets/bootstrap_and_overrides.css.less +0 -40
  82. data/lib/generators/templates/app/assets/stylesheets/datepicker.css +0 -224
  83. data/lib/generators/templates/app/assets/stylesheets/reset.css +0 -48
  84. data/lib/generators/templates/app/assets/stylesheets/themes/default/d.gif +0 -0
  85. data/lib/generators/templates/app/assets/stylesheets/themes/default/d.png +0 -0
  86. data/lib/generators/templates/app/assets/stylesheets/themes/default/style.css +0 -74
  87. data/lib/generators/templates/app/assets/stylesheets/timepicker.css +0 -89
  88. data/lib/generators/templates/app/views/partials/_register_form.html.erb +0 -44
  89. data/lib/generators/templates/app/views/partials/_sign_in_form.html.erb +0 -18
  90. data/lib/generators/templates/app/views/partials/_sign_in_sign_out.html.erb +0 -19
  91. data/lib/generators/templates/lib/custom_failure.rb +0 -15
@@ -5,63 +5,63 @@
5
5
  <title>Beautiful Scaffold</title>
6
6
 
7
7
  <meta name="description" content="Beautiful Scaffold">
8
- <meta name="author" content="You or me Sylvain Claudel (http://blog.escarworld.com)">
8
+ <meta name="author" content="You or me Sylvain Claudel (https://blog.rivsc.ovh)">
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
10
 
11
- <%%= stylesheet_link_tag "application-bs" %>
12
- <%%= javascript_include_tag "application-bs" %>
11
+ <!--TODO remove cdn-->
12
+ <script src="https://unpkg.com/driver.js/dist/driver.min.js"></script>
13
+ <link rel="stylesheet" href="https://unpkg.com/driver.js/dist/driver.min.css">
14
+
15
+ <%%= stylesheet_link_tag "<%= engine_name %>application-bs" %>
16
+ <%%= javascript_include_tag "<%= engine_name %>application-bs" %>
13
17
 
14
18
  <%%= csrf_meta_tags %>
15
19
  <%%= yield :head %>
16
20
  </head>
17
- <body style="display:none;">
18
- <div class="navbar navbar-default navbar-fixed-top">
19
- <div class="container">
20
- <div class="navbar-header">
21
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
22
- <span class="sr-only">Toggle navigation</span>
23
- <i class="fa fa-bars"></i>
24
- </button>
25
- <a class="navbar-brand" href="#">
26
- Beautiful-Scaffold
27
- </a>
28
- </div>
29
- <div class="navbar-collapse collapse">
30
- <ul class="nav navbar-nav">
31
- <li class="active"><a href="/">Home</a></li>
32
- <%%= render :partial => "layouts/beautiful_menu" %>
33
- </ul>
34
- <ul class="nav navbar-nav pull-right">
35
- <li>
36
- <!-- Beautiful_scaffold - Signin - Do not remove -->
37
- </li>
38
- </ul>
39
- </div>
21
+ <body>
22
+ <div class="navbar navbar-expand-md navbar-dark bg-dark">
23
+ <div class="navbar-header">
24
+ <a class="navbar-brand" href="#">
25
+ Beautiful-Scaffold
26
+ </a>
27
+ <button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse">
28
+ <span class="navbar-toggler-icon"></span>
29
+ </button>
30
+ </div>
31
+ <div class="navbar-collapse collapse">
32
+ <nav class="nav navbar-nav">
33
+ <a href="/" class="nav-link">Home</a>
34
+ <%%= render :partial => "layouts/beautiful_menu" %>
35
+ <!-- Beautiful_scaffold - Signin - Do not remove -->
36
+ </nav>
37
+ <i class="fa fa-question-circle text-white float-right" id="bs-help"></i>
40
38
  </div>
41
39
  </div>
42
40
  <div class="container-fluid">
43
41
  <div class="row">
44
- <div class="col-md-2">
45
- <ul class="nav nav-pills nav-stacked">
46
- <%%= render :partial => "layouts/beautiful_menu" %>
47
- </ul>
48
- </div>
49
- <div class="col-md-10">
50
- <%% if not flash[:notice].blank? then %>
42
+ <div class="col-md filler">
43
+ <%% if !flash[:notice].blank? %>
51
44
  <div class="alert alert-info">
52
45
  <a class="close" data-dismiss="alert" href="#">×</a>
53
46
  <h4 class="alert-heading">Info : </h4>
54
47
  <%%= flash[:notice] %>
55
48
  </div>
56
49
  <%% end %>
57
- <%% if not flash[:error].blank? then %>
50
+ <%% if !flash[:alert].blank? %>
51
+ <div class="alert alert-warning">
52
+ <a class="close" data-dismiss="alert" href="#">×</a>
53
+ <h4 class="alert-heading">Warning : </h4>
54
+ <%%= flash[:alert] %>
55
+ </div>
56
+ <%% end %>
57
+ <%% if !flash[:error].blank? %>
58
58
  <div class="alert alert-danger">
59
59
  <a class="close" data-dismiss="alert" href="#">×</a>
60
60
  <h4 class="alert-heading">Error : </h4>
61
61
  <%%= flash[:error] %>
62
62
  </div>
63
63
  <%% end %>
64
- <div>
64
+ <div class="mt-2">
65
65
  <%%= yield %>
66
66
  </div>
67
67
  </div>
@@ -76,20 +76,9 @@
76
76
  <!-- Beautiful_scaffold - Modal - Do not remove -->
77
77
 
78
78
  <script type="text/javascript">
79
- <%% if not @opened_modal.blank? then %>
79
+ <%% if !@opened_modal.blank? %>
80
80
  $('<%%= @opened_modal %>').modal('show');
81
81
  <%% end %>
82
82
  </script>
83
- <script type="text/javascript">
84
- ;(function($){
85
- $.fn.datepicker.dates['<%%= I18n.locale.to_s %>'] = {
86
- days: <%%= (t("date.day_names") + [t("date.day_names").first]).map(&:capitalize).to_s.html_safe %>,
87
- daysShort: <%%= (t("date.abbr_day_names") + [t("date.abbr_day_names").first]).map(&:capitalize).to_s.html_safe %>,
88
- daysMin: <%%= (t("date.abbr_day_names") + [t("date.abbr_day_names").first]).map{ |d| d.capitalize[0..2] }.to_s.html_safe %>,
89
- months: <%%= t("date.month_names")[1..12].map(&:capitalize).to_s.html_safe %>,
90
- monthsShort: <%%= t("date.abbr_month_names")[1..12].map(&:capitalize).to_s.html_safe %>
91
- };
92
- }(jQuery));
93
- </script>
94
83
  </body>
95
84
  </html>
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h1> Welcome <%= @user.email %> </h1>
8
+ <p>
9
+ You have successfully signed up to www.example.com, and your username is: <%= @user.email %>.
10
+ </p>
11
+ <p>
12
+ To login to the site, just follow this link: <%= @url %> .
13
+ </p>
14
+ <p>Thanks for joining and have a great day!</p>
15
+ </body>
16
+ </html>
@@ -0,0 +1,9 @@
1
+ Welcome to example.com, <%= @user.email %>
2
+ ===============================================
3
+
4
+ You have successfully signed up to example.com,
5
+ your username is: <%= @user.email %>.
6
+
7
+ To login to the site, just follow this link: <%= @url %> .
8
+
9
+ Thanks for joining and have a great day!
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h1>Bienvenue <%= @user.email %> </h1>
8
+ <p>
9
+ Vous vous êtes inscrit à www.example.com, votre identifiant est : <%= @user.email %>.
10
+ </p>
11
+ <p>
12
+ Pour activer votre compte, veuillez cliquer sur ce lien : <%= @url %> .
13
+ </p>
14
+ <p>Merci d'avoir créé votre compte, bonne journée !</p>
15
+ </body>
16
+ </html>
@@ -0,0 +1,8 @@
1
+ Bienvenue, <%= @user.email %>
2
+ ===============================================
3
+
4
+ Vous vous êtes inscrit à www.example.com, votre identifiant est : <%= @user.email %>.
5
+
6
+ Pour activer votre compte, veuillez cliquer sur ce lien : <%= @url %> .
7
+
8
+ Merci d'avoir créé votre compte, bonne journée !
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h1>Congratulations, <%= @user.email %>!</h1>
8
+ <p>
9
+ You have successfully activated your example.com account,
10
+ your username is: <%= @user.email %>.
11
+ </p>
12
+ <p>
13
+ To login to the site, just follow this link: <%= @url %>.
14
+ </p>
15
+ <p>
16
+ Thanks for joining and have a great day!
17
+ </p>
18
+ </body>
19
+ </html>
@@ -0,0 +1,8 @@
1
+ Congratulations, <%= @user.email %>!
2
+
3
+ You have successfully activated your example.com account,
4
+ your username is: <%= @user.email %>.
5
+
6
+ To login to the site, just follow this link: <%= @url %>.
7
+
8
+ Thanks for joining and have a great day!
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h1>Félicitations <%= @user.email %>!</h1>
8
+ <p>
9
+ Vous avez activé votre compte sur www.example.com avec succès,
10
+ Votre identifiant est : <%= @user.email %>.
11
+ </p>
12
+ <p>
13
+ Pour ce connecter sur le site, veuillez suivre ce lien : <%= @url %>.
14
+ </p>
15
+ <p>
16
+ Merci de vous être inscrit, bonne journée !
17
+ </p>
18
+ </body>
19
+ </html>
@@ -0,0 +1,8 @@
1
+ Félicitations <%= @user.email %>!
2
+
3
+ Vous avez activé votre compte sur www.example.com avec succès,
4
+ Votre identifiant est : <%= @user.email %>.
5
+
6
+ Pour ce connecter sur le site, veuillez suivre ce lien : <%= @url %>.
7
+
8
+ Merci de vous être inscrit, bonne journée !
@@ -0,0 +1,15 @@
1
+ <%= form_with url: user_sessions_path, method: :post do |f| %>
2
+ <div class="form-group">
3
+ <%= f.label :email, :class => "control-label" %><br />
4
+ <%= f.text_field :email, :class => "form-control" %>
5
+ </div>
6
+ <div class="form-group">
7
+ <%= f.label :password, :class => "control-label" %><br />
8
+ <%= f.password_field :password, :class => "form-control" %>
9
+ </div>
10
+ <div>
11
+ <%= link_to t(:back, :default => 'Back'), users_path, :class => "btn btn-light" %>
12
+ <%= f.submit :class => "btn btn-primary", :data => { :disable_with => t(:saving, :default => "Saving...") } %>
13
+ </div>
14
+ <% end %>
15
+
@@ -0,0 +1,3 @@
1
+ <h2><%= t(:login, :default => 'Login') %></h2>
2
+
3
+ <%= render 'form' %>
@@ -1,5 +1,3 @@
1
1
  <h2><%%= t(:new, :default => 'New') %> <%%= <%= i18n_t_m(singular_table_name) %> %></h2>
2
2
 
3
3
  <%%= render 'form' %>
4
-
5
- <%%= link_to t(:back, :default => "Back"), <%= namespace_for_route %><%= plural_table_name %>_path, :class => "btn btn-default" %>
@@ -2,8 +2,8 @@
2
2
  <div class="modal-dialog">
3
3
  <div class="modal-content">
4
4
  <div class="modal-header">
5
+ <h5 class="modal-title"><%%= t(:forgot_password, :default => "Forgot password") %></h5>
5
6
  <button type="button" class="close" data-dismiss="modal">×</button>
6
- <h3><%%= t(:forgot_password, :default => "Forgot password") %></h3>
7
7
  </div>
8
8
  <div class="modal-body">
9
9
  <%%= form_for('<%= model %>', :as => '<%= model %>', :url => password_path('<%= model %>'), :html => { :method => :post, :class => "form-horizontal" }) do |f| %>
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  <div class="form-group">
17
17
  <div>
18
- <%%= f.submit t(:send_me_reset_password_instructions, :default => "Send me reset password instructions"), :class => 'btn btn-default' %>
18
+ <%%= f.submit t(:send_me_reset_password_instructions, :default => "Send me reset password instructions"), :class => 'btn btn-light' %>
19
19
  </div>
20
20
  </div>
21
21
  <%% end %>
@@ -1,23 +1,23 @@
1
1
  <%- attributes.each do |attribute| -%>
2
- <%- if @beautiful_attributes.include?(attribute.name + ':wysiwyg') then -%>
2
+ <%- if @beautiful_attributes.include?(attribute.name + ':wysiwyg') -%>
3
3
  <div class="form-group">
4
4
  <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
5
5
  <%%= f.text_area :<%= attribute.name %>, :class => "wysiwyg-editor form-control" %>
6
6
  </div>
7
7
  <%%= f.hidden_field :<%= attribute.name %>_typetext, :value => "html" %>
8
- <%- elsif @beautiful_attributes.include?(attribute.name + ':references') then -%>
8
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':references') -%>
9
9
  <div class="form-group">
10
10
  <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
11
- <%%= f.collection_select :<%= attribute.name %>_id, <%= attribute.name.camelcase %>.all, :id, :caption, { :include_blank => true }, { :class => "form-control" } %>
11
+ <%%= f.collection_select :<%= attribute.name %>_id, <%= engine_camel.present? ? "#{engine_camel}::" : '' %><%= attribute.name.camelcase %>.all, :id, :caption, { :include_blank => true }, { :class => "form-control" } %>
12
12
  </div>
13
- <%- elsif @beautiful_attributes.include?(attribute.name + ':price') then -%>
13
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':price') -%>
14
14
  <div class="form-group">
15
15
  <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
16
16
  <div class="input-group">
17
17
  <span class="input-group-addon">$</span><%%= f.<%= attribute.field_type %> :<%= attribute.name %>, :class => "form-control" %>
18
18
  </div>
19
19
  </div>
20
- <%- elsif @beautiful_attributes.include?(attribute.name + ':date') then -%>
20
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':date') -%>
21
21
  <div class="form-group">
22
22
  <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
23
23
  <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(3i)]" id="<%= singular_table_name %>_<%= attribute.name %>_3i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.day rescue "" end %>" />
@@ -27,7 +27,7 @@
27
27
  <%%= f.text_field :<%= attribute.name %>, :value => (begin @<%= singular_table_name %>.<%= attribute.name %>.strftime("%d/%m/%Y") rescue "" end), :class => "dpicker form-control" %><span class="input-group-addon"><i class="fa fa-calendar"></i></span>
28
28
  </div>
29
29
  </div>
30
- <%- elsif @beautiful_attributes.include?(attribute.name + ':datetime') then -%>
30
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':datetime') -%>
31
31
  <div class="form-group">
32
32
  <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
33
33
  <input type="hidden" name="<%= singular_table_name %>[<%= attribute.name %>(3i)]" id="<%= singular_table_name %>_<%= attribute.name %>_3i" value="<%%= begin @<%= singular_table_name %>.<%= attribute.name %>.day rescue "" end %>" />
@@ -42,7 +42,7 @@
42
42
  <%%= f.text_field :<%= attribute.name %>, :value => (begin @<%= singular_table_name %>.<%= attribute.name %>.strftime("%H:%M") rescue "" end), :class => "tpicker form-control" %><span class="input-group-addon"><i class="fa fa-clock-o"></i></span>
43
43
  </div>
44
44
  </div>
45
- <%- elsif @beautiful_attributes.include?(attribute.name + ':color') then -%>
45
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':color') -%>
46
46
  <div class="form-group">
47
47
  <%%= f.label :<%= attribute.name %>, <%= i18n_t_a(singular_table_name, attribute.name) %>.capitalize, :class => "control-label" %>
48
48
  <div class="input-group color" data-color="<%%= (@<%= model %>.<%= attribute.name %> || "rgba(0, 0, 0)") %>" data-color-format="rgba">
@@ -1,5 +1,5 @@
1
1
  <%- attributes.each{ |attribute| -%>
2
- <%- if attribute.type.to_s == "boolean" then -%>
2
+ <%- if attribute.type.to_s == "boolean" -%>
3
3
  <option value="<%= attribute.name %>.true"><%%= t(:settrueforattr, :attr => "'<%= attribute.name %>'", :default => "Set <%= attribute.name %> to true") %></option>
4
4
  <option value="<%= attribute.name %>.false"><%%= t(:setfalseforattr, :attr => "'<%= attribute.name %>'", :default => "Set <%= attribute.name %> to false") %></option>
5
5
  <%- end -%>
@@ -1,11 +1,11 @@
1
1
  <%- attributes.each do |attribute| -%>
2
2
  <td <%%= visible_column("<%= singular_table_name %>", "<%= attribute.name %>") %> class="bs-col-<%= attribute.name %> <%%= align_attribute("<%= attribute.type %>") %>">
3
- <%- if @beautiful_attributes.include?(attribute.name + ':price') then -%>
3
+ <%- if @beautiful_attributes.include?(attribute.name + ':price') -%>
4
4
  <%%= number_to_currency(<%= singular_table_name %>.<%= attribute.name %>, :locale => I18n.locale) %>
5
- <%- elsif @beautiful_attributes.include?(attribute.name + ':boolean') then -%>
5
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':boolean') -%>
6
6
  <%%= t((<%= singular_table_name %>.<%= attribute.name %> ? "yes" : "no").to_sym) %>
7
- <%- elsif @beautiful_attributes.include?(attribute.name + ':references') then -%>
8
- <%% if not <%= singular_table_name %>.<%= attribute.name %>_id.nil? then %>
7
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':references') -%>
8
+ <%% if !<%= singular_table_name %>.<%= attribute.name %>_id.nil? %>
9
9
  <%%= link_to <%= singular_table_name %>.<%= attribute.name %>.caption, <%= namespace_for_route %><%= attribute.name %>_path(<%= singular_table_name %>.<%= attribute.name %>_id) %>
10
10
  <%% else %>
11
11
  <%%= t(:any, :default => "Any") %>
@@ -1,7 +1,7 @@
1
1
  <%- attributes.each do |attribute| -%>
2
2
  <th <%%= visible_column("<%= singular_table_name %>", "<%= attribute.name %>") %> class="bs-col-<%= attribute.name %>">
3
3
  <%- id_or_not = "" -%>
4
- <%- if @beautiful_attributes.include?(attribute.name + ':references') then -%>
4
+ <%- if @beautiful_attributes.include?(attribute.name + ':references') -%>
5
5
  <%- id_or_not = "_id" -%>
6
6
  <%- end -%>
7
7
  <%%= sorting_header("<%= singular_table_name %>", "<%= attribute.name %><%= id_or_not %>", "<%= namespace_alone %>") %>
@@ -2,8 +2,8 @@
2
2
  <%- next if @beautiful_attributes.include?(a.name + ':color') -%>
3
3
  <%- attribute = "" -%>
4
4
  <%- caption = a.name.capitalize -%>
5
- <%- if @beautiful_attributes.include?(a.name + ':references') then -%>
5
+ <%- if @beautiful_attributes.include?(a.name + ':references') -%>
6
6
  <%- attribute = "_id" -%>
7
7
  <%- end -%>
8
- <%%= ransack_field("<%= singular_table_name %>", "<%= a.name %><%= attribute %>", f, "<%= caption %>") %>
8
+ <%%= ransack_field("<%= singular_table_name %>", "<%= a.name %><%= attribute %>", f, "<%= caption %>"<%= (engine_name.blank? ? '' : ", \"#{engine_opt}\"") %>) %>
9
9
  <%- end -%>
@@ -1,3 +1,3 @@
1
1
  <%- { :created_at => "Created At", :updated_at => "Updated At", :id => "Id" }.each{ |k,v| -%>
2
- <%%= ransack_field("<%= singular_table_name %>", "<%= k.to_s %>", f, "<%= v %>") %>
2
+ <%%= ransack_field("<%= singular_table_name %>", "<%= k.to_s %>", f, "<%= v %>"<%= (engine_name.blank? ? '' : ", \"#{engine_opt}\"") %>) %>
3
3
  <%- } -%>
@@ -0,0 +1,7 @@
1
+ <% if current_user %>
2
+ <%= link_to "Edit Profile", edit_user_path(current_user.id), class: "nav-link" %>
3
+ <%= link_to "Logout", :logout, method: :post, class: "nav-link" %>
4
+ <% else %>
5
+ <%= link_to "Register", new_user_path, class: "nav-link" %>
6
+ <%= link_to "Login", :login, class: "nav-link" %>
7
+ <% end %>
@@ -1,11 +1,11 @@
1
1
  <%- attributes.each do |attribute| -%>
2
2
  <p>
3
3
  <b><%%= <%= i18n_t_a(singular_table_name, attribute.name) %> %>:</b>
4
- <%- if @beautiful_attributes.include?(attribute.name + ':price') then -%>
4
+ <%- if @beautiful_attributes.include?(attribute.name + ':price') -%>
5
5
  <%%= number_to_currency(@<%= singular_table_name %>.<%= attribute.name %>) %>
6
- <%- elsif @beautiful_attributes.include?(attribute.name + ':boolean') then -%>
6
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':boolean') -%>
7
7
  <%%= t((@<%= singular_table_name %>.<%= attribute.name %> ? "yes".to_sym : "no".to_sym)) %>
8
- <%- elsif @beautiful_attributes.include?(attribute.name + ':references') then -%>
8
+ <%- elsif @beautiful_attributes.include?(attribute.name + ':references') -%>
9
9
  <%%= (@<%= singular_table_name %>.<%= attribute.name %>.nil? ? "" : @<%= singular_table_name %>.<%= attribute.name %>.caption) %>
10
10
  <%- else -%>
11
11
  <%%= @<%= singular_table_name %>.<%= attribute.name %> %>
@@ -3,6 +3,6 @@
3
3
  <%= render_partial 'app/views/partials/_show_field.html.erb' %>
4
4
  <!-- Beautiful_scaffold - AddField - Field - Do not remove -->
5
5
 
6
- <%%= link_to t(:edit, :default => "Edit"), edit_<%= namespace_for_route %><%= singular_table_name %>_path(@<%= singular_table_name %>), :class => "btn btn-default" %>
7
- <%%= link_to t(:back, :default => "Back"), <%= namespace_for_route %><%= plural_table_name %>_path, :class => "btn btn-default" %>
6
+ <%%= link_to t(:edit, :default => "Edit"), edit_<%= namespace_for_route %><%= singular_table_name %>_path(@<%= singular_table_name %>), :class => "btn btn-light" %>
7
+ <%%= link_to t(:back, :default => "Back"), <%= namespace_for_route %><%= plural_table_name %>_path, :class => "btn btn-light" %>
8
8
 
@@ -1,17 +1,20 @@
1
1
  <h2><%%= t(:treeview, :default => 'Treeview') %> <%%= <%= i18n_t_m(singular_table_name) %> %></h2>
2
2
 
3
+ <% engine_or_empty = (engine_camel.present? ? "#{engine_camel}::" : '') %>
4
+
3
5
  <%%
6
+ engine_name = "<%= engine_name %>"
4
7
  namespace_for_url = "<%= namespace_for_url %>"
5
8
  plural_model_name = "<%= model_pluralize %>"
6
9
  model_name = "<%= singular_table_name %>"
7
- opened_node = <%= model_camelize %>.select(:id).all.map{ |g| "'treeelt_" + g.id.to_s + "'" }.join(',').html_safe
10
+ opened_node = <%= engine_or_empty %><%= model_camelize %>.select(:id).all.map{ |g| "'treeelt_" + g.id.to_s + "'" }.join(',').html_safe
8
11
  %>
9
12
 
10
- <div id="treeview" data-model="<%%= model_name %>" data-url="/<%%= namespace_for_url %><%%= plural_model_name %>/" data-opened="[<%%= opened_node %>]">
13
+ <div id="treeview" data-model="<%%= model_name %>" data-url="/<%%= engine_name %><%%= namespace_for_url %><%%= plural_model_name %>/" data-opened="[<%%= opened_node %>]">
11
14
  <ul>
12
- <%% <%= model_camelize %>.transaction do %>
13
- <%% ar = <%= model_camelize %>.where(:<%= model %>_id => nil) %>
14
- <%% ar = ar.order("position") if <%= model_camelize %>.column_names.include?("position") %>
15
+ <%% <%= engine_or_empty %><%= model_camelize %>.transaction do %>
16
+ <%% ar = <%= engine_or_empty %><%= model_camelize %>.where(:<%= model %>_id => nil) %>
17
+ <%% ar = ar.order("position") if <%= engine_or_empty %><%= model_camelize %>.column_names.include?("position") %>
15
18
  <%% for g in ar.all %>
16
19
  <%%= build_treeview(g, '<%= model_pluralize %>') %>
17
20
  <%% end %>