Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new question card formatting in https://publiclab.org/questions caused some issues #10043

Closed
jywarren opened this issue Aug 17, 2021 · 10 comments
Labels
design issue requires more design work and discussion (i.e. mockups and sketches) help wanted requires help by anyone willing to contribute HTML

Comments

@jywarren
Copy link
Member

Uh oh - actually it looks like our question card formatting affecting https://publiclab.org/questions was affected by the changes in #8731. I'm opening this just to try to resolve it:

Before:

image

Now:

image

I think we need to fix the lazy loading on /questions, probably just by running this:

$(function(){
  $("img").lazyload();
});

(see https://github.com/publiclab/plots2/pull/8043/files#diff-10d79f07bd4ae39a54ddd901d05832f6ea45f6ec427932edd966bed0b83e6714R20)

Originally posted by @jywarren in #8731 (comment)

@jywarren jywarren added design issue requires more design work and discussion (i.e. mockups and sketches) help wanted requires help by anyone willing to contribute HTML labels Aug 17, 2021
@jywarren
Copy link
Member Author

cc @Manasa2850 but I know you're busy now -- just whenever you are available!

@Tlazypanda
Copy link
Collaborator

Hey @jywarren Just checked out this issue seems like it's not broken but maybe these questions don't have any images for them so it's showing this placeholder. For example - https://publiclab.org/questions?page=4 on navigating here the images take about 30 seconds but the ones with images load for example - https://publiclab.org/notes/iman/03-30-2021/why-the-color-of-infragram-picture-is-different-from-what-i-take-with-my-raspberry-pi-using-picamera-api

I tried locally too but wasn't able to reproduce 😅
image

Not sure if this is what you meant by the issue though :p Maybe we can only show the images where they exist to not create confusion?

@ebarry
Copy link
Member

ebarry commented Sep 13, 2021

Great idea @Tlazypanda ! I support this.

@jywarren
Copy link
Member Author

Great, thanks @Tlazypanda - let's just remove them then!

@jywarren
Copy link
Member Author

Ah wait - so, i realize that we do need to be careful that the removal only affects /questions/ - as the way we manage missing images in /notes/ is distinct:

image

see i.e. https://publiclab.org/tag/helium

but that should be easy enough with a conditional!!!

@TildaDares
Copy link
Member

@jywarren @ebarry @Tlazypanda I looked through this PR #9922 and the issue is that a question has a type of note so this condition will never be fulfilled

<% elsif node.type == 'question' %>
<div class="card bg-white rounded<% if node.status == 4 %> moderated<% end %>">
<div class="card-header">
<%= render partial: 'dashboard/node_moderate', locals: { node: node } %>
<h4><a <% if @widget %>target="_blank"<% end %> href="<%= node.path(:question) %>"><%= node.title %></a></h4>
</div>
<div class="card-footer">
<p class="meta"><%= render partial: "dashboard/node_meta", locals: { node: node } %></p>
</div>
</div>
<% end %>

Since you want these changes to affect only '/questions' I think it would be better to just return the questions template back to https://github.com/publiclab/plots2/blob/main/app/views/questions/_questions.html.erb#L5-L12. _card.html.erb was created with notes in mind so trying to customize the look of only questions would involve a lot of conditionals.

@jywarren
Copy link
Member Author

Wow, great catch here too @TildaDares. And I think i agree on the solution. Thanks!

@jywarren
Copy link
Member Author

So if we could just switch back to displaying the question template that would seem to work, although please do confirm it ends up looking like the "before" image above.

However if it doesn't, we could amend the conditional by using instead of type == 'question', this function which helps determine if it's really a question:

plots2/app/models/node.rb

Lines 188 to 190 in 9682cb8

def is_question?
has_power_tag('question')
end

@TildaDares
Copy link
Member

@jywarren I created an FTO in #10325 for this issue

@TildaDares
Copy link
Member

Resolved in #10359

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design issue requires more design work and discussion (i.e. mockups and sketches) help wanted requires help by anyone willing to contribute HTML
Projects
None yet
Development

No branches or pull requests

4 participants