plots2 icon indicating copy to clipboard operation
plots2 copied to clipboard

add link to "new contributor" labels

Open first-timers[bot] opened this issue 8 years ago • 5 comments

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!

🤔 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

  • [ ] 🙋 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!

  • [ ] 📝 Update the file app/models/node_tag.rb in the plots2 repository (press the little pen Icon) and edit the line as shown below.

See this page for some help in taking your first steps!

Below is a "diff" showing in red (and a -) which lines to remove, and in green (and a +) which lines to add:

@@ -21,7 +21,7 @@ def author
 
   def new_author_contributor
     @uid = uid
-    return "<span class = 'label label-success'><i>New Contributor</i></span>".html_safe if Node.where(:uid => @uid).length === 1
+    return "<a href='/tag/first-time-poster' class='label label-success'><i>new contributor</i></a>".html_safe if Node.where(:uid => @uid).length === 1
   end
 
   def user
  • [ ] 💾 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!

(This issue was created by First-Timers-Bot.)

first-timers[bot] avatar Oct 31 '18 13:10 first-timers[bot]

After this is done, we need a similar change in two other places:

https://github.com/publiclab/plots2/blob/4f028aad99913a8e995246d890228cc6478497f1/app/models/user.rb#L53-L56

and

https://github.com/publiclab/plots2/blob/900ac7da8b484df33cad70a88c9b5efb834cd4e2/app/models/drupal_user.rb#L91-L99

We would also be very happy if someone wanted to try and consolidate these three pieces of code so they aren't redundant! So, multiple issues available here!

jywarren avatar Oct 31 '18 13:10 jywarren

🙋🙋🙋 @jywarren

leanyanko avatar Oct 31 '18 16:10 leanyanko

Super! Thank you!!!

Next after this:

try and consolidate these three pieces of code so they aren't redundant

But it can be a follow-up PR once this one is closed.

jywarren avatar Oct 31 '18 16:10 jywarren

Sure, @jywarren . Thanks!

Just to check, because I'm not really familiar with ruby. I'm going to declare new file contributor.rb, move new_contributor there and include this file to all 3 models as require_relative 'contributor', right?

I would also consider if I need both, new_contributor and new_author_contributer,

leanyanko avatar Oct 31 '18 18:10 leanyanko

Hi, so sorry for the slow reply!!!

So basically you can just keep one of the three locations it already exists -- i think i prefer plots2/app/models/user.rb -- and for the others, just make them references to the user.rb version. So for the drupal_user versions, you could do:

def new_author_contributor 
  user.new_contributor
end 
  
def new_contributor 
  user.new_contributor
end 

That /should/ work... but also perhaps we can search the codebase entirely for new_author_contributor and replace all instances with new_contributor since it seems redundant?

Also, just a note that your initial work on this was already merged! So this pull request is no longer needed and you could close it if you wanted; the changes have already been accepted to the main publiclab repository: https://github.com/meinou/plots2/pull/2

Thanks again, and if you want to open a new PR, please name it descriptively -- something like "remove redundancy of 'new_contributor' code" -- that way we can quickly help you get it reviewed and wrapped up.

🙌 🎉

jywarren avatar Nov 05 '18 21:11 jywarren