lolita 4.0.11 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/app/assets/stylesheets/lolita/style.css.erb +1 -2
- data/app/views/components/lolita/configuration/tab/_error_msg.html.haml +4 -4
- data/app/views/layouts/lolita/application.html.haml +22 -22
- data/lib/lolita/adapter/active_record.rb +1 -1
- data/lib/lolita/adapter/mongoid.rb +1 -1
- data/lib/lolita/configuration/base.rb +6 -2
- data/lib/lolita/configuration/column.rb +1 -1
- data/lib/lolita/configuration/factory/field.rb +7 -7
- data/lib/lolita/configuration/field.rb +15 -11
- data/lib/lolita/configuration/field/array.rb +6 -6
- data/lib/lolita/configuration/list.rb +1 -1
- data/lib/lolita/configuration/nested_list.rb +5 -5
- data/lib/lolita/controllers/rails_helpers.rb +2 -8
- data/lib/lolita/extensions/authorization/pundit_adapter.rb +1 -1
- data/lib/lolita/hooks.rb +2 -2
- data/lib/lolita/mapping.rb +2 -2
- data/lib/lolita/version.rb +2 -2
- data/spec/configuration/field_spec.rb +1 -1
- data/spec/configuration/list_spec.rb +3 -3
- data/spec/configuration/nested_list_spec.rb +5 -5
- data/spec/mapping_spec.rb +0 -9
- data/spec/rails_app/app/orm/active_record/post.rb +1 -1
- data/spec/rails_app/config/routes.rb +0 -2
- data/spec/spec_helper.rb +5 -4
- metadata +4 -7
- data/spec/rails_app/app/controllers/dashboard_controller.rb +0 -5
- data/spec/rails_app/app/controllers/data_import_controller.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0217f3c46ff81621fc7747c2ebcd69d97e56e156
|
4
|
+
data.tar.gz: 546206df2c2088ac4c6e5616d0b75f1fa64e14ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c42fcefe4594902e737ace2b42397d9afa47abc3bc104e726ca30dc0604dfbc8d1eda78d47879650fee943bb458ae89e2a4ec26a504236043b6c234889aac962
|
7
|
+
data.tar.gz: d9f6ce013bd2bc9e4bb0ac503bf58d68eaf9d1e8b15a2e52ae33e7d8a2660e3ee5022a2818c77dbfddc922c72eb0692d5e396d700f4ed79b267b6ef0823c652d
|
data/Gemfile
CHANGED
@@ -18,10 +18,10 @@ end
|
|
18
18
|
gem 'simplecov', require: false, group: :test
|
19
19
|
|
20
20
|
group :rails do
|
21
|
-
gem
|
22
|
-
gem
|
23
|
-
gem
|
24
|
-
gem
|
21
|
+
gem "rails" , "~> 4.2.0"
|
22
|
+
gem "rspec-rails", "~> 2.14"
|
23
|
+
gem "coffee-rails", "~> 4.0.1"
|
24
|
+
gem "therubyracer", "~> 0.12.0"
|
25
25
|
end
|
26
26
|
|
27
27
|
group :mongoid do
|
@@ -81,8 +81,7 @@ header nav .username {margin-right: 15px;}
|
|
81
81
|
#main .box form .field_string,
|
82
82
|
#main .box form .field_integer,
|
83
83
|
#main .box form .field_big_decimal,
|
84
|
-
#main .box form .field_array
|
85
|
-
#main .box form .field_date { margin-top: 17px;}
|
84
|
+
#main .box form .field_array { margin-top: 17px;}
|
86
85
|
#main .box form .field-value { margin-top: 5px;}
|
87
86
|
#main .box form .field-value input, #main .box form .field-value textarea {
|
88
87
|
border: 1px solid #cdcdcd;
|
@@ -3,12 +3,12 @@
|
|
3
3
|
- errors = resource.errors.keys.collect do |k|
|
4
4
|
- title = if k.to_s.match(/\./)
|
5
5
|
- assoc_name, attr_name = k.to_s.split(".")
|
6
|
-
- if tab.fields.by_name(attr_name.
|
7
|
-
- klass = resource.lolita.dbi.reflect_on_association(assoc_name.
|
6
|
+
- if tab.fields.by_name(attr_name.to_s)
|
7
|
+
- klass = resource.lolita.dbi.reflect_on_association(assoc_name.to_s).klass
|
8
8
|
- klass.human_attribute_name(attr_name).downcase
|
9
|
-
- elsif tab.fields.by_name(k.
|
9
|
+
- elsif tab.fields.by_name(k.to_s)
|
10
10
|
- resource.class.human_attribute_name(k)
|
11
|
-
- elsif assoc = resource.lolita.dbi.reflect_on_association(k.
|
11
|
+
- elsif assoc = resource.lolita.dbi.reflect_on_association(k.to_s)
|
12
12
|
- assoc.klass.lolita_model_name.human
|
13
13
|
- if title && resource.errors[k] && resource.errors[k].respond_to?(:any?) && resource.errors[k].any?
|
14
14
|
- "#{title.to_s.capitalize}: #{resource.errors[k].join(" #{::I18n.t("lolita.shared.and")} ")}"
|
@@ -3,28 +3,28 @@
|
|
3
3
|
|
4
4
|
%head
|
5
5
|
%meta{:charset => "utf-8"}
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
6
|
+
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
|
7
|
+
%title= Lolita.application.name
|
8
|
+
%meta{:content => "", :name => "description"}
|
9
|
+
%meta{:content => "", :name => "author"}
|
10
|
+
= favicon_link_tag "lolita/favicon.ico" rescue ""
|
11
|
+
= stylesheet_link_tag "lolita/application.css"
|
12
|
+
= yield :style
|
13
|
+
= javascript_include_tag "lolita/application.js"
|
14
|
+
= yield :script
|
15
|
+
= include_application_assets
|
16
|
+
= raw csrf_meta_tag
|
17
|
+
- if flash[:lolita_notice]
|
18
|
+
:javascript
|
19
|
+
$(function(){
|
20
|
+
show_notice_msg(Base64.decode('#{flash[:lolita_notice]}'));
|
21
|
+
})
|
22
|
+
- elsif flash[:lolita_alert]
|
23
|
+
:javascript
|
24
|
+
$(function(){
|
25
|
+
show_alert_msg(Base64.decode('#{flash[:lolita_alert]}'));
|
26
|
+
})
|
27
|
+
%body
|
28
28
|
= render_component :"lolita/shared", :flash
|
29
29
|
#container
|
30
30
|
= render_component :"lolita/shared", :header
|
@@ -55,7 +55,7 @@ module Lolita
|
|
55
55
|
unless @associations
|
56
56
|
@associations = {}
|
57
57
|
klass.relations.each{|name,association|
|
58
|
-
@associations[name.
|
58
|
+
@associations[name.to_s] = Association.new(association,self)
|
59
59
|
}
|
60
60
|
end
|
61
61
|
@associations
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Lolita
|
2
2
|
module Configuration
|
3
|
-
# This is superclass of other configuration classes, that is used to configure different parts of resource.
|
3
|
+
# This is superclass of other configuration classes, that is used to configure different parts of resource.
|
4
4
|
class Base
|
5
5
|
include Lolita::Builder
|
6
6
|
attr_reader :dbi
|
@@ -30,7 +30,11 @@ module Lolita
|
|
30
30
|
def set_attributes(*args)
|
31
31
|
options = args && args.extract_options! || {}
|
32
32
|
options.each do |attr_name,value|
|
33
|
-
|
33
|
+
if attr_name == :association_name
|
34
|
+
self.association_name = value
|
35
|
+
else
|
36
|
+
self.send("#{attr_name}=".to_sym,value)
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
@@ -11,7 +11,7 @@ module Lolita
|
|
11
11
|
# *<tt>third</tt> - Pass dbi_field
|
12
12
|
# Field.add(dbi,:dbi_field => dbi.fields.first)
|
13
13
|
def create(dbi,*args,&block)
|
14
|
-
|
14
|
+
|
15
15
|
options = args ? args.extract_options! : {}
|
16
16
|
dbi_field = options[:dbi_field]
|
17
17
|
name = args[0] || options[:name] || (dbi_field ? dbi_field.name : nil)
|
@@ -19,9 +19,9 @@ module Lolita
|
|
19
19
|
dbi_field ||= dbi.field_by_association(name)
|
20
20
|
association ||= detect_association(dbi,name)
|
21
21
|
|
22
|
-
type = args[1] || options[:type] ||
|
22
|
+
type = args[1] || options[:type] ||
|
23
23
|
(association ? :array : nil ) ||
|
24
|
-
(dbi_field ? dbi_field.type : nil) ||
|
24
|
+
(dbi_field ? dbi_field.type : nil) ||
|
25
25
|
:string
|
26
26
|
options[:dbi_field] = dbi_field
|
27
27
|
if !name || !type
|
@@ -35,15 +35,15 @@ module Lolita
|
|
35
35
|
alias :add :create
|
36
36
|
|
37
37
|
def detect_association(dbi,name)
|
38
|
-
dbi.associations[name.
|
38
|
+
dbi.associations[name.to_s]
|
39
39
|
end
|
40
40
|
|
41
41
|
def field_class(name)
|
42
42
|
("Lolita::Configuration::Field::"+name.to_s.camelize).constantize
|
43
43
|
end
|
44
|
-
end
|
45
|
-
|
44
|
+
end
|
45
|
+
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
@@ -11,7 +11,7 @@ module Lolita
|
|
11
11
|
# form there are fields from profile that can be manipulated when user is changed or created.
|
12
12
|
# * <tt>options</tt> - specific options for different type of fields, see Lolita::Configuration::FieldExtensions for details
|
13
13
|
# * <tt>html_options</tt> - used to change field HTML output,like class or style etc.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# To define field in ORM class through lolita configuration block
|
16
16
|
# ====Example
|
17
17
|
# lolita do
|
@@ -19,7 +19,7 @@ module Lolita
|
|
19
19
|
# field :email
|
20
20
|
# field :user_id, :type=>"string"
|
21
21
|
# field :body do
|
22
|
-
# title "Full text"
|
22
|
+
# title "Full text"
|
23
23
|
# html_options :class=>"full_text"
|
24
24
|
# end
|
25
25
|
# end
|
@@ -33,7 +33,7 @@ module Lolita
|
|
33
33
|
lolita_accessor :name,:title,:on,:field_set, :nested_form,:nested_for,:options, :html_options
|
34
34
|
attr_reader :dbi,:nested_in
|
35
35
|
attr_accessor :dbi_field
|
36
|
-
|
36
|
+
|
37
37
|
def initialize dbi,name,*args, &block
|
38
38
|
@dbi=dbi
|
39
39
|
self.name = name
|
@@ -49,7 +49,7 @@ module Lolita
|
|
49
49
|
set_default_values
|
50
50
|
validate
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def title(new_title = nil)
|
54
54
|
if new_title
|
55
55
|
@title = new_title
|
@@ -89,15 +89,15 @@ module Lolita
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def nested_in=(dbi)
|
92
|
-
if !self.dbi.associations_class_names.include?(dbi.klass.to_s) && !dbi.associations_class_names.include?(self.dbi.klass.to_s)
|
92
|
+
if !self.dbi.associations_class_names.include?(dbi.klass.to_s) && !dbi.associations_class_names.include?(self.dbi.klass.to_s)
|
93
93
|
raise Lolita::ReferenceError, "There is no association between #{self.dbi.klass} and #{dbi.klass}"
|
94
94
|
end
|
95
95
|
if !dbi.is_a?(Lolita::DBI::Base) && !dbi.class.to_s.match(/Lolita::Adapter/)
|
96
|
-
raise ArgumentError, "Field can be nested only in Lolita::DBI::Base object."
|
96
|
+
raise ArgumentError, "Field can be nested only in Lolita::DBI::Base object."
|
97
97
|
end
|
98
98
|
@nested_in=dbi
|
99
99
|
end
|
100
|
-
|
100
|
+
|
101
101
|
def nested?
|
102
102
|
!self.nested_in.nil?
|
103
103
|
end
|
@@ -109,12 +109,16 @@ module Lolita
|
|
109
109
|
self.nested_in && self.nested_in.klass==dbi_or_class
|
110
110
|
end
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
def set_attributes(attributes)
|
114
114
|
excluded_keys = [:name,:type]
|
115
115
|
attributes.each{|attr,value|
|
116
116
|
unless excluded_keys.include?(attr.to_sym)
|
117
|
-
|
117
|
+
if attr == :dbi_field
|
118
|
+
self.dbi_field = value
|
119
|
+
else
|
120
|
+
self.send(:"#{attr}=",value)
|
121
|
+
end
|
118
122
|
end
|
119
123
|
}
|
120
124
|
end
|
@@ -126,8 +130,8 @@ module Lolita
|
|
126
130
|
end
|
127
131
|
|
128
132
|
private
|
129
|
-
|
130
|
-
def builder_local_variable_name
|
133
|
+
|
134
|
+
def builder_local_variable_name
|
131
135
|
:field
|
132
136
|
end
|
133
137
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
module Lolita
|
2
2
|
module Configuration
|
3
3
|
module Field
|
4
|
-
# Fields with Array is used to
|
5
|
-
# * create select for belongs_to association or
|
4
|
+
# Fields with Array is used to
|
5
|
+
# * create select for belongs_to association or
|
6
6
|
# * has_and_belongs_to_many field for selecting all associated objects or
|
7
7
|
# * for polymorphic belongs_to associations
|
8
8
|
# ==Polymorphic builder (:polymorphic)
|
9
9
|
# Create two select boxes one of all related classes and second with related records for that class.
|
10
10
|
# Related classes can have <em>polymorphic_select_name</em> instance method, that is used to populate second
|
11
11
|
# select with visible values by default it calles <em>text_method</em>. It will fallback first content column. Class should respond to one
|
12
|
-
# of these.
|
12
|
+
# of these.
|
13
13
|
class Array < Lolita::Configuration::Field::Base
|
14
14
|
include Lolita::Hooks
|
15
|
-
MAX_RECORD_COUNT =
|
15
|
+
MAX_RECORD_COUNT = 100
|
16
16
|
|
17
17
|
add_hook :after_association_loaded
|
18
18
|
|
@@ -74,7 +74,7 @@ module Lolita
|
|
74
74
|
@association_values
|
75
75
|
end
|
76
76
|
|
77
|
-
# Collect values for polymorphic association, you may pass
|
77
|
+
# Collect values for polymorphic association, you may pass
|
78
78
|
# * <tt>:klass</tt> - class that's records are used
|
79
79
|
# * <tt>:record</tt> - record class that has polymorphic association. It is used to call to detect related object class.
|
80
80
|
def polymorphic_association_values(options={})
|
@@ -129,7 +129,7 @@ module Lolita
|
|
129
129
|
|
130
130
|
def detect_association
|
131
131
|
unless @association
|
132
|
-
dbi.associations[self.name.
|
132
|
+
dbi.associations[self.name.to_s]
|
133
133
|
else
|
134
134
|
@association
|
135
135
|
end
|
@@ -32,7 +32,7 @@ module Lolita
|
|
32
32
|
# Allow to crate nested list for list
|
33
33
|
def list(*args, &block)
|
34
34
|
if args && args.any? || block_given?
|
35
|
-
association = dbi.associations[args[0].to_s
|
35
|
+
association = dbi.associations[args[0].to_s]
|
36
36
|
association_dbi = association && Lolita::DBI::Base.create(association.klass)
|
37
37
|
raise Lolita::UnknownDBPError.new("No DBI specified for list sublist") unless association_dbi
|
38
38
|
Lolita::LazyLoader.lazy_load(self,:@list,Lolita::Configuration::NestedList,association_dbi, self, :association_name => association.name,&block)
|
@@ -2,14 +2,14 @@ module Lolita
|
|
2
2
|
class ParentNotAListError < ArgumentError ; end
|
3
3
|
|
4
4
|
module Configuration
|
5
|
-
|
5
|
+
|
6
6
|
class NestedList < Lolita::Configuration::List
|
7
7
|
attr_accessor :parent,:association_name
|
8
8
|
|
9
9
|
def initialize dbi,parent,options={},&block
|
10
10
|
init_nested_list_attributes(parent)
|
11
11
|
set_and_validate_dbi(dbi)
|
12
|
-
set_list_attributes do
|
12
|
+
set_list_attributes do
|
13
13
|
set_attributes(options)
|
14
14
|
self.instance_eval(&block) if block_given?
|
15
15
|
end
|
@@ -28,7 +28,7 @@ module Lolita
|
|
28
28
|
self.parent.dbi.klass
|
29
29
|
else
|
30
30
|
dbi.klass
|
31
|
-
end
|
31
|
+
end
|
32
32
|
@mapping = Lolita::Mapping.new(:"#{mapping_class.to_s.downcase.pluralize}") || false
|
33
33
|
end
|
34
34
|
@mapping
|
@@ -88,7 +88,7 @@ module Lolita
|
|
88
88
|
def init_nested_list_attributes parent
|
89
89
|
@parent = parent
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def validate
|
93
93
|
msg = "#{parent.class} must be kind of Lolita::Configuration::List or Lolita::Configuration::Column"
|
94
94
|
raise(Lolita::ParentNotAListError, msg) unless [
|
@@ -99,4 +99,4 @@ module Lolita
|
|
99
99
|
end
|
100
100
|
|
101
101
|
end
|
102
|
-
end
|
102
|
+
end
|
@@ -46,10 +46,8 @@ module Lolita
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def resource_with_attributes(current_resource,attributes={})
|
49
|
-
attributes
|
50
|
-
attributes
|
51
|
-
current_resource.send(:"#{key}=",value)
|
52
|
-
}
|
49
|
+
permitted_attributes = ActionController::Parameters.new(attributes || resource_attributes).permit!
|
50
|
+
current_resource.attributes = permitted_attributes
|
53
51
|
current_resource
|
54
52
|
end
|
55
53
|
|
@@ -103,10 +101,6 @@ module Lolita
|
|
103
101
|
end
|
104
102
|
end
|
105
103
|
date_attributes.each_pair do |k,v|
|
106
|
-
if v.values.all?{|va| va == 0}
|
107
|
-
attributes[k] = nil
|
108
|
-
next
|
109
|
-
end
|
110
104
|
unless v.detect{|index,value| value == 0 && index<4}
|
111
105
|
attributes[k] = v.size == 3 ? Date.new(v[1],v[2],v[3]) : Time.new(v[1],v[2],v[3],v[4],v[5])
|
112
106
|
end
|
data/lib/lolita/hooks.rb
CHANGED
@@ -102,7 +102,7 @@ module Lolita
|
|
102
102
|
|
103
103
|
def run(&block)
|
104
104
|
if !@options[:once] || (@options[:once] && !self.class.runned?(@options[:once],@hook_name))
|
105
|
-
self.class.singleton_hook(@options[:once],@hook_name)
|
105
|
+
self.class.singleton_hook(@options[:once] || Object,@hook_name)
|
106
106
|
result = nil
|
107
107
|
in_hooks_scope(@options[:scope],@options[:run_scope]) do
|
108
108
|
callback = get_callback(@hook_name)
|
@@ -396,4 +396,4 @@ module Lolita
|
|
396
396
|
end
|
397
397
|
|
398
398
|
end
|
399
|
-
end
|
399
|
+
end
|
data/lib/lolita/mapping.rb
CHANGED
@@ -17,7 +17,7 @@ module Lolita
|
|
17
17
|
# what controller to use, what model is related with it and so on. This is used to generate urls and paths.
|
18
18
|
# Also eahc request containers information with mapping related to it.
|
19
19
|
class Mapping
|
20
|
-
attr_reader :class_name,:path,:singular,:plural,:path_prefix,:module,:as,:controllers
|
20
|
+
attr_reader :class_name,:path,:singular,:plural,:path_prefix,:module,:as,:controllers
|
21
21
|
attr_reader :visible, :only, :append_to, :title
|
22
22
|
alias :name :singular
|
23
23
|
|
@@ -74,7 +74,7 @@ module Lolita
|
|
74
74
|
end
|
75
75
|
tree = parent_branch.children
|
76
76
|
end
|
77
|
-
unless tree.branches.detect{|b| b.object.is_a?(Lolita::Mapping) && b.object.
|
77
|
+
unless tree.branches.detect{|b| b.object.is_a?(Lolita::Mapping) && b.object.to==self.to}
|
78
78
|
tree.append(self, :title => @title)
|
79
79
|
end
|
80
80
|
end
|
data/lib/lolita/version.rb
CHANGED
@@ -31,7 +31,7 @@ describe Lolita::Configuration::Field do
|
|
31
31
|
# Lolita::Configuration::Field.new(@dbi,:noname)
|
32
32
|
# }.should raise_error Lolita::FieldNameError
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should always set field title if not specified" do
|
36
36
|
field=field_class.new(@dbi,:title)
|
37
37
|
field.title.size.should > 0
|
@@ -102,11 +102,11 @@ describe Lolita::Configuration::List do
|
|
102
102
|
dummy_association = double("dummy_association")
|
103
103
|
dummy_association.stub(:klass).and_return(Object)
|
104
104
|
dummy_association.stub(:name).and_return("name")
|
105
|
-
dbp.stub(:associations).and_return({
|
105
|
+
dbp.stub(:associations).and_return({'dummy_association' => dummy_association})
|
106
106
|
|
107
107
|
nested_list = double("nested_list")
|
108
108
|
Lolita::Configuration::NestedList.should_receive(:new).with(nested_dbp,list,{:association_name => "name"}).and_return(nested_list)
|
109
|
-
list.list
|
109
|
+
list.list 'dummy_association'
|
110
110
|
list.list.should eq(nested_list)
|
111
111
|
end
|
112
112
|
|
@@ -270,4 +270,4 @@ describe Lolita::Configuration::List do
|
|
270
270
|
end
|
271
271
|
end
|
272
272
|
|
273
|
-
end
|
273
|
+
end
|
@@ -10,7 +10,7 @@ describe Lolita::Configuration::NestedList do
|
|
10
10
|
expect do
|
11
11
|
Lolita::Configuration::NestedList.new(comment_dbi,list_class.new(dbi))
|
12
12
|
end.not_to raise_error
|
13
|
-
end
|
13
|
+
end
|
14
14
|
|
15
15
|
it "should raise error when no list or nested list or column is given" do
|
16
16
|
expect do
|
@@ -60,16 +60,16 @@ describe Lolita::Configuration::NestedList do
|
|
60
60
|
main_list = list_class.new(dbi) do
|
61
61
|
list(:comments){}
|
62
62
|
end
|
63
|
-
main_list.list.association.name.should == dbi.associations[
|
63
|
+
main_list.list.association.name.should == dbi.associations['comments'].name
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
it "should return root" do
|
67
67
|
list = list_class.new(dbi)
|
68
68
|
nlist1 = nested_list_class.new(dbi,list)
|
69
69
|
nlist2 = nested_list_class.new(dbi,nlist1)
|
70
70
|
nlist2.root.should == list
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
it "should create mapping for DBI class" do
|
74
74
|
list = list_class.new(dbi)
|
75
75
|
nlist = nested_list_class.new(comment_dbi,list, :association_name => "comments")
|
@@ -108,4 +108,4 @@ describe Lolita::Configuration::NestedList do
|
|
108
108
|
new_list.list.nested_options_for(record)[:nested].keys.should == ["category_id",:parent,:path]
|
109
109
|
new_list.list.list.nested_options_for(post)[:nested].keys.should == ["post_id",:parent,:path]
|
110
110
|
end
|
111
|
-
end
|
111
|
+
end
|
data/spec/mapping_spec.rb
CHANGED
@@ -25,14 +25,5 @@ describe Lolita::Mapping do
|
|
25
25
|
mapping.url_name.should == "my_admin_posts"
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
29
|
-
it 'should add headless navigation items to tree' do
|
30
|
-
tree = Lolita::Navigation::Tree.new(:"left_side_navigation")
|
31
|
-
Lolita::Navigation::Tree.remember(tree)
|
32
|
-
|
33
|
-
described_class.new(:dashboard).add_to_navigation_tree
|
34
|
-
described_class.new(:data_import).add_to_navigation_tree
|
35
|
-
expect(Lolita.navigation.branches.size).to eq(2)
|
36
|
-
end
|
37
28
|
end
|
38
29
|
|
@@ -4,7 +4,7 @@ class Post < ActiveRecord::Base
|
|
4
4
|
has_and_belongs_to_many :tags
|
5
5
|
has_many :comments, dependent: :destroy
|
6
6
|
belongs_to :profile
|
7
|
-
|
7
|
+
validates :title, presence: true
|
8
8
|
default_scope -> { order("title") }
|
9
9
|
accepts_nested_attributes_for :comments, reject_if: :all_blank
|
10
10
|
|
data/spec/spec_helper.rb
CHANGED
@@ -30,15 +30,16 @@ Benchmark.bm do |x|
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
x.report("Loading test stuff: ") do
|
33
|
+
#x.report("Loading test stuff: ") do
|
34
34
|
require 'ffaker'
|
35
|
-
end
|
36
|
-
x.report("Loading factories") do
|
35
|
+
#end
|
36
|
+
#x.report("Loading factories") do
|
37
37
|
Dir["#{File.dirname(__FILE__)}/fabricators/**/*_fabricator.rb"].each {|f| require f}
|
38
|
-
end
|
38
|
+
#end
|
39
39
|
Dir["#{File.dirname(__FILE__)}/support/**/*[^_spec].rb"].each {|f| require f}
|
40
40
|
RSpec.configure do |config|
|
41
41
|
config.mock_with :rspec
|
42
42
|
config.order = "rand:3455"
|
43
|
+
config.infer_spec_type_from_file_location!
|
43
44
|
end
|
44
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolita
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ITHouse (Latvia) and Arturs Meisters
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kaminari
|
@@ -428,8 +428,6 @@ files:
|
|
428
428
|
- spec/orm/mongoid.rb
|
429
429
|
- spec/orm/mongoid.yml
|
430
430
|
- spec/rails_app/app/controllers/application_controller.rb
|
431
|
-
- spec/rails_app/app/controllers/dashboard_controller.rb
|
432
|
-
- spec/rails_app/app/controllers/data_import_controller.rb
|
433
431
|
- spec/rails_app/app/helpers/application_helper.rb
|
434
432
|
- spec/rails_app/app/orm/active_record/address.rb
|
435
433
|
- spec/rails_app/app/orm/active_record/category.rb
|
@@ -547,7 +545,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
547
545
|
version: '0'
|
548
546
|
requirements: []
|
549
547
|
rubyforge_project:
|
550
|
-
rubygems_version: 2.4.
|
548
|
+
rubygems_version: 2.4.6
|
551
549
|
signing_key:
|
552
550
|
specification_version: 4
|
553
551
|
summary: Great web resources management tool
|
@@ -595,8 +593,6 @@ test_files:
|
|
595
593
|
- spec/orm/mongoid.rb
|
596
594
|
- spec/orm/mongoid.yml
|
597
595
|
- spec/rails_app/app/controllers/application_controller.rb
|
598
|
-
- spec/rails_app/app/controllers/dashboard_controller.rb
|
599
|
-
- spec/rails_app/app/controllers/data_import_controller.rb
|
600
596
|
- spec/rails_app/app/helpers/application_helper.rb
|
601
597
|
- spec/rails_app/app/orm/active_record/address.rb
|
602
598
|
- spec/rails_app/app/orm/active_record/category.rb
|
@@ -690,3 +686,4 @@ test_files:
|
|
690
686
|
- spec/spec_helper.rb
|
691
687
|
- spec/support/cleaner.rb
|
692
688
|
- spec/support/formatter_spec.rb
|
689
|
+
has_rdoc:
|