zena 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/History.txt +18 -0
  2. data/app/controllers/nodes_controller.rb +11 -6
  3. data/app/controllers/sites_controller.rb +3 -2
  4. data/app/controllers/user_sessions_controller.rb +1 -1
  5. data/app/controllers/virtual_classes_controller.rb +3 -2
  6. data/app/models/document.rb +2 -2
  7. data/app/models/node.rb +6 -1
  8. data/app/models/note.rb +3 -27
  9. data/app/models/role.rb +11 -5
  10. data/app/models/site.rb +140 -43
  11. data/app/models/string_hash.rb +2 -0
  12. data/app/models/user.rb +9 -4
  13. data/app/models/user_session.rb +1 -1
  14. data/app/models/virtual_class.rb +49 -18
  15. data/app/views/sites/_form.erb +7 -4
  16. data/app/views/sites/_li.erb +15 -9
  17. data/app/views/users/_li.rhtml +3 -0
  18. data/app/views/users/index.rhtml +1 -1
  19. data/app/views/virtual_classes/_form.erb +1 -1
  20. data/bricks/acls/zena/init.rb +1 -2
  21. data/bricks/acls/zena/test/sites/erebus/roles.yml +4 -0
  22. data/bricks/activity/lib/bricks/activity.rb +24 -0
  23. data/bricks/activity/zena/migrate/20130711135905_add_activity_to_user.rb +9 -0
  24. data/bricks/activity/zena/test/integration/activity_integration_test.rb +29 -0
  25. data/bricks/captcha/zena/init.rb +0 -3
  26. data/bricks/fs_skin/lib/bricks/fs_skin.rb +3 -3
  27. data/bricks/fs_skin/zena/skins/blog/Node.zafu +1 -1
  28. data/bricks/fs_skin/zena/tasks.rb +2 -2
  29. data/bricks/fs_skin/zena/test/integration/fs_skin_integration_test.rb +2 -2
  30. data/bricks/fs_skin/zena/test/unit/fs_skin_test.rb +1 -1
  31. data/bricks/math/zena/init.rb +0 -3
  32. data/bricks/pdf/zena/init.rb +1 -5
  33. data/bricks/worker/zena/init.rb +0 -2
  34. data/bricks/zena/zena/migrate/20130617164527_add_master_id_to_site.rb +13 -0
  35. data/bricks/zena/zena/migrate/20130712081512_alter_login_users.rb +9 -0
  36. data/config/bricks.yml +4 -1
  37. data/lib/bricks/loader.rb +17 -9
  38. data/lib/tasks/zena.rake +40 -5
  39. data/lib/zafu/process/ruby_less_processing.rb +3 -5
  40. data/lib/zena.rb +2 -0
  41. data/lib/zena/acts/secure.rb +11 -2
  42. data/lib/zena/console.rb +5 -4
  43. data/lib/zena/core_ext/string.rb +2 -2
  44. data/lib/zena/deploy.rb +22 -6
  45. data/lib/zena/deploy/logrotate_app.rhtml +10 -7
  46. data/lib/zena/deploy/logrotate_host.rhtml +21 -26
  47. data/lib/zena/deploy/vhost.rhtml +3 -3
  48. data/lib/zena/foxy_parser.rb +1 -1
  49. data/lib/zena/info.rb +1 -1
  50. data/lib/zena/site_worker.rb +2 -2
  51. data/lib/zena/use.rb +0 -1
  52. data/lib/zena/use/ancestry.rb +1 -1
  53. data/lib/zena/use/authlogic.rb +2 -1
  54. data/lib/zena/use/display.rb +6 -0
  55. data/lib/zena/use/query_builder.rb +1 -1
  56. data/lib/zena/use/query_node.rb +3 -3
  57. data/lib/zena/use/rendering.rb +47 -13
  58. data/lib/zena/use/test_helper.rb +1 -1
  59. data/lib/zena/use/urls.rb +6 -104
  60. data/lib/zena/use/zafu_safe_definitions.rb +9 -4
  61. data/lib/zena/use/zafu_templates.rb +1 -0
  62. data/locale/app.pot +4 -0
  63. data/locale/de/LC_MESSAGES/zena.mo +0 -0
  64. data/locale/de/zena.po +6 -2
  65. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  66. data/locale/en/zena.po +6 -2
  67. data/locale/fr/LC_MESSAGES/zena.mo +0 -0
  68. data/locale/fr/zena.po +5 -1
  69. data/locale/it/LC_MESSAGES/zena.mo +0 -0
  70. data/locale/it/zena.po +6 -2
  71. data/locale/zena.pot +4 -0
  72. data/test/functional/nodes_controller_test.rb +2 -133
  73. data/test/functional/sites_controller_test.rb +1 -1
  74. data/test/integration/multiple_hosts_test.rb +2 -1
  75. data/test/integration/navigation_test.rb +37 -0
  76. data/test/integration/query_node/basic.yml +1 -1
  77. data/test/integration/zafu_compiler/ajax.yml +7 -0
  78. data/test/integration/zafu_compiler/comments.yml +2 -2
  79. data/test/integration/zafu_compiler/context.yml +6 -2
  80. data/test/integration/zafu_compiler/display.yml +16 -4
  81. data/test/integration/zafu_compiler/forms.yml +1 -0
  82. data/test/integration/zafu_compiler/query.yml +7 -1
  83. data/test/integration/zafu_compiler/relations.yml +12 -7
  84. data/test/integration/zafu_compiler/roles.yml +3 -3
  85. data/test/integration/zafu_compiler/rubyless.yml +1 -2
  86. data/test/integration/zafu_compiler/safe_definitions.yml +5 -0
  87. data/test/sites/complex/roles.yml +1 -1
  88. data/test/sites/ocean/roles.yml +4 -0
  89. data/test/sites/zena/columns.yml +3 -1
  90. data/test/sites/zena/roles.yml +5 -1
  91. data/test/sites/zena/sites.yml +22 -0
  92. data/test/unit/document_test.rb +14 -0
  93. data/test/unit/node_test.rb +14 -0
  94. data/test/unit/role_test.rb +19 -4
  95. data/test/unit/site_test.rb +67 -0
  96. data/test/unit/user_test.rb +20 -0
  97. data/test/unit/virtual_class_test.rb +116 -11
  98. data/test/unit/zena/use/rendering_test.rb +1 -1
  99. data/zena.gemspec +67 -66
  100. metadata +126 -125
  101. data/bricks/fs_skin/zena/init.rb +0 -1
  102. data/bricks/grid/zena/init.rb +0 -4
  103. data/bricks/single/zena/init.rb +0 -1
  104. data/bricks/spreadsheet/zena/init.rb +0 -3
@@ -3,6 +3,8 @@ class StringHash < Hash
3
3
 
4
4
  def self.from_string(str)
5
5
  from_hash(JSON.parse(str))
6
+ rescue
7
+ from_hash({})
6
8
  end
7
9
 
8
10
  def self.from_hash(hash)
@@ -64,9 +64,10 @@ class User < ActiveRecord::Base
64
64
  include RubyLess
65
65
 
66
66
  safe_attribute :login, :time_zone, :created_at, :updated_at, :lang, :id
67
- safe_method :initials => String, :status => Number, :status_name => String,
67
+ safe_method :status => Number, :status_name => String,
68
68
  :is_anon? => Boolean, :is_admin? => Boolean, :user? => Boolean, :commentator? => Boolean,
69
- :moderated? => Boolean, :asset_host? => Boolean, [:in_group?, String] => Boolean
69
+ :moderated? => Boolean, :asset_host? => Boolean, [:in_group?, String] => Boolean,
70
+ :group_names => [String]
70
71
 
71
72
  safe_context :node => node_user_proc,
72
73
  :to_publish => ['Version'], :redactions => ['Version'], :proposed => ['Version'],
@@ -219,10 +220,14 @@ class User < ActiveRecord::Base
219
220
  # This is set on the user during login.
220
221
  alias asset_host? asset_host
221
222
 
222
- def in_group?(name)
223
+ def group_names
223
224
  @group_names ||= begin
224
225
  groups.all(:order=>'name').map(&:name)
225
- end.include?(name)
226
+ end
227
+ end
228
+
229
+ def in_group?(name)
230
+ group_names.include?(name)
226
231
  end
227
232
 
228
233
  # Return true if the user's status is high enough to start editing nodes.
@@ -1,4 +1,4 @@
1
1
  class UserSession < Authlogic::Session::Base
2
2
  self.find_by_login_method = :find_allowed_user_by_login
3
-
3
+ consecutive_failed_logins_limit 10
4
4
  end
@@ -146,14 +146,17 @@ class VirtualClass < Role
146
146
  end
147
147
 
148
148
  conditions[0] = conditions[0].join(' AND ')
149
-
149
+
150
+ seen_names = {}
150
151
  Node.native_classes.each do |kpath, real_class|
152
+ seen_names[real_class.name] = true
151
153
  load_roles_and_cache(build_vclass_from_real_class(real_class))
152
154
  end
153
155
 
154
156
  VirtualClass.all(
155
157
  :conditions => conditions,
156
158
  :order => 'kpath ASC').each do |vclass|
159
+ next if seen_names[vclass.name]
157
160
  load_roles_and_cache(vclass)
158
161
  end
159
162
 
@@ -184,15 +187,21 @@ class VirtualClass < Role
184
187
  end
185
188
 
186
189
  def build_vclass_from_real_class(real_class)
187
- vclass = VirtualClass.new(:name => real_class.name)
190
+ # Merge virtual class from db if it exists.
191
+ if vclass = VirtualClass.first(:conditions => {:name => real_class.name, :site_id => current_site.id})
192
+ # ...
193
+ else
194
+ vclass = VirtualClass.new(:name => real_class.name)
195
+ if real_class <= TextDocument
196
+ vclass.monolingual = true
197
+ end
198
+ end
188
199
  vclass.kpath = real_class.kpath
189
200
  vclass.real_class = real_class
190
201
  vclass.include_role real_class.schema
191
202
  vclass.instance_variable_set(:@is_real_class, true)
192
203
  vclass.site_id = current_site.id
193
- if real_class <= TextDocument
194
- vclass.monolingual = true
195
- end
204
+
196
205
  vclass
197
206
  end
198
207
 
@@ -405,19 +414,26 @@ class VirtualClass < Role
405
414
  nil
406
415
  end
407
416
  end
417
+
418
+ def defined_in_db?
419
+ !id.blank?
420
+ end
408
421
 
409
422
  # Return safe columns including super class's safe columns
410
423
  def defined_safe_columns
411
- @defined_safe_columns ||= if real_class?
412
- # Get columns from the 'native' schema of the real class (this schema is a Property::Role,
413
- # not a VirtualClass or ::Role).
414
- #
415
- # Only columns explicitly declared safe are safe here
416
- real_class.schema.defined_columns.values.select do |col|
417
- real_class.safe_method_type([col.name])
418
- end.sort {|a,b| a.name <=> b.name}
419
- else
420
- super
424
+ @defined_safe_columns ||= begin
425
+ # If we have
426
+ list = defined_in_db? ? super : []
427
+ if real_class?
428
+ # Get columns from the 'native' schema of the real class (this schema is a Property::Role,
429
+ # not a VirtualClass or ::Role).
430
+ #
431
+ # Only columns explicitly declared safe are safe here
432
+ list += real_class.schema.defined_columns.values.select do |col|
433
+ real_class.safe_method_type([col.name])
434
+ end
435
+ end
436
+ list.sort {|a,b| a.name <=> b.name}
421
437
  end
422
438
  end
423
439
 
@@ -553,6 +569,10 @@ class VirtualClass < Role
553
569
 
554
570
  protected
555
571
  def rebuild_kpath(superclass)
572
+ if self.name == self.real_class.name
573
+ return self[:kpath] = self.real_class.kpath
574
+ end
575
+
556
576
  index = 0
557
577
  kpath = nil
558
578
  try_keys = "#{name}ABCDEFGHIJKLMNOPQRSTUCWXYZ1234567890"
@@ -588,14 +608,25 @@ class VirtualClass < Role
588
608
  end
589
609
 
590
610
  return if !errors.empty?
591
- @superclass ||= self.superclass
611
+
612
+ if native = Node.native_classes_by_name[name]
613
+ self[:real_class] = native.name
614
+ up = native.superclass
615
+ if up != ActiveRecord::Base
616
+ @superclass = VirtualClass[up.name]
617
+ else
618
+ # superclass of 'Node' virtual class is Node ruby class.
619
+ @superclass = Node
620
+ end
621
+ else
622
+ @superclass ||= self.superclass
623
+ self[:real_class] = get_real_class(@superclass)
624
+ end
592
625
 
593
626
  if real_class? || name_changed? || @superclass != old.superclass
594
627
  rebuild_kpath(@superclass)
595
628
  end
596
629
 
597
- self[:real_class] = get_real_class(@superclass)
598
-
599
630
  unless (secure!(Group) { Group.find(self[:create_group_id]) } rescue nil)
600
631
  errors.add('create_group_id', 'invalid group')
601
632
  end
@@ -14,21 +14,24 @@
14
14
  <% end %>
15
15
  <table cellspacing='0' class='edit_site'>
16
16
  <tr><td class='label'><%= _('host') %></td><td><%= @site[:host] %></td></tr>
17
- <% Site.attributes_for_form[:text].each do |name| -%>
17
+ <tr><td class='label'><%= _('root') %></td><td><%= text_field('site', :root_zip, :size=>15, :value => @site.root_zip) %></td></tr>
18
+ <% Site.attributes_for_form(@site.is_alias?)[:text].each do |name| -%>
18
19
  <tr><td class='label'><%= _(name) %></td><td><%= text_field('site', name, :size=>nil) %></td></tr>
19
20
  <% end -%>
21
+ <% if !@site.is_alias? %>
20
22
  <tr><td class='label'><%= _('redit_time') %></td><td><%= text_field('site', :redit_time, :size=>15, :value => @site.redit_time) %></td></tr>
21
23
  <tr><td class='label'><%= _('public group') %></td><td><%= @site.public_group.name %></td></tr>
22
24
  <tr><td class='label'><%= _('site group') %></td><td><%= @site.site_group.name %></td></tr>
23
25
  <tr><td class='label'><%= _('API group') %></td><td><%= select('site', 'api_group_id', visitor.all_groups.map{|g| [g.name, g.id]}, {:include_blank => true, :selected => @site.api_group_id} ) %></td></tr>
24
-
26
+ <% end %>
27
+
25
28
  <tr><td class='label'><%= _('options') %></td><td>
26
- <% Site.attributes_for_form[:bool].each do |sym| -%>
29
+ <% Site.attributes_for_form(@site.is_alias?)[:bool].each do |sym| -%>
27
30
  <input type='hidden' name='site[<%= sym %>]' value=''/>
28
31
  <input type='checkbox' name='site[<%= sym %>]' value='1'<%= @site.send(sym) ? " checked='checked'" : '' %>/> <%= _(sym.to_s) %><br/>
29
32
  <% end -%>
30
33
  </td></tr>
31
- <% if !@site.new_record? %>
34
+ <% if !@site.new_record? && !@site.is_alias? %>
32
35
  <tr><td class='label'><%= _('action') %></td><td id='messages<%= @site[:id] %>'>
33
36
  <ul>
