changing a stylesheet or javascript asset works either from a source or with plain text
This commit is contained in:
parent
2f4128bf8f
commit
c444b1d58a
@ -67,10 +67,12 @@ class ThemeAsset
|
||||
end
|
||||
|
||||
def plain_text
|
||||
if not self.performing_plain_text? #not @plain_text_changed
|
||||
@plain_text ||= self.source.read rescue nil
|
||||
end
|
||||
@plain_text
|
||||
@plain_text ||= self.source.read
|
||||
# puts "\tperforming plain text ? #{self.performing_plain_text?}"
|
||||
# if not self.performing_plain_text? #not @plain_text_changed
|
||||
# @plain_text = self.source.read #rescue nil
|
||||
# end
|
||||
# @plain_text
|
||||
end
|
||||
|
||||
# def plain_text=(source)
|
||||
@ -84,11 +86,15 @@ class ThemeAsset
|
||||
end
|
||||
|
||||
def store_plain_text
|
||||
return if !self.stylesheet_or_javascript? || self.plain_text_name.blank? || self.plain_text.blank?
|
||||
data = self.performing_plain_text? ? self.plain_text : self.source.read
|
||||
|
||||
sanitized_source = self.escape_shortcut_urls(self.plain_text)
|
||||
return if !self.stylesheet_or_javascript? || self.plain_text_name.blank? || data.blank?
|
||||
|
||||
# puts "================"
|
||||
sanitized_source = self.escape_shortcut_urls(data)
|
||||
|
||||
puts "================"
|
||||
puts "\tperforming plain text ? #{self.performing_plain_text?}"
|
||||
puts "\data = #{data[0..100]}"
|
||||
# puts self.source.instance_variable_get(:@original_file).inspect
|
||||
|
||||
self.source = CarrierWave::SanitizedFile.new({
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
= f.hidden_field :performing_plain_text
|
||||
|
||||
#file-selector{ :class => "selector #{'hidden' if @theme_asset.performing_plain_text?}" }
|
||||
#file-selector{ :class => "selector #{'hidden' if @theme_asset.stylesheet_or_javascript?}" }
|
||||
= f.inputs :name => :information do
|
||||
= f.input :source
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
!= t('admin.theme_assets.form.choose_plain_text')
|
||||
|
||||
- if allow_plain_text_editing?(@theme_asset)
|
||||
#text-selector{ :class => "selector #{'hidden' if !@theme_asset.performing_plain_text?}", :style => "#{'display: none' if !@theme_asset.performing_plain_text?}" }
|
||||
#text-selector{ :class => "selector #{'hidden' if !@theme_asset.stylesheet_or_javascript?}", :style => "#{'display: none' if !@theme_asset.stylesheet_or_javascript?}" }
|
||||
= f.inputs :name => :code, :class => 'inputs code' do
|
||||
|
||||
- if @theme_asset.new_record?
|
||||
@ -31,13 +31,6 @@
|
||||
%span.alt
|
||||
!= t('admin.theme_assets.form.choose_file')
|
||||
|
||||
/ - if @theme_asset.image?
|
||||
/ = f.foldable_inputs :name => "#{t('formtastic.titles.preview')} #{image_dimensions_and_size(@theme_asset)}", :class => 'preview' do
|
||||
/ %li
|
||||
/ .image
|
||||
/ .inside
|
||||
/ = image_tag(@theme_asset.source.url(:preview))
|
||||
|
||||
= f.foldable_inputs :name => :options do
|
||||
= f.input :folder
|
||||
= f.custom_input :hidden, :css => 'toggle' do
|
||||
|
Loading…
Reference in New Issue
Block a user