Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Markech
refinerycms-news
Commits
6a6b705d
Commit
6a6b705d
authored
Jan 02, 2013
by
Martin Markech
Browse files
new feature - copy existing item and create new
parent
e85f138b
Changes
10
Hide whitespace changes
Inline
Side-by-side
app/assets/images/refinery/icons/copy.png
0 → 100644
View file @
6a6b705d
481 Bytes
app/controllers/refinery/news/admin/items_controller.rb
View file @
6a6b705d
...
...
@@ -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
...
...
app/models/refinery/news/item.rb
View file @
6a6b705d
...
...
@@ -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
...
...
app/views/refinery/news/admin/items/_form.html.erb
View file @
6a6b705d
<%=
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
%>
app/views/refinery/news/admin/items/_item.html.erb
View file @
6a6b705d
...
...
@@ -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'
),
...
...
app/views/refinery/news/admin/items/copy.html.erb
0 → 100644
View file @
6a6b705d
<%=
form_for
[
refinery
,
:news
,
:admin
,
@item
],
:url
=>
refinery
.
news_admin_items_path
,
:method
=>
"post"
do
|
f
|
%>
<%=
render
"form"
,
{
:f
=>
f
}
%>
<%
end
%>
app/views/refinery/news/admin/items/edit.html.erb
View file @
6a6b705d
<%=
render
"form"
%>
<%=
form_for
[
refinery
,
:news
,
:admin
,
@item
]
do
|
f
|
%>
<%=
render
"form"
,
{
:f
=>
f
}
%>
<%
end
%>
app/views/refinery/news/admin/items/new.html.erb
View file @
6a6b705d
<%=
render
"form"
%>
<%=
form_for
[
refinery
,
:news
,
:admin
,
@item
]
do
|
f
|
%>
<%=
render
"form"
,
{
:f
=>
f
}
%>
<%
end
%>
config/locales/sk.yml
View file @
6a6b705d
...
...
@@ -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"
...
...
config/routes.rb
View file @
6a6b705d
...
...
@@ -13,6 +13,9 @@ Refinery::Core::Engine.routes.draw do
collection
do
post
:update_positions
end
member
do
get
:copy
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment