beautiful_scaffold 0.3.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +2 -0
- data/.gitignore +2 -0
- data/CHANGELOG +68 -1
- data/Gemfile +24 -17
- data/README.rdoc +56 -44
- data/Rakefile +29 -0
- data/beautiful_scaffold.gemspec +8 -7
- data/lib/beautiful_scaffold/version.rb +3 -0
- data/lib/generators/beautiful_devisecancan_generator.rb +1 -1
- data/lib/generators/beautiful_jointable_generator.rb +40 -7
- data/lib/generators/beautiful_locale_generator.rb +102 -80
- data/lib/generators/beautiful_migration_generator.rb +14 -20
- data/lib/generators/beautiful_scaffold_common_methods.rb +88 -29
- data/lib/generators/beautiful_scaffold_generator.rb +166 -111
- data/lib/generators/templates/app/assets/javascripts/application-bs.js +11 -19
- data/lib/generators/templates/app/assets/javascripts/beautiful_scaffold.js +68 -78
- data/lib/generators/templates/app/assets/javascripts/bootstrap-datetimepicker-for-beautiful-scaffold.js +23 -42
- data/lib/generators/templates/app/assets/javascripts/fixed_menu.js +3 -1
- data/lib/generators/templates/app/assets/javascripts/jstree.min.js +6 -0
- data/lib/generators/templates/app/assets/stylesheets/application-bs.css +14 -12
- data/lib/generators/templates/app/assets/stylesheets/beautiful-scaffold.css.scss +38 -3
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/32px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/40px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/style.scss +1146 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default-dark/throbber.gif +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/32px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/40px.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/style.scss +1102 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/throbber.gif +0 -0
- data/lib/generators/templates/app/controllers/base.rb +31 -14
- data/lib/generators/templates/app/controllers/master_base.rb +55 -47
- data/lib/generators/templates/app/helpers/beautiful_helper.rb +123 -72
- data/lib/generators/templates/app/helpers/model_helper.rb +14 -3
- data/lib/generators/templates/app/initializers/link_renderer.rb +24 -17
- data/lib/generators/templates/app/initializers/ransack.rb +16 -0
- data/lib/generators/templates/app/locales/beautiful_scaffold.ja.yml +50 -0
- data/lib/generators/templates/app/models/concerns/fulltext_concern.rb +10 -10
- data/lib/generators/templates/app/views/_form.html.erb +4 -1
- data/lib/generators/templates/app/views/_form_habtm_tag.html.erb +6 -2
- data/lib/generators/templates/app/views/_mass_inserting.html.erb +40 -31
- data/lib/generators/templates/app/views/_modal_columns.html.erb +4 -4
- data/lib/generators/templates/app/views/edit.html.erb +1 -3
- data/lib/generators/templates/app/views/index.html.erb +84 -58
- data/lib/generators/templates/app/views/layout.html.erb +29 -47
- data/lib/generators/templates/app/views/new.html.erb +0 -2
- data/lib/generators/templates/app/views/partials/_forget_password.html.erb +2 -2
- data/lib/generators/templates/app/views/partials/_form_field.html.erb +7 -33
- data/lib/generators/templates/app/views/partials/_index_batch.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_index_column.html.erb +4 -6
- data/lib/generators/templates/app/views/partials/_index_header.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_index_search.html.erb +2 -4
- data/lib/generators/templates/app/views/partials/_index_search_default_fields.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_register_form.html.erb +2 -2
- data/lib/generators/templates/app/views/partials/_show_field.html.erb +3 -3
- data/lib/generators/templates/app/views/partials/_sign_in_form.html.erb +1 -1
- data/lib/generators/templates/app/views/partials/_sign_in_sign_out.html.erb +2 -2
- data/lib/generators/templates/app/views/show.html.erb +2 -2
- data/lib/generators/templates/app/views/treeview.html.erb +8 -5
- metadata +41 -187
- data/lib/generators/templates/app/assets/javascripts/bootstrap-datepicker.js +0 -834
- data/lib/generators/templates/app/assets/javascripts/bootstrap-timepicker.js +0 -797
- data/lib/generators/templates/app/assets/javascripts/jquery.jstree.js +0 -4551
- data/lib/generators/templates/app/assets/javascripts/jquery.livequery.js +0 -226
- data/lib/generators/templates/app/assets/stylesheets/bootstrap_and_overrides.css.less +0 -40
- data/lib/generators/templates/app/assets/stylesheets/datepicker.css +0 -224
- data/lib/generators/templates/app/assets/stylesheets/reset.css +0 -48
- data/lib/generators/templates/app/assets/stylesheets/themes/default/d.gif +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/d.png +0 -0
- data/lib/generators/templates/app/assets/stylesheets/themes/default/style.css +0 -74
- data/lib/generators/templates/app/assets/stylesheets/timepicker.css +0 -89
- data/lib/generators/templates/markitup/jquery.markitup.js +0 -593
- data/lib/generators/templates/markitup/sets/bbcode/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/clean.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/fonts.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/list-item.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/images/underline.png +0 -0
- data/lib/generators/templates/markitup/sets/bbcode/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/bbcode/set.js +0 -39
- data/lib/generators/templates/markitup/sets/bbcode/style.css +0 -47
- data/lib/generators/templates/markitup/sets/default/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/clean.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/image.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/default/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/default/set.js +0 -30
- data/lib/generators/templates/markitup/sets/default/style.css +0 -34
- data/lib/generators/templates/markitup/sets/html/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/clean.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/image.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/list-item.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/paragraph.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/html/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/html/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/html/set.js +0 -39
- data/lib/generators/templates/markitup/sets/html/style.css +0 -59
- data/lib/generators/templates/markitup/sets/markdown/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/markdown/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/markdown/set.js +0 -52
- data/lib/generators/templates/markitup/sets/markdown/style.css +0 -54
- data/lib/generators/templates/markitup/sets/textile/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/paragraph.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/textile/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/textile/set.js +0 -40
- data/lib/generators/templates/markitup/sets/textile/style.css +0 -60
- data/lib/generators/templates/markitup/sets/wiki/images/bold.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/code.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h1.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h2.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h3.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h4.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h5.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/h6.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/italic.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/link.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/list-bullet.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/list-numeric.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/picture.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/preview.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/quotes.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/stroke.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/images/url.png +0 -0
- data/lib/generators/templates/markitup/sets/wiki/readme.txt +0 -11
- data/lib/generators/templates/markitup/sets/wiki/set.js +0 -37
- data/lib/generators/templates/markitup/sets/wiki/style.css +0 -57
- data/lib/generators/templates/markitup/skins/markitup/images/bg-container.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-bbcode.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-dotclear.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-html.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-json.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-markdown.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-textile.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-wiki.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor-xml.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/bg-editor.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/handle.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/menu.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/images/submenu.png +0 -0
- data/lib/generators/templates/markitup/skins/markitup/style.css +0 -147
- data/lib/generators/templates/markitup/skins/simple/images/handle.png +0 -0
- data/lib/generators/templates/markitup/skins/simple/images/menu.png +0 -0
- data/lib/generators/templates/markitup/skins/simple/images/submenu.png +0 -0
- data/lib/generators/templates/markitup/skins/simple/style.css +0 -118
- data/lib/generators/templates/markitup/templates/preview.css +0 -5
- data/lib/generators/templates/markitup/templates/preview.html +0 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d1fe3aee750d2046a19d5f956820fb36e03a49ecac78cef8046d75e573e44e5e
|
4
|
+
data.tar.gz: aa521359c646d5171eeb3981f67ba5c7138ef9f422f2f88856e04280acc4b434
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a3816f89d26548eccf73546dd698a3606f739bd1637e70fc53b19eaa27e7455ce61ea65a18fdc504ec8a8bea5f24dfd2d3bf6d030480c84f077e427d1481a447
|
7
|
+
data.tar.gz: 1256a2a3b5534405148fb3a0f9f2c3a404703e4ea2ff521887e8bb5f61c6937da8793a69fcfa8e4a584c131cd6af44c9d14c8bc8886b0daf97bfb54be4f98ebe
|
data/.gitattributes
ADDED
data/.gitignore
ADDED
data/CHANGELOG
CHANGED
@@ -1,3 +1,70 @@
|
|
1
|
+
== master
|
2
|
+
|
3
|
+
* enhancement
|
4
|
+
|
5
|
+
* bugfix
|
6
|
+
|
7
|
+
== 2.0.0
|
8
|
+
|
9
|
+
* enhancement
|
10
|
+
* Bootstrap 4.5 for search field.
|
11
|
+
|
12
|
+
* bugfix
|
13
|
+
* Beautiful migration & Rails 6 (fix #23)
|
14
|
+
|
15
|
+
== 2.0.0.pre
|
16
|
+
|
17
|
+
* enhancement
|
18
|
+
* replace chardinjs by driverjs : https://github.com/kamranahmedse/driver.js
|
19
|
+
* replace bootstrapdatetimepicker by https://tempusdominus.github.io/bootstrap-4/Usage/
|
20
|
+
* Update JStreeview
|
21
|
+
* Update Bootstrap 4.2
|
22
|
+
* Update FontAwesome 5
|
23
|
+
* Generate beautiful scaffold for mountable engine
|
24
|
+
* Tests generators works !
|
25
|
+
* Refactoring ruby code.
|
26
|
+
|
27
|
+
* bugfix
|
28
|
+
* Bugfix for engine
|
29
|
+
|
30
|
+
== 1.0.3
|
31
|
+
|
32
|
+
* enhancement
|
33
|
+
* You can generate scaffold in a mountable engine, now. (see README for syntax)
|
34
|
+
|
35
|
+
* Bugfix
|
36
|
+
* I18n translation default value (model.column).
|
37
|
+
|
38
|
+
== 1.0.2
|
39
|
+
|
40
|
+
* enhancement
|
41
|
+
* Using static twitter bootstrap files
|
42
|
+
* UI : button back & submit on the same line
|
43
|
+
* Add tests (better late than never :/)
|
44
|
+
|
45
|
+
* bugfix
|
46
|
+
* Fix #18 : Responsive Theme Navbar Overlaps Content When Resizing Below ~979px
|
47
|
+
* Fix generator locales
|
48
|
+
* Fix icon datetimepicker
|
49
|
+
* render nothing: true replace with head :ok
|
50
|
+
|
51
|
+
== 1.0.1
|
52
|
+
|
53
|
+
* enhancement
|
54
|
+
* Change datetimepicker (eyecon.ro -> eonasdan)
|
55
|
+
* Support CamelCase syntaxe for models.
|
56
|
+
|
57
|
+
* bugfix
|
58
|
+
* Change keys symbol into string on session (begin at 0.3.5)
|
59
|
+
|
60
|
+
== 1.0.0.pre
|
61
|
+
|
62
|
+
* enhancement
|
63
|
+
* Remove Markitup
|
64
|
+
* Remove Livequery
|
65
|
+
* Compatibility Rails 5
|
66
|
+
* Update gem (prawn, ransack, willpaginate)
|
67
|
+
|
1
68
|
== 0.3.6
|
2
69
|
|
3
70
|
* enhancement
|
@@ -166,4 +233,4 @@
|
|
166
233
|
|
167
234
|
== Previous versions
|
168
235
|
|
169
|
-
* See commits on github
|
236
|
+
* See commits on github
|
data/Gemfile
CHANGED
@@ -2,20 +2,27 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem "rails", "~>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
#
|
13
|
-
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
5
|
+
gem "rails", "~> 6.0"
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem 'sqlite3'
|
9
|
+
|
10
|
+
gems = {
|
11
|
+
'will_paginate' => nil, # v 3.1.5
|
12
|
+
'ransack' => nil, #'2.3.2',
|
13
|
+
'jquery-ui-rails' => nil,
|
14
|
+
'prawn' => nil, #'2.1.0',
|
15
|
+
'prawn-table' => nil, #'0.2.2',
|
16
|
+
'sanitize' => nil,
|
17
|
+
'bootstrap' => '~> 4.3.1',
|
18
|
+
'font-awesome-rails' => '4.7.0.5',
|
19
|
+
'momentjs-rails' => '>= 2.9.0',
|
20
|
+
'bootstrap4-datetime-picker-rails' => nil,
|
21
|
+
'jquery-rails' => '4.3.1'
|
22
|
+
}
|
23
|
+
|
24
|
+
gems.each{ |gem_to_add, version|
|
25
|
+
gem(gem_to_add, version)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
data/README.rdoc
CHANGED
@@ -2,98 +2,110 @@
|
|
2
2
|
|
3
3
|
Beautiful Scaffold is a gem which propose generators for a complete scaffold with paginate, sort and filter.
|
4
4
|
Fully customizable.
|
5
|
-
|
6
|
-
Demo : http://
|
5
|
+
Info : https://github.com/rivsc/Beautiful-Scaffold
|
6
|
+
Demo : http://beautiful-scaffold.rivsc.ovh/
|
7
7
|
|
8
8
|
== Install
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
Add this in your Gemfile :
|
13
|
-
gem 'beautiful_scaffold', '0.3.4'
|
14
|
-
|
15
|
-
=== RubyOnRails 4.2
|
16
|
-
|
17
|
-
Add this in your Gemfile :
|
18
|
-
gem 'beautiful_scaffold', '0.3.5'
|
10
|
+
Add this in the Gemfile of your rails app or engine :
|
11
|
+
gem 'beautiful_scaffold'
|
19
12
|
|
20
13
|
=== Next
|
21
14
|
|
22
15
|
And run
|
23
|
-
|
16
|
+
|
17
|
+
bundle install
|
24
18
|
|
25
19
|
== Usage
|
26
20
|
|
27
21
|
=== Scaffold
|
28
22
|
|
29
|
-
|
23
|
+
# model : underscore and singular
|
24
|
+
# mountable_engine : underscore
|
25
|
+
# namespace : underscore
|
26
|
+
rails generate beautiful_scaffold model attr:type attr:type... [--namespace=name] [--donttouchgem=yes] [--mountable_engine=name]
|
30
27
|
|
31
|
-
|
28
|
+
Types available:
|
32
29
|
* integer
|
33
30
|
* float
|
34
31
|
* text
|
35
32
|
* string
|
36
33
|
* price
|
37
34
|
* color
|
38
|
-
* richtext
|
39
35
|
* wysiwyg
|
40
36
|
|
37
|
+
(See below #label-Barcodes)
|
38
|
+
|
41
39
|
# Example : products
|
42
|
-
|
40
|
+
|
41
|
+
rails g beautiful_scaffold product name:string price:price tva:float description:wysiwyg visible:boolean && rake db:migrate
|
43
42
|
|
44
43
|
# Example : admin products
|
45
|
-
|
44
|
+
|
45
|
+
rails g beautiful_scaffold product name:string price:price tva:float description:wysiwyg overview_description:wysiwyg visible:boolean --namespace=admin && rake db:migrate
|
46
|
+
|
47
|
+
# Example (for an engine) :
|
48
|
+
# You need to add beautiful-scaffold to the gemfile of the engine (not the gemspec !).
|
49
|
+
|
50
|
+
rails g beautiful_scaffold user code:string --mountable-engine=faq
|
51
|
+
rails g beautiful_scaffold question title:string description:wysiwyg user:references resolved:boolean --mountable-engine=faq
|
52
|
+
rails g beautiful_scaffold answer description:wysiwyg user:references up:integer down:integer --mountable-engine=faq
|
53
|
+
rails g beautiful_migration AddPositionToFaqAnswers position:integer --mountable-engine=faq
|
54
|
+
rails g beautiful_jointable answer tag --mountable-engine=faq
|
46
55
|
|
47
56
|
=== Migration (Use Add[Field]To[ModelPluralize] syntax)
|
48
57
|
|
49
|
-
rails g beautiful_migration AddFieldToModels field:type
|
58
|
+
rails g beautiful_migration AddFieldToModels field:type
|
50
59
|
|
51
60
|
=== Locale (i18n) (Example)
|
52
61
|
|
53
|
-
Run rake db:migrate before
|
62
|
+
Run `rake db:migrate` before `rails g beautiful_locale` (to get lastest attribute translation)
|
54
63
|
|
55
|
-
rails g beautiful_locale all
|
56
|
-
rails g beautiful_locale en
|
57
|
-
rails g beautiful_locale fr
|
58
|
-
rails g beautiful_locale de
|
64
|
+
rails g beautiful_locale all
|
65
|
+
rails g beautiful_locale en
|
66
|
+
rails g beautiful_locale fr
|
67
|
+
rails g beautiful_locale de
|
59
68
|
|
60
69
|
=== Join Table (has_and_belongs_to_many relation)
|
61
70
|
|
62
|
-
rails g beautiful_jointable model1 model2
|
71
|
+
rails g beautiful_jointable model1 model2
|
63
72
|
|
73
|
+
TODO replace Devise by Sorcery & Cancan by Cancancan
|
64
74
|
=== Install et Configure Devise (authentification) and Cancan (authorization)
|
65
75
|
|
66
|
-
rails g beautiful_devisecancan model
|
76
|
+
rails g beautiful_devisecancan model
|
67
77
|
|
68
78
|
=== In views
|
69
79
|
|
70
80
|
==== Barcodes
|
71
81
|
|
72
82
|
Set code like this :
|
73
|
-
|
83
|
+
|
84
|
+
<span class="barcode" data-barcode="1234567890128" data-type-barcode="ean13"></span>
|
74
85
|
|
75
86
|
data-type-barcode can be :
|
76
87
|
|
77
|
-
codabar
|
78
|
-
code11 (code 11)
|
79
|
-
code39 (code 39)
|
80
|
-
code93 (code 93)
|
81
|
-
code128 (code 128)
|
82
|
-
ean8 (ean 8)
|
83
|
-
ean13 (ean 13)
|
84
|
-
std25 (standard 2 of 5 - industrial 2 of 5)
|
85
|
-
int25 (interleaved 2 of 5)
|
86
|
-
msi
|
87
|
-
datamatrix (ASCII + extended)
|
88
|
+
codabar
|
89
|
+
code11 (code 11)
|
90
|
+
code39 (code 39)
|
91
|
+
code93 (code 93)
|
92
|
+
code128 (code 128)
|
93
|
+
ean8 (ean 8)
|
94
|
+
ean13 (ean 13)
|
95
|
+
std25 (standard 2 of 5 - industrial 2 of 5)
|
96
|
+
int25 (interleaved 2 of 5)
|
97
|
+
msi
|
98
|
+
datamatrix (ASCII + extended)
|
99
|
+
|
100
|
+
==== Driverjs (overlay instructions)
|
101
|
+
|
102
|
+
Example : when you click on the #bs-help tag presentation tour display on screen !
|
88
103
|
|
89
|
-
|
104
|
+
If you want to add 'slide' :
|
90
105
|
|
91
|
-
|
92
|
-
<a href="#" class="bs-chardinjs" data-selector="#menu">Help Menu</a>
|
106
|
+
For add instruction to element, add this to your markup :
|
93
107
|
|
94
|
-
|
95
|
-
<a href="#" class="bs-chardinjs" data-selector="body">Help</a>
|
108
|
+
id="myunique-id-in-the-page" data-present-title="Title for the slide" data-present-description="Short description" data-present-order="1"
|
96
109
|
|
97
|
-
|
110
|
+
And Beautiful-Scaffold does the job !
|
98
111
|
|
99
|
-
For add instruction to element, read official documentation : https://github.com/heelhook/chardin.js#adding-data-for-the-instructions
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Beautiful-Scaffold'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
load 'rails/tasks/statistics.rake'
|
20
|
+
require 'bundler/gem_tasks'
|
21
|
+
require 'rake/testtask'
|
22
|
+
|
23
|
+
Rake::TestTask.new(:test) do |t|
|
24
|
+
t.libs << 'test'
|
25
|
+
t.pattern = 'test/**/*_test.rb'
|
26
|
+
t.verbose = false
|
27
|
+
end
|
28
|
+
|
29
|
+
task default: :test
|
data/beautiful_scaffold.gemspec
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
|
4
|
+
require "beautiful_scaffold/version"
|
5
|
+
|
4
6
|
Gem::Specification.new do |s|
|
5
7
|
s.name = "beautiful_scaffold"
|
6
|
-
s.version =
|
8
|
+
s.version = BeautifulScaffold::VERSION
|
7
9
|
s.platform = Gem::Platform::RUBY
|
8
10
|
s.summary = "Beautiful Scaffold generate fully customizable scaffold"
|
9
11
|
s.email = "claudel.sylvain@gmail.com"
|
10
|
-
s.homepage = "
|
11
|
-
s.description = "Beautiful Scaffold generate a complete scaffold (sort, export, paginate and filter data) http://
|
12
|
+
s.homepage = "https://blog.rivsc.ovh"
|
13
|
+
s.description = "Beautiful Scaffold generate a complete scaffold (sort, export, paginate and filter data) http://beautiful-scaffold.rivsc.ovh"
|
12
14
|
s.authors = ['Sylvain Claudel']
|
13
|
-
s.files = `git ls-files`.split("\n")
|
14
|
-
|
15
|
-
s.rubyforge_project = "beautiful_scaffold"
|
15
|
+
s.files = `git ls-files`.split("\n").reject{ |filepath| filepath.start_with? 'test/' }
|
16
|
+
s.licenses = ['MIT']
|
16
17
|
|
17
|
-
s.require_paths = ["lib","lib/generators"]
|
18
|
+
s.require_paths = ["lib","lib/generators","test/*"]
|
18
19
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding : utf-8
|
2
2
|
class BeautifulDevisecancanGenerator < Rails::Generators::Base
|
3
|
-
|
3
|
+
require_relative 'beautiful_scaffold_common_methods'
|
4
4
|
include BeautifulScaffoldCommonMethods
|
5
5
|
|
6
6
|
source_root File.expand_path('../templates', __FILE__)
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# encoding : utf-8
|
2
2
|
class BeautifulJointableGenerator < Rails::Generators::Base
|
3
|
-
|
3
|
+
require_relative 'beautiful_scaffold_common_methods'
|
4
4
|
include BeautifulScaffoldCommonMethods
|
5
5
|
|
6
6
|
source_root File.expand_path('../templates', __FILE__)
|
7
7
|
|
8
8
|
argument :join_models, :type => :array, :default => [], :banner => "model model"
|
9
|
+
|
10
|
+
class_option :mountable_engine, default: nil
|
9
11
|
|
10
12
|
def create_join_table
|
11
13
|
if join_models.length != 2 then
|
@@ -13,14 +15,21 @@ class BeautifulJointableGenerator < Rails::Generators::Base
|
|
13
15
|
else
|
14
16
|
sorted_model = join_models.sort
|
15
17
|
|
18
|
+
prefix_str = ''
|
19
|
+
if engine_name.present?
|
20
|
+
prefix_str = "#{engine_opt}_"
|
21
|
+
end
|
22
|
+
|
23
|
+
join_table_name = "#{prefix_str}#{sorted_model[0].pluralize}_#{sorted_model[1].pluralize}"
|
24
|
+
|
16
25
|
# Generate migration
|
17
26
|
migration_content = "
|
18
|
-
create_table :#{
|
27
|
+
create_table :#{join_table_name}, :id => false do |t|
|
19
28
|
t.integer :#{sorted_model[0]}_id
|
20
29
|
t.integer :#{sorted_model[1]}_id
|
21
30
|
end
|
22
31
|
|
23
|
-
add_index :#{
|
32
|
+
add_index :#{join_table_name}, [:#{sorted_model[0]}_id, :#{sorted_model[1]}_id]
|
24
33
|
"
|
25
34
|
|
26
35
|
migration_name = "create_join_table_for_#{sorted_model[0]}_and_#{sorted_model[1]}"
|
@@ -31,11 +40,35 @@ class BeautifulJointableGenerator < Rails::Generators::Base
|
|
31
40
|
inject_into_file(filename, migration_content, :after => "def change")
|
32
41
|
|
33
42
|
# Add habtm relation
|
34
|
-
inject_into_file("app/models/#{sorted_model[0]}.rb", "\n has_and_belongs_to_many :#{sorted_model[1].pluralize}", :after => "
|
35
|
-
inject_into_file("app/models/#{sorted_model[1]}.rb", "\n has_and_belongs_to_many :#{sorted_model[0].pluralize}", :after => "
|
36
|
-
inject_into_file("app/models/#{sorted_model[0]}.rb", ":#{sorted_model[1]}_ids, ", :after => "
|
37
|
-
|
43
|
+
inject_into_file("app/models/#{engine_name}#{sorted_model[0]}.rb", "\n #{engine_name.present? ? ' ' : ''}has_and_belongs_to_many :#{sorted_model[1].pluralize}", :after => "ApplicationRecord")
|
44
|
+
inject_into_file("app/models/#{engine_name}#{sorted_model[1]}.rb", "\n #{engine_name.present? ? ' ' : ''}has_and_belongs_to_many :#{sorted_model[0].pluralize}", :after => "ApplicationRecord")
|
45
|
+
inject_into_file("app/models/#{engine_name}#{sorted_model[0]}.rb", "{ :#{sorted_model[1]}_ids => [] }, ", :after => "permitted_attributes
|
46
|
+
return ")
|
47
|
+
inject_into_file("app/models/#{engine_name}#{sorted_model[1]}.rb", "{ :#{sorted_model[0]}_ids => [] }, ", :after => "permitted_attributes
|
48
|
+
return ")
|
38
49
|
end
|
39
50
|
end
|
40
51
|
|
52
|
+
def add_habtm_field_in_forms
|
53
|
+
models = join_models.sort
|
54
|
+
|
55
|
+
2.times do
|
56
|
+
html = "<%=
|
57
|
+
render :partial => 'layouts/#{engine_name}form_habtm_tag', :locals => {
|
58
|
+
:model_class => @#{models[0]},
|
59
|
+
:model_name => '#{models[0]}',
|
60
|
+
:plural_model_name => '#{models[0].pluralize}',
|
61
|
+
:linked_model_name => '#{models[1]}',
|
62
|
+
:plural_linked_model_name => '#{models[1].pluralize}',
|
63
|
+
:namespace_bs => '',
|
64
|
+
:engine_bs => '#{engine_opt}',
|
65
|
+
:field_to_search_for_linked_model => 'name',
|
66
|
+
:attr_to_show => 'caption',
|
67
|
+
:f => f
|
68
|
+
} %>"
|
69
|
+
|
70
|
+
inject_into_file("app/views/#{engine_name}#{models[0].pluralize}/_form.html.erb", html, :before => "<!-- Beautiful_scaffold - AddField - Do not remove -->")
|
71
|
+
models = models.reverse
|
72
|
+
end
|
73
|
+
end
|
41
74
|
end
|
@@ -1,26 +1,23 @@
|
|
1
1
|
# encoding : utf-8
|
2
2
|
class BeautifulLocaleGenerator < Rails::Generators::Base
|
3
|
-
|
3
|
+
require_relative 'beautiful_scaffold_common_methods'
|
4
4
|
include BeautifulScaffoldCommonMethods
|
5
5
|
|
6
6
|
source_root File.expand_path('../templates', __FILE__)
|
7
7
|
|
8
|
-
argument :name, :type => :string, :desc => "type of locale : fr OR en OR de OR all..."
|
8
|
+
argument :name, :type => :string, :desc => "type of locale : fr OR en OR de OR ja all..."
|
9
|
+
|
10
|
+
class_option :mountable_engine, :default => nil
|
11
|
+
|
12
|
+
def list_locales
|
13
|
+
availablelocale = ["fr", "en", "ja"]
|
14
|
+
|
15
|
+
localestr = name.downcase
|
16
|
+
(localestr == 'all' ? availablelocale : [localestr])
|
17
|
+
end
|
9
18
|
|
10
19
|
def install_locale
|
11
|
-
|
12
|
-
|
13
|
-
localestr = name.downcase
|
14
|
-
|
15
|
-
locale_to_process = []
|
16
|
-
|
17
|
-
if localestr == 'all' then
|
18
|
-
locale_to_process = availablelocale
|
19
|
-
else
|
20
|
-
locale_to_process << localestr
|
21
|
-
end
|
22
|
-
|
23
|
-
locale_to_process.each{ |temp_locale|
|
20
|
+
list_locales.each{ |temp_locale|
|
24
21
|
filename = "beautiful_scaffold.#{temp_locale}.yml"
|
25
22
|
gem_localepath = "app/locales/#{filename}"
|
26
23
|
app_localepath = "config/locales/#{filename}"
|
@@ -54,86 +51,112 @@ class BeautifulLocaleGenerator < Rails::Generators::Base
|
|
54
51
|
def regenerate_app_locale
|
55
52
|
require 'net/http'
|
56
53
|
|
57
|
-
|
54
|
+
app_name = (Rails.root || engine_opt)
|
55
|
+
engine_or_apps = (Rails.application.class.parent_name || engine_opt).downcase
|
56
|
+
prefix = engine_opt.blank? ? '' : "#{engine_opt.camelize}::"
|
58
57
|
|
59
|
-
|
60
|
-
|
61
|
-
hi18n = YAML.load_file(filepath)
|
62
|
-
rescue
|
63
|
-
puts "Error loading locale file : #{filepath}"
|
64
|
-
end
|
65
|
-
|
66
|
-
hi18n ||= { name.downcase => {} }
|
67
|
-
hi18n[name.downcase] ||= { 'app' => {} }
|
68
|
-
hi18n[name.downcase]['app'] ||= { 'models' => {} }
|
69
|
-
hi18n[name.downcase]['app']['models'] ||= {}
|
58
|
+
already_processed = {}
|
59
|
+
hi18n = {}
|
70
60
|
|
71
|
-
|
72
|
-
|
73
|
-
hshtranslations['bs_attributes'].each{ |attr, translated_attr|
|
74
|
-
already_processed[name.downcase][attr] = translated_attr
|
75
|
-
}
|
76
|
-
}
|
61
|
+
list_locales.each do |locale_str|
|
62
|
+
locale = locale_str.downcase
|
77
63
|
|
78
|
-
|
79
|
-
puts model_file
|
80
|
-
next if File.directory?(model_file) or File.basename(model_file).first == '.'
|
81
|
-
model = File.basename(model_file, File.extname(model_file))
|
82
|
-
klass = model.camelize.constantize
|
64
|
+
already_processed[locale] ||= {}
|
83
65
|
|
66
|
+
filepath = File.join(app_name, 'config', 'locales', "#{engine_or_apps}.#{locale}.yml")
|
84
67
|
begin
|
85
|
-
|
68
|
+
if File.exist?(filepath)
|
69
|
+
hi18n = YAML.load_file(filepath)
|
70
|
+
end
|
86
71
|
rescue
|
87
|
-
|
72
|
+
puts "Error loading locale file (YAML invalid?) : #{filepath}"
|
88
73
|
end
|
89
74
|
|
90
|
-
|
75
|
+
hi18n[locale] ||= { 'app' => {} }
|
76
|
+
hi18n[locale]['app'] ||= { 'models' => {} }
|
77
|
+
hi18n[locale]['app']['models'] ||= {}
|
78
|
+
|
79
|
+
# Feed data already translated
|
80
|
+
hi18n[locale]['app']['models'].each do |modelname, hshtranslations|
|
81
|
+
hshtranslations['bs_attributes'].each do |attr, translated_attr|
|
82
|
+
already_processed[locale][attr] = translated_attr
|
83
|
+
end
|
84
|
+
end
|
91
85
|
|
92
|
-
|
86
|
+
Dir.glob("app/models/**/*").each do |model_file|
|
87
|
+
puts model_file
|
88
|
+
|
89
|
+
next if File.directory?(model_file) or
|
90
|
+
File.basename(model_file).first == '.' or
|
91
|
+
model_file.include?('/concerns/') or
|
92
|
+
model_file.include?('pdf_report.rb') or
|
93
|
+
model_file.include?('application_record.rb')
|
94
|
+
|
95
|
+
model = File.basename(model_file, File.extname(model_file))
|
96
|
+
|
97
|
+
klass = "#{prefix}#{model}".camelize.constantize
|
98
|
+
sorted_attr = klass.attribute_names.sort
|
99
|
+
|
100
|
+
newmodel = !hi18n[locale]['app']['models'].has_key?(model)
|
101
|
+
|
102
|
+
hi18n[locale]['app']['models'][model] ||= {
|
93
103
|
'bs_caption' => model,
|
94
104
|
'bs_caption_plural' => model.pluralize,
|
95
105
|
'bs_attributes' => {},
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
106
|
+
}
|
107
|
+
|
108
|
+
if newmodel then
|
109
|
+
bs_caption = ""
|
110
|
+
begin
|
111
|
+
bs_caption = translate_string(locale, model)
|
112
|
+
rescue Exception => e
|
113
|
+
puts "Erreur traduction #{e.backtrace}"
|
114
|
+
bs_caption = model
|
115
|
+
end
|
116
|
+
bs_caption_plural = ""
|
117
|
+
begin
|
118
|
+
bs_caption_plural = translate_string(locale, model.pluralize)
|
119
|
+
rescue Exception => e
|
120
|
+
puts "Erreur traduction #{e.backtrace}"
|
121
|
+
bs_caption_plural = model.pluralize
|
122
|
+
end
|
101
123
|
|
102
|
-
|
103
|
-
|
104
|
-
|
124
|
+
hi18n[locale]['app']['models'][model]['bs_caption'] = bs_caption
|
125
|
+
hi18n[locale]['app']['models'][model]['bs_caption_plural'] = bs_caption_plural
|
126
|
+
end
|
105
127
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
128
|
+
hi18n[locale]['app']['models'][model]['bs_attributes'] ||= {}
|
129
|
+
|
130
|
+
sorted_attr.each do |k|
|
131
|
+
# Si pas déjà renseigné
|
132
|
+
if hi18n[locale]['app']['models'][model]['bs_attributes'][k].blank?
|
133
|
+
# Si pas déjà traduit
|
134
|
+
if already_processed[locale][k].blank?
|
135
|
+
begin
|
136
|
+
attr_translate = translate_string(locale, k)
|
137
|
+
already_processed[locale][k] = attr_translate
|
138
|
+
rescue
|
139
|
+
puts "Plantage translate API"
|
140
|
+
attr_translate = k
|
141
|
+
end
|
142
|
+
else
|
143
|
+
attr_translate = already_processed[locale][k]
|
119
144
|
end
|
120
145
|
else
|
121
|
-
|
146
|
+
# Récupère l'attribut traduit
|
147
|
+
attr_translate = hi18n[locale]['app']['models'][model]['bs_attributes'][k]
|
122
148
|
end
|
123
|
-
else
|
124
|
-
# Récupère l'attribut traduit
|
125
|
-
attr_translate = hi18n[name.downcase]['app']['models'][model]['bs_attributes'][k]
|
126
|
-
end
|
127
149
|
|
128
|
-
|
129
|
-
|
130
|
-
|
150
|
+
hi18n[locale]['app']['models'][model]['bs_attributes'][k] = attr_translate
|
151
|
+
end
|
152
|
+
end
|
131
153
|
|
132
|
-
|
154
|
+
File.unlink(filepath) if File.exist?(filepath)
|
133
155
|
|
134
|
-
|
135
|
-
|
136
|
-
|
156
|
+
file = File.open(filepath, "w")
|
157
|
+
file.write(hi18n.to_yaml)
|
158
|
+
file.close
|
159
|
+
end
|
137
160
|
end
|
138
161
|
|
139
162
|
private
|
@@ -141,14 +164,13 @@ class BeautifulLocaleGenerator < Rails::Generators::Base
|
|
141
164
|
def translate_string(locale, str)
|
142
165
|
# See http://www.microsofttranslator.com/dev/
|
143
166
|
#
|
144
|
-
if locale == "en"
|
167
|
+
if locale == "en"
|
145
168
|
attr_translate = "#{str.gsub(/_/, " ")}"
|
146
169
|
else
|
147
|
-
url_domain
|
148
|
-
|
170
|
+
url_domain = "api.mymemory.translated.net"
|
171
|
+
url_query = "/get?q=#{str.gsub(/_/, "%20")}&langpair=en%7C#{locale}"
|
149
172
|
|
150
|
-
|
151
|
-
json = JSON.parse(Net::HTTP.get(url_domain, urlstr))
|
173
|
+
json = JSON.parse(Net::HTTP.get(url_domain, url_query))
|
152
174
|
attr_translate = json["responseData"]["translatedText"].strip.downcase
|
153
175
|
end
|
154
176
|
raise 'Free Limit' if attr_translate =~ /mymemory/
|