lolita 3.2.0.rc.6 → 3.2.0.rc.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/History.rdoc +8 -3
  2. data/README.md +0 -5
  3. data/VERSION +1 -1
  4. data/app/assets/images/lolita/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  5. data/app/assets/images/lolita/jquery-ui/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  6. data/app/assets/images/lolita/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  7. data/app/assets/images/lolita/jquery-ui/images/ui-bg_highlight-soft_45_676767_1x100.png +0 -0
  8. data/app/assets/images/lolita/jquery-ui/images/ui-bg_highlight-soft_75_e3e3e3_1x100.png +0 -0
  9. data/app/assets/images/lolita/jquery-ui/images/ui-bg_highlight-soft_85_f3f3f3_1x100.png +0 -0
  10. data/app/assets/images/lolita/jquery-ui/images/ui-bg_inset-hard_100_d7d7d7_1x100.png +0 -0
  11. data/app/assets/images/lolita/jquery-ui/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  12. data/app/assets/images/lolita/jquery-ui/images/ui-icons_7ac1ed_256x240.png +0 -0
  13. data/app/assets/images/lolita/jquery-ui/images/ui-icons_a1a1a1_256x240.png +0 -0
  14. data/app/assets/images/lolita/jquery-ui/images/ui-icons_cd0a0a_256x240.png +0 -0
  15. data/app/assets/images/lolita/jquery-ui/images/ui-icons_d8e7f3_256x240.png +0 -0
  16. data/app/assets/images/lolita/large-ajax-loader.gif +0 -0
  17. data/app/assets/images/lolita/small-ajax-loader.gif +0 -0
  18. data/app/assets/images/lolita/trash-small.png +0 -0
  19. data/app/assets/javascripts/lolita/main.js +3 -1
  20. data/app/assets/javascripts/lolita/tab.js +46 -35
  21. data/app/assets/stylesheets/lolita/application.css +1 -1
  22. data/app/assets/stylesheets/lolita/jquery-ui-1.8.16.lolita.css.erb +568 -0
  23. data/app/assets/stylesheets/lolita/style.css.erb +10 -0
  24. data/app/controllers/lolita/field_data_controller.rb +13 -9
  25. data/app/controllers/lolita/info_controller.rb +12 -1
  26. data/app/views/components/lolita/configuration/column/_header.html.erb +1 -1
  27. data/app/views/components/lolita/configuration/column/_sort.html.erb +7 -4
  28. data/app/views/components/lolita/configuration/field/_display.html.erb +12 -10
  29. data/app/views/components/lolita/configuration/field/array/_display.html.erb +1 -1
  30. data/app/views/components/lolita/configuration/field/array/autocomplete/_display.html.haml +14 -0
  31. data/app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml +19 -0
  32. data/app/views/components/lolita/configuration/field/array/{habtm → checkbox}/_display.html.haml +0 -0
  33. data/app/views/components/lolita/configuration/list/_new_resource.html.erb +6 -4
  34. data/app/views/components/lolita/configuration/nested_form/_display.html.erb +8 -6
  35. data/app/views/components/lolita/configuration/tab/_error_msg.html.erb +10 -4
  36. data/app/views/components/lolita/navigation/_tree.html.erb +2 -0
  37. data/app/views/components/lolita/shared/_right_sidebar.html.erb +1 -6
  38. data/app/views/components/lolita/shared/_save_button.html.erb +6 -0
  39. data/config/routes.rb +1 -1
  40. data/lib/lolita.rb +5 -0
  41. data/lib/lolita/adapter/active_record.rb +17 -13
  42. data/lib/lolita/adapter/mongoid.rb +21 -17
  43. data/lib/lolita/configuration/base.rb +15 -2
  44. data/lib/lolita/configuration/column.rb +25 -2
  45. data/lib/lolita/configuration/field.rb +24 -1
  46. data/lib/lolita/configuration/field/array.rb +33 -9
  47. data/lib/lolita/configuration/search.rb +1 -0
  48. data/lib/lolita/controllers/authorization_helpers.rb +1 -1
  49. data/lib/lolita/controllers/internal_helpers.rb +17 -3
  50. data/lib/lolita/hooks.rb +33 -5
  51. data/lib/lolita/lazy_loader.rb +3 -0
  52. data/lib/lolita/mapping.rb +13 -2
  53. data/lib/lolita/navigation/branch.rb +13 -11
  54. data/lib/lolita/rails.rb +1 -0
  55. data/lib/lolita/rails/routes.rb +3 -1
  56. data/lib/lolita/search/simple.rb +1 -2
  57. data/lolita.gemspec +23 -6
  58. data/spec/configuration/field_spec.rb +17 -0
  59. data/vendor/assets/javascripts/application_vendor_lolita.js +1 -0
  60. data/vendor/assets/javascripts/jquery-numeric.js +280 -0
  61. metadata +60 -43
  62. data/app/views/components/lolita/configuration/field/array/habtm_autocomplete/_display.html.haml +0 -11
  63. data/lolita.gemspec.orig +0 -434
  64. data/vendor/assets/javascripts/jquery-ui-1.8.13.min.js +0 -407
@@ -1,6 +1,7 @@
1
1
  html,body{
2
2
  height: 100%;
3
3
  }
4
+ *:focus {outline: none;}
4
5
  body {background: #f3f3f3; font-size: 13px;}
5
6
 
6
7
  a, a:visited, a:active {color: #7ac1ed; text-decoration: none;}
@@ -57,6 +58,7 @@ header nav .username {margin-right: 15px;}
57
58
  #main .box form input {background: #FFF;}
58
59
  #main .box form label {color: #c3c3c3; font-size: 13px;}
59
60
  #main .box form select {min-width: 150px;}
61
+ #main .box form .date_time select {min-width: 50px;}
60
62
  #main .box form .field {margin: 10px 0; overflow: hidden;}
61
63
  #main .box form .field:first-child input {
62
64
  font-size: 24px;
@@ -98,6 +100,10 @@ header nav .username {margin-right: 15px;}
98
100
  padding-bottom: 5px;
99
101
  border-bottom: 1px dashed #DDD;
100
102
  }
103
+ #main .box form .nested_form.simple .nested-form-fields-container{
104
+ max-height: 100px;
105
+ overflow: auto;
106
+ }
101
107
  #main .box form .nested_form p {margin-left: 50px;}
102
108
  #main .box form .nested_form input {
103
109
  border: 1px solid #cdcdcd;
@@ -123,6 +129,10 @@ header nav .username {margin-right: 15px;}
123
129
  margin: 5px 0;
124
130
  padding-bottom: 5px;
125
131
  border-bottom: 1px dashed #DDD;
132
+ overflow: hidden;
133
+ }
134
+ .autocomplete-container ul li a {
135
+ float: right;
126
136
  }
127
137
  .ui-menu .ui-menu-item a {
128
138
  font-size: 10px;
@@ -19,14 +19,18 @@ class Lolita::FieldDataController < ApplicationController
19
19
  end
20
20
 
21
21
  def autocomplete_field
22
- model = params[:class].singularize.camelize.constantize
23
- column = model.lolita.tabs.first.fields.first.name.to_sym
24
- data = model.where(model.arel_table[column].matches("%#{params[:term]}%")).map do |record|
25
- {:id => record.id,
26
- :value => record.send(column),
27
- :name => "#{params[:field_class].downcase}[#{params[:class].singularize}_ids][]",
28
- :delete_link => I18n.t("lolita.shared.delete")}
29
- end
30
- render :json => data
22
+ klass = params[:field_class].camelize.constantize
23
+ field = klass.lolita.tabs.fields.detect{|field| field.name.to_s == params[:field_name]}
24
+ data = if field
25
+ (field.search || field.create_search(true)).run(params[:term],request).map do |record|
26
+ {
27
+ :id => record.id,
28
+ :value => record.send(field.current_text_method(field.association.klass)),
29
+ :name => "#{params[:field_class].downcase}[#{params[:field_name].singularize}_ids][]",
30
+ :delete_link => I18n.t("lolita.shared.delete").to_s.downcase
31
+ }
32
+ end
33
+ end
34
+ render :json => data || {}
31
35
  end
32
36
  end
@@ -1,9 +1,16 @@
1
1
  class Lolita::InfoController < ApplicationController
2
2
  @@properties = []
3
+ include Lolita::Controllers::UserHelpers
4
+ include Lolita::Controllers::AuthorizationHelpers
5
+ before_filter :authenticate_lolita_user!, :only => [:index]
3
6
 
4
7
  def index
5
8
  if Lolita.mappings.any?
6
- return redirect_to(lolita_resources_path(Lolita.mappings.values.first))
9
+ available_mapping = Lolita.mappings.detect{|name,mapping|
10
+ can?(:read,mapping.to)
11
+ }
12
+ available_mapping &&= available_mapping.last
13
+ return redirect_to(lolita_resources_path(available_mapping)) if available_mapping
7
14
  end
8
15
  render :layout => false
9
16
  end
@@ -16,6 +23,10 @@ class Lolita::InfoController < ApplicationController
16
23
  end
17
24
  end
18
25
 
26
+ def is_lolita_resource?
27
+ true
28
+ end
29
+
19
30
  private
20
31
 
21
32
  def self.property(name, value = nil)
@@ -1,4 +1,4 @@
1
- <th <%=column.currently_sorting?(params) ? "class='active'" : ""%> >
1
+ <th >
2
2
  <% if column.sortable? %>
3
3
  <%= render_component column, :sort %>
4
4
  <% else %>
@@ -1,4 +1,7 @@
1
- <% param_options=params.reject{|k,v| [:controller,:action].include?(k)} %>
2
- <% options=param_options.merge(column.sort_options(params)) %>
3
- <% direction_indicator=column.currently_sorting?(params) && options[:sd].to_s=="desc" ? raw('&uArr;') : raw('&dArr;') %>
4
- <%= link_to raw("#{column.title.to_s.capitalize } #{direction_indicator}"), lolita_resources_path(options) %>
1
+ <%
2
+ sort_mapping = {"desc" => '&dArr;', "asc" => '&uArr;'}
3
+ new_params = params.reject{|k,v| ["controller","action"].include?(k.to_s)}
4
+ direction_indicator = raw(sort_mapping[column.current_sort_state(new_params)[1]])
5
+ new_params[:s] = column.sort_params(new_params)
6
+ %>
7
+ <%= link_to raw("#{column.title.to_s.capitalize} #{direction_indicator}"), lolita_resources_path(new_params) %>
@@ -1,11 +1,13 @@
1
- <div class="field <%= field.type %>" id="field_<%=field.__id__%>">
2
- <% unless field.type == "hidden" %>
3
- <%= render_component *field.build(:name=>"/lolita/configuration/field", :state => :"label") %>
4
- <% end %>
5
- <div class="field-value" id="field_<%=field.__id__%>_value">
6
- <%= render_component *field.build %>
1
+ <% if field.match_state_of?(resource) %>
2
+ <div class="field <%= field.type %>" id="field_<%=field.__id__%>">
3
+ <% unless field.type == "hidden" %>
4
+ <%= render_component *field.build(:name=>"/lolita/configuration/field", :state => :"label") %>
5
+ <% end %>
6
+ <div class="field-value" id="field_<%=field.__id__%>_value">
7
+ <%= render_component *field.build %>
8
+ </div>
9
+ <% unless resource.errors[field.name.to_s.gsub(/_id$/,"").to_sym].empty? %>
10
+ <p class="inline-errors"><%= raw resource.errors[field.name.to_s.gsub(/_id$/,"").to_sym].join("<br>") %></p>
11
+ <% end %>
7
12
  </div>
8
- <% unless resource.errors[field.name.to_s.gsub(/_id$/,"").to_sym].empty? %>
9
- <p class="inline-errors"><%= raw resource.errors[field.name.to_s.gsub(/_id$/,"").to_sym].join("<br>") %></p>
10
- <% end %>
11
- </div>
13
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  <% if field.association && field.association.macro == :one %>
2
2
  <%= render_component :"lolita/configuration/field/array/select", :display, :field=>field %>
3
3
  <% else %>
4
- <%= render_component :"lolita/configuration/field/array/habtm", :display, :field=>field %>
4
+ <%= render_component :"lolita/configuration/field/array/autocomplete", :display, :field=>field %>
5
5
  <% end %>
@@ -0,0 +1,14 @@
1
+ .autocomplete-container
2
+ - if field.association.macro == :one
3
+ = tab_form.hidden_field field.association.key
4
+ = render_component *field.build(:state => "input", :with_value => true)
5
+ - else
6
+ - ids_method = field.name.to_s.match(/_ids$/) ? field.name : "#{field.name.to_s.singularize}_ids"
7
+ = hidden_field_tag "#{resource_name}[#{ids_method}][]",""
8
+ = render_component *field.build(:state => "input")
9
+ %ul
10
+ - resource.persisted? && resource.send(field.name).each do |record|
11
+ %li
12
+ = record.send(field.current_text_method(field.association.klass))
13
+ = link_to I18n.t("lolita.shared.delete").downcase, nil
14
+ = hidden_field_tag "#{resource_name}[#{ids_method}][]", record.id
@@ -0,0 +1,19 @@
1
+ - # Set variables, f_cached - recod has methods that keeps cached names, f_name - field name or some other name, if there is no
2
+ - # need to store autocomplete field information, f_url - request url for search, f_value - value for autocomplete input,
3
+ - # f_options - html options for input are used in js.
4
+
5
+ - f_cached = field.dbi.klass.respond_to?(:"cached_#{field.name}")
6
+ - f_name = f_cached ? "cached_#{field.name}" : "autocomplete-#{resource_name}-#{field.name}"
7
+ - f_url = autocomplete_field_path(:field_class => resource_class.to_s, :field_name => field.name)
8
+
9
+ - f_value = if local_assigns[:with_value]
10
+ - tab_form.object.send(field.association.name) && tab_form.object.send(field.association.name).send(field.current_text_method(field.association.klass))
11
+ - else
12
+ - nil
13
+
14
+ - f_options = {:"data-autocomplete-url" => f_url, :"data-macro" => field.association.macro, :"data-cached" => f_cached ? "yes" : "no"}
15
+
16
+ - if f_cached
17
+ = tab_form.text_field f_name, f_options
18
+ - else
19
+ = text_field_tag f_name, f_value, f_options
@@ -1,4 +1,6 @@
1
- <a href="<%= new_lolita_resource_path%>" class="create">
2
- <%= ::I18n.t("lolita.list.add_new",:name=>resource_class.model_name.human.downcase) %>
3
- <%= image_tag "lolita/plus.png", :alt=>"+" %>
4
- </a>
1
+ <% if can?(:create,resource_class)
2
+ <a href="<%= new_lolita_resource_path%>" class="create">
3
+ <%= ::I18n.t("lolita.list.add_new",:name=>resource_class.model_name.human.downcase) %>
4
+ <%= image_tag "lolita/plus.png", :alt=>"+" %>
5
+ </a>
6
+ <% end %>
@@ -1,12 +1,14 @@
1
- <div class="nested_form" id=<%= "nested_form_#{nested_form.__id__}" %>>
1
+ <div class="nested_form <%=nested_form.field_style%>" id=<%= "nested_form_#{nested_form.__id__}" %>>
2
2
  <% unless nested_form.field_style == :normal %>
3
3
  <%= render_component *nested_form.as_field.build(:name=>"/lolita/configuration/field", :state => :"label") %>
4
4
  <% end %>
5
- <%= tab_form.fields_for nested_form.name, resource.send(nested_form.build_method) do |form| %>
6
- <% tab_form(form) do %>
7
- <%= render_component nested_form, :fields %>
8
- <% end %>
9
- <% end %>
5
+ <div class="nested-form-fields-container">
6
+ <%= tab_form.fields_for nested_form.name, resource.send(nested_form.build_method) do |form| %>
7
+ <% tab_form(form) do %>
8
+ <%= render_component nested_form, :fields %>
9
+ <% end %>
10
+ <% end %>
11
+ </div>
10
12
  <% if nested_form.expandable? && !nested_form.update_only? %>
11
13
  <p><%= link_to_add_fields ::I18n.t("lolita.nested_form.add", :resource_name => nested_form.klass.model_name.human.downcase), tab_form, nested_form %> </p>
12
14
  <% end %>
@@ -3,12 +3,18 @@
3
3
  <%= raw resource.errors.keys.collect{|k|
4
4
  title = if k.to_s.match(/\./)
5
5
  assoc_name, attr_name = k.to_s.split(".")
6
- klass = resource.lolita.dbi.reflect_on_association(assoc_name.to_sym).klass
7
- klass.human_attribute_name(attr_name).downcase
6
+ if tab.fields.by_name(attr_name.to_sym)
7
+ klass = resource.lolita.dbi.reflect_on_association(assoc_name.to_sym).klass
8
+ klass.human_attribute_name(attr_name).downcase
9
+ end
8
10
  else
9
- resource.class.human_attribute_name(k)
11
+ if tab.fields.by_name(k.to_sym)
12
+ resource.class.human_attribute_name(k)
13
+ end
14
+ end
15
+ if title && resource.errors[k] && resource.errors[k].respond_to?(:any?) && resource.errors[k].any?
16
+ "#{title.to_s.capitalize}: #{resource.errors[k].join(" #{::I18n.t("lolita.shared.and")} ")}"
10
17
  end
11
- "#{title.to_s.capitalize}: #{resource.errors[k].join(" #{::I18n.t("lolita.shared.and")} ")}"
12
18
  }.compact.join("<br>") %>
13
19
  </p>
14
20
  <% end %>
@@ -11,7 +11,9 @@
11
11
  end
12
12
  end
13
13
  end %>
14
+
14
15
  <% visible ||= (tree.root? || nil) %>
16
+
15
17
  <% if tree.visible?(self) %>
16
18
  <ul <%= !tree.root? ? "class='subtree'" : ""%> style="display:<%=visible ? "block" : "none"%>" >
17
19
  <% last_branch=tree.branches.last %>
@@ -4,11 +4,6 @@
4
4
  <h1><%= t "lolita.tabs.save" %></h1>
5
5
  <div class="arrow"></div>
6
6
  </div>
7
- <div class="save black">
8
- <div class="last-save">
9
- <%= resource.updated_at.strftime("#{t("lolita.tabs.last_save")}: %m/%d/%Y %H:%M ") if resource.respond_to?(:updated_at) && resource.updated_at %>
10
- </div>
11
- <button class="save-all"><%=::I18n.t("lolita.tabs.save")%></button>
12
- </div>
7
+ <%= render_component "lolita/shared", :save_button%>
13
8
  </div>
14
9
  </div>
@@ -0,0 +1,6 @@
1
+ <div class="save black">
2
+ <div class="last-save">
3
+ <%= resource.updated_at.strftime("#{t("lolita.tabs.last_save")}: %m/%d/%Y %H:%M ") if resource.respond_to?(:updated_at) && resource.updated_at %>
4
+ </div>
5
+ <button class="save-all"><%=::I18n.t("lolita.tabs.save")%></button>
6
+ </div>
data/config/routes.rb CHANGED
@@ -2,5 +2,5 @@ Rails.application.routes.draw do
2
2
  match '/lolita' => "lolita/info#index"
3
3
  match '/lolita/info/properties' => "lolita/info#properties"
4
4
  match "/lolita/array_field/:name/:field_class/:class/:id" => "lolita/field_data#array_polymorphic", :as => "array_field_data_collector"
5
- match "/lolita/autocomplete_field/:field_class/:class" => "lolita/field_data#autocomplete_field", :as => "autocomplete_field"
5
+ match "/lolita/autocomplete_field/:field_class/:field_name" => "lolita/field_data#autocomplete_field", :as => "autocomplete_field"
6
6
  end
data/lib/lolita.rb CHANGED
@@ -60,6 +60,7 @@ module Lolita
60
60
 
61
61
  # Keep all configuration classes and modules, that is used to configure classes with lolita.
62
62
  module Configuration
63
+
63
64
  autoload :Base, 'lolita/configuration/base'
64
65
  autoload :Column, 'lolita/configuration/column'
65
66
  autoload :Columns, 'lolita/configuration/columns'
@@ -98,6 +99,9 @@ module Lolita
98
99
 
99
100
  def self.included(base)
100
101
  base.class_eval do
102
+ include Lolita::Hooks
103
+ add_hook :after_lolita_loaded
104
+
101
105
  extend ClassMethods
102
106
  def lolita
103
107
  self.class.lolita
@@ -109,6 +113,7 @@ module Lolita
109
113
  def lolita(&block)
110
114
  Lolita::LazyLoader.lazy_load(self,:@lolita,Lolita::Configuration::Base,self,&block)
111
115
  end
116
+
112
117
  def lolita=(value)
113
118
  if value.is_a?(Lolita::Configuration::Base)
114
119
  @lolita=value
@@ -202,21 +202,25 @@ module Lolita
202
202
 
203
203
  def search(query, options = {})
204
204
  #TODO raise error or warn when there are lot of records and no index on field
205
- resources = self.klass.arel_table
206
- content_fields = @dbi.fields.map{|field| field.type!="string" ? nil : field.name.to_sym}.compact
207
- if options[:fields] && options[:fields].any?
208
- content_fields = content_fields & options[:fields]
209
- end
210
- scope = nil
211
- content_fields.each_with_index do |field,index|
212
- new_scope = resources[field].matches("%#{query}%")
213
- unless index == 0
214
- scope = scope.or(new_scope)
215
- else
216
- scope = new_scope
205
+ unless query.blank?
206
+ resources = self.klass.arel_table
207
+ content_fields = @dbi.fields.map{|field| field.type!="string" ? nil : field.name.to_sym}.compact
208
+ if options[:fields] && options[:fields].any?
209
+ content_fields = content_fields & options[:fields]
217
210
  end
211
+ scope = nil
212
+ content_fields.each_with_index do |field,index|
213
+ new_scope = resources[field].matches("%#{query}%")
214
+ unless index == 0
215
+ scope = scope.or(new_scope)
216
+ else
217
+ scope = new_scope
218
+ end
219
+ end
220
+ self.klass.where(scope)
221
+ else
222
+ self.klass.where(nil)
218
223
  end
219
- self.klass.where(scope)
220
224
  end
221
225
 
222
226
  def db
@@ -185,25 +185,29 @@ module Lolita
185
185
  end
186
186
 
187
187
  def search(query, options = {})
188
- content_fields = @dbi.fields.map{|field|
189
- if field.type!="string" || field.name.match(/^_/)
190
- nil
191
- else
192
- field.name.to_sym
188
+ unless query.blank?
189
+ content_fields = @dbi.fields.map{|field|
190
+ if field.type!="string" || field.name.match(/^_/)
191
+ nil
192
+ else
193
+ field.name.to_sym
194
+ end
195
+ }.compact
196
+ if options[:fields] && options[:fields].any?
197
+ content_fields = content_fields & options[:fields]
193
198
  end
194
- }.compact
195
- if options[:fields] && options[:fields].any?
196
- content_fields = content_fields & options[:fields]
197
- end
198
- content_fields = content_fields.slice(0..3)
199
- #result = self.map_reduce_search(content_fields,query)
200
- #debugger
201
- #result
202
- where_hash = {}
203
- content_fields.each do |field|
204
- where_hash[field] = /#{Regexp.escape(query.to_s)}/
199
+ content_fields = content_fields.slice(0..3)
200
+ #result = self.map_reduce_search(content_fields,query)
201
+ #debugger
202
+ #result
203
+ where_hash = {}
204
+ content_fields.each do |field|
205
+ where_hash[field] = /#{Regexp.escape(query.to_s)}/
206
+ end
207
+ klass.where(where_hash)
208
+ else
209
+ klass.where(nil)
205
210
  end
206
- klass.where(where_hash)
207
211
  end
208
212
 
209
213
  #FIXME
@@ -15,9 +15,11 @@ module Lolita
15
15
 
16
16
  attr_reader :dbi,:klass
17
17
  @@generators=[:tabs,:list]
18
+
18
19
  class << self
20
+
19
21
  def add_generator(method)
20
- @@generators<<method.to_sym
22
+ @@generators<<method.to_sym
21
23
  end
22
24
  end
23
25
  # When configuration is defined in class than you don't need to worry about
@@ -38,6 +40,7 @@ module Lolita
38
40
  # Person.lolita=Lolita::Configuration::Base.new(Person)
39
41
  # Person.lolita.klass #=> Person
40
42
  def initialize(orm_class,&block)
43
+ @in_callback_mode = false
41
44
  @klass=orm_class
42
45
  @dbi=Lolita::DBI::Base.create(orm_class)
43
46
  block_given? ? self.instance_eval(&block) : self.generate!
@@ -50,6 +53,10 @@ module Lolita
50
53
  Lolita::LazyLoader.lazy_load(self,:@list,Lolita::Configuration::List,@dbi,&block)
51
54
  end
52
55
 
56
+ def list=(new_list)
57
+ @list = new_list if new_list.is_a?(Lolita::Configuration::List)
58
+ end
59
+
53
60
  # Create collection of Lolita::Configuration::Tab, loading lazy.
54
61
  # See Lolita::Configuration::Tabs for details.
55
62
  def tabs &block
@@ -69,7 +76,13 @@ module Lolita
69
76
  self.send(generator)
70
77
  }
71
78
  end
72
-
79
+
80
+ private
81
+
82
+ def after_initialize
83
+ @dbi.klass.run(:after_lolita_loaded, :once => self)
84
+ end
85
+
73
86
  end
74
87
  end
75
88
  end