trestle 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +12 -5
  3. data/Gemfile +1 -0
  4. data/README.md +1 -1
  5. data/app/assets/bundle/trestle/bundle.css +0 -0
  6. data/app/assets/bundle/trestle/bundle.js +0 -0
  7. data/app/assets/bundle/trestle/fa-brands-400.eot +0 -0
  8. data/app/assets/bundle/trestle/fa-brands-400.svg +0 -0
  9. data/app/assets/bundle/trestle/fa-brands-400.ttf +0 -0
  10. data/app/assets/bundle/trestle/fa-brands-400.woff +0 -0
  11. data/app/assets/bundle/trestle/fa-brands-400.woff2 +0 -0
  12. data/app/assets/bundle/trestle/fa-regular-400.eot +0 -0
  13. data/app/assets/bundle/trestle/fa-regular-400.svg +0 -0
  14. data/app/assets/bundle/trestle/fa-regular-400.ttf +0 -0
  15. data/app/assets/bundle/trestle/fa-regular-400.woff +0 -0
  16. data/app/assets/bundle/trestle/fa-regular-400.woff2 +0 -0
  17. data/app/assets/bundle/trestle/fa-solid-900.eot +0 -0
  18. data/app/assets/bundle/trestle/fa-solid-900.svg +0 -0
  19. data/app/assets/bundle/trestle/fa-solid-900.ttf +0 -0
  20. data/app/assets/bundle/trestle/fa-solid-900.woff +0 -0
  21. data/app/assets/bundle/trestle/fa-solid-900.woff2 +0 -0
  22. data/app/assets/bundle/trestle/flatpickr/ar.js +0 -0
  23. data/app/assets/bundle/trestle/flatpickr/at.js +0 -0
  24. data/app/assets/bundle/trestle/flatpickr/az.js +0 -0
  25. data/app/assets/bundle/trestle/flatpickr/be.js +0 -0
  26. data/app/assets/bundle/trestle/flatpickr/bg.js +0 -0
  27. data/app/assets/bundle/trestle/flatpickr/bn.js +0 -0
  28. data/app/assets/bundle/trestle/flatpickr/bs.js +0 -0
  29. data/app/assets/bundle/trestle/flatpickr/cat.js +0 -0
  30. data/app/assets/bundle/trestle/flatpickr/cs.js +0 -0
  31. data/app/assets/bundle/trestle/flatpickr/cy.js +0 -0
  32. data/app/assets/bundle/trestle/flatpickr/da.js +0 -0
  33. data/app/assets/bundle/trestle/flatpickr/de.js +0 -0
  34. data/app/assets/bundle/trestle/flatpickr/default.js +0 -0
  35. data/app/assets/bundle/trestle/flatpickr/eo.js +0 -0
  36. data/app/assets/bundle/trestle/flatpickr/es.js +0 -0
  37. data/app/assets/bundle/trestle/flatpickr/et.js +0 -0
  38. data/app/assets/bundle/trestle/flatpickr/fa.js +0 -0
  39. data/app/assets/bundle/trestle/flatpickr/fi.js +0 -0
  40. data/app/assets/bundle/trestle/flatpickr/fo.js +0 -0
  41. data/app/assets/bundle/trestle/flatpickr/fr.js +0 -0
  42. data/app/assets/bundle/trestle/flatpickr/ga.js +0 -0
  43. data/app/assets/bundle/trestle/flatpickr/gr.js +0 -0
  44. data/app/assets/bundle/trestle/flatpickr/he.js +0 -0
  45. data/app/assets/bundle/trestle/flatpickr/hi.js +0 -0
  46. data/app/assets/bundle/trestle/flatpickr/hr.js +0 -0
  47. data/app/assets/bundle/trestle/flatpickr/hu.js +0 -0
  48. data/app/assets/bundle/trestle/flatpickr/id.js +0 -0
  49. data/app/assets/bundle/trestle/flatpickr/is.js +0 -0
  50. data/app/assets/bundle/trestle/flatpickr/it.js +0 -0
  51. data/app/assets/bundle/trestle/flatpickr/ja.js +0 -0
  52. data/app/assets/bundle/trestle/flatpickr/ka.js +0 -0
  53. data/app/assets/bundle/trestle/flatpickr/km.js +0 -0
  54. data/app/assets/bundle/trestle/flatpickr/ko.js +0 -0
  55. data/app/assets/bundle/trestle/flatpickr/kz.js +0 -0
  56. data/app/assets/bundle/trestle/flatpickr/lt.js +0 -0
  57. data/app/assets/bundle/trestle/flatpickr/lv.js +0 -0
  58. data/app/assets/bundle/trestle/flatpickr/mk.js +0 -0
  59. data/app/assets/bundle/trestle/flatpickr/mn.js +0 -0
  60. data/app/assets/bundle/trestle/flatpickr/ms.js +0 -0
  61. data/app/assets/bundle/trestle/flatpickr/my.js +0 -0
  62. data/app/assets/bundle/trestle/flatpickr/nl.js +0 -0
  63. data/app/assets/bundle/trestle/flatpickr/no.js +0 -0
  64. data/app/assets/bundle/trestle/flatpickr/pa.js +0 -0
  65. data/app/assets/bundle/trestle/flatpickr/pl.js +0 -0
  66. data/app/assets/bundle/trestle/flatpickr/pt.js +0 -0
  67. data/app/assets/bundle/trestle/flatpickr/ro.js +0 -0
  68. data/app/assets/bundle/trestle/flatpickr/ru.js +0 -0
  69. data/app/assets/bundle/trestle/flatpickr/si.js +0 -0
  70. data/app/assets/bundle/trestle/flatpickr/sk.js +0 -0
  71. data/app/assets/bundle/trestle/flatpickr/sl.js +0 -0
  72. data/app/assets/bundle/trestle/flatpickr/sq.js +0 -0
  73. data/app/assets/bundle/trestle/flatpickr/sr-cyr.js +0 -0
  74. data/app/assets/bundle/trestle/flatpickr/sr.js +0 -0
  75. data/app/assets/bundle/trestle/flatpickr/sv.js +0 -0
  76. data/app/assets/bundle/trestle/flatpickr/th.js +0 -0
  77. data/app/assets/bundle/trestle/flatpickr/tr.js +0 -0
  78. data/app/assets/bundle/trestle/flatpickr/uk.js +0 -0
  79. data/app/assets/bundle/trestle/flatpickr/uz.js +0 -0
  80. data/app/assets/bundle/trestle/flatpickr/uz_latn.js +0 -0
  81. data/app/assets/bundle/trestle/flatpickr/vn.js +0 -0
  82. data/app/assets/bundle/trestle/flatpickr/zh-tw.js +0 -0
  83. data/app/assets/bundle/trestle/flatpickr/zh.js +0 -0
  84. data/app/controllers/trestle/admin_controller.rb +23 -25
  85. data/app/controllers/trestle/application_controller.rb +10 -12
  86. data/app/controllers/trestle/dashboard_controller.rb +11 -13
  87. data/app/controllers/trestle/resource_controller.rb +5 -7
  88. data/app/helpers/trestle/layout_helper.rb +20 -0
  89. data/app/helpers/trestle/navigation_helper.rb +23 -0
  90. data/app/views/layouts/trestle/admin.html.erb +2 -2
  91. data/app/views/trestle/resource/_scopes.html.erb +17 -8
  92. data/app/views/trestle/resource/index.html.erb +1 -1
  93. data/app/views/trestle/shared/_sidebar.html.erb +4 -5
  94. data/frontend/css/components/_fields.scss +5 -0
  95. data/frontend/css/components/_scopes.scss +65 -22
  96. data/frontend/css/layout/_content.scss +5 -2
  97. data/frontend/css/variables/_trestle.scss +5 -5
  98. data/frontend/js/components/navigation.js +63 -0
  99. data/frontend/js/components/sidebar.js +4 -7
  100. data/lib/trestle/evaluation_context.rb +11 -3
  101. data/lib/trestle/form/fields/form_group.rb +6 -4
  102. data/lib/trestle/navigation/group.rb +4 -0
  103. data/lib/trestle/resource.rb +2 -2
  104. data/lib/trestle/resource/builder.rb +3 -2
  105. data/lib/trestle/resource/collection.rb +1 -5
  106. data/lib/trestle/scopes.rb +37 -9
  107. data/lib/trestle/scopes/definition.rb +22 -0
  108. data/lib/trestle/scopes/scope.rb +5 -1
  109. data/lib/trestle/version.rb +1 -1
  110. data/webpack.config.js +4 -1
  111. data/yarn.lock +771 -712
  112. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c79f7b5d12b485966fe7c165b5481e00f9e411e353a74818d91dc9d17c4dd6f2
