refinerycms-pdf_newsletters 0.8 → 0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
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
@@ -0,0 +1,21 @@
1
+ if defined?(User)
2
+ User.all.each do |user|
3
+ if user.plugins.where(:name => 'newsletters').blank?
4
+ user.plugins.create(:name => 'newsletters',
5
+ :position => (user.plugins.maximum(:position) || -1) +1)
6
+ end
7
+ end
8
+ end
9
+
10
+ if defined?(Page)
11
+ page = Page.create(
12
+ :title => 'Newsletters',
13
+ :link_url => '/newsletters',
14
+ :deletable => false,
15
+ :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
16
+ :menu_match => '^/newsletters(\/|\/.+?|)$'
17
+ )
18
+ Page.default_parts.each do |default_page_part|
19
+ page.parts.create(:title => default_page_part, :body => nil)
20
+ end
21
+ 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: "0.8"
5
+ version: "0.10"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Doug Bradbury <doug@8thlight.com>
@@ -46,6 +46,8 @@ files:
46
46
  - app/views/newsletters/_list_by_year.html.erb
47
47
  - app/views/newsletters/_newsletter.html.erb
48
48
  - app/views/newsletters/index.html.erb
49
+ - db/migrate/create_newsletters.rb
50
+ - db/seeds/newsletters.rb
49
51
  homepage: https://github.com/dougbradbury/refinerycms-newsletters
50
52
  licenses: []
51
53