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

[feature] Poll web view #2377

Merged
merged 6 commits into from
Nov 22, 2023
Merged

[feature] Poll web view #2377

merged 6 commits into from
Nov 22, 2023

Conversation

tsmethurst
Copy link
Contributor

Description

If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements.

If this is a documentation change, please briefly describe what you've changed and why.

This pull request adds a template + web view for rendering status polls in the frontend.

Produced HTML for a poll looks like this:

<figure class="poll">
	<figcaption class="poll-info">
		<span class="poll-expiry">Poll closed&nbsp;Aug 28, 2021, 10:40</span>
		<span class="total-votes">Total votes: 2</span>
	</figcaption>
	<ul class="poll-options">
		<li class="poll-option">
			<label aria-hidden="true" for="option-1" lang="en">50:50</label>
			<meter aria-hidden="true" id="option-1" min="0" max="100" value="0">0&#37;</meter>
			<div class="sr-only">Option 1:&nbsp;<span lang="en">50:50</span></div>
			<div class="poll-vote-summary">
				<span class="poll-vote-share">0&#37;</span>
				<span class="poll-vote-count">0 votes</span>
			</div>
		</li>
		<li class="poll-option">
			<label aria-hidden="true" for="option-2" lang="en">phone a friend</label>
			<meter aria-hidden="true" id="option-2" min="0" max="100" value="50">50&#37;</meter>
			<div class="sr-only">Option 2:&nbsp;<span lang="en">phone a friend</span></div>
			<div class="poll-vote-summary">
				<span class="poll-vote-share">50&#37;</span>
				<span class="poll-vote-count">1 vote</span>
			</div>
		</li>
		<li class="poll-option">
			<label aria-hidden="true" for="option-3" lang="en">ask the audience</label>
			<meter aria-hidden="true" id="option-3" min="0" max="100" value="50">50&#37;</meter>
			<div class="sr-only">Option 3:&nbsp;<span lang="en">ask the audience</span></div>
			<div class="poll-vote-summary">
				<span class="poll-vote-share">50&#37;</span>
				<span class="poll-vote-count">1 vote</span>
			</div>
		</li>
	</ul>
</figure>

And it's styled in the frontend like this:

image

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@NyaaaWhatsUpDoc
Copy link
Member

looks good to me! squerge away!!

@tsmethurst tsmethurst merged commit 8c2d94c into main Nov 22, 2023
3 checks passed
@tsmethurst tsmethurst deleted the poll_web_view branch November 22, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants