lolita 4.0.0 → 4.0.1
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.
- checksums.yaml +4 -4
- data/README.md +13 -14
- data/lib/lolita/rails/routes.rb +4 -18
- data/lib/lolita/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2eb473bc7ecc5d3f8479d25b0afeb9d57a0fd5fa
|
|
4
|
+
data.tar.gz: a536d5c8f2d53b6e0e11ebd2a2efa74f858e2314
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bee0d825101882719f5ffc50bbf513bf88599d417545b4bb77a09388f986be9a5c7f6ff0975b6c645be2e14a0b7197e2b16b8972bc597f3bcfad1ede04561d3b
|
|
7
|
+
data.tar.gz: 0543bfadce138033eb0cd3d4de38173f5f17219867178f037b2bb9f14ef61f7fd60c2fe1717749f8934ed5ed41bb42beae5b35c526bfe91095229bfc6029fb53
|
data/README.md
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
#Lolita
|
|
2
2
|
|
|
3
3
|
Great Rails CMS, that turns your business logic into good-looking, fully functional workspace.
|
|
4
|
-
Works with Rails 3.2
|
|
4
|
+
Works with Rails 3.2, 4.0, 4.1
|
|
5
5
|
|
|
6
6
|
[](https://travis-ci.org/ithouse/lolita) [](https://codeclimate.com/github/ithouse/lolita)
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
See the demo page at [Demo](http://lolita-demo.ithouse.lv/lolita)
|
|
10
|
-
email: lolita@ithouse.lv
|
|
11
|
-
password: lolita
|
|
8
|
+
## How it looks
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## Installation
|
|
14
13
|
|
|
15
14
|
First add Lolita gem to your Gemfile
|
|
16
15
|
|
|
17
|
-
gem 'lolita', '~>
|
|
16
|
+
gem 'lolita', '~> 4.0.1'
|
|
18
17
|
|
|
19
18
|
Then go to your rails project and
|
|
20
19
|
|
|
@@ -30,7 +29,7 @@ gem "lolita-file-upload"
|
|
|
30
29
|
```
|
|
31
30
|
|
|
32
31
|
It will also call *lolita_file_upload:install*.
|
|
33
|
-
##Usage
|
|
32
|
+
## Usage
|
|
34
33
|
|
|
35
34
|
To make your model use Lolita do like this
|
|
36
35
|
|
|
@@ -52,7 +51,7 @@ or open `/lolita` and it will redirect to first available resource list view.
|
|
|
52
51
|
|
|
53
52
|
For more detailed usage read [Usage](https://github.com/ithouse/lolita/wiki/Usage) at wiki.
|
|
54
53
|
|
|
55
|
-
###Add authorization to Lolita
|
|
54
|
+
### Add authorization to Lolita
|
|
56
55
|
|
|
57
56
|
Easiest way to add authentication is with Devise. First install Devise as gem, than add it to your project.
|
|
58
57
|
Make Devise model, lets say, *User*. After that add these lines in */config/initializers/lolita.rb*
|
|
@@ -73,10 +72,10 @@ config.authentication = :authenticate_admin
|
|
|
73
72
|
And than put this method for common use in *ApplicationController* or in some other place that is accessable
|
|
74
73
|
to all controllers.
|
|
75
74
|
|
|
76
|
-
###Using hooks
|
|
75
|
+
### Using hooks
|
|
77
76
|
|
|
78
77
|
Lolita define hooks for RestController and for components.
|
|
79
|
-
####RestController hooks
|
|
78
|
+
#### RestController hooks
|
|
80
79
|
|
|
81
80
|
There are two kind of hooks for all actions - *before_[action name]* and *after_[action name]*.
|
|
82
81
|
Define callbacks for those hooks outside of controller. This will call User#log_action each time when #destroy
|
|
@@ -103,7 +102,7 @@ class PostController < Lolita::RestController
|
|
|
103
102
|
end
|
|
104
103
|
```
|
|
105
104
|
|
|
106
|
-
####Component hooks
|
|
105
|
+
#### Component hooks
|
|
107
106
|
|
|
108
107
|
Components have three hooks - *before*, *after* and *around*.
|
|
109
108
|
Component hooks are different from controller hooks with names. Each component has it's own name, that is used to
|
|
@@ -136,12 +135,12 @@ Lolita::Hooks.component(:"/lolita/configuration/list/display").around do
|
|
|
136
135
|
end
|
|
137
136
|
```
|
|
138
137
|
|
|
139
|
-
##Tests
|
|
138
|
+
## Tests
|
|
140
139
|
To run all specs run rake, it will run all specs for all supported ORM's.
|
|
141
140
|
|
|
142
141
|
$ rake
|
|
143
142
|
|
|
144
143
|
|
|
145
|
-
##License
|
|
144
|
+
## License
|
|
146
145
|
|
|
147
146
|
Lolita is under MIT license. See [LICENSE.txt](https://github.com/ithouse/lolita/blob/master/LICENSE.txt)
|
data/lib/lolita/rails/routes.rb
CHANGED
|
@@ -34,8 +34,6 @@ module ActionDispatch::Routing
|
|
|
34
34
|
# lolita_for :galleries
|
|
35
35
|
# # lolita_for try to call :lolita_gallery in Mapper class
|
|
36
36
|
def lolita_for *resources
|
|
37
|
-
|
|
38
|
-
return if migrating? || generating?
|
|
39
37
|
options = resources.extract_options!
|
|
40
38
|
|
|
41
39
|
options[:as] ||= @scope[:as] if @scope[:as].present?
|
|
@@ -85,6 +83,10 @@ module ActionDispatch::Routing
|
|
|
85
83
|
Lolita.common_routes(all_resource_classes).each do |route_name|
|
|
86
84
|
send(:"lolita_#{route_name}_route")
|
|
87
85
|
end
|
|
86
|
+
# rescues sql exception when migration for new model is executed
|
|
87
|
+
rescue ActiveRecord::StatementInvalid
|
|
88
|
+
Rails.logger.debug "Executing lolita_for got an error: #{$!}"
|
|
89
|
+
nil
|
|
88
90
|
end
|
|
89
91
|
|
|
90
92
|
protected
|
|
@@ -110,22 +112,6 @@ module ActionDispatch::Routing
|
|
|
110
112
|
|
|
111
113
|
private
|
|
112
114
|
|
|
113
|
-
def migrating?
|
|
114
|
-
if Lolita.application.skip_routes.respond_to?(:call)
|
|
115
|
-
Lolita.application.skip_routes.call
|
|
116
|
-
else
|
|
117
|
-
File.basename($0).match(/^rake/) && (ARGV.detect{|arg| arg.to_s.match(/db|apartment/)})
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
def generating?
|
|
122
|
-
if Lolita.application.skip_routes.respond_to?(:call)
|
|
123
|
-
Lolita.application.skip_routes.call
|
|
124
|
-
else
|
|
125
|
-
Lolita.application.skip_routes || File.basename($0).match(/^rails/) && generator_detected?
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
115
|
def generator_detected?
|
|
130
116
|
defined?(Rails::Generators)
|
|
131
117
|
end
|
data/lib/lolita/version.rb
CHANGED
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.0.1
|
|
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-01-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: kaminari
|