uzuuzu-cms 0.0.0

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.
Files changed (95) hide show
  1. data/.document +5 -0
  2. data/.project +17 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +15 -0
  5. data/Gemfile.lock +99 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.rdoc +19 -0
  8. data/Rakefile +49 -0
  9. data/VERSION +1 -0
  10. data/lib/uzuuzu-cms/controller/admin.rb +16 -0
  11. data/lib/uzuuzu-cms/controller/contents.rb +16 -0
  12. data/lib/uzuuzu-cms/controller/crud.rb +245 -0
  13. data/lib/uzuuzu-cms/controller/index.rb +108 -0
  14. data/lib/uzuuzu-cms/controller/initialize.rb +53 -0
  15. data/lib/uzuuzu-cms/controller/oauth.rb +10 -0
  16. data/lib/uzuuzu-cms/controller/openid.rb +105 -0
  17. data/lib/uzuuzu-cms/controller/page.rb +20 -0
  18. data/lib/uzuuzu-cms/controller/plugin.rb +16 -0
  19. data/lib/uzuuzu-cms/controller/user.rb +27 -0
  20. data/lib/uzuuzu-cms/controller/view/admin/index.rhtml +0 -0
  21. data/lib/uzuuzu-cms/controller/view/crud/destroy.rhtml +28 -0
  22. data/lib/uzuuzu-cms/controller/view/crud/edit.rhtml +52 -0
  23. data/lib/uzuuzu-cms/controller/view/crud/index.rhtml +45 -0
  24. data/lib/uzuuzu-cms/controller/view/crud/new.rhtml +48 -0
  25. data/lib/uzuuzu-cms/controller/view/crud/show.rhtml +47 -0
  26. data/lib/uzuuzu-cms/controller/view/error/404.rhtml +2 -0
  27. data/lib/uzuuzu-cms/controller/view/error/500.rhtml +2 -0
  28. data/lib/uzuuzu-cms/controller/view/initialize/step1.rhtml +15 -0
  29. data/lib/uzuuzu-cms/controller/view/initialize/step2.rhtml +1 -0
  30. data/lib/uzuuzu-cms/controller/view/initialize/step3.rhtml +0 -0
  31. data/lib/uzuuzu-cms/controller/view/layout.rhtml +25 -0
  32. data/lib/uzuuzu-cms/controller/view/openid/index.rhtml +14 -0
  33. data/lib/uzuuzu-cms/controller/view/user/entry.rhtml +13 -0
  34. data/lib/uzuuzu-cms/controller.rb +16 -0
  35. data/lib/uzuuzu-cms/fixture/layout.yaml +110 -0
  36. data/lib/uzuuzu-cms/model/blog.rb +40 -0
  37. data/lib/uzuuzu-cms/model/blog_category.rb +15 -0
  38. data/lib/uzuuzu-cms/model/blog_comment.rb +29 -0
  39. data/lib/uzuuzu-cms/model/blog_entry.rb +24 -0
  40. data/lib/uzuuzu-cms/model/contents.rb +43 -0
  41. data/lib/uzuuzu-cms/model/css.rb +22 -0
  42. data/lib/uzuuzu-cms/model/file.rb +41 -0
  43. data/lib/uzuuzu-cms/model/image.rb +41 -0
  44. data/lib/uzuuzu-cms/model/info.rb +127 -0
  45. data/lib/uzuuzu-cms/model/javascript.rb +22 -0
  46. data/lib/uzuuzu-cms/model/layout.rb +22 -0
  47. data/lib/uzuuzu-cms/model/movie.rb +39 -0
  48. data/lib/uzuuzu-cms/model/page.rb +167 -0
  49. data/lib/uzuuzu-cms/model/page_body.rb +28 -0
  50. data/lib/uzuuzu-cms/model/user.rb +30 -0
  51. data/lib/uzuuzu-cms/model/wiki.rb +43 -0
  52. data/lib/uzuuzu-cms/model/wiki_attache.rb +26 -0
  53. data/lib/uzuuzu-cms/model/wiki_entry.rb +21 -0
  54. data/lib/uzuuzu-cms/model/wiki_layout.rb +13 -0
  55. data/lib/uzuuzu-cms/model.rb +24 -0
  56. data/lib/uzuuzu-cms.rb +5 -0
  57. data/spec/spec_helper.rb +12 -0
  58. data/spec/uzuuzu-cms_spec.rb +7 -0
  59. data/template/app.rb +3 -0
  60. data/template/config.ru +15 -0
  61. data/template/public/css/images/ajax-loader.png +0 -0
  62. data/template/public/css/images/icon-search-black.png +0 -0
  63. data/template/public/css/images/icons-18-black.png +0 -0
  64. data/template/public/css/images/icons-18-white.png +0 -0
  65. data/template/public/css/images/icons-36-black.png +0 -0
  66. data/template/public/css/images/icons-36-white.png +0 -0
  67. data/template/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  68. data/template/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  69. data/template/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
  70. data/template/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  71. data/template/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  72. data/template/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  73. data/template/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  74. data/template/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  75. data/template/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  76. data/template/public/css/images/ui-icons_222222_256x240.png +0 -0
  77. data/template/public/css/images/ui-icons_228ef1_256x240.png +0 -0
  78. data/template/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
  79. data/template/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
  80. data/template/public/css/images/ui-icons_ffffff_256x240.png +0 -0
  81. data/template/public/css/index.css +146 -0
  82. data/template/public/css/jquery-ui.css +578 -0
  83. data/template/public/css/jquery.mobile.css +16 -0
  84. data/template/public/css/screen.css +30 -0
  85. data/template/public/dispatch.fcgi +27 -0
  86. data/template/public/js/jquery-ui.js +784 -0
  87. data/template/public/js/jquery.js +16 -0
  88. data/template/public/js/jquery.mobile.js +134 -0
  89. data/template/public/js/uzuuzu-ui.js +0 -0
  90. data/template/public/js/uzuuzu.js +0 -0
  91. data/template/public/js/uzuuzu.mobile.js +0 -0
  92. data/template/start.rb +29 -0
  93. data/template/uzuuzu.yaml +43 -0
  94. data/uzuuzu-cms.gemspec +145 -0
  95. metadata +207 -0
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ #
5
+ #
6
+ #
7
+ class BlogComment
8
+ include DataMapper::Resource
9
+ include DataMapper::Timestamps
10
+
11
+ property :id, Serial
12
+ property :name, String,
13
+ :required => false,
14
+ :length => 255
15
+ property :url, String,
16
+ :length => 255
17
+ property :title, String,
18
+ :required => true,
19
+ :length => 255
20
+ property :body, Text,
21
+ :required => true
22
+ property :status, Enum[:new, :allowed, :deleted]
23
+ timestamps :at
24
+
25
+ belongs_to :user, :required => false
26
+ belongs_to :blog_entry
27
+
28
+ end #BlogComment
29
+ end #UzuUzu
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ class BlogEntry
5
+ include DataMapper::Resource
6
+ include DataMapper::Timestamps
7
+
8
+ property :id, Serial
9
+ property :format, String,
10
+ :length => 32
11
+ property :title, String,
12
+ :required => true,
13
+ :length => 255
14
+ property :body, Text,
15
+ :required => true
16
+ timestamps :at
17
+
18
+ has n, :blog_categories, :through => Resource
19
+ has n, :blog_comments
20
+
21
+ belongs_to :blog
22
+
23
+ end #BlogEntry
24
+ end #UzuUzu
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+ require 'uzuuzu/adapter/datamapper/model/css'
3
+ require 'uzuuzu/adapter/datamapper/model/javascript'
4
+
5
+ module UzuUzu
6
+ class Css
7
+ has n, :contents, 'UzuUzu::Contents', :through => Resource
8
+ end
9
+
10
+ class Javascript
11
+ has n, :contents, 'UzuUzu::Contents', :through => Resource
12
+ end
13
+
14
+ class Contents
15
+ include DataMapper::Resource
16
+ include DataMapper::Timestamps
17
+
18
+ property :id, Serial
19
+ property :format, Enum[:none, :erb, :markdown],
20
+ :required => true
21
+ property :name, String,
22
+ :required => true,
23
+ :length => 255
24
+ property :body, Text,
25
+ :required => true
26
+ timestamps :at
27
+
28
+ has n, :csses, :through => Resource
29
+ has n, :javascripts, :through => Resource
30
+
31
+ def render
32
+ UzuUzu.render_engine(nil, self.body, self.format, options, locals)
33
+ end
34
+ end # Contents
35
+
36
+ if auto_upgrade?
37
+ repository do
38
+ Contents.auto_upgrade!
39
+ ContentsJavascript.auto_upgrade!
40
+ ContentsCss.auto_upgrade!
41
+ end
42
+ end
43
+ end # UzuUzu
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ class Css
5
+ include DataMapper::Resource
6
+ include DataMapper::Timestamps
7
+
8
+ property :id, Serial
9
+ property :url, Text
10
+ property :format, String,
11
+ :length => 10
12
+ property :body, Text
13
+ timestamps :updated_at
14
+
15
+ end #Css
16
+
17
+ if auto_upgrade?
18
+ repository do
19
+ Css.auto_upgrade!
20
+ end
21
+ end
22
+ end #UzuUzu
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ require 'uzuuzu/adapter/datamapper/model/user'
3
+
4
+ module UzuUzu
5
+ class User
6
+ has n, :files
7
+ end
8
+
9
+ class File
10
+ include DataMapper::Resource
11
+ include DataMapper::Timestamps
12
+
13
+ property :id, Serial
14
+ property :file_name, String,
15
+ :required => true,
16
+ :unique => true,
17
+ :length => 255
18
+ property :content_type, String,
19
+ :required => true,
20
+ :length => 255
21
+ timestamps :updated_at
22
+
23
+ if UzuUzu.gae?
24
+ property :file_data, Blob,
25
+ :required => true,
26
+ :length => 2 ** 32
27
+ else
28
+ property :file_data, Binary,
29
+ :required => true,
30
+ :length => 2 ** 32
31
+ end
32
+
33
+ belongs_to :user
34
+ end #File
35
+
36
+ if auto_upgrade?
37
+ repository do
38
+ File.auto_upgrade!
39
+ end
40
+ end
41
+ end #UzuUzu
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ require 'uzuuzu/adapter/datamapper/model/user'
3
+
4
+ module UzuUzu
5
+ class User
6
+ has n, :images
7
+ end
8
+
9
+ class Image
10
+ include DataMapper::Resource
11
+ include DataMapper::Timestamps
12
+
13
+ property :id, Serial
14
+ property :file_name, String,
15
+ :required => true,
16
+ :unique => true,
17
+ :length => 255
18
+ property :content_type, String,
19
+ :required => true,
20
+ :length => 255
21
+ timestamps :updated_at
22
+
23
+ if UzuUzu.gae?
24
+ property :image, Blob,
25
+ :required => true,
26
+ :length => 2 ** 32
27
+ else
28
+ property :image, Binary,
29
+ :required => true,
30
+ :length => 2 ** 32
31
+ end
32
+
33
+ belongs_to :user
34
+ end #Image
35
+
36
+ if auto_upgrade?
37
+ repository do
38
+ Image.auto_upgrade!
39
+ end
40
+ end
41
+ end #UzuUzu
@@ -0,0 +1,127 @@
1
+ # coding: utf-8
2
+ require 'uzuuzu/adapter/datamapper/model/user'
3
+ require 'uzuuzu/adapter/datamapper/model/css'
4
+ require 'uzuuzu/adapter/datamapper/model/javascript'
5
+ require 'uzuuzu/adapter/datamapper/model/layout'
6
+ require 'uzuuzu/adapter/datamapper/model/page_body'
7
+ require 'uzuuzu/adapter/datamapper/model/page'
8
+
9
+ module UzuUzu
10
+ class User
11
+ has n, :infos
12
+ end
13
+
14
+ class Css
15
+ has n, :infos, :through => Resource
16
+ end
17
+
18
+ class Javascript
19
+ has n, :infos, :through => Resource
20
+ end
21
+
22
+ class Layout
23
+ has n, :infos
24
+ end
25
+
26
+ class PageBody
27
+ has n, :info_headers, 'UzuUzu::Info', :child_key => [ :header_id ]
28
+ has n, :info_footers, 'UzuUzu::Info', :child_key => [ :footer_id ]
29
+ has n, :info_navigators, 'UzuUzu::Info', :child_key => [ :navigator_id ]
30
+ has n, :info_lefts, 'UzuUzu::Info', :child_key => [ :left_id ]
31
+ has n, :info_rights, 'UzuUzu::Info', :child_key => [ :right_id ]
32
+ end
33
+
34
+ class Page
35
+ has n, :infos
36
+ end
37
+
38
+ class Info
39
+ include DataMapper::Resource
40
+
41
+ property :id, Serial
42
+ property :title, String,
43
+ :required => true,
44
+ :default => '',
45
+ :length => 255
46
+ property :step, Integer,
47
+ :default => 1
48
+ property :use_navigator, Boolean,
49
+ :default => false
50
+
51
+ belongs_to :top_page, 'UzuUzu::Page', :required => false
52
+ belongs_to :layout, :required => false
53
+ belongs_to :admin, 'UzuUzu::User', :required => false
54
+ belongs_to :header, 'UzuUzu::PageBody'
55
+ belongs_to :footer, 'UzuUzu::PageBody'
56
+ belongs_to :navigator, 'UzuUzu::PageBody'
57
+ belongs_to :left, 'UzuUzu::PageBody'
58
+ belongs_to :right, 'UzuUzu::PageBody'
59
+
60
+ has n, :csses, 'UzuUzu::Css', :through => Resource
61
+ has n, :javascripts, 'UzuUzu::Javascript', :through => Resource
62
+
63
+ def self.uniq
64
+ ret = nil
65
+ UzuUzu.transaction do |tr|
66
+ tr.begin
67
+ ary = self.all
68
+ if ary.empty?
69
+ ret = self.new
70
+ ret.title = "UzuUzu"
71
+ ret.header = ::UzuUzu::PageBody.new
72
+ ret.footer = ::UzuUzu::PageBody.new
73
+ ret.navigator = ::UzuUzu::PageBody.new
74
+ ret.left = ::UzuUzu::PageBody.new
75
+ ret.right = ::UzuUzu::PageBody.new
76
+ if ret.save
77
+ tr.commit
78
+ else
79
+ tr.rollback
80
+ end
81
+ break
82
+ end
83
+
84
+ ret = ary.pop
85
+ ary.each do |record|
86
+ record.destroy
87
+ end
88
+
89
+ tr.commit
90
+ end
91
+ ret
92
+ end #self.uniq
93
+
94
+ def initialize?
95
+ self.step == 4
96
+ end
97
+
98
+ def self.initialize?
99
+ info = self.uniq
100
+ info.initialize?
101
+ end
102
+
103
+ def render(contents=nil, instance=nil, options={})
104
+ locals = {
105
+ :@header => self.header.render(instance, options),
106
+ :@footer => self.footer.render(instance, options),
107
+ :@left => self.left.render(instance, options),
108
+ :@right => self.right.render(instance, options),
109
+ :@css => self.csses,
110
+ :@js => self.javascripts
111
+ }
112
+ locals[:@navigator] = self.navigator.render(instance, options) if self.use_navigator
113
+ locals[:@contents] = contents
114
+ locals[:@contents] ||= yield if block_given?
115
+ locals[:@contents] ||= ""
116
+ UzuUzu.render_engine(instance, self.layout.body, self.layout.engine, options, locals)
117
+ end # render
118
+ end #Info
119
+
120
+ if auto_upgrade?
121
+ repository do
122
+ Info.auto_upgrade!
123
+ InfoJavascript.auto_upgrade!
124
+ CssInfo.auto_upgrade!
125
+ end
126
+ end
127
+ end #UzuUzu
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ class Javascript
5
+ include DataMapper::Resource
6
+ include DataMapper::Timestamps
7
+
8
+ property :id, Serial
9
+ property :url, Text
10
+ property :format, String,
11
+ :length => 10
12
+ property :body, Text
13
+ timestamps :updated_at
14
+
15
+ end #Js
16
+
17
+ if auto_upgrade?
18
+ repository do
19
+ Javascript.auto_upgrade!
20
+ end
21
+ end
22
+ end #UzuUzu
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ class Layout
5
+ include DataMapper::Resource
6
+
7
+ property :id, Serial
8
+ property :name, String,
9
+ :length => 255
10
+ property :format, String,
11
+ :required => true,
12
+ :length => 10
13
+ property :body, Text,
14
+ :required => true
15
+ end #Page
16
+
17
+ if auto_upgrade?
18
+ repository do
19
+ Layout.auto_upgrade!
20
+ end
21
+ end
22
+ end #UzuUzu
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ require 'uzuuzu/adapter/datamapper/model/user'
3
+
4
+ module UzuUzu
5
+ class Movie
6
+ include DataMapper::Resource
7
+ include DataMapper::Timestamps
8
+
9
+ property :id, Serial
10
+ property :file_name, String,
11
+ :required => true,
12
+ :length => 255
13
+ property :extension, String,
14
+ :required => true,
15
+ :length => 255
16
+ property :content_type, String,
17
+ :required => true,
18
+ :length => 255
19
+ timestamps :updated_at
20
+
21
+ if UzuUzu.gae?
22
+ property :movie, Blob,
23
+ :required => true,
24
+ :length => 2 ** 32
25
+ else
26
+ property :movie, Binary,
27
+ :required => true,
28
+ :length => 2 ** 32
29
+ end
30
+
31
+ belongs_to :user
32
+ end #Movie
33
+
34
+ if auto_upgrade?
35
+ repository do
36
+ Movie.auto_upgrade!
37
+ end
38
+ end
39
+ end #UzuUzu
@@ -0,0 +1,167 @@
1
+ # coding: utf-8
2
+ require 'uzuuzu/adapter/datamapper/model/css'
3
+ require 'uzuuzu/adapter/datamapper/model/javascript'
4
+ require 'uzuuzu/adapter/datamapper/model/layout'
5
+ require 'uzuuzu/adapter/datamapper/model/page_body'
6
+
7
+ module UzuUzu
8
+ class Css
9
+ has n, :pages, :through => Resource
10
+ end
11
+
12
+ class Javascript
13
+ has n, :pages, :through => Resource
14
+ end
15
+
16
+ class Layout
17
+ has n, :pages
18
+ end
19
+
20
+ class PageBody
21
+ has n, :pages
22
+ has n, :page_headers, 'UzuUzu::Page', :child_key => :header_id
23
+ has n, :page_footers, 'UzuUzu::Page', :child_key => :footer_id
24
+ has n, :page_navigators, 'UzuUzu::Page', :child_key => :navigator_id
25
+ has n, :page_lefts, 'UzuUzu::Page', :child_key => :left_id
26
+ has n, :page_rights, 'UzuUzu::Page', :child_key => :right_id
27
+ end
28
+
29
+ class Page
30
+ include DataMapper::Resource
31
+ include DataMapper::Timestamps
32
+
33
+ property :id, Serial
34
+ property :name, String,
35
+ :required => true,
36
+ :length => 255
37
+ property :title, String,
38
+ :required => true,
39
+ :length => 255
40
+ property :use_navigator, Boolean
41
+ timestamps :at
42
+
43
+ belongs_to :layout,
44
+ :required => false
45
+ belongs_to :parent, 'UzuUzu::Page',
46
+ :required => false
47
+ belongs_to :page_body
48
+ belongs_to :header, 'UzuUzu::PageBody',
49
+ :required => false
50
+ belongs_to :footer, 'UzuUzu::PageBody',
51
+ :required => false
52
+ belongs_to :navigator, 'UzuUzu::PageBody',
53
+ :required => false
54
+ belongs_to :left, 'UzuUzu::PageBody',
55
+ :required => false
56
+ belongs_to :right, 'UzuUzu::PageBody',
57
+ :required => false
58
+
59
+ has n, :csses, :through => Resource
60
+ has n, :javascripts, :through => Resource
61
+ has n, :childs, 'UzuUzu::Page', :child_key => :parent
62
+
63
+ #
64
+ #
65
+ #
66
+ def css_urls
67
+ self.csses.map do |css|
68
+ css.url
69
+ end
70
+ end
71
+
72
+ #
73
+ #
74
+ #
75
+ def javascript_urls
76
+ _javascript = []
77
+
78
+ end
79
+
80
+ def reverse_look_up(column=nil)
81
+ if column
82
+ key = self.send(column)
83
+ else
84
+ key = self
85
+ end
86
+ child_tree = parent.reverse_look_up(self) if parent
87
+ {key => child_tree}
88
+ end
89
+
90
+ def breadcrumbs
91
+ _breadcrumbs = []
92
+ tree = reverse_look_up
93
+ while(tree)
94
+ tree.each do |key, value|
95
+ _breadcrumbs.push({:id => key.id, :name => key.name})
96
+ tree = value
97
+ end
98
+ end
99
+ _breadcrumbs.reverse
100
+ end
101
+
102
+ #
103
+ #
104
+ #
105
+ def self.top_page
106
+ self.first(:top_page => true)
107
+ end
108
+
109
+ #
110
+ #
111
+ #
112
+ def self.page_id_tree(parent_page_id=nil)
113
+ self.tree(:id, parent_page_id)
114
+ end
115
+
116
+ #
117
+ #
118
+ #
119
+ def self.page_name_tree(parent_page_id=nil)
120
+ self.tree(:name, parent_page_id)
121
+ end
122
+
123
+ #
124
+ #
125
+ #
126
+ def self.tree(column=nil, parent_page_id=nil)
127
+ ary = self.all(:parent_page_id => parent_page_id)
128
+ return nil if ary.nil? or ary.length <= 0
129
+ tree_map = {}
130
+ ary.each do |record|
131
+ child_tree = self.tree(column, record.id)
132
+ if colomn
133
+ key = record.send(column)
134
+ else
135
+ key = self
136
+ end
137
+ tree_map[key] = self.tree(column, record.id)
138
+ end
139
+ tree_map
140
+ end
141
+
142
+ def render(contents=nil, instance=nil, options={})
143
+ locals = {
144
+ :@header => self.header.render(instance, options),
145
+ :@footer => self.footer.render(instance, options),
146
+ :@left => self.left.render(instance, options),
147
+ :@right => self.right.render(instance, options),
148
+ :@css => self.csses,
149
+ :@js => self.javascripts
150
+ }
151
+ locals[:@navigator] = self.navigator.render(instance, options) if self.use_navigator
152
+ locals[:@contents] = contents
153
+ locals[:@contents] ||= yield if block_given?
154
+ locals[:@contents] ||= self.page_body.render(instance, options)
155
+ locals[:@contents] ||= ""
156
+ UzuUzu.render_engine(instance, self.layout.body, self.layout.engine, options, locals)
157
+ end # render
158
+ end #Page
159
+
160
+ if auto_upgrade?
161
+ repository do
162
+ Page.auto_upgrade!
163
+ JavascriptPage.auto_upgrade!
164
+ CssPage.auto_upgrade!
165
+ end
166
+ end
167
+ end #UzuUzu
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ class Contents
5
+ has n, :page_bodies, :through => Resource
6
+ end
7
+
8
+ class PageBody
9
+ include DataMapper::Resource
10
+
11
+ property :id, Serial
12
+
13
+ has n, :contents, 'UzuUzu::Contents', :through => Resource
14
+
15
+ def render(instance=nil, options={})
16
+ self.contents.map do |c|
17
+ c.render(instance=nil, options={})
18
+ end.join('\n')
19
+ end
20
+ end # PageBody
21
+
22
+ if auto_upgrade?
23
+ repository do
24
+ PageBody.auto_upgrade!
25
+ ContentsPageBody.auto_upgrade!
26
+ end
27
+ end
28
+ end # UzuUzu
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ class User
5
+ include DataMapper::Resource
6
+ include DataMapper::Timestamps
7
+
8
+ property :id, Serial
9
+ property :user_id, Text,
10
+ :required => true,
11
+ :unique => true
12
+ property :name, String,
13
+ :required => true,
14
+ :length => 255
15
+ property :domain, String,
16
+ :required => true,
17
+ :length => 255
18
+ property :email, String,
19
+ :length => 255
20
+ property :web, Text
21
+ timestamps :at
22
+
23
+ end #User
24
+
25
+ if auto_upgrade?
26
+ repository do
27
+ User.auto_upgrade!
28
+ end
29
+ end
30
+ end #UzuUzu
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+
3
+ require 'uzuuzu/adapter/datamapper/model/css'
4
+ require 'uzuuzu/adapter/datamapper/model/javascript'
5
+ require 'uzuuzu/adapter/datamapper/model/wiki_layout'
6
+ require 'uzuuzu/adapter/datamapper/model/wiki_attache'
7
+ require 'uzuuzu/adapter/datamapper/model/wiki_entry'
8
+
9
+ module UzuUzu
10
+
11
+ class Css
12
+ has n, :wikis, :through => Resource
13
+ end
14
+
15
+ class Javascript
16
+ has n, :wikis, :through => Resource
17
+ end
18
+
19
+ class Wiki
20
+ include DataMapper::Resource
21
+
22
+ property :id, Serial
23
+ property :title, String,
24
+ :required => true,
25
+ :length => 255
26
+
27
+ has n, :wiki_layouts
28
+ has n, :wiki_entries
29
+ has n, :csses, :through => Resource
30
+ has n, :javascripts, :through => Resource
31
+ end
32
+
33
+ if auto_upgrade?
34
+ repository do
35
+ Wiki.auto_upgrade!
36
+ WikiJavascript.auto_upgrade!
37
+ WikiCss.auto_upgrade!
38
+ WikiLayout.auto_upgrade!
39
+ WikiEntry.auto_upgrade!
40
+ WikiAttache.auto_upgrade!
41
+ end
42
+ end
43
+ end