4
- data.tar.gz: 8502c2dee447e7ad01ccb3df23d3b17dc1e02db3e8f1de5049cbb3a245655a43
3
+ metadata.gz: 0fbbf8844e06a0b7770f4754ae4b9082d2718705a4636072f5b02b8920cfed43
4
+ data.tar.gz: 03311a6ef3ef6fc6e95abdb956de744347f44bacdfc0c25253eb6185a1855235
5
5
  SHA512:
6
- metadata.gz: 8c86b38910a39e0c8cc45625db9b34860074491b4f6b8033c7ac54d17706ca2efae535d9657efb6725b744adcb5c91b4854e84c6e58ff34a79f8648328dc36be
7
- data.tar.gz: e597539d8dc3285a710da28be1b935d2c0c0ef2d555d193dd03d402f109929a93c63db9b3e5d518846e33a69ad4e52be712b5a7f3aefb9bc02d3cd2ae5303a0d
6
+ metadata.gz: 5c3935441a6a9bde8ed536cdd08b3642c7114ac697a1e986d5f189da4ce61c3705df26d7de1383e4644c7391f7cb33be5baf2ddac949a5115ad4ef589f5c505a
7
+ data.tar.gz: ab4b6fb774080b47600871f008cd3f3cd6aa1a2c2f0b4f9f9cd9536223147c97b8567c67732d2496941a0441535ab0c5e7020f9a5dc62dd465e1a1199110d914
data/.travis.yml CHANGED
@@ -7,20 +7,27 @@ before_install:
7
7
  - gem install bundler
8
8
 
9
9
  rvm:
10
- - 2.6.5
11
- - 2.7.1
10
+ - 2.6.6
11
+ - 2.7.2
12
12
 
13
13
  gemfile:
14
14
  - gemfiles/rails-5.0.gemfile
15
15
  - gemfiles/rails-5.1.gemfile
16
16
  - gemfiles/rails-5.2.gemfile
17
17
  - gemfiles/rails-6.0.gemfile
18
+ - gemfiles/rails-6.1.gemfile
18
19
 
19
20
  addons:
20
21
  chrome: stable
21
22
 
22
23
  jobs:
23
24
  include:
24
- gemfile: gemfiles/rails-4.2.gemfile
25
- before_install:
26
- - gem install bundler -v '< 2'
25
+ - gemfile: gemfiles/rails-4.2.gemfile
26
+ before_install:
27
+ - gem install bundler -v '< 2'
28
+
29
+ # - gemfile: gemfiles/rails-6.0.gemfile
30
+ # rvm: 3.0.0
31
+
32
+ - gemfile: gemfiles/rails-6.1.gemfile
33
+ rvm: 3.0.0
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ group :test do
9
9
 
10
10
  gem 'capybara'
11
11
  gem 'capybara-selenium'
12
+ gem 'rexml'
12
13
  gem 'selenium-webdriver'
13
14
  gem 'webdrivers'
14
15
  gem 'puma'
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  # Trestle
6
6
 
