diff --git a/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb b/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb index e87447b..de191e4 100644 --- a/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb +++ b/src/noosfero-spb/software_communities/features/step_definitions/software_communities_steps.rb @@ -151,7 +151,7 @@ Given /^the user "([^"]*)" has "([^"]*)" as secondary e\-mail$/ do |login, email end Given /^I click on anything with selector "([^"]*)"$/ do |selector| - evaluate_script "jQuery('#{selector}').trigger('click') && true" + page.evaluate_script("jQuery('##{selector}').click();") end Given /^I should see "([^"]*)" of this selector "([^"]*)"$/ do |quantity, selector| diff --git a/src/noosfero-spb/software_communities/features/use_report.feature b/src/noosfero-spb/software_communities/features/use_report.feature new file mode 100644 index 0000000..853cfd8 --- /dev/null +++ b/src/noosfero-spb/software_communities/features/use_report.feature @@ -0,0 +1,56 @@ +Feature: Use report + As a user + I want to make a use report of a software + to give my feedback about a software. + + Background: + Given "SoftwareCommunitiesPlugin" plugin is enabled + Given "OrganizationRatings" plugin is enabled + And I am logged in as mpog_admin + And I go to /admin/plugins + And I check "SoftwareCommunitiesPlugin" + And I press "Save changes" + And the following softwares + | name | public_software | finality | + | Noosfero | true | some finality | + + Scenario: Add Organization Ratings Block + Given I go to Noosfero's control panel + And I follow "Edit sideboxes" + When I follow "Add a block" + And I choose "Organization Ratings" + And I press "Add" + Then I should see "Report your experiences" + + Scenario: Add Average Rating Block + Given I go to Noosfero's control panel + And I follow "Edit sideboxes" + When I follow "Add a block" + And I choose "Organization Average Rating" + And I press "Add" + Then I should see "Be the first to rate!" + + @selenium + Scenario: Test Additional Fields JavaScript + Given I go to /profile/noosfero/plugin/organization_ratings/new_rating + Then I should not see "Number of Beneficiaries" + And I should not see "Saved Resources" + When I click on anything with selector "comments-additional-information" + Then I should see "Number of Beneficiaries" + And I should see "Saved Resources" + + @selenium + Scenario: Validate Use Report fields format + Given I go to Noosfero's control panel + Given I follow "Edit sideboxes" + When I follow "Add a block" + And I choose "Organization Ratings" + And I press "Add" + And I am on Noosfero's homepage + And I follow "Rate Community" + When I click on anything with selector "comments-additional-information" + And I fill in "organization_rating_people_benefited" with "123123" + And I fill in "organization_rating_saved_value" with "7654321" + And I press "Save" + Then I should see "Benefited People: 123.123" + And I should see "Saved Resources: $ 76,543.21" diff --git a/src/noosfero-spb/software_communities/public/vendor/jquery.maskedinput.min.js b/src/noosfero-spb/software_communities/public/vendor/jquery.maskedinput.min.js index 0d9ce6e..becb14c 100644 --- a/src/noosfero-spb/software_communities/public/vendor/jquery.maskedinput.min.js +++ b/src/noosfero-spb/software_communities/public/vendor/jquery.maskedinput.min.js @@ -1,7 +1,15 @@ -/* - Masked Input plugin for jQuery - Copyright (c) 2007-2013 Josh Bush (digitalbush.com) - Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) - Version: 1.3.1 -*/ -(function(e){function t(){var e=document.createElement("input"),t="onpaste";return e.setAttribute(t,""),"function"==typeof e[t]?"paste":"input"}var n,a=t()+".mask",r=navigator.userAgent,i=/iphone/i.test(r),o=/android/i.test(r);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,r){var c,l,s,u,f,h;return!t&&this.length>0?(c=e(this[0]),c.data(e.mask.dataName)()):(r=e.extend({placeholder:e.mask.placeholder,completed:null},r),l=e.mask.definitions,s=[],u=h=t.length,f=null,e.each(t.split(""),function(e,t){"?"==t?(h--,u=e):l[t]?(s.push(RegExp(l[t])),null===f&&(f=s.length-1)):s.push(null)}),this.trigger("unmask").each(function(){function c(e){for(;h>++e&&!s[e];);return e}function d(e){for(;--e>=0&&!s[e];);return e}function m(e,t){var n,a;if(!(0>e)){for(n=e,a=c(t);h>n;n++)if(s[n]){if(!(h>a&&s[n].test(R[a])))break;R[n]=R[a],R[a]=r.placeholder,a=c(a)}b(),x.caret(Math.max(f,e))}}function p(e){var t,n,a,i;for(t=e,n=r.placeholder;h>t;t++)if(s[t]){if(a=c(t),i=R[t],R[t]=n,!(h>a&&s[a].test(i)))break;n=i}}function g(e){var t,n,a,r=e.which;8===r||46===r||i&&127===r?(t=x.caret(),n=t.begin,a=t.end,0===a-n&&(n=46!==r?d(n):a=c(n-1),a=46===r?c(a):a),k(n,a),m(n,a-1),e.preventDefault()):27==r&&(x.val(S),x.caret(0,y()),e.preventDefault())}function v(t){var n,a,i,l=t.which,u=x.caret();t.ctrlKey||t.altKey||t.metaKey||32>l||l&&(0!==u.end-u.begin&&(k(u.begin,u.end),m(u.begin,u.end-1)),n=c(u.begin-1),h>n&&(a=String.fromCharCode(l),s[n].test(a)&&(p(n),R[n]=a,b(),i=c(n),o?setTimeout(e.proxy(e.fn.caret,x,i),0):x.caret(i),r.completed&&i>=h&&r.completed.call(x))),t.preventDefault())}function k(e,t){var n;for(n=e;t>n&&h>n;n++)s[n]&&(R[n]=r.placeholder)}function b(){x.val(R.join(""))}function y(e){var t,n,a=x.val(),i=-1;for(t=0,pos=0;h>t;t++)if(s[t]){for(R[t]=r.placeholder;pos++a.length)break}else R[t]===a.charAt(pos)&&t!==u&&(pos++,i=t);return e?b():u>i+1?(x.val(""),k(0,h)):(b(),x.val(x.val().substring(0,i+1))),u?t:f}var x=e(this),R=e.map(t.split(""),function(e){return"?"!=e?l[e]?r.placeholder:e:void 0}),S=x.val();x.data(e.mask.dataName,function(){return e.map(R,function(e,t){return s[t]&&e!=r.placeholder?e:null}).join("")}),x.attr("readonly")||x.one("unmask",function(){x.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){clearTimeout(n);var e;S=x.val(),e=y(),n=setTimeout(function(){b(),e==t.length?x.caret(0,e):x.caret(e)},10)}).bind("blur.mask",function(){y(),x.val()!=S&&x.change()}).bind("keydown.mask",g).bind("keypress.mask",v).bind(a,function(){setTimeout(function(){var e=y(!0);x.caret(e),r.completed&&e==x.val().length&&r.completed.call(x)},0)}),y()}))}})})(jQuery); \ No newline at end of file +// jQuery Mask Plugin v1.13.4 +// github.com/igorescobar/jQuery-Mask-Plugin +(function(b){"function"===typeof define&&define.amd?define(["jquery"],b):"object"===typeof exports?module.exports=b(require("jquery")):b(jQuery||Zepto)})(function(b){var y=function(a,c,d){a=b(a);var g=this,k=a.val(),l;c="function"===typeof c?c(a.val(),void 0,a,d):c;var e={invalid:[],getCaret:function(){try{var q,b=0,e=a.get(0),f=document.selection,c=e.selectionStart;if(f&&-1===navigator.appVersion.indexOf("MSIE 10"))q=f.createRange(),q.moveStart("character",a.is("input")?-a.val().length:-a.text().length), +b=q.text.length;else if(c||"0"===c)b=c;return b}catch(d){}},setCaret:function(q){try{if(a.is(":focus")){var b,c=a.get(0);c.setSelectionRange?c.setSelectionRange(q,q):c.createTextRange&&(b=c.createTextRange(),b.collapse(!0),b.moveEnd("character",q),b.moveStart("character",q),b.select())}}catch(f){}},events:function(){a.on("input.mask keyup.mask",e.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){a.keydown().keyup()},100)}).on("change.mask",function(){a.data("changed",!0)}).on("blur.mask", +function(){k===a.val()||a.data("changed")||a.triggerHandler("change");a.data("changed",!1)}).on("blur.mask",function(){k=a.val()}).on("focus.mask",function(a){!0===d.selectOnFocus&&b(a.target).select()}).on("focusout.mask",function(){d.clearIfNotMatch&&!l.test(e.val())&&e.val("")})},getRegexMask:function(){for(var a=[],b,e,f,d,h=0;h <%= label_tag "comments_people_benefited", _("Number of Beneficiaries")%> - <%= text_field_tag "organization_rating[people_benefited]", "" %> + <%= text_field_tag "people_benefited_tmp", "" %> + <%= hidden_field_tag "organization_rating[people_benefited]", "" %>
- <%= label_tag "comments_saved_value", _("Saved resources")%> + <%= label_tag "comments_saved_value", _("Saved Resources")%> - <%= text_field_tag "organization_rating[saved_value]", "", :placeholder=>"R$"%> + <%= text_field_tag "saved_value_tmp", "", :placeholder=>"R$" %> + <%= hidden_field_tag "organization_rating[saved_value]","" %>
diff --git a/src/noosfero-spb/software_communities/views/organization_ratings_extra_fields_show_data.html.erb b/src/noosfero-spb/software_communities/views/organization_ratings_extra_fields_show_data.html.erb index 0e57615..497b402 100644 --- a/src/noosfero-spb/software_communities/views/organization_ratings_extra_fields_show_data.html.erb +++ b/src/noosfero-spb/software_communities/views/organization_ratings_extra_fields_show_data.html.erb @@ -1,10 +1,10 @@
- <%=_("Benefited People")%> : <%= user_rating.people_benefited unless user_rating.nil? %> + <%=_("Benefited People")%>: <%= number_with_delimiter(user_rating.people_benefited, :separator => environment.currency_separator, :delimiter => environment.currency_delimiter) unless user_rating.nil? %>
- <%=_("Saved Resources")%> : <%= user_rating.saved_value unless user_rating.nil? %> + <%=_("Saved Resources")%>: <%= float_to_currency(user_rating.saved_value) unless user_rating.nil? %>
-- libgit2 0.21.2