wallaby 6.1.5 → 7.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/fonts/FontAwesome.otf +0 -0
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +2671 -0
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/assets/fonts/summernote.eot +0 -0
- data/app/assets/fonts/summernote.hash +1 -0
- data/app/assets/fonts/summernote.ttf +0 -0
- data/app/assets/fonts/summernote.woff +0 -0
- data/app/assets/fonts/summernote.woff2 +0 -0
- data/app/assets/javascripts/wallaby/base.js +1 -17
- data/app/assets/javascripts/wallaby/core.js +46172 -0
- data/app/assets/javascripts/wallaby/core.js.map +7 -0
- data/app/assets/javascripts/wallaby/{setup.js.erb → setup.js} +17 -5
- data/app/assets/stylesheets/wallaby/base/_fonts.scss +22 -0
- data/app/assets/stylesheets/wallaby/base/_functions.scss +15 -29
- data/app/assets/stylesheets/wallaby/base/_mixins.scss +7 -7
- data/app/assets/stylesheets/wallaby/base.scss +2 -8
- data/app/assets/stylesheets/wallaby/core.scss +12139 -0
- data/app/assets/stylesheets/wallaby/pages/_index.scss +1 -1
- data/app/javascript/wallaby/core.js +23 -0
- data/app/javascript/wallaby/globals.js +9 -0
- data/app/stylesheets/wallaby/core.scss +15 -0
- data/app/views/layouts/wallaby/resources.html.erb +1 -3
- data/app/views/wallaby/resources/_edit_page.html.erb +20 -0
- data/app/views/wallaby/resources/_form.html.erb +7 -1
- data/app/views/wallaby/resources/_frontend.html.erb +2 -3
- data/app/views/wallaby/resources/_home_page.html.erb +5 -0
- data/app/views/wallaby/resources/_index_page.html.erb +59 -0
- data/app/views/wallaby/resources/_index_query.html.erb +2 -2
- data/app/views/wallaby/resources/_new_page.html.erb +19 -0
- data/app/views/wallaby/resources/_show_page.html.erb +42 -0
- data/app/views/wallaby/resources/edit.html.erb +1 -18
- data/app/views/wallaby/resources/error.json.jbuilder +1 -0
- data/app/views/wallaby/resources/form/_belongs_to.html.erb +1 -1
- data/app/views/wallaby/resources/form/_citext.html.erb +1 -1
- data/app/views/wallaby/resources/form/_color.html.erb +1 -1
- data/app/views/wallaby/resources/form/_date.html.erb +1 -1
- data/app/views/wallaby/resources/form/_daterange.html.erb +1 -1
- data/app/views/wallaby/resources/form/_datetime.html.erb +1 -1
- data/app/views/wallaby/resources/form/_has_and_belongs_to_many.html.erb +1 -1
- data/app/views/wallaby/resources/form/_has_many.html.erb +1 -1
- data/app/views/wallaby/resources/form/_hstore.html.erb +1 -1
- data/app/views/wallaby/resources/form/_json.html.erb +1 -1
- data/app/views/wallaby/resources/form/_jsonb.html.erb +1 -1
- data/app/views/wallaby/resources/form/_longtext.html.erb +1 -1
- data/app/views/wallaby/resources/form/_markdown.html.erb +1 -1
- data/app/views/wallaby/resources/form/_mediumtext.html.erb +1 -1
- data/app/views/wallaby/resources/form/_text.html.erb +1 -1
- data/app/views/wallaby/resources/form/_time.html.erb +1 -1
- data/app/views/wallaby/resources/form/_tinytext.html.erb +1 -1
- data/app/views/wallaby/resources/form/_tsrange.html.erb +1 -1
- data/app/views/wallaby/resources/form/_tstzrange.html.erb +1 -1
- data/app/views/wallaby/resources/form/_xml.html.erb +1 -1
- data/app/views/wallaby/resources/home.html.erb +1 -5
- data/app/views/wallaby/resources/index/_box.html.erb +1 -1
- data/app/views/wallaby/resources/index/_circle.html.erb +1 -1
- data/app/views/wallaby/resources/index/_citext.html.erb +1 -1
- data/app/views/wallaby/resources/index/_dollar.html.erb +5 -0
- data/app/views/wallaby/resources/index/_hstore.html.erb +1 -1
- data/app/views/wallaby/resources/index/_json.html.erb +1 -1
- data/app/views/wallaby/resources/index/_jsonb.html.erb +1 -1
- data/app/views/wallaby/resources/index/_line.html.erb +1 -1
- data/app/views/wallaby/resources/index/_longtext.html.erb +1 -1
- data/app/views/wallaby/resources/index/_lseg.html.erb +1 -1
- data/app/views/wallaby/resources/index/_ltree.html.erb +1 -1
- data/app/views/wallaby/resources/index/_mediumtext.html.erb +1 -1
- data/app/views/wallaby/resources/index/_path.html.erb +1 -1
- data/app/views/wallaby/resources/index/_percent.html.erb +10 -0
- data/app/views/wallaby/resources/index/_polygon.html.erb +1 -1
- data/app/views/wallaby/resources/index/_sti.html.erb +1 -1
- data/app/views/wallaby/resources/index/_string.html.erb +1 -1
- data/app/views/wallaby/resources/index/_text.html.erb +1 -1
- data/app/views/wallaby/resources/index/_tinytext.html.erb +1 -1
- data/app/views/wallaby/resources/index/_tsvector.html.erb +1 -1
- data/app/views/wallaby/resources/index/_uuid.html.erb +1 -1
- data/app/views/wallaby/resources/index/_xml.html.erb +1 -1
- data/app/views/wallaby/resources/index.csv.erb +7 -1
- data/app/views/wallaby/resources/index.html.erb +1 -54
- data/app/views/wallaby/resources/new.html.erb +1 -18
- data/app/views/wallaby/resources/show/_active_storage.html.erb +5 -0
- data/app/views/wallaby/resources/show.html.erb +1 -35
- data/lib/generators/wallaby/engine/partials/USAGE +23 -0
- data/lib/generators/wallaby/engine/partials/partials_generator.rb +25 -0
- data/lib/generators/wallaby/install/install_generator.rb +1 -54
- data/lib/wallaby/ui_engine.rb +3 -2
- data/lib/wallaby/version.rb +1 -1
- data/lib/wallaby/views.rb +2 -11
- metadata +45 -122
- data/app/assets/stylesheets/wallaby/summernote.scss.erb +0 -7
- data/lib/generators/wallaby/install/templates/application_authorizer.rb.erb +0 -40
- data/lib/generators/wallaby/install/templates/application_controller.rb.erb +0 -148
- data/lib/generators/wallaby/install/templates/application_decorator.rb.erb +0 -10
- data/lib/generators/wallaby/install/templates/application_paginator.rb.erb +0 -30
- data/lib/generators/wallaby/install/templates/application_servicer.rb.erb +0 -50
- data/lib/generators/wallaby/install/templates/initializer.rb.erb +0 -58
- /data/app/views/wallaby/resources/{_active_storage.html.erb → index/_active_storage.html.erb} +0 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
<%# @param object [model] model instance %>
|
2
|
+
<%# @param field_name [String] name of the field %>
|
3
|
+
<%# @param value [Object] value of the field %>
|
4
|
+
<%# @param metadata [Hash] metadata of the field %>
|
5
|
+
<%= if value.nil?
|
6
|
+
null
|
7
|
+
else
|
8
|
+
"%.#{ metadata[:precision] || 2 }f%%" %
|
9
|
+
(value.to_f * (metadata[:is_percent] ? 1 : 100))
|
10
|
+
end %>
|
@@ -8,7 +8,13 @@
|
|
8
8
|
<%
|
9
9
|
decorated_collection.each do |decorated|
|
10
10
|
data = current_model_decorator.index_field_names.map do |field_name|
|
11
|
-
|
11
|
+
render(
|
12
|
+
decorated.index_type_of(field_name),
|
13
|
+
object: decorated,
|
14
|
+
field_name: field_name,
|
15
|
+
value: decorated.try(field_name),
|
16
|
+
metadata: decorated.index_metadata_of(field_name)
|
17
|
+
)
|
12
18
|
end
|
13
19
|
%>
|
14
20
|
<%= ::CSV.generate_line(data).strip.html_safe %>
|
@@ -1,54 +1 @@
|
|
1
|
-
|
2
|
-
# decorate first on every page or partial
|
3
|
-
decorated_collection = decorate collection
|
4
|
-
%>
|
5
|
-
<article class="resources">
|
6
|
-
<div class="resources__header">
|
7
|
-
<h1><%= to_model_label(current_model_class) %></h1>
|
8
|
-
<%= render 'index_query' %>
|
9
|
-
<%= render 'index_filters' %>
|
10
|
-
<%= render 'index_pagination' %>
|
11
|
-
</div>
|
12
|
-
<%= render 'flash_messages' %>
|
13
|
-
|
14
|
-
<section>
|
15
|
-
<% # Data table %>
|
16
|
-
<% if decorated_collection.present? %>
|
17
|
-
<% field_names = current_model_decorator.index_field_names %>
|
18
|
-
<div class="resources__container">
|
19
|
-
<table class="resources__data">
|
20
|
-
<thead>
|
21
|
-
<tr>
|
22
|
-
<% field_names.each do |field_name| %>
|
23
|
-
<%= content_tag :th, class: sort_link_builder.current_sort[field_name] do %>
|
24
|
-
<%= sort_link_builder.build field_name %>
|
25
|
-
<% end %>
|
26
|
-
<% end %>
|
27
|
-
<th> </th>
|
28
|
-
</tr>
|
29
|
-
</thead>
|
30
|
-
<tbody>
|
31
|
-
<% decorated_collection.each do |decorated| %>
|
32
|
-
<tr>
|
33
|
-
<% field_names.each do |field_name| %>
|
34
|
-
<td>
|
35
|
-
<%= type_render decorated.index_type_of(field_name), object: decorated, field_name: field_name %>
|
36
|
-
</td>
|
37
|
-
<% end %>
|
38
|
-
<td class="resource__actions">
|
39
|
-
<%= render 'resource_actions', decorated: decorated %>
|
40
|
-
</td>
|
41
|
-
</tr>
|
42
|
-
<% end %>
|
43
|
-
</tbody>
|
44
|
-
</table>
|
45
|
-
</div>
|
46
|
-
<% else %>
|
47
|
-
<div class="resources__not-found">
|
48
|
-
<%= image_tag 'wallaby/not_found.png' %>
|
49
|
-
<%= wt 'errors.not_found.collection' %>
|
50
|
-
</div>
|
51
|
-
<% end %>
|
52
|
-
<% # /Data table %>
|
53
|
-
</section>
|
54
|
-
</article>
|
1
|
+
<%= render 'index_page' %>
|
@@ -1,18 +1 @@
|
|
1
|
-
|
2
|
-
<article class="resource">
|
3
|
-
<div class="resource__header">
|
4
|
-
<h1><%= wt 'labels.create', model: to_model_label(current_model_class) %></h1>
|
5
|
-
<%= render 'resource_navs' %>
|
6
|
-
</div>
|
7
|
-
<%= render 'flash_messages' %>
|
8
|
-
<section>
|
9
|
-
<div class="resource__container">
|
10
|
-
<%= form_for(
|
11
|
-
decorated, url: url_for(action: (params[:resource] ? :show : :index)),
|
12
|
-
method: :post, html: { :multipart => true }, builder: Wallaby::FormBuilder
|
13
|
-
) do |form| %>
|
14
|
-
<%= render 'form', form: form, decorated: decorated %>
|
15
|
-
<% end %>
|
16
|
-
</div>
|
17
|
-
</section>
|
18
|
-
</article>
|
1
|
+
<%= render 'new_page' %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%# @param object [model] model instance %>
|
2
|
+
<%# @param field_name [String] name of the field %>
|
3
|
+
<%# @param value [Object] value of the field %>
|
4
|
+
<%# @param metadata [Hash] metadata of the field %>
|
5
|
+
<%= value.try(:attachment) ? link_to(value.attachment.blob.filename, rails_blob_path(value)) : null %>
|
@@ -1,35 +1 @@
|
|
1
|
-
|
2
|
-
<%
|
3
|
-
if resource
|
4
|
-
# decorate first on every page or partial
|
5
|
-
decorated = decorate resource
|
6
|
-
%>
|
7
|
-
<div class="resource__header">
|
8
|
-
<h1><%= show_title decorated %></h1>
|
9
|
-
<%= render 'resource_navs' %>
|
10
|
-
</div>
|
11
|
-
<%= render 'flash_messages' %>
|
12
|
-
<section>
|
13
|
-
<div class="resource__container">
|
14
|
-
<% decorated.show_field_names.each do |field_name| %>
|
15
|
-
<dl>
|
16
|
-
<dt><%= decorated.show_label_of field_name %></dt>
|
17
|
-
<dd><%= type_render decorated.show_type_of(field_name), object: decorated, field_name: field_name %></dd>
|
18
|
-
</dl>
|
19
|
-
<% end %>
|
20
|
-
</div>
|
21
|
-
</section>
|
22
|
-
<% else %>
|
23
|
-
<div class="resource__header">
|
24
|
-
<h1><%= to_model_label(current_model_class) %></h1>
|
25
|
-
<%= render 'resource_navs' %>
|
26
|
-
</div>
|
27
|
-
<%= render 'flash_messages' %>
|
28
|
-
<section>
|
29
|
-
<div class="resource__not-found">
|
30
|
-
<%= image_tag 'wallaby/not_found.png' %>
|
31
|
-
<%= wt 'errors.not_found.resource', resource: to_model_label(current_model_class) %>
|
32
|
-
</div>
|
33
|
-
</section>
|
34
|
-
<% end %>
|
35
|
-
</article>
|
1
|
+
<%= render 'show_page' %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Description:
|
2
|
+
Copy the main partials and templates for the given NAME (default to 'admin').
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate wallaby:engine:partials admin
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
- app/views/admin/application/_footer.html.erb
|
9
|
+
- app/views/admin/application/_frontend.html.erb
|
10
|
+
- app/views/admin/application/_logo.html.erb
|
11
|
+
- app/views/admin/application/_navs.html.erb
|
12
|
+
- app/views/admin/application/_title.html.erb
|
13
|
+
- app/views/admin/application/_user_menu.html.erb
|
14
|
+
- app/views/admin/application/_index_actions.html.erb
|
15
|
+
- app/views/admin/application/_index_filters.html.erb
|
16
|
+
- app/views/admin/application/_index_pagination.html.erb
|
17
|
+
- app/views/admin/application/_index_query.html.erb
|
18
|
+
- app/views/admin/application/_resource_navs.html.erb
|
19
|
+
- app/views/admin/application/index.html.erb
|
20
|
+
- app/views/admin/application/new.html.erb
|
21
|
+
- app/views/admin/application/show.html.erb
|
22
|
+
- app/views/admin/application/edit.html.erb
|
23
|
+
- app/views/admin/application/_form.html.erb
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Wallaby
|
4
|
+
class Engine
|
5
|
+
# `wallaby:engine:partials` generator
|
6
|
+
class PartialsGenerator < Rails::Generators::NamedBase
|
7
|
+
source_root File.expand_path('../../../../../', __dir__)
|
8
|
+
argument :name, type: :string, default: 'admin'
|
9
|
+
|
10
|
+
# @see https://github.com/wallaby-rails/wallaby/blob/master/lib/generators/wallaby/engine/partials/USAGE
|
11
|
+
def install
|
12
|
+
destination_prefix = "app/views/#{file_name}/application"
|
13
|
+
%w[
|
14
|
+
_footer _frontend _logo _navs _title _user_menu
|
15
|
+
_index_actions _index_filters _index_pagination _index_query _resource_navs
|
16
|
+
].each do |name|
|
17
|
+
copy_file(
|
18
|
+
"#{source_paths.first}/app/views/wallaby/resources/#{name}.html.erb",
|
19
|
+
"#{destination_prefix}/#{name}.html.erb"
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
module Wallaby
|
4
4
|
# `wallaby:install` generator
|
5
5
|
class InstallGenerator < Rails::Generators::NamedBase
|
6
|
-
source_root File.expand_path('templates', __dir__)
|
7
6
|
argument :name, type: :string, default: 'admin'
|
8
7
|
|
9
8
|
class_option \
|
@@ -32,59 +31,7 @@ module Wallaby
|
|
32
31
|
|
33
32
|
# @see https://github.com/wallaby-rails/wallaby/blob/master/lib/generators/wallaby/install/USAGE
|
34
33
|
def install
|
35
|
-
|
36
|
-
return if options[:mount_only]
|
37
|
-
|
38
|
-
create_wallaby_initializer_file
|
39
|
-
create_application_files
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def commenting
|
45
|
-
file_name == self.class.arguments.first.default && '# ' || ''
|
46
|
-
end
|
47
|
-
|
48
|
-
def mount_wallaby_to_given_name
|
49
|
-
route %(mount Wallaby::Engine, at: '/#{file_name}')
|
50
|
-
rescue StandardError => e
|
51
|
-
Rails.logger.error "WARNING: #{e.message}"
|
52
|
-
end
|
53
|
-
|
54
|
-
def create_wallaby_initializer_file
|
55
|
-
template 'initializer.rb.erb', 'config/initializers/wallaby.rb'
|
56
|
-
end
|
57
|
-
|
58
|
-
def create_application_files
|
59
|
-
create_basic_files
|
60
|
-
create_application_authorizer if options[:include_authorizer]
|
61
|
-
create_application_paginator if options[:include_paginator]
|
62
|
-
create_application_partials if options[:include_partials]
|
63
|
-
end
|
64
|
-
|
65
|
-
def create_basic_files
|
66
|
-
template 'application_controller.rb.erb', "app/controllers/#{file_name}/application_controller.rb"
|
67
|
-
template 'application_decorator.rb.erb', "app/decorators/#{file_name}/application_decorator.rb"
|
68
|
-
template 'application_servicer.rb.erb', "app/servicers/#{file_name}/application_servicer.rb"
|
69
|
-
end
|
70
|
-
|
71
|
-
def create_application_authorizer
|
72
|
-
template 'application_authorizer.rb.erb', "app/authorizers/#{file_name}/application_authorizer.rb"
|
73
|
-
end
|
74
|
-
|
75
|
-
def create_application_paginator
|
76
|
-
template 'application_paginator.rb.erb', "app/paginators/#{file_name}/application_paginator.rb"
|
77
|
-
end
|
78
|
-
|
79
|
-
def create_application_partials
|
80
|
-
source_prefix = '../../../../../app/views/wallaby/resources'
|
81
|
-
destination_prefix = "app/views/#{file_name}/application"
|
82
|
-
%w(
|
83
|
-
footer frontend logo navs title user_menu
|
84
|
-
index_actions index_filters index_pagination index_query resource_navs
|
85
|
-
).each do |name|
|
86
|
-
copy_file "#{source_prefix}/_#{name}.html.erb", "#{destination_prefix}/_#{name}.html.erb"
|
87
|
-
end
|
34
|
+
invoke 'wallaby:engine:install', [name], options.dup
|
88
35
|
end
|
89
36
|
end
|
90
37
|
end
|
data/lib/wallaby/ui_engine.rb
CHANGED
@@ -16,7 +16,7 @@ module Wallaby
|
|
16
16
|
|
17
17
|
initializer 'wallaby.assets.precompile' do |_|
|
18
18
|
config.assets.precompile +=
|
19
|
-
%w
|
19
|
+
%w[
|
20
20
|
wallaby/application.js
|
21
21
|
wallaby/application.css
|
22
22
|
wallaby/bad_request.png
|
@@ -26,7 +26,8 @@ module Wallaby
|
|
26
26
|
wallaby/not_implemented.png
|
27
27
|
wallaby/unauthorized.png
|
28
28
|
wallaby/unprocessable_entity.png
|
29
|
-
|
29
|
+
]
|
30
|
+
config.assets.paths << config.root.join("app", "assets", "fonts")
|
30
31
|
end
|
31
32
|
end
|
32
33
|
end
|
data/lib/wallaby/version.rb
CHANGED
data/lib/wallaby/views.rb
CHANGED
@@ -3,15 +3,6 @@
|
|
3
3
|
# NOTE: We need to require the following rails engines
|
4
4
|
# so that the main app could pick up the assets from these engines
|
5
5
|
# even if they don't appear in the `Gemfile`
|
6
|
-
require 'sass-rails'
|
7
|
-
|
8
|
-
require 'bootstrap'
|
9
|
-
require 'font-awesome-sass'
|
10
|
-
require 'bootstrap4-datetime-picker-rails'
|
11
|
-
require 'jquery-minicolors-rails'
|
12
|
-
require 'jquery-rails'
|
13
|
-
require 'momentjs-rails'
|
14
|
-
require 'summernote-rails'
|
15
|
-
require 'twitter-typeahead-rails'
|
16
|
-
require 'jbuilder'
|
17
6
|
require 'csv'
|
7
|
+
require 'jbuilder'
|
8
|
+
require 'sprockets/railtie'
|