locomotive_cms 2.1.4 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. data/Gemfile +1 -5
  2. data/app/assets/images/locomotive/icons/flags/zh-CN.png +0 -0
  3. data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/css/inputcontrol.css +3 -0
  4. data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/lib/inputcontrol-plugin.js +94 -0
  5. data/app/assets/javascripts/aloha/plugins/custom/inputcontrol/package.json +1 -0
  6. data/app/assets/javascripts/locomotive.js +2 -1
  7. data/app/assets/javascripts/locomotive/models/content_type.js.coffee +6 -2
  8. data/app/assets/javascripts/locomotive/models/page.js.coffee +1 -1
  9. data/app/assets/javascripts/locomotive/models/site.js.coffee +1 -1
  10. data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +17 -7
  11. data/app/assets/javascripts/locomotive/utils/tinymce_settings.js.coffee +6 -0
  12. data/app/assets/javascripts/locomotive/views/application_view.js.coffee +13 -2
  13. data/app/assets/javascripts/locomotive/views/content_entries/_form_view.js.coffee +19 -2
  14. data/app/assets/javascripts/locomotive/views/content_entries/_popup_form_view.js.coffee +1 -1
  15. data/app/assets/javascripts/locomotive/views/content_entries/index_view.js.coffee +2 -2
  16. data/app/assets/javascripts/locomotive/views/content_types/_form_view.js.coffee +2 -1
  17. data/app/assets/javascripts/locomotive/views/content_types/custom_field_entry_view.js.coffee +3 -0
  18. data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +2 -1
  19. data/app/assets/javascripts/locomotive/views/editable_elements/edit_all_view.js.coffee +3 -6
  20. data/app/assets/javascripts/locomotive/views/editable_elements/text_view.js.coffee +47 -0
  21. data/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee +1 -1
  22. data/app/assets/javascripts/locomotive/views/pages/_form_view.js.coffee +2 -1
  23. data/app/assets/javascripts/locomotive/views/pages/list_view.js.coffee +2 -2
  24. data/app/assets/javascripts/locomotive/views/shared/fields/belongs_to_view.js.coffee +32 -0
  25. data/app/assets/javascripts/locomotive/views/shared/fields/has_many_view.js.coffee +2 -2
  26. data/app/assets/javascripts/locomotive/views/shared/fields/many_to_many_view.js.coffee +2 -2
  27. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +2 -0
  28. data/app/assets/javascripts/locomotive/views/snippets/_form_view.js.coffee +2 -1
  29. data/app/assets/javascripts/locomotive/views/theme_assets/_form_view.js.coffee +2 -1
  30. data/app/assets/javascripts/locomotive/views/theme_assets/index_view.js.coffee +0 -1
  31. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/es.js +1 -0
  32. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/et.js +1 -0
  33. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/it.js +1 -0
  34. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/ja.js +1 -0
  35. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/nb.js +1 -0
  36. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/nl.js +1 -0
  37. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/no.js +1 -0
  38. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/pl.js +1 -0
  39. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/pt.js +1 -0
  40. data/app/assets/javascripts/tinymce/plugins/locomotive_media/langs/zh-cn.js +1 -0
  41. data/app/assets/stylesheets/locomotive.css +1 -0
  42. data/app/assets/stylesheets/locomotive/backoffice/codemirror_changes.css.scss +2 -0
  43. data/app/assets/stylesheets/locomotive/backoffice/formtastic_changes.css.scss +17 -3
  44. data/app/controllers/locomotive/content_entries_controller.rb +6 -2
  45. data/app/controllers/locomotive/public/content_entries_controller.rb +6 -0
  46. data/app/helpers/locomotive/base_helper.rb +8 -0
  47. data/app/helpers/locomotive/sites_helper.rb +6 -0
  48. data/app/models/locomotive/content_entry.rb +35 -5
  49. data/app/models/locomotive/content_type.rb +26 -8
  50. data/app/models/locomotive/editable_element.rb +15 -1
  51. data/app/models/locomotive/editable_file.rb +0 -2
  52. data/app/models/locomotive/editable_long_text.rb +3 -3
  53. data/app/models/locomotive/editable_short_text.rb +3 -64
  54. data/app/models/locomotive/editable_text.rb +84 -0
  55. data/app/models/locomotive/extensions/content_entry/csv.rb +7 -3
  56. data/app/models/locomotive/extensions/page/editable_elements.rb +3 -5
  57. data/app/models/locomotive/extensions/site/locales.rb +20 -0
  58. data/app/models/locomotive/extensions/site/timezone.rb +35 -0
  59. data/app/models/locomotive/site.rb +20 -16
  60. data/app/models/locomotive/theme_asset.rb +1 -1
  61. data/app/presenters/locomotive/content_entry_presenter.rb +1 -1
  62. data/app/presenters/locomotive/{editable_short_text_presenter.rb → editable_text_presenter.rb} +14 -2
  63. data/app/views/locomotive/current_site/_form.html.haml +1 -0
  64. data/app/views/locomotive/custom_fields/types/_belongs_to.html.haml +6 -5
  65. data/app/views/locomotive/pages/_editable_elements.html.haml +1 -1
  66. data/app/views/locomotive/shared/_head.html.haml +2 -0
  67. data/app/views/locomotive/shared/_main_app_head_before_backbone.html.haml +1 -0
  68. data/config/locales/admin_ui.de.yml +1 -0
  69. data/config/locales/admin_ui.en.yml +1 -0
  70. data/config/locales/admin_ui.et.yml +1 -0
  71. data/config/locales/admin_ui.fr.yml +1 -0
  72. data/config/locales/admin_ui.ja.yml +1 -0
  73. data/config/locales/admin_ui.nb.yml +2 -0
  74. data/config/locales/admin_ui.pl.yml +1 -0
  75. data/config/locales/admin_ui.pt-BR.yml +2 -1
  76. data/config/locales/admin_ui.ru.yml +24 -4
  77. data/config/locales/admin_ui.zh-CN.yml +347 -0
  78. data/config/locales/carrierwave.zh-CN.yml +4 -0
  79. data/config/locales/default.zh-CN.yml +116 -0
  80. data/config/locales/devise.nb.yml +1 -0
  81. data/config/locales/devise.zh-CN.yml +64 -0
  82. data/config/locales/flash.zh-CN.yml +115 -0
  83. data/config/locales/formtastic.en.yml +1 -0
  84. data/config/locales/formtastic.ru.yml +4 -1
  85. data/config/locales/formtastic.zh-CN.yml +112 -0
  86. data/features/backoffice/content_types/localized.feature +63 -0
  87. data/features/backoffice/pages.feature +3 -1
  88. data/features/backoffice/site.feature +7 -0
  89. data/features/public/contact_form.feature +11 -0
  90. data/features/public/content_entries.feature +13 -0
  91. data/features/public/pages.feature +24 -0
  92. data/features/step_definitions/page_steps.rb +6 -0
  93. data/features/step_definitions/web_steps.rb +24 -7
  94. data/lib/generators/locomotive/install/templates/locomotive.rb +2 -2
  95. data/lib/generators/locomotive/install/templates/mongoid.yml +23 -29
  96. data/lib/locomotive.rb +1 -4
  97. data/lib/locomotive/configuration.rb +3 -3
  98. data/lib/locomotive/dependencies.rb +1 -0
  99. data/lib/locomotive/engine.rb +2 -1
  100. data/lib/locomotive/liquid/drops/page.rb +1 -1
  101. data/lib/locomotive/liquid/filters/date.rb +3 -1
  102. data/lib/locomotive/liquid/filters/misc.rb +4 -0
  103. data/lib/locomotive/liquid/filters/text.rb +4 -0
  104. data/lib/locomotive/liquid/tags/editable.rb +1 -2
  105. data/lib/locomotive/liquid/tags/editable/text.rb +79 -0
  106. data/lib/locomotive/liquid/tags/inline_editor.rb +1 -1
  107. data/lib/locomotive/liquid/tags/link_to.rb +72 -13
  108. data/lib/locomotive/liquid/tags/with_scope.rb +3 -3
  109. data/lib/locomotive/middlewares.rb +0 -1
  110. data/lib/locomotive/mongoid/patches.rb +0 -16
  111. data/lib/locomotive/render.rb +1 -1
  112. data/lib/locomotive/version.rb +1 -1
  113. data/lib/tasks/locomotive.rake +15 -9
  114. data/mongodb/migrate/20130326201349_rename_entry_to_content_entry.rb +1 -1
  115. data/mongodb/migrate/20130621135025_create_editable_texts.rb +42 -0
  116. data/mongodb/migrate/20130627101548_localize_slugs_of_content_entries.rb +43 -0
  117. data/spec/dummy/config/initializers/locomotive.rb +1 -1
  118. data/spec/dummy/config/initializers/session_store.rb +1 -1
  119. data/spec/lib/locomotive/liquid/drops/page_spec.rb +1 -1
  120. data/spec/lib/locomotive/liquid/filters/misc_spec.rb +26 -0
  121. data/spec/lib/locomotive/liquid/tags/editable/text_spec.rb +85 -0
  122. data/spec/lib/locomotive/liquid/tags/link_to_spec.rb +111 -0
  123. data/spec/lib/locomotive/liquid/tags/with_scope_spec.rb +6 -0
  124. data/spec/models/locomotive/content_entry_spec.rb +27 -7
  125. data/spec/models/locomotive/{editable_short_text_spec.rb → editable_text_spec.rb} +53 -8
  126. data/spec/models/locomotive/extensions/page/editable_elements_spec.rb +6 -6
  127. data/spec/models/locomotive/site_spec.rb +52 -32
  128. data/vendor/assets/images/select2-spinner.gif +0 -0
  129. data/vendor/assets/images/select2.png +0 -0
  130. data/vendor/assets/images/select2x2.png +0 -0
  131. data/vendor/assets/javascripts/locomotive/liquid_mode.js +1 -1
  132. data/vendor/assets/javascripts/select2/select2.js +3054 -0
  133. data/vendor/assets/stylesheets/select2/select2.css.scss +652 -0
  134. metadata +77 -33
  135. data/app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee +0 -36
  136. data/app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee +0 -22
  137. data/app/presenters/locomotive/editable_long_text_presenter.rb +0 -5
  138. data/lib/locomotive/liquid/tags/editable/long_text.rb +0 -33
  139. data/lib/locomotive/liquid/tags/editable/short_text.rb +0 -41
  140. data/lib/locomotive/middlewares/fonts.rb +0 -42
  141. data/lib/locomotive/session_store.rb +0 -64
  142. data/spec/lib/locomotive/liquid/tags/editable/short_text_spec.rb +0 -46
  143. data/spec/models/locomotive/editable_long_text_spec.rb +0 -50
