typus 3.1.0.rc12 → 3.1.0.rc13
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/base_controller.rb +1 -6
- data/app/controllers/admin/resources_controller.rb +1 -1
- data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +2 -2
- data/app/helpers/admin/resources/data_types/has_many_helper.rb +1 -1
- data/app/helpers/admin/resources/display_helper.rb +1 -1
- data/app/helpers/admin/resources/filters_helper.rb +1 -1
- data/app/helpers/admin/resources/relationships_helper.rb +1 -1
- data/app/helpers/admin/resources_helper.rb +1 -1
- data/app/themes/default/views/admin/dashboard/_applications.html.erb +1 -1
- data/app/themes/default/views/helpers/admin/resources/_sidebar.html.erb +1 -1
- data/lib/generators/templates/config/typus/typus.yml +2 -2
- data/lib/support/string.rb +1 -5
- data/lib/typus.rb +1 -1
- data/lib/typus/configuration.rb +0 -14
- data/lib/typus/controller/associations.rb +2 -2
- data/lib/typus/version.rb +1 -1
- metadata +17 -17
@@ -2,7 +2,6 @@ class Admin::BaseController < ActionController::Base
|
|
2
2
|
|
3
3
|
include Typus::Authentication::const_get(Typus.authentication.to_s.classify)
|
4
4
|
|
5
|
-
before_filter :set_models_constantized
|
6
5
|
before_filter :reload_config_and_roles
|
7
6
|
before_filter :authenticate
|
8
7
|
before_filter :set_locale
|
@@ -14,12 +13,8 @@ class Admin::BaseController < ActionController::Base
|
|
14
13
|
|
15
14
|
protected
|
16
15
|
|
17
|
-
def set_models_constantized
|
18
|
-
Typus::Configuration.models_constantized!
|
19
|
-
end
|
20
|
-
|
21
16
|
def reload_config_and_roles
|
22
|
-
Typus.reload!
|
17
|
+
Typus.reload! if Rails.env.development?
|
23
18
|
end
|
24
19
|
|
25
20
|
def set_locale
|
@@ -211,7 +211,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
211
211
|
# call the related method.
|
212
212
|
#
|
213
213
|
if params[:_saveandassign]
|
214
|
-
item_class = params[:resource].
|
214
|
+
item_class = params[:resource].constantize
|
215
215
|
# For some reason we are forced to set the /admin prefix to the controller
|
216
216
|
# when working with namespaced stuff.
|
217
217
|
options = { :controller => "/admin/#{item_class.to_resource}" }
|
@@ -6,7 +6,7 @@ module Admin::Resources::DataTypes::BelongsToHelper
|
|
6
6
|
related = if defined?(set_belongs_to_context)
|
7
7
|
set_belongs_to_context.send(attribute.pluralize.to_sym)
|
8
8
|
else
|
9
|
-
association.class_name.
|
9
|
+
association.class_name.constantize
|
10
10
|
end
|
11
11
|
related_fk = association.foreign_key
|
12
12
|
|
@@ -70,7 +70,7 @@ module Admin::Resources::DataTypes::BelongsToHelper
|
|
70
70
|
def belongs_to_filter(filter)
|
71
71
|
att_assoc = @resource.reflect_on_association(filter.to_sym)
|
72
72
|
class_name = att_assoc.options[:class_name] || filter.capitalize.camelize
|
73
|
-
resource = class_name.
|
73
|
+
resource = class_name.constantize
|
74
74
|
|
75
75
|
items = [[Typus::I18n.t("View all %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase.pluralize), ""]]
|
76
76
|
items += resource.order(resource.typus_order_by).map { |v| [v.to_label, v.id] }
|
@@ -3,7 +3,7 @@ module Admin::Resources::DataTypes::HasManyHelper
|
|
3
3
|
def has_many_filter(filter)
|
4
4
|
att_assoc = @resource.reflect_on_association(filter.to_sym)
|
5
5
|
class_name = att_assoc.options[:class_name] || filter.classify
|
6
|
-
resource = class_name.
|
6
|
+
resource = class_name.constantize
|
7
7
|
|
8
8
|
items = [[Typus::I18n.t("View all %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase.pluralize), ""]]
|
9
9
|
items += resource.order(resource.typus_order_by).map { |v| [v.to_label, v.id] }
|
@@ -17,7 +17,7 @@ module Admin::Resources::DisplayHelper
|
|
17
17
|
@resource.typus_defaults_for(:relationships).each do |relationship|
|
18
18
|
association = @resource.reflect_on_association(relationship.to_sym)
|
19
19
|
next if association.macro == :belongs_to
|
20
|
-
next if admin_user.cannot?('read', association.class_name.
|
20
|
+
next if admin_user.cannot?('read', association.class_name.constantize)
|
21
21
|
html << send("typus_form_#{association.macro}", relationship)
|
22
22
|
end
|
23
23
|
end.html_safe
|
@@ -27,7 +27,7 @@ module Admin::Resources::FiltersHelper
|
|
27
27
|
|
28
28
|
att_assoc = @resource.reflect_on_association(key.to_sym)
|
29
29
|
class_name = att_assoc.options[:class_name] || key.capitalize.camelize
|
30
|
-
resource = class_name.
|
30
|
+
resource = class_name.constantize
|
31
31
|
att_assoc.foreign_key
|
32
32
|
end
|
33
33
|
|
@@ -2,7 +2,7 @@ module Admin::Resources::RelationshipsHelper
|
|
2
2
|
|
3
3
|
def setup_relationship(field)
|
4
4
|
@field = field
|
5
|
-
@model_to_relate = @resource.reflect_on_association(field.to_sym).class_name.
|
5
|
+
@model_to_relate = @resource.reflect_on_association(field.to_sym).class_name.constantize
|
6
6
|
@model_to_relate_as_resource = @model_to_relate.to_resource
|
7
7
|
@reflection = @resource.reflect_on_association(field.to_sym)
|
8
8
|
@association_name = @reflection.name.to_s
|
@@ -16,7 +16,7 @@ module Admin::ResourcesHelper
|
|
16
16
|
app_name = @resource.typus_application
|
17
17
|
|
18
18
|
admin_user.application(app_name).each do |resource|
|
19
|
-
klass = resource.
|
19
|
+
klass = resource.constantize
|
20
20
|
resources[resource] = [sidebar_all_resource(klass), sidebar_add_new(klass)].compact
|
21
21
|
end
|
22
22
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
</tr>
|
9
9
|
</thead>
|
10
10
|
|
11
|
-
<% admin_user.application(app).map { |i| i.
|
11
|
+
<% admin_user.application(app).map { |i| i.constantize }.each do |klass| %>
|
12
12
|
<tr class="<%= cycle("even", "odd") %>">
|
13
13
|
<td>
|
14
14
|
<%= link_to klass.model_name.human.pluralize, :controller => "/admin/#{klass.to_resource}" %>
|
@@ -6,12 +6,12 @@
|
|
6
6
|
fields:
|
7
7
|
default: first_name, last_name, role, email, locale
|
8
8
|
list: email, role, status
|
9
|
-
form: first_name, last_name, role, email, password, password_confirmation, locale
|
9
|
+
form: first_name, last_name, role, email, password, password_confirmation, locale, status
|
10
10
|
options:
|
11
11
|
selectors: role, locale
|
12
12
|
booleans:
|
13
13
|
status: Active, Inactive
|
14
14
|
filters: status, role
|
15
|
-
search: first_name, last_name, email
|
15
|
+
search: first_name, last_name, email, role
|
16
16
|
application: Admin
|
17
17
|
description: Users Administration
|
data/lib/support/string.rb
CHANGED
data/lib/typus.rb
CHANGED
data/lib/typus/configuration.rb
CHANGED
@@ -17,10 +17,6 @@ module Typus
|
|
17
17
|
mattr_accessor :config
|
18
18
|
@@config = {}
|
19
19
|
|
20
|
-
def self.register_config(config)
|
21
|
-
@@config.merge!(config)
|
22
|
-
end
|
23
|
-
|
24
20
|
# Read roles from files <tt>config/typus/*_roles.yml</tt>.
|
25
21
|
def self.roles!
|
26
22
|
files = Dir[File.join(Typus.config_folder, "*_roles.yml").to_s].sort
|
@@ -39,15 +35,5 @@ module Typus
|
|
39
35
|
mattr_accessor :roles
|
40
36
|
@@roles = {}
|
41
37
|
|
42
|
-
def self.register_roles(roles)
|
43
|
-
@@roles.merge!(roles)
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.models_constantized!
|
47
|
-
@@models_constantized = config.map { |i| i.first }.inject({}) { |result, model| result[model] = model.constantize; result }
|
48
|
-
end
|
49
|
-
|
50
|
-
mattr_accessor :models_constantized
|
51
|
-
|
52
38
|
end
|
53
39
|
end
|
@@ -26,7 +26,7 @@ module Typus
|
|
26
26
|
# => ...
|
27
27
|
#
|
28
28
|
def relate
|
29
|
-
resource_class = params[:resource].
|
29
|
+
resource_class = params[:resource].constantize
|
30
30
|
association_name = resource_class.table_name
|
31
31
|
|
32
32
|
item = resource_class.find(params[:resource_id])
|
@@ -45,7 +45,7 @@ module Typus
|
|
45
45
|
# - has_one
|
46
46
|
#
|
47
47
|
def unrelate
|
48
|
-
item_class = params[:resource].
|
48
|
+
item_class = params[:resource].constantize
|
49
49
|
item = item_class.find(params[:resource_id])
|
50
50
|
|
51
51
|
case item_class.relationship_with(@resource)
|
data/lib/typus/version.rb
CHANGED
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.0.
|
4
|
+
version: 3.1.0.rc13
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-07-07 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dragonfly
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153129580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.9'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153129580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jquery-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153129140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153129140
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: paperclip
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153128580 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153128580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rack-cache
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153127680 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2153127680
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rails-trash
|
60
|
-
requirement: &
|
60
|
+
requirement: &2153125960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.1.1
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2153125960
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jquery-rails
|
71
|
-
requirement: &
|
71
|
+
requirement: &2153125020 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2153125020
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: kaminari
|
82
|
-
requirement: &
|
82
|
+
requirement: &2153124140 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2153124140
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rails
|
93
|
-
requirement: &
|
93
|
+
requirement: &2153123580 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: 3.1.0.rc4
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2153123580
|
102
102
|
description: Ruby on Rails Admin Panel (Engine) to allow trusted users edit structured
|
103
103
|
content.
|
104
104
|
email:
|