Commit baeda131f9a4c541cd9d2732de2f32bc364fb7ff
Committed by
Thiago Ribeiro
1 parent
8229dbd7
Exists in
stable-spb-1.4
Fix rails 4 organization_ratings bugs
Signed-off-by: Álvaro Fernando <alvarofernandoms@gmail.com> Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> (cherry picked from commit 4c6bcb89e2fba3e120848542e58d555f320a1a86)
Showing
7 changed files
with
59 additions
and
24 deletions
Show diff stats
features/manage_users.feature
... | ... | @@ -15,7 +15,7 @@ Background: |
15 | 15 | Scenario: deactive user |
16 | 16 | Given I follow "Deactivate user" within "tr[title='Joao Silva']" |
17 | 17 | When I confirm the browser dialog |
18 | - Then the "tr[title='Joao Silva'] td.actions a.icon-activate-user" button should be enabled | |
18 | + Then the field "tr[title='Joao Silva'] td.actions a.icon-activate-user" should be enabled | |
19 | 19 | |
20 | 20 | @selenium |
21 | 21 | Scenario: activate user |
... | ... | @@ -23,7 +23,7 @@ Background: |
23 | 23 | And I confirm the browser dialog |
24 | 24 | And I follow "Activate user" within "tr[title='Paulo Santos']" |
25 | 25 | When I confirm the browser dialog |
26 | - Then the "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" button should be enabled | |
26 | + Then the field "tr[title='Paulo Santos'] td.actions a.icon-deactivate-user" should be enabled | |
27 | 27 | |
28 | 28 | @selenium |
29 | 29 | Scenario: remove user |
... | ... | @@ -36,7 +36,7 @@ Background: |
36 | 36 | Scenario: admin user |
37 | 37 | Given I follow "Set admin role" within "tr[title='Joao Silva']" |
38 | 38 | When I confirm the browser dialog |
39 | - Then the "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" button should be enabled | |
39 | + Then the field "tr[title='Joao Silva'] td.actions a.icon-reset-admin-role" should be enabled | |
40 | 40 | |
41 | 41 | @selenium |
42 | 42 | Scenario: unadmin user |
... | ... | @@ -44,4 +44,4 @@ Background: |
44 | 44 | And I confirm the browser dialog |
45 | 45 | And I follow "Reset admin role" within "tr[title='Paulo Santos']" |
46 | 46 | When I confirm the browser dialog |
47 | - Then the "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" button should be enabled | |
47 | + Then the field "tr[title='Paulo Santos'] td.actions a.icon-set-admin-role" should be enabled | ... | ... |
features/step_definitions/custom_web_steps.rb
... | ... | @@ -22,14 +22,14 @@ When /^I should see "([^\"]+)" linking to "([^\"]+)"$/ do |text, href| |
22 | 22 | page.should have_xpath("//a[@href='#{href}']") |
23 | 23 | end |
24 | 24 | |
25 | -Then /^the "([^"]*)" button should be disabled$/ do |selector| | |
26 | - field = find(selector) | |
27 | - field['disabled'].should be_truthy | |
28 | -end | |
25 | +Then /^the field "([^"]*)" should be (enabled|disabled)$/ do |selector, status| | |
26 | + field = page.find(:css, selector) | |
29 | 27 | |
30 | -Then /^the "([^"]*)" button should be enabled$/ do |selector| | |
31 | - field = find(selector) | |
32 | - field['disabled'].should_not be_truthy | |
28 | + if status == 'enabled' | |
29 | + field.disabled?.should_not be_truthy | |
30 | + else | |
31 | + field.disabled?.should be_truthy | |
32 | + end | |
33 | 33 | end |
34 | 34 | |
35 | 35 | When /^I reload and wait for the page$/ do | ... | ... |
plugins/organization_ratings/features/rate_community.feature
... | ... | @@ -33,4 +33,4 @@ Feature: rate_community |
33 | 33 | Given I am on mycommunity's homepage |
34 | 34 | When I follow "Rate this Community" |
35 | 35 | Then I should see "Joao Silva" within ".star-profile-name" |
36 | - And I should see Joao Silva's profile image | |
37 | 36 | \ No newline at end of file |
37 | + And I should see Joao Silva's profile image | ... | ... |
plugins/organization_ratings/features/vote_once_disable_cooldown.feature
0 → 100644
... | ... | @@ -0,0 +1,23 @@ |
1 | +Feature: vote_once_disable_cooldown | |
2 | + As a admin | |
3 | + I want to disable the cooldown time when vote once is enabled | |
4 | + Making it clearly that there is no cooldown when vote once is enabled | |
5 | + | |
6 | + Background: | |
7 | + Given plugin "OrganizationRatings" is enabled on environment | |
8 | + And I am logged in as admin | |
9 | + And I go to /admin/plugins | |
10 | + And I check "Organization Ratings" | |
11 | + And I press "Save changes" | |
12 | + | |
13 | + @selenium | |
14 | + Scenario: disable or enable the cooldown field when vote on is checked or unchecked | |
15 | + Given I follow "Administration" | |
16 | + And I follow "Plugins" | |
17 | + And I follow "Configuration" | |
18 | + And the field "#organization_ratings_config_cooldown" should be enabled | |
19 | + And I check "Vote once" | |
20 | + And the field "#organization_ratings_config_cooldown" should be disabled | |
21 | + And I uncheck "Vote once" | |
22 | + Then the field "#organization_ratings_config_cooldown" should be enabled | |
23 | + | ... | ... |
plugins/organization_ratings/lib/organization_ratings_plugin.rb
plugins/organization_ratings/public/organization_rating_management.js
... | ... | @@ -9,8 +9,8 @@ |
9 | 9 | |
10 | 10 | |
11 | 11 | cacheDom: function() { |
12 | - this.$vote_once_checkbox = $("#environment_organization_ratings_vote_once"); | |
13 | - this.$hours_timer_input = $("#environment_organization_ratings_cooldown"); | |
12 | + this.$vote_once_checkbox = $("#organization_ratings_config_vote_once"); | |
13 | + this.$hours_timer_input = $("#organization_ratings_config_cooldown"); | |
14 | 14 | }, |
15 | 15 | |
16 | 16 | |
... | ... | @@ -21,10 +21,22 @@ |
21 | 21 | |
22 | 22 | verifyHoursTimerDisable: function() { |
23 | 23 | if (this.$vote_once_checkbox.is(":checked")) { |
24 | - this.$hours_timer_input.attr("disabled", "disabled"); | |
24 | + //this.$hours_timer_input.attr("disabled", "disabled"); | |
25 | + this.disableVoteOnce(); | |
25 | 26 | } else { |
26 | - this.$hours_timer_input.removeAttr("disabled"); | |
27 | + //this.$hours_timer_input.removeAttr("disabled"); | |
28 | + this.enableVoteOnce(); | |
27 | 29 | } |
30 | + }, | |
31 | + | |
32 | + | |
33 | + enableVoteOnce: function() { | |
34 | + this.$hours_timer_input.removeAttr("disabled"); | |
35 | + }, | |
36 | + | |
37 | + | |
38 | + disableVoteOnce: function() { | |
39 | + this.$hours_timer_input.attr("disabled", "disabled"); | |
28 | 40 | } |
29 | 41 | } |
30 | 42 | ... | ... |
plugins/organization_ratings/public/style.css
... | ... | @@ -14,11 +14,11 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | .star-negative { |
17 | - background-image: url('public/images/star-negative.png'); | |
17 | + background-image: url('images/star-negative.png'); | |
18 | 18 | } |
19 | 19 | |
20 | 20 | .star-positive { |
21 | - background-image: url('public/images/star-positive.png'); | |
21 | + background-image: url('images/star-positive.png'); | |
22 | 22 | } |
23 | 23 | |
24 | 24 | .small-star-negative, .small-star-positive { |
... | ... | @@ -31,11 +31,11 @@ |
31 | 31 | } |
32 | 32 | |
33 | 33 | .small-star-negative { |
34 | - background-image: url('public/images/small-star-negative.png'); | |
34 | + background-image: url('images/small-star-negative.png'); | |
35 | 35 | } |
36 | 36 | |
37 | 37 | .small-star-positive { |
38 | - background-image: url('public/images/small-star-positive.png'); | |
38 | + background-image: url('images/small-star-positive.png'); | |
39 | 39 | } |
40 | 40 | |
41 | 41 | .medium-star-negative, .medium-star-positive { |
... | ... | @@ -48,11 +48,11 @@ |
48 | 48 | } |
49 | 49 | |
50 | 50 | .medium-star-positive { |
51 | - background-image: url('public/images/star-positive-medium.png'); | |
51 | + background-image: url('images/star-positive-medium.png'); | |
52 | 52 | } |
53 | 53 | |
54 | 54 | .medium-star-negative { |
55 | - background-image: url('public/images/star-negative-medium.png'); | |
55 | + background-image: url('images/star-negative-medium.png'); | |
56 | 56 | } |
57 | 57 | |
58 | 58 | .star-hide { | ... | ... |