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
"Browse other activities" next to "replicate this" prompt #754
Comments
I would like to help with this issue. Can u explain further on how? |
Maybe a good place to begin here would be to look over this test, which lays out what we expect to happen in that template: https://github.com/publiclab/plots2/blob/master/test/integration/node_insert_extras_test.rb#L40-L53 Here, we're adding the tag You could add that expectation to the test and create a PR, which we should expect to fail, initially. But -- once it does, we can then begin writing the code to get that test to pass -- and we have a clear way to tell when it's working; to run the tests. Make sense? I think if we take that as our first step, and you create pull request, we can start there and move forward. Sound good? Thanks!! |
Oh, and see how the |
Yeah it sounds great. I will have a look |
Oh - or perhaps you'd like to re-start on this one? Thank you! |
Yeah I think I should finish this one first. |
#1083 is the new PR |
so the tagname of the URL will be = DrupalTag.where(name: "activities:" + @node.power_tag('activity')).first.nodes.first.path |
Hi, so the link would be to a node, and that node would have a tag named So we need to know what the tagname is -- we find that out by using the @node.power_tag('activity') IF it returns something, we then use the resulting string to search for a tag matching DrupalTag.where(name: @node.power_tag('activity')) IF we find tags there, we want to use the first one returned (since tag.nodes.first So basically at each stage of this, we need to use an |
I have added the if statements. Cant understand how to add it to the link. I have opened a PR #1090. |
This has been marked as a good candidate for becoming a first-timers-only issue like these, meaning that it's simple, self-contained, and with some extra formatting, could be a great entry point for a new contributor. If you're familiar enough with this code, please consider reformatting or reposting it as a first-timers-only issue, and then ping @jywarren to get it labelled.
Or just solve it yourself!
A link next to the button would let people more easily horizontally browse activities:
It could go on this line of code, though you should break it up unto multiple lines so it's easier to read:
https://github.com/publiclab/plots2/blob/master/app/views/notes/_responses.html.erb#L8
To determine where the link should lead to, we look for the
tagname
, and go to the page with a tag such asactivities:<tagname>
, so:However, we must account for the possibility that:
.first
on an empty returned array.first
on an empty.nodes
arraySo we'll have to add some
if
statements to protect against that possibility.But once you have the URL, you can just add it in a link, like
<a href="/...">Browser other activities</a>
The text was updated successfully, but these errors were encountered: