trestle 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -5
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/app/assets/bundle/trestle/bundle.css +0 -0
- data/app/assets/bundle/trestle/bundle.js +0 -0
- data/app/assets/bundle/trestle/fa-brands-400.eot +0 -0
- data/app/assets/bundle/trestle/fa-brands-400.svg +0 -0
- data/app/assets/bundle/trestle/fa-brands-400.ttf +0 -0
- data/app/assets/bundle/trestle/fa-brands-400.woff +0 -0
- data/app/assets/bundle/trestle/fa-brands-400.woff2 +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.eot +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.svg +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.ttf +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.woff +0 -0
- data/app/assets/bundle/trestle/fa-regular-400.woff2 +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.eot +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.svg +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.ttf +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.woff +0 -0
- data/app/assets/bundle/trestle/fa-solid-900.woff2 +0 -0
- data/app/assets/bundle/trestle/flatpickr/ar.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/at.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/az.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/be.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/bg.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/bn.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/bs.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/cat.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/cs.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/cy.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/da.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/de.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/default.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/eo.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/es.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/et.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/fa.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/fi.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/fo.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/fr.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/ga.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/gr.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/he.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/hi.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/hr.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/hu.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/id.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/is.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/it.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/ja.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/ka.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/km.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/ko.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/kz.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/lt.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/lv.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/mk.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/mn.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/ms.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/my.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/nl.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/no.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/pa.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/pl.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/pt.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/ro.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/ru.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/si.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/sk.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/sl.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/sq.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/sr-cyr.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/sr.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/sv.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/th.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/tr.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/uk.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/uz.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/uz_latn.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/vn.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/zh-tw.js +0 -0
- data/app/assets/bundle/trestle/flatpickr/zh.js +0 -0
- data/app/controllers/trestle/admin_controller.rb +23 -25
- data/app/controllers/trestle/application_controller.rb +10 -12
- data/app/controllers/trestle/dashboard_controller.rb +11 -13
- data/app/controllers/trestle/resource_controller.rb +5 -7
- data/app/helpers/trestle/layout_helper.rb +20 -0
- data/app/helpers/trestle/navigation_helper.rb +23 -0
- data/app/views/layouts/trestle/admin.html.erb +2 -2
- data/app/views/trestle/resource/_scopes.html.erb +17 -8
- data/app/views/trestle/resource/index.html.erb +1 -1
- data/app/views/trestle/shared/_sidebar.html.erb +4 -5
- data/frontend/css/components/_fields.scss +5 -0
- data/frontend/css/components/_scopes.scss +65 -22
- data/frontend/css/layout/_content.scss +5 -2
- data/frontend/css/variables/_trestle.scss +5 -5
- data/frontend/js/components/navigation.js +63 -0
- data/frontend/js/components/sidebar.js +4 -7
- data/lib/trestle/evaluation_context.rb +11 -3
- data/lib/trestle/form/fields/form_group.rb +6 -4
- data/lib/trestle/navigation/group.rb +4 -0
- data/lib/trestle/resource.rb +2 -2
- data/lib/trestle/resource/builder.rb +3 -2
- data/lib/trestle/resource/collection.rb +1 -5
- data/lib/trestle/scopes.rb +37 -9
- data/lib/trestle/scopes/definition.rb +22 -0
- data/lib/trestle/scopes/scope.rb +5 -1
- data/lib/trestle/version.rb +1 -1
- data/webpack.config.js +4 -1
- data/yarn.lock +771 -712
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fbbf8844e06a0b7770f4754ae4b9082d2718705a4636072f5b02b8920cfed43
|
4
|
+
data.tar.gz: 03311a6ef3ef6fc6e95abdb956de744347f44bacdfc0c25253eb6185a1855235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
11
|
-
- 2.7.
|
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
|
-
|
26
|
-
|
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
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.
|
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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,33 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
end
|
1
|
+
class Trestle::AdminController < Trestle::ApplicationController
|
2
|
+
def index
|
3
|
+
end
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
class << self
|
6
|
+
attr_reader :admin
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
def admin
|
16
|
+
@_admin ||= self.class.admin.new(self)
|
17
|
+
end
|
18
|
+
helper_method :admin
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
protected
|
21
|
+
def breadcrumbs
|
22
|
+
@_breadcrumbs ||= admin.breadcrumbs.dup
|
23
|
+
end
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
2
|
-
|
3
|
-
protect_from_forgery
|
1
|
+
class Trestle::ApplicationController < ActionController::Base
|
2
|
+
protect_from_forgery
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
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
|
-
|
57
|
+
<% end %>
|
58
58
|
</html>
|