uzuuzu-cms 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/VERSION +1 -1
  2. data/lib/uzuuzu-cms.rb +2 -0
  3. data/lib/uzuuzu-cms/controller/admin/view/index.rhtml +35 -0
  4. data/lib/uzuuzu-cms/controller/contents.rb +6 -2
  5. data/lib/uzuuzu-cms/controller/error.rb +11 -0
  6. data/lib/uzuuzu-cms/controller/index.rb +0 -9
  7. data/lib/uzuuzu-cms/controller/initialize.rb +22 -87
  8. data/lib/uzuuzu-cms/controller/openid.rb +1 -1
  9. data/lib/uzuuzu-cms/controller/page.rb +43 -6
  10. data/lib/uzuuzu-cms/controller/user.rb +1 -2
  11. data/lib/uzuuzu-cms/controller/view/crud/destroy.rhtml +2 -2
  12. data/lib/uzuuzu-cms/controller/view/crud/edit.rhtml +2 -2
  13. data/lib/uzuuzu-cms/controller/view/crud/index.rhtml +2 -2
  14. data/lib/uzuuzu-cms/controller/view/crud/new.rhtml +2 -2
  15. data/lib/uzuuzu-cms/controller/view/crud/show.rhtml +2 -2
  16. data/lib/uzuuzu-cms/controller/view/error/404.rhtml +1 -1
  17. data/lib/uzuuzu-cms/controller/view/error/500.rhtml +1 -1
  18. data/lib/uzuuzu-cms/controller/view/initialize/step1.rhtml +7 -5
  19. data/lib/uzuuzu-cms/controller/view/initialize/step2.rhtml +6 -19
  20. data/lib/uzuuzu-cms/controller/view/openid/index.rhtml +3 -3
  21. data/lib/uzuuzu-cms/controller/view/user/entry.rhtml +4 -4
  22. data/lib/uzuuzu-cms/helper/page.rb +61 -0
  23. data/lib/uzuuzu-cms/model/authority.rb +18 -0
  24. data/lib/uzuuzu-cms/{controller/view/admin/index.rhtml → model/authority_group.rb} +0 -0
  25. data/lib/uzuuzu-cms/model/contents.rb +4 -2
  26. data/lib/uzuuzu-cms/model/info.rb +61 -89
  27. data/lib/uzuuzu-cms/model/layout.rb +19 -1
  28. data/lib/uzuuzu-cms/model/page.rb +57 -98
  29. data/lib/uzuuzu-cms/model/page_meta.rb +20 -0
  30. data/lib/uzuuzu-cms/model/user.rb +2 -0
  31. data/lib/uzuuzu-cms/wrapper/application.rb +6 -0
  32. data/lib/uzuuzu-cms/wrapper/controller.rb +17 -1
  33. data/lib/uzuuzu-cms/wrapper/helper.rb +6 -0
  34. data/lib/uzuuzu-cms/wrapper/lang/ja.yaml +5 -14
  35. data/lib/uzuuzu-cms/wrapper/model.rb +1 -1
  36. data/lib/uzuuzu-cms/wrapper/uzuuzu.rb +10 -0
  37. data/uzuuzu-cms.gemspec +11 -7
  38. metadata +12 -8
  39. data/lib/uzuuzu-cms/controller/plugin.rb +0 -16
  40. data/lib/uzuuzu-cms/controller/view/initialize/step3.rhtml +0 -24
  41. data/lib/uzuuzu-cms/controller/view/layout.rhtml +0 -25
  42. data/lib/uzuuzu-cms/model/page_body.rb +0 -37
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,6 +1,8 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require 'uzuuzu'
4
+ require 'uzuuzu-cms/wrapper/uzuuzu'
4
5
  require 'uzuuzu-cms/wrapper/model'
6
+ require 'uzuuzu-cms/wrapper/helper'
5
7
  require 'uzuuzu-cms/wrapper/controller'
6
8
  require 'uzuuzu-cms/wrapper/environments'
@@ -0,0 +1,35 @@
1
+
2
+ <div class="admin_navigator">
3
+ <a class="admin_panel_button">
4
+ </a>
5
+ <a class="admin_edit_button">
6
+ </a>
7
+ </div>
8
+
9
+ <div class="admin_panel">
10
+ <div class="tab_navigator">
11
+ <div class="">
12
+ </div>
13
+ <div class="">
14
+ </div>
15
+ <div class="">
16
+ </div>
17
+ <div class="">
18
+ </div>
19
+ <div class="">
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="admin_edit_panel">
25
+ </div>
26
+ <div class="admin_file_panel">
27
+ </div>
28
+ <div class="admin_image_panel">
29
+ </div>
30
+ <div class="admin_movie_panel">
31
+ </div>
32
+ <div class="admin_contents_panel">
33
+ </div>
34
+
35
+
@@ -8,8 +8,12 @@ module UzuUzu
8
8
  redirect(rf(Initialize)) unless info.initialize?
9
9
  end
10
10
 
11
- def index
12
- ''
11
+ def index(id)
12
+ contents = ::UzuUzu::Contents.first(:id => id)
13
+ if contents.nil?
14
+ not_found
15
+ end
16
+ respond(contents.render(self))
13
17
  end
14
18
  end # Contents
15
19
  end # Controller
@@ -0,0 +1,11 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Error
6
+ def index(code)
7
+ respond(render_page(info, render_file(__DIR__("view/error/#{code}.rhtml"))))
8
+ end
9
+ end
10
+ end
11
+ end
@@ -9,15 +9,6 @@ module UzuUzu
9
9
  respond(render_full(Page, :top_page))
10
10
  end
11
11
 
12
- def error(code)
13
- @contents = render_file(__DIR__("view/error/#{code}.rhtml"))
14
- if info.initialize?
15
- @resource = info
16
- end
17
- @contents = render_file(__DIR__("view/layout.rhtml"))
18
- respond(@contents)
19
- end
20
-
21
12
  def css(id)
22
13
  UzuUzu::repository do
23
14
  @resource = Css.first(:id => id)
@@ -4,109 +4,44 @@ module UzuUzu
4
4
  module Controller
5
5
  class Initialize
6
6
  def index
7
- if Info.first.nil?
8
- # fixture load
9
- logger.debug 'fixture load start'
10
- Dir.glob('./fixture/**/*.*').each do |path|
11
- logger.debug "fixture file : #{path}"
12
- paths = path.split('/')
13
- model_name = ::File.basename(paths.pop, '.*')
14
- while !paths.blank? && paths[-1] != 'fixture'
15
- model_name = "#{paths.pop.camel_case}::#{model_name.camel_case}"
16
- end
17
- begin
18
- logger.debug "fixture model name : #{model_name}"
19
- model = eval("::#{model_name}")
20
- ::UzuUzu::DataStore::Fixture.import_file(model, path, true)
21
- rescue NameError => e
22
- logger.error(e.to_s)
23
- end
24
- end
25
- logger.debug 'fixture load end'
26
- end
27
- if info.initialize?
28
- redirect rf(UzuUzu::Controller::Index)
29
- end
30
7
  self.send("step#{info.step}")
31
8
  case(info.step)
32
9
  when 1
33
- respond(info.render(self, render_file(__DIR__('view/initialize/step1.rhtml'))))
10
+ respond(render_page(info, render_file(__DIR__('view/initialize/step1.rhtml'))))
34
11
  when 2
35
- respond(info.render(self, render_file(__DIR__('view/initialize/step2.rhtml'))))
36
- when 3
37
- respond(info.render(self, render_file(__DIR__('view/initialize/step3.rhtml'))))
38
- when 4
39
- redirect rf(UzuUzu::Controller::Index)
12
+ respond(render_page(info, render_file(__DIR__('view/initialize/step2.rhtml'))))
40
13
  end
41
- end
14
+ end # index
42
15
 
43
16
  private
44
17
 
45
18
  def step1
46
- unless session[:openid_identity].nil?
47
- UzuUzu.transaction do |tr|
48
- tr.begin
49
- info.step = 2
50
- info.save
51
- tr.commit
52
- end
53
- end
54
- end
55
-
56
- def step2
57
19
  if session[:openid_identity].nil?
58
- UzuUzu.transaction do |tr|
59
- tr.begin
60
- info.step = 1
61
- info.save
62
- tr.commit
63
- end
64
20
  return
65
21
  end
66
- if request.post?
67
- if request.params['name'].blank?
68
- @error = fix_localize(:user_name_empty)
69
- return
70
- end
71
- UzuUzu.transaction do |tr|
72
- tr.begin
73
- user = UzuUzu::User.new
74
- user.user_id = session[:openid_identity]
75
- user.domain = session[:openid_domain]
76
- user.name = request.params['name']
77
- user.email = request.params['email']
78
- user.web = request.params['web']
79
- info.step = 3
80
- info.admin = user
81
- if info.save
82
- tr.commit
83
- else
84
- tr.roolback
85
- end
86
- end
87
- end
88
- end
89
-
90
- def step3
91
- if session[:openid_identity].nil?
92
- UzuUzu.transaction do |tr|
93
- tr.begin
94
- info.step = 1
95
- info.save
22
+ UzuUzu.transaction do |tr|
23
+ tr.begin
24
+ info.step = 2
25
+ user = UzuUzu::User.new
26
+ user.user_id = session[:openid_identity]
27
+ user.domain = session[:openid_domain]
28
+ user.name = 'admin'
29
+ user.admin = true
30
+ if info.save
96
31
  tr.commit
32
+ else
33
+ tr.rollback
97
34
  end
98
- return
99
35
  end
100
- if request.post?
101
- UzuUzu.transaction do |tr|
102
- tr.begin
103
- info.step = 4
104
- info.title = request.params['title']
105
- info.save
106
- tr.commit
107
- end
36
+ end # step1
37
+
38
+ def step2
39
+ if session[:openid_identity].nil?
40
+ redirect rf(::UzuUzu::Controller::Index)
108
41
  end
109
- end
42
+ login_user = ::UzuUzu::User.first(:user_id => session[:openid_identity])
43
+ login_user
44
+ end # step2
110
45
  end # Initialize
111
46
  end # Controller
112
47
  end # UzuUzu
@@ -22,7 +22,7 @@ module UzuUzu
22
22
  redirect referer || rf(Index)
23
23
  end
24
24
  session[:referer] = request.referrer
25
- respond(info.render(render_file(__DIR__('view/openid/index.rhtml'))))
25
+ respond(render_page(info, render_file(__DIR__('view/openid/index.rhtml'))))
26
26
  end
27
27
 
28
28
  def logout
@@ -2,19 +2,56 @@
2
2
 
3
3
  module UzuUzu
4
4
  module Controller
5
+ #
6
+ #
7
+ #
5
8
  class Page
6
9
 
10
+ #
11
+ #
12
+ #
7
13
  def before
8
14
  redirect(rf(Initialize)) unless info.initialize?
9
- end
15
+ end # before
10
16
 
11
- def index(page, *args)
12
-
13
- end
17
+ #
18
+ #
19
+ #
20
+ def index(*breadcrumbs)
21
+ if breadcrumbs.blank?
22
+ not_found
23
+ end
24
+ page = ::UzuUzu::Page.first(:name => breadcrumbs.shift)
25
+ while !breadcrumbs.blank?
26
+ page = page.childs(:name => breadcrumbs.shift) unless page.nil?
27
+ end
28
+ if page.nil?
29
+ not_found
30
+ end
31
+ respond(page.render(self))
32
+ end # index
33
+
34
+ #
35
+ #
36
+ #
37
+ def id(page_id)
38
+ page = ::UzuUzu::Page.first(:id => page_id)
39
+ if page.nil?
40
+ not_found
41
+ end
42
+ respond(render_page(page))
43
+ end # id
14
44
 
45
+ #
46
+ #
47
+ #
15
48
  def top_page
16
- ""
17
- end
49
+ page = info.top_page
50
+ if page.nil?
51
+ not_found
52
+ end
53
+ respond(render_page(page))
54
+ end # top_page
18
55
  end # Page
19
56
  end # Controller
20
57
  end # UzuUzu
@@ -19,8 +19,7 @@ module UzuUzu
19
19
  end
20
20
  end
21
21
  end
22
- view_value = render_file(__DIR__("view/user/entry.xhtml"))
23
- respond(view_value)
22
+ respond(render_page(info, render_file(__DIR__('view/user/entry.rhtml'))))
24
23
  end
25
24
  end # User
26
25
  end # Controller
@@ -7,8 +7,8 @@
7
7
  <meta http-equiv="Content-Style-Type" content="text/css" />
8
8
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
9
  <meta http-equiv="expires" content="-1" />
10
- <%= css 'jquery.mobile' %>
11
- <%= js_for 'jquery', 'jquery.mobile' %>
10
+ <%= css '/css/jquery.mobile.css' %>
11
+ <%= js_for '/js/jquery.js', '/js/jquery.mobile.js' %>
12
12
  </head>
13
13
  <body >
14
14
  <div data-role="page" id="confirm">
@@ -7,8 +7,8 @@
7
7
  <meta http-equiv="Content-Style-Type" content="text/css" />
8
8
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
9
  <meta http-equiv="expires" content="-1" />
10
- <%= css 'jquery.mobile' %>
11
- <%= js_for 'jquery', 'jquery.mobile' %>
10
+ <%= css '/css/jquery.mobile.css' %>
11
+ <%= js_for '/js/jquery.js', '/js/jquery.mobile.js' %>
12
12
  </head>
13
13
  <body >
14
14
  <div data-role="page" id="top">
@@ -7,8 +7,8 @@
7
7
  <meta http-equiv="Content-Style-Type" content="text/css" />
8
8
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
9
  <meta http-equiv="expires" content="-1" />
10
- <%= css 'jquery.mobile' %>
11
- <%= js_for 'jquery', 'jquery.mobile' %>
10
+ <%= css '/css/jquery.mobile.css' %>
11
+ <%= js_for '/js/jquery.js', '/js/jquery.mobile.js' %>
12
12
  </head>
13
13
  <body>
14
14
  <div data-role="page" id="top">
@@ -7,8 +7,8 @@
7
7
  <meta http-equiv="Content-Style-Type" content="text/css" />
8
8
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
9
  <meta http-equiv="expires" content="-1" />
10
- <%= css 'jquery.mobile' %>
11
- <%= js_for 'jquery', 'jquery.mobile' %>
10
+ <%= css '/css/jquery.mobile.css' %>
11
+ <%= js_for '/js/jquery.js', '/js/jquery.mobile.js' %>
12
12
  </head>
13
13
  <body >
14
14
  <div data-role="page" id="top">
@@ -7,8 +7,8 @@
7
7
  <meta http-equiv="Content-Style-Type" content="text/css" />
8
8
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
9
  <meta http-equiv="expires" content="0" />
10
- <%= css 'jquery.mobile' %>
11
- <%= js_for 'jquery', 'jquery.mobile' %>
10
+ <%= css '/css/jquery.mobile.css' %>
11
+ <%= js_for '/js/jquery.js', '/js/jquery.mobile.js' %>
12
12
  </head>
13
13
  <body >
14
14
  <div data-role="page" id="top">
@@ -1,2 +1,2 @@
1
1
 
2
- <%= fix_localize(:not_found) %>
2
+ <%= localize(:not_found) %>
@@ -1,2 +1,2 @@
1
1
 
2
- <%= fix_localize(:server_error) %>
2
+ <%= localize(:server_error) %>
@@ -1,15 +1,17 @@
1
1
 
2
2
  <div id="step1">
3
3
  <p>
4
- <%= fix_localize(:step1) %>
4
+ <%= localize(:step1) %>
5
+ </p>
6
+ <br />
7
+ <p>
8
+ <%= localize(:openid_message) %>
5
9
  </p>
6
10
  <form method="post" action="<%= rf(UzuUzu::Controller::Openid, :openid_begin) %>">
7
11
  <p>
8
- <%= fix_localize(:openid_url) %>:
12
+ <%= localize(:openid_url) %>:
9
13
  <input type="text" name="url" />
10
- </p>
11
- <p>
12
- <input type="submit" value="<%= fix_localize(:login) %>"/>
14
+ <input type="submit" value="<%= localize(:login) %>"/>
13
15
  </p>
14
16
  </form>
15
17
  </div>
@@ -1,24 +1,11 @@
1
1
 
2
2
  <div id="step2">
3
3
  <p>
4
- <%= fix_localize(:step2) %>
4
+ <%= localize(:step2) %>
5
+ </p>
6
+ <p>
7
+ <a href="<%= rf(::UzuUzu::Controller::Admin::Index) %>"><%= localize(:to_admin_page) %></a>
8
+ &nbsp;
9
+ <a href="<%= rf(::UzuUzu::Controller::Index) %>"><%= localize(:to_top_page) %></a>
5
10
  </p>
6
- <form method="post">
7
- <p class='error_detail'><%= @error %></p>
8
- <p>
9
- <%= fix_localize(:user_entry_name) %>:
10
- <input type="text" name="name" />
11
- </p>
12
- <p>
13
- <%= fix_localize(:user_entry_email) %>:
14
- <input type="text" name="email" />
15
- </p>
16
- <p>
17
- <%= fix_localize(:user_entry_web) %>:
18
- <input type="text" name="web" />
19
- </p>
20
- <p>
21
- <input type="submit" value="<%= fix_localize(:entry) %>"/>
22
- </p>
23
- </form>
24
11
  </div>
@@ -1,14 +1,14 @@
1
1
  <div id="openid_index">
2
2
  <p>
3
- <%= fix_localize(:openid_message) %>
3
+ <%= localize(:openid_message) %>
4
4
  </p>
5
5
  <form method="post" action="<%= r(:openid_begin) %>">
6
6
  <p>
7
- <%= fix_localize(:openid_url) %>:
7
+ <%= localize(:openid_url) %>:
8
8
  <input type="text" name="url" />
9
9
  </p>
10
10
  <p>
11
- <input type="submit" value="<%= fix_localize(:login) %>"/>
11
+ <input type="submit" value="<%= localize(:login) %>"/>
12
12
  </p>
13
13
  </form>
14
14
  </div>