Commit 2ad8dc5e authored by Martin Markech's avatar Martin Markech
Browse files

add translations

parent f6630a3d
$(document).ready(function(){
page_options.init(
false
, "/refinery/page_parts/new"
, "/refinery/page_parts"
);
});
......@@ -3,7 +3,7 @@ module Refinery
module Admin
class ItemsController < ::Refinery::AdminController
crudify :'refinery/news/item', :xhr_paging => true
crudify :'refinery/news/item', :xhr_paging => true, :order=>"position DESC, created_at DESC"
def copy
@item = Refinery::News::Item.find(params[:id])
......
......@@ -3,24 +3,29 @@ module Refinery
class Item < Refinery::Core::BaseModel
extend FriendlyId
translates :title, :body
translates :title, :body, :teaser
attr_accessor :locale # to hold temporarily
attr_accessible :title, :body, :content, :source, :publish_date, :expiration_date, :position, :image_id, :teaser
#has_many :image_pages, :class_name => '::Refinery::ImagePage' , :as => :page
#has_many :images, :through => :image_pages
belongs_to :image, :class_name => '::Refinery::Image'
attr_accessible :title, :body, :source, :publish_date, :expiration_date, :position, :image_id, :teaser
#accepts_nested_attributes_for :image_pages
class Translation
attr_accessible :locale
end
belongs_to :image, :class_name => '::Refinery::Image'
alias_attribute :content, :body
validates :title, :content, :publish_date, :presence => true
validates :title, :publish_date, :presence => true
friendly_id :title, :use => [:slugged]
acts_as_indexed :fields => [:title, :body]
acts_as_indexed :fields => [:title, :body, :teaser]
default_scope order('position DESC')
default_scope order('position DESC, publish_date DESC')
def not_published? # has the published date not yet arrived?
publish_date > Time.now
......@@ -34,6 +39,10 @@ module Refinery
self.class.previous(self).first
end
def contains_body?
body.present? && body != "<br>"
end
class << self
def by_archive(archive_date)
where(:publish_date => archive_date.beginning_of_month..archive_date.end_of_month)
......
......@@ -33,16 +33,6 @@
%>
</div>
<script>
$(document).ready(function(){
page_options.init(
false
, "/refinery/page_parts/new"
, "/refinery/page_parts"
);
});
</script>
<div class='field'>
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
<ul id='page_parts'>
......@@ -52,6 +42,9 @@
<li class='ui-state-default' data-index='1'>
<a href="#page_part_body"><%= t('.body') %></a>
</li>
<li class='ui-state-default' id="custom_image_tab">
<a href="#custom_tab_0">Obrázky</a>
</li>
</ul>
<div id='page_part_editors'>
......@@ -61,10 +54,27 @@
<div class='page_part' id='page_part_body'>
<%= f.text_area :body, :rows => "20", :id=>"page_parts_attributes_1_body", :class => "wymeditor widest" %>
</div>
<!--<div class='page_part' id='custom_tab_0'>
<div class='wym_skin_refinery page_part' id='page_image_picker'>
<div class='wym_area_top'>
<span class='clearfix label_inline_with_link'>
<a href="/refinery/images/insert?callback=image_added&amp;dialog=true&amp;height=510&amp;multiple=true&amp;width=950" id="add_image_link">Pridať obrázok</a>
</span>
</div>
<div class='wym_box field images_field'>
<ul id='page_images' class='clearfix'>
<li class='empty'>
<input id="page_images_attributes_0_id" name="item[images_attributes][0][id]" type="hidden" />
</li>
</ul>
</div>
</div>
</div> -->
</div>
</div>
</div>
<%= render "/refinery/admin/form_actions",
:f => f,
:continue_editing => true,
......
......@@ -2,7 +2,7 @@
<span class='title'>
<%= item.title %>
<span class="preview">
<%= t('.published') %> <%= l(item.publish_date, :format => :short) %>
<%= t('.published') %> <%= l(item.publish_date, :format => :long) if item.publish_date %>
</span>
<% if defined?(::Refinery::I18n) and ::Refinery::I18n.frontend_locales.many? and
(locales = item.translations.collect{|t| t.locale}).present? %>
......@@ -15,8 +15,8 @@
</span>
<span class='actions'>
<%= link_to refinery_icon_tag('application_go.png'), refinery.news_item_path(item),
:title => t('.view_live_html'),
:target => "_blank" %>
:title => t('.view_live_html'),
:target => "_blank" %>
<%= link_to refinery_icon_tag('copy.png'), refinery.copy_news_admin_item_path(item),
:title => t('.copy') %>
......
Refinery::Core.configure do |config|
# Register extra javascript for backend
config.register_javascript "refinery/news/news.js"
config.register_javascript "refinery/page-image-picker.js"
config.register_stylesheet "refinery/page-image-picker.css"
end
......@@ -6,6 +6,8 @@ sk:
description: Poskytuje jednoduchú správu noviniek
news:
copy_of: "KÓPIA "
created_at: Vytvorené
updated_at: Aktualizované
admin:
items:
form:
......
class AddTeaserToItemTranslations < ActiveRecord::Migration
def change
add_column Refinery::News::Item::Translation.table_name, :teaser, :text
end
end
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