typus 3.1.0.rc18 → 3.1.0.rc19
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -11
- data/.travis.yml +12 -0
- data/CHANGELOG +253 -0
- data/Gemfile +69 -0
- data/Guardfile +11 -0
- data/README.md +14 -26
- data/Rakefile +24 -100
- data/app/assets/javascripts/typus/application.js +8 -2
- data/app/assets/javascripts/typus/custom.js +2 -0
- data/app/assets/javascripts/typus/jquery.application.js +14 -0
- data/app/assets/stylesheets/typus/application.css +18 -10
- data/app/assets/stylesheets/typus/content.css +0 -1
- data/app/assets/stylesheets/typus/custom.css +11 -0
- data/app/assets/stylesheets/typus/errors.css +1 -1
- data/app/assets/stylesheets/typus/forms.css +17 -5
- data/app/assets/stylesheets/typus/hacks.css +4 -0
- data/app/assets/stylesheets/typus/header.css +8 -2
- data/app/assets/stylesheets/typus/pagination.css +3 -3
- data/app/assets/stylesheets/typus/sidebar.css +4 -0
- data/app/assets/stylesheets/typus/tables.css +0 -1
- data/app/controllers/admin/account_controller.rb +1 -2
- data/app/controllers/admin/base_controller.rb +5 -2
- data/app/controllers/admin/dashboard_controller.rb +5 -0
- data/app/controllers/admin/resource_controller.rb +1 -2
- data/app/controllers/admin/resources_controller.rb +36 -51
- data/app/controllers/admin/session_controller.rb +2 -3
- data/app/helpers/admin/base_helper.rb +2 -5
- data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +35 -27
- data/app/helpers/admin/resources/data_types/dragonfly_helper.rb +16 -3
- data/app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb +45 -13
- data/app/helpers/admin/resources/data_types/has_many_helper.rb +27 -19
- data/app/helpers/admin/resources/data_types/has_one_helper.rb +24 -11
- data/app/helpers/admin/resources/data_types/paperclip_helper.rb +1 -1
- data/app/helpers/admin/resources/data_types/string_helper.rb +1 -1
- data/app/helpers/admin/resources/data_types/text_helper.rb +1 -1
- data/app/helpers/admin/resources/data_types/transversal_helper.rb +1 -1
- data/app/helpers/admin/resources/data_types/tree_helper.rb +1 -1
- data/app/helpers/admin/resources/display_helper.rb +10 -9
- data/app/helpers/admin/resources/filters_helper.rb +3 -10
- data/app/helpers/admin/resources/form_helper.rb +12 -2
- data/app/helpers/admin/resources/list_helper.rb +13 -5
- data/app/helpers/admin/resources/relationships_helper.rb +0 -21
- data/app/helpers/admin/resources_helper.rb +3 -3
- data/app/mailers/admin/mailer.rb +9 -4
- data/app/views/admin/base/user_guide.html.erb +1 -1
- data/app/views/admin/dashboard/{show.html.erb → index.html.erb} +0 -0
- data/app/views/admin/dashboard/widgets/_applications.html.erb +32 -10
- data/app/views/admin/mailer/reset_password_instructions.html.erb +9 -0
- data/app/views/admin/mailer/reset_password_instructions.text.erb +9 -0
- data/app/views/admin/resources/edit.html.erb +3 -13
- data/app/views/admin/resources/index.html.erb +11 -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/shared/_head.html.erb +2 -2
- data/app/views/admin/templates/_belongs_to.html.erb +6 -9
- data/app/views/admin/templates/_dragonfly.html.erb +1 -1
- data/app/views/admin/templates/_dragonfly_form_preview.html.erb +21 -0
- data/app/views/admin/templates/_dragonfly_preview.html.erb +1 -1
- data/app/views/admin/templates/_has_and_belongs_to_many.html.erb +15 -0
- data/app/views/admin/templates/{_has_n.html.erb → _has_many.html.erb} +0 -0
- data/app/views/admin/templates/_password.html.erb +1 -1
- data/app/views/admin/templates/_selector.html.erb +1 -11
- data/app/views/admin/templates/_string.html.erb +2 -20
- data/app/views/admin/templates/_string_with_preview.html.erb +2 -3
- data/app/views/admin/templates/_text.html.erb +1 -8
- data/app/views/admin/templates/_text_with_ckeditor.html.erb +1 -1
- data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +12 -9
- data/app/views/helpers/admin/base/_apps.html.erb +12 -4
- data/app/views/helpers/admin/base/_login_info.html.erb +1 -1
- data/app/views/helpers/admin/resources/_filters.html.erb +2 -1
- data/app/views/helpers/admin/resources/_sidebar.html.erb +25 -41
- data/app/views/layouts/admin/base.html.erb +1 -1
- data/config/locales/typus.ca.yml +1 -1
- data/config/locales/typus.de.yml +40 -35
- data/config/locales/typus.el.yml +1 -1
- data/config/locales/typus.es.yml +1 -1
- data/config/locales/typus.fr.yml +1 -1
- data/config/locales/typus.hu.yml +1 -1
- data/config/locales/typus.it.yml +1 -1
- data/config/locales/typus.locale.models.yml.template +17 -0
- data/config/locales/typus.locale.yml.template +80 -0
- data/config/locales/typus.pt-BR.yml +1 -1
- data/config/locales/typus.pt-PT.yml +2 -2
- data/config/locales/typus.ru.yml +1 -1
- data/config/locales/typus.zh-CN.yml +1 -1
- data/config/routes.rb +5 -1
- data/lib/generators/templates/config/initializers/typus.rb +9 -0
- data/lib/generators/templates/config/typus/README +0 -6
- data/lib/support/active_record.rb +2 -10
- data/lib/support/string.rb +6 -1
- data/lib/typus.rb +49 -10
- data/lib/typus/authentication/base.rb +0 -4
- data/lib/typus/authentication/none_with_role.rb +15 -0
- data/lib/typus/configuration.rb +3 -7
- data/lib/typus/controller/ancestry.rb +1 -1
- data/lib/typus/controller/bulk.rb +6 -2
- data/lib/typus/controller/format.rb +38 -25
- data/lib/typus/orm/active_record/class_methods.rb +0 -1
- data/lib/typus/orm/active_record/search.rb +6 -2
- data/lib/typus/orm/base.rb +4 -3
- data/lib/typus/orm/mongoid.rb +4 -0
- data/lib/typus/orm/{mongo → mongoid}/class_methods.rb +4 -3
- data/lib/typus/resources.rb +9 -0
- data/lib/typus/version.rb +1 -1
- data/typus.gemspec +13 -13
- data/vendor/assets/chosen/chosen-sprite.png +0 -0
- data/vendor/assets/chosen/chosen.css +334 -0
- data/vendor/assets/chosen/chosen.jquery.min.js +10 -0
- data/vendor/assets/fancybox/jquery.fancybox-1.3.4.css +17 -17
- metadata +57 -131
- data/.gitmodules +0 -6
- data/app/assets/javascripts/typus.js +0 -8
- data/app/assets/stylesheets/typus.css +0 -20
- data/app/assets/stylesheets/typus/actions.css +0 -11
- data/app/views/admin/mailer/reset_password_link.text.erb +0 -9
- data/app/views/admin/templates/_belongs_to_with_autocomplete.html.erb +0 -26
- data/lib/typus/controller/associations.rb +0 -146
- data/lib/typus/controller/autocomplete.rb +0 -16
- data/vendor/assets/fancybox/jquery.easing-1.3.pack.js +0 -72
- data/vendor/assets/fancybox/jquery.fancybox-1.3.4.js +0 -1156
- data/vendor/assets/fancybox/jquery.mousewheel-3.0.4.pack.js +0 -14
- data/vendor/assets/formalize/css/_formalize.sass +0 -332
- data/vendor/assets/formalize/css/demo.css +0 -47
- data/vendor/assets/formalize/css/reset.css +0 -202
- data/vendor/assets/formalize/css/text.css +0 -81
- data/vendor/assets/formalize/js/dojo.formalize.js +0 -166
- data/vendor/assets/formalize/js/dojo.formalize.min.js +0 -1
- data/vendor/assets/formalize/js/extjs.formalize.js +0 -163
- data/vendor/assets/formalize/js/extjs.formalize.min.js +0 -1
- data/vendor/assets/formalize/js/jquery.formalize.js +0 -150
- data/vendor/assets/formalize/js/mootools.formalize.js +0 -155
- data/vendor/assets/formalize/js/mootools.formalize.min.js +0 -1
- data/vendor/assets/formalize/js/prototype.formalize.js +0 -163
- data/vendor/assets/formalize/js/prototype.formalize.min.js +0 -1
- data/vendor/assets/formalize/js/yui.formalize.js +0 -152
- data/vendor/assets/formalize/js/yui.formalize.min.js +0 -1
- data/vendor/assets/jquery-tokeninput/jquery.tokeninput.js +0 -736
- data/vendor/assets/jquery-tokeninput/token-input.css +0 -120
@@ -1,2 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
//= require jquery.fancybox-1.3.4.pack
|
4
|
+
//= require jquery.searchField
|
5
|
+
//= require js/jquery.formalize.min
|
6
|
+
//= require typus/jquery.application
|
7
|
+
//= require typus/custom
|
8
|
+
//= require chosen.jquery.min
|
@@ -11,6 +11,18 @@ $(document).ready(function() {
|
|
11
11
|
'scrolling': false,
|
12
12
|
});
|
13
13
|
|
14
|
+
$(".iframe_with_reload").fancybox({
|
15
|
+
'width': 720,
|
16
|
+
'height': '90%',
|
17
|
+
'autoScale': false,
|
18
|
+
'transitionIn': 'none',
|
19
|
+
'transitionOut': 'none',
|
20
|
+
'type': 'iframe',
|
21
|
+
'centerOnScroll': true,
|
22
|
+
'scrolling': false,
|
23
|
+
onClosed: function() { parent.location.reload(true); },
|
24
|
+
});
|
25
|
+
|
14
26
|
$(".iframe").fancybox({
|
15
27
|
'width': 720,
|
16
28
|
'height': '90%',
|
@@ -29,6 +41,8 @@ $(document).ready(function() {
|
|
29
41
|
$('.action-toggle').each(function() { this.checked = status; });
|
30
42
|
});
|
31
43
|
|
44
|
+
$(".chzn-select").chosen();
|
45
|
+
|
32
46
|
});
|
33
47
|
|
34
48
|
function setConfirmUnload(on) {
|
@@ -1,12 +1,20 @@
|
|
1
|
-
|
2
|
-
/* Create the file `app/assets/stylesheets/typus/application.css` in your
|
3
|
-
application if you need/want to override/add some stylesheets. */
|
4
|
-
|
5
1
|
/*
|
6
|
-
.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
*= require jquery.fancybox-1.3.4
|
3
|
+
*= require chosen
|
4
|
+
*= require css/formalize
|
5
|
+
*= require css/fluid
|
6
|
+
*= require typus/reset
|
7
|
+
*= require typus/layout
|
8
|
+
*= require typus/defaults
|
9
|
+
*= require typus/errors
|
10
|
+
*= require typus/account
|
11
|
+
*= require typus/header
|
12
|
+
*= require typus/content
|
13
|
+
*= require typus/sidebar
|
14
|
+
*= require typus/footer
|
15
|
+
*= require typus/tables
|
16
|
+
*= require typus/pagination
|
17
|
+
*= require typus/forms
|
18
|
+
*= require typus/hacks
|
19
|
+
*= require typus/custom
|
12
20
|
*/
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/* Create the file `app/assets/stylesheets/typus/custom.css` in your
|
2
|
+
application if you need/want to override/add some stylesheets. */
|
3
|
+
|
4
|
+
/*
|
5
|
+
.logo {
|
6
|
+
height: 50px;
|
7
|
+
width: 150px;
|
8
|
+
background: transparent url(/images/logo.gif) no-repeat;
|
9
|
+
text-indent: -10000px;
|
10
|
+
}
|
11
|
+
*/
|
@@ -8,14 +8,15 @@ fieldset ol {
|
|
8
8
|
}
|
9
9
|
|
10
10
|
fieldset ol li {
|
11
|
+
line-height: 1.5em;
|
11
12
|
list-style: none!important;
|
12
|
-
margin: 1em 0
|
13
|
+
margin: 1em 0;
|
13
14
|
}
|
14
15
|
|
15
16
|
fieldset small {
|
16
|
-
font-size: 0.
|
17
|
+
font-size: 0.85em;
|
17
18
|
font-weight: normal;
|
18
|
-
margin: 0 0 0 0.
|
19
|
+
margin: 0 0 0 0.5em;
|
19
20
|
}
|
20
21
|
|
21
22
|
fieldset small a {
|
@@ -24,8 +25,10 @@ fieldset small a {
|
|
24
25
|
|
25
26
|
fieldset.inputs {}
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
/* I know I can use input[type='text'] but for some reason this is not
|
29
|
+
working with "Chosen".
|
30
|
+
*/
|
31
|
+
fieldset.inputs input.text {
|
29
32
|
font-size: 1.25em;
|
30
33
|
width: 100%;
|
31
34
|
}
|
@@ -50,3 +53,12 @@ fieldset.buttons {
|
|
50
53
|
fieldset.buttons ol li {
|
51
54
|
display: inline;
|
52
55
|
}
|
56
|
+
|
57
|
+
fieldset ol ul {
|
58
|
+
margin: 0!important;
|
59
|
+
}
|
60
|
+
|
61
|
+
fieldset ol ul label.inline_label {
|
62
|
+
display: inline;
|
63
|
+
font-weight: normal;
|
64
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#header {
|
2
2
|
background: #4A525A;
|
3
|
-
padding: 1.25em 1em;
|
3
|
+
padding: 1.25em 0 1.25em 1em;
|
4
4
|
}
|
5
5
|
|
6
6
|
#header .title {
|
@@ -28,8 +28,13 @@
|
|
28
28
|
display: inline;
|
29
29
|
}
|
30
30
|
|
31
|
+
#header .applications {
|
32
|
+
margin: -0.5em 1em;
|
33
|
+
}
|
34
|
+
|
31
35
|
#header .applications ul li {
|
32
|
-
|
36
|
+
line-height: 2.5em;
|
37
|
+
padding: 0 0.25em 0 0;
|
33
38
|
}
|
34
39
|
|
35
40
|
#header .applications ul li a {
|
@@ -47,6 +52,7 @@
|
|
47
52
|
}
|
48
53
|
|
49
54
|
#header .profile {
|
55
|
+
margin: 0.25em 0 0 0;
|
50
56
|
text-align: right;
|
51
57
|
}
|
52
58
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
.pagination {
|
2
2
|
border-top: 1px solid #D3D3D3;
|
3
|
-
|
4
|
-
margin: -1em auto 1em auto;
|
3
|
+
margin: 1em auto;
|
5
4
|
padding: 1em 0;
|
6
5
|
text-align: center;
|
7
6
|
}
|
@@ -37,6 +36,7 @@
|
|
37
36
|
|
38
37
|
.pagination .first,
|
39
38
|
.pagination .last,
|
40
|
-
.pagination .current
|
39
|
+
.pagination .current,
|
40
|
+
.pagination .gap {
|
41
41
|
display: none;
|
42
42
|
}
|
@@ -23,8 +23,7 @@ class Admin::AccountController < Admin::BaseController
|
|
23
23
|
|
24
24
|
def send_password
|
25
25
|
if user = Typus.user_class.find_by_email(params[:typus_user][:email])
|
26
|
-
|
27
|
-
Admin::Mailer.reset_password_link(user, url).deliver
|
26
|
+
Admin::Mailer.reset_password_instructions(user).deliver
|
28
27
|
redirect_to new_admin_session_path, :notice => Typus::I18n.t("Password recovery link sent to your email.")
|
29
28
|
else
|
30
29
|
render :action => :forgot_password
|
@@ -8,8 +8,7 @@ class Admin::BaseController < ActionController::Base
|
|
8
8
|
|
9
9
|
helper_method :admin_user
|
10
10
|
|
11
|
-
def user_guide
|
12
|
-
end
|
11
|
+
def user_guide; end
|
13
12
|
|
14
13
|
protected
|
15
14
|
|
@@ -29,4 +28,8 @@ class Admin::BaseController < ActionController::Base
|
|
29
28
|
Typus.user_class.count.zero?
|
30
29
|
end
|
31
30
|
|
31
|
+
def not_allowed
|
32
|
+
render :text => "Not allowed!", :status => :unprocessable_entity
|
33
|
+
end
|
34
|
+
|
32
35
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class Admin::ResourcesController < Admin::BaseController
|
2
2
|
|
3
3
|
include Typus::Controller::Actions
|
4
|
-
include Typus::Controller::Associations
|
5
|
-
include Typus::Controller::Autocomplete
|
6
4
|
include Typus::Controller::Filters
|
7
5
|
include Typus::Controller::Format
|
8
6
|
include Typus::Controller::Headless
|
@@ -10,26 +8,24 @@ class Admin::ResourcesController < Admin::BaseController
|
|
10
8
|
Whitelist = [:edit, :update, :destroy, :toggle, :position, :relate, :unrelate]
|
11
9
|
|
12
10
|
before_filter :get_model
|
13
|
-
before_filter :set_context
|
11
|
+
before_filter :set_context
|
14
12
|
before_filter :get_object, :only => Whitelist + [:show]
|
15
13
|
before_filter :check_resource_ownership, :only => Whitelist
|
16
14
|
before_filter :check_if_user_can_perform_action_on_resources
|
17
15
|
|
18
|
-
##
|
19
|
-
# This is the main index of the model. With filters, conditions and more.
|
20
|
-
#
|
21
|
-
# By default application can respond to html, csv and xml, but you can add
|
22
|
-
# your formats.
|
23
|
-
#
|
24
16
|
def index
|
25
17
|
get_objects
|
26
18
|
|
19
|
+
custom_actions_for(:index).each do |action|
|
20
|
+
prepend_resources_action(action.titleize, {:action => action, :id => nil}, {})
|
21
|
+
end
|
22
|
+
|
27
23
|
respond_to do |format|
|
28
24
|
format.html do
|
29
25
|
if headless_mode_with_custom_action_is_enabled?
|
30
26
|
set_headless_resource_actions
|
31
27
|
else
|
32
|
-
|
28
|
+
set_default_action
|
33
29
|
add_resource_action("Trash", {:action => "destroy"}, {:confirm => "#{Typus::I18n.t("Trash")}?", :method => 'delete'})
|
34
30
|
end
|
35
31
|
generate_html
|
@@ -50,11 +46,6 @@ class Admin::ResourcesController < Admin::BaseController
|
|
50
46
|
end
|
51
47
|
end
|
52
48
|
|
53
|
-
##
|
54
|
-
# Create new items. There's an special case when we create an item from
|
55
|
-
# another item. In this case, after the item is created we also create the
|
56
|
-
# relationship between these items.
|
57
|
-
#
|
58
49
|
def create
|
59
50
|
@item = @resource.new
|
60
51
|
@item.assign_attributes(params[@object_name], :as => :admin)
|
@@ -73,18 +64,23 @@ class Admin::ResourcesController < Admin::BaseController
|
|
73
64
|
end
|
74
65
|
|
75
66
|
def edit
|
67
|
+
custom_actions_for(:edit).each do |action|
|
68
|
+
prepend_resources_action(action.titleize, {:action => action, :id => @item}, {})
|
69
|
+
end
|
76
70
|
end
|
77
71
|
|
78
72
|
def show
|
79
73
|
check_resource_ownership if @resource.typus_options_for(:only_user_items)
|
80
74
|
|
81
|
-
|
75
|
+
if admin_user.can?('edit', @resource)
|
76
|
+
prepend_resources_action("Edit", {:action => 'edit', :id => @item}, {})
|
77
|
+
end
|
78
|
+
|
82
79
|
respond_to do |format|
|
83
80
|
format.html # show.html.erb
|
84
|
-
format.xml { render
|
81
|
+
format.xml { can_export?(:xml) ? render(:xml => @item) : not_allowed }
|
85
82
|
format.json { render :json => @item }
|
86
83
|
end
|
87
|
-
=end
|
88
84
|
end
|
89
85
|
|
90
86
|
def update
|
@@ -166,6 +162,13 @@ class Admin::ResourcesController < Admin::BaseController
|
|
166
162
|
|
167
163
|
# Here we set the current scope!
|
168
164
|
def set_scope
|
165
|
+
if (scope = params[:scope])
|
166
|
+
if @resource.respond_to?(scope)
|
167
|
+
@resource = @resource.send(scope)
|
168
|
+
else
|
169
|
+
not_allowed
|
170
|
+
end
|
171
|
+
end
|
169
172
|
end
|
170
173
|
|
171
174
|
def set_wheres
|
@@ -197,47 +200,29 @@ class Admin::ResourcesController < Admin::BaseController
|
|
197
200
|
def redirect_on_success
|
198
201
|
path = params.dup.cleanup
|
199
202
|
|
200
|
-
# Redirects to { :action => 'index' }
|
201
203
|
if params[:_save]
|
202
|
-
path.delete_if { |k, v| %w(action id).include?(k) }
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
# created. It's similar to calling `relate` but which the difference that
|
208
|
-
# we are creating a new record.
|
209
|
-
#
|
210
|
-
# We have two objects, detect the relationship_between them and then
|
211
|
-
# call the related method.
|
212
|
-
#
|
213
|
-
if params[:_saveandassign]
|
214
|
-
item_class = params[:resource].constantize
|
215
|
-
# For some reason we are forced to set the /admin prefix to the controller
|
216
|
-
# when working with namespaced stuff.
|
217
|
-
options = { :controller => "/admin/#{item_class.to_resource}" }
|
218
|
-
assoc = item_class.relationship_with(@resource).to_s
|
219
|
-
unused_path, notice, alert = send("set_#{assoc}_association", item_class, options)
|
220
|
-
path.merge!(:action => 'edit', :id => @item.id)
|
204
|
+
path.delete_if { |k, v| %w(action id).include?(k) } # Redirects to { :action => 'index' }
|
205
|
+
elsif params[:_addanother]
|
206
|
+
path.merge!(:action => 'new', :id => nil) # Redirects to { :action => 'new' }
|
207
|
+
elsif params[:_continue]
|
208
|
+
path.merge!(:action => 'edit', :id => @item.id) # Redirects to { :action => 'edit' => :id => @item.id }
|
221
209
|
end
|
222
210
|
|
223
|
-
|
224
|
-
if params[:_addanother]
|
225
|
-
path.merge!(:action => 'new', :id => nil)
|
226
|
-
end
|
227
|
-
|
228
|
-
# Redirects to { :action => 'edit' => :id => @item.id }
|
229
|
-
if params[:_continue]
|
230
|
-
path.merge!(:action => 'edit', :id => @item.id)
|
231
|
-
end
|
232
|
-
|
233
|
-
message = (params[:action] == 'create') ? "%{model} successfully created." : "%{model} successfully updated."
|
211
|
+
message = params[:action].eql?('create') ? "%{model} successfully created." : "%{model} successfully updated."
|
234
212
|
notice = Typus::I18n.t(message, :model => @resource.model_name.human)
|
235
213
|
|
236
214
|
redirect_to path, :notice => notice
|
237
215
|
end
|
238
216
|
|
239
|
-
def
|
240
|
-
@resource.typus_options_for(:default_action_on_item)
|
217
|
+
def set_default_action
|
218
|
+
default_action = @resource.typus_options_for(:default_action_on_item)
|
219
|
+
action = admin_user.can?('edit', @resource.model_name) ? default_action : "show"
|
220
|
+
add_resource_action(action.titleize, {:action => action}, {})
|
221
|
+
end
|
222
|
+
|
223
|
+
def custom_actions_for(action)
|
224
|
+
return [] if headless_mode?
|
225
|
+
@resource.typus_actions_on(action).reject { |a| admin_user.cannot?(a, @resource.model_name) }
|
241
226
|
end
|
242
227
|
|
243
228
|
end
|
@@ -5,15 +5,14 @@ class Admin::SessionController < Admin::BaseController
|
|
5
5
|
|
6
6
|
before_filter :create_an_account?, :only => [:new, :create]
|
7
7
|
|
8
|
-
def new
|
9
|
-
end
|
8
|
+
def new; end
|
10
9
|
|
11
10
|
def create
|
12
11
|
user = user_scope.authenticate(params[:typus_user][:email], params[:typus_user][:password])
|
13
12
|
|
14
13
|
path = if user
|
15
14
|
session[:typus_user_id] = user.id
|
16
|
-
params[:back_to] ||
|
15
|
+
params[:back_to] || admin_dashboard_index_path
|
17
16
|
else
|
18
17
|
new_admin_session_path(:back_to => params[:back_to])
|
19
18
|
end
|