refinerycms-simple_members 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ class CreateMembers < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :members do |t|
5
+ t.string :first_name
6
+ t.string :last_name
7
+ t.string :email
8
+ t.string :unique_identifier
9
+ t.integer :position
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :members, :id
14
+
15
+ load(Rails.root.join('db', 'seeds', 'members.rb'))
16
+ end
17
+
18
+ def self.down
19
+ if defined?(UserPlugin)
20
+ UserPlugin.destroy_all({:name => "members"})
21
+ end
22
+
23
+ if defined?(Page)
24
+ Page.delete_all({:link_url => "/members"})
25
+ end
26
+
27
+ drop_table :members
28
+ end
29
+
30
+ end
@@ -0,0 +1,22 @@
1
+ if defined?(User)
2
+ User.all.each do |user|
3
+ if user.plugins.where(:name => 'members').blank?
4
+ user.plugins.create(:name => 'members',
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 => 'Members',
13
+ :link_url => '/members',
14
+ :deletable => false,
15
+ :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
16
+ :menu_match => '^/members(\/|\/.+?|)$',
17
+ :show_in_menu => false,
18
+ )
19
+ Page.default_parts.each do |default_page_part|
20
+ page.parts.create(:title => default_page_part, :body => nil)
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-simple_members
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -42,6 +42,8 @@ files:
42
42
  - app/views/admin/members/new.html.erb
43
43
  - app/views/members/index.html.erb
44
44
  - app/views/members/show.html.erb
45
+ - db/migrate/create_members.rb
46
+ - db/seeds/members.rb
45
47
  homepage:
46
48
  licenses: []
47
49
  post_install_message: