trestle 0.8.11 → 0.8.12

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +11 -1
  3. data/README.md +8 -3
  4. data/app/assets/javascripts/trestle/components/_confirmation.js +22 -22
  5. data/app/assets/stylesheets/trestle/components/_dropdown.scss +28 -0
  6. data/app/assets/stylesheets/trestle/components/_fields.scss +5 -0
  7. data/app/assets/stylesheets/trestle/core/_defaults.scss +2 -0
  8. data/app/controllers/trestle/dashboard_controller.rb +1 -1
  9. data/app/helpers/trestle/i18n_helper.rb +6 -0
  10. data/app/helpers/trestle/panel_helper.rb +1 -1
  11. data/app/helpers/trestle/toolbars_helper.rb +2 -1
  12. data/app/views/layouts/trestle/admin.html.erb +5 -3
  13. data/app/views/trestle/application/_dialog.html.erb +2 -2
  14. data/app/views/trestle/application/_header.html.erb +2 -2
  15. data/app/views/trestle/shared/_sidebar.html.erb +1 -1
  16. data/config/locales/en.yml +1 -0
  17. data/config/locales/ko.rb +18 -0
  18. data/config/locales/ko.yml +96 -0
  19. data/gemfiles/rails-4.2.gemfile +1 -1
  20. data/gemfiles/rails-5.0.gemfile +1 -1
  21. data/gemfiles/rails-5.1.gemfile +1 -1
  22. data/gemfiles/rails-5.2.gemfile +1 -1
  23. data/gemfiles/rails-edge.gemfile +1 -1
  24. data/lib/generators/trestle/install/templates/trestle.rb.erb +4 -0
  25. data/lib/trestle.rb +5 -3
  26. data/lib/trestle/adapters/adapter.rb +2 -17
  27. data/lib/trestle/configuration.rb +3 -0
  28. data/lib/trestle/evaluation_context.rb +24 -0
  29. data/lib/trestle/form/fields/password_field.rb +4 -0
  30. data/lib/trestle/form/fields/select.rb +3 -1
  31. data/lib/trestle/form/renderer.rb +1 -0
  32. data/lib/trestle/navigation.rb +6 -6
  33. data/lib/trestle/navigation/block.rb +6 -6
  34. data/lib/trestle/resource.rb +6 -1
  35. data/lib/trestle/resource/builder.rb +6 -5
  36. data/lib/trestle/scopes.rb +23 -0
  37. data/lib/trestle/scopes/block.rb +38 -0
  38. data/lib/trestle/scopes/scope.rb +49 -0
  39. data/lib/trestle/toolbar.rb +11 -0
  40. data/lib/trestle/toolbar/builder.rb +8 -27
  41. data/lib/trestle/toolbar/item.rb +118 -0
  42. data/lib/trestle/toolbar/menu.rb +63 -0
  43. data/lib/trestle/version.rb +1 -1
  44. data/trestle.gemspec +4 -4
  45. metadata +34 -28
  46. data/lib/trestle/scope.rb +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1640cda170a3f473968769e1c0380de2689ac11ecdd88c0b19bf93796701680
4
- data.tar.gz: c3c78457d933155de6eba4bac6500a906e4fb78dce4232a68040ddeb2dfd919e
3
+ metadata.gz: be67cdeb0e544dff3707615b388ab9380f23cc4f10b8ac026f77681a2b89a58d
4
+ data.tar.gz: e560c637fb2418ec119bbdb895dab33fef47af0647f5c479e53ae0bc7ca71307
5
5
  SHA512:
6
- metadata.gz: d597693a4f29721adb0a3b8e0b6d15679bef552b6d050b390940fcf53a28922f99cca9c993d1f9458d284786f5f4e29fbce2bef6bcc7891be639b53e7502ea83
7
- data.tar.gz: ba5bd00f7a509ea1a349e57d52dd46e15f86c78d95fd0cabc755a82c5079155fcc9db8b405523378977119f274d171ff9e3ca0d5c128631a39f6a2fb72577afa
6
+ metadata.gz: ced0081c87529f11111908d9688ccc17c8aa1816d723160980a52892ae1236628c4aa425324f051faa82029add5a042ef211e9a6e9327d3479590e68b0f25dbf
7
+ data.tar.gz: 6129c4dd280c17b4b395b58e3221728e8917a50fdecd1960eedc3ae9ccc1a6dadec63976de3780ef8f10e24022a007f9c523778740b985920e4626fc540aa472
@@ -1,10 +1,11 @@
1
1
  language: ruby
2
2
 
3
3
  before_install:
4
+ - gem update --system
4
5
  - gem install bundler
5
6
 
6
7
  rvm:
7
- - 2.4.1
8
+ - 2.6.1
8
9
 
9
10
  gemfile:
10
11
  - gemfiles/rails-4.2.gemfile
@@ -15,3 +16,12 @@ gemfile:
15
16
 
16
17
  addons:
17
18
  chrome: stable
19
+
20
+ matrix:
21
+ exclude:
22
+ gemfile: gemfiles/rails-4.2.gemfile
23
+
24
+ include:
25
+ gemfile: gemfiles/rails-4.2.gemfile
26
+ before_install:
27
+ - gem install bundler -v '< 2'
data/README.md CHANGED
@@ -9,6 +9,8 @@
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
 
12
+ [Demo Site](https://demo.trestle.io) | [Demo Source Code](https://github.com/TrestleAdmin/RailsFlixDemo)
13
+
12
14
  > A modern, responsive admin framework for Ruby on Rails
13
15
 
14
16
  <img src="https://trestle.io/images/Trestle-Screenshot-1-1x.png?" width="50%" /><img src="https://trestle.io/images/Trestle-Screenshot-2-1x.png?" width="50%" />
@@ -45,9 +47,11 @@ Trestle.resource(:posts) do
45
47
  end
46
48
 
47
49
  # Define custom scopes for the index view
48
- scope :all, default: true
49
- scope :published
50
- scope :drafts, -> { Post.unpublished }
50
+ scopes do
51
+ scope :all, default: true
52
+ scope :published
53
+ scope :drafts, -> { Post.unpublished }
54
+ end
51
55
 
52
56
  # Define the index view table listing
53
57
  table do
@@ -98,6 +102,7 @@ The following plugins are currently available:
98
102
  | *trestle-tinymce* | [TinyMCE](https://www.tinymce.com/) (WYSIWYG editor) integration | [GitHub](https://github.com/TrestleAdmin/trestle-tinymce) \| [RubyGems](https://rubygems.org/gems/trestle-tinymce) |
99
103
  | *trestle-simplemde* | [SimpleMDE](https://simplemde.com/) (Markdown editor) integration | [GitHub](https://github.com/TrestleAdmin/trestle-simplemde) \| [RubyGems](https://rubygems.org/gems/trestle-simplemde) |
100
104
  | *trestle-sidekiq* | [Sidekiq](http://sidekiq.org/) integration | [GitHub](https://github.com/TrestleAdmin/trestle-sidekiq) \| [RubyGems](https://rubygems.org/gems/trestle-sidekiq) |
105
+ | *trestle-active_storage* | [Active Storage](https://guides.rubyonrails.org/active_storage_overview.html) integration | [GitHub](https://github.com/richardvenneman/trestle-active_storage) \| [RubyGems](https://rubygems.org/gems/trestle-active_storage) |
101
106
 
102
107
 
103
108
  ## License
@@ -1,30 +1,30 @@
1
1
  Trestle.confirmation = {};
2
2
 
3
- Trestle.confirmation.DEFAULTS = {
4
- rootSelector: 'body',
5
- singleton: true,
6
- popout: true,
7
- title: Trestle.i18n['admin.confirmation.title'] || 'Are you sure?',
8
- btnOkIcon: '',
9
- btnOkClass: 'btn-primary',
10
- btnOkLabel: Trestle.i18n['admin.confirmation.ok'] || 'OK',
11
- btnCancelIcon: '',
12
- btnCancelClass: 'btn-default',
13
- btnCancelLabel: Trestle.i18n['admin.confirmation.cancel'] || 'Cancel',
14
- copyAttributes: ''
15
- };
3
+ Trestle.ready(function() {
4
+ Trestle.confirmation.DEFAULTS = {
5
+ rootSelector: 'body',
6
+ singleton: true,
7
+ popout: true,
8
+ title: Trestle.i18n['trestle.confirmation.title'] || 'Are you sure?',
9
+ btnOkIcon: '',
10
+ btnOkClass: 'btn-primary',
11
+ btnOkLabel: Trestle.i18n['trestle.confirmation.ok'] || 'OK',
12
+ btnCancelIcon: '',
13
+ btnCancelClass: 'btn-default',
14
+ btnCancelLabel: Trestle.i18n['trestle.confirmation.cancel'] || 'Cancel',
15
+ copyAttributes: ''
16
+ };
16
17
 
17
- Trestle.confirmation.CONFIRM = $.extend({}, Trestle.confirmation.DEFAULTS, {
18
- selector: '[data-toggle="confirm"]'
19
- });
18
+ Trestle.confirmation.CONFIRM = $.extend({}, Trestle.confirmation.DEFAULTS, {
19
+ selector: '[data-toggle="confirm"]'
20
+ });
20
21
 
21
- Trestle.confirmation.DELETE = $.extend({}, Trestle.confirmation.DEFAULTS, {
22
- selector: '[data-toggle="confirm-delete"]',
23
- btnOkClass: 'btn-danger',
24
- btnOkLabel: Trestle.i18n['admin.confirmation.delete'] || 'Delete'
25
- });
22
+ Trestle.confirmation.DELETE = $.extend({}, Trestle.confirmation.DEFAULTS, {
23
+ selector: '[data-toggle="confirm-delete"]',
24
+ btnOkClass: 'btn-danger',
25
+ btnOkLabel: Trestle.i18n['trestle.confirmation.delete'] || 'Delete'
26
+ });
26
27
 
27
- Trestle.ready(function() {
28
28
  // This must be bound to an element beneath document so
29
29
  // that it is fired before any jquery_ujs events.
30
30
  var root = $('body');
@@ -40,4 +40,32 @@
40
40
  right: 11px;
41
41
  }
42
42
  }
43
+
44
+ .dropup & {
45
+ margin-top: 0;
46
+ margin-bottom: 8px;
47
+
48
+ &:before {
49
+ top: auto;
50
+ bottom: -$dropdown-arrow-outer-width;
51
+
52
+ border-bottom: 0;
53
+ border-top: $dropdown-arrow-width solid $dropdown-fallback-border;
54
+ border-top-color: $dropdown-border;
55
+ }
56
+
57
+ &:after {
58
+ top: auto;
59
+ bottom: -$dropdown-arrow-width;
60
+
61
+ border-bottom: 0;
62
+ border-top: $dropdown-arrow-outer-width solid white;
63
+ }
64
+ }
43
65
  }
66
+
67
+ .dropdown-header {
68
+ text-transform: uppercase;
69
+ font-size: 10px;
70
+ font-weight: bold;
71
+ }
@@ -20,6 +20,11 @@
20
20
  // within Bootstrap tabs that are hidden when the page is first loaded.
21
21
  // See: https://github.com/select2/select2/issues/4220
22
22
  width: 100% !important;
23
+
24
+ .select2-results__group {
25
+ font-size: 10px;
26
+ text-transform: uppercase;
27
+ }
23
28
  }
24
29
 
25
30
  .date-select,
@@ -84,6 +84,8 @@ $popover-arrow-width: 7px !default;
84
84
  $dropdown-arrow-width: $popover-arrow-width !default;
85
85
  $dropdown-arrow-outer-width: $dropdown-arrow-width + 1px !default;
86
86
 
87
+ $dropdown-header-color: #aaa !default;
88
+
87
89
  $input-border: #ccc !default;
88
90
  $input-border-focus: mix($brand-primary, $input-border) !default;
89
91
  $input-bg-disabled: #fafafa !default;
@@ -6,7 +6,7 @@ class Trestle::DashboardController < Trestle::ApplicationController
6
6
 
7
7
  private
8
8
  def primary_admin
9
- if navigation = Trestle.navigation.first
9
+ if navigation = Trestle.navigation(self).first
10
10
  navigation.admin
11
11
  elsif Trestle.admins.values.any?
12
12
  Trestle.admins.values.first
@@ -10,5 +10,11 @@ module Trestle
10
10
  [locale]
11
11
  end
12
12
  end
13
+
14
+ def default_translation(key)
15
+ translate(key, locale: :en)
16
+ rescue I18n::InvalidLocale
17
+ key.split(".").last.humanize
18
+ end
13
19
  end
14
20
  end
@@ -3,7 +3,7 @@ module Trestle
3
3
  def panel(options={}, &block)
4
4
  html_class = options.fetch(:class) { "panel-default" }
5
5
 
6
- content_tag(:div, class: ["panel", html_class]) do
6
+ content_tag(:div, options.slice(:id, :data).merge(class: ["panel", html_class])) do
7
7
  if options[:title]
8
8
  concat content_tag(:div, options[:title], class: "panel-heading")
9
9
  end
@@ -1,7 +1,8 @@
1
1
  module Trestle
2
2
  module ToolbarsHelper
3
- def toolbar(name, &block)
3
+ def toolbar(name, options={}, &block)
4
4
  toolbar = (toolbars[name.to_s] ||= Toolbar.new)
5
+ toolbar.clear! if options[:clear]
5
6
  toolbar.prepend(&block) if block_given?
6
7
  toolbar
7
8
  end
@@ -14,6 +14,8 @@
14
14
 
15
15
  <title><%= [yield(:title), Trestle.config.site_title].join(' :: ') %></title>
16
16
 
17
+ <%= favicon_link_tag Trestle.config.favicon if Trestle.config.favicon %>
18
+
17
19
  <%= stylesheet_link_tag "trestle/admin", 'data-turbolinks-track': 'reload' %>
18
20
 
19
21
  <%= hook :stylesheets %>
@@ -21,13 +23,13 @@
21
23
  <%= javascript_include_tag "turbolinks" if Trestle.config.turbolinks %>
22
24
  <%= javascript_include_tag "trestle/admin", 'data-turbolinks-track': 'reload' %>
23
25
 
24
- <script type="text/javascript">
26
+ <%= javascript_tag nonce: true do %>
25
27
  <% Trestle.config.javascript_i18n_keys.each do |key| %>
26
- Trestle.i18n['<%= key %>'] = "<%= escape_javascript(t(key, default: t(key, locale: :en))) %>";
28
+ Trestle.i18n['<%= key %>'] = "<%= escape_javascript(t(key, default: default_translation(key))) %>";
27
29
  <% end %>
28
30
 
29
31
  Trestle.localize(<%= i18n_fallbacks.map { |l| "'#{l}'" }.join(", ").html_safe %>);
30
- </script>
32
+ <% end %>
31
33
 
32
34
  <%= hook :javascripts %>
33
35
 
@@ -22,12 +22,12 @@
22
22
  </div>
23
23
 
24
24
  <div class="modal-footer">
25
- <div class="btn-toolbar secondary-toolbar">
25
+ <div class="btn-toolbar secondary-toolbar" role="toolbar">
26
26
  <%= render_toolbar(toolbar(:secondary)) %>
27
27
  <%= deprecated_toolbar(:secondary) %>
28
28
  </div>
29
29
 
30
- <div class="btn-toolbar primary-toolbar">
30
+ <div class="btn-toolbar primary-toolbar" role="toolbar">
31
31
  <%= render_toolbar(toolbar(:primary)) %>
32
32
  <%= deprecated_toolbar(:primary) %>
33
33
  </div>
@@ -16,12 +16,12 @@
16
16
  </div>
17
17
 
18
18
  <div class="content-header-toolbars">
19
- <div class="btn-toolbar primary-toolbar">
19
+ <div class="btn-toolbar primary-toolbar" role="toolbar">
20
20
  <%= render_toolbar(toolbar(:primary)) %>
21
21
  <%= deprecated_toolbar(:primary) %>
22
22
  </div>
23
23
 
24
- <div class="btn-toolbar secondary-toolbar">
24
+ <div class="btn-toolbar secondary-toolbar" role="toolbar">
25
25
  <%= render_toolbar(toolbar(:secondary)) %>
26
26
  <%= deprecated_toolbar(:secondary) %>
27
27
  </div>
@@ -15,7 +15,7 @@
15
15
  <div class="app-sidebar-inner">
16
16
  <nav class="app-nav">
17
17
  <% collapsed = cookies["trestle:navigation:collapsed"].try(:split, ",") || [] %>
18
- <% Trestle.navigation.visible(self).each do |group, items| %>
18
+ <% Trestle.navigation(self).each do |group, items| %>
19
19
  <ul<% if group.present? && collapsed.include?(group.id) %> class="collapsed"<% end %>>
20
20
  <% if group.present? %>
21
21
  <li class="nav-header"><%= link_to group.label, "##{group.id}" %></li>
@@ -24,6 +24,7 @@ en:
24
24
  ui:
25
25
  toggle_navigation: "Toggle navigation"
26
26
  toggle_sidebar: "Toggle sidebar"
27
+ toggle_dropdown: "Toggle dropdown"
27
28
 
28
29
  dialog:
29
30
  error: "The request could not be completed."
@@ -0,0 +1,18 @@
1
+ {
2
+ ko: {
3
+ date: {
4
+ formats: {
5
+ trestle_date: "%Y년 %m월 %d일",
6
+ trestle_calendar: "%Y년 %m월 %d일",
7
+ }
8
+ },
9
+
10
+ time: {
11
+ formats: {
12
+ trestle_date: "%Y년 %m월 %d일",
13
+ trestle_time: "%H:%M",
14
+ trestle_time_with_seconds: "%H:%M:%S"
15
+ }
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,96 @@
1
+ ko:
2
+ trestle:
3
+ title: "Trestle Admin"
4
+ footer: "Powered by Trestle"
5
+ version: "버전"
6
+
7
+ helpers:
8
+ page_entries_info:
9
+ one_page:
10
+ display_entries:
11
+ zero: "%{entry_name}을(를) 찾을 수 없습니다."
12
+ one: "<strong>1</strong> %{entry_name} 표시중"
13
+ other: "<strong>모든 %{count}</strong> %{entry_name} 표시중"
14
+
15
+ more_pages:
16
+ display_entries: "<b>%{total}</b> 중 <strong>%{first}&nbsp;-&nbsp;%{last}</strong> %{entry_name} 표시중"
17
+
18
+ onboarding:
19
+ welcome: "Trestle에 오신 것을 환영합니다."
20
+ no_admins: "사용하시려면 <code>app/admin</code>에 admin을 생성하십시오."
21
+ no_template: "이 템플릿을 사용자화 하시려면, <code>%{path}</code>를 생성하십시오."
22
+ no_form: "form block을 정의하시거나 <code>_form.html</code> partial를 생성하십시오."
23
+
24
+ ui:
25
+ toggle_navigation: "네비게이션 토글"
26
+ toggle_sidebar: "사이드바 토글"
27
+
28
+ dialog:
29
+ error: "완료될 수 없는 요청입니다."
30
+
31
+ confirmation:
32
+ title: "정말 하시겠습니까?"
33
+ delete: "삭제"
34
+ cancel: "취소"
35
+
36
+ admin:
37
+ titles:
38
+ index: "%{pluralized_model_name} 목록"
39
+ new: "%{model_name} 생성"
40
+ edit: "%{model_name} 수정"
41
+
42
+ buttons:
43
+ new: "%{model_name} 생성"
44
+ save: "%{model_name} 저장"
45
+ delete: "%{model_name} 삭제"
46
+ show: "%{model_name} 보기"
47
+ edit: "%{model_name} 수정"
48
+ ok: "확인"
49
+
50
+ breadcrumbs:
51
+ home: "Home"
52
+
53
+ flash:
54
+ create:
55
+ success:
56
+ title: "성공!"
57
+ message: "%{lowercase_model_name} 성공적으로 생성되었습니다."
58
+
59
+ failure:
60
+ title: "경고!"
61
+ message: "하기된 에러를 확인하십시오."
62
+
63
+ update:
64
+ success:
65
+ title: "성공!"
66
+ message: "%{lowercase_model_name} 성공적으로 수정되었습니다."
67
+
68
+ failure:
69
+ title: "경고!"
70
+ message: "하기된 에러를 확인하십시오."
71
+
72
+ destroy:
73
+ success:
74
+ title: "성공!"
75
+ message: "%{lowercase_model_name} 성공적으로 삭제되었습니다."
76
+
77
+ failure:
78
+ title: "경고!"
79
+ message: "%{lowercase_model_name} 삭제할 수 없습니다."
80
+
81
+ table:
82
+ headers:
83
+ id: "ID"
84
+
85
+ form:
86
+ select:
87
+ prompt: "- %{attribute_name} 선택 -"
88
+
89
+ format:
90
+ blank: "없음"
91
+
92
+ datepicker:
93
+ formats:
94
+ date: "Y/m/d"
95
+ datetime: "Y/m/d h:i K"
96
+ time: "h:i K"
@@ -13,4 +13,4 @@ end
13
13
 
14
14
  gem 'rails', '~> 4.2.0'
15
15
 
16
- gemspec :path => "../"
16
+ gemspec path: "../"
@@ -13,4 +13,4 @@ end
13
13
 
14
14
  gem 'rails', '~> 5.0.0'
15
15
 
16
- gemspec :path => "../"
16
+ gemspec path: "../"
@@ -13,4 +13,4 @@ end
13
13
 
14
14
  gem 'rails', '~> 5.1.0'
15
15
 
16
- gemspec :path => "../"
16
+ gemspec path: "../"
@@ -13,4 +13,4 @@ end
13
13
 
14
14
  gem 'rails', '~> 5.2.0'
15
15
 
16
- gemspec :path => "../"
16
+ gemspec path: "../"
@@ -14,4 +14,4 @@ end
14
14
  gem 'rails', github: 'rails/rails'
15
15
  gem 'arel', github: 'rails/arel'
16
16
 
17
- gemspec :path => "../"
17
+ gemspec path: "../"