Commit 498e40b7b47bcafc8988cc6943193c5a6e91528b
1 parent
5b9b6c8f
Exists in
master
and in
29 other branches
HTML forms with id #ajax-form will be submited by ajax automatically
- fixing some bugfixes - all controllers under admin/ should require login - plugins admin interface should require at least one permission (ActionItem2056)
Showing
8 changed files
with
25 additions
and
4 deletions
Show diff stats
app/controllers/admin/admin_panel_controller.rb
app/controllers/admin/plugins_controller.rb
app/controllers/admin_controller.rb
features/send_email_to_environment_members.feature
... | ... | @@ -5,7 +5,7 @@ Feature: send emails to environment members users |
5 | 5 | Scenario: Cant access if not logged in |
6 | 6 | Given I am not logged in |
7 | 7 | When I go to /admin/users/send_mail |
8 | - Then I should see "Access denied" | |
8 | + Then I should be on login page | |
9 | 9 | |
10 | 10 | Scenario: Cant access as normal user |
11 | 11 | Given the following user | ... | ... |
public/javascripts/application.js
... | ... | @@ -677,3 +677,18 @@ function original_image_dimensions(src) { |
677 | 677 | img.src = src; |
678 | 678 | return { 'width' : img.width, 'height' : img.height }; |
679 | 679 | } |
680 | + | |
681 | +jQuery(function() { | |
682 | + jQuery("#ajax-form").before("<div id='ajax-form-loading-area' style='display:block;width:16px;height:16px;'></div>"); | |
683 | + jQuery("#ajax-form").before("<div id='ajax-form-message-area'></div>"); | |
684 | + jQuery("#ajax-form").ajaxForm({ | |
685 | + beforeSubmit: function(a,f,o) { | |
686 | + jQuery('#ajax-form-message-area').html(''); | |
687 | + o.loading = small_loading('ajax-form-loading-area'); | |
688 | + }, | |
689 | + success: function() { | |
690 | + loading_done('ajax-form-loading-area'); | |
691 | + }, | |
692 | + target: "#ajax-form-message-area" | |
693 | + }) | |
694 | +}); | ... | ... |
test/functional/admin_controller_test.rb
test/functional/cms_controller_test.rb
... | ... | @@ -16,6 +16,7 @@ class CmsControllerTest < Test::Unit::TestCase |
16 | 16 | |
17 | 17 | @profile = create_user_with_permission('testinguser', 'post_content') |
18 | 18 | login_as :testinguser |
19 | + @controller.stubs(:user).returns(@profile) | |
19 | 20 | end |
20 | 21 | |
21 | 22 | attr_reader :profile |
... | ... | @@ -614,7 +615,7 @@ class CmsControllerTest < Test::Unit::TestCase |
614 | 615 | end |
615 | 616 | |
616 | 617 | should 'not make enterprise homepage available to person' do |
617 | - @controller.stubs(:profile).returns(create_user('test_user').person) | |
618 | + @controller.stubs(:profile).returns(profile) | |
618 | 619 | assert_not_includes @controller.available_article_types, EnterpriseHomepage |
619 | 620 | end |
620 | 621 | |
... | ... | @@ -1278,6 +1279,7 @@ class CmsControllerTest < Test::Unit::TestCase |
1278 | 1279 | c = Community.create!(:name => 'test_comm', :identifier => 'test_comm') |
1279 | 1280 | u = create_user_with_permission('test_user', 'publish_content', c) |
1280 | 1281 | login_as :test_user |
1282 | + @controller.stubs(:user).returns(u) | |
1281 | 1283 | |
1282 | 1284 | get :new, :profile => c.identifier, :type => 'TinyMceArticle' |
1283 | 1285 | assert_response :success |
... | ... | @@ -1311,6 +1313,7 @@ class CmsControllerTest < Test::Unit::TestCase |
1311 | 1313 | u = create_user_with_permission('test_user', 'publish_content', c) |
1312 | 1314 | a = c.articles.create!(:name => 'test_article', :last_changed_by => u) |
1313 | 1315 | login_as :test_user |
1316 | + @controller.stubs(:user).returns(u) | |
1314 | 1317 | |
1315 | 1318 | get :edit, :profile => c.identifier, :id => a.id |
1316 | 1319 | ... | ... |
test/functional/users_controller_test.rb