Plots2: Refactor _answer.html.erb

Created on 10 Jan 2019  ยท  10Comments  ยท  Source: publiclab/plots2

Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!

We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you ๐Ÿ’

If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!

The problem

Line 62 in _answer.html.erb is considerably long. We need to break it into shorter lines for readability.

<a href="<% if current_user %>'/answer_like/likes/<%= answer.id %>'<% else %>'#'<% end %>" data-remote ="true" tooltip-title="Helpful? Like it" class="btn btn-default btn-sm btn-like" id="answer-like-button-<%= answer.id %>" <% unless current_user %> popover-content="You must be logged in to Like the answer" <% end %> ><span id="answer-like-star-<%= answer.id %>" class="fa fa-star<% if current_user && !answer.liked_by(current_user.uid) %>-o<% end %>"></span><span id="answer-like-count-<%= answer.id %>"><%= answer.likers.length %></span> Likes</a>

๐Ÿค” What you will need to know.

Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you through the process.

๐Ÿ“‹ Step by Step solution

  • [ ] ๐Ÿ™‹ Claim this issue: Comment below. If someone else has claimed it, ask if they've opened a pull request already and if they're stuck -- maybe you can help them solve a problem or move it along!

  • [ ] ๐Ÿ“ Refactor line 62, instead of one long line break it into smaller lines instead.

code link - https://github.com/publiclab/plots2/blob/master/app/views/questions/_answer.html.erb

  • [ ] ๐Ÿ’พ Commit your changes

  • [ ] ๐Ÿ”€ Start a Pull Request. There are two ways how you can start a pull request:

  1. If you are familiar with the terminal or would like to learn it, here is a great tutorial on how to send a pull request using the terminal.

  2. You can also edit files directly in your browser and open a pull request from there.

  • [ ] ๐Ÿ Done Ask in comments for a review :)

๐Ÿค”โ“ Questions?

Leave a comment below!

Is someone else already working on this?

We encourage you to link to this issue by mentioning the issue # in your pull request, so we can see if someone's already started on it. If someone seem stuck, offer them some help! Otherwise, take a look at some other issues you can help with. Thanks!

enhancement first-timers-only

All 10 comments

Hi @jywarren there are many places in our codebase where the length of line makes it look complex and difficult to read. Would you like to recommend the optimal length?

Thanks!

I've read that 80 characters is a good # to aim for, and i think in coding
maybe even less... what's the max character width of GitHub's UI?

On Thu, Jan 10, 2019 at 4:07 PM Gaurav Sachdeva notifications@github.com
wrote:

Hi @jywarren https://github.com/jywarren there are many places in our
codebase where the length of line makes it look complex and difficult to
read. Would you like to recommend the optimal length?

Thanks!

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/4595#issuecomment-453253712,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABfJyz9hORb-Dasym06uq1tF01LKLKhks5vB6tWgaJpZM4Z6TQW
.

Hi @jywarren, it varies dependent on browser, but between 113 and 126 as per https://stackoverflow.com/questions/22207920/what-is-githubs-character-limit-or-line-length-for-viewing-files-on-github

I too have read 80 characters is a good number to aim for in terms of readability.

Great @dave-light! Please keep it 80 char max then while refactoring the file. Thanks!

Quick thought, instead of doing this myself, should I edit the issue and make it an FTO? It's perfect for someone who hasn't yet contributed.

Yes, sure @dave-light! you can refer to FTO template from here - https://github.com/publiclab/plots2/issues/4440 and mention me or @publiclab/plots2-reviewers for getting it labelled.

Thanks!

Hi @dave-light, here's the markdown for FTO:
https://gist.github.com/gauravano/2bb62600bbdca57df83e1757af634b1e

Thanks!

@gauravano thanks for the FTO markdown code, i've updated the issue. Please add FTO tag :-)

Greetings!
First time contributor in your codebase.
Could I start with this issue ?

Hi @vladdypwnz, Welcome to Public Lab and you can start with this issue! Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

first-timers[bot] picture first-timers[bot]  ยท  3Comments

keshavsethi picture keshavsethi  ยท  3Comments

ebarry picture ebarry  ยท  3Comments

bronwen9 picture bronwen9  ยท  3Comments

grvsachdeva picture grvsachdeva  ยท  3Comments