refinerycms-portfolio 0.9.9 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/controllers/portfolio_controller.rb +2 -0
- data/app/models/portfolio_entry.rb +5 -0
- data/app/views/admin/portfolio/_form.html.erb +34 -29
- data/app/views/admin/portfolio/_list.html.erb +9 -1
- data/app/views/admin/portfolio/_locale_picker.html.erb +11 -0
- data/app/views/portfolio/index.html.erb +1 -0
- data/app/views/portfolio/show.html.erb +15 -1
- data/config/locales/bg.yml +26 -0
- data/config/locales/cs.yml +26 -0
- data/config/locales/en.yml +1 -1
- data/config/locales/es.yml +31 -0
- data/config/locales/fr.yml +26 -0
- data/config/locales/it.yml +26 -0
- data/config/locales/lt.yml +27 -0
- data/config/locales/lv.yml +1 -1
- data/config/locales/nb.yml +26 -0
- data/config/locales/nl.yml +1 -1
- data/config/locales/pl.yml +30 -0
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/rs.yml +26 -0
- data/config/locales/ru.yml +28 -0
- data/config/locales/sl.yml +1 -1
- data/{lib/generators/refinerycms_portfolio/templates/db/migrate/migration_number_create_structure_for_portfolio.rb → db/migrate/1_create_structure_for_portfolio.rb} +0 -2
- data/db/migrate/2_translate_portfolio_entries.rb +18 -0
- data/{lib/generators/refinerycms_portfolio/templates/db → db}/seeds/portfolio.rb +0 -0
- data/features/manage_portfolio.feature +52 -0
- data/features/step_definitions/portfolio_steps.rb +13 -0
- data/features/support/factories.rb +5 -0
- data/features/support/paths.rb +16 -0
- data/features/visit_portfolio.feature +8 -0
- data/lib/gemspec.rb +2 -8
- data/lib/generators/refinerycms_portfolio_generator.rb +8 -0
- data/lib/portfolio/version.rb +1 -1
- data/public/javascripts/portfolio.js +5 -1
- data/spec/models/portfolio_entry_spec.rb +47 -0
- metadata +33 -13
- data/lib/generators/refinerycms_portfolio/refinerycms_portfolio_generator.rb +0 -59
@@ -6,6 +6,8 @@ class PortfolioController < ApplicationController
|
|
6
6
|
if RefinerySetting.find_or_set(:portfolio_has_no_index, true)
|
7
7
|
if (first_entry = PortfolioEntry.where(:parent_id => nil).first).present?
|
8
8
|
redirect_to portfolio_url(first_entry)
|
9
|
+
else
|
10
|
+
@portfolio_entries = []
|
9
11
|
end
|
10
12
|
else
|
11
13
|
@portfolio_entries = PortfolioEntry.all
|
@@ -1,6 +1,11 @@
|
|
1
|
+
require 'globalize3'
|
2
|
+
|
1
3
|
class PortfolioEntry < ActiveRecord::Base
|
2
4
|
belongs_to :title_image, :class_name => 'Image'
|
3
5
|
|
6
|
+
translates :title, :body if self.respond_to?(:translates)
|
7
|
+
attr_accessor :locale # to hold temporarily
|
8
|
+
|
4
9
|
validates :title, :presence => true
|
5
10
|
|
6
11
|
# call to gems included in refinery.
|
@@ -11,7 +11,13 @@
|
|
11
11
|
:locals => {
|
12
12
|
:object => f.object,
|
13
13
|
:include_object_name => true
|
14
|
-
}
|
14
|
+
} %>
|
15
|
+
|
16
|
+
<%= render :partial => "locale_picker",
|
17
|
+
:locals => {
|
18
|
+
:current_locale => Thread.current[:globalize_locale]
|
19
|
+
} if defined?(::Refinery::I18n) %>
|
20
|
+
|
15
21
|
<div id='portfolio_body' class='field clearfix'>
|
16
22
|
<%= f.required_label t('.title') %>
|
17
23
|
<%= f.text_field :title, :class => "larger widest" %>
|
@@ -28,7 +34,7 @@
|
|
28
34
|
</div>
|
29
35
|
<% end %>
|
30
36
|
<div class='field clearfix'>
|
31
|
-
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content'>
|
37
|
+
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
|
32
38
|
<ul id='page_parts'>
|
33
39
|
<li class='ui-state-default ui-state-active'>
|
34
40
|
<%= link_to t('.content'), '#page_part_content'%>
|
@@ -37,37 +43,36 @@
|
|
37
43
|
<%= link_to t('.images'), '#portfolio_image_picker'%>
|
38
44
|
</li>
|
39
45
|
</ul>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
<%= f.text_area :body, :class => "wymeditor widest", :rows => 7 %>
|
44
|
-
</div>
|
45
|
-
<div class='page_part wym_skin_refinery' id='portfolio_image_picker'>
|
46
|
-
<div class='wym_area_top'>
|
47
|
-
<span class='clearfix label_inline_with_link'>
|
48
|
-
<%= link_to t('.add_another_image').html_safe,
|
49
|
-
insert_admin_images_url(:dialog => true,
|
50
|
-
:width => 866,
|
51
|
-
:height => 510,
|
52
|
-
:callback => "image_added"),
|
53
|
-
:id => "add_image_link" %>
|
54
|
-
</span>
|
46
|
+
<div id='page_part_editors'>
|
47
|
+
<div id='page_part_content' class='page_part'>
|
48
|
+
<%= f.text_area :body, :class => "wymeditor widest", :rows => 7 %>
|
55
49
|
</div>
|
56
|
-
<div class='
|
57
|
-
<
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
50
|
+
<div class='page_part wym_skin_refinery' id='portfolio_image_picker'>
|
51
|
+
<div class='wym_area_top'>
|
52
|
+
<span class='clearfix label_inline_with_link'>
|
53
|
+
<%= link_to t('.add_another_image').html_safe,
|
54
|
+
insert_admin_images_url(:dialog => true,
|
55
|
+
:width => 866,
|
56
|
+
:height => 510,
|
57
|
+
:callback => "image_added"),
|
58
|
+
:id => "add_image_link" %>
|
59
|
+
</span>
|
60
|
+
</div>
|
61
|
+
<div class='wym_box field images_field'>
|
62
|
+
<ul id='portfolio_images' class='clearfix portfolio_entry_images'>
|
63
|
+
<%= f.fields_for :images do |image_form| %>
|
64
|
+
<li id='image_<%= image_form.object.id %>'>
|
65
|
+
<%= image_form.hidden_field :id %>
|
66
|
+
<%= image_fu image_form.object, '135x135#c' %>
|
67
|
+
</li>
|
68
|
+
<% end %>
|
69
|
+
<li class='empty'>
|
70
|
+
<%= hidden_field_tag "portfolio_entry[images_attributes][#{@portfolio_entry.images.size}][id]" %>
|
62
71
|
</li>
|
63
|
-
|
64
|
-
|
65
|
-
<%= hidden_field_tag "portfolio_entry[images_attributes][#{@portfolio_entry.images.size}][id]" %>
|
66
|
-
</li>
|
67
|
-
</ul>
|
72
|
+
</ul>
|
73
|
+
</div>
|
68
74
|
</div>
|
69
75
|
</div>
|
70
|
-
</div>
|
71
76
|
</div>
|
72
77
|
<% if (nested_portfolios = nested_set_options(PortfolioEntry, @portfolio_entry) {|i| "#{'-' * i.level} #{i.title}" }).present? %>
|
73
78
|
<div class='field'>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<span class='actions'>
|
11
11
|
<% url = (::Refinery::Portfolio.multi_level? && list.parent ? portfolio_project_url(list.parent, list) : portfolio_url(list)) %>
|
12
12
|
<%= link_to refinery_icon_tag('application_go.png'), url, :target => "_blank",
|
13
|
-
:title => t('.
|
13
|
+
:title => t('.view_live_html') %>
|
14
14
|
<%= link_to refinery_icon_tag('application_edit.png'), edit_admin_portfolio_entry_path(list),
|
15
15
|
:title => t('.edit_this_entry') %>
|
16
16
|
<%= link_to refinery_icon_tag('delete.png'), admin_portfolio_entry_path(list),
|
@@ -20,6 +20,14 @@
|
|
20
20
|
:method => :delete %>
|
21
21
|
</span>
|
22
22
|
<%=h list.title %>
|
23
|
+
<% if defined?(::Refinery::I18n) and ::Refinery::I18n.frontend_locales.many? and
|
24
|
+
(locales = list.translations.collect{|t| t.locale}).present? %>
|
25
|
+
<span class='preview'>
|
26
|
+
<% locales.each do |locale| %>
|
27
|
+
<%= refinery_icon_tag "flags/#{locale}.png", :size => '16x11' %>
|
28
|
+
<% end %>
|
29
|
+
</span>
|
30
|
+
<% end %>
|
23
31
|
</div>
|
24
32
|
<% if (children = list.children).any? %>
|
25
33
|
<ul<%= " class='nested'" %>>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<input type='hidden' name='switch_locale' id='switch_locale' value='<%= local_assigns[:current_locale] %>' />
|
2
|
+
<% if (locales ||= ::Refinery::I18n.frontend_locales).present? and locales.many? %>
|
3
|
+
<ul id='switch_locale_picker' class='clearfix'>
|
4
|
+
<% locales.each do |locale| %>
|
5
|
+
<li<%= " class='selected'" if locale.to_s == local_assigns[:current_locale].to_s %>>
|
6
|
+
<%= link_to refinery_icon_tag("flags/#{locale}.png", :size => '48x33'),
|
7
|
+
url_for(:switch_locale => locale) %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
<% end %>
|
@@ -12,6 +12,7 @@
|
|
12
12
|
<% content_for :body_content_left do %>
|
13
13
|
<div id='portfolio_main_image_container'>
|
14
14
|
<%= render :partial => "main_image" %>
|
15
|
+
<span class="content"><%= raw @portfolio_entry.body %></span>
|
15
16
|
</div>
|
16
17
|
<% end %>
|
17
18
|
|
@@ -19,7 +20,7 @@
|
|
19
20
|
<h2><%= @portfolio_entry.title %></h2>
|
20
21
|
<ul id='portfolio_images'>
|
21
22
|
<% @portfolio_entry.images.each_with_index do |image, index| %>
|
22
|
-
<li class="<%= cycle('odd', 'even') %>
|
23
|
+
<li class="<%= cycle('odd', 'even') %> <%= (index == params[:image_id].to_i) ? 'selected' : 'other' %>">
|
23
24
|
<%= link_to_portfolio_image(@master_entry, @portfolio_entry, image, index) %>
|
24
25
|
</li>
|
25
26
|
<% end %>
|
@@ -30,6 +31,7 @@
|
|
30
31
|
<%= render :partial => "/shared/content_page" %>
|
31
32
|
</div>
|
32
33
|
|
34
|
+
<% if Refinery.version < '0.9.9' %>
|
33
35
|
<% content_for :head do %>
|
34
36
|
<%= stylesheet_link_tag('portfolio') %>
|
35
37
|
<%# remove the jquery_include_tags call if jquery is included in your layout.
|
@@ -40,3 +42,15 @@
|
|
40
42
|
var portfolio_entry_url = "<%= portfolio_project_url(@master_entry, @portfolio_entry) if ::Refinery::Portfolio.multi_level? %>";
|
41
43
|
</script>
|
42
44
|
<% end %>
|
45
|
+
<% else %>
|
46
|
+
<% content_for :stylesheets, stylesheet_link_tag('portfolio') %>
|
47
|
+
<%# remove the jquery_include_tags call if jquery is included in your layout.
|
48
|
+
%>
|
49
|
+
<%= content_for :javascript_libraries, jquery_include_tags(:include_ui => false) %>
|
50
|
+
<% content_for :javascripts do %>
|
51
|
+
<%= javascript_include_tag 'portfolio' %>
|
52
|
+
<script type='text/javascript'>
|
53
|
+
var portfolio_entry_url = "<%= portfolio_project_url(@master_entry, @portfolio_entry) if ::Refinery::Portfolio.multi_level? %>";
|
54
|
+
</script>
|
55
|
+
<% end %>
|
56
|
+
<% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
bg:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Портфолио
|
5
|
+
description: Управление на портфолио в Refinery CMS
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Действия
|
10
|
+
create_new_portfolio_entry: "Добавяне на нов елемент"
|
11
|
+
reorder_portfolio: "Пренареждане на портфолиото"
|
12
|
+
reorder_portfolio_done: "Запис на текущото подреждане на портфолиото"
|
13
|
+
portfolio: Портфолио
|
14
|
+
no_portfolio_entries_yet: 'Все още Вашето портфолио е празно. Натиснете "Добавяне на нов елемент", за да добавите нов.'
|
15
|
+
list:
|
16
|
+
view_live_html: "Преглед на този елемент <br/><em>(ще се отвори се в нов прозорец)</em>"
|
17
|
+
edit_this_entry: "Редактиране на този елемент"
|
18
|
+
move_this_entry_up: "Преместване на този елемент едно ниво нагоре"
|
19
|
+
confirm_delete_entry_title: "Изтриване на този елемент завинаги"
|
20
|
+
form:
|
21
|
+
title: Заглавие
|
22
|
+
images: Изображения
|
23
|
+
add: Добавяне
|
24
|
+
add_another_image: "Добавяне на друго изображение"
|
25
|
+
content: Съдържание
|
26
|
+
parent: Родител
|
@@ -0,0 +1,26 @@
|
|
1
|
+
cs:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Portfolio
|
5
|
+
description: Správa portfolia v Refinery CMS
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Akce
|
10
|
+
create_new_portfolio_entry: "Přidat novou položku portfolia"
|
11
|
+
reorder_portfolio: "Přeuspořádat položky"
|
12
|
+
reorder_portfolio_done: "Uložit uspořádání"
|
13
|
+
portfolio: Portfolio
|
14
|
+
no_portfolio_entries_yet: 'Zatím nebyly vytvořeny žádné položky portfolia.'
|
15
|
+
list:
|
16
|
+
view_live_html: "Zobrazit tuto položku <br/><em>(otevře se v novém okně)</em>"
|
17
|
+
edit_this_entry: "Upravit tuto položku"
|
18
|
+
move_this_entry_up: "Přesunout položku o jednu úroveň výš"
|
19
|
+
confirm_delete_entry_title: "Odstranit tuto položku"
|
20
|
+
form:
|
21
|
+
title: Název
|
22
|
+
images: Obrázky
|
23
|
+
add: Přidat
|
24
|
+
add_another_image: "Přidat další obrázek"
|
25
|
+
content: Obsah
|
26
|
+
parent: "Nadřazená položka"
|
data/config/locales/en.yml
CHANGED
@@ -13,7 +13,7 @@ en:
|
|
13
13
|
portfolio: Portfolio
|
14
14
|
no_portfolio_entries_yet: 'There are no portfolio entries yet. Click "Add New Portfolio Entry" to add your first portfolio entries.'
|
15
15
|
list:
|
16
|
-
|
16
|
+
view_live_html: "View this entry live <br/><em>(opens in a new window)</em>"
|
17
17
|
edit_this_entry: "Edit this entry"
|
18
18
|
move_this_entry_up: "Move this entry up one level"
|
19
19
|
confirm_delete_entry_title: "Remove this entry forever"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
es:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Portfolio
|
5
|
+
description: Gestionar un portfolio dentro de Refinery CMS
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Acciones
|
10
|
+
create_new_portfolio_entry: "Añadir Nueva Entrada de Portfolio"
|
11
|
+
reorder_portfolio: "Reordenar portfolios"
|
12
|
+
reorder_portfolio_done: "He terminado de reordenar los portfolios"
|
13
|
+
portfolio: Portfolio
|
14
|
+
no_portfolio_entries_yet: 'No hay entradas de portfolio todavía. Pulsa en "Añadir Nueva Entrada de Portfolio" para añadir tu primera entrada de portfolio.'
|
15
|
+
list:
|
16
|
+
view_live_html: "Ver esta entrada como abierta al público<br/><em>(la abre en ventana nueva)</em>"
|
17
|
+
edit_this_entry: "Editar esta entrada"
|
18
|
+
move_this_entry_up: "Subir esta entrada un nivel"
|
19
|
+
confirm_delete_entry_title: "Borrar esta entrada para siempre"
|
20
|
+
form:
|
21
|
+
title: Título
|
22
|
+
images: Imágenes
|
23
|
+
add: Añadir
|
24
|
+
add_another_image: "Añadir Otra Imagen"
|
25
|
+
content: Contenido
|
26
|
+
parent: Padre
|
27
|
+
activerecord:
|
28
|
+
attributes:
|
29
|
+
portfolio_entry:
|
30
|
+
image: Imagen
|
31
|
+
portfolio_no_entries: No hemos introducido nada de este proyecto todavía.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
fr:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Portfolio
|
5
|
+
description: Gestion du portfolio dans Refinery CMS
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Actions
|
10
|
+
create_new_portfolio_entry: "Ajouter une entrée dans le portfolio"
|
11
|
+
reorder_portfolio: "Réordonner le Portfolio"
|
12
|
+
reorder_portfolio_done: "Fin de réordonnancement du Portfolio"
|
13
|
+
portfolio: Portfolio
|
14
|
+
no_portfolio_entries_yet: "Il n'y a pas encore d'entrée au portfolio. Cliquez sur \"Ajouter une entrée dans le portfolio\" pour ajouter votre première entrée."
|
15
|
+
list:
|
16
|
+
view_live_html: "Voir cette nouvelle entrée <br/><em>(Ouvre une nouvelle fenêtre)</em>"
|
17
|
+
edit_this_entry: "Modifier cette entrée"
|
18
|
+
move_this_entry_up: "Déplacer cette entrée d'un niveau"
|
19
|
+
confirm_delete_entry_title: "Supprimer définitivement cette entrée"
|
20
|
+
form:
|
21
|
+
title: Titre
|
22
|
+
images: Images
|
23
|
+
add: Ajouter
|
24
|
+
add_another_image: "Ajouter une autre image"
|
25
|
+
content: Contenu
|
26
|
+
parent: Parent
|
@@ -0,0 +1,26 @@
|
|
1
|
+
it:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Portfolio
|
5
|
+
description: Gestione di un portfolio in Refinery CMS
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Azioni
|
10
|
+
create_new_portfolio_entry: "Aggiungi un elemento al Portfolio"
|
11
|
+
reorder_portfolio: "Riordina il Portfolio"
|
12
|
+
reorder_portfolio_done: "Riordinamento del Portfolio Finito"
|
13
|
+
portfolio: Portfolio
|
14
|
+
no_portfolio_entries_yet: 'Non ci sono ancora elementi nel portfolio. Premi "Aggiungi un elemento al Portfolio" per inserire il primo elemento al portfolio.'
|
15
|
+
list:
|
16
|
+
view_live_html: "Visualizza questo elemento <br/><em>(in una nuova finestra)</em>"
|
17
|
+
edit_this_entry: "Modifica questo elemento"
|
18
|
+
move_this_entry_up: "Muovi questo elemento su di un livello"
|
19
|
+
confirm_delete_entry_title: "Elimina questo elemento per sempre"
|
20
|
+
form:
|
21
|
+
title: Titolo
|
22
|
+
images: Immagini
|
23
|
+
add: Aggiungi
|
24
|
+
add_another_image: "Aggiungi un'altra Immagine"
|
25
|
+
content: Contenuto
|
26
|
+
parent: Genitore
|
@@ -0,0 +1,27 @@
|
|
1
|
+
lt:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Portfolio
|
5
|
+
description: Portfolio valdymas Refinery turinio valdymo sistemoje
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Veiksmai
|
10
|
+
create_new_portfolio_entry: "Pridėti naują Portfolio įrašą"
|
11
|
+
reorder_portfolio: "Keisti Portfolio eiliškumą"
|
12
|
+
reorder_portfolio_done: "Baigti keisti Portfolio eiliškumą"
|
13
|
+
portfolio: Portfolio
|
14
|
+
no_portfolio_entries_yet: 'There are no portfolio entries yet. Click "Add New Portfolio Entry" to add your first portfolio entries.'
|
15
|
+
no_portfolio_entries_yet: 'Kolk nėra portfolio įrašų. Paspauskite "Pridėti naują Portfolio įrašą", kad sukurti pirmąjį.'
|
16
|
+
list:
|
17
|
+
view_live_html: "Peržiūrėti šį įrašą gyvai svetainėje<br /><em>(atsidarys naujame lange)</em>"
|
18
|
+
edit_this_entry: "Redaguoti šį įrašą"
|
19
|
+
move_this_entry_up: "Perkelti įrašą vienu lygiu aukštyn"
|
20
|
+
confirm_delete_entry_title: "Pašalinti įrašą visam laikui"
|
21
|
+
form:
|
22
|
+
title: Antraštė
|
23
|
+
images: Paveikslėliai
|
24
|
+
add: Pridėti
|
25
|
+
add_another_image: "Pridėti kitą paveikslėlį"
|
26
|
+
content: Turinys
|
27
|
+
parent: Tėvas
|
data/config/locales/lv.yml
CHANGED
@@ -13,7 +13,7 @@ lv:
|
|
13
13
|
portfolio: Portfolio
|
14
14
|
no_portfolio_entries_yet: Vēl nav neviena portfolio ieraksta. Spied "Izveidot Jaunu Portfolio Ierakstu", lai pievienotu pirmo ierakstu.
|
15
15
|
list:
|
16
|
-
|
16
|
+
view_live_html: Apskatīt šo ieraksu <br/><em>(tiks atvērts jaunā logā)</em>
|
17
17
|
edit_this_entry: Labot šo ierakstu
|
18
18
|
move_this_entry_up: Pārvietot šo ierkastu vienu līmeni augstāk
|
19
19
|
confirm_delete_entry_title: Dzēst šo ierakstu
|
@@ -0,0 +1,26 @@
|
|
1
|
+
nb:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Portfolio
|
5
|
+
description: Behandle en portfolio i Refinery CMS
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Handlinger
|
10
|
+
create_new_portfolio_entry: "Legg til nytt element"
|
11
|
+
reorder_portfolio: "Endre rekkefølge"
|
12
|
+
reorder_portfolio_done: "Ferdig å endre rekkefølge"
|
13
|
+
portfolio: Portfolio
|
14
|
+
no_portfolio_entries_yet: 'Det er ikke lagt til noen elementer enda. Klikk på "Legg til nytt element" for å legge til ditt første portfolio element.'
|
15
|
+
list:
|
16
|
+
view_live_html: "Se hvordan elementet ser ut for besøkende <br/><em>(åpnes i et nytt vindu)</em>"
|
17
|
+
edit_this_entry: "Rediger elementet"
|
18
|
+
move_this_entry_up: "Flytt elementet opp ett nivå"
|
19
|
+
confirm_delete_entry_title: "Fjern elementet permanent"
|
20
|
+
form:
|
21
|
+
title: Tittel
|
22
|
+
images: Bilder
|
23
|
+
add: Legg til
|
24
|
+
add_another_image: "Legg til et bilde"
|
25
|
+
content: Innhold
|
26
|
+
parent: Forelder
|
data/config/locales/nl.yml
CHANGED
@@ -13,7 +13,7 @@ nl:
|
|
13
13
|
portfolio: Portfolio
|
14
14
|
no_portfolio_entries_yet: 'Er bestaan nog geen portfolio items. Klik "Maak een nieuw Portfolio item" om een eerste portfolio toe te voegen.'
|
15
15
|
list:
|
16
|
-
|
16
|
+
view_live_html: "Preview dit item <br/><em>(opent in nieuw venster)</em>"
|
17
17
|
edit_this_entry: "Bewerk dit item"
|
18
18
|
move_this_entry_up: "Verplaats dit item een niveau hoger"
|
19
19
|
confirm_delete_entry_title: "Verwijder dit item voorgoed"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
pl:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Portfolio
|
5
|
+
description: Zarządzaj portfolio wewnątrz RefineryCMS
|
6
|
+
article: masculine
|
7
|
+
admin:
|
8
|
+
portfolio:
|
9
|
+
index:
|
10
|
+
actions: Akcje
|
11
|
+
create_new_portfolio_entry: "Dodaj nowy wpis w portfolio"
|
12
|
+
reorder_portfolio: "Uporządkuj portfolio"
|
13
|
+
reorder_portfolio_done: "Zakończ porządkowanie portfolio"
|
14
|
+
portfolio: Portfolio
|
15
|
+
no_portfolio_entries_yet: 'Nie ma jeszcze żadnych wpisów w portfolio. Kliknij "Dodaj nowy wpis w portfolio" aby dodać pierwszy.'
|
16
|
+
list:
|
17
|
+
view_live_html: "Zobacz ten wpis na żywo <br/><em>(otwiera się w nowym oknie)</em>"
|
18
|
+
edit_this_entry: "Zmień ten wpis"
|
19
|
+
move_this_entry_up: "Przenieś ten wpis poziom wyżej"
|
20
|
+
confirm_delete_entry_title: "Usuń ten wpis na zawsze"
|
21
|
+
form:
|
22
|
+
title: Tytuł
|
23
|
+
images: Obrazy
|
24
|
+
add: Dodaj
|
25
|
+
add_another_image: "Dodaj inny obraz"
|
26
|
+
content: Zawartość
|
27
|
+
parent: Wpis nadrzędny
|
28
|
+
activerecord:
|
29
|
+
models:
|
30
|
+
portfolio_entry: wpis w portfolio
|
data/config/locales/pt-BR.yml
CHANGED
@@ -12,7 +12,7 @@ pt-BR:
|
|
12
12
|
portfolio: Portfólio
|
13
13
|
no_portfolio_entries_yet: 'Não há portfólios cadastrados. Clique em "Criar novo Portfólio" para cadastrar seu primeiro portfólio.'
|
14
14
|
list:
|
15
|
-
|
15
|
+
view_live_html: "Ver este portfólio no site<br/><em>(abrirá em uma nova janela)</em>"
|
16
16
|
edit_this_entry: "Alterar este portfólio"
|
17
17
|
move_this_entry_up: "Mover este portfólio um nível acima"
|
18
18
|
confirm_delete_entry_title: "Remover este portfólio para sempre"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
rs:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Galerije
|
5
|
+
description: Omogućava rad sa galerijama slika u Refinery CMS-u
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Akcije
|
10
|
+
create_new_portfolio_entry: "Dodaj novu galeriju"
|
11
|
+
reorder_portfolio: "Promeni redosled galerija"
|
12
|
+
reorder_portfolio_done: "Završi sa promenom"
|
13
|
+
portfolio: Galerije
|
14
|
+
no_portfolio_entries_yet: 'Ne postoje galerije. Klikni "Dodaj novu galeriju" da dodaš.'
|
15
|
+
list:
|
16
|
+
view_live_html: "Pogledaj ovu galeriju <br/><em>(otvara se u novom prozoru)</em>"
|
17
|
+
edit_this_entry: "Izmeni ovu galeriju"
|
18
|
+
move_this_entry_up: "Pomeri ovu galeriju jedan nivo iznad"
|
19
|
+
confirm_delete_entry_title: "Ukloni ovu galeriju zauvek"
|
20
|
+
form:
|
21
|
+
title: Naslov
|
22
|
+
images: Slike
|
23
|
+
add: Dodaj
|
24
|
+
add_another_image: "Dodaj još slika"
|
25
|
+
content: Sadržaj
|
26
|
+
parent: Roditelj
|
@@ -0,0 +1,28 @@
|
|
1
|
+
ru:
|
2
|
+
plugins:
|
3
|
+
portfolio:
|
4
|
+
title: Портфолио
|
5
|
+
description: Управление галереями с помощью Refinery CMS
|
6
|
+
admin:
|
7
|
+
portfolio:
|
8
|
+
index:
|
9
|
+
actions: Действия
|
10
|
+
create_new_portfolio_entry: "Добавить"
|
11
|
+
reorder_portfolio: "Сортировать"
|
12
|
+
reorder_portfolio_done: "Завершить сортировку"
|
13
|
+
portfolio: Портфолио
|
14
|
+
no_portfolio_entries_yet: 'Нет ни одного Портфолио. Нажмите "Добавить" для создания первого Портфолио.'
|
15
|
+
list:
|
16
|
+
view_live_html: "Посмотреть в максимальном размере <br/><em>(открыть в новом окне)</em>"
|
17
|
+
edit_this_entry: "Редактировать"
|
18
|
+
move_this_entry_up: "Переместить вверх на один уровень"
|
19
|
+
confirm_delete_entry_title: "Удалить навсегда"
|
20
|
+
form:
|
21
|
+
title: Заголовок
|
22
|
+
images: Изображения
|
23
|
+
add: Добавить
|
24
|
+
add_another_image: "Добавить"
|
25
|
+
content: Содержимое
|
26
|
+
parent: Родитель
|
27
|
+
portfolio:
|
28
|
+
portfolio_no_entries: В этой галерее нет фотографий
|
data/config/locales/sl.yml
CHANGED
@@ -12,7 +12,7 @@ sl:
|
|
12
12
|
portfolio: Portfelja
|
13
13
|
no_portfolio_entries_yet: 'Trenutno še ni nobenega portfelja. Kliknite "Ustvari Novo Portfelje" če želite dodati prvo portfelje.'
|
14
14
|
list:
|
15
|
-
|
15
|
+
view_live_html: Poglej si ta zapis v živo <br/><em>(odpre se v novem oknu)</em>
|
16
16
|
edit_this_entry: "Uredi zapis"
|
17
17
|
move_this_entry_up: "Premakni zapis en nivo višje"
|
18
18
|
confirm_delete_entry_title: "Odstrani zapis"
|
@@ -25,8 +25,6 @@ class CreateStructureForPortfolio < ActiveRecord::Migration
|
|
25
25
|
add_index :portfolio_entries, :parent_id
|
26
26
|
add_index :portfolio_entries, :lft
|
27
27
|
add_index :portfolio_entries, :rgt
|
28
|
-
|
29
|
-
load(Rails.root.join('db', 'seeds', 'portfolio.rb'))
|
30
28
|
end
|
31
29
|
|
32
30
|
def self.down
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class TranslatePortfolioEntries < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
PortfolioEntry.create_translation_table!({
|
5
|
+
:title => :string,
|
6
|
+
:body => :text
|
7
|
+
}, {
|
8
|
+
:migrate_data => true
|
9
|
+
})
|
10
|
+
|
11
|
+
load(Rails.root.join('db', 'seeds', 'portfolio.rb'))
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
PortfolioEntry.drop_translation_table! :migrate_data => true
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
@portfolio @portfolio-manage @portfolio-entries
|
2
|
+
Feature: Manage Portfolio
|
3
|
+
In order to add a portfolio section to my website
|
4
|
+
As an administrator
|
5
|
+
I want to create and manage portfolio entries
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I am a logged in refinery user
|
9
|
+
And I have no portfolio entries
|
10
|
+
|
11
|
+
@portfolio-list @list
|
12
|
+
Scenario: Portfolio Entries List
|
13
|
+
Given I have portfolio entries titled Home, About
|
14
|
+
When I go to the list of portfolio entries
|
15
|
+
Then I should see "Home"
|
16
|
+
And I should see "About"
|
17
|
+
|
18
|
+
@portfolio-valid @valid
|
19
|
+
Scenario: Add Valid Portfolio Entry
|
20
|
+
When I go to the list of portfolio entries
|
21
|
+
And I follow "Add New Portfolio Entry"
|
22
|
+
And I fill in "portfolio_entry_title" with "Portfolios are useful to show off my work"
|
23
|
+
And I press "Save"
|
24
|
+
Then I should see "'Portfolios are useful to show off my work' was successfully added."
|
25
|
+
And I should have 1 portfolio entries
|
26
|
+
|
27
|
+
@portfolio-invalid @invalid
|
28
|
+
Scenario: Add Invalid Portfolio Entry (without title)
|
29
|
+
When I go to the list of portfolio entries
|
30
|
+
And I follow "Add New Portfolio Entry"
|
31
|
+
And I press "Save"
|
32
|
+
Then I should see "Title can't be blank"
|
33
|
+
And I should have 0 portfolio entries
|
34
|
+
|
35
|
+
@portfolio-edit @edit
|
36
|
+
Scenario: Edit Existing Portfolio Entry
|
37
|
+
Given I have portfolio entries titled Home
|
38
|
+
And I go to the list of portfolio entries
|
39
|
+
And I follow "Edit this entry"
|
40
|
+
And I fill in "portfolio_entry_title" with "Away"
|
41
|
+
And I press "Save"
|
42
|
+
Then I should see "'Away' was successfully updated."
|
43
|
+
And I should not see "Home"
|
44
|
+
And I should have 1 portfolio entries
|
45
|
+
|
46
|
+
@portfolio-delete @delete
|
47
|
+
Scenario: Delete Portfolio Entry
|
48
|
+
Given I only have a portfolio entry titled "test"
|
49
|
+
When I go to the list of portfolio entries
|
50
|
+
And I follow "Remove this entry forever"
|
51
|
+
Then I should see "'test' was successfully removed."
|
52
|
+
And I should have 0 portfolio entries
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Given /^I have no portfolio entries$/ do
|
2
|
+
PortfolioEntry.delete_all
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^I (only )?have a? ?portfolio entry?i?e?s? titled "?([^\"]*)"?$/ do |only, title|
|
6
|
+
PortfolioEntry.delete_all if only
|
7
|
+
|
8
|
+
entry = PortfolioEntry.create(:title => title)
|
9
|
+
end
|
10
|
+
|
11
|
+
Then /^I should have ([0-9]+) portfolio entries?$/ do |count|
|
12
|
+
PortfolioEntry.count.should == count.to_i
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
module Refinery
|
3
|
+
module Portfolio
|
4
|
+
def path_to(page_name)
|
5
|
+
case page_name
|
6
|
+
when /the list of portfolio( entries)?/
|
7
|
+
admin_portfolio_entries_path
|
8
|
+
when /the new portfolio( entry)? form/
|
9
|
+
new_admin_portfolio_path
|
10
|
+
else
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/gemspec.rb
CHANGED
@@ -2,10 +2,7 @@
|
|
2
2
|
require File.expand_path('../portfolio/version.rb', __FILE__)
|
3
3
|
version = Refinery::Portfolio.version
|
4
4
|
raise "Could not get version so gemspec can not be built" if version.nil?
|
5
|
-
files =
|
6
|
-
%w(app config generators lib public rails test vendor).each do |dir|
|
7
|
-
files += Dir.glob("#{dir}/**/*") if File.directory?(dir)
|
8
|
-
end
|
5
|
+
files = (Dir.glob("*") | Dir.glob("**/*")).reject{ |f| f =~ %r{.gem(spec)?$} }
|
9
6
|
|
10
7
|
gemspec = <<EOF
|
11
8
|
Gem::Specification.new do |s|
|
@@ -19,14 +16,11 @@ Gem::Specification.new do |s|
|
|
19
16
|
s.authors = ['Resolve Digital']
|
20
17
|
s.require_paths = %w(lib)
|
21
18
|
|
22
|
-
s.add_dependency 'refinerycms', '>= 0.9.
|
19
|
+
s.add_dependency 'refinerycms', '>= 0.9.9'
|
23
20
|
|
24
21
|
s.files = [
|
25
22
|
'#{files.join("',\n '")}'
|
26
23
|
]
|
27
|
-
#{"s.test_files = [
|
28
|
-
'#{Dir.glob("test/**/*.rb").join("',\n '")}'
|
29
|
-
]" if File.directory?("test")}
|
30
24
|
end
|
31
25
|
EOF
|
32
26
|
|
data/lib/portfolio/version.rb
CHANGED
@@ -78,7 +78,11 @@ image_added = function(image) {
|
|
78
78
|
|
79
79
|
$(document).ready(function() {
|
80
80
|
$('h1#body_content_page_title').addClass('clearfix');
|
81
|
-
|
81
|
+
|
82
|
+
if ($('#portfolio_images').sortable) {
|
83
|
+
reset_functionality();
|
84
|
+
}
|
85
|
+
|
82
86
|
|
83
87
|
$("ul#portfolio_images li.other a img").fadeTo(0, 0.3);
|
84
88
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
Dir[File.expand_path('../../../features/support/factories.rb', __FILE__)].each {|f| require f}
|
4
|
+
|
5
|
+
describe PortfolioEntry do
|
6
|
+
describe "validations" do
|
7
|
+
it "rejects empty title" do
|
8
|
+
PortfolioEntry.new.should_not be_valid
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "title_image association" do
|
13
|
+
it "have a title_image attribute" do
|
14
|
+
Factory(:portfolio_entry).should respond_to(:title_image)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "images_portfolio_entries association" do
|
19
|
+
it "have an images_portfolio_entries attribute" do
|
20
|
+
Factory(:portfolio_entry).should respond_to(:images_portfolio_entries)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "images association" do
|
25
|
+
it "have an images attribute" do
|
26
|
+
Factory(:portfolio_entry).should respond_to(:images)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "default scope" do
|
31
|
+
it "order by lft in ASC order" do
|
32
|
+
PortfolioEntry.delete_all
|
33
|
+
entry1 = Factory(:portfolio_entry)
|
34
|
+
entry2 = Factory(:portfolio_entry)
|
35
|
+
portfolio_entries = PortfolioEntry.all
|
36
|
+
portfolio_entries.first.should == entry1
|
37
|
+
portfolio_entries.second.should == entry2
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "alias between content and body" do
|
42
|
+
it "aliases content method to body" do
|
43
|
+
entry = Factory(:portfolio_entry, :content => "refinerycms")
|
44
|
+
entry.content.should == entry.body
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-portfolio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 47
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
9
|
+
- 10
|
10
|
+
version: 0.9.10
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Resolve Digital
|
@@ -14,8 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
-
default_executable:
|
18
|
+
date: 2011-12-16 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: refinerycms
|
@@ -25,11 +25,12 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 41
|
28
29
|
segments:
|
29
30
|
- 0
|
30
31
|
- 9
|
31
|
-
-
|
32
|
-
version: 0.9.
|
32
|
+
- 9
|
33
|
+
version: 0.9.9
|
33
34
|
type: :runtime
|
34
35
|
version_requirements: *id001
|
35
36
|
description: A really straightforward open source Ruby on Rails portfolio plugin designed for integration with RefineryCMS
|
@@ -41,8 +42,8 @@ extensions: []
|
|
41
42
|
extra_rdoc_files: []
|
42
43
|
|
43
44
|
files:
|
44
|
-
- readme.md
|
45
45
|
- license.md
|
46
|
+
- readme.md
|
46
47
|
- app/controllers/admin/portfolio_controller.rb
|
47
48
|
- app/controllers/portfolio_controller.rb
|
48
49
|
- app/helpers/portfolio_helper.rb
|
@@ -50,6 +51,7 @@ files:
|
|
50
51
|
- app/models/portfolio_entry.rb
|
51
52
|
- app/views/admin/portfolio/_form.html.erb
|
52
53
|
- app/views/admin/portfolio/_list.html.erb
|
54
|
+
- app/views/admin/portfolio/_locale_picker.html.erb
|
53
55
|
- app/views/admin/portfolio/_sortable_list.html.erb
|
54
56
|
- app/views/admin/portfolio/edit.html.erb
|
55
57
|
- app/views/admin/portfolio/index.html.erb
|
@@ -58,22 +60,38 @@ files:
|
|
58
60
|
- app/views/portfolio/empty.html.erb
|
59
61
|
- app/views/portfolio/index.html.erb
|
60
62
|
- app/views/portfolio/show.html.erb
|
63
|
+
- config/locales/bg.yml
|
64
|
+
- config/locales/cs.yml
|
61
65
|
- config/locales/en.yml
|
66
|
+
- config/locales/es.yml
|
67
|
+
- config/locales/fr.yml
|
68
|
+
- config/locales/it.yml
|
69
|
+
- config/locales/lt.yml
|
62
70
|
- config/locales/lv.yml
|
71
|
+
- config/locales/nb.yml
|
63
72
|
- config/locales/nl.yml
|
73
|
+
- config/locales/pl.yml
|
64
74
|
- config/locales/pt-BR.yml
|
75
|
+
- config/locales/rs.yml
|
76
|
+
- config/locales/ru.yml
|
65
77
|
- config/locales/sl.yml
|
66
78
|
- config/routes.rb
|
79
|
+
- db/migrate/1_create_structure_for_portfolio.rb
|
80
|
+
- db/migrate/2_translate_portfolio_entries.rb
|
81
|
+
- db/seeds/portfolio.rb
|
82
|
+
- features/manage_portfolio.feature
|
83
|
+
- features/step_definitions/portfolio_steps.rb
|
84
|
+
- features/support/factories.rb
|
85
|
+
- features/support/paths.rb
|
86
|
+
- features/visit_portfolio.feature
|
67
87
|
- lib/gemspec.rb
|
68
|
-
- lib/generators/
|
69
|
-
- lib/generators/refinerycms_portfolio/templates/db/migrate/migration_number_create_structure_for_portfolio.rb
|
70
|
-
- lib/generators/refinerycms_portfolio/templates/db/seeds/portfolio.rb
|
88
|
+
- lib/generators/refinerycms_portfolio_generator.rb
|
71
89
|
- lib/portfolio/version.rb
|
72
90
|
- lib/portfolio.rb
|
73
91
|
- lib/refinerycms-portfolio.rb
|
74
92
|
- public/javascripts/portfolio.js
|
75
93
|
- public/stylesheets/portfolio.css
|
76
|
-
|
94
|
+
- spec/models/portfolio_entry_spec.rb
|
77
95
|
homepage: http://refinerycms.com
|
78
96
|
licenses: []
|
79
97
|
|
@@ -87,6 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
105
|
requirements:
|
88
106
|
- - ">="
|
89
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
90
109
|
segments:
|
91
110
|
- 0
|
92
111
|
version: "0"
|
@@ -95,13 +114,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
114
|
requirements:
|
96
115
|
- - ">="
|
97
116
|
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
98
118
|
segments:
|
99
119
|
- 0
|
100
120
|
version: "0"
|
101
121
|
requirements: []
|
102
122
|
|
103
123
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.
|
124
|
+
rubygems_version: 1.8.10
|
105
125
|
signing_key:
|
106
126
|
specification_version: 3
|
107
127
|
summary: Ruby on Rails portfolio plugin for RefineryCMS.
|
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'rails/generators/migration'
|
2
|
-
|
3
|
-
class RefinerycmsPortfolioGenerator < Rails::Generators::NamedBase
|
4
|
-
|
5
|
-
include Rails::Generators::Migration
|
6
|
-
|
7
|
-
source_root File.expand_path('../templates', __FILE__)
|
8
|
-
argument :name, :type => :string, :default => 'portfolio'
|
9
|
-
|
10
|
-
def generate
|
11
|
-
Dir.glob(File.expand_path('../templates/**/**', __FILE__)).each do |path|
|
12
|
-
template path, plugin_path_for(path) unless File.directory?(path)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
def plugin_path_for(path)
|
19
|
-
path = path.gsub(File.dirname(__FILE__) + "/templates/", "vendor/engines/#{plural_name}/")
|
20
|
-
path = path.gsub("plural_name", plural_name)
|
21
|
-
path = path.gsub("singular_name", singular_name)
|
22
|
-
path = path.gsub(".migration", '')
|
23
|
-
|
24
|
-
# hack can be removed after issue is fixed
|
25
|
-
next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
|
26
|
-
path = path.gsub("migration_number", next_migration_number)
|
27
|
-
|
28
|
-
# replace our local db path with the app one instead.
|
29
|
-
path = path.gsub("/db/", "/../../../db/")
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
# Below is a hack until this issue:
|
35
|
-
# https://rails.lighthouseapp.com/projects/8994/tickets/3820-make-railsgeneratorsmigrationnext_migration_number-method-a-class-method-so-it-possible-to-use-it-in-custom-generators
|
36
|
-
# is fixed on the Rails project.
|
37
|
-
|
38
|
-
require 'rails/generators/named_base'
|
39
|
-
require 'rails/generators/migration'
|
40
|
-
require 'rails/generators/active_model'
|
41
|
-
require 'active_record'
|
42
|
-
|
43
|
-
module ActiveRecord
|
44
|
-
module Generators
|
45
|
-
class Base < Rails::Generators::NamedBase #:nodoc:
|
46
|
-
include Rails::Generators::Migration
|
47
|
-
|
48
|
-
# Implement the required interface for Rails::Generators::Migration.
|
49
|
-
def self.next_migration_number(dirname) #:nodoc:
|
50
|
-
next_migration_number = current_migration_number(dirname) + 1
|
51
|
-
if ActiveRecord::Base.timestamped_migrations
|
52
|
-
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
|
53
|
-
else
|
54
|
-
"%.3d" % next_migration_number
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|