Merge branch 'master' of github.com:Retrospring/retrospring

This commit is contained in:
Andreas Nedbal 2020-05-09 05:03:54 +02:00
commit c9866e87bf
14 changed files with 48 additions and 34 deletions

View File

@ -9,7 +9,7 @@ class GroupController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js { render layout: false }
end end
end end
end end

View File

@ -49,7 +49,7 @@ class InboxController < ApplicationController
@disabled = true if @inbox.empty? @disabled = true if @inbox.empty?
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js { render layout: false }
end end
end end
end end

View File

@ -9,7 +9,7 @@ class NotificationsController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js { render layout: false }
end end
end end

View File

@ -8,7 +8,7 @@ class PublicController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js { render layout: false }
end end
end end
end end

View File

@ -7,7 +7,7 @@ class QuestionController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js { render layout: false }
end end
end end
end end

View File

@ -9,7 +9,7 @@ class StaticController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js { render layout: false }
end end
else else
return render 'static/front' return render 'static/front'

View File

@ -19,7 +19,7 @@ class UserController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js { render layout: false }
end end
end end
@ -78,7 +78,11 @@ class UserController < ApplicationController
@users_last_id = @users.map(&:id).min @users_last_id = @users.map(&:id).min
@more_data_available = !@user.cursored_followers(last_id: @users_last_id, size: 1).count.zero? @more_data_available = !@user.cursored_followers(last_id: @users_last_id, size: 1).count.zero?
@type = :friend @type = :friend
render 'show_follow'
respond_to do |format|
format.html { render "show_follow" }
format.js { render "show_follow", layout: false }
end
end end
def friends def friends
@ -88,7 +92,11 @@ class UserController < ApplicationController
@users_last_id = @users.map(&:id).min @users_last_id = @users.map(&:id).min
@more_data_available = !@user.cursored_friends(last_id: @users_last_id, size: 1).count.zero? @more_data_available = !@user.cursored_friends(last_id: @users_last_id, size: 1).count.zero?
@type = :friend @type = :friend
render 'show_follow'
respond_to do |format|
format.html { render "show_follow" }
format.js { render "show_follow", layout: false }
end
end end
def questions def questions
@ -97,6 +105,11 @@ class UserController < ApplicationController
@questions = @user.cursored_questions(author_is_anonymous: false, last_id: params[:last_id]) @questions = @user.cursored_questions(author_is_anonymous: false, last_id: params[:last_id])
@questions_last_id = @questions.map(&:id).min @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? @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 end
def data def data

View File

@ -7,4 +7,4 @@ module LayoutsHelper
@haml_buffer.buffer.replace output @haml_buffer.buffer.replace output
self.output_buffer = ActionView::OutputBuffer.new(output) self.output_buffer = ActionView::OutputBuffer.new(output)
end end
end end

View File

@ -2,11 +2,11 @@
- @timeline.each do |answer| - @timeline.each do |answer|
= render 'answerbox', a: answer = render 'answerbox', a: answer
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @timeline_last_id = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @timeline_last_id
- if @more_data_available - if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @timeline_last_id }} %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @timeline_last_id }}
= t 'views.actions.load' = t 'views.actions.load'
- provide(:title, group_title(@group)) - provide(:title, group_title(@group))
- parent_layout "feed" - parent_layout "feed"

View File

@ -5,8 +5,8 @@
- if @inbox.empty? - if @inbox.empty?
= t 'views.inbox.empty' = t 'views.inbox.empty'
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @inbox_last_id = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @inbox_last_id
- if @more_data_available - if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @inbox_last_id }} %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @inbox_last_id }}
= t 'views.actions.load' = t 'views.actions.load'

View File

@ -15,8 +15,9 @@
.media .media
= render "notifications/type/#{notification.target_type.downcase}", notification: notification = 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 - if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @notifications_last_id }} %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @notifications_last_id }}
Load more Load more

View File

@ -1,6 +1,6 @@
$('#notifications').append('<% @notifications.each do |notification| $('#notifications').append('<% @notifications.each do |notification|
%><%= j render 'notifications/notification', notification: notification %><li class="list-group-item"><div class="media"><%= j render "notifications/type/#{notification.target_type.downcase}", notification: notification
%><% end %>'); %></div></li><% end %>');
<% if @more_data_available %> <% 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] %>'); $('#pagination').html('<%= j render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type] %>');
<% else %> <% else %>

View File

@ -2,11 +2,11 @@
- @timeline.each do |answer| - @timeline.each do |answer|
= render 'answerbox', a: answer = render 'answerbox', a: answer
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @timeline_last_id = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @timeline_last_id
- if @more_data_available - if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @timeline_last_id }} %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @timeline_last_id }}
Load more Load more
- provide(:title, generate_title("Public Timeline")) - provide(:title, generate_title("Public Timeline"))
- parent_layout "feed" - parent_layout "feed"

View File

@ -2,11 +2,11 @@
- @timeline.each do |answer| - @timeline.each do |answer|
= render 'answerbox', a: answer = render 'answerbox', a: answer
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @timeline_last_id = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @timeline_last_id
- if @more_data_available - if @more_data_available
%button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @timeline_last_id }} %button#load-more-btn.btn.btn-default{type: :button, data: { last_id: @timeline_last_id }}
Load more Load more
- provide(:title, "#{APP_CONFIG['site_name']}") - provide(:title, "#{APP_CONFIG['site_name']}")
- parent_layout "feed" - parent_layout "feed"