refinerycms-pdf_newsletters 1.0 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/pdf_newsletters_controller.rb +8 -0
- data/app/controllers/{newsletters_controller.rb → pdf_newsletters_controller.rb} +4 -4
- data/app/models/{newsletter.rb → pdf_newsletter.rb} +3 -3
- data/app/views/admin/pdf_newsletters/_actions.html.erb +28 -0
- data/app/views/admin/{newsletters → pdf_newsletters}/_form.html.erb +5 -5
- data/app/views/admin/{newsletters/_newsletter.html.erb → pdf_newsletters/_pdf_newsletter.html.erb} +6 -6
- data/app/views/admin/pdf_newsletters/_pdf_newsletters.html.erb +2 -0
- data/app/views/admin/{newsletters → pdf_newsletters}/_records.html.erb +2 -2
- data/app/views/admin/{newsletters → pdf_newsletters}/_sortable_list.html.erb +1 -1
- data/app/views/admin/{newsletters → pdf_newsletters}/edit.html.erb +0 -0
- data/app/views/admin/{newsletters → pdf_newsletters}/index.html.erb +1 -1
- data/app/views/admin/{newsletters → pdf_newsletters}/new.html.erb +0 -0
- data/app/views/{newsletters → pdf_newsletters}/_list_by_year.html.erb +0 -0
- data/app/views/{newsletters → pdf_newsletters}/_newsletter.html.erb +0 -0
- data/app/views/{newsletters → pdf_newsletters}/index.html.erb +0 -0
- data/config/locales/en.yml +14 -14
- data/config/locales/fr.yml +14 -14
- data/config/locales/lolcat.yml +14 -14
- data/config/locales/nb.yml +14 -14
- data/config/locales/nl.yml +14 -14
- data/config/routes.rb +2 -2
- data/db/migrate/create_pdf_newsletters.rb +32 -0
- data/db/seeds/{newsletters.rb → pdf_newsletters.rb} +5 -5
- data/lib/refinerycms-pdf_newsletters.rb +2 -12
- data/lib/tasks/pdf_newsletters.rake +7 -7
- metadata +18 -18
- data/app/controllers/admin/newsletters_controller.rb +0 -8
- data/app/views/admin/newsletters/_actions.html.erb +0 -28
- data/app/views/admin/newsletters/_newsletters.html.erb +0 -2
- data/db/migrate/create_newsletters.rb +0 -32
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class PdfNewslettersController < ApplicationController
|
2
2
|
|
3
3
|
before_filter :find_all_newsletters
|
4
4
|
before_filter :find_page
|
@@ -10,7 +10,7 @@ class NewslettersController < ApplicationController
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def show
|
13
|
-
@newsletter =
|
13
|
+
@newsletter = PdfNewsletter.find(params[:id])
|
14
14
|
|
15
15
|
# you can use meta fields from your model instead (e.g. browser_title)
|
16
16
|
# by swapping @page for @newsletter in the line below:
|
@@ -20,11 +20,11 @@ class NewslettersController < ApplicationController
|
|
20
20
|
protected
|
21
21
|
|
22
22
|
def find_all_newsletters
|
23
|
-
@newsletters =
|
23
|
+
@newsletters = PdfNewsletter.recent
|
24
24
|
end
|
25
25
|
|
26
26
|
def find_page
|
27
|
-
@page = Page.where(:link_url => "/
|
27
|
+
@page = Page.where(:link_url => "/pdf_newsletters").first
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class PdfNewsletter < ActiveRecord::Base
|
2
2
|
|
3
3
|
acts_as_indexed :fields => [:volume, :issue]
|
4
4
|
|
@@ -16,10 +16,10 @@ class Newsletter < ActiveRecord::Base
|
|
16
16
|
self.publish_on.year
|
17
17
|
end
|
18
18
|
scope :published, lambda {
|
19
|
-
where("
|
19
|
+
where("pdf_newsletters.publish_on IS NOT NULL AND pdf_newsletters.publish_on <= ?", Time.zone.now)
|
20
20
|
}
|
21
21
|
|
22
|
-
scope :recent, published.order("
|
22
|
+
scope :recent, published.order("pdf_newsletters.publish_on DESC")
|
23
23
|
|
24
24
|
def self.current
|
25
25
|
self.recent.first
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<ul>
|
2
|
+
<% if Admin::PdfNewslettersController.searchable? %>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_pdf_newsletters_path
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
<li>
|
11
|
+
<%= link_to t('.create_new'), new_admin_pdf_newsletter_path,
|
12
|
+
:class => "add_icon" %>
|
13
|
+
</li>
|
14
|
+
<% if !searching? and Admin::PdfNewslettersController.sortable? and PdfNewsletter.count > 1 %>
|
15
|
+
<li>
|
16
|
+
<%= link_to t('.reorder', :what => "Pdf Newsletters"),
|
17
|
+
admin_pdf_newsletters_path,
|
18
|
+
:id => "reorder_action",
|
19
|
+
:class => "reorder_icon" %>
|
20
|
+
|
21
|
+
<%= link_to t('.reorder_done', :what => "Pdf Newsletters"),
|
22
|
+
admin_pdf_newsletters_path,
|
23
|
+
:id => "reorder_action_done",
|
24
|
+
:style => "display: none;",
|
25
|
+
:class => "reorder_icon" %>
|
26
|
+
</li>
|
27
|
+
<% end %>
|
28
|
+
</ul>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<%= form_for [:admin, @
|
1
|
+
<%= form_for [:admin, @pdf_newsletter] do |f| -%>
|
2
2
|
<%= render :partial => "/shared/admin/error_messages", :locals => {
|
3
|
-
:object => @
|
3
|
+
:object => @pdf_newsletter,
|
4
4
|
:include_object_name => true
|
5
5
|
} %>
|
6
6
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<%= render :partial => "/shared/admin/resource_picker", :locals => {
|
15
15
|
:f => f,
|
16
16
|
:field => :pdf_id,
|
17
|
-
:resource => @
|
17
|
+
:resource => @pdf_newsletter.pdf,
|
18
18
|
} %>
|
19
19
|
</div>
|
20
20
|
|
@@ -37,7 +37,7 @@
|
|
37
37
|
:locals => {
|
38
38
|
:f => f,
|
39
39
|
:continue_editing => false,
|
40
|
-
:delete_title => t('delete', :scope => 'admin.
|
41
|
-
:delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @
|
40
|
+
:delete_title => t('delete', :scope => 'admin.pdf_newsletters.pdf_newsletter'),
|
41
|
+
:delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @pdf_newsletter.volume)
|
42
42
|
} %>
|
43
43
|
<% end -%>
|
data/app/views/admin/{newsletters/_newsletter.html.erb → pdf_newsletters/_pdf_newsletter.html.erb}
RENAMED
@@ -1,18 +1,18 @@
|
|
1
|
-
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(pdf_newsletter) -%>">
|
2
2
|
<span class='title'>
|
3
|
-
<%= "Volume #{
|
3
|
+
<%= "Volume #{pdf_newsletter.volume}, Issue #{pdf_newsletter.issue} - #{pdf_newsletter.month} #{pdf_newsletter.year}" %>
|
4
4
|
<span class="preview"> </span>
|
5
5
|
</span>
|
6
6
|
<span class='actions'>
|
7
|
-
<%= link_to refinery_icon_tag("application_go.png"),
|
7
|
+
<%= link_to refinery_icon_tag("application_go.png"), pdf_newsletter_path(pdf_newsletter),
|
8
8
|
:title => t('.view_live_html'),
|
9
9
|
:target => "_blank" %>
|
10
|
-
<%= link_to refinery_icon_tag("application_edit.png"),
|
10
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_pdf_newsletter_path(pdf_newsletter),
|
11
11
|
:title => t('.edit') %>
|
12
|
-
<%= link_to refinery_icon_tag("delete.png"),
|
12
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_pdf_newsletter_path(pdf_newsletter),
|
13
13
|
:class => "cancel confirm-delete",
|
14
14
|
:title => t('.delete'),
|
15
|
-
:confirm => t('message', :scope => 'shared.admin.delete', :title =>
|
15
|
+
:confirm => t('message', :scope => 'shared.admin.delete', :title => "Volume #{pdf_newsletter.volume} Issue #{pdf_newsletter.issue}"),
|
16
16
|
:method => :delete %>
|
17
17
|
</span>
|
18
18
|
</li>
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<% if searching? %>
|
2
2
|
<h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
|
3
3
|
<% end %>
|
4
|
-
<% if @
|
4
|
+
<% if @pdf_newsletters.any? %>
|
5
5
|
<div class='pagination_container'>
|
6
|
-
<%= render :partial => '
|
6
|
+
<%= render :partial => 'pdf_newsletters' %>
|
7
7
|
</div>
|
8
8
|
<% else %>
|
9
9
|
<p>
|
File without changes
|
@@ -7,4 +7,4 @@
|
|
7
7
|
<%= render :partial => '/shared/admin/make_sortable',
|
8
8
|
:locals => {
|
9
9
|
:tree => false
|
10
|
-
} if !searching? and Admin::
|
10
|
+
} if !searching? and Admin::PdfNewslettersController.sortable? and PdfNewsletter.count > 1 %>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/config/locales/en.yml
CHANGED
@@ -4,22 +4,22 @@ en:
|
|
4
4
|
image_picker:
|
5
5
|
image: image
|
6
6
|
plugins:
|
7
|
-
|
8
|
-
title: Newsletters
|
7
|
+
pdf_newsletters:
|
8
|
+
title: Pdf Newsletters
|
9
9
|
admin:
|
10
|
-
|
10
|
+
pdf_newsletters:
|
11
11
|
actions:
|
12
|
-
create_new: Add New Newsletter
|
13
|
-
reorder: Reorder Newsletters
|
14
|
-
reorder_done: Done Reordering Newsletters
|
12
|
+
create_new: Add New Pdf Newsletter
|
13
|
+
reorder: Reorder Pdf Newsletters
|
14
|
+
reorder_done: Done Reordering Pdf Newsletters
|
15
15
|
records:
|
16
|
-
title: Newsletters
|
16
|
+
title: Pdf Newsletters
|
17
17
|
sorry_no_results: Sorry! There are no results found.
|
18
|
-
no_items_yet: There are no Newsletters yet. Click "Add New Newsletter" to add your first newsletter.
|
19
|
-
|
20
|
-
view_live_html: View this newsletter live <br/><em>(opens in a new window)</em>
|
21
|
-
edit: Edit this newsletter
|
22
|
-
delete: Remove this newsletter forever
|
23
|
-
|
18
|
+
no_items_yet: There are no Pdf Newsletters yet. Click "Add New Pdf Newsletter" to add your first pdf newsletter.
|
19
|
+
pdf_newsletter:
|
20
|
+
view_live_html: View this pdf newsletter live <br/><em>(opens in a new window)</em>
|
21
|
+
edit: Edit this pdf newsletter
|
22
|
+
delete: Remove this pdf newsletter forever
|
23
|
+
pdf_newsletters:
|
24
24
|
show:
|
25
|
-
other: Other Newsletters
|
25
|
+
other: Other Pdf Newsletters
|
data/config/locales/fr.yml
CHANGED
@@ -4,22 +4,22 @@ fr:
|
|
4
4
|
image_picker:
|
5
5
|
image: image
|
6
6
|
plugins:
|
7
|
-
|
8
|
-
title: Newsletters
|
7
|
+
pdf_newsletters:
|
8
|
+
title: Pdf Newsletters
|
9
9
|
admin:
|
10
|
-
|
10
|
+
pdf_newsletters:
|
11
11
|
actions:
|
12
|
-
create_new: Créer un(e) nouve(au/l/lle) Newsletter
|
13
|
-
reorder: Réordonner les Newsletters
|
14
|
-
reorder_done: Fin de réordonnancement des Newsletters
|
12
|
+
create_new: Créer un(e) nouve(au/l/lle) Pdf Newsletter
|
13
|
+
reorder: Réordonner les Pdf Newsletters
|
14
|
+
reorder_done: Fin de réordonnancement des Pdf Newsletters
|
15
15
|
records:
|
16
|
-
title: Newsletters
|
16
|
+
title: Pdf Newsletters
|
17
17
|
sorry_no_results: "Désolé ! Aucun résultat."
|
18
|
-
no_items_yet: 'Il n''y a actuellement aucun(e) Newsletter. Cliquer sur "Créer un(e) nouve(au/l/lle) Newsletter" pour créer votre premi(er/ère) newsletter.'
|
19
|
-
|
20
|
-
view_live_html: Voir ce(t/tte) newsletter <br/><em>(Ouvre une nouvelle fenêtre)</em>
|
21
|
-
edit: Modifier ce(t/tte) newsletter
|
22
|
-
delete: Supprimer définitivement ce(t/tte) newsletter
|
23
|
-
|
18
|
+
no_items_yet: 'Il n''y a actuellement aucun(e) Pdf Newsletter. Cliquer sur "Créer un(e) nouve(au/l/lle) Pdf Newsletter" pour créer votre premi(er/ère) pdf newsletter.'
|
19
|
+
pdf_newsletter:
|
20
|
+
view_live_html: Voir ce(t/tte) pdf newsletter <br/><em>(Ouvre une nouvelle fenêtre)</em>
|
21
|
+
edit: Modifier ce(t/tte) pdf newsletter
|
22
|
+
delete: Supprimer définitivement ce(t/tte) pdf newsletter
|
23
|
+
pdf_newsletters:
|
24
24
|
show:
|
25
|
-
other: Autres Newsletters
|
25
|
+
other: Autres Pdf Newsletters
|
data/config/locales/lolcat.yml
CHANGED
@@ -4,22 +4,22 @@ lolcat:
|
|
4
4
|
image_picker:
|
5
5
|
image: IMAGE
|
6
6
|
plugins:
|
7
|
-
|
8
|
-
title: Newsletters
|
7
|
+
pdf_newsletters:
|
8
|
+
title: Pdf Newsletters
|
9
9
|
admin:
|
10
|
-
|
10
|
+
pdf_newsletters:
|
11
11
|
actions:
|
12
|
-
create_new: CREATE NEW Newsletter
|
13
|
-
reorder: REORDR Newsletters
|
14
|
-
reorder_done: DUN REORDERIN Newsletters
|
12
|
+
create_new: CREATE NEW Pdf Newsletter
|
13
|
+
reorder: REORDR Pdf Newsletters
|
14
|
+
reorder_done: DUN REORDERIN Pdf Newsletters
|
15
15
|
records:
|
16
|
-
title: Newsletters
|
16
|
+
title: Pdf Newsletters
|
17
17
|
sorry_no_results: SRY! THAR R NO RESULTS FINDZ.
|
18
|
-
no_items_yet: THAR R NO Newsletters YET. CLICK "CREATE NEW Newsletter" 2 ADD UR FURST newsletter.
|
19
|
-
|
20
|
-
view_live_html: VIEW DIS newsletter LIV <BR/><EM>(OPENS IN NEW WINDOW)</EM>
|
21
|
-
edit: EDIT DIS newsletter
|
22
|
-
delete: REMOOV DIS newsletter FOREVR
|
23
|
-
|
18
|
+
no_items_yet: THAR R NO Pdf Newsletters YET. CLICK "CREATE NEW Pdf Newsletter" 2 ADD UR FURST pdf newsletter.
|
19
|
+
pdf_newsletter:
|
20
|
+
view_live_html: VIEW DIS pdf newsletter LIV <BR/><EM>(OPENS IN NEW WINDOW)</EM>
|
21
|
+
edit: EDIT DIS pdf newsletter
|
22
|
+
delete: REMOOV DIS pdf newsletter FOREVR
|
23
|
+
pdf_newsletters:
|
24
24
|
show:
|
25
|
-
other: OTHR Newsletters
|
25
|
+
other: OTHR Pdf Newsletters
|
data/config/locales/nb.yml
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
nb:
|
2
2
|
plugins:
|
3
|
-
|
4
|
-
title: Newsletters
|
3
|
+
pdf_newsletters:
|
4
|
+
title: Pdf Newsletters
|
5
5
|
admin:
|
6
|
-
|
6
|
+
pdf_newsletters:
|
7
7
|
actions:
|
8
|
-
create_new: Lag en ny Newsletter
|
9
|
-
reorder: Endre rekkefølgen på Newsletters
|
10
|
-
reorder_done: Ferdig å endre rekkefølgen Newsletters
|
8
|
+
create_new: Lag en ny Pdf Newsletter
|
9
|
+
reorder: Endre rekkefølgen på Pdf Newsletters
|
10
|
+
reorder_done: Ferdig å endre rekkefølgen Pdf Newsletters
|
11
11
|
records:
|
12
|
-
title: Newsletters
|
12
|
+
title: Pdf Newsletters
|
13
13
|
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
14
|
-
no_items_yet: Det er ingen Newsletters enda. Klikk på "Lag en ny Newsletter" for å legge til din første newsletter.
|
15
|
-
|
16
|
-
view_live_html: Vis hvordan denne newsletter ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
17
|
-
edit: Rediger denne newsletter
|
18
|
-
delete: Fjern denne newsletter permanent
|
19
|
-
|
14
|
+
no_items_yet: Det er ingen Pdf Newsletters enda. Klikk på "Lag en ny Pdf Newsletter" for å legge til din første pdf newsletter.
|
15
|
+
pdf_newsletter:
|
16
|
+
view_live_html: Vis hvordan denne pdf newsletter ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
17
|
+
edit: Rediger denne pdf newsletter
|
18
|
+
delete: Fjern denne pdf newsletter permanent
|
19
|
+
pdf_newsletters:
|
20
20
|
show:
|
21
|
-
other: Andre Newsletters
|
21
|
+
other: Andre Pdf Newsletters
|
data/config/locales/nl.yml
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
nl:
|
2
2
|
plugins:
|
3
|
-
|
4
|
-
title: Newsletters
|
3
|
+
pdf_newsletters:
|
4
|
+
title: Pdf Newsletters
|
5
5
|
admin:
|
6
|
-
|
6
|
+
pdf_newsletters:
|
7
7
|
actions:
|
8
|
-
create_new: Maak een nieuwe Newsletter
|
9
|
-
reorder: Wijzig de volgorde van de Newsletters
|
10
|
-
reorder_done: Klaar met het wijzingen van de volgorde van de Newsletters
|
8
|
+
create_new: Maak een nieuwe Pdf Newsletter
|
9
|
+
reorder: Wijzig de volgorde van de Pdf Newsletters
|
10
|
+
reorder_done: Klaar met het wijzingen van de volgorde van de Pdf Newsletters
|
11
11
|
records:
|
12
|
-
title: Newsletters
|
12
|
+
title: Pdf Newsletters
|
13
13
|
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
14
|
-
no_items_yet: Er zijn nog geen Newsletters. Druk op 'Maak een nieuwe Newsletter' om de eerste aan te maken.
|
15
|
-
|
16
|
-
view_live_html: Bekijk deze newsletter op de website <br/><em>(opent een nieuw venster)</em>
|
17
|
-
edit: Bewerk deze newsletter
|
18
|
-
delete: Verwijder deze newsletter voor eeuwig
|
19
|
-
|
14
|
+
no_items_yet: Er zijn nog geen Pdf Newsletters. Druk op 'Maak een nieuwe Pdf Newsletter' om de eerste aan te maken.
|
15
|
+
pdf_newsletter:
|
16
|
+
view_live_html: Bekijk deze pdf newsletter op de website <br/><em>(opent een nieuw venster)</em>
|
17
|
+
edit: Bewerk deze pdf newsletter
|
18
|
+
delete: Verwijder deze pdf newsletter voor eeuwig
|
19
|
+
pdf_newsletters:
|
20
20
|
show:
|
21
|
-
other: Andere Newsletters
|
21
|
+
other: Andere Pdf Newsletters
|
data/config/routes.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
::Refinery::Application.routes.draw do
|
2
|
-
resources :
|
2
|
+
resources :pdf_newsletters, :only => [:index, :show]
|
3
3
|
|
4
4
|
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
5
|
-
resources :
|
5
|
+
resources :pdf_newsletters, :except => :show do
|
6
6
|
collection do
|
7
7
|
post :update_positions
|
8
8
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class CreatePdfNewsletters < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :pdf_newsletters do |t|
|
5
|
+
t.datetime :publish_on
|
6
|
+
t.integer :pdf_id
|
7
|
+
t.string :volume
|
8
|
+
t.string :issue
|
9
|
+
t.integer :position
|
10
|
+
t.string :editor
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :pdf_newsletters, :id
|
16
|
+
|
17
|
+
load(Rails.root.join('db', 'seeds', 'pdf_newsletters.rb'))
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
if defined?(UserPlugin)
|
22
|
+
UserPlugin.destroy_all({:name => "pdf_newsletters"})
|
23
|
+
end
|
24
|
+
|
25
|
+
if defined?(Page)
|
26
|
+
Page.delete_all({:link_url => "/pdf_newsletters"})
|
27
|
+
end
|
28
|
+
|
29
|
+
drop_table :pdf_newsletters
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
if defined?(User)
|
2
2
|
User.all.each do |user|
|
3
|
-
if user.plugins.where(:name => '
|
4
|
-
user.plugins.create(:name => '
|
3
|
+
if user.plugins.where(:name => 'pdf_newsletters').blank?
|
4
|
+
user.plugins.create(:name => 'pdf_newsletters',
|
5
5
|
:position => (user.plugins.maximum(:position) || -1) +1)
|
6
6
|
end
|
7
7
|
end
|
@@ -10,12 +10,12 @@ end
|
|
10
10
|
if defined?(Page)
|
11
11
|
page = Page.create(
|
12
12
|
:title => 'Newsletters',
|
13
|
-
:link_url => '/
|
13
|
+
:link_url => '/pdf_newsletters',
|
14
14
|
:deletable => false,
|
15
15
|
:position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
|
16
|
-
:menu_match => '^/
|
16
|
+
:menu_match => '^/pdf_newsletters(\/|\/.+?|)$'
|
17
17
|
)
|
18
18
|
Page.default_parts.each do |default_page_part|
|
19
19
|
page.parts.create(:title => default_page_part, :body => nil)
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
@@ -1,15 +1,7 @@
|
|
1
1
|
require 'refinerycms-base'
|
2
2
|
|
3
3
|
module Refinery
|
4
|
-
module
|
5
|
-
|
6
|
-
class << self
|
7
|
-
attr_accessor :root
|
8
|
-
def root
|
9
|
-
@root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
4
|
+
module PdfNewsletters
|
13
5
|
class Engine < Rails::Engine
|
14
6
|
initializer "static assets" do |app|
|
15
7
|
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
@@ -18,10 +10,8 @@ module Refinery
|
|
18
10
|
config.after_initialize do
|
19
11
|
Refinery::Plugin.register do |plugin|
|
20
12
|
plugin.name = "pdf_newsletters"
|
21
|
-
plugin.pathname = root
|
22
13
|
plugin.activity = {
|
23
|
-
:class =>
|
24
|
-
:title => 'volume'
|
14
|
+
:class => PdfNewsletter
|
25
15
|
}
|
26
16
|
end
|
27
17
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
namespace :refinery do
|
2
|
-
|
3
|
-
namespace :
|
4
|
-
|
5
|
-
# call this task my running: rake refinery:
|
2
|
+
|
3
|
+
namespace :pdf_newsletters do
|
4
|
+
|
5
|
+
# call this task my running: rake refinery:pdf_newsletters:my_task
|
6
6
|
# desc "Description of my task below"
|
7
7
|
# task :my_task => :environment do
|
8
8
|
# # add your logic here
|
9
9
|
# end
|
10
|
-
|
10
|
+
|
11
11
|
end
|
12
|
-
|
13
|
-
end
|
12
|
+
|
13
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refinerycms-pdf_newsletters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: "1.
|
5
|
+
version: "1.2"
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Doug Bradbury <doug@8thlight.com>
|
@@ -31,23 +31,23 @@ files:
|
|
31
31
|
- config/locales/nb.yml
|
32
32
|
- config/locales/nl.yml
|
33
33
|
- config/routes.rb
|
34
|
-
- app/controllers/admin/
|
35
|
-
- app/controllers/
|
36
|
-
- app/models/
|
37
|
-
- app/views/admin/
|
38
|
-
- app/views/admin/
|
39
|
-
- app/views/admin/
|
40
|
-
- app/views/admin/
|
41
|
-
- app/views/admin/
|
42
|
-
- app/views/admin/
|
43
|
-
- app/views/admin/
|
44
|
-
- app/views/admin/
|
45
|
-
- app/views/admin/
|
46
|
-
- app/views/
|
47
|
-
- app/views/
|
48
|
-
- app/views/
|
49
|
-
- db/migrate/
|
50
|
-
- db/seeds/
|
34
|
+
- app/controllers/admin/pdf_newsletters_controller.rb
|
35
|
+
- app/controllers/pdf_newsletters_controller.rb
|
36
|
+
- app/models/pdf_newsletter.rb
|
37
|
+
- app/views/admin/pdf_newsletters/_actions.html.erb
|
38
|
+
- app/views/admin/pdf_newsletters/_form.html.erb
|
39
|
+
- app/views/admin/pdf_newsletters/_pdf_newsletter.html.erb
|
40
|
+
- app/views/admin/pdf_newsletters/_pdf_newsletters.html.erb
|
41
|
+
- app/views/admin/pdf_newsletters/_records.html.erb
|
42
|
+
- app/views/admin/pdf_newsletters/_sortable_list.html.erb
|
43
|
+
- app/views/admin/pdf_newsletters/edit.html.erb
|
44
|
+
- app/views/admin/pdf_newsletters/index.html.erb
|
45
|
+
- app/views/admin/pdf_newsletters/new.html.erb
|
46
|
+
- app/views/pdf_newsletters/_list_by_year.html.erb
|
47
|
+
- app/views/pdf_newsletters/_newsletter.html.erb
|
48
|
+
- app/views/pdf_newsletters/index.html.erb
|
49
|
+
- db/migrate/create_pdf_newsletters.rb
|
50
|
+
- db/seeds/pdf_newsletters.rb
|
51
51
|
homepage: https://github.com/dougbradbury/refinerycms-pdf_newsletters
|
52
52
|
licenses: []
|
53
53
|
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<ul>
|
2
|
-
<% if Admin::NewslettersController.searchable? %>
|
3
|
-
<li>
|
4
|
-
<%= render :partial => "/shared/admin/search",
|
5
|
-
:locals => {
|
6
|
-
:url => admin_newsletters_path
|
7
|
-
} %>
|
8
|
-
</li>
|
9
|
-
<% end %>
|
10
|
-
<li>
|
11
|
-
<%= link_to t('.create_new'), new_admin_newsletter_path,
|
12
|
-
:class => "add_icon" %>
|
13
|
-
</li>
|
14
|
-
<% if !searching? and Admin::NewslettersController.sortable? and Newsletter.count > 1 %>
|
15
|
-
<li>
|
16
|
-
<%= link_to t('.reorder', :what => "Newsletters"),
|
17
|
-
admin_newsletters_path,
|
18
|
-
:id => "reorder_action",
|
19
|
-
:class => "reorder_icon" %>
|
20
|
-
|
21
|
-
<%= link_to t('.reorder_done', :what => "Newsletters"),
|
22
|
-
admin_newsletters_path,
|
23
|
-
:id => "reorder_action_done",
|
24
|
-
:style => "display: none;",
|
25
|
-
:class => "reorder_icon" %>
|
26
|
-
</li>
|
27
|
-
<% end %>
|
28
|
-
</ul>
|
@@ -1,32 +0,0 @@
|
|
1
|
-
class CreateNewsletters < ActiveRecord::Migration
|
2
|
-
|
3
|
-
def self.up
|
4
|
-
create_table :newsletters do |t|
|
5
|
-
t.datetime :publish_on
|
6
|
-
t.integer :pdf_id
|
7
|
-
t.string :volume
|
8
|
-
t.string :issue
|
9
|
-
t.integer :position
|
10
|
-
t.string :editor
|
11
|
-
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
|
15
|
-
add_index :newsletters, :id
|
16
|
-
|
17
|
-
load(Rails.root.join('db', 'seeds', 'newsletters.rb'))
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.down
|
21
|
-
if defined?(UserPlugin)
|
22
|
-
UserPlugin.destroy_all({:name => "newsletters"})
|
23
|
-
end
|
24
|
-
|
25
|
-
if defined?(Page)
|
26
|
-
Page.delete_all({:link_url => "/newsletters"})
|
27
|
-
end
|
28
|
-
|
29
|
-
drop_table :newsletters
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|