Commit e85f138b authored by Martin Markech's avatar Martin Markech
Browse files

add image picker

parent 93dcbd93
......@@ -7,11 +7,12 @@ module Refinery
attr_accessor :locale # to hold temporarily
attr_accessible :title, :body, :content, :source, :publish_date, :expiration_date, :position
attr_accessible :title, :body, :content, :source, :publish_date, :expiration_date, :position, :image_id
class Translation
attr_accessible :locale
end
belongs_to :image, :class_name => '::Refinery::Image'
alias_attribute :content, :body
validates :title, :content, :publish_date, :presence => true
......
<%= form_for [refinery, :news, :admin, @item] do |f| %>
<%= render "/refinery/admin/error_messages",
:object => @item,
:include_object_name => true %>
<%= render "locale_picker",
:current_locale => Thread.current[:globalize_locale] if defined?(::Refinery::I18n) %>
<div class='field'>
<%= f.label :title %>
<%= f.text_field :title, :class => "larger widest" %>
</div>
<div class='field'>
<%= f.label :publish_date %>
<%= f.datetime_select :publish_date %>
</div>
<div class='field'>
<%= f.label :expiration_date %>
<%= f.datetime_select :expiration_date, :start_year => Time.now.year,
:include_blank => true %>
</div>
<div class='field'>
<%= f.label :body %>
<%= f.text_area :body, :rows => "20", :class => "wymeditor widest" %>
</div>
<div class='field'>
<%= f.label :source %>
<%= f.text_field :source, :class => "larger widest" %>
</div>
<%= render "/refinery/admin/form_actions",
:f => f,
:continue_editing => true,
:delete_title => t('admin.news.items.item.delete'),
:delete_confirmation => t('shared.admin.delete.message', :title => @item.title) %>
<%= render "/refinery/admin/error_messages",
:object => @item,
:include_object_name => true %>
<%= render "locale_picker",
:current_locale => Thread.current[:globalize_locale] if defined?(::Refinery::I18n) %>
<div class='field'>
<%= f.label :title %>
<%= f.text_field :title, :class => "larger widest" %>
</div>
<div class='field'>
<%= f.label :publish_date %>
<%= f.datetime_select :publish_date %>
</div>
<div class='field'>
<%= f.label :expiration_date %>
<%= f.datetime_select :expiration_date, :start_year => Time.now.year,
:include_blank => true %>
</div>
<div class='field'>
<%= f.label :image -%>
<%= render '/refinery/admin/image_picker',
:f => f,
:field => :image_id,
:image => @item.image,
:toggle_image_display => false,
:description => t('refinery.news.admin.item')
%>
</div>
<div class='field'>
<%= f.label :body %>
<%= f.text_area :body, :rows => "20", :class => "wymeditor widest" %>
</div>
<div class='field'>
<%= f.label :source %>
<%= f.text_field :source, :class => "larger widest" %>
</div>
<%= render "/refinery/admin/form_actions",
:f => f,
:continue_editing => true,
:delete_title => t('admin.news.items.item.delete'),
:delete_confirmation => t('shared.admin.delete.message', :title => @item.title) %>
<% end %>
......@@ -48,5 +48,6 @@ sk:
publish_date: Dátum zverejnenia
expiration_date: Dátum expirácie
source: Zdroj
image: Obrázok
models:
'refinery/news/item': Novinka
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment