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

Idea: powertag pages for activity (activity:foo) can use the "value" of their key:value pair #6173

Closed
ebarry opened this issue Aug 21, 2019 · 8 comments · Fixed by #8634
Closed
Labels
feature explains that the issue is to add a new feature fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet

Comments

@ebarry
Copy link
Member

ebarry commented Aug 21, 2019

Please describe the desired behavior.

This is a feature idea for convention for powertag pages for Activity:foo to

  1. have their lead cards default to the "value" of their key:value pair
  2. have their lead images be pulled from the "value" wiki page of their key:value pair

For instance, view https://publiclab.org/tag/activity:microscope to see that the lead card could have a link back to /microscope, and the lead image be pulled from /microscope.

Screen Shot 2019-08-21 at 3 32 48 PM

Additional context (optional)

Thank you for reading!

@ebarry ebarry added the feature explains that the issue is to add a new feature label Aug 21, 2019
@jywarren
Copy link
Member

We currently have this card pull from a page that's redirected to, which is a similar situation. So, we can look at these lines of code:

if params[:id].is_a? Integer
@wiki = Node.find(params[:id])&.first
else
@wiki = Node.where(path: "/wiki/#{params[:id]}").try(:first) || Node.where(path: "/#{params[:id]}").try(:first)
@wiki = Node.where(slug: @wiki.power_tag('redirect'))&.first if @wiki&.has_power_tag('redirect') # use a redirected wiki page if it exists
end
@node = @wiki # expose the wiki node in the @node variable so we get open graph meta tags in the layout

We can add a condition which detects if it's a key:value powertag, like:

elsif tagname = params[:id].match(':') && node = Node.where(slug: tagname)&.first
    @wiki = node # skip powertag prefix to find wiki page

...I think? This might take some reworking, but it's worth a try!


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 @publiclab/reviewers to get it labelled. Or, if this is not your first time, try to solve it yourself!

@ebarry
Copy link
Member Author

ebarry commented Aug 29, 2019

Thanks to anyone who might be able to reformat this as a first-timers-only issue 💚

@ebarry ebarry added this to the Tagging and topics milestone Sep 5, 2019
@ebarry ebarry added the fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet label Sep 12, 2019
@cesswairimu
Copy link
Collaborator

Hi @ebarry @jywarren, I am trying to reformat this to be a fto need some clarity though...The link we are editing is it Add a wiki page button in the screenshot about and from the example should it link to /tag/microscope? Thanks

@Jigyasa-Kumari
Copy link
Contributor

Hi, I am Jigyasa, and I am an Outreachy 2020 applicant. Is this issue open and can I work on this?

@stale stale bot added the stale label Oct 7, 2020
@publiclab publiclab deleted a comment from stale bot Oct 7, 2020
@stale stale bot removed the stale label Oct 7, 2020
@Karska-dev
Copy link
Contributor

Hello! I would like to work with this one.

@cesswairimu
Copy link
Collaborator

Hi @Karska-dev we would love your help. Go ahead

@Karska-dev
Copy link
Contributor

Hi @ebarry @jywarren, I am trying to reformat this to be a fto need some clarity though...The link we are editing is it Add a wiki page button in the screenshot about and from the example should it link to /tag/microscope? Thanks

So, if I get it right. This card:

Screen Shot 2020-10-14 at 6 31 19 PM

should look exactly like this one:

Screen Shot 2020-10-14 at 6 31 28 PM

Please, correct me where I am wrong!

@ebarry
Copy link
Member Author

ebarry commented Oct 15, 2020

HI @Karska-dev ,
Thanks for working on this one!

This situation is where there's a power tag in the form key:value where value already has a dedicated wiki page.

In your example, you are showing the tag page for the powertag activity:translation. There is a page publiclab.org/wiki/translation, so the activity:translation card should:

  1. pull the preview text from publiclab.org/wiki/translation, same as publiclab.org/tag/translation does.
  2. display a "Learn more" button that links to /wiki/translation instead of "Add a description" button that leads to an editor for creating a new wiki page.
  3. pull the lead image from /wiki/translation same as /tag/translation does
  4. Remain labelled on the card as activity:translation

Karska-dev added a commit to Karska-dev/plots2 that referenced this issue Oct 20, 2020
jywarren pushed a commit that referenced this issue Dec 1, 2020
…eir key:value pair (#8634)

* Fixes #6173. Powertag pages for activity () can use the ':value'

* Fix codeclimate issues

* Fix codeclimate issue

* Fix codeclimate issue: reduse amount of line by one, get rid from excessive variable
manchere pushed a commit to manchere/plots2 that referenced this issue Feb 13, 2021
…ue" of their key:value pair (publiclab#8634)

* Fixes publiclab#6173. Powertag pages for activity () can use the ':value'

* Fix codeclimate issues

* Fix codeclimate issue

* Fix codeclimate issue: reduse amount of line by one, get rid from excessive variable
lagunasmel pushed a commit to lagunasmel/plots2 that referenced this issue Mar 2, 2021
…ue" of their key:value pair (publiclab#8634)

* Fixes publiclab#6173. Powertag pages for activity () can use the ':value'

* Fix codeclimate issues

* Fix codeclimate issue

* Fix codeclimate issue: reduse amount of line by one, get rid from excessive variable
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this issue Oct 16, 2021
…ue" of their key:value pair (publiclab#8634)

* Fixes publiclab#6173. Powertag pages for activity () can use the ':value'

* Fix codeclimate issues

* Fix codeclimate issue

* Fix codeclimate issue: reduse amount of line by one, get rid from excessive variable
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this issue Dec 28, 2021
…ue" of their key:value pair (publiclab#8634)

* Fixes publiclab#6173. Powertag pages for activity () can use the ':value'

* Fix codeclimate issues

* Fix codeclimate issue

* Fix codeclimate issue: reduse amount of line by one, get rid from excessive variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature explains that the issue is to add a new feature fto-candidate issues which are meant to be solved by first timers but aren't well-formatted yet
Projects
None yet
5 participants