typus 1.0.0.pre5 → 1.0.0.pre6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -5
- data/Rakefile +5 -1
- data/app/controllers/admin/account_controller.rb +3 -3
- data/app/controllers/admin/resources_controller.rb +12 -12
- data/app/controllers/admin/session_controller.rb +1 -1
- data/app/helpers/admin/base_helper.rb +1 -1
- data/app/helpers/admin/filters_helper.rb +6 -6
- data/app/helpers/admin/relationships_helper.rb +6 -6
- data/app/helpers/admin/resources_helper.rb +2 -2
- data/app/helpers/admin/sidebar_helper.rb +4 -4
- data/app/helpers/admin/table_helper.rb +9 -9
- data/app/mailers/admin/mailer.rb +1 -1
- data/app/views/admin/account/forgot_password.html.erb +2 -2
- data/app/views/admin/account/new.html.erb +2 -2
- data/app/views/admin/dashboard/show.html.erb +1 -1
- data/app/views/admin/helpers/_apps.html.erb +2 -2
- data/app/views/admin/helpers/_header.html.erb +1 -1
- data/app/views/admin/helpers/_login_info.html.erb +2 -2
- data/app/views/admin/helpers/dashboard/_applications.html.erb +2 -2
- data/app/views/admin/helpers/dashboard/_resources.html.erb +2 -2
- data/app/views/admin/helpers/filters/_filters.html.erb +1 -1
- data/app/views/admin/helpers/resources/_display_link_to_previous.html.erb +1 -1
- data/app/views/admin/helpers/resources/_pagination.html.erb +2 -2
- data/app/views/admin/helpers/search/_search.html.erb +1 -1
- data/app/views/admin/helpers/sidebar/_sidebar.html.erb +1 -1
- data/app/views/admin/mailer/reset_password_link.text.erb +2 -2
- data/app/views/admin/resources/_form.html.erb +1 -1
- data/app/views/admin/resources/edit.html.erb +2 -2
- data/app/views/admin/resources/index.html.erb +4 -4
- data/app/views/admin/resources/new.html.erb +2 -2
- data/app/views/admin/resources/show.html.erb +1 -1
- data/app/views/admin/session/new.html.erb +2 -2
- data/app/views/admin/templates/_file.html.erb +2 -2
- data/app/views/admin/templates/_has_many.html.erb +2 -2
- data/app/views/admin/templates/_has_n.html.erb +1 -1
- data/app/views/admin/templates/_relate_form.html.erb +1 -1
- data/app/views/admin/templates/_string.html.erb +2 -2
- data/lib/support/object.rb +3 -3
- data/lib/typus/authentication.rb +10 -10
- data/lib/typus/version.rb +1 -1
- data/test/fixtures/rails_app/app/views/admin/mailer/reset_password_link.text.erb +2 -2
- data/typus-1.0.0.pre5.gem +0 -0
- metadata +4 -39
- data/test/fixtures/rails_app/db/test.sqlite3 +0 -0
- data/test/fixtures/rails_app/tmp/export-posts-20100913124503.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913124524.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913124638.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913124717.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913125425.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913125626.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913125651.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913125741.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913125827.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913125856.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913125928.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913130119.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913130159.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913130319.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913130339.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913131400.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913131915.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913132022.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913132844.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913171700.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913172044.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913172118.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913174300.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913174322.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913174959.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913175019.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913175116.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913175204.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913175228.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913175254.csv +0 -2
- data/test/fixtures/rails_app/tmp/export-posts-20100913180324.csv +0 -2
- data/typus-1.0.0.pre2.gem +0 -0
- data/typus-1.0.0.pre3.gem +0 -0
- data/typus-1.0.0.pre4.gem +0 -0
data/README.rdoc
CHANGED
@@ -29,16 +29,19 @@ enough to match lots of use cases.
|
|
29
29
|
|
30
30
|
== Installing
|
31
31
|
|
32
|
-
|
33
|
-
<tt>Rails 3.0.0</tt>.
|
32
|
+
Add *Typus* to your <tt>Gemfile</tt>.
|
34
33
|
|
35
|
-
|
34
|
+
gem 'typus', :git => 'git://github.com/fesplugas/typus.git'
|
36
35
|
|
37
|
-
|
36
|
+
Update your bundle.
|
37
|
+
|
38
|
+
$ bundle install
|
39
|
+
|
40
|
+
Run the *Typus* generator.
|
38
41
|
|
39
42
|
$ rails generate typus
|
40
43
|
|
41
|
-
Start the application server and go to {http://0.0.0.0:3000/admin}[http://0.0.0.0:3000/admin].
|
44
|
+
Start the application server and go to {http://0.0.0.0:3000/admin}[http://0.0.0.0:3000/admin]http://0.0.0.0:3000/admin.
|
42
45
|
|
43
46
|
== License
|
44
47
|
|
data/Rakefile
CHANGED
@@ -33,9 +33,13 @@ end
|
|
33
33
|
desc 'Build and release the gem.'
|
34
34
|
task :release => :build do
|
35
35
|
version = Typus::VERSION
|
36
|
+
|
36
37
|
system "git commit -m 'Bump version to #{Typus::VERSION}' lib/typus/version.rb"
|
37
38
|
system "git tag v#{version}"
|
38
|
-
system "git push
|
39
|
+
system "git push"
|
40
|
+
system "git push --tags"
|
41
|
+
|
39
42
|
system "gem push typus-#{version}.gem"
|
43
|
+
|
40
44
|
system "git clean -fd"
|
41
45
|
end
|
@@ -10,7 +10,7 @@ class Admin::AccountController < Admin::BaseController
|
|
10
10
|
before_filter :new?, :only => [:forgot_password]
|
11
11
|
|
12
12
|
def new
|
13
|
-
flash[:notice] =
|
13
|
+
flash[:notice] = _t("Enter your email below to create the first user.")
|
14
14
|
end
|
15
15
|
|
16
16
|
def create
|
@@ -25,7 +25,7 @@ class Admin::AccountController < Admin::BaseController
|
|
25
25
|
if user = Typus.user_class.find_by_email(params[:typus_user][:email])
|
26
26
|
url = admin_account_url(user.token)
|
27
27
|
Admin::Mailer.reset_password_link(user, url).deliver
|
28
|
-
notice =
|
28
|
+
notice = _t("Password recovery link sent to your email.")
|
29
29
|
path = new_admin_session_path
|
30
30
|
else
|
31
31
|
render :action => :forgot_password and return
|
@@ -35,7 +35,7 @@ class Admin::AccountController < Admin::BaseController
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def show
|
38
|
-
flash[:notice] =
|
38
|
+
flash[:notice] = _t("Please set a new password.")
|
39
39
|
typus_user = Typus.user_class.find_by_token!(params[:id])
|
40
40
|
session[:typus_user_id] = typus_user.id
|
41
41
|
redirect_to :controller => "admin/#{Typus.user_class.to_resource}", :action => "edit", :id => typus_user.id
|
@@ -94,7 +94,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
94
94
|
|
95
95
|
def destroy
|
96
96
|
@item.destroy
|
97
|
-
notice =
|
97
|
+
notice = _t("%{model} successfully removed.", :model => @resource.model_name.human)
|
98
98
|
redirect_to set_path, :notice => notice
|
99
99
|
end
|
100
100
|
|
@@ -102,7 +102,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
102
102
|
@item.toggle(params[:field])
|
103
103
|
@item.save!
|
104
104
|
|
105
|
-
notice =
|
105
|
+
notice = _t("%{model} %{attribute} changed.",
|
106
106
|
:model => @resource.model_name.human,
|
107
107
|
:attribute => params[:field].humanize.downcase)
|
108
108
|
|
@@ -120,7 +120,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
120
120
|
#
|
121
121
|
def position
|
122
122
|
@item.send(params[:go])
|
123
|
-
notice =
|
123
|
+
notice = _t("Record moved %{to}.", :to => params[:go].gsub(/move_/, '').humanize.downcase)
|
124
124
|
redirect_to set_path, :notice => notice
|
125
125
|
end
|
126
126
|
|
@@ -133,11 +133,11 @@ class Admin::ResourcesController < Admin::BaseController
|
|
133
133
|
resource_tableized = params[:related][:model].tableize
|
134
134
|
|
135
135
|
if @item.send(resource_tableized) << resource_class.find(params[:related][:id])
|
136
|
-
flash[:notice] =
|
136
|
+
flash[:notice] = _t("%{model_a} related to %{model_b}",
|
137
137
|
:model_a => resource_class.model_name.human,
|
138
138
|
:model_b => @resource.model_name.human)
|
139
139
|
else
|
140
|
-
flash[:alert] =
|
140
|
+
flash[:alert] = _t("%{model_a} cannot be related to %{model_b}",
|
141
141
|
:model_a => resource_class.model_name.human,
|
142
142
|
:model_b => @resource.model_name.human)
|
143
143
|
end
|
@@ -178,11 +178,11 @@ class Admin::ResourcesController < Admin::BaseController
|
|
178
178
|
end
|
179
179
|
|
180
180
|
if saved_succesfully
|
181
|
-
flash[:notice] =
|
181
|
+
flash[:notice] = _t("%{model_a} unrelated from %{model_b}",
|
182
182
|
:model_a => resource_class.model_name.human,
|
183
183
|
:model_b => @resource.model_name.human)
|
184
184
|
else
|
185
|
-
flash[:alert] =
|
185
|
+
flash[:alert] = _t("%{model_a} cannot be unrelated from %{model_b}",
|
186
186
|
:model_a => resource_class.model_name.human,
|
187
187
|
:model_b => @resource.model_name.human)
|
188
188
|
end
|
@@ -202,7 +202,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
202
202
|
end
|
203
203
|
|
204
204
|
attachment = @resource.human_attribute_name(params[:attachment])
|
205
|
-
notice =
|
205
|
+
notice = _t(message, :attachment => attachment)
|
206
206
|
|
207
207
|
redirect_to set_path, :notice => notice
|
208
208
|
end
|
@@ -244,7 +244,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
244
244
|
when "create"
|
245
245
|
path = { :action => action }
|
246
246
|
path.merge!(:id => @item.id) unless action.eql?("index")
|
247
|
-
notice =
|
247
|
+
notice = _t("%{model} successfully created.", :model => @resource.model_name.human)
|
248
248
|
when "update"
|
249
249
|
path = case action
|
250
250
|
when "index"
|
@@ -254,7 +254,7 @@ class Admin::ResourcesController < Admin::BaseController
|
|
254
254
|
:id => @item.id,
|
255
255
|
:back_to => params[:back_to] }
|
256
256
|
end
|
257
|
-
notice =
|
257
|
+
notice = _t("%{model} successfully updated.", :model => @resource.model_name.human)
|
258
258
|
end
|
259
259
|
|
260
260
|
redirect_to path, :notice => notice
|
@@ -285,13 +285,13 @@ class Admin::ResourcesController < Admin::BaseController
|
|
285
285
|
@item.send(params[:resource]) << resource
|
286
286
|
when :has_many
|
287
287
|
@item.save
|
288
|
-
message =
|
288
|
+
message = _t("%{model} successfully created.", :model => @resource.model_name.human)
|
289
289
|
path = "#{params[:back_to]}?#{params[:selected]}=#{@item.id}"
|
290
290
|
when :polymorphic
|
291
291
|
resource.send(@item.class.to_resource).create(params[@object_name])
|
292
292
|
end
|
293
293
|
|
294
|
-
flash[:notice] = message ||
|
294
|
+
flash[:notice] = message || _t("%{model_a} successfully assigned to %{model_b}.",
|
295
295
|
:model_a => @item.class.model_name.human,
|
296
296
|
:model_b => resource_class.model_name.human)
|
297
297
|
|
@@ -16,7 +16,7 @@ class Admin::SessionController < Admin::BaseController
|
|
16
16
|
session[:typus_user_id] = user.id
|
17
17
|
path = params[:back_to] || admin_dashboard_path
|
18
18
|
else
|
19
|
-
alert =
|
19
|
+
alert = _t("The email and/or password you entered is invalid.")
|
20
20
|
path = new_admin_session_path(:back_to => params[:back_to])
|
21
21
|
end
|
22
22
|
|
@@ -39,7 +39,7 @@ module Admin
|
|
39
39
|
:action => 'edit',
|
40
40
|
:id => user.id }
|
41
41
|
|
42
|
-
message =
|
42
|
+
message = _t("Are you sure you want to sign out and end your session?")
|
43
43
|
|
44
44
|
user_details = if user.can?('edit', Typus.user_class_name)
|
45
45
|
link_to user.name, admin_edit_typus_user_path
|
@@ -44,36 +44,36 @@ module Admin
|
|
44
44
|
values_labelized = values.map { |v| v.to_label }
|
45
45
|
items = values.map(&:id).to_hash_with(values_labelized)
|
46
46
|
|
47
|
-
message =
|
47
|
+
message = _t("View all %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase.pluralize)
|
48
48
|
|
49
49
|
return filter, items, message
|
50
50
|
end
|
51
51
|
|
52
52
|
def date_filter(request, filter)
|
53
53
|
values = %w(today last_few_days last_7_days last_30_days)
|
54
|
-
values_humanized = values.map { |v|
|
54
|
+
values_humanized = values.map { |v| _t(v.humanize) }
|
55
55
|
items = values.to_hash_with(values_humanized)
|
56
|
-
message =
|
56
|
+
message = _t("Show all dates")
|
57
57
|
return filter, items, message
|
58
58
|
end
|
59
59
|
|
60
60
|
def boolean_filter(request, filter)
|
61
61
|
items = @resource.typus_boolean(filter)
|
62
|
-
message =
|
62
|
+
message = _t("Show by %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase)
|
63
63
|
return filter, items, message
|
64
64
|
end
|
65
65
|
|
66
66
|
def string_filter(request, filter)
|
67
67
|
values = @resource::const_get(filter.to_s.upcase)
|
68
68
|
items = values.kind_of?(Hash) ? values : values.to_hash_with(values)
|
69
|
-
message =
|
69
|
+
message = _t("Show by %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase)
|
70
70
|
return filter, items, message
|
71
71
|
end
|
72
72
|
|
73
73
|
def remove_filter_link(filter = request.env['QUERY_STRING'])
|
74
74
|
return unless filter && !filter.blank?
|
75
75
|
message = params.compact.include?(:search) ? "search" : "filter"
|
76
|
-
link_to
|
76
|
+
link_to _t("Remove #{message}")
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
@@ -91,7 +91,7 @@ module Admin
|
|
91
91
|
|
92
92
|
return unless set_condition && @current_user.can?("create", @model_to_relate)
|
93
93
|
|
94
|
-
link_to
|
94
|
+
link_to _t("Add new"), default_options.merge(options)
|
95
95
|
end
|
96
96
|
|
97
97
|
def set_condition
|
@@ -138,7 +138,7 @@ module Admin
|
|
138
138
|
options,
|
139
139
|
association)
|
140
140
|
else
|
141
|
-
message =
|
141
|
+
message = _t("There are no %{records}.",
|
142
142
|
:records => model_to_relate.model_name.human.downcase)
|
143
143
|
html << <<-HTML
|
144
144
|
<div id="flash" class="notice"><p>#{message}</p></div>
|
@@ -164,11 +164,11 @@ module Admin
|
|
164
164
|
related = @resource.reflect_on_association(attribute.to_sym).class_name.constantize
|
165
165
|
related_fk = @resource.reflect_on_association(attribute.to_sym).primary_key_name
|
166
166
|
|
167
|
-
confirm = [
|
168
|
-
|
169
|
-
|
167
|
+
confirm = [ _t("Are you sure you want to leave this page?"),
|
168
|
+
_t("If you have made any changes to the fields without clicking the Save/Update entry button, your changes will be lost."),
|
169
|
+
_t("Click OK to continue, or click Cancel to stay on this page.") ]
|
170
170
|
|
171
|
-
message = link_to
|
171
|
+
message = link_to _t("Add"), { :controller => "admin/#{related.to_resource}",
|
172
172
|
:action => 'new',
|
173
173
|
:back_to => back_to,
|
174
174
|
:selected => related_fk },
|
@@ -43,7 +43,7 @@ module Admin
|
|
43
43
|
else
|
44
44
|
"You're adding a new %{resource_from}."
|
45
45
|
end
|
46
|
-
message =
|
46
|
+
message = _t(message,
|
47
47
|
:resource_from => options[:resource_from],
|
48
48
|
:resource_to => options[:resource_to])
|
49
49
|
|
@@ -62,7 +62,7 @@ module Admin
|
|
62
62
|
options = { :controller => klass.to_resource }
|
63
63
|
items = klass.typus_actions_on("index").map do |action|
|
64
64
|
if @current_user.can?(action, klass)
|
65
|
-
(link_to
|
65
|
+
(link_to _t(action.humanize), options.merge(:action => action))
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -21,11 +21,11 @@ module Admin
|
|
21
21
|
|
22
22
|
if @current_user.can?("create", klass)
|
23
23
|
options = { :controller => klass.to_resource }
|
24
|
-
message =
|
24
|
+
message = _t("Add new")
|
25
25
|
actions << (link_to_unless_current message, options.merge(:action => "new"))
|
26
26
|
end
|
27
27
|
|
28
|
-
message =
|
28
|
+
message = _t("List")
|
29
29
|
options = { :controller => klass.to_resource }
|
30
30
|
actions << (link_to_unless_current message, options)
|
31
31
|
|
@@ -36,7 +36,7 @@ module Admin
|
|
36
36
|
options = { :controller => klass.to_resource }
|
37
37
|
klass.typus_actions_on("index").map do |action|
|
38
38
|
if @current_user.can?(action, klass)
|
39
|
-
(link_to_unless_current
|
39
|
+
(link_to_unless_current _t(action.humanize), options.merge(:action => action))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -45,7 +45,7 @@ module Admin
|
|
45
45
|
return [] unless params[:action] == "index"
|
46
46
|
|
47
47
|
klass.typus_export_formats.map do |format|
|
48
|
-
link_to
|
48
|
+
link_to _t("Export as %{format}", :format => format.upcase), params.merge(:format => format)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -76,7 +76,7 @@ module Admin
|
|
76
76
|
:action => action,
|
77
77
|
:id => item.id }
|
78
78
|
|
79
|
-
link_to
|
79
|
+
link_to _t(action.capitalize), options
|
80
80
|
end
|
81
81
|
|
82
82
|
#--
|
@@ -100,7 +100,7 @@ module Admin
|
|
100
100
|
options = { :action => 'unrelate', :id => params[:id], :resource => model, :resource_id => item.id }
|
101
101
|
end
|
102
102
|
|
103
|
-
title =
|
103
|
+
title = _t(action.titleize)
|
104
104
|
|
105
105
|
case params[:action]
|
106
106
|
when 'index'
|
@@ -111,10 +111,10 @@ module Admin
|
|
111
111
|
else
|
112
112
|
@current_user.can?('destroy', model)
|
113
113
|
end
|
114
|
-
confirm =
|
114
|
+
confirm = _t("Remove %{resource}?", :resource => item.class.model_name.human)
|
115
115
|
when 'edit'
|
116
116
|
# If we are editing content, we can relate and unrelate always!
|
117
|
-
confirm =
|
117
|
+
confirm = _t("Unrelate %{unrelate_model} from %{unrelate_model_from}?",
|
118
118
|
:unrelate_model => model.model_name.human,
|
119
119
|
:unrelate_model_from => @resource.model_name.human)
|
120
120
|
when 'show'
|
@@ -125,12 +125,12 @@ module Admin
|
|
125
125
|
condition = if @resource.typus_user_id? && @current_user.is_not_root?
|
126
126
|
@item.owned_by?(@current_user)
|
127
127
|
end
|
128
|
-
confirm =
|
128
|
+
confirm = _t("Unrelate %{unrelate_model} from %{unrelate_model_from}?",
|
129
129
|
:unrelate_model => model.model_name.human,
|
130
130
|
:unrelate_model_from => @resource.model_name.human)
|
131
131
|
end
|
132
132
|
|
133
|
-
message = %(<div class="sprite #{action}">#{
|
133
|
+
message = %(<div class="sprite #{action}">#{_t(action.titleize)}</div>)
|
134
134
|
|
135
135
|
if condition
|
136
136
|
link_to raw(message), options, :title => title, :confirm => confirm, :method => method
|
@@ -203,7 +203,7 @@ module Admin
|
|
203
203
|
{ :move_higher => "Up", :move_lower => "Down" }.each do |key, value|
|
204
204
|
options = { :controller => item.class.to_resource, :action => "position", :id => item.id, :go => key }
|
205
205
|
first_or_last = (item.respond_to?(:first?) && (key == :move_higher && item.first?)) || (item.respond_to?(:last?) && (key == :move_lower && item.last?))
|
206
|
-
html_position << link_to_unless(first_or_last,
|
206
|
+
html_position << link_to_unless(first_or_last, _t(value), params.merge(options)) do |name|
|
207
207
|
%(<span class="inactive">#{name}</span>)
|
208
208
|
end
|
209
209
|
end
|
@@ -226,12 +226,12 @@ module Admin
|
|
226
226
|
content = if status.nil?
|
227
227
|
Typus::Resources.human_nil
|
228
228
|
else
|
229
|
-
message =
|
229
|
+
message = _t(boolean_hash["#{status}".to_sym])
|
230
230
|
options = { :controller => "admin/#{item.class.to_resource}",
|
231
231
|
:action => "toggle",
|
232
232
|
:id => item.id,
|
233
233
|
:field => attribute.gsub(/\?$/,'') }
|
234
|
-
confirm =
|
234
|
+
confirm = _t("Change %{attribute}?",
|
235
235
|
:attribute => item.class.human_attribute_name(attribute).downcase)
|
236
236
|
link_to message, options, :confirm => confirm
|
237
237
|
end
|
data/app/mailers/admin/mailer.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
page_title =
|
2
|
+
page_title = _t("Forgot password")
|
3
3
|
title(page_title)
|
4
4
|
%>
|
5
5
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
</li>
|
14
14
|
|
15
15
|
<li>
|
16
|
-
<%= submit_tag
|
16
|
+
<%= submit_tag _t("Submit"), :class => "button" %> <%= link_to _t("I remember my password"), new_admin_session_path %>
|
17
17
|
</li>
|
18
18
|
|
19
19
|
</ul>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
page_title =
|
2
|
+
page_title = _t("Sign up")
|
3
3
|
title(page_title)
|
4
4
|
%>
|
5
5
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
</li>
|
14
14
|
|
15
15
|
<li>
|
16
|
-
<%= submit_tag
|
16
|
+
<%= submit_tag _t("Sign up"), :class => "button" %>
|
17
17
|
</li>
|
18
18
|
|
19
19
|
</ul>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<ul>
|
2
|
-
<li><%= link_to
|
2
|
+
<li><%= link_to _t("Dashboard"), admin_dashboard_path %></li>
|
3
3
|
<% Typus.applications.each do |app| %>
|
4
|
-
<li><%= link_to
|
4
|
+
<li><%= link_to _t(app), :controller => Typus.application(app).sort {|a,b| a.constantize.model_name.human <=> b.constantize.model_name.human}.first.tableize %></li>
|
5
5
|
<% end %>
|
6
6
|
</ul>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1 class="logo">
|
2
2
|
<% if Rails.application.routes.routes.map(&:name).include?(:root) %>
|
3
|
-
<%= link_to Typus.admin_title, root_path, :title =>
|
3
|
+
<%= link_to Typus.admin_title, root_path, :title => _t("View site") %>
|
4
4
|
<% else %>
|
5
5
|
<%= Typus.admin_title %>
|
6
6
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<ul>
|
2
|
-
<li><%=
|
3
|
-
<li><%= link_to
|
2
|
+
<li><%= _t("Logged as") %> <%= user_details %></li>
|
3
|
+
<li><%= link_to _t("Sign out"), admin_session_path, :confirm => message, :method => :delete %></li>
|
4
4
|
</ul>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<thead>
|
6
6
|
<tr>
|
7
|
-
<th colspan="2"><%=
|
7
|
+
<th colspan="2"><%= _t(app) %></th>
|
8
8
|
</tr>
|
9
9
|
</thead>
|
10
10
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<%= link_to klass_human_name, admin_items_path %>
|
22
22
|
</td>
|
23
23
|
<td class="right">
|
24
|
-
<%= link_to_if @current_user.can?("create", klass),
|
24
|
+
<%= link_to_if @current_user.can?("create", klass), _t("Add"), admin_items_path.merge(:action => "new") %>
|
25
25
|
</td>
|
26
26
|
</tr>
|
27
27
|
|
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
<thead>
|
4
4
|
<tr>
|
5
|
-
<th colspan="2"><%=
|
5
|
+
<th colspan="2"><%= _t("Resources") %></th>
|
6
6
|
</tr>
|
7
7
|
</thead>
|
8
8
|
|
9
9
|
<% resources.each do |resource| %>
|
10
10
|
<tr class="<%= cycle("even", "odd") %>">
|
11
|
-
<td><%= link_to
|
11
|
+
<td><%= link_to _t(resource.titleize.capitalize), :controller => "admin/#{resource.underscore}" %></td>
|
12
12
|
<td align="right" style="vertical-align: bottom;"></td>
|
13
13
|
</tr>
|
14
14
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<%= form_tag url_for(:controller => params[:controller]), :method => :get do %>
|
4
4
|
<ul>
|
5
|
-
<li><input id="quicksearch" name="search" type="text" title="<%= params[:search] ||
|
5
|
+
<li><input id="quicksearch" name="search" type="text" title="<%= params[:search] || _t("Search") %>"/></li>
|
6
6
|
</ul>
|
7
7
|
<% hidden_params.each do |field| %>
|
8
8
|
<%= field %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<% resource = "/admin/#{key.constantize.to_resource}" %>
|
4
4
|
|
5
5
|
<%= link_to :controller => resource, :action => "index" do %>
|
6
|
-
<h3><%=
|
6
|
+
<h3><%= _t(key.constantize.model_name.human.pluralize) %></h3>
|
7
7
|
<% end %>
|
8
8
|
|
9
9
|
<% if @resource.name.eql?(key) %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
|
-
<%=
|
2
|
+
<%= _t("You can update your password at") %>:
|
3
3
|
|
4
4
|
<%= @url %>
|
5
5
|
|
6
|
-
<%=
|
6
|
+
<%= _t("If you didn't request a password update, you can ignore this message") %>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
<fieldset class="buttons">
|
21
21
|
<ol>
|
22
|
-
<li><%= submit_tag button , :class => "commit" %> or <%= link_to
|
22
|
+
<li><%= submit_tag button , :class => "commit" %> or <%= link_to _t("Cancel and go back").downcase, :action => "index" %></li>
|
23
23
|
</ol>
|
24
24
|
</fieldset>
|
25
25
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
page_title =
|
2
|
+
page_title = _t("Edit %{resource}", :resource => @resource.model_name.human)
|
3
3
|
title(page_title)
|
4
4
|
%>
|
5
5
|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
:back_to => params[:back_to],
|
21
21
|
:resource => params[:resource],
|
22
22
|
:resource_id => params[:resource_id] }
|
23
|
-
button =
|
23
|
+
button = _t("Save %{resource}", :resource => @resource.model_name.human)
|
24
24
|
%>
|
25
25
|
|
26
26
|
<%= render form_partial, :options => options, :button => button %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
page_title =
|
2
|
+
page_title = _t("%{resources}", :resources => @resource.model_name.human.pluralize)
|
3
3
|
title(page_title)
|
4
4
|
%>
|
5
5
|
|
@@ -26,12 +26,12 @@
|
|
26
26
|
<% else %>
|
27
27
|
<% if @resource.count.zero? %>
|
28
28
|
<p>
|
29
|
-
<%=
|
30
|
-
<%= link_to
|
29
|
+
<%= _t("There are no %{records}.", :records => @resource.model_name.human.pluralize.downcase) %>
|
30
|
+
<%= link_to _t("Create one now."), { :action => "new" } if @current_user.can?('create', @resource) %>
|
31
31
|
</p>
|
32
32
|
<% else %>
|
33
33
|
<div class="flash notice">
|
34
|
-
<%=
|
34
|
+
<%= _t("There are no %{records} under this filter.", :records => @resource.model_name.human.pluralize.downcase) %>
|
35
35
|
</div>
|
36
36
|
<% end %>
|
37
37
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
page_title =
|
2
|
+
page_title = _t("New %{resource}", :resource => @resource.model_name.human)
|
3
3
|
title(page_title)
|
4
4
|
%>
|
5
5
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
:selected => params[:selected],
|
19
19
|
:resource => params[:resource],
|
20
20
|
:resource_id => params[:resource_id] }
|
21
|
-
button =
|
21
|
+
button = _t("Create %{resource}", :resource => @resource.model_name.human)
|
22
22
|
%>
|
23
23
|
|
24
24
|
<%= render form_partial, :options => options, :button => button %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%
|
2
|
-
page_title =
|
2
|
+
page_title = _t("Sign in")
|
3
3
|
title(page_title)
|
4
4
|
%>
|
5
5
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
</li>
|
19
19
|
|
20
20
|
<li>
|
21
|
-
<%= submit_tag
|
21
|
+
<%= submit_tag _t("Sign in"), :class => "button" %> <%= link_to _t("Recover password"), forgot_password_admin_account_index_path if Typus.mailer_sender %>
|
22
22
|
</li>
|
23
23
|
|
24
24
|
</ul>
|
@@ -3,12 +3,12 @@
|
|
3
3
|
# attachment = attribute.split('_file_name').first
|
4
4
|
|
5
5
|
if !@item.class.validators.map { |i| i.class }.include?(ActiveModel::Validations::PresenceValidator) && @item.send(attribute).exists?
|
6
|
-
message =
|
6
|
+
message = _t("Remove %{attribute}", :attribute => @item.class.human_attribute_name(attribute).downcase)
|
7
7
|
label_text << <<-HTML
|
8
8
|
<small>#{link_to message, { :action => 'detach',
|
9
9
|
:id => @item,
|
10
10
|
:attachment => attribute },
|
11
|
-
:confirm =>
|
11
|
+
:confirm => _t("Are you sure?")}</small>
|
12
12
|
HTML
|
13
13
|
end
|
14
14
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<h2>
|
5
5
|
<%= link_to model_to_relate.model_name.human.pluralize,
|
6
6
|
{ :controller => "admin/#{model_to_relate_as_resource}", foreign_key => @item.id },
|
7
|
-
:title =>
|
7
|
+
:title => _t("%{model} filtered by %{filtered_by}",
|
8
8
|
:model => model_to_relate.model_name.human.pluralize,
|
9
9
|
:filtered_by => @item.to_label) %>
|
10
10
|
<%= add_new %>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<%= pagination(:anchor => model_to_relate.to_resource) %>
|
18
18
|
<% else %>
|
19
19
|
<div id="flash" class="notice">
|
20
|
-
<p><%=
|
20
|
+
<p><%= _t("There are no %{records}.", :records => model_to_relate.model_name.human.pluralize.downcase) %></p>
|
21
21
|
</div>
|
22
22
|
<% end %>
|
23
23
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<%= table %>
|
12
12
|
<%= pagination(:anchor => model_to_relate.to_resource) %>
|
13
13
|
<% else %>
|
14
|
-
<p><%=
|
14
|
+
<p><%= _t("There are no %{records}.", :records => model_to_relate.model_name.human.pluralize.downcase) %></p>
|
15
15
|
<% end %>
|
16
16
|
|
17
17
|
</div>
|
@@ -1,4 +1,4 @@
|
|
1
1
|
<%= form_tag :action => :relate, :id => @item.id do %>
|
2
2
|
<%= hidden_field :related, :model, :value => model_to_relate %>
|
3
|
-
<p><%= select :related, :id, items_to_relate.collect { |f| [f.to_label, f.id] }.sort_by { |e| e.first } %> <%= submit_tag
|
3
|
+
<p><%= select :related, :id, items_to_relate.collect { |f| [f.to_label, f.id] }.sort_by { |e| e.first } %> <%= submit_tag _t("Add"), :class => "button" %></p>
|
4
4
|
<% end %>
|
@@ -3,13 +3,13 @@
|
|
3
3
|
# Read only fields.
|
4
4
|
if @resource.typus_field_options_for(:read_only).to_s.include?(attribute)
|
5
5
|
custom = { :readonly => 'readonly' }
|
6
|
-
label_text << " <small>#{
|
6
|
+
label_text << " <small>#{_t("Read only")}</small>"
|
7
7
|
end
|
8
8
|
|
9
9
|
# Auto generated fields.
|
10
10
|
if @resource.typus_field_options_for(:auto_generated).include?(attribute)
|
11
11
|
custom = { :auto_generated => true }
|
12
|
-
label_text << " <small>#{
|
12
|
+
label_text << " <small>#{_t("Auto generated")}</small>"
|
13
13
|
end
|
14
14
|
|
15
15
|
options.merge!(custom) if custom
|
data/lib/support/object.rb
CHANGED
@@ -6,13 +6,13 @@ class Object
|
|
6
6
|
#
|
7
7
|
# We define this method to define the value only once:
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# _t("Hello World!")
|
10
10
|
#
|
11
11
|
# Note that interpolation still works ...
|
12
12
|
#
|
13
|
-
#
|
13
|
+
# _t("Hello %{world}!", :world => @world)
|
14
14
|
#
|
15
|
-
def
|
15
|
+
def _t(msg, *args)
|
16
16
|
options = args.extract_options!
|
17
17
|
options[:default] = msg
|
18
18
|
I18n.t(msg, options)
|
data/lib/typus/authentication.rb
CHANGED
@@ -49,12 +49,12 @@ module Typus
|
|
49
49
|
@current_user = Typus.user_class.find(session[:typus_user_id])
|
50
50
|
|
51
51
|
unless Typus::Configuration.roles.has_key?(@current_user.role)
|
52
|
-
raise
|
52
|
+
raise _t("Role does no longer exists.")
|
53
53
|
end
|
54
54
|
|
55
55
|
unless @current_user.status
|
56
56
|
back_to = (request.env['REQUEST_URI'] == admin_dashboard_path) ? nil : request.env['REQUEST_URI']
|
57
|
-
raise
|
57
|
+
raise _t("Typus user has been disabled.")
|
58
58
|
end
|
59
59
|
|
60
60
|
I18n.locale = @current_user.preferences[:locale]
|
@@ -81,32 +81,32 @@ module Typus
|
|
81
81
|
|
82
82
|
# Only admin and owner of Typus User can edit.
|
83
83
|
if @current_user.is_not_root? && !current_user
|
84
|
-
|
84
|
+
_t("As you're not the admin or the owner of this record you cannot edit it.")
|
85
85
|
end
|
86
86
|
|
87
87
|
when 'update'
|
88
88
|
|
89
89
|
# current_user cannot change her role.
|
90
90
|
if current_user && !(@item.role == params[@object_name][:role])
|
91
|
-
|
91
|
+
_t("You can't change your role.")
|
92
92
|
end
|
93
93
|
|
94
94
|
when 'toggle'
|
95
95
|
|
96
96
|
# Only admin can toggle typus user status, but not herself.
|
97
97
|
if @current_user.is_root? && current_user
|
98
|
-
|
98
|
+
_t("You can't toggle your status.")
|
99
99
|
elsif @current_user.is_not_root?
|
100
|
-
|
100
|
+
_t("You're not allowed to toggle status.")
|
101
101
|
end
|
102
102
|
|
103
103
|
when 'destroy'
|
104
104
|
|
105
105
|
# Admin can remove anything except herself.
|
106
106
|
if @current_user.is_root? && current_user
|
107
|
-
|
107
|
+
_t("You can't remove yourself.")
|
108
108
|
elsif @current_user.is_not_root?
|
109
|
-
|
109
|
+
_t("You're not allowed to remove Typus Users.")
|
110
110
|
end
|
111
111
|
|
112
112
|
end
|
@@ -135,7 +135,7 @@ module Typus
|
|
135
135
|
"%{current_user_role} can't perform action. (%{action})"
|
136
136
|
end
|
137
137
|
|
138
|
-
message =
|
138
|
+
message = _t(message,
|
139
139
|
:current_user_role => @current_user.role.capitalize,
|
140
140
|
:action => params[:action])
|
141
141
|
|
@@ -179,7 +179,7 @@ module Typus
|
|
179
179
|
condition_typus_user_id = @item.respond_to?(Typus.user_fk) && !@item.owned_by?(@current_user)
|
180
180
|
|
181
181
|
if condition_typus_users || condition_typus_user_id
|
182
|
-
alert =
|
182
|
+
alert = _t("You don't have permission to access this item.")
|
183
183
|
redirect_to set_path, :alert => alert
|
184
184
|
end
|
185
185
|
|
data/lib/typus/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
|
-
<%=
|
2
|
+
<%= _t("You can update your password at") %>:
|
3
3
|
|
4
4
|
<%= @url %>
|
5
5
|
|
6
|
-
<%=
|
6
|
+
<%= _t("If you didn't request a password update, you can ignore this message") %>
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -1876988179
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.0.0.
|
10
|
+
- pre6
|
11
|
+
version: 1.0.0.pre6
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Francesc Esplugas
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-15 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -270,7 +270,6 @@ files:
|
|
270
270
|
- test/fixtures/rails_app/config/typus/typus_roles.yml
|
271
271
|
- test/fixtures/rails_app/config.ru
|
272
272
|
- test/fixtures/rails_app/db/seeds.rb
|
273
|
-
- test/fixtures/rails_app/db/test.sqlite3
|
274
273
|
- test/fixtures/rails_app/public/404.html
|
275
274
|
- test/fixtures/rails_app/public/422.html
|
276
275
|
- test/fixtures/rails_app/public/500.html
|
@@ -287,37 +286,6 @@ files:
|
|
287
286
|
- test/fixtures/rails_app/Rakefile
|
288
287
|
- test/fixtures/rails_app/README
|
289
288
|
- test/fixtures/rails_app/script/rails
|
290
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913124503.csv
|
291
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913124524.csv
|
292
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913124638.csv
|
293
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913124717.csv
|
294
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913125425.csv
|
295
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913125626.csv
|
296
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913125651.csv
|
297
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913125741.csv
|
298
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913125827.csv
|
299
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913125856.csv
|
300
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913125928.csv
|
301
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913130119.csv
|
302
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913130159.csv
|
303
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913130319.csv
|
304
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913130339.csv
|
305
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913131400.csv
|
306
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913131915.csv
|
307
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913132022.csv
|
308
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913132844.csv
|
309
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913171700.csv
|
310
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913172044.csv
|
311
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913172118.csv
|
312
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913174300.csv
|
313
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913174322.csv
|
314
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913174959.csv
|
315
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913175019.csv
|
316
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913175116.csv
|
317
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913175204.csv
|
318
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913175228.csv
|
319
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913175254.csv
|
320
|
-
- test/fixtures/rails_app/tmp/export-posts-20100913180324.csv
|
321
289
|
- test/functional/admin/account_controller_test.rb
|
322
290
|
- test/functional/admin/dashboard_controller_http_basic_test.rb
|
323
291
|
- test/functional/admin/dashboard_controller_none_test.rb
|
@@ -360,9 +328,6 @@ files:
|
|
360
328
|
- test/unit/admin/mailer_test.rb
|
361
329
|
- test/unit/typus_user_roles_test.rb
|
362
330
|
- test/unit/typus_user_test.rb
|
363
|
-
- typus-1.0.0.pre2.gem
|
364
|
-
- typus-1.0.0.pre3.gem
|
365
|
-
- typus-1.0.0.pre4.gem
|
366
331
|
- typus-1.0.0.pre5.gem
|
367
332
|
- typus.gemspec
|
368
333
|
has_rdoc: true
|
File without changes
|
data/typus-1.0.0.pre2.gem
DELETED
Binary file
|
data/typus-1.0.0.pre3.gem
DELETED
Binary file
|
data/typus-1.0.0.pre4.gem
DELETED
Binary file
|