34
37
  <% Site::ACTIONS.each do |action| %>
@@ -1,14 +1,20 @@
1
1
  <tr id='site<%= li[:id] %>'>
2
- <td class='icon'><%= link_to_remote(_('site_img'),
2
+ <td class='icon'><%= link_to_remote(li.master_id ? _('alias_img') : _('site_img'),
3
3
  :update =>"site#{li[:id]}",
4
4
  :url => edit_site_path(li),
5
5
  :method => :get) %></td>
6
- <% [:host, :name, :languages, :default_lang].each do |sym| -%>
7
- <td class="<%= sym %>"><%= li[sym] %></td>
8
- <% end -%>
9
- <td class='public_group'><%= li.public_group.name %></td>
10
- <td class='site_group' ><%= li.site_group.name %></td>
11
- <td class='api_group' ><%= li.api_group ? li.api_group.name : _('no API') %></td>
12
- <td class='redit_time' ><%= li.redit_time %></td>
13
- <td class='options'><%= Site.attributes_for_form[:bool].reject{|sym| !li.send(sym)}.join(', ') %></td>
6
+ <td class="name"><%= li.host %></td>
7
+ <% if !li.master_id %>
8
+ <td class='root'><%= li.root_node.title.limit(10) %></td>
9
+ <% [:languages, :default_lang].each do |sym| -%>
10
+ <td class="<%= sym %>"><%= li[sym] %></td>
11
+ <% end -%>
12
+ <td class='public_group'><%= li.public_group.name %></td>
13
+ <td class='site_group' ><%= li.site_group.name %></td>
14
+ <td class='api_group' ><%= li.api_group ? li.api_group.name : _('no API') %></td>
15
+ <td class='redit_time' ><%= li.redit_time %></td>
16
+ <td class='options'><%= Site.attributes_for_form(li.is_alias?)[:bool].reject{|sym| !li.send(sym)}.join(', ') %></td>
17
+ <% else %>
18
+ <td colspan='8' class='root'><%= li.root_node.title %></td>
19
+ <% end -%>
14
20
  </tr>
@@ -12,5 +12,8 @@ end %>
12
12
  <td class="login"><%= li.is_anon? ? '<i>public</i>' : li.login %></td>
13
13
  <td class="fullname" ><a href='<%= zen_path(li.node) %>'><%= li.node ? li.node.title : '' %></a></td>
14
14
  <td class="login"><%= _(User::Num_to_status[li.status].to_s) %></td>
15
+ <% if Bricks::CONFIG['activity'] %>
16
+ <td class="seen_at"><%= format_date(li.seen_at, :format =>_(Zena::Use::Dates::DATETIME)) %></td>
17
+ <% end %>
15
18
  <td class="groups"><%= li.groups.map {|g| g.name }.join(', ') %></td>
16
19
  </tr>
@@ -1,7 +1,7 @@
1
1
  <h2 class='title'><%= _('users') %></h2>
2
2
 
3
3
  <table id='user_list' class='admin' cellspacing="0">
4
- <tr><th class='nav' colspan='5'><%= will_paginate @users %></th></tr>
4
+ <tr><th class='nav' colspan='6'><%= will_paginate @users %></th></tr>
5
5
  <%= render :partial=>'users/li', :collection=>@users %>
6
6
  <%= render :partial=>'users/add', :locals=>{:groups=>@groups} %>
7
7
  </table>
@@ -28,7 +28,7 @@
28
28
  <td class='label'><%= _('kpath') %></td>
29
29
  <td><b><%= @virtual_class.kpath %></b></td>
30
30
  </tr>
31
- <tr><td class='label'><%= _('superclass')%></td><td><%= select('virtual_class', 'superclass', Node.classes_for_form(:without => ((@virtual_class.new_record? || @virtual_class.kind_of?(Role)) ? nil : @virtual_class.to_s)), :selected => @virtual_class.superclass.to_s ) %></td></tr>
31
+ <tr><td class='label'><%= _('superclass')%></td><td><%= select('virtual_class', 'superclass', ['']+Node.classes_for_form(:without => ((@virtual_class.new_record? || @virtual_class.kind_of?(Role)) ? nil : @virtual_class.to_s)), :selected => (@virtual_class.superclass.kind_of?(VirtualClass) ? @virtual_class.superclass.to_s : '') ) %></td></tr>
32
32
 
33
33
  <% if @virtual_class.kind_of?(VirtualClass) -%>
34
34
  <% Zena::Use::Fulltext::FULLTEXT_FIELDS.reverse_each do |fld| -%>
@@ -1,2 +1 @@
1
- Zena.use Bricks::Acls
2
- Site::CLEANUP_SQL.unshift ['acls', 'site_id = ?']
1
+ Site::CLEANUP_SQL.unshift ['acls', 'site_id = ?']
@@ -10,3 +10,7 @@ Reference:
10
10
  Contact:
11
11
  kpath: NRC
12
12
  real_class: Node
13
+
14
+ Note:
15
+ kpath: NN
16
+ real_class: Note
@@ -0,0 +1,24 @@
1
+ module Bricks
2
+ module Activity
3
+ module ControllerMethods
4
+ def self.included(base)
5
+ base.class_eval do
6
+ alias_method_chain :set_visitor, :activity
7
+ end
8
+ end
9
+
10
+ def set_visitor_with_activity
11
+ set_visitor_without_activity
12
+ Zena::Db.set_attribute(visitor, 'seen_at', Time.now.utc)
13
+ end
14
+ end # ControllerMethods
15
+
16
+ module UserMethods
17
+ def self.included(base)
18
+ base.class_eval do
19
+ safe_method :seen_at => Time
20
+ end
21
+ end
22
+ end # UserMethods
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ class AddActivityToUser < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :users, :seen_at, :datetime
4
+ end
5
+
6
+ def self.down
7
+ remove_column :users, :seen_at
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/../../../../../test/test_helper'
2
+
3
+ class ActivityIntegrationTest < Zena::Integration::TestCase
4
+
5
+ context 'A visitor' do
6
+ setup do
7
+ $_test_site = 'test.host'
8
+ end
9
+
10
+ context 'with normal access' do
11
+ setup do
12
+ post 'http://test.host/session', :login=>'ant', :password=>'ant'
13
+ assert_redirected_to 'http://test.host/oo'
14
+ end
15
+
16
+ should 'not set seen_at on login' do
17
+ assert_equal nil, users(:ant).seen_at
18
+ end
19
+
20
+ should 'set seen_at on get' do
21
+ before = Time.now.utc.to_i
22
+ get 'http://test.host/oo'
23
+ after = Time.now.utc.to_i
24
+ seen_at = users(:ant).seen_at.to_i
25
+ assert (before <= seen_at) && (seen_at <= after)
26
+ end
27
+ end # with normal access
28
+ end # a visitor
29
+ end
@@ -1,6 +1,3 @@
1
- require 'bricks/captcha'
2
- Zena.use Bricks::Captcha
3
-
4
1
  # TODO change 'asset_method' to Zena::Use.zazen_tag 'email' => :zazen_email
5
2
  Zena::Use::Zazen::ViewMethods.asset_method 'email' => :email_asset
6
3
 
@@ -1,5 +1,5 @@
1
1
  module Bricks
2
- module Fs_skin
2
+ module FsSkin
3
3
  ELEM = "([a-zA-Z_]+)"
4
4
  ELEM_REGEXP = %r{^#{ELEM}$}
5
5
  SECURE_PATH_REGEXP = %r{^[a-zA-Z_/\-\+]+$}
@@ -74,7 +74,7 @@ module Bricks
74
74
  end
75
75
 
76
76
  # We move this method here so that we do not need to reference
77
- # Bricks::Fs_skin in I18n when fs_skin brick is disabled.
77
+ # Bricks::FsSkin in I18n when fs_skin brick is disabled.
78
78
  def base.text_from_fs_skin(brick_name, skin_name, path, opts)
79
79
  if path =~ SECURE_PATH_REGEXP
80
80
  fullpath = "$#{brick_name}-#{skin_name}/#{path}"
@@ -186,5 +186,5 @@ module Bricks
186
186
  end
187
187
  end
188
188
  end # SiteMethods
189
- end # Fs_skin
189
+ end # FsSkin
190
190
  end # Bricks
@@ -59,7 +59,7 @@
59
59
  <div style="clear: both;"> </div>
60
60
 
61
61
  <div id="footer">
62
- &copy; Copyright <a href="#">Fs_skin blog</a> | <r:zena type='made'/> | <r:login_link/>
62
+ &copy; Copyright <a href="#">FsSkin blog</a> | <r:zena type='made'/> | <r:login_link/>
63
63
  </div>
64
64
  </div>
65
65
  </body>
@@ -9,11 +9,11 @@ namespace :fs_skin do
9
9
  if ENV['HOST']
10
10
  sites = [Site.find_by_host(ENV['HOST'])]
11
11
  else
12
- sites = Site.all
12
+ sites = Site.master_sites
13
13
  end
14
14
 
15
15
  sites.each do |site|
16
- Thread.current[:visitor] = site.any_admin
16
+ setup_visitor(site.any_admin, site)
17
17
  if ENV['WORKER'] == 'false' || RAILS_ENV == 'test'
18
18
  # We avoid SiteWorker.
19
19
  site.rebuild_fs_skin_index
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../../../../../test/test_helper'
2
2
 
3
- class Fs_skinIntegrationTest < Zena::Integration::TestCase
3
+ class FsSkinIntegrationTest < Zena::Integration::TestCase
4
4
 
5
5
  context 'A page using a fs_skin Skin' do
6
6
  subject do
@@ -23,7 +23,7 @@ class Fs_skinIntegrationTest < Zena::Integration::TestCase
23
23
  should 'use fs_skin template' do
24
24
  get "http://test.host/en/blog#{subject.zip}.html"
25
25
  assert_response :success
26
- assert_match %r{Copyright <a href="#">Fs_skin blog</a>}, response.body
26
+ assert_match %r{Copyright <a href="#">FsSkin blog</a>}, response.body
27
27
  end
28
28
  end # with normal access
29
29
  end # A page using a fs_skin Skin
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../../../../../test/test_helper'
2
2
 
3
- class Fs_skinTest < Zena::Unit::TestCase
3
+ class FsSkinTest < Zena::Unit::TestCase
4
4
 
5
5
  context 'A Skin' do
6
6
  setup do
@@ -1,4 +1 @@
1
- require 'bricks/math'
2
-
3
- Zena.use Bricks::Math
4
1
  Zena::Use::Zazen::ViewMethods.asset_method 'math' => :math_asset
@@ -1,5 +1 @@
1
- require 'bricks/pdf'
2
-
3
- Bricks::Pdf.engine = Bricks::CONFIG['pdf']['engine']
4
-
5
- Zena.use Bricks::Pdf
1
+ Bricks::Pdf.engine = Bricks::CONFIG['pdf']['engine']
@@ -14,5 +14,3 @@ class Delayed::Job
14
14
  self[:site_id] = current_site[:id]
15
15
  end
16
16
  end
17
-
18
- Zena.use Bricks::Worker
@@ -0,0 +1,13 @@
1
+ class AddMasterIdToSite < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :sites, :master_id, :integer
4
+ # The id of the node without parent
5
+ add_column :sites, :orphan_id, :integer
6
+ execute "UPDATE sites SET orphan_id = root_id"
7
+ end
8
+
9
+ def self.down
10
+ remove_column :sites, :master_id
11
+ remove_column :sites, :orphan_id
12
+ end
13
+ end