fix minor ui issue in the theme assets section

This commit is contained in:
dinedine 2011-01-29 17:24:37 +01:00
parent a525e4ccd5
commit e896618c99
3 changed files with 13 additions and 5 deletions

View File

@ -76,7 +76,7 @@ GEM
locomotive_carrierwave
mongoid (~> 2.0.0.rc.6)
daemons (1.1.0)
database_cleaner (0.6.0)
database_cleaner (0.6.1)
delayed_job (2.1.2)
activesupport (~> 3.0)
daemons

View File

@ -9,7 +9,15 @@ module Admin::AssetsHelper
end
def allow_plain_text_editing?(asset)
asset.new_record? || asset.stylesheet? || asset.javascript?
asset.new_record? || asset.stylesheet_or_javascript?
end
def display_plain_text?(asset)
if asset.new_record?
asset.performing_plain_text?
else
asset.stylesheet_or_javascript?
end
end
end

View File

@ -4,16 +4,16 @@
= f.hidden_field :performing_plain_text
#file-selector{ :class => "selector #{'hidden' if @theme_asset.stylesheet_or_javascript?}" }
#file-selector{ :class => "selector #{'hidden' if display_plain_text?(@theme_asset)}" }
= f.inputs :name => :information do
= f.input :source
- if @theme_asset.new_record? || @theme_asset.stylesheet_or_javascript?
- if allow_plain_text_editing?(@theme_asset)
%span.alt
!= t('admin.theme_assets.form.choose_plain_text')
- if allow_plain_text_editing?(@theme_asset)
#text-selector{ :class => "selector #{'hidden' if !@theme_asset.stylesheet_or_javascript?}", :style => "#{'display: none' if !@theme_asset.stylesheet_or_javascript?}" }
#text-selector{ :class => "selector #{'hidden' unless display_plain_text?(@theme_asset)}", :style => "#{'display: none' unless display_plain_text?(@theme_asset)}" }
= f.inputs :name => :code, :class => 'inputs code' do
- if @theme_asset.new_record?