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.
- data/History.rdoc +8 -3
- data/README.md +0 -5
- data/VERSION +1 -1
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_highlight-soft_45_676767_1x100.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_highlight-soft_75_e3e3e3_1x100.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_highlight-soft_85_f3f3f3_1x100.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_inset-hard_100_d7d7d7_1x100.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-icons_7ac1ed_256x240.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-icons_a1a1a1_256x240.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/images/lolita/jquery-ui/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/app/assets/images/lolita/large-ajax-loader.gif +0 -0
- data/app/assets/images/lolita/small-ajax-loader.gif +0 -0
- data/app/assets/images/lolita/trash-small.png +0 -0
- data/app/assets/javascripts/lolita/main.js +3 -1
- data/app/assets/javascripts/lolita/tab.js +46 -35
- data/app/assets/stylesheets/lolita/application.css +1 -1
- data/app/assets/stylesheets/lolita/jquery-ui-1.8.16.lolita.css.erb +568 -0
- data/app/assets/stylesheets/lolita/style.css.erb +10 -0
- data/app/controllers/lolita/field_data_controller.rb +13 -9
- data/app/controllers/lolita/info_controller.rb +12 -1
- data/app/views/components/lolita/configuration/column/_header.html.erb +1 -1
- data/app/views/components/lolita/configuration/column/_sort.html.erb +7 -4
- data/app/views/components/lolita/configuration/field/_display.html.erb +12 -10
- data/app/views/components/lolita/configuration/field/array/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/array/autocomplete/_display.html.haml +14 -0
- data/app/views/components/lolita/configuration/field/array/autocomplete/_input.html.haml +19 -0
- data/app/views/components/lolita/configuration/field/array/{habtm → checkbox}/_display.html.haml +0 -0
- data/app/views/components/lolita/configuration/list/_new_resource.html.erb +6 -4
- data/app/views/components/lolita/configuration/nested_form/_display.html.erb +8 -6
- data/app/views/components/lolita/configuration/tab/_error_msg.html.erb +10 -4
- data/app/views/components/lolita/navigation/_tree.html.erb +2 -0
- data/app/views/components/lolita/shared/_right_sidebar.html.erb +1 -6
- data/app/views/components/lolita/shared/_save_button.html.erb +6 -0
- data/config/routes.rb +1 -1
- data/lib/lolita.rb +5 -0
- data/lib/lolita/adapter/active_record.rb +17 -13
- data/lib/lolita/adapter/mongoid.rb +21 -17
- data/lib/lolita/configuration/base.rb +15 -2
- data/lib/lolita/configuration/column.rb +25 -2
- data/lib/lolita/configuration/field.rb +24 -1
- data/lib/lolita/configuration/field/array.rb +33 -9
- data/lib/lolita/configuration/search.rb +1 -0
- data/lib/lolita/controllers/authorization_helpers.rb +1 -1
- data/lib/lolita/controllers/internal_helpers.rb +17 -3
- data/lib/lolita/hooks.rb +33 -5
- data/lib/lolita/lazy_loader.rb +3 -0
- data/lib/lolita/mapping.rb +13 -2
- data/lib/lolita/navigation/branch.rb +13 -11
- data/lib/lolita/rails.rb +1 -0
- data/lib/lolita/rails/routes.rb +3 -1
- data/lib/lolita/search/simple.rb +1 -2
- data/lolita.gemspec +23 -6
- data/spec/configuration/field_spec.rb +17 -0
- data/vendor/assets/javascripts/application_vendor_lolita.js +1 -0
- data/vendor/assets/javascripts/jquery-numeric.js +280 -0
- metadata +60 -43
- data/app/views/components/lolita/configuration/field/array/habtm_autocomplete/_display.html.haml +0 -11
- data/lolita.gemspec.orig +0 -434
- 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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
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,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<%
|
2
|
+
sort_mapping = {"desc" => '⇓', "asc" => '⇑'}
|
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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
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/
|
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
|
data/app/views/components/lolita/configuration/field/array/{habtm → checkbox}/_display.html.haml
RENAMED
File without changes
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
2
|
-
<%=
|
3
|
-
|
4
|
-
|
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
7
|
-
|
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
|
-
|
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 %>
|
@@ -4,11 +4,6 @@
|
|
4
4
|
<h1><%= t "lolita.tabs.save" %></h1>
|
5
5
|
<div class="arrow"></div>
|
6
6
|
</div>
|
7
|
-
|
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/:
|
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
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
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
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
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
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
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
|