7
7
  [![RubyGem](https://img.shields.io/gem/v/trestle.svg?style=flat&colorB=4065a9)](https://rubygems.org/gems/trestle)
8
- [![Travis](https://img.shields.io/travis/TrestleAdmin/trestle.svg?style=flat)](https://travis-ci.org/TrestleAdmin/trestle)
8
+ [![Travis](https://img.shields.io/travis/TrestleAdmin/trestle.svg?style=flat)](https://travis-ci.com/github/TrestleAdmin/trestle)
9
9
  [![Coveralls](https://img.shields.io/coveralls/TrestleAdmin/trestle.svg?style=flat)](https://coveralls.io/github/TrestleAdmin/trestle)
10
10
  [![Code Climate](https://api.codeclimate.com/v1/badges/c529a7a9c500ed81baed/maintainability)](https://codeclimate.com/github/TrestleAdmin/trestle)
11
11
 
Binary file
Binary file
@@ -1,33 +1,31 @@
1
- module Trestle
2
- class AdminController < ApplicationController
3
- def index
4
- end
1
+ class Trestle::AdminController < Trestle::ApplicationController
2
+ def index
3
+ end
5
4
 
6
- class << self
7
- attr_reader :admin
5
+ class << self
6
+ attr_reader :admin
8
7
 
9
- private
10
- def local_prefixes
11
- return admin.view_path_prefixes if admin
12
- [controller_path.sub(/\/$/, "")]
13
- end
8
+ private
9
+ def local_prefixes
10
+ return admin.view_path_prefixes if admin
11
+ [controller_path.sub(/\/$/, "")]
14
12
  end
13
+ end
15
14
 
16
- def admin
17
- @_admin ||= self.class.admin.new(self)
18
- end
19
- helper_method :admin
15
+ def admin
16
+ @_admin ||= self.class.admin.new(self)
17
+ end
18
+ helper_method :admin
20
19
 
21
- protected
22
- def breadcrumbs
23
- @_breadcrumbs ||= admin.breadcrumbs.dup
24
- end
20
+ protected
21
+ def breadcrumbs
22
+ @_breadcrumbs ||= admin.breadcrumbs.dup
23
+ end
25
24
 
26
- def flash_message(type, title:, message:)
27
- {
28
- title: admin.t("flash.#{type}.title", default: title),
29
- message: admin.t("flash.#{type}.message", default: message)
30
- }
31
- end
25
+ def flash_message(type, title:, message:)
26
+ {
27
+ title: admin.t("flash.#{type}.title", default: title),
28
+ message: admin.t("flash.#{type}.message", default: message)
29
+ }
32
30
  end
33
31
  end
@@ -1,14 +1,12 @@
1
- module Trestle
2
- class ApplicationController < ActionController::Base
3
- protect_from_forgery
1
+ class Trestle::ApplicationController < ActionController::Base
2
+ protect_from_forgery
4
3
 
5
- include Controller::Breadcrumbs
6
- include Controller::Callbacks
7
- include Controller::Dialog
8
- include Controller::Helpers
9
- include Controller::Layout
10
- include Controller::Location
11
- include Controller::Title
12
- include Controller::Toolbars
13
- end
4
+ include Trestle::Controller::Breadcrumbs
5
+ include Trestle::Controller::Callbacks
6
+ include Trestle::Controller::Dialog
7
+ include Trestle::Controller::Helpers
8
+ include Trestle::Controller::Layout
9
+ include Trestle::Controller::Location
10
+ include Trestle::Controller::Title
11
+ include Trestle::Controller::Toolbars
14
12
  end
@@ -1,17 +1,15 @@
1
- module Trestle
2
- class DashboardController < ApplicationController
3
- def index
4
- admin = primary_admin
5
- redirect_to admin.path if admin
6
- end
1
+ class Trestle::DashboardController < Trestle::ApplicationController
2
+ def index
3
+ admin = primary_admin
4
+ redirect_to admin.path if admin
5
+ end
7
6
 
8
- private
9
- def primary_admin
10
- if navigation = Trestle.navigation(self).first
11
- navigation.admin
12
- elsif Trestle.admins.values.any?
13
- Trestle.admins.values.first
14
- end
7
+ private
8
+ def primary_admin
9
+ if navigation = Trestle.navigation(self).first
10
+ navigation.admin
11
+ elsif Trestle.admins.values.any?
12
+ Trestle.admins.values.first
15
13
  end
16
14
  end
17
15
  end
@@ -1,8 +1,6 @@
1
- module Trestle
2
- class ResourceController < AdminController
3
- include Resource::Controller::Actions
4
- include Resource::Controller::DataMethods
5
- include Resource::Controller::Redirection
6
- include Resource::Controller::Toolbar
7
- end
1
+ class Trestle::ResourceController < Trestle::AdminController
2
+ include Trestle::Resource::Controller::Actions
3
+ include Trestle::Resource::Controller::DataMethods
4
+ include Trestle::Resource::Controller::Redirection
5
+ include Trestle::Resource::Controller::Toolbar
8
6
  end
@@ -0,0 +1,20 @@
1
+ module Trestle
2
+ module LayoutHelper
3
+ SIDEBAR_CLASSES = {
4
+ "expanded" => "sidebar-expanded",
5
+ "collapsed" => "sidebar-collapsed"
6
+ }
7
+
8
+ def body_attributes
9
+ {
10
+ class: body_classes
11
+ }.reject { |k, v| v.blank? }
12
+ end
13
+
14
+ def body_classes
15
+ [
16
+ SIDEBAR_CLASSES[cookies["trestle:sidebar"]]
17
+ ].compact
18
+ end
19
+ end
20
+ end
@@ -7,5 +7,28 @@ module Trestle
7
7
  def current_admin?(admin)
8
8
  respond_to?(:admin) && self.admin && self.admin.name == admin.name
9
9
  end
10
+
11
+ def navigation_group_collapsed?(group)
12
+ if collapsed_navigation_groups.include?(group.id)
13
+ # Explicitly collapsed by user
14
+ true
15
+ elsif group.collapse?
16
+ # Default to collapsed unless expanded by user
17
+ !expanded_navigation_groups.include?(group.id)
18
+ end
19
+ end
20
+
21
+ private
22
+ def collapsed_navigation_groups
23
+ @collapsed_navigation_groups ||= navigation_groups(:collapsed)
24
+ end
25
+
26
+ def expanded_navigation_groups
27
+ @expanded_navigation_groups ||= navigation_groups(:expanded)
28
+ end
29
+
30
+ def navigation_groups(state)
31
+ cookies["trestle:navigation:#{state}"].try(:split, ",") || []
32
+ end
10
33
  end
11
34
  end
@@ -40,7 +40,7 @@
40
40
  <%= hook :head %>
41
41
  </head>
42
42
 
43
- <body<%=raw " class=\"sidebar-#{cookies["trestle:sidebar"]}\"" if cookies["trestle:sidebar"] %>>
43
+ <%= content_tag :body, body_attributes do %>
44
44
  <div class="app-wrapper">
45
45
  <%= render "trestle/shared/sidebar" %>
46
46
 
@@ -54,5 +54,5 @@
54
54
  <%= render "trestle/shared/footer" %>
55
55
  </div>
56
56
  </div>
57
- </body>
57
+ <% end %>
58
58
  </html>