@@ -2,7 +2,6 @@ module Locomotive
2
2
  class EditableFile < EditableElement
3
3
 
4
4
  ## behaviours ##
5
- # mount_uploader :source, EditableFileUploader
6
5
  mount_uploader 'source', EditableFileUploader
7
6
 
8
7
  replace_field 'source', ::String, true
@@ -11,7 +10,6 @@ module Locomotive
11
10
  field :default_source_url, localize: true
12
11
 
13
12
  ## callbacks ##
14
- # before_save { |c| puts "#{c.block}/#{c.slug} saved called !"}
15
13
  after_save :propagate_content
16
14
 
17
15
  ## methods ##
@@ -1,5 +1,5 @@
1
1
  module Locomotive
2
- class EditableLongText < EditableShortText
3
-
2
+ class EditableLongText < EditableText
3
+ # @deprecated
4
4
  end
5
- end
5
+ end
@@ -1,66 +1,5 @@
1
1
  module Locomotive
2
- class EditableShortText < EditableElement
3
-
4
- ## fields ##
5
- field :content, localize: true
6
- field :default_content, type: Boolean, localize: true, default: true
7
-
8
- ## methods ##
9
-
10
- def content=(value)
11
- return if value == self.content
12
- self.add_current_locale
13
- self.default_content = false unless self.new_record?
14
- super
15
- end
16
-
17
- def default_content?
18
- !!self.default_content
19
- end
20
-
21
- def content_from_default=(content)
22
- if self.default_content?
23
- self.content_will_change!
24
- self.attributes['content'] ||= {}
25
- self.attributes['content'][::Mongoid::Fields::I18n.locale.to_s] = content
26
- end
27
- end
28
-
29
- def copy_attributes_from(el)
30
- super(el)
31
-
32
- self.attributes['content'] = el.content_translations || {}
33
- self.attributes['default_content'] = el.default_content_translations
34
- end
35
-
36
- def set_default_content_from(el)
37
- super(el)
38
-
39
- locale = ::Mongoid::Fields::I18n.locale.to_s
40
-
41
- if self.default_content? || self.attributes['default_content'][locale].nil?
42
- self.default_content = true
43
-
44
- self.content_will_change!
45
- self.attributes['content'][locale] = el.content
46
- end
47
- end
48
-
49
- protected
50
-
51
- def propagate_content
52
- if self.content_changed?
53
- operations = {
54
- '$set' => {
55
- "editable_elements.$.content.#{::Mongoid::Fields::I18n.locale}" => self.content,
56
- "editable_elements.$.default_content.#{::Mongoid::Fields::I18n.locale}" => false,
57
- }
58
- }
59
-
60
- self.page.collection.find(self._selector).update(operations, multi: true)
61
- end
62
- true
63
- end
64
-
2
+ class EditableShortText < EditableText
3
+ # @deprecated
65
4
  end
