trestle 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/bundle/trestle/bundle.css +3 -3
- data/app/assets/bundle/trestle/bundle.js +8 -8
- data/app/views/trestle/flash/_flash.html.erb +1 -1
- data/frontend/css/components/_fields.scss +1 -0
- data/frontend/js/components/tabs.js +1 -1
- data/lib/generators/trestle/install/install_generator.rb +6 -2
- data/lib/generators/trestle/install/templates/_custom.css +8 -0
- data/lib/trestle/debug_errors.rb +24 -0
- data/lib/trestle/navigation/group.rb +1 -2
- data/lib/trestle/navigation/item.rb +2 -2
- data/lib/trestle/version.rb +1 -1
- data/lib/trestle.rb +1 -0
- data/yarn.lock +624 -636
- metadata +4 -2
@@ -2,6 +2,6 @@
|
|
2
2
|
<%= render "trestle/flash/alert", html_class: "alert-success", icon: icon("alert-icon far fa-check-circle"), alert: normalize_flash_alert(flash[:message]) %>
|
3
3
|
<% elsif flash[:error] -%>
|
4
4
|
<%= render layout: "trestle/flash/alert", locals: { html_class: "alert-danger", icon: icon("alert-icon far fa-times-circle"), alert: normalize_flash_alert(flash[:error]) } do %>
|
5
|
-
<%= render "trestle/flash/debug", errors: instance.errors if debug_form_errors? %>
|
5
|
+
<%= render "trestle/flash/debug", errors: Trestle::DebugErrors.new(instance.errors) if debug_form_errors? %>
|
6
6
|
<% end %>
|
7
7
|
<% end -%>
|
@@ -6,7 +6,7 @@ import { init } from '../core/events'
|
|
6
6
|
|
7
7
|
const TAB_SELECTOR = 'a[data-toggle="tab"]'
|
8
8
|
const TAB_PANE_SELECTOR = '.tab-pane'
|
9
|
-
const ERROR_SELECTOR = '.
|
9
|
+
const ERROR_SELECTOR = '.has-error'
|
10
10
|
|
11
11
|
// Save active tab to URL hash
|
12
12
|
init(function (root) {
|
@@ -10,8 +10,12 @@ module Trestle
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_assets
|
13
|
-
|
14
|
-
|
13
|
+
if defined?(Sass) || defined?(SassC)
|
14
|
+
template "_custom.scss", "app/assets/stylesheets/trestle/_custom.scss"
|
15
|
+
template "_theme.scss", "app/assets/stylesheets/trestle/_theme.scss"
|
16
|
+
else
|
17
|
+
template "_custom.css", "app/assets/stylesheets/trestle/_custom.css"
|
18
|
+
end
|
15
19
|
|
16
20
|
template "custom.js", "app/assets/javascripts/trestle/custom.js"
|
17
21
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/* This file may be used for providing additional customizations to the Trestle
|
2
|
+
* admin. It will be automatically included within all admin pages.
|
3
|
+
*
|
4
|
+
* For organizational purposes, you may wish to define your customizations
|
5
|
+
* within individual partials in this folder and they'll be required below.
|
6
|
+
*
|
7
|
+
*= require_tree .
|
8
|
+
*/
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Trestle
|
2
|
+
class DebugErrors
|
3
|
+
def initialize(errors)
|
4
|
+
@errors = errors
|
5
|
+
end
|
6
|
+
|
7
|
+
def any?
|
8
|
+
@errors.any?
|
9
|
+
end
|
10
|
+
|
11
|
+
def each
|
12
|
+
if defined?(ActiveModel::Error)
|
13
|
+
# Rails 6.1 introduces a unified Error class
|
14
|
+
@errors.each do |error|
|
15
|
+
yield error.attribute, error.message
|
16
|
+
end
|
17
|
+
else
|
18
|
+
@errors.each do |error, message|
|
19
|
+
yield error, message
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -4,7 +4,7 @@ module Trestle
|
|
4
4
|
attr_reader :name, :path, :options
|
5
5
|
|
6
6
|
def initialize(name, path=nil, options={})
|
7
|
-
@name, @path, @options = name, path, options
|
7
|
+
@name, @path, @options = name.to_s, path, options
|
8
8
|
end
|
9
9
|
|
10
10
|
def ==(other)
|
@@ -40,7 +40,7 @@ module Trestle
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def label
|
43
|
-
options[:label] || I18n.t("admin.navigation.items.#{name}", default: name.
|
43
|
+
options[:label] || I18n.t("admin.navigation.items.#{name}", default: name.titlecase)
|
44
44
|
end
|
45
45
|
|
46
46
|
def icon
|
data/lib/trestle/version.rb
CHANGED
data/lib/trestle.rb
CHANGED
@@ -11,6 +11,7 @@ module Trestle
|
|
11
11
|
require_relative "trestle/adapters"
|
12
12
|
require_relative "trestle/attribute"
|
13
13
|
require_relative "trestle/breadcrumb"
|
14
|
+
require_relative "trestle/debug_errors"
|
14
15
|
require_relative "trestle/lazy"
|
15
16
|
require_relative "trestle/configurable"
|
16
17
|
require_relative "trestle/configuration"
|