locomotivecms 3.2.1 → 3.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -6
  3. data/LICENSE +1 -1
  4. data/README.md +2 -2
  5. data/app/api/locomotive/api.rb +1 -0
  6. data/app/api/locomotive/api/entities/content_entry_entity.rb +4 -0
  7. data/app/api/locomotive/api/forms/page_form.rb +10 -0
  8. data/app/api/locomotive/api/resources/page_resource.rb +2 -0
  9. data/app/api/locomotive/api/resources/url_redirection_resource.rb +69 -0
  10. data/app/assets/images/locomotive/icons/flags/da.png +0 -0
  11. data/app/assets/images/locomotive/icons/flags/el.png +0 -0
  12. data/app/assets/images/locomotive/icons/flags/fa-IR.png +0 -0
  13. data/app/assets/images/locomotive/icons/flags/fi-FI.png +0 -0
  14. data/app/assets/images/locomotive/icons/flags/{ja.png → ja-JP.png} +0 -0
  15. data/app/assets/images/locomotive/icons/flags/{pl.png → pl-PL.png} +0 -0
  16. data/app/assets/images/locomotive/icons/flags/uk.png +0 -0
  17. data/app/assets/javascripts/locomotive/views/inputs/markdown_view.js.coffee +6 -2
  18. data/app/assets/javascripts/locomotive/views/inputs/rte/link_view.js.coffee +1 -1
  19. data/app/assets/javascripts/locomotive/views/inputs/rte/table_view.js.coffee +1 -1
  20. data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +1 -1
  21. data/app/assets/stylesheets/locomotive/new/_flags.scss.erb +2 -1
  22. data/app/assets/stylesheets/locomotive/old/form/_popover.scss +0 -4
  23. data/app/controllers/locomotive/concerns/redirect_to_main_host_controller.rb +1 -1
  24. data/app/controllers/locomotive/current_site_controller.rb +4 -1
  25. data/app/controllers/locomotive/errors_controller.rb +2 -0
  26. data/app/controllers/locomotive/passwords_controller.rb +5 -1
  27. data/app/controllers/locomotive/registrations_controller.rb +6 -0
  28. data/app/controllers/locomotive/sessions_controller.rb +5 -1
  29. data/app/helpers/locomotive/base_helper.rb +18 -0
  30. data/app/helpers/locomotive/custom_fields_helper.rb +14 -0
  31. data/app/helpers/locomotive/shared/pages_helper.rb +4 -0
  32. data/app/helpers/locomotive/sites_helper.rb +4 -4
  33. data/app/models/locomotive/concerns/page/redirect.rb +1 -1
  34. data/app/models/locomotive/concerns/site/locales.rb +3 -4
  35. data/app/models/locomotive/concerns/site/url_redirections.rb +47 -1
  36. data/app/models/locomotive/page.rb +10 -5
  37. data/app/policies/locomotive/page_policy.rb +4 -0
  38. data/app/uploaders/locomotive/theme_asset_uploader.rb +1 -1
  39. data/app/views/locomotive/current_site/_url_redirection.html.slim +9 -5
  40. data/app/views/locomotive/current_site/form/_url_redirections.html.slim +1 -1
  41. data/app/views/locomotive/layouts/account.html.slim +1 -1
  42. data/app/views/locomotive/layouts/error.html.slim +2 -2
  43. data/app/views/locomotive/passwords/edit.html.slim +1 -1
  44. data/app/views/locomotive/passwords/new.html.slim +1 -1
  45. data/app/views/locomotive/registrations/new.html.slim +1 -1
  46. data/app/views/locomotive/sessions/new.html.slim +2 -2
  47. data/app/views/locomotive/shared/_account_navigation.slim +1 -1
  48. data/app/views/locomotive/shared/_sidebar.html.slim +1 -1
  49. data/app/views/locomotive/shared/sidebar/_page.html.slim +25 -24
  50. data/config/locales/ca.yml +332 -0
  51. data/config/locales/carrierwave.ar.yml +4 -0
  52. data/config/locales/carrierwave.ca.yml +4 -0
  53. data/config/locales/carrierwave.da.yml +4 -0
  54. data/config/locales/carrierwave.fi-FI.yml +4 -0
  55. data/config/locales/carrierwave.it.yml +4 -0
  56. data/config/locales/carrierwave.ja-JP.yml +4 -0
  57. data/config/locales/carrierwave.pl-PL.yml +4 -0
  58. data/config/locales/carrierwave.ru.yml +1 -1
  59. data/config/locales/carrierwave.sv-FI.yml +4 -0
  60. data/config/locales/cs.yml +14 -0
  61. data/config/locales/de.yml +64 -60
  62. data/config/locales/default.ca.yml +13 -0
  63. data/config/locales/default.da.yml +13 -0
  64. data/config/locales/default.de.yml +1 -1
  65. data/config/locales/default.fa_IR.yml +13 -0
  66. data/config/locales/default.fi-FI.yml +13 -0
  67. data/config/locales/default.ja-JP.yml +13 -0
  68. data/config/locales/default.pl-PL.yml +13 -0
  69. data/config/locales/default.sv-FI.yml +13 -0
  70. data/config/locales/devise.ca.yml +61 -0
  71. data/config/locales/devise.da.yml +60 -0
  72. data/config/locales/devise.de.yml +23 -23
  73. data/config/locales/devise.en.yml +6 -5
  74. data/config/locales/devise.fi-FI.yml +61 -0
  75. data/config/locales/devise.fr.yml +6 -4
  76. data/config/locales/devise.it.yml +61 -0
  77. data/config/locales/devise.ja-JP.yml +61 -0
  78. data/config/locales/devise.pl-PL.yml +61 -0
  79. data/config/locales/devise.ru.yml +35 -35
  80. data/config/locales/devise.sv-FI.yml +61 -0
  81. data/config/locales/el.yml +14 -0
  82. data/config/locales/en.yml +7 -0
  83. data/config/locales/flash.ca.yml +82 -0
  84. data/config/locales/flash.cs.yml +3 -0
  85. data/config/locales/flash.da.yml +79 -0
  86. data/config/locales/flash.de.yml +19 -16
  87. data/config/locales/flash.el.yml +3 -0
  88. data/config/locales/flash.ja-JP.yml +82 -0
  89. data/config/locales/flash.pl-PL.yml +82 -0
  90. data/config/locales/flash.sv-FI.yml +82 -0
  91. data/config/locales/fr.yml +5 -1
  92. data/config/locales/inputs.ca.yml +19 -0
  93. data/config/locales/inputs.da.yml +18 -0
  94. data/config/locales/inputs.fa_IR.yml +18 -0
  95. data/config/locales/inputs.fi-FI.yml +19 -0
  96. data/config/locales/inputs.ja-JP.yml +19 -0
  97. data/config/locales/inputs.pl-PL.yml +19 -0
  98. data/config/locales/inputs.sv-FI.yml +19 -0
  99. data/config/locales/ja-JP.yml +332 -0
  100. data/config/locales/mongoid.ca.yml +47 -0
  101. data/config/locales/mongoid.da.yml +47 -0
  102. data/config/locales/mongoid.de.yml +15 -6
  103. data/config/locales/mongoid.fa_IR.yml +41 -0
  104. data/config/locales/mongoid.ja-JP.yml +47 -0
  105. data/config/locales/mongoid.pl-PL.yml +47 -0
  106. data/config/locales/mongoid.sv-FI.yml +47 -0
  107. data/config/locales/nl.yml +4 -0
  108. data/config/locales/pl-PL.yml +332 -0
  109. data/config/locales/ru.yml +74 -74
  110. data/config/locales/simple_form.ca.yml +153 -0
  111. data/config/locales/simple_form.cs.yml +1 -0
  112. data/config/locales/simple_form.de.yml +45 -33
  113. data/config/locales/simple_form.el.yml +1 -0
  114. data/config/locales/simple_form.fi-FI.yml +153 -0
  115. data/config/locales/simple_form.ja-JP.yml +153 -0
  116. data/config/locales/simple_form.pl-PL.yml +153 -0
  117. data/config/locales/simple_form.ru.yml +8 -8
  118. data/config/locales/simple_form.sv-FI.yml +153 -0
  119. data/config/locales/sv-FI.yml +332 -0
  120. data/lib/locomotive/configuration.rb +1 -1
  121. data/lib/locomotive/dragonfly.rb +6 -4
  122. data/lib/locomotive/engine.rb +6 -0
  123. data/lib/locomotive/middlewares/site.rb +3 -1
  124. data/lib/locomotive/mongoid/patches.rb +9 -28
  125. data/lib/locomotive/steam/middlewares/wysihtml_css.rb +1 -1
  126. data/lib/locomotive/version.rb +1 -1
  127. data/spec/models/locomotive/concerns/site/metafields_spec.rb +1 -1
  128. data/spec/models/locomotive/concerns/site/url_redirections_spec.rb +62 -2
  129. data/spec/models/locomotive/content_entry_spec.rb +4 -4
  130. data/spec/models/locomotive/page_spec.rb +25 -10
  131. data/spec/models/locomotive/site_spec.rb +2 -0
  132. data/spec/requests/locomotive/steam/cache_spec.rb +1 -1
  133. data/spec/support/factories.rb +1 -0
  134. data/vendor/assets/javascripts/locomotive/datepicker_i18n.js.erb +12 -6
  135. data/vendor/assets/javascripts/locomotive/wysihtml5x-toolbar.js +24 -27
  136. metadata +102 -89
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d203a25b5a34a47a541a78378343b514dbf98aa8
4
- data.tar.gz: 7ae7925d76d662d1fed3a07aefca4d9443523717
3
+ metadata.gz: 6fa0ccc8361eb063596917d328170297cafd835e
4
+ data.tar.gz: a9bd9f70ef7a44687f0d42654e0672320a5df04c
5
5
  SHA512:
6
- metadata.gz: 2edc5299aab7b77a81bbadbf32f583edfe563d092fe4737c9e392f95dd8735d1d32cf5350ff4a9e268e34c4932989518fb9e318939e0cb0fc221d9e71815990d
7
- data.tar.gz: 671d6c44e61c44811ff5c60a9d7d24ee5ba0599259edb178cddc29e0075be2b705f230397319c1627018fce3b3268d00f45970d9abd9c237dd20891069d7b052
6
+ metadata.gz: 81743c70c111b18756bf436b795dbace81d7b8556c5aad17107bf112f06da723c5440bf8d3d21b36bd8566b5a98abc115dd474b8f527d6759e3e0170a0bb303b
7
+ data.tar.gz: e5bb69b97e20cd06fcd02889d499514afab906d3752992959f3f273a620bc163045084330154ce068de9f52566342761e92a2f5e2587c4a3fd721186af283b40
data/Gemfile CHANGED
@@ -9,23 +9,22 @@ gem 'sass-rails', '~> 5.0.4'
9
9
  gem 'coffee-rails', '~> 4.1.0'
10
10
  gem 'uglifier', '>= 2.5.3'
11
11
 
12
- gem 'coveralls', '~> 0.7.2', require: false
12
+ gem 'coveralls', '~> 0.8.19', require: false
13
13
 
14
14
  group :test, :development do
15
- gem 'rspec-rails', '~> 3.2.1' #~> 2.14.2' # In order to have rspec tasks and generators
15
+ gem 'rspec-rails', '~> 3.5.2' #~> 2.14.2' # In order to have rspec tasks and generators
16
16
  gem 'pry'
17
17
  end
18
18
 
19
19
  group :development do
20
- # gem 'custom_fields', path: '../custom_fields'
21
20
  # gem 'custom_fields', path: '../gems/custom_fields' # for Developers
22
- # gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: 'b5dcac5'
21
+ # gem 'custom_fields', github: 'locomotivecms/custom_fields', ref: '4a612e5'
23
22
 
24
23
  # gem 'locomotivecms_common', path: '../gems/common', require: false
25
24
  # gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '257047b', require: false
26
25
 
27
26
  # gem 'locomotivecms_steam', path: '../gems/steam', require: false
28
- # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'a2cba33', require: false
27
+ # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'e624ab686', require: false
29
28
 
30
29
  # gem 'locomotive_liquid', path: '../gems/liquid' # for Developers
31
30
  # gem 'locomotivecms_solid', path: '../gems/solid' # for Developers
@@ -55,7 +54,7 @@ end
55
54
  group :test do
56
55
  gem 'simplecov'
57
56
 
58
- gem 'capybara-webkit', '~> 1.10.1'
57
+ gem 'capybara-webkit', '~> 1.12.0'
59
58
 
60
59
  gem 'grape-entity-matchers'
61
60
  gem 'shoulda-matchers', '2.7.0'
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  == MIT License
2
2
 
3
- Copyright (c) 2010-2015, Didier Lafforgue.
3
+ Copyright (c) 2010-2017, NoCoffee.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -10,7 +10,7 @@ Locomotive relies on a **very original workflow**:
10
10
  - Sites are deployed to the platform (engine) thanks to our internal API.
11
11
  - A back-office for the end-users is automatically generated based on the custom models and editable regions described by the developers.
12
12
 
13
- ![Locomotive](https://dl.dropboxusercontent.com/u/20823269/locomotive-engine.png)
13
+ ![Locomotive](http://i.imgur.com/iRG1gWA.jpg)
14
14
 
15
15
  Visit the Locomotive official website [here](http://
16
16
  locomotive.works) for more information.
@@ -74,4 +74,4 @@ For new features (especially large ones) it is best to create a topic on the [Go
74
74
 
75
75
  Feel free to contact me at did at locomotivecms dot com.
76
76
 
77
- Copyright (c) 2016 NoCoffee, released under the MIT license
77
+ Copyright (c) 2017 NoCoffee, released under the MIT license
@@ -50,6 +50,7 @@ module Locomotive
50
50
  mount API::Resources::MembershipResource
51
51
  mount API::Resources::CurrentSiteResource
52
52
  mount API::Resources::ContentAssetResource
53
+ mount API::Resources::UrlRedirectionResource
53
54
 
54
55
  route :any, '*path' do
55
56
  error!({ error: "Unrecognized request path: #{params[:path]}" }, 404)
@@ -71,6 +71,10 @@ module Locomotive
71
71
  dynamic_value_of(name).pluck_with_natural_order(:_slug)
72
72
  end
73
73
 
74
+ def expose_json_field(name)
75
+ expose_default_field(name).try(:to_json)
76
+ end
77
+
74
78
  def dynamic_value_of(name)
75
79
  self.object.send(name)
76
80
  end
@@ -24,6 +24,9 @@ module Locomotive
24
24
  # Editable elements
25
25
  attrs :editable_elements_attributes
26
26
 
27
+ # Display settings
28
+ attrs :display_settings
29
+
27
30
  def initialize(site, attributes = {}, existing_page = nil)
28
31
  @site = site
29
32
  @existing_page = existing_page
@@ -62,6 +65,13 @@ module Locomotive
62
65
  set_attribute :redirect_url, value
63
66
  end
64
67
 
68
+ def display_settings=(settings)
69
+ (settings || {}).each do |k, v|
70
+ settings[k] = v == 'true'
71
+ end
72
+ set_attribute(:display_settings, settings)
73
+ end
74
+
65
75
  end
66
76
 
67
77
  end
@@ -61,6 +61,7 @@ module Locomotive
61
61
  optional :seo_title
62
62
  optional :meta_keywords
63
63
  optional :meta_description
64
+ optional :display_settings
64
65
  end
65
66
  end
66
67
  post do
@@ -97,6 +98,7 @@ module Locomotive
97
98
  optional :seo_title
98
99
  optional :meta_keywords
99
100
  optional :meta_description
101
+ optional :display_settings
100
102
  end
101
103
  end
102
104
  put ':id' do
@@ -0,0 +1,69 @@
1
+ module Locomotive
2
+ module API
3
+ module Resources
4
+
5
+ class UrlRedirectionResource < Grape::API
6
+
7
+ resource :url_redirections do
8
+ entity_klass = Entities::SiteEntity
9
+
10
+ before do
11
+ authenticate_locomotive_account!
12
+ require_site!
13
+ end
14
+
15
+ desc 'Index of url redirections'
16
+ get '/' do
17
+ authorize current_site, :show?
18
+
19
+ present current_site.url_redirections_with_information, with: Grape::Presenters::Presenter
20
+ end
21
+
22
+
23
+ desc 'Add or update url redirection'
24
+ params do
25
+ requires :url_redirection, type: Hash do
26
+ requires :source
27
+ requires :target
28
+ optional :counter, type: Integer
29
+ optional :hidden, type: Boolean
30
+ end
31
+ end
32
+ put do
33
+ authorize current_site, :update?
34
+
35
+ source = params[:url_redirection][:source]
36
+ target = params[:url_redirection][:target]
37
+ information = params[:url_redirection].slice(:counter, :hidden)
38
+
39
+ if current_site.add_or_update_url_redirection(source, target, information)
40
+ current_site.save
41
+ present current_site, with: Grape::Presenters::Presenter
42
+ else
43
+ status 422
44
+ end
45
+ end
46
+
47
+
48
+ desc "Delete url redirection"
49
+ params do
50
+ requires :url_redirection, type: Hash do
51
+ requires :source
52
+ end
53
+ end
54
+ delete do
55
+ authorize current_site, :destroy?
56
+
57
+ current_site.remove_url_redirection(params[:url_redirection][:source])
58
+ current_site.save
59
+
60
+ present current_site, with: entity_klass
61
+ end
62
+
63
+ end
64
+ end
65
+
66
+ end
67
+
68
+ end
69
+ end
@@ -12,8 +12,12 @@ class Locomotive.Views.Inputs.MarkdownView extends Locomotive.Views.Inputs.TextV
12
12
 
13
13
  _.bindAll(@, 'insert_file')
14
14
 
15
- @$textarea = @$('textarea.markdown')
16
- @editor = CodeMirror.fromTextArea @$textarea[0],
15
+ @$textarea = @$('textarea.markdown')
16
+
17
+ # if the input is required then Chrome won't be able to submit the form
18
+ @$textarea.removeAttr('required')
19
+
20
+ @editor = CodeMirror.fromTextArea @$textarea[0],
17
21
  mode: 'markdown'
18
22
  tabMode: 'indent'
19
23
  lineWrapping: true
@@ -26,7 +26,7 @@ class Locomotive.Views.Inputs.Rte.LinkView extends Backbone.View
26
26
  @$content.show()
27
27
  @$link.popover
28
28
  container: @$link.parents('fieldset')
29
- placement: 'right'
29
+ placement: 'bottom'
30
30
  content: @$content
31
31
  html: true
32
32
  trigger: 'manual'
@@ -24,7 +24,7 @@ class Locomotive.Views.Inputs.Rte.TableView extends Backbone.View
24
24
  @$content.show()
25
25
  @$link.popover
26
26
  container: @$link.parents('fieldset')
27
- placement: 'right'
27
+ placement: 'bottom'
28
28
  content: @$content
29
29
  html: true
30
30
  trigger: 'manual'
@@ -59,7 +59,7 @@ class Locomotive.Views.Inputs.RteView extends Backbone.View
59
59
  html = $button.next('.style-dialog-content').html()
60
60
 
61
61
  @$style_popover = @$style_popover || ($button.popover
62
- placement: 'top'
62
+ placement: 'bottom'
63
63
  content: html
64
64
  html: true
65
65
  title: undefined)
@@ -7,7 +7,8 @@
7
7
  background-size: 24px;
8
8
  background-position: 0 0;
9
9
 
10
- <% %w(bf bg cs de en es et fr it ja lt mg nb nl pl pt-BR pt ru sk sr sv zh-CN).each do |locale| %>
10
+ // https://www.iconfinder.com/iconsets/flags_gosquared
11
+ <% %w(bf bg cs da de el en es et fa-IR fi-FI fr it ja-JP lt mg nb nl pl-PL pt-BR pt ru sk sr sv uk zh-CN).each do |locale| %>
11
12
  &.flag-<%= locale %> {
12
13
  background-image: url(asset-path('locomotive/icons/flags/<%= locale %>.png'));
13
14
  }
@@ -1,8 +1,4 @@
1
1
  .popover {
2
- margin-top: 60px !important;
3
- .arrow {
4
- margin-top: -71px !important;
5
- }
6
2
  .simple_form {
7
3
  padding-bottom: 0;
8
4
 
@@ -13,7 +13,7 @@ module Locomotive
13
13
  private
14
14
 
15
15
  def redirect_to_main_host
16
- return if Locomotive.config.host.blank?
16
+ return if Locomotive.config.host.blank? || request.env['locomotive.default_host'].present?
17
17
 
18
18
  if request.host != Locomotive.config.host
19
19
  options = { host: Locomotive.config.host }
@@ -47,7 +47,10 @@ module Locomotive
47
47
 
48
48
  def new_url_redirection
49
49
  if params[:url_redirection].present? && params[:url_redirection].include?(' ')
50
- render partial: 'url_redirection', locals: { url_redirection: params[:url_redirection].split(' ') }
50
+ source, target = params[:url_redirection].split(' ')
51
+ render partial: 'url_redirection', locals: {
52
+ url_redirection: { 'source' => source, 'target' => target }
53
+ }
51
54
  else
52
55
  head :unprocessable_entity
53
56
  end
@@ -3,6 +3,8 @@ module Locomotive
3
3
 
4
4
  layout '/locomotive/layouts/error'
5
5
 
6
+ helper Locomotive::BaseHelper
7
+
6
8
  def error_404
7
9
  render '404', status: :not_found
8
10
  end
@@ -28,7 +28,11 @@ module Locomotive
28
28
  end
29
29
 
30
30
  def set_locale
31
- I18n.locale = current_site? ? current_site.accounts.first.locale : Locomotive.config.default_locale
31
+ I18n.locale = current_site? ? current_site.accounts.first.locale : default_locale
32
+ end
33
+
34
+ def default_locale
35
+ Locomotive.config.default_locale
32
36
  end
33
37
 
34
38
  end
@@ -10,6 +10,8 @@ module Locomotive
10
10
 
11
11
  helper Locomotive::BaseHelper
12
12
 
13
+ before_filter :set_locale
14
+
13
15
  private
14
16
 
15
17
  def after_sign_up_path_for(resource)
@@ -20,5 +22,9 @@ module Locomotive
20
22
  devise_parameter_sanitizer.for(:sign_up) << :name
21
23
  end
22
24
 
25
+ def set_locale
26
+ I18n.locale = Locomotive.config.default_locale
27
+ end
28
+
23
29
  end
24
30
  end
@@ -24,7 +24,11 @@ module Locomotive
24
24
  end
25
25
 
26
26
  def set_locale
27
- I18n.locale = current_site? ? current_site.accounts.first.locale : Locomotive.config.default_locale
27
+ I18n.locale = current_site? ? current_site.accounts.first.locale : default_locale
28
+ end
29
+
30
+ def default_locale
31
+ Locomotive.config.default_locale
28
32
  end
29
33
 
30
34
  end
@@ -11,6 +11,10 @@ module Locomotive
11
11
  [self.controller.controller_name, action].map(&:dasherize).join(' ')
12
12
  end
13
13
 
14
+ def application_name
15
+ Locomotive.config.name
16
+ end
17
+
14
18
  def title(title = nil)
15
19
  if title.nil?
16
20
  @content_for_title
@@ -33,6 +37,12 @@ module Locomotive
33
37
  end
34
38
  end
35
39
 
40
+ #= Sessions
41
+
42
+ def enable_registration?
43
+ current_site.nil? && Locomotive.config.enable_registration
44
+ end
45
+
36
46
  #= Sidebar
37
47
 
38
48
  def sidebar_current_section_class
@@ -72,6 +82,14 @@ module Locomotive
72
82
 
73
83
  ## Tag helpers ##
74
84
 
85
+ def account_logo_tag
86
+ image_tag 'locomotive/logo-white.png'
87
+ end
88
+
89
+ def sidebar_logo_tag
90
+ image_tag 'locomotive/logo.png'
91
+ end
92
+
75
93
  def icon_tag(name)
76
94
  content_tag :i, '', class: ['fa', name].join(' ')
77
95
  end
@@ -103,6 +103,10 @@ module Locomotive
103
103
  { as: :email }
104
104
  end
105
105
 
106
+ def password_custom_field_options(field, entry)
107
+ { as: :password }
108
+ end
109
+
106
110
  def file_custom_field_options(field, entry)
107
111
  { as: :file, select_content_asset: true }
108
112
  end
@@ -195,6 +199,16 @@ module Locomotive
195
199
  { as: type }
196
200
  end
197
201
 
202
+ def json_custom_field_options(field, entry)
203
+ {
204
+ as: :text,
205
+ input_html: {
206
+ rows: 10,
207
+ value: entry.send(field.name).try(:to_json)
208
+ }
209
+ }
210
+ end
211
+
198
212
  def custom_field_picker_options(field, slug)
199
213
  {
200
214
  label_method: :_label,
@@ -108,6 +108,10 @@ module Locomotive
108
108
  depth >= 2 ? MAX_WIDTH[depth - 2 + inc] : nil
109
109
  end
110
110
 
111
+ def show?
112
+ controller.send(:policy, page).show?
113
+ end
114
+
111
115
  alias :to_param :_id
112
116
 
113
117
  end