typus 3.1.5 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGELOG → CHANGELOG.md} +73 -22
- data/Gemfile +6 -6
- data/README.md +1 -1
- data/app/controllers/admin/resources_controller.rb +1 -1
- data/app/helpers/admin/resources/data_types/integer_helper.rb +10 -0
- data/app/helpers/admin/resources/data_types/position_helper.rb +1 -1
- data/app/helpers/admin/resources/filters_helper.rb +2 -1
- data/app/helpers/admin/resources/form_helper.rb +7 -3
- data/app/helpers/admin/resources/relationships_helper.rb +2 -1
- data/app/views/admin/templates/_has_many.html.erb +5 -1
- data/app/views/admin/templates/_position.html.erb +1 -1
- data/config/routes.rb +3 -6
- data/lib/typus.rb +5 -2
- data/lib/typus/controller/format.rb +1 -1
- data/lib/typus/orm/active_record/class_methods.rb +5 -14
- data/lib/typus/orm/active_record/search.rb +2 -66
- data/lib/typus/orm/base/class_methods.rb +180 -0
- data/lib/typus/orm/base/search.rb +91 -0
- data/lib/typus/orm/mongoid.rb +12 -1
- data/lib/typus/orm/mongoid/class_methods.rb +55 -1
- data/lib/typus/orm/mongoid/instance_methods.rb +18 -0
- data/lib/typus/orm/mongoid/search.rb +46 -0
- data/lib/typus/version.rb +1 -1
- data/typus.gemspec +2 -2
- data/vendor/assets/fancybox/{jquery.fancybox-1.3.4.css → jquery.fancybox-1.3.4.css.erb} +33 -33
- metadata +22 -18
- data/lib/typus/orm/base.rb +0 -167
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bcrypt-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &70213462925800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70213462925800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jquery-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70213462924980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,29 +32,29 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70213462924980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: kaminari
|
38
|
-
requirement: &
|
38
|
+
requirement: &70213462921200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 0.12.4
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70213462921200
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rails
|
49
|
-
requirement: &
|
49
|
+
requirement: &70213462939560 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.1.
|
54
|
+
version: 3.1.3
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70213462939560
|
58
58
|
description: Ruby on Rails Admin Panel (Engine) to allow trusted users edit structured
|
59
59
|
content.
|
60
60
|
email:
|
@@ -63,7 +63,7 @@ executables: []
|
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files: []
|
65
65
|
files:
|
66
|
-
- CHANGELOG
|
66
|
+
- CHANGELOG.md
|
67
67
|
- Gemfile
|
68
68
|
- MIT-LICENSE
|
69
69
|
- README.md
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb
|
103
103
|
- app/helpers/admin/resources/data_types/has_many_helper.rb
|
104
104
|
- app/helpers/admin/resources/data_types/has_one_helper.rb
|
105
|
+
- app/helpers/admin/resources/data_types/integer_helper.rb
|
105
106
|
- app/helpers/admin/resources/data_types/paperclip_helper.rb
|
106
107
|
- app/helpers/admin/resources/data_types/position_helper.rb
|
107
108
|
- app/helpers/admin/resources/data_types/selector_helper.rb
|
@@ -258,9 +259,12 @@ files:
|
|
258
259
|
- lib/typus/orm/active_record/user/class_methods.rb
|
259
260
|
- lib/typus/orm/active_record/user/instance_methods.rb
|
260
261
|
- lib/typus/orm/active_record/user/instance_methods_more.rb
|
261
|
-
- lib/typus/orm/base.rb
|
262
|
+
- lib/typus/orm/base/class_methods.rb
|
263
|
+
- lib/typus/orm/base/search.rb
|
262
264
|
- lib/typus/orm/mongoid.rb
|
263
265
|
- lib/typus/orm/mongoid/class_methods.rb
|
266
|
+
- lib/typus/orm/mongoid/instance_methods.rb
|
267
|
+
- lib/typus/orm/mongoid/search.rb
|
264
268
|
- lib/typus/regex.rb
|
265
269
|
- lib/typus/resources.rb
|
266
270
|
- lib/typus/version.rb
|
@@ -307,7 +311,7 @@ files:
|
|
307
311
|
- vendor/assets/fancybox/fancybox-x.png
|
308
312
|
- vendor/assets/fancybox/fancybox-y.png
|
309
313
|
- vendor/assets/fancybox/fancybox.png
|
310
|
-
- vendor/assets/fancybox/jquery.fancybox-1.3.4.css
|
314
|
+
- vendor/assets/fancybox/jquery.fancybox-1.3.4.css.erb
|
311
315
|
- vendor/assets/fancybox/jquery.fancybox-1.3.4.pack.js
|
312
316
|
- vendor/assets/formalize/.gitignore
|
313
317
|
- vendor/assets/formalize/css/formalize.css
|
@@ -329,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
329
333
|
version: '0'
|
330
334
|
segments:
|
331
335
|
- 0
|
332
|
-
hash:
|
336
|
+
hash: 3351687569820403912
|
333
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
334
338
|
none: false
|
335
339
|
requirements:
|
@@ -338,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
338
342
|
version: '0'
|
339
343
|
segments:
|
340
344
|
- 0
|
341
|
-
hash:
|
345
|
+
hash: 3351687569820403912
|
342
346
|
requirements: []
|
343
347
|
rubyforge_project: typus
|
344
348
|
rubygems_version: 1.8.11
|
data/lib/typus/orm/base.rb
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
module Typus
|
2
|
-
module Orm
|
3
|
-
module Base
|
4
|
-
|
5
|
-
# Model fields as an <tt>ActiveSupport::OrderedHash</tt>.
|
6
|
-
def model_fields; end
|
7
|
-
|
8
|
-
# Model relationships as an <tt>ActiveSupport::OrderedHash</tt>.
|
9
|
-
def model_relationships; end
|
10
|
-
|
11
|
-
# Model description for admin panel.
|
12
|
-
def typus_description
|
13
|
-
read_model_config['description']
|
14
|
-
end
|
15
|
-
|
16
|
-
# Form and list fields
|
17
|
-
def typus_fields_for(filter); end
|
18
|
-
|
19
|
-
def typus_filters; end
|
20
|
-
|
21
|
-
# Extended actions for this model on Typus.
|
22
|
-
def typus_actions_on(filter)
|
23
|
-
actions = read_model_config['actions']
|
24
|
-
actions && actions[filter.to_s] ? actions[filter.to_s].extract_settings : []
|
25
|
-
end
|
26
|
-
|
27
|
-
# Used for +search+, +relationships+
|
28
|
-
def typus_defaults_for(filter)
|
29
|
-
read_model_config[filter.to_s].try(:extract_settings) || []
|
30
|
-
end
|
31
|
-
|
32
|
-
def typus_search_fields
|
33
|
-
Hash.new.tap do |search|
|
34
|
-
typus_defaults_for(:search).each do |field|
|
35
|
-
if field.starts_with?("=")
|
36
|
-
field.slice!(0)
|
37
|
-
search[field] = "="
|
38
|
-
elsif field.starts_with?("^")
|
39
|
-
field.slice!(0)
|
40
|
-
search[field] = "^"
|
41
|
-
else
|
42
|
-
search[field] = "@"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def typus_application
|
49
|
-
name = read_model_config['application'] || 'Unknown'
|
50
|
-
name.extract_settings.first
|
51
|
-
end
|
52
|
-
|
53
|
-
def typus_field_options_for(filter)
|
54
|
-
options = read_model_config['fields']['options']
|
55
|
-
options && options[filter.to_s] ? options[filter.to_s].extract_settings.map(&:to_sym) : []
|
56
|
-
end
|
57
|
-
|
58
|
-
#--
|
59
|
-
# With +Typus::Resources.setup+ we can define application defaults.
|
60
|
-
#
|
61
|
-
# Typus::Resources.setup do |config|
|
62
|
-
# config.per_page = 25
|
63
|
-
# end
|
64
|
-
#
|
65
|
-
# If for any reason we need a better default for an specific resource we
|
66
|
-
# can override it on +application.yaml+.
|
67
|
-
#
|
68
|
-
# Post:
|
69
|
-
# ...
|
70
|
-
# options:
|
71
|
-
# per_page: 25
|
72
|
-
#++
|
73
|
-
def typus_options_for(filter)
|
74
|
-
options = read_model_config['options']
|
75
|
-
|
76
|
-
unless options.nil? || options[filter.to_s].nil?
|
77
|
-
options[filter.to_s]
|
78
|
-
else
|
79
|
-
Typus::Resources.send(filter)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def typus_order_by
|
84
|
-
typus_defaults_for(:order_by).map do |field|
|
85
|
-
field.include?('-') ? "#{field.delete('-')} DESC" : "#{field} ASC"
|
86
|
-
end.join(', ')
|
87
|
-
end
|
88
|
-
|
89
|
-
#--
|
90
|
-
# Define our own boolean mappings.
|
91
|
-
#
|
92
|
-
# Post:
|
93
|
-
# fields:
|
94
|
-
# default: title, status
|
95
|
-
# options:
|
96
|
-
# booleans:
|
97
|
-
# status: "Published", "Not published"
|
98
|
-
#
|
99
|
-
#++
|
100
|
-
def typus_boolean(attribute = :default)
|
101
|
-
options = read_model_config['fields']['options']
|
102
|
-
|
103
|
-
boolean = if options && options['booleans'] && boolean = options['booleans'][attribute.to_s]
|
104
|
-
boolean.is_a?(String) ? boolean.extract_settings : boolean
|
105
|
-
else
|
106
|
-
["True", "False"]
|
107
|
-
end
|
108
|
-
|
109
|
-
[[boolean.first, "true"], [boolean.last, "false"]]
|
110
|
-
end
|
111
|
-
|
112
|
-
#--
|
113
|
-
# Custom date formats.
|
114
|
-
#++
|
115
|
-
def typus_date_format(attribute = :default)
|
116
|
-
options = read_model_config['fields']['options']
|
117
|
-
if options && options['date_formats'] && options['date_formats'][attribute.to_s]
|
118
|
-
options['date_formats'][attribute.to_s].to_sym
|
119
|
-
else
|
120
|
-
:default
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
#--
|
125
|
-
# This is user to use custome templates for attribute:
|
126
|
-
#
|
127
|
-
# Post:
|
128
|
-
# fields:
|
129
|
-
# form: title, body, status
|
130
|
-
# options:
|
131
|
-
# templates:
|
132
|
-
# body: rich_text
|
133
|
-
#
|
134
|
-
# Templates are stored on <tt>app/views/admin/templates</tt>.
|
135
|
-
#++
|
136
|
-
def typus_template(attribute)
|
137
|
-
options = read_model_config['fields']['options']
|
138
|
-
if options && options['templates'] && options['templates'][attribute.to_s]
|
139
|
-
options['templates'][attribute.to_s]
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def adapter
|
144
|
-
@adapter ||= ::ActiveRecord::Base.configurations[Rails.env]['adapter']
|
145
|
-
end
|
146
|
-
|
147
|
-
def typus_user_id?
|
148
|
-
columns.map(&:name).include?(Typus.user_foreign_key)
|
149
|
-
end
|
150
|
-
|
151
|
-
def read_model_config
|
152
|
-
Typus::Configuration.config[name] or raise "No typus configuration specified for #{name}"
|
153
|
-
end
|
154
|
-
|
155
|
-
#--
|
156
|
-
# >> Post.to_resource
|
157
|
-
# => "posts"
|
158
|
-
# >> Admin::User.to_resource
|
159
|
-
# => "admin/users"
|
160
|
-
#++
|
161
|
-
def to_resource
|
162
|
-
name.underscore.pluralize
|
163
|
-
end
|
164
|
-
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|