Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/templates/create_survey.templ
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ templ CreateSurvey(user *oauth.User, profile *oauth.Profile, posthogKey string,
</div>

<div style="margin: 1rem 0;">
<label style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
<label for="ai-consent" style="display: flex; align-items: center; gap: 0.5rem; cursor: pointer;">
<input type="checkbox" id="ai-consent" style="cursor: pointer;"/>
<span style="font-size: 0.9rem;">I consent to sending my description to OpenAI for processing</span>
</label>
Expand Down Expand Up @@ -136,7 +136,7 @@ templ CreateSurvey(user *oauth.User, profile *oauth.Profile, posthogKey string,

<!-- Example Selector -->
<div style="margin-bottom: 1.5rem; padding: 1rem; background: #f8f9fa; border-radius: 4px;">
<label style="display: block; font-weight: 600; margin-bottom: 0.5rem;">
<label for="example-select" style="display: block; font-weight: 600; margin-bottom: 0.5rem;">
Load an Example
</label>
<p style="color: #7f8c8d; font-size: 0.9rem; margin: 0 0 0.75rem 0;">
Expand Down
4 changes: 2 additions & 2 deletions internal/templates/my_data.templ
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ templ MyDataCollectionPage(user *oauth.User, profile *oauth.Profile, collection
<thead>
<tr style="border-bottom: 2px solid #ddd;">
<th style="padding: 0.5rem; text-align: left; width: 50px;">
<input type="checkbox" id="select-all-checkbox" onchange="selectAll()"/>
<input type="checkbox" id="select-all-checkbox" aria-label="Select all records" onchange="selectAll()"/>
</th>
<th style="padding: 0.5rem; text-align: left;">RKey</th>
<th style="padding: 0.5rem; text-align: left;">Record</th>
Expand All @@ -70,7 +70,7 @@ templ MyDataCollectionPage(user *oauth.User, profile *oauth.Profile, collection
for _, record := range records {
<tr style="border-bottom: 1px solid #eee;">
<td style="padding: 0.5rem;">
<input type="checkbox" name="rkeys" value={ record.RKey }/>
<input type="checkbox" name="rkeys" value={ record.RKey } aria-label={ fmt.Sprintf("Select record %s", record.RKey) }/>
</td>
<td style="padding: 0.5rem;">
<code>{ record.RKey }</code>
Expand Down
6 changes: 4 additions & 2 deletions internal/templates/share.templ
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ templ ShareLinks(survey *models.Survey) {

<!-- Short URL (always shown) -->
<div class="share-link-row" style="margin-bottom: 0.5rem;">
<label style="font-size: 0.85rem; color: #7f8c8d; display: block; margin-bottom: 0.25rem;">
<label for="share-url-short" style="font-size: 0.85rem; color: #7f8c8d; display: block; margin-bottom: 0.25rem;">
Link
</label>
<div style="display: flex; gap: 0.5rem; align-items: center;">
<input
type="text"
id="share-url-short"
readonly
class="share-url-input"
data-url-type="short"
Expand All @@ -41,13 +42,14 @@ templ ShareLinks(survey *models.Survey) {
<!-- AT URI (only shown for ATProto surveys) -->
if survey.URI != nil && *survey.URI != "" {
<div class="share-link-row" style="margin-top: 0.75rem;">
<label style="font-size: 0.85rem; color: #7f8c8d; display: block; margin-bottom: 0.25rem;">
<label for="share-url-aturi" style="font-size: 0.85rem; color: #7f8c8d; display: block; margin-bottom: 0.25rem;">
ATProto URI
<span style="font-size: 0.8rem; color: #95a5a6;">(for Bluesky apps)</span>
</label>
<div style="display: flex; gap: 0.5rem; align-items: center;">
<input
type="text"
id="share-url-aturi"
readonly
value={ *survey.URI }
class="share-url-input aturi-input"
Expand Down
28 changes: 20 additions & 8 deletions internal/templates/survey_form.templ
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,29 @@ templ SurveyForm(survey *models.Survey, user *oauth.User, profile *oauth.Profile
<form id="survey-form" hx-post={ "/surveys/" + survey.Slug + "/responses" } hx-swap="outerHTML" style="margin-top: 2rem;">
for i, question := range survey.Definition.Questions {
<div style="margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid #ecf0f1;">
<label style="display: block; font-weight: 600; margin-bottom: 1rem; font-size: 1.1rem;">
{ fmt.Sprintf("%d. %s", i+1, question.Text) }
if question.Required {
<span style="color: #e74c3c;">*</span>
}
</label>
if question.Type == models.QuestionTypeText {
<label for={ question.ID } style="display: block; font-weight: 600; margin-bottom: 1rem; font-size: 1.1rem;">
{ fmt.Sprintf("%d. %s", i+1, question.Text) }
if question.Required {
<span style="color: #e74c3c;">*</span>
}
</label>
} else {
<p style="display: block; font-weight: 600; margin-bottom: 1rem; font-size: 1.1rem;">
{ fmt.Sprintf("%d. %s", i+1, question.Text) }
if question.Required {
<span style="color: #e74c3c;">*</span>
}
</p>
}

if question.Type == models.QuestionTypeSingle {
for _, option := range question.Options {
<div style="margin-bottom: 0.75rem;">
<label style="display: flex; align-items: center; cursor: pointer; padding: 0.5rem; border-radius: 4px; transition: background 0.2s;">
<label for={ question.ID + "-" + option.ID } style="display: flex; align-items: center; cursor: pointer; padding: 0.5rem; border-radius: 4px; transition: background 0.2s;">
<input
type="radio"
id={ question.ID + "-" + option.ID }
name={ question.ID }
value={ option.ID }
required?={ question.Required }
Expand All @@ -63,9 +73,10 @@ templ SurveyForm(survey *models.Survey, user *oauth.User, profile *oauth.Profile
} else if question.Type == models.QuestionTypeMulti {
for _, option := range question.Options {
<div style="margin-bottom: 0.75rem;">
<label style="display: flex; align-items: center; cursor: pointer; padding: 0.5rem; border-radius: 4px; transition: background 0.2s;">
<label for={ question.ID + "-" + option.ID } style="display: flex; align-items: center; cursor: pointer; padding: 0.5rem; border-radius: 4px; transition: background 0.2s;">
<input
type="checkbox"
id={ question.ID + "-" + option.ID }
name={ question.ID }
value={ option.ID }
style="margin-right: 0.75rem;"
Expand All @@ -76,6 +87,7 @@ templ SurveyForm(survey *models.Survey, user *oauth.User, profile *oauth.Profile
}
} else if question.Type == models.QuestionTypeText {
<textarea
id={ question.ID }
name={ question.ID }
required?={ question.Required }
rows="4"
Expand Down