Commit 6a6b705d authored by Martin Markech's avatar Martin Markech
Browse files

new feature - copy existing item and create new

parent e85f138b
......@@ -5,6 +5,12 @@ module Refinery
crudify :'refinery/news/item', :xhr_paging => true
def copy
@item = Refinery::News::Item.find(params[:id])
@item.attributes['id'] = nil
@item.title = ::I18n.t('refinery.news.copy_of') + @item.title
end
end
end
end
......
......@@ -20,6 +20,7 @@ module Refinery
acts_as_indexed :fields => [:title, :body]
default_scope order('position DESC')
def not_published? # has the published date not yet arrived?
publish_date > Time.now
......
<%= form_for [refinery, :news, :admin, @item] do |f| %>
<%= render "/refinery/admin/error_messages",
:object => @item,
:include_object_name => true %>
......@@ -39,10 +39,6 @@
<%= 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,
......@@ -50,4 +46,4 @@
:delete_title => t('admin.news.items.item.delete'),
:delete_confirmation => t('shared.admin.delete.message', :title => @item.title) %>
<% end %>
......@@ -17,8 +17,12 @@
<%= link_to refinery_icon_tag('application_go.png'), refinery.news_item_path(item),
:title => t('.view_live_html'),
:target => "_blank" %>
<%= link_to refinery_icon_tag('copy.png'), refinery.copy_news_admin_item_path(item),
:title => t('.copy') %>
<%= link_to refinery_icon_tag('application_edit.png'), refinery.edit_news_admin_item_path(item),
:title => t('.edit') %>
<%= link_to refinery_icon_tag('delete.png'), refinery.news_admin_item_path(item),
:class => "cancel confirm-delete",
:title => t('.delete'),
......
<%= form_for [refinery, :news, :admin, @item], :url=> refinery.news_admin_items_path, :method=>"post" do |f| %>
<%= render "form", {:f=> f} %>
<% end %>
<%= render "form" %>
<%= form_for [refinery, :news, :admin, @item] do |f| %>
<%= render "form", {:f =>f} %>
<% end %>
<%= render "form" %>
<%= form_for [refinery, :news, :admin, @item] do |f| %>
<%= render "form", {:f =>f} %>
<% end %>
......@@ -5,6 +5,7 @@ sk:
title: Novinky
description: Poskytuje jednoduchú správu noviniek
news:
copy_of: "KÓPIA "
admin:
items:
actions:
......@@ -15,6 +16,7 @@ sk:
view_live_html: "Zobraziť novinku v novom okne"
edit: "Editovať novinku"
delete: "Zmazať novinku"
copy: "Duplikovať novinku"
published: Uverejnená
index:
create: "Pridať novinku"
......
......@@ -13,6 +13,9 @@ Refinery::Core::Engine.routes.draw do
collection do
post :update_positions
end
member do
get :copy
end
end
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