From dad0d3868b8c396f27f0b4260cc4f730bbb5bd04 Mon Sep 17 00:00:00 2001 From: zmagod Date: Tue, 27 Sep 2016 17:31:37 +0200 Subject: [PATCH] fixing hound --- app/assets/javascripts/comments.js | 16 ++++++++++++---- app/controllers/my_module_comments_controller.rb | 6 +++--- app/controllers/project_comments_controller.rb | 6 +++--- app/controllers/result_comments_controller.rb | 6 +++--- app/controllers/step_comments_controller.rb | 6 +++--- 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/comments.js b/app/assets/javascripts/comments.js index 5e5b46041..7d8e75ba3 100644 --- a/app/assets/javascripts/comments.js +++ b/app/assets/javascripts/comments.js @@ -62,10 +62,10 @@ var Comments = (function() { } $(data.html).insertAfter(listItem); - if (data.results_number < data.per_page) { + if (data.resultsNumber < data.perPage) { moreBtn.remove(); } else { - moreBtn.attr('href', data.more_url); + moreBtn.attr('href', data.moreUrl); moreBtn.trigger('blur'); } @@ -160,7 +160,11 @@ var Comments = (function() { } function initCommentOptions(scrollableContainer, useParentOffset) { - useParentOffset = (typeof useParentOffset !== 'undefined') ? useParentOffset : true; + if ( ! _.isUndefined(typeof useParentOffset) ) { + useParentOffset = useParentOffset; + } else { + useParentOffset = true; + } scrollCommentOptions($('.dropdown-comment'), useParentOffset); // Reposition dropdown to the left @@ -188,7 +192,11 @@ var Comments = (function() { } function scrollCommentOptions(selector, useParentOffset) { - useParentOffset = (typeof useParentOffset !== 'undefined') ? useParentOffset : true; + if ( ! _.isUndefined(typeof useParentOffset) ) { + useParentOffset = useParentOffset; + } else { + useParentOffset = true; + } _.each(selector, function(el) { var $el = $(el); var offset = useParentOffset ? $el.offset().top : $el.position().top; diff --git a/app/controllers/my_module_comments_controller.rb b/app/controllers/my_module_comments_controller.rb index 7a9bec164..5138c8126 100644 --- a/app/controllers/my_module_comments_controller.rb +++ b/app/controllers/my_module_comments_controller.rb @@ -23,9 +23,9 @@ class MyModuleCommentsController < ApplicationController .first.id)) end render json: { - per_page: @per_page, - results_number: @comments.length, - more_url: more_url, + perPage: @per_page, + resultsNumber: @comments.length, + moreUrl: more_url, html: render_to_string( partial: partial, locals: { diff --git a/app/controllers/project_comments_controller.rb b/app/controllers/project_comments_controller.rb index 245d780f9..a6b06fe7b 100644 --- a/app/controllers/project_comments_controller.rb +++ b/app/controllers/project_comments_controller.rb @@ -22,9 +22,9 @@ class ProjectCommentsController < ApplicationController .first.id)) end render json: { - per_page: @per_page, - results_number: @comments.length, - more_url: more_url, + perPage: @per_page, + resultsNumber: @comments.length, + moreUrl: more_url, html: render_to_string( partial: partial, locals: { diff --git a/app/controllers/result_comments_controller.rb b/app/controllers/result_comments_controller.rb index c63e2dca5..77083ec6a 100644 --- a/app/controllers/result_comments_controller.rb +++ b/app/controllers/result_comments_controller.rb @@ -24,9 +24,9 @@ class ResultCommentsController < ApplicationController .first.id)) end render json: { - per_page: @per_page, - results_number: @comments.length, - more_url: more_url, + perPage: @per_page, + resultsNumber: @comments.length, + moreUrl: more_url, html: render_to_string(partial: partial, locals: { comments: @comments, more_comments_url: more_url }) diff --git a/app/controllers/step_comments_controller.rb b/app/controllers/step_comments_controller.rb index 9c68770e3..1f6502da5 100644 --- a/app/controllers/step_comments_controller.rb +++ b/app/controllers/step_comments_controller.rb @@ -23,9 +23,9 @@ class StepCommentsController < ApplicationController from: @comments.first.id)) end render json: { - per_page: @per_page, - results_number: @comments.length, - more_url: more_url, + perPage: @per_page, + resultsNumber: @comments.length, + moreUrl: more_url, html: render_to_string(partial: partial, locals: { comments: @comments, more_comments_url: more_url })