Commit 30e45981d00aab9e9592807d42070c63ac7c036b

Authored by Melissa Wen
2 parents cb360ed8 8600e789

Merge branch 'fix_rating_form_addition_fields_bug' into 'master'

Fix rating form addition fields bug

Fix rating form bug:
When the add new institution button appeared, and the block was closed(with the arrow)
the addition fields script was killing the entire page.

See merge request !110
src/noosfero-spb/gov_user/public/views/create-institution.js
... ... @@ -200,11 +200,9 @@ modulejs.define('CreateInstitution', ['jquery', 'NoosferoRoot', 'SelectElement']
200 200  
201 201 function toggle_extra_fields_style_status(status) {
202 202 if(status) {
203   - $('.extra-fields-container').css({ marginTop: "55px" });
204   - $('.button-bar').css({ marginTop: "55px" });
  203 + $('.comments-software-extra-fields').css({height: "180px" });
205 204 } else {
206   - $('.extra-fields-container').css({ marginTop: "0px" });
207   - $('.button-bar').css({ marginTop: "20px" });
  205 + $('.comments-software-extra-fields').css({height: "140px" });
208 206 }
209 207 }
210 208  
... ...
src/noosfero-spb/noosfero-spb-theme/css/use-report.css
... ... @@ -237,6 +237,11 @@
237 237 margin-left: 10px;
238 238 }
239 239  
  240 +#content .star-rate-form .star-comment-container .extra-fields-container{
  241 + height: 56px;
  242 + overflow: hidden;
  243 +}
  244 +
240 245 #content .star-rate-form .star-comment-container .comments-software-extra-fields {
241 246 height: 0;
242 247 overflow: initial;
... ... @@ -245,7 +250,7 @@
245 250 #content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments {
246 251 margin-bottom: 19px;
247 252 margin-top: 16px;
248   - height: 50px;
  253 + height: auto;
249 254 }
250 255  
251 256 #content .star-rate-form .star-comment-container .comments-software-extra-fields #input_institution_comments > label {
... ...
src/noosfero-spb/noosfero-spb-theme/theme.js
... ... @@ -51,7 +51,7 @@ function alignBlocks(containerIndex){
51 51 // Foco no botao de busca
52 52  
53 53 $('#link-buscar').click(function(e) {
54   - e.preventDefault();
  54 + e.defaultPrevented();
55 55 window.location.hash = '#portal-searchbox';
56 56 $('.searchField').focus()
57 57 })
... ... @@ -195,35 +195,37 @@ $('#link-buscar').click(function(e) {
195 195 $('.star-tooltip').html("?");
196 196 }
197 197  
198   - // TODO: fix calls for this function below
199   - // TODO: comments-additional-information --> comments-display-fields
  198 +
200 199 function set_arrow_direction() {
201 200 var additional_data_bar = $('.comments-display-fields');
202   - var arrow = $('.comments-arrow-down');
203   - var state = 0;
  201 +
204 202 additional_data_bar.on('click', function() {
205   - animateExtraFields();
  203 + var arrow = additional_data_bar.find('span[class*="comments-arrow"]');
  204 + var additional_fields = $('.comments-software-extra-fields');
  205 +
  206 + if (additional_fields) {
  207 + animateExtraFields(additional_fields, arrow);
  208 + }
206 209 });
207 210 }
208 211  
209   - function animateExtraFields() {
210   - var additional_data_bar = $('.comments-display-fields');
211   - var arrow = ($('.comments-arrow-down')[0])? $('.comments-arrow-down') : $('.comments-arrow-up');
212   - console.log(arrow);
213   - var fields = $('.comments-software-extra-fields');
214   - if(fields) {
215   - var innerHeight = fields[0].offsetHeight;
216   - if(fields.height()!==0) {
217   - arrow.attr('class', "comments-arrow-down");
218   - fields.animate({height: 0});
219   - }
220   - else {
221   - arrow.attr('class', "comments-arrow-up");
222   - fields.animate({height: 140});
223   - }
  212 +
  213 + function animateExtraFields(additional_fields, arrow) {
  214 + var innerHeight = additional_fields[0].offsetHeight;
  215 +
  216 + if(additional_fields.height() !== 0) {
  217 + arrow.attr('class', "comments-arrow-down");
  218 + additional_fields.animate({height: 0});
  219 + } else {
  220 + arrow.attr('class', "comments-arrow-up");
  221 + additional_fields.animate({height: additional_fields.get(0).scrollHeight}, 1000 );
224 222 }
  223 +
  224 + // Fix for the arrow change on modal display to block, killing the entire page
  225 + $("#institution_modal").css({'display':'none'});
225 226 }
226 227  
  228 +
227 229 function set_use_report_content() {
228 230 $('.profile-homepage .organization-average-rating-container .rate-this-organization a').html('Avalie este software');
229 231 $('.make-report-block .make-report-container .button-bar a span').html('Avalie este software');
... ...