trestle 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/trestle/_confirmation.js +23 -0
  3. data/app/assets/javascripts/trestle/_datepicker.js +22 -0
  4. data/app/assets/javascripts/trestle/_errors.js +11 -0
  5. data/app/assets/javascripts/trestle/_form.js +6 -0
  6. data/app/assets/javascripts/trestle/_gallery.js +27 -0
  7. data/app/assets/javascripts/trestle/_select.js +11 -0
  8. data/app/assets/javascripts/trestle/_sidebar.js +52 -0
  9. data/app/assets/javascripts/trestle/_table.js +21 -0
  10. data/app/assets/javascripts/trestle/_tabs.js +13 -0
  11. data/app/assets/javascripts/trestle/_tooltips.js +3 -0
  12. data/app/assets/javascripts/trestle/admin.js +23 -0
  13. data/app/assets/javascripts/trestle/custom.js +4 -0
  14. data/app/assets/stylesheets/trestle/components/_table.scss +6 -0
  15. data/app/helpers/trestle/form_helper.rb +1 -1
  16. data/app/helpers/trestle/format_helper.rb +48 -0
  17. data/app/helpers/trestle/url_helper.rb +2 -8
  18. data/app/views/layouts/trestle/admin.html.erb +3 -3
  19. data/app/views/trestle/admin/index.html.erb +1 -1
  20. data/app/views/trestle/dashboard/index.html.erb +2 -2
  21. data/app/views/trestle/resource/_form.html.erb +1 -1
  22. data/app/views/trestle/resource/edit.html.erb +2 -2
  23. data/app/views/trestle/resource/index.html.erb +1 -1
  24. data/app/views/trestle/resource/new.html.erb +1 -1
  25. data/app/views/trestle/resource/show.html.erb +2 -2
  26. data/app/views/trestle/shared/_sidebar.html.erb +4 -2
  27. data/bower.json +1 -1
  28. data/config/locales/en.yml +16 -2
  29. data/lib/generators/trestle/install/install_generator.rb +3 -3
  30. data/lib/generators/trestle/install/templates/custom.js +7 -0
  31. data/lib/generators/trestle/install/templates/trestle.rb.erb +3 -2
  32. data/lib/trestle/adapters.rb +7 -64
  33. data/lib/trestle/adapters/active_record_adapter.rb +46 -20
  34. data/lib/trestle/adapters/adapter.rb +176 -0
  35. data/lib/trestle/adapters/sequel_adapter.rb +85 -0
  36. data/lib/trestle/admin.rb +1 -1
  37. data/lib/trestle/attribute.rb +14 -37
  38. data/lib/trestle/breadcrumb.rb +6 -0
  39. data/lib/trestle/configuration.rb +1 -1
  40. data/lib/trestle/form/automatic.rb +29 -21
  41. data/lib/trestle/form/builder.rb +4 -0
  42. data/lib/trestle/form/field.rb +2 -2
  43. data/lib/trestle/form/fields/check_box.rb +1 -1
  44. data/lib/trestle/form/fields/collection_select.rb +1 -1
  45. data/lib/trestle/form/fields/date_select.rb +1 -1
  46. data/lib/trestle/form/fields/datetime_select.rb +1 -1
  47. data/lib/trestle/form/fields/grouped_collection_select.rb +1 -1
  48. data/lib/trestle/form/fields/select.rb +2 -2
  49. data/lib/trestle/form/fields/tag_select.rb +1 -2
  50. data/lib/trestle/form/fields/time_select.rb +1 -1
  51. data/lib/trestle/form/fields/time_zone_select.rb +1 -1
  52. data/lib/trestle/resource.rb +11 -7
  53. data/lib/trestle/resource/builder.rb +2 -1
  54. data/lib/trestle/resource/controller.rb +61 -17
  55. data/lib/trestle/scope.rb +1 -1
  56. data/lib/trestle/table/automatic.rb +5 -11
  57. data/lib/trestle/table/builder.rb +1 -0
  58. data/lib/trestle/table/column.rb +24 -43
  59. data/lib/trestle/version.rb +1 -1
  60. data/trestle.gemspec +3 -4
  61. data/vendor/assets/bower_components/trestle/flatpickr/dist/flatpickr.css +51 -26
  62. data/vendor/assets/bower_components/trestle/flatpickr/dist/flatpickr.js +349 -299
  63. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ar.js +5 -5
  64. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/bg.js +5 -5
  65. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/bn.js +5 -5
  66. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/cat.js +7 -7
  67. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/cs.js +7 -7
  68. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/cy.js +7 -7
  69. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/da.js +6 -6
  70. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/de.js +10 -10
  71. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/eo.js +11 -11
  72. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/es.js +7 -7
  73. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/et.js +11 -11
  74. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/fa.js +6 -6
  75. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/fi.js +7 -7
  76. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/fr.js +11 -11
  77. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/gr.js +13 -13
  78. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/he.js +5 -5
  79. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/hi.js +5 -5
  80. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/hr.js +6 -6
  81. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/hu.js +10 -10
  82. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/id.js +7 -7
  83. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/index.js +97 -0
  84. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/it.js +10 -10
  85. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ja.js +5 -5
  86. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ko.js +6 -6
  87. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/lt.js +10 -10
  88. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/lv.js +6 -6
  89. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/mk.js +8 -8
  90. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ms.js +7 -7
  91. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/my.js +7 -7
  92. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/nl.js +11 -11
  93. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/no.js +11 -11
  94. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/pa.js +5 -5
  95. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/pl.js +6 -6
  96. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/pt.js +6 -8
  97. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ro.js +7 -9
  98. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/ru.js +6 -8
  99. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/si.js +5 -7
  100. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sk.js +8 -8
  101. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sl.js +8 -10
  102. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sq.js +5 -7
  103. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sr.js +9 -10
  104. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/sv.js +8 -10
  105. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/th.js +10 -11
  106. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/tr.js +6 -8
  107. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/uk.js +6 -7
  108. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/vn.js +6 -8
  109. data/vendor/assets/bower_components/trestle/flatpickr/dist/l10n/zh.js +9 -11
  110. metadata +24 -34
  111. data/app/assets/javascripts/trestle/_confirmation.js.coffee +0 -18
  112. data/app/assets/javascripts/trestle/_datepicker.js.coffee +0 -18
  113. data/app/assets/javascripts/trestle/_errors.js.coffee +0 -8
  114. data/app/assets/javascripts/trestle/_form.js.coffee +0 -4
  115. data/app/assets/javascripts/trestle/_gallery.js.coffee +0 -21
  116. data/app/assets/javascripts/trestle/_select.js.coffee +0 -7
  117. data/app/assets/javascripts/trestle/_sidebar.js.coffee +0 -45
  118. data/app/assets/javascripts/trestle/_table.js.coffee +0 -16
  119. data/app/assets/javascripts/trestle/_tabs.js.coffee +0 -9
  120. data/app/assets/javascripts/trestle/_tooltips.js.coffee +0 -2
  121. data/app/assets/javascripts/trestle/admin.js.coffee +0 -22
  122. data/app/assets/javascripts/trestle/custom.js.coffee +0 -4
  123. data/lib/generators/trestle/install/templates/custom.js.coffee +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64b62775f02866abaf0937d6a4e0bec5d86a1a31
4
- data.tar.gz: 7707fa64f42e4c771721b9c306c143ce2614e18f
3
+ metadata.gz: f4f02402474a2f77fc6f4af6582e9b68f59274d0
4
+ data.tar.gz: bb9815ae6b48b970443740c5b111aefef96dcea3
5
5
  SHA512:
6
- metadata.gz: a7bed2fddf9f950463693e7ec502aaf08439240a27075e61d2fc575381e165da4b0c407406d4a02990524c37ea9ce730a76886bea2c57ebee03b0ab935d34b51
7
- data.tar.gz: c0dcd718a1bb3ac020924d09bd99f1658da42c7b53122af829822837a1a0c1631bfc942bb6a274d4301e7de5b4e90d00ad32cb242c30485abf88450ba3186dab
6
+ metadata.gz: c1593ee4dafcde35f20c312441df49e1b0861b82d87e387b4ed407e60a29758fb24e9efe4274339a1e04c78aac60cb0e85b9c76a425863fc3176d6a1f3afb70a
7
+ data.tar.gz: 04e575f53c928a249a74aa4cc8ad3477c7cd16fad6ef26874e0d9adf9397bbfe070fd059f74b4c85c25cba599887d84dbf3f5da1fd0cd91d26704c85ef976a1b
@@ -0,0 +1,23 @@
1
+ Trestle.ready(function() {
2
+ // This must be bound to an element beneath document so
3
+ // that it is fired before any jquery_ujs events.
4
+ var root = $('body');
5
+
6
+ // Ensure it is only initialized once
7
+ if (root.data('bs.confirmation')) return;
8
+
9
+ root.confirmation({
10
+ rootSelector: 'body',
11
+ selector: '[data-toggle="confirm-delete"]',
12
+ singleton: true,
13
+ popout: true,
14
+ title: Trestle.i18n['admin.confirmation.title'],
15
+ btnOkIcon: '',
16
+ btnOkClass: 'btn-danger',
17
+ btnOkLabel: Trestle.i18n['admin.confirmation.delete'] || 'Delete',
18
+ btnCancelIcon: '',
19
+ btnCancelClass: 'btn-default',
20
+ btnCancelLabel: Trestle.i18n['admin.confirmation.cancel'] || 'Cancel',
21
+ copyAttributes: ''
22
+ });
23
+ });
@@ -0,0 +1,22 @@
1
+ Trestle.ready(function() {
2
+ $('input[type="date"][data-picker="true"]').flatpickr({
3
+ allowInput: true,
4
+ altInput: true,
5
+ altFormat: "m/d/Y",
6
+ });
7
+
8
+ $('input[type="datetime"][data-picker="true"], input[type="datetime-local"][data-picker="true"]').flatpickr({
9
+ enableTime: true,
10
+ allowInput: true,
11
+ altInput: true,
12
+ altFormat: "m/d/Y h:i K",
13
+ });
14
+
15
+ $('input[type="time"][data-picker="true"]').flatpickr({
16
+ enableTime: true,
17
+ noCalendar: true,
18
+ allowInput: true,
19
+ altInput: true,
20
+ altFormat: "h:i K"
21
+ });
22
+ });
@@ -0,0 +1,11 @@
1
+ // Add error indicators to tabs
2
+ Trestle.ready(function() {
3
+ $('.tab-pane').each(function() {
4
+ var errorCount = $(this).find('.has-error').length;
5
+
6
+ if (errorCount > 0) {
7
+ var indicator = $("<span>").addClass('label label-danger label-pill').text(errorCount);
8
+ $(".nav-tabs a[href='#" + $(this).attr('id') + "']").append(indicator);
9
+ }
10
+ });
11
+ });
@@ -0,0 +1,6 @@
1
+ // Prevent enter key from submitting the form
2
+ $(document).on('keypress', '.app-main form :input:not(textarea):not([type=submit])', function(e) {
3
+ if (e.keyCode == 13) {
4
+ e.preventDefault();
5
+ }
6
+ });
@@ -0,0 +1,27 @@
1
+ Trestle.ready(function() {
2
+ $('[data-behavior~="zoom"]').magnificPopup({
3
+ type: 'image',
4
+ closeOnContentClick: false,
5
+ closeBtnInside: false,
6
+ mainClass: 'mfp-with-zoom mfp-img-mobile',
7
+ zoom: {
8
+ enabled: true,
9
+ duration: 150
10
+ }
11
+ });
12
+
13
+ $('[data-behavior~="gallery"]').magnificPopup({
14
+ delegate: 'a',
15
+ type: 'image',
16
+ closeOnContentClick: false,
17
+ closeBtnInside: false,
18
+ mainClass: 'mfp-with-zoom mfp-img-mobile',
19
+ gallery: {
20
+ enabled: true
21
+ },
22
+ zoom: {
23
+ enabled: true,
24
+ duration: 150
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,11 @@
1
+ Trestle.ready(function() {
2
+ $('select[data-enable-select2]').each(function() {
3
+ $(this).select2({
4
+ theme: 'bootstrap',
5
+ containerCssClass: ':all:',
6
+ dropdownCssClass: function(el) {
7
+ return el[0].className.replace(/\s*form-control\s*/, '');
8
+ }
9
+ });
10
+ });
11
+ });
@@ -0,0 +1,52 @@
1
+ Trestle.ready(function() {
2
+ var sidebar = $('.app-sidebar');
3
+
4
+ // Toggle mobile navigation using menu button
5
+
6
+ sidebar.find('.navbar-toggle').on('click', function(e) {
7
+ e.preventDefault();
8
+
9
+ $('.app-wrapper').addClass('animate');
10
+ $('body').toggleClass('mobile-nav-expanded');
11
+ });
12
+
13
+ $('.app-wrapper').on('transitionend webkitTransitionEnd', function() {
14
+ $(this).removeClass('animate');
15
+ });
16
+
17
+
18
+ // Interacting outside of the sidebar closes the navigation
19
+
20
+ $('.app-wrapper').on('click touchstart', function(e) {
21
+ var navExpanded = $('body').hasClass('mobile-nav-expanded');
22
+
23
+ var clickInHeader = $(e.target).closest('.app-header').length;
24
+ var clickInSidebar = $(e.target).closest('.app-sidebar').length;
25
+
26
+ if (navExpanded && !clickInHeader && !clickInSidebar) {
27
+ e.stopPropagation();
28
+ e.preventDefault();
29
+
30
+ $('.app-wrapper').addClass('animate');
31
+ $('body').removeClass('mobile-nav-expanded');
32
+ }
33
+ });
34
+
35
+
36
+ // Toggle sidebar expand/collapse
37
+
38
+ sidebar.find('.toggle-sidebar').on('click', function(e) {
39
+ e.preventDefault();
40
+
41
+ if (sidebar.hasClass('expanded') || sidebar.hasClass('collapsed')) {
42
+ sidebar.removeClass('expanded').removeClass('collapsed');
43
+ document.cookie = "trestle:sidebar=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
44
+ } else if ($(document).width() >= 1200) {
45
+ sidebar.addClass('collapsed');
46
+ document.cookie = "trestle:sidebar=collapsed; path=/";
47
+ } else if ($(document).width() >= 768) {
48
+ sidebar.addClass('expanded');
49
+ document.cookie = "trestle:sidebar=expanded; path=/";
50
+ }
51
+ });
52
+ });
@@ -0,0 +1,21 @@
1
+ $(document).on('click', 'tr[data-url]', function(e) {
2
+ var row = $(e.currentTarget);
3
+
4
+ if (row.data('url') == 'auto') {
5
+ var url = row.find('td:not(.actions) a:first').attr('href');
6
+ } else {
7
+ var url = row.data('url');
8
+ }
9
+
10
+ if (url) {
11
+ if (e.metaKey || e.ctrlKey) {
12
+ window.open(url, '_blank');
13
+ } else {
14
+ Trestle.visit(url);
15
+ }
16
+ }
17
+ });
18
+
19
+ $(document).on('click', 'tr[data-url] a', function(e) {
20
+ e.stopPropagation();
21
+ });
@@ -0,0 +1,13 @@
1
+ Trestle.ready(function() {
2
+ $("a[data-toggle='tab']").on('shown.bs.tab', function(e) {
3
+ var hash = $(this).attr("href");
4
+
5
+ if (hash.substr(0, 1) == "#") {
6
+ history.replaceState({ turbolinks: {} }, "", "#!" + hash.substr(1));
7
+ }
8
+ });
9
+
10
+ if (location.hash.substr(0, 2) == "#!") {
11
+ $("a[data-toggle='tab'][href='#" + location.hash.substr(2) + "']").tab("show");
12
+ }
13
+ });
@@ -0,0 +1,3 @@
1
+ Trestle.ready(function() {
2
+ $('[data-toggle="tooltip"]').tooltip();
3
+ });
@@ -0,0 +1,23 @@
1
+ //= require trestle/jquery
2
+ //= require trestle/jquery_ujs
3
+ //= require trestle/bootstrap
4
+ //= require trestle/bootstrap-confirmation
5
+ //= require trestle/magnific-popup
6
+ //= require trestle/flatpickr
7
+ //= require trestle/select2
8
+ //
9
+ //= require_self
10
+ //= require trestle/custom
11
+ //= require_tree .
12
+
13
+ var Trestle = window.Trestle = {};
14
+
15
+ Trestle.i18n = {};
16
+
17
+ if (typeof(Turbolinks) !== 'undefined' && Turbolinks.supported) {
18
+ Trestle.ready = function(callback) { $(document).on('turbolinks:load', callback); };
19
+ Trestle.visit = function(url) { Turbolinks.visit(url); };
20
+ } else {
21
+ Trestle.ready = function(callback) { $(callback); };
22
+ Trestle.visit = function(url) { document.location = url; };
23
+ }
@@ -0,0 +1,4 @@
1
+ // This file is left as an extension point for user customization.
2
+ //
3
+ // It will be overridden by the similarly named file within
4
+ // the app/assets folder of the Rails application.
@@ -77,4 +77,10 @@
77
77
  height: 32px;
78
78
  vertical-align: middle;
79
79
  }
80
+
81
+ ul, ol {
82
+ margin-bottom: 0;
83
+ padding-left: 0;
84
+ list-style-position: inside;
85
+ }
80
86
  }
@@ -5,7 +5,7 @@ module Trestle
5
5
  options[:as] ||= admin.admin_name.singularize
6
6
 
7
7
  form_for(instance, options) do |f|
8
- with_form(f) { yield }
8
+ with_form(f) { yield f }
9
9
  end
10
10
  end
11
11
 
@@ -0,0 +1,48 @@
1
+ module Trestle
2
+ module FormatHelper
3
+ def format_value(value, options={})
4
+ if options.key?(:format)
5
+ format_value_from_options(value, options)
6
+ else
7
+ autoformat_value(value, options)
8
+ end
9
+ end
10
+
11
+ def format_value_from_options(value, options={})
12
+ case options[:format]
13
+ when :currency
14
+ number_to_currency(value)
15
+ when :tags
16
+ safe_join(value.map { |tag| content_tag(:span, tag, class: "tag") })
17
+ else
18
+ value
19
+ end
20
+ end
21
+
22
+ def autoformat_value(value, options={})
23
+ case value
24
+ when Array
25
+ content_tag(:ol, safe_join(value.map { |v| content_tag(:li, autoformat_value(v, options)) }, "\n"))
26
+ when Time, DateTime
27
+ timestamp(value)
28
+ when Date
29
+ datestamp(value)
30
+ when TrueClass, FalseClass
31
+ status_tag(icon("fa fa-check"), :success) if value
32
+ when NilClass
33
+ text = options.key?(:blank) ? options[:blank] : I18n.t("admin.format.blank")
34
+ content_tag(:span, text, class: "blank")
35
+ when String
36
+ if value.html_safe? || options[:truncate] == false
37
+ value
38
+ else
39
+ truncate(value, options[:truncate] || {})
40
+ end
41
+ when ->(value) { value.respond_to?(:id) }
42
+ display(value)
43
+ else
44
+ value
45
+ end
46
+ end
47
+ end
48
+ end
@@ -6,13 +6,7 @@ module Trestle
6
6
  content = capture(&block)
7
7
  end
8
8
 
9
- if options.key?(:admin)
10
- admin = Trestle.lookup(options.delete(:admin))
11
- else
12
- admin = admin_for(instance) || self.admin
13
- end
14
-
15
- if admin
9
+ if admin = (options.key?(:admin) ? Trestle.lookup(options.delete(:admin)) : admin_for(instance))
16
10
  link_to(content, admin_url_for(instance, admin: admin), options)
17
11
  else
18
12
  content
@@ -20,7 +14,7 @@ module Trestle
20
14
  end
21
15
 
22
16
  def admin_url_for(instance, options={})
23
- admin = Trestle.lookup(options[:admin] || self.admin)
17
+ admin = options.key?(:admin) ? Trestle.lookup(options[:admin]) : admin_for(instance)
24
18
  admin.path(options[:action] || :show, id: admin.to_param(instance)) if admin
25
19
  end
26
20
 
@@ -23,11 +23,11 @@
23
23
 
24
24
  <script type="text/javascript">
25
25
  <% Trestle.config.javascript_i18n_keys.each do |key| %>
26
- Trestle.i18n['<%= key %>'] = "<%= escape_javascript(t(key, default: t(key, locale: :en))) %>";
26
+ Trestle.i18n['<%= key %>'] = "<%= escape_javascript(t(key, default: t(key, locale: :en))) %>";
27
27
  <% end %>
28
28
 
29
- if (Flatpickr.l10ns['<%= I18n.locale %>']) {
30
- Flatpickr.localize(Flatpickr.l10ns['<%= I18n.locale %>']);
29
+ if (flatpickr.l10ns['<%= I18n.locale %>']) {
30
+ flatpickr.localize(flatpickr.l10ns['<%= I18n.locale %>']);
31
31
  }
32
32
  </script>
33
33
 
@@ -1,5 +1,5 @@
1
1
  <% content_for(:title, admin.admin_name.titleize) %>
2
2
 
3
3
  <%= render layout: "layout" do %>
4
- To customize this template, please create <code>app/views/<%= admin.controller_path %>/index.html.erb</code>.
4
+ <p><%= t("trestle.onboarding.no_template", path: "app/views/#{admin.controller_path}/index.html.erb", default: "To customize this template, please create <code>%{path}</code>.").html_safe %></p>
5
5
  <% end %>
@@ -1,5 +1,5 @@
1
- <% content_for(:title, "Welcome to Trestle") %>
1
+ <% content_for(:title, t("trestle.onboarding.welcome", default: "Welcome to Trestle")) %>
2
2
 
3
3
  <%= render layout: "layout" do %>
4
- <p>To begin, please create an admin within <code>app/admin</code>.</p>
4
+ <p><%= t("trestle.onboarding.no_admins", default: "To begin, please create an admin within <code>app/admin</code>.").html_safe %></p>
5
5
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% if admin.form -%>
2
2
  <%= admin.form.render(self, instance) %>
3
3
  <% else %>
4
- <p>Please define a form block or create a <code>_form.html</code> partial.</p>
4
+ <p><%= t("trestle.onboarding.no_form", default: "Please define a form block or create a <code>_form.html</code> partial.").html_safe %></p>
5
5
  <% end %>
@@ -1,4 +1,4 @@
1
- <% title = I18n.t("admin.titles.edit", default: "Editing %{model_name}", model_name: admin.model_name, pluralized_model_name: admin.model_name.pluralize) %>
1
+ <% title = t("admin.titles.edit", default: "Editing %{model_name}", model_name: admin.model_name, pluralized_model_name: admin.model_name.pluralize) %>
2
2
 
3
3
  <% content_for(:title, title) %>
4
4
  <% breadcrumb title %>
@@ -13,6 +13,6 @@
13
13
  <% end unless admin.readonly? %>
14
14
  <% end %>
15
15
 
16
- <%= trestle_form_for instance, url: admin.readonly? ? "#" : admin.path(:update, id: admin.to_param(instance)) do |f| %>
16
+ <%= trestle_form_for instance, url: admin.readonly? ? "#" : admin.path(:update, id: admin.to_param(instance)), method: :patch do |f| %>
17
17
  <%= render partial: "form", layout: "layout" %>
18
18
  <% end %>
@@ -1,4 +1,4 @@
1
- <% content_for(:title, I18n.t("admin.titles.index", default: "Listing %{pluralized_model_name}", model_name: admin.model_name, pluralized_model_name: admin.model_name.pluralize)) %>
1
+ <% content_for(:title, t("admin.titles.index", default: "Listing %{pluralized_model_name}", model_name: admin.model_name, pluralized_model_name: admin.model_name.pluralize)) %>
2
2
 
3
3
  <% content_for(:primary_toolbar) do %>
4
4
  <%= link_to icon("fa fa-plus"), admin.path(:new), class: "btn btn-default btn-lg" unless admin.readonly? %>
@@ -7,6 +7,6 @@
7
7
  <%= button_tag t("admin.buttons.save", default: "Save %{model_name}", model_name: admin.model_name), class: "btn btn-success btn-lg" %>
8
8
  <% end %>
9
9
 
10
- <%= trestle_form_for instance, url: admin.path do |f| %>
10
+ <%= trestle_form_for instance, url: admin.path, method: :post do |f| %>
11
11
  <%= render partial: "form", layout: "layout" %>
12
12
  <% end %>
@@ -1,4 +1,4 @@
1
- <% title = I18n.t("admin.titles.edit", default: "Editing %{model_name}", model_name: admin.model_name, pluralized_model_name: admin.model_name.pluralize) %>
1
+ <% title = t("admin.titles.edit", default: "Editing %{model_name}", model_name: admin.model_name, pluralized_model_name: admin.model_name.pluralize) %>
2
2
 
3
3
  <% content_for(:title, title) %>
4
4
  <% breadcrumb title %>
@@ -13,6 +13,6 @@
13
13
  <% end unless admin.readonly? %>
14
14
  <% end %>
15
15
 
16
- <%= trestle_form_for instance, url: admin.readonly? ? "#" : admin.path(:update, id: admin.to_param(instance)) do |f| %>
16
+ <%= trestle_form_for instance, url: admin.readonly? ? "#" : admin.path(:update, id: admin.to_param(instance)), method: :patch do |f| %>
17
17
  <%= render partial: "form", layout: "layout" %>
18
18
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <aside class="app-sidebar<%= " #{cookies["trestle:sidebar"]}" if cookies["trestle:sidebar"] %>">
2
2
  <header class="app-sidebar-header">
3
3
  <button class="navbar-toggle">
4
- <span class="sr-only">Toggle navigation</span>
4
+ <span class="sr-only"><%= t("admin.ui.toggle_navigation", default: "Toggle navigation") %></span>
5
5
  <span class="icon-bar"></span>
6
6
  <span class="icon-bar"></span>
7
7
  <span class="icon-bar"></span>
@@ -32,6 +32,8 @@
32
32
  <% end %>
33
33
  </nav>
34
34
 
35
- <button class="toggle-sidebar"></button>
35
+ <button class="toggle-sidebar">
36
+ <span class="sr-only"><%= t("admin.ui.toggle_sidebar", default: "Toggle sidebar") %></span>
37
+ </button>
36
38
  </div>
37
39
  </aside>