66
- end
5
+ end
@@ -0,0 +1,84 @@
1
+ module Locomotive
2
+ class EditableText < EditableElement
3
+
4
+ ## fields ##
5
+ field :content, localize: true
6
+ field :default_content, type: Boolean, localize: true, default: true
7
+ field :format, default: 'html'
8
+ field :rows, type: Integer, default: 15
9
+ field :line_break, type: Boolean, default: true
10
+
11
+ ## callbacks ##
12
+ before_save :strip_content
13
+
14
+ ## methods ##
15
+
16
+ def content=(value)
17
+ return if value == self.content
18
+ self.add_current_locale
19
+ self.default_content = false unless self.new_record?
20
+ super
21
+ end
22
+
23
+ def default_content?
24
+ !!self.default_content
25
+ end
26
+
27
+ def content_from_default=(content)
28
+ if self.default_content?
29
+ self.content_will_change!
30
+ self.attributes['content'] ||= {}
31
+ self.attributes['content'][::Mongoid::Fields::I18n.locale.to_s] = content
32
+ end
33
+ end
34
+
35
+ def copy_attributes_from(el)
36
+ super(el)
37
+
38
+ self.attributes['content'] = el.content_translations || {}
39
+ self.attributes['default_content'] = el.default_content_translations
40
+ end
41
+
42
+ def copy_default_attributes_from(el)
43
+ super(el)
44
+
45
+ %w(format rows line_break).each do |attr|
46
+ self.send(:"#{attr}=", el.send(attr.to_sym))
47
+ end
48
+ end
49
+
50
+ def set_default_content_from(el)
51
+ super(el)
52
+
53
+ locale = ::Mongoid::Fields::I18n.locale.to_s
54
+
55
+ if self.default_content? || self.attributes['default_content'][locale].nil?
56
+ self.default_content = true
57
+
58
+ self.content_will_change!
59
+ self.attributes['content'][locale] = el.content
60
+ end
61
+ end
62
+
63
+ protected
64
+
65
+ def propagate_content
66
+ if self.content_changed?
67
+ operations = {
68
+ '$set' => {
69
+ "editable_elements.$.content.#{::Mongoid::Fields::I18n.locale}" => self.content,
70
+ "editable_elements.$.default_content.#{::Mongoid::Fields::I18n.locale}" => false,
71
+ }
72
+ }
73
+
74
+ self.page.collection.find(self._selector).update(operations, multi: true)
75
+ end
76
+ true
77
+ end
78
+
79
+ def strip_content
80
+ self.content.strip! unless self.content.blank?
81
+ end
82
+
83
+ end
84
+ end
@@ -7,16 +7,19 @@ module Locomotive
7
7
 
8
8
  # Get the values from the custom fields as an array.
9
9
  # Values are ordered by the position of the custom fields.
10
+ # It also adds the created_at value of the instance.
10
11
  #
11
12
  # @param [ Hash ] options For now, stores only the host for the File fields.
12
13
  #
13
14
  # @return [ Array ]
14
15
  #
15
16
  def to_values(options = {})
16
- self.content_type.ordered_entries_custom_fields.map do |field|
17
+ values = self.content_type.ordered_entries_custom_fields.map do |field|
17
18
  value = self.send(field.name)
18
19
  self.value_from_type(field.type.to_sym, value, options)
19
20
  end.compact
21
+
22
+ values << I18n.l(self.created_at, format: :long)
20
23
  end
21
24
 
22
25
  protected
@@ -59,13 +62,14 @@ module Locomotive
59
62
  end
60
63
 
61
64
  fields = content_type.ordered_entries_custom_fields
65
+ labels = fields.map(&:label) << I18n.t('mongoid.attributes.locomotive/content_entry.created_at')
62
66
 
63
67
  CSV.generate(csv_options) do |csv|
64
68
  # header
65
- csv << (fields.map(&:label) + [I18n.t('mongoid.attributes.locomotive/content_entry.created_at')])
69
+ csv << labels
66
70
  # body
67
71
  all.each do |entry|
68
- csv << (entry.to_values(options) + [I18n.l(entry.created_at, format: :long)])
72
+ csv << entry.to_values(options)
69
73
  end
70
74
  end
71
75
  end
@@ -79,16 +79,14 @@ module Locomotive
79
79
  if existing_el.nil? # new one from parents
80
80
  new_el = self.editable_elements.build({}, el.class)
81
81
  new_el.copy_attributes_from(el)
82
- else
82
+ elsif existing_el.from_parent? # it inherits from a parent page
83
83
  existing_el.disabled = false
84
84
 
85
85
  # make sure the default content gets updated too
86
86
  existing_el.set_default_content_from(el)
87
87
 
88
- # only the type, hint and fixed properties can be modified from the parent element
89
- %w(_type hint fixed priority locales).each do |attr|
90
- existing_el.send(:"#{attr}=", el.send(attr.to_sym))
91
- end
88
+ # copy _type, hint, fixed, priority and locales + type custom attributes
89
+ existing_el.copy_default_attributes_from(el)
92
90
  end
93
91
  end
94
92
  end
@@ -74,6 +74,26 @@ module Locomotive
74
74
  [locale.to_s] + (locales - [locale.to_s])
75
75
  end
76
76
 
77
+ # Iterate through all the locales of the site and for each of them
78
+ # call yield with the related Mongoid::Fields::I18n locale context.
79
+ # The first locale is the default one.
80
+ #
81
+ def each_locale(&block)
82
+ self.locales.each do |locale|
83
+ ::Mongoid::Fields::I18n.with_locale(locale) do
84
+ yield locale
85
+ end
86
+ end
87
+ end
88
+
89
+ # Call yield within the Mongoid::Fields::I18 context of the default locale.
90
+ #
91
+ def with_default_locale(&block)
92
+ ::Mongoid::Fields::I18n.with_locale(self.default_locale) do
93
+ yield
94
+ end
95
+ end
96
+
77
97
  protected
78
98
 
79
99
  def add_default_locale
@@ -0,0 +1,35 @@
1
+ module Locomotive
2
+ module Extensions
3
+ module Site
4
+ module Timezone
5
+
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+
10
+ ## fields ##
11
+ field :timezone_name, type: ::String, default: "UTC"
12
+
13
+ # ## validations ##
14
+ validate :wrong_timezone_name
15
+ #
16
+ # ## callbacks ##
17
+ # after_validation :add_default_locale
18
+ # before_update :verify_localized_default_pages_integrity
19
+ end
20
+
21
+ def timezone
22
+ @timezone ||= ActiveSupport::TimeZone.new(self.timezone_name)
23
+ end
24
+
25
+ protected
26
+ def wrong_timezone_name
27
+ unless ActiveSupport::TimeZone.new(self.timezone_name)
28
+ self.errors.add :timezone, I18n.t(:wrong_timezone_name, scope: [:errors, :messages, :site])
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
@@ -8,18 +8,20 @@ module Locomotive
8
8
  extend Extensions::Site::FirstInstallation
9
9
  include Extensions::Shared::Seo
10
10
  include Extensions::Site::Locales
11
+ include Extensions::Site::Timezone
11
12
 
12
13
  ## fields ##
13
14
  field :name
14
15
  field :robots_txt
15
16
 
16
17
  ## associations ##
17
- has_many :pages, class_name: 'Locomotive::Page', validate: false
18
- has_many :snippets, class_name: 'Locomotive::Snippet', dependent: :destroy, validate: false
19
- has_many :theme_assets, class_name: 'Locomotive::ThemeAsset', dependent: :destroy, validate: false
20
- has_many :content_assets, class_name: 'Locomotive::ContentAsset', dependent: :destroy, validate: false
21
- has_many :content_types, class_name: 'Locomotive::ContentType', dependent: :destroy, validate: false
22
- has_many :translations, class_name: 'Locomotive::Translation', dependent: :destroy, validate: false
18
+ has_many :pages, class_name: 'Locomotive::Page', validate: false, autosave: false
19
+ has_many :snippets, class_name: 'Locomotive::Snippet', dependent: :destroy, validate: false, autosave: false
20
+ has_many :theme_assets, class_name: 'Locomotive::ThemeAsset', dependent: :destroy, validate: false, autosave: false
21
+ has_many :content_assets, class_name: 'Locomotive::ContentAsset', dependent: :destroy, validate: false, autosave: false
22
+ has_many :content_types, class_name: 'Locomotive::ContentType', dependent: :destroy, validate: false, autosave: false
23
+ has_many :content_entries, class_name: 'Locomotive::ContentEntry', dependent: :destroy, validate: false, autosave: false
24
+ has_many :translations, class_name: 'Locomotive::Translation', dependent: :destroy, validate: false, autosave: false
23
25
  embeds_many :memberships, class_name: 'Locomotive::Membership'
24
26
 
25
27
  ## validations ##
@@ -63,17 +65,19 @@ module Locomotive
63
65
  # method is available
64
66
  def create_default_pages!
65
67
  %w{index 404}.each do |slug|
66
- page = self.pages.build(published: true)
67
- self.locales.each do |locale|
68
- ::Mongoid::Fields::I18n.with_locale(locale) do
69
- page.attributes = {
70
- slug: slug,
71
- title: ::I18n.t("attributes.defaults.pages.#{slug}.title", locale: locale),
72
- raw_template: ::I18n.t("attributes.defaults.pages.#{slug}.body", locale: locale)
73
- }
74
- end
68
+ page = nil
69
+
70
+ self.each_locale do |locale|
71
+ page ||= self.pages.build(published: true) # first locale = default one
72
+
73
+ page.attributes = {
74
+ slug: slug,
75
+ title: ::I18n.t("attributes.defaults.pages.#{slug}.title", locale: locale),
76
+ raw_template: ::I18n.t("attributes.defaults.pages.#{slug}.body", locale: locale)
77
+ }
75
78
  end
76
- page.save
79
+
80
+ self.with_default_locale { page.save! }
77
81
  end
78
82
 
79
83
  end
@@ -144,7 +144,7 @@ module Locomotive
144
144
  def escape_shortcut_urls(text)
145
145
  return if text.blank?
146
146
 
147
- text.gsub(/[("'](\/(stylesheets|javascripts|images|media|others)\/(([^;.]+)\/)*([a-zA-Z_\-0-9]+)\.[a-z]{2,3})(\?[0-9]+)?[)"']/) do |path|
147
+ text.gsub(/[("'](\/(stylesheets|javascripts|images|media|fonts|others)\/(([^;.]+)\/)*([a-zA-Z_\-0-9]+)\.[a-z]{2,3})(\?[0-9]+)?[)"']/) do |path|
148
148
 
149
149
  sanitized_path = path.gsub(/[("')]/, '').gsub(/^\//, '').gsub(/\?[0-9]+$/, '')
150
150
 
@@ -19,7 +19,7 @@ module Locomotive
19
19
 
20
20
  with_options only_getter: true, if: Proc.new { html_view? } do |presenter|
21
21
  presenter.properties :safe_attributes
22
- presenter.properties :select_custom_fields, :file_custom_fields, :has_many_custom_fields, :many_to_many_custom_fields
22
+ presenter.properties :select_custom_fields, :file_custom_fields, :belongs_to_custom_fields, :has_many_custom_fields, :many_to_many_custom_fields
23
23
  end
24
24
 
25
25
  ## callbacks ##
@@ -1,9 +1,9 @@
1
1
  module Locomotive
2
- class EditableShortTextPresenter < EditableElementPresenter
2
+ class EditableTextPresenter < EditableElementPresenter
3
3
 
4
4
  ## properties ##
5
-
6
5
  properties :content, :default_content
6
+ properties :format, :line_break, :rows, only_getter: true
7
7
 
8
8
  ## callbacks ##
9
9
 
@@ -26,3 +26,15 @@ module Locomotive
26
26
 
27
27
  end
28
28
  end
29
+
30
+ module Locomotive
31
+ class EditableShortTextPresenter < EditableTextPresenter
32
+ # @deprecated
33
+ end
34
+ end
35
+
36
+ module Locomotive
37
+ class EditableLongTextPresenter < EditableTextPresenter
38
+ # @deprecated
39
+ end
40
+ end
@@ -10,6 +10,7 @@
10
10
  = f.inputs name: :information do
11
11
  = f.input :name, wrapper_html: { style: 'display: none' }
12
12
  = f.input :locales, as: '::Locomotive::Locales', collection: ordered_current_site_locales, input_html: { class: 'locales' }
13
+ = f.input :timezone_name, as: :select, include_blank: false, collection: options_for_site_timezones
13
14
 
14
15
  - if can?(:point, Locomotive::Site)
15
16
  - if manage_subdomain_or_domains?
@@ -1,5 +1,6 @@
1
- = f.input :"#{name}_id",
2
- label: field.label,
3
- hint: field.hint,
4
- as: :select,
5
- collection: options_for_belongs_to_custom_field(field.class_name)
1
+ = f.input :"#{name}_id",
2
+ label: field.label,
3
+ hint: field.hint,
4
+ as: :string,
5
+ wrapper_html: { class: 'select2' },
6
+ input_html: { data: { value: f.object.send(field.name.to_sym).try(:_label), url: content_entries_url(field.class_name_to_content_type.slug, :json), per_page: Locomotive.config.ui[:per_page] } }
@@ -18,7 +18,7 @@
18
18
 
19
19
  %label{ for: 'page_editable_elements_attributes_{{index}}_content' } {{label}}
20
20
 
21
- = text_area_tag 'page[editable_elements_attributes][{{index}}][content]', '{{content}}', id: 'page_editable_elements_attributes_{{index}}_content'
21
+ = text_area_tag 'page[editable_elements_attributes][{{index}}][content]', '{{content}}', id: 'page_editable_elements_attributes_{{index}}_content', rows: '{{rows}}'
22
22
 
23
23
  {{#if hint}}
24
24
  %p.inline-hints {{hint}}
@@ -14,6 +14,8 @@
14
14
  = stylesheet_link_tag 'locomotive', media: 'screen'
15
15
  = javascript_include_tag 'locomotive'
16
16
 
17
+ = render 'locomotive/shared/main_app_head_before_backbone'
18
+
17
19
  %script{ type: 'text/javascript' }
18
20
  :plain
19
21
  window.locale = '#{I18n.locale}';