diff --git a/app/controllers/group_controller.rb b/app/controllers/group_controller.rb index 95f772d6..3e19e921 100644 --- a/app/controllers/group_controller.rb +++ b/app/controllers/group_controller.rb @@ -9,7 +9,7 @@ class GroupController < ApplicationController respond_to do |format| format.html - format.js + format.js { render layout: false } end end end diff --git a/app/controllers/inbox_controller.rb b/app/controllers/inbox_controller.rb index 24849f32..9bb867c9 100644 --- a/app/controllers/inbox_controller.rb +++ b/app/controllers/inbox_controller.rb @@ -49,7 +49,7 @@ class InboxController < ApplicationController @disabled = true if @inbox.empty? respond_to do |format| format.html - format.js + format.js { render layout: false } end end end diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 006ba5e8..f2569383 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -9,7 +9,7 @@ class NotificationsController < ApplicationController respond_to do |format| format.html - format.js + format.js { render layout: false } end end diff --git a/app/controllers/public_controller.rb b/app/controllers/public_controller.rb index 9a7b1d97..c5fc1143 100644 --- a/app/controllers/public_controller.rb +++ b/app/controllers/public_controller.rb @@ -8,7 +8,7 @@ class PublicController < ApplicationController respond_to do |format| format.html - format.js + format.js { render layout: false } end end end diff --git a/app/controllers/question_controller.rb b/app/controllers/question_controller.rb index f698bdca..7854d8df 100644 --- a/app/controllers/question_controller.rb +++ b/app/controllers/question_controller.rb @@ -7,7 +7,7 @@ class QuestionController < ApplicationController respond_to do |format| format.html - format.js + format.js { render layout: false } end end end diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 1fc494d8..8854f0e4 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -9,7 +9,7 @@ class StaticController < ApplicationController respond_to do |format| format.html - format.js + format.js { render layout: false } end else return render 'static/front' diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 9804a61e..0cd06f9f 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -19,7 +19,7 @@ class UserController < ApplicationController respond_to do |format| format.html - format.js + format.js { render layout: false } end end @@ -78,7 +78,11 @@ class UserController < ApplicationController @users_last_id = @users.map(&:id).min @more_data_available = !@user.cursored_followers(last_id: @users_last_id, size: 1).count.zero? @type = :friend - render 'show_follow' + + respond_to do |format| + format.html { render "show_follow" } + format.js { render "show_follow", layout: false } + end end def friends @@ -88,7 +92,11 @@ class UserController < ApplicationController @users_last_id = @users.map(&:id).min @more_data_available = !@user.cursored_friends(last_id: @users_last_id, size: 1).count.zero? @type = :friend - render 'show_follow' + + respond_to do |format| + format.html { render "show_follow" } + format.js { render "show_follow", layout: false } + end end def questions @@ -97,6 +105,11 @@ class UserController < ApplicationController @questions = @user.cursored_questions(author_is_anonymous: false, last_id: params[:last_id]) @questions_last_id = @questions.map(&:id).min @more_data_available = !@user.cursored_questions(author_is_anonymous: false, last_id: @questions_last_id, size: 1).count.zero? + + respond_to do |format| + format.html + format.js { render layout: false } + end end def data diff --git a/app/helpers/layouts_helper.rb b/app/helpers/layouts_helper.rb index 20784840..5a74f551 100644 --- a/app/helpers/layouts_helper.rb +++ b/app/helpers/layouts_helper.rb @@ -7,4 +7,4 @@ module LayoutsHelper @haml_buffer.buffer.replace output self.output_buffer = ActionView::OutputBuffer.new(output) end -end \ No newline at end of file +end diff --git a/app/views/notifications/index.haml b/app/views/notifications/index.haml index 919cfb59..86a66d4c 100644 --- a/app/views/notifications/index.haml +++ b/app/views/notifications/index.haml @@ -15,8 +15,9 @@ .media = render "notifications/type/#{notification.target_type.downcase}", notification: notification - = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type] + - unless @notifications.count.zero? + = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type] - - if @more_data_available - %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @notifications_last_id }} - Load more \ No newline at end of file + - if @more_data_available + %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @notifications_last_id }} + Load more diff --git a/app/views/notifications/index.js.erb b/app/views/notifications/index.js.erb index ba7adebb..8ebcb51d 100644 --- a/app/views/notifications/index.js.erb +++ b/app/views/notifications/index.js.erb @@ -1,6 +1,6 @@ $('#notifications').append('<% @notifications.each do |notification| - %><%= j render 'notifications/notification', notification: notification -%><% end %>'); + %>
  • <%= j render "notifications/type/#{notification.target_type.downcase}", notification: notification +%>
  • <% end %>'); <% if @more_data_available %> $('#pagination').html('<%= j render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type] %>'); <% else %>