lolita 3.1.12 → 3.1.13
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.
- data/History.rdoc +8 -0
- data/VERSION +1 -1
- data/app/controllers/lolita/rest_controller.rb +2 -3
- data/app/views/components/lolita/configuration/field/array/habtm/_display.html.haml +7 -0
- data/app/views/components/lolita/configuration/field/array/select/_display.html.erb +1 -2
- data/app/views/components/lolita/configuration/tab/_fields.html.erb +3 -3
- data/app/views/components/lolita/configuration/tab/_nested_form.html.erb +16 -0
- data/app/views/components/lolita/configuration/tab/default/_display.html.erb +5 -3
- data/app/views/components/lolita/shared/_flash.html.erb +1 -1
- data/app/views/layouts/lolita/application.html.erb +1 -1
- data/lib/lolita.rb +2 -0
- data/lib/lolita/adapter/active_record.rb +1 -1
- data/lib/lolita/configuration/field.rb +1 -1
- data/lib/lolita/configuration/nested_form.rb +26 -0
- data/lib/lolita/configuration/tab.rb +37 -8
- data/lib/lolita/controllers/component_helpers.rb +1 -1
- data/lib/lolita/controllers/internal_helpers.rb +9 -1
- data/lolita.gemspec +10 -7
- data/public/javascripts/lolita/base64.js +1 -0
- data/public/javascripts/lolita/main.js +4 -4
- data/public/stylesheets/lolita/style.css +17 -1
- data/spec/configuration/tab_spec.rb +11 -0
- metadata +36 -35
- data/app/views/components/lolita/configuration/field/array/habtm/_display.html.erb +0 -26
data/History.rdoc
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== Version 3.1.13 / 2011-08-16
|
2
|
+
* Enhancements
|
3
|
+
* Color for Lolita-Alert popup changed
|
4
|
+
* #tab_form method added in lolita helpers
|
5
|
+
* Bug fixes
|
6
|
+
* DBI for AR - method names fixed
|
7
|
+
* Messages encoding bug fixed
|
8
|
+
|
1
9
|
=== Version 3.1.12 / 2011-07-15
|
2
10
|
* Bug fixes
|
3
11
|
* Time convertation from rails time_select fixed.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.13
|
@@ -19,7 +19,6 @@ class Lolita::RestController < ApplicationController
|
|
19
19
|
def create
|
20
20
|
self.run(:before_create)
|
21
21
|
build_resource
|
22
|
-
debugger
|
23
22
|
save_and_redirect
|
24
23
|
end
|
25
24
|
|
@@ -96,13 +95,13 @@ class Lolita::RestController < ApplicationController
|
|
96
95
|
|
97
96
|
def respond_html_200
|
98
97
|
response.headers["Validation"] = 'true'
|
99
|
-
response.headers["Lolita-Notice"] = ::I18n.t "lolita.shared.save_notice"
|
98
|
+
response.headers["Lolita-Notice"] = Base64.encode64(::I18n.t "lolita.shared.save_notice")
|
100
99
|
show_form
|
101
100
|
end
|
102
101
|
|
103
102
|
def respond_html_400
|
104
103
|
response.headers["Validation"] = 'false'
|
105
|
-
response.headers["Lolita-Alert"] = ::I18n.t "lolita.shared.save_alert"
|
104
|
+
response.headers["Lolita-Alert"] = Base64.encode64(::I18n.t "lolita.shared.save_alert")
|
106
105
|
show_form
|
107
106
|
end
|
108
107
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
= hidden_field_tag "#{resource_name}[#{field.name.to_s.singularize}_ids][]",""
|
2
|
+
- field.association_values.call.each do |value|
|
3
|
+
- editors = resource.send(:"#{field.name.to_s.singularize}_ids")
|
4
|
+
.habtm-container
|
5
|
+
= label_tag "#{resource_name}_#{field.name}_#{value.last}",value.first, :class => "habtm-label"
|
6
|
+
= check_box_tag "#{resource_name}[#{field.name.to_s.singularize}_ids][]", value.last, resource.send(field.name).include?(value.last), :id => "#{resource_name}_#{field.name}_#{value.last}", :class => "habtm-checkbox"
|
7
|
+
.clear
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% tab.fields_with_field_set do |fields_or_field,field_set| %>
|
2
2
|
<% if field_set %>
|
3
3
|
<%= render_component :"lolita/configuration/field_set", :display, :fields=>fields_or_field,:field_set=>field_set %>
|
4
|
-
|
4
|
+
<% else %>
|
5
5
|
<%= render_component :"lolita/configuration/field", :display,:field=>fields_or_field %>
|
6
|
-
|
7
|
-
<% end %>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class = "nested-fields" >
|
2
|
+
<%= tab_form.fields_for field.nested_form.resource_name do |nested_form| %>
|
3
|
+
<%
|
4
|
+
old_tab_form = tab_form
|
5
|
+
self.tab_form = nested_form
|
6
|
+
%>
|
7
|
+
<%- fields.each do |field| %>
|
8
|
+
<% if field.is_a?(Array) %>
|
9
|
+
<%# implement fieldset in nested form here%>
|
10
|
+
<% else %>
|
11
|
+
<%= render_component *field.build(field.nested_form.options) %>
|
12
|
+
<% end %>
|
13
|
+
<%- end %>
|
14
|
+
<% self.tab_form = old_tab_form %>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
@@ -2,8 +2,10 @@
|
|
2
2
|
# FIXME: move to /tab_types/
|
3
3
|
#
|
4
4
|
%>
|
5
|
-
<%=
|
5
|
+
<%= form_for resource, :url => "#",:html => {:multipart=>true, :id=>"tab-form-#{tab.__id__}",:method => resource.new_record? ? :post : :put} do |form| %>
|
6
|
+
<% self.tab_form = form %>
|
6
7
|
<div class="tab-content">
|
7
|
-
<%= render_component :"lolita/configuration/tab", :fields, :tab=>tab %>
|
8
|
+
<%= render_component :"lolita/configuration/tab", :fields, :tab=>tab, %>
|
8
9
|
</div>
|
9
|
-
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% self.tab_form = nil %>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
}
|
25
25
|
</script>
|
26
26
|
<%= javascript_include_tag "modernizr-1.7.min" %>
|
27
|
-
<%= javascript_include_tag "rails","lolita/tab","lolita/main","lolita/application" %>
|
27
|
+
<%= javascript_include_tag "rails","lolita/tab","lolita/main","lolita/application", "lolita/base64" %>
|
28
28
|
<%= yield :script %>
|
29
29
|
<%= raw csrf_meta_tag %>
|
30
30
|
</head>
|
data/lib/lolita.rb
CHANGED
@@ -16,6 +16,7 @@ puts "=> Lolita #{LOLITA_VERSION} starting#{defined?(Rails) ? " with Rails" : ""
|
|
16
16
|
# end
|
17
17
|
|
18
18
|
require 'abstract'
|
19
|
+
require "base64"
|
19
20
|
unless defined?(ActiveSupport)
|
20
21
|
require 'active_support/core_ext/numeric/time'
|
21
22
|
require 'active_support/core_ext/date_time/conversions'
|
@@ -69,6 +70,7 @@ module Lolita
|
|
69
70
|
autoload :Page, 'lolita/configuration/page'
|
70
71
|
autoload :Tabs, 'lolita/configuration/tabs'
|
71
72
|
autoload :Filter, 'lolita/configuration/filter'
|
73
|
+
autoload :NestedForm, 'lolita/configuration/nested_form'
|
72
74
|
|
73
75
|
module Field
|
74
76
|
extend Lolita::Configuration::Factory
|
@@ -29,7 +29,7 @@ module Lolita
|
|
29
29
|
include Lolita::Builder
|
30
30
|
|
31
31
|
@@default_type="string"
|
32
|
-
lolita_accessor :name,:title,:field_set,:nested_for,:options, :html_options,:record,:association
|
32
|
+
lolita_accessor :name,:title,:field_set, :nested_form,:nested_for,:options, :html_options,:record,:association
|
33
33
|
attr_reader :dbi,:nested_in
|
34
34
|
|
35
35
|
def initialize dbi, *args, &block
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Lolita
|
2
|
+
module Configuration
|
3
|
+
class NestedForm
|
4
|
+
@@last_nested_form=0
|
5
|
+
|
6
|
+
attr_reader :parent, :options
|
7
|
+
attr_accessor :name
|
8
|
+
|
9
|
+
def initialize parent,name=nil, options ={}
|
10
|
+
@parent=parent
|
11
|
+
@options = options
|
12
|
+
self.name=name || "nested_form_#{next_nested_form}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def fields
|
16
|
+
self.parent.fields.reject{|f| f.nested_form!=self}
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def next_nested_form
|
22
|
+
@@last_nested_form+=1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -26,8 +26,8 @@ module Lolita
|
|
26
26
|
@@available_types=[:content]
|
27
27
|
|
28
28
|
lolita_accessor :title,:name,:type
|
29
|
-
attr_accessor :dbi,:current_fieldset,:current_dbi
|
30
|
-
attr_reader :field_sets,:
|
29
|
+
attr_accessor :dbi,:current_fieldset, :current_nested_form,:current_dbi
|
30
|
+
attr_reader :field_sets,:nested_forms
|
31
31
|
|
32
32
|
# To create new tab the following parametrs need to be provided.
|
33
33
|
# * <tt>dbi</tt> Lolita::DBI::Base object, that represents database.
|
@@ -35,7 +35,8 @@ module Lolita
|
|
35
35
|
# * <tt>&block</tt> Block can be passed, anything in block will be evaled for current instance.
|
36
36
|
def initialize dbi,*args,&block
|
37
37
|
@fields=Lolita::Configuration::Fields.new
|
38
|
-
@field_sets=[]
|
38
|
+
@field_sets = []
|
39
|
+
@nested_forms = []
|
39
40
|
self.dbi=dbi
|
40
41
|
self.current_dbi=dbi
|
41
42
|
self.set_attributes(*args)
|
@@ -49,11 +50,12 @@ module Lolita
|
|
49
50
|
# Return field itself.
|
50
51
|
def field *args, &block
|
51
52
|
field=Lolita::Configuration::Field.add(self.current_dbi,*args,&block)
|
52
|
-
field.field_set=current_fieldset
|
53
|
+
field.field_set = current_fieldset
|
53
54
|
if self.current_dbi!=self.dbi
|
54
55
|
field.nested_in=self.dbi
|
56
|
+
field.nested_form = current_nested_form
|
55
57
|
end
|
56
|
-
@fields<<field
|
58
|
+
@fields << field
|
57
59
|
field
|
58
60
|
end
|
59
61
|
|
@@ -88,11 +90,15 @@ module Lolita
|
|
88
90
|
|
89
91
|
# Add tab nested fields for <em>class_or_name</em> and <em>&block</em>
|
90
92
|
# that will be evaluted in current tab instance.
|
91
|
-
def nested_fields_for class_or_name,&block
|
93
|
+
def nested_fields_for class_or_name, options ={},&block
|
92
94
|
current_class=get_class(class_or_name)
|
95
|
+
nested_form = Lolita::Configuration::NestedForm.new(self,current_class.to_s.downcase, options)
|
96
|
+
self.current_nested_form = nested_form
|
97
|
+
@nested_forms << nested_form
|
93
98
|
self.current_dbi=Lolita::DBI::Base.new(current_class)
|
94
99
|
self.instance_eval(&block)
|
95
100
|
self.current_dbi=self.dbi
|
101
|
+
self.current_nested_form = nil
|
96
102
|
end
|
97
103
|
|
98
104
|
# Return nested field for given <em>class_or_name</em>
|
@@ -107,8 +113,8 @@ module Lolita
|
|
107
113
|
# that will be evaluted in current tab instance.
|
108
114
|
def field_set name,&block
|
109
115
|
field_set=Lolita::Configuration::FieldSet.new(self,name)
|
110
|
-
self.current_fieldset=field_set
|
111
|
-
@field_sets<<field_set
|
116
|
+
self.current_fieldset = field_set
|
117
|
+
@field_sets << field_set
|
112
118
|
self.instance_eval(&block)
|
113
119
|
self.current_fieldset=nil
|
114
120
|
end
|
@@ -126,11 +132,34 @@ module Lolita
|
|
126
132
|
end
|
127
133
|
}
|
128
134
|
end
|
135
|
+
|
129
136
|
# tab.field do
|
130
137
|
# tab.fields_with_fieldset do |field,fieldset|
|
131
138
|
# =field
|
132
139
|
# end
|
133
140
|
|
141
|
+
def fields_by_forms
|
142
|
+
forms = []
|
143
|
+
current_form = nil
|
144
|
+
content = forms
|
145
|
+
self.fields.each do |field|
|
146
|
+
if field.nested_form
|
147
|
+
if current_form != field.nested_form
|
148
|
+
form_fields = []
|
149
|
+
forms << form_fields
|
150
|
+
content = form_fields
|
151
|
+
end
|
152
|
+
content << field
|
153
|
+
end
|
154
|
+
end
|
155
|
+
if block_given?
|
156
|
+
forms.each do |form_or_field|
|
157
|
+
yield form_or_field
|
158
|
+
end
|
159
|
+
else
|
160
|
+
forms
|
161
|
+
end
|
162
|
+
end
|
134
163
|
|
135
164
|
# Set attributes from given <em>*args</em>.
|
136
165
|
# First element of args is used as <i>type</i> other interpreted as options.
|
@@ -32,7 +32,7 @@ module Lolita
|
|
32
32
|
will_use_component name
|
33
33
|
component_name=File.join(name.to_s,state ? state.to_s : nil)
|
34
34
|
partial_name=File.join("/components",component_name)
|
35
|
-
output=output_component(partial_name,component_name,:format=>format,:locals=>options)
|
35
|
+
output=output_component(partial_name,component_name,:format=>format ,:locals=>options)
|
36
36
|
self.respond_to?(:raw) ? raw(output) : output
|
37
37
|
end
|
38
38
|
|
@@ -6,7 +6,7 @@ module Lolita
|
|
6
6
|
helper LolitaHelper
|
7
7
|
#TODO pārnest helperus uz lolitu vai arī uz lolita app nevis likt iekš controllers iekš lolitas
|
8
8
|
helpers = %w(resource resource_name
|
9
|
-
resource_class lolita_mapping show_response)
|
9
|
+
resource_class lolita_mapping show_response tab_form tab_form=)
|
10
10
|
hide_action *helpers
|
11
11
|
|
12
12
|
helper_method *helpers
|
@@ -31,6 +31,14 @@ module Lolita
|
|
31
31
|
def lolita_mapping
|
32
32
|
@lolita_mapping||=request.env["lolita.mapping"]
|
33
33
|
end
|
34
|
+
|
35
|
+
def tab_form=(form)
|
36
|
+
@tab_form = form
|
37
|
+
end
|
38
|
+
|
39
|
+
def tab_form
|
40
|
+
@tab_form
|
41
|
+
end
|
34
42
|
|
35
43
|
protected
|
36
44
|
|
data/lolita.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{lolita}
|
8
|
-
s.version = "3.1.
|
8
|
+
s.version = "3.1.13"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-
|
11
|
+
s.authors = [%q{ITHouse (Latvia) and Arturs Meisters}]
|
12
|
+
s.date = %q{2011-08-17}
|
13
13
|
s.description = %q{Great Rails CMS, that turns your business logic into good-looking, fully functional workspace. }
|
14
14
|
s.email = %q{support@ithouse.lv}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
"app/views/components/lolita/configuration/field/_object.html.erb",
|
47
47
|
"app/views/components/lolita/configuration/field/array/_display.html.erb",
|
48
48
|
"app/views/components/lolita/configuration/field/array/filter/_display.html.erb",
|
49
|
-
"app/views/components/lolita/configuration/field/array/habtm/_display.html.
|
49
|
+
"app/views/components/lolita/configuration/field/array/habtm/_display.html.haml",
|
50
50
|
"app/views/components/lolita/configuration/field/array/select/_display.html.erb",
|
51
51
|
"app/views/components/lolita/configuration/field/big_decimal/_display.html.erb",
|
52
52
|
"app/views/components/lolita/configuration/field/boolean/_display.html.erb",
|
@@ -70,6 +70,7 @@ Gem::Specification.new do |s|
|
|
70
70
|
"app/views/components/lolita/configuration/list/_title.html.erb",
|
71
71
|
"app/views/components/lolita/configuration/tab/_display.html.erb",
|
72
72
|
"app/views/components/lolita/configuration/tab/_fields.html.erb",
|
73
|
+
"app/views/components/lolita/configuration/tab/_nested_form.html.erb",
|
73
74
|
"app/views/components/lolita/configuration/tab/content/_display.html.erb",
|
74
75
|
"app/views/components/lolita/configuration/tab/default/_display.html.erb",
|
75
76
|
"app/views/components/lolita/configuration/tabs/_display.html.erb",
|
@@ -120,6 +121,7 @@ Gem::Specification.new do |s|
|
|
120
121
|
"lib/lolita/configuration/fields.rb",
|
121
122
|
"lib/lolita/configuration/filter.rb",
|
122
123
|
"lib/lolita/configuration/list.rb",
|
124
|
+
"lib/lolita/configuration/nested_form.rb",
|
123
125
|
"lib/lolita/configuration/page.rb",
|
124
126
|
"lib/lolita/configuration/tab.rb",
|
125
127
|
"lib/lolita/configuration/tab/content.rb",
|
@@ -153,6 +155,7 @@ Gem::Specification.new do |s|
|
|
153
155
|
"public/javascripts/jquery-1.6.min.js",
|
154
156
|
"public/javascripts/jquery-ui-1.8.13.min.js",
|
155
157
|
"public/javascripts/lolita/application.js",
|
158
|
+
"public/javascripts/lolita/base64.js",
|
156
159
|
"public/javascripts/lolita/main.js",
|
157
160
|
"public/javascripts/lolita/tab.js",
|
158
161
|
"public/javascripts/modernizr-1.7.min.js",
|
@@ -326,9 +329,9 @@ Gem::Specification.new do |s|
|
|
326
329
|
"spec/support/formatter_spec.rb"
|
327
330
|
]
|
328
331
|
s.homepage = %q{http://github.com/ithouse/lolita}
|
329
|
-
s.licenses = [
|
330
|
-
s.require_paths = [
|
331
|
-
s.rubygems_version = %q{1.
|
332
|
+
s.licenses = [%q{MIT}]
|
333
|
+
s.require_paths = [%q{lib}]
|
334
|
+
s.rubygems_version = %q{1.8.8}
|
332
335
|
s.summary = %q{Great Rails CMS.}
|
333
336
|
s.test_files = [
|
334
337
|
"spec/adapter_helper.rb",
|
@@ -0,0 +1 @@
|
|
1
|
+
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(c){var a="";var k,h,f,j,g,e,d;var b=0;c=Base64._utf8_encode(c);while(b<c.length){k=c.charCodeAt(b++);h=c.charCodeAt(b++);f=c.charCodeAt(b++);j=k>>2;g=((k&3)<<4)|(h>>4);e=((h&15)<<2)|(f>>6);d=f&63;if(isNaN(h)){e=d=64}else{if(isNaN(f)){d=64}}a=a+this._keyStr.charAt(j)+this._keyStr.charAt(g)+this._keyStr.charAt(e)+this._keyStr.charAt(d)}return a},decode:function(c){var a="";var k,h,f;var j,g,e,d;var b=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(b<c.length){j=this._keyStr.indexOf(c.charAt(b++));g=this._keyStr.indexOf(c.charAt(b++));e=this._keyStr.indexOf(c.charAt(b++));d=this._keyStr.indexOf(c.charAt(b++));k=(j<<2)|(g>>4);h=((g&15)<<4)|(e>>2);f=((e&3)<<6)|d;a=a+String.fromCharCode(k);if(e!=64){a=a+String.fromCharCode(h)}if(d!=64){a=a+String.fromCharCode(f)}}a=Base64._utf8_decode(a);return a},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},_utf8_decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};
|
@@ -5,7 +5,7 @@ $(function(){
|
|
5
5
|
"lolita_xhr": "true"
|
6
6
|
}
|
7
7
|
})
|
8
|
-
|
8
|
+
//$("#flash").slideUp("fast");
|
9
9
|
$("#flash").live("click", function(){
|
10
10
|
$(this).slideUp("fast");
|
11
11
|
})
|
@@ -15,13 +15,13 @@ $(function(){
|
|
15
15
|
var error=request.getResponseHeader("Lolita-Error");
|
16
16
|
var alert_msg=request.getResponseHeader("Lolita-Alert");
|
17
17
|
if(notice){
|
18
|
-
show_flash("<span style='color:green'>"+notice+"</span>");
|
18
|
+
show_flash("<span style='color:green'>"+Base64.decode(notice)+"</span>");
|
19
19
|
}else{
|
20
20
|
if(error){
|
21
|
-
show_flash("<span style='color:red'>"+error+"</span>");
|
21
|
+
show_flash("<span style='color:red'>"+Base64.decode(error)+"</span>");
|
22
22
|
}else{
|
23
23
|
if(alert_msg){
|
24
|
-
show_flash("<span style='color
|
24
|
+
show_flash("<span style='color:#ea7c15'>"+Base64.decode(alert_msg)+"</span>");
|
25
25
|
}
|
26
26
|
}
|
27
27
|
}
|
@@ -247,7 +247,23 @@ a.create {
|
|
247
247
|
-webkit-box-sizing: border-box;
|
248
248
|
box-sizing: border-box; /* IE7 does not support it, IE8 does */
|
249
249
|
}
|
250
|
-
|
250
|
+
.habtm-container{
|
251
|
+
float:left;
|
252
|
+
margin-bottom: 3px;
|
253
|
+
}
|
254
|
+
.habtm-container label{
|
255
|
+
float:right;
|
256
|
+
color: #666 !important;
|
257
|
+
width: 150px;
|
258
|
+
}
|
259
|
+
.habtm-container input{
|
260
|
+
width:30px !important;
|
261
|
+
float:left;
|
262
|
+
margin-right: 5px;
|
263
|
+
}
|
264
|
+
.clear{
|
265
|
+
clear:both;
|
266
|
+
}
|
251
267
|
/* --------------------------------------------- */
|
252
268
|
|
253
269
|
|
@@ -161,5 +161,16 @@ describe Lolita::Configuration::Tab do
|
|
161
161
|
tab.fields.by_name(:title).name.should == :title
|
162
162
|
end
|
163
163
|
|
164
|
+
it "should have nested forms" do
|
165
|
+
tab = tab_class.new(@dbi) do
|
166
|
+
default_fields
|
167
|
+
nested_fields_for("Comment") do
|
168
|
+
default_fields
|
169
|
+
end
|
170
|
+
end
|
171
|
+
tab.nested_forms.should have(1).item
|
172
|
+
tab.nested_forms[0].fields.size.should > 0
|
173
|
+
end
|
174
|
+
|
164
175
|
end
|
165
176
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolita
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-08-17 00:00:00.000000000Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rails
|
17
|
-
requirement: &
|
16
|
+
requirement: &79171940 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ~>
|
@@ -22,10 +21,10 @@ dependencies:
|
|
22
21
|
version: 3.0.7
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *79171940
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
26
|
name: kaminari
|
28
|
-
requirement: &
|
27
|
+
requirement: &79170900 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
29
|
requirements:
|
31
30
|
- - ~>
|
@@ -33,10 +32,10 @@ dependencies:
|
|
33
32
|
version: 0.12.4
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
35
|
+
version_requirements: *79170900
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
name: abstract
|
39
|
-
requirement: &
|
38
|
+
requirement: &79170290 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ! '>='
|
@@ -44,10 +43,10 @@ dependencies:
|
|
44
43
|
version: '0'
|
45
44
|
type: :runtime
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
46
|
+
version_requirements: *79170290
|
48
47
|
- !ruby/object:Gem::Dependency
|
49
48
|
name: builder
|
50
|
-
requirement: &
|
49
|
+
requirement: &79169580 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
51
|
requirements:
|
53
52
|
- - ~>
|
@@ -55,10 +54,10 @@ dependencies:
|
|
55
54
|
version: 2.1.2
|
56
55
|
type: :runtime
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
57
|
+
version_requirements: *79169580
|
59
58
|
- !ruby/object:Gem::Dependency
|
60
59
|
name: jeweler
|
61
|
-
requirement: &
|
60
|
+
requirement: &79168890 !ruby/object:Gem::Requirement
|
62
61
|
none: false
|
63
62
|
requirements:
|
64
63
|
- - ~>
|
@@ -66,10 +65,10 @@ dependencies:
|
|
66
65
|
version: 1.5.2
|
67
66
|
type: :development
|
68
67
|
prerelease: false
|
69
|
-
version_requirements: *
|
68
|
+
version_requirements: *79168890
|
70
69
|
- !ruby/object:Gem::Dependency
|
71
70
|
name: rspec
|
72
|
-
requirement: &
|
71
|
+
requirement: &79168020 !ruby/object:Gem::Requirement
|
73
72
|
none: false
|
74
73
|
requirements:
|
75
74
|
- - ~>
|
@@ -77,10 +76,10 @@ dependencies:
|
|
77
76
|
version: 2.6.0
|
78
77
|
type: :development
|
79
78
|
prerelease: false
|
80
|
-
version_requirements: *
|
79
|
+
version_requirements: *79168020
|
81
80
|
- !ruby/object:Gem::Dependency
|
82
81
|
name: rspec-rails
|
83
|
-
requirement: &
|
82
|
+
requirement: &79166460 !ruby/object:Gem::Requirement
|
84
83
|
none: false
|
85
84
|
requirements:
|
86
85
|
- - ~>
|
@@ -88,10 +87,10 @@ dependencies:
|
|
88
87
|
version: 2.6.0
|
89
88
|
type: :development
|
90
89
|
prerelease: false
|
91
|
-
version_requirements: *
|
90
|
+
version_requirements: *79166460
|
92
91
|
- !ruby/object:Gem::Dependency
|
93
92
|
name: factory_girl
|
94
|
-
requirement: &
|
93
|
+
requirement: &79162390 !ruby/object:Gem::Requirement
|
95
94
|
none: false
|
96
95
|
requirements:
|
97
96
|
- - ! '>='
|
@@ -99,10 +98,10 @@ dependencies:
|
|
99
98
|
version: '0'
|
100
99
|
type: :development
|
101
100
|
prerelease: false
|
102
|
-
version_requirements: *
|
101
|
+
version_requirements: *79162390
|
103
102
|
- !ruby/object:Gem::Dependency
|
104
103
|
name: ffaker
|
105
|
-
requirement: &
|
104
|
+
requirement: &79160600 !ruby/object:Gem::Requirement
|
106
105
|
none: false
|
107
106
|
requirements:
|
108
107
|
- - ! '>='
|
@@ -110,10 +109,10 @@ dependencies:
|
|
110
109
|
version: '0'
|
111
110
|
type: :development
|
112
111
|
prerelease: false
|
113
|
-
version_requirements: *
|
112
|
+
version_requirements: *79160600
|
114
113
|
- !ruby/object:Gem::Dependency
|
115
114
|
name: ruby-debug19
|
116
|
-
requirement: &
|
115
|
+
requirement: &79158890 !ruby/object:Gem::Requirement
|
117
116
|
none: false
|
118
117
|
requirements:
|
119
118
|
- - ! '>='
|
@@ -121,10 +120,10 @@ dependencies:
|
|
121
120
|
version: '0'
|
122
121
|
type: :development
|
123
122
|
prerelease: false
|
124
|
-
version_requirements: *
|
123
|
+
version_requirements: *79158890
|
125
124
|
- !ruby/object:Gem::Dependency
|
126
125
|
name: cucumber-rails
|
127
|
-
requirement: &
|
126
|
+
requirement: &79157700 !ruby/object:Gem::Requirement
|
128
127
|
none: false
|
129
128
|
requirements:
|
130
129
|
- - ! '>='
|
@@ -132,10 +131,10 @@ dependencies:
|
|
132
131
|
version: '0'
|
133
132
|
type: :development
|
134
133
|
prerelease: false
|
135
|
-
version_requirements: *
|
134
|
+
version_requirements: *79157700
|
136
135
|
- !ruby/object:Gem::Dependency
|
137
136
|
name: capybara
|
138
|
-
requirement: &
|
137
|
+
requirement: &79157020 !ruby/object:Gem::Requirement
|
139
138
|
none: false
|
140
139
|
requirements:
|
141
140
|
- - ! '>='
|
@@ -143,10 +142,10 @@ dependencies:
|
|
143
142
|
version: '0'
|
144
143
|
type: :development
|
145
144
|
prerelease: false
|
146
|
-
version_requirements: *
|
145
|
+
version_requirements: *79157020
|
147
146
|
- !ruby/object:Gem::Dependency
|
148
147
|
name: database_cleaner
|
149
|
-
requirement: &
|
148
|
+
requirement: &79154350 !ruby/object:Gem::Requirement
|
150
149
|
none: false
|
151
150
|
requirements:
|
152
151
|
- - ! '>='
|
@@ -154,10 +153,10 @@ dependencies:
|
|
154
153
|
version: '0'
|
155
154
|
type: :development
|
156
155
|
prerelease: false
|
157
|
-
version_requirements: *
|
156
|
+
version_requirements: *79154350
|
158
157
|
- !ruby/object:Gem::Dependency
|
159
158
|
name: akephalos
|
160
|
-
requirement: &
|
159
|
+
requirement: &79153460 !ruby/object:Gem::Requirement
|
161
160
|
none: false
|
162
161
|
requirements:
|
163
162
|
- - ! '>='
|
@@ -165,7 +164,7 @@ dependencies:
|
|
165
164
|
version: '0'
|
166
165
|
type: :development
|
167
166
|
prerelease: false
|
168
|
-
version_requirements: *
|
167
|
+
version_requirements: *79153460
|
169
168
|
description: ! 'Great Rails CMS, that turns your business logic into good-looking,
|
170
169
|
fully functional workspace. '
|
171
170
|
email: support@ithouse.lv
|
@@ -204,7 +203,7 @@ files:
|
|
204
203
|
- app/views/components/lolita/configuration/field/_object.html.erb
|
205
204
|
- app/views/components/lolita/configuration/field/array/_display.html.erb
|
206
205
|
- app/views/components/lolita/configuration/field/array/filter/_display.html.erb
|
207
|
-
- app/views/components/lolita/configuration/field/array/habtm/_display.html.
|
206
|
+
- app/views/components/lolita/configuration/field/array/habtm/_display.html.haml
|
208
207
|
- app/views/components/lolita/configuration/field/array/select/_display.html.erb
|
209
208
|
- app/views/components/lolita/configuration/field/big_decimal/_display.html.erb
|
210
209
|
- app/views/components/lolita/configuration/field/boolean/_display.html.erb
|
@@ -228,6 +227,7 @@ files:
|
|
228
227
|
- app/views/components/lolita/configuration/list/_title.html.erb
|
229
228
|
- app/views/components/lolita/configuration/tab/_display.html.erb
|
230
229
|
- app/views/components/lolita/configuration/tab/_fields.html.erb
|
230
|
+
- app/views/components/lolita/configuration/tab/_nested_form.html.erb
|
231
231
|
- app/views/components/lolita/configuration/tab/content/_display.html.erb
|
232
232
|
- app/views/components/lolita/configuration/tab/default/_display.html.erb
|
233
233
|
- app/views/components/lolita/configuration/tabs/_display.html.erb
|
@@ -278,6 +278,7 @@ files:
|
|
278
278
|
- lib/lolita/configuration/fields.rb
|
279
279
|
- lib/lolita/configuration/filter.rb
|
280
280
|
- lib/lolita/configuration/list.rb
|
281
|
+
- lib/lolita/configuration/nested_form.rb
|
281
282
|
- lib/lolita/configuration/page.rb
|
282
283
|
- lib/lolita/configuration/tab.rb
|
283
284
|
- lib/lolita/configuration/tab/content.rb
|
@@ -311,6 +312,7 @@ files:
|
|
311
312
|
- public/javascripts/jquery-1.6.min.js
|
312
313
|
- public/javascripts/jquery-ui-1.8.13.min.js
|
313
314
|
- public/javascripts/lolita/application.js
|
315
|
+
- public/javascripts/lolita/base64.js
|
314
316
|
- public/javascripts/lolita/main.js
|
315
317
|
- public/javascripts/lolita/tab.js
|
316
318
|
- public/javascripts/modernizr-1.7.min.js
|
@@ -482,7 +484,6 @@ files:
|
|
482
484
|
- spec/support/factories/post.rb
|
483
485
|
- spec/support/factories/tag.rb
|
484
486
|
- spec/support/formatter_spec.rb
|
485
|
-
has_rdoc: true
|
486
487
|
homepage: http://github.com/ithouse/lolita
|
487
488
|
licenses:
|
488
489
|
- MIT
|
@@ -498,7 +499,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
498
499
|
version: '0'
|
499
500
|
segments:
|
500
501
|
- 0
|
501
|
-
hash:
|
502
|
+
hash: 641694611
|
502
503
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
503
504
|
none: false
|
504
505
|
requirements:
|
@@ -507,7 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
507
508
|
version: '0'
|
508
509
|
requirements: []
|
509
510
|
rubyforge_project:
|
510
|
-
rubygems_version: 1.
|
511
|
+
rubygems_version: 1.8.8
|
511
512
|
signing_key:
|
512
513
|
specification_version: 3
|
513
514
|
summary: Great Rails CMS.
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<% options = field.association_values.respond_to?(:call) ? field.association_values.call(self) : field.association_values %>
|
2
|
-
<% values = self.instance_variable_get("@#{resource_name}").send("#{field.name}") %>
|
3
|
-
<% subject_habtm_fieldname = "#{field.name.to_s.singularize}_ids" %>
|
4
|
-
<% values.each{|value|%>
|
5
|
-
<%
|
6
|
-
option_tags = options.collect{|option|
|
7
|
-
option_tag_attributes = {:value=>option[1]}
|
8
|
-
option_tag_attributes[:selected] = "selected" if option[1] == value.id
|
9
|
-
content_tag :option, option[0], option_tag_attributes
|
10
|
-
}.join("").html_safe
|
11
|
-
%>
|
12
|
-
<div style="height:30px;">
|
13
|
-
<%= select_tag "#{resource_name}[#{subject_habtm_fieldname}][]", option_tags ,{:include_blank=>true} %>
|
14
|
-
</div>
|
15
|
-
<% } %>
|
16
|
-
<% empty_fields = (values.size < 5) ? (5 - values.size) : 0 %>
|
17
|
-
<%
|
18
|
-
option_tags = options.collect{|option|
|
19
|
-
content_tag :option, option[0], {:value=>option[1]}
|
20
|
-
}.join("").html_safe
|
21
|
-
%>
|
22
|
-
<% empty_fields.times{ %>
|
23
|
-
<div style="height:30px;">
|
24
|
-
<%= select_tag "#{resource_name}[#{subject_habtm_fieldname}][]", option_tags ,{:include_blank=>true} %>
|
25
|
-
</div>
|
26
|
-
<% } %>
|