Skip to content

Create page link UI#23236

Open
NobodysNightmare wants to merge 4 commits into
devfrom
create-wiki-link-dialog
Open

Create page link UI#23236
NobodysNightmare wants to merge 4 commits into
devfrom
create-wiki-link-dialog

Conversation

@NobodysNightmare
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Caution

The provided work package version does not match the core version

Details:

Please make sure that:

  • The work package version OR your pull request target branch is correct

Comment thread modules/wikis/config/locales/en.yml Outdated
@NobodysNightmare NobodysNightmare force-pushed the create-wiki-link-dialog branch 4 times, most recently from d0d45f9 to 371cddd Compare May 21, 2026 14:59
@NobodysNightmare NobodysNightmare changed the base branch from dev to implementation/73354-add-deletion-action-to-wiki-page-link May 21, 2026 15:00
Base automatically changed from implementation/73354-add-deletion-action-to-wiki-page-link to dev May 21, 2026 15:27
@NobodysNightmare NobodysNightmare force-pushed the create-wiki-link-dialog branch 2 times, most recently from 6872f96 to f43e3e1 Compare May 22, 2026 08:02
@NobodysNightmare NobodysNightmare changed the title Draft: Create page link UI Create page link UI May 22, 2026
@NobodysNightmare NobodysNightmare force-pushed the create-wiki-link-dialog branch 2 times, most recently from 5182852 to e4caa52 Compare May 22, 2026 08:18
Comment thread modules/wikis/app/controllers/work_package_wikis_tab_controller.rb
@NobodysNightmare NobodysNightmare requested a review from a team May 22, 2026 08:30
@NobodysNightmare NobodysNightmare force-pushed the create-wiki-link-dialog branch 3 times, most recently from e4caa52 to 0b0622b Compare May 26, 2026 14:05
<% end %>
<% dialog.with_footer do %>
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": id })) { t("button_cancel") } %>
<%= render(Primer::Beta::Button.new(scheme: :primary, form: form_id, type: :submit)) { t("button_link") } %>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 I do not agree with the term Link for the submit action of this dialog. The figma uses Add and I find it a better alternative. Maybe even written out: Add wiki page link. In the end, this is a UX question, but the indicator, that you had to create a new locale key for it, is also there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy to use whatever someone else decides for me. However, this is frustrating.

I used 100% of the initial Figma, then showed stuff to @dominic-braeunlein and he pointed out that the action menu items should be called "Link ..." (see the very first comment on this PR). I also want to point out that Dominic changed the expected texts in the Figma in one place.

Then looking at the remaining Figma designs, I noticed that the text was not updated everywhere, but that the Dialog had the name of the action menu for a title, so I changed the dialog title to "Link ...".

Now finally I had a dialog titled "Link ..." but the primary action was "Add". This didn't make sense to me, so I changed the button as well.

tl; dr: We should consistently change the mockups to whatever and then do that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ololol... I see your frustration. :D wasn't aware, that dominic already overwrote figma.


++#%>

<%= render(Primer::Alpha::Dialog.new(id:, title: t(".title"), size: :large, **system_arguments)) do |dialog| %>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 I do not really know, why you people prefer the "every line a <%=" approach, over one big enclosing <%= ... =>.

I know, there are cases where it actually IS necessary, like in the usage of the primer stack with multiple renders at the same level. Or the dialog footer in this very file. But in all the other cases it adds way to much noise for my taste. WDYT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually go for one extreme or the other. Everything in a single <%= %> is fine. However, if that's not possible, I usually "give up" and separate all lines.

As you pointed out the footer requires this. I could've probably single-blockified the dialog.with_body. However, you put this comment onto the render for the entire dialog. I am not sure whether this is syntactically possible (since it would cover a block that spans over the footer, where we need multiple renders). Even if it was possible, I'd need to see the result to judge how I like it.

Feel free to transform this dialog into your preferred form and show it to me once there are no more syntax errors.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the two options are:

<%= render(Primer::Alpha::Dialog.new(id:, title: t(".title"), size: :large, **system_arguments)) do |dialog| %>
  <% dialog.with_body do %>
    <%= primer_form_with(**form_options) do |form| %>
      <%= render(Wikis::LinkExistingWikiPageForm.new(form)) %>
    <% end %>
  <% end %>
  <% dialog.with_footer do %>
    <%= render(Primer::Beta::Button.new(data: { "close-dialog-id": id })) { t("button_cancel") } %>
    <%= render(Primer::Beta::Button.new(scheme: :primary, form: form_id, type: :submit)) { t("button_link") } %>
  <% end %>
<% end %>

versus

<%=
  render(Primer::Alpha::Dialog.new(id:, title: t(".title"), size: :large, **system_arguments)) do |dialog|
    dialog.with_body do
      primer_form_with(**form_options) do |form|
        render(Wikis::LinkExistingWikiPageForm.new(form))
      end
    end
    dialog.with_footer do
      concat(render(Primer::Beta::Button.new(data: { "close-dialog-id": id })) { t("button_cancel") })
      concat(render(Primer::Beta::Button.new(scheme: :primary, form: form_id, type: :submit)) { t("button_link") })
    end
  end
%>

As you notice, you CAN make it work in the footer, too, but you need a helper method. Now, the rest is personal taste. ^^ And I won't force you to use any of those. I just stated, that at least for me, my eyes stumble over those dozens of <%= ... %>.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, fair. Though I always feel like concat is a hack, so I avoided using that too.

Your first version is the same as my current code, isn't it?

I mean, we could optimize that at least a bit, if we wanted to:

<%= render(Primer::Alpha::Dialog.new(id:, title: t(".title"), size: :large, **system_arguments)) do |dialog| %>
  <% dialog.with_body do
    primer_form_with(**form_options) do |form|
      render(Wikis::LinkExistingWikiPageForm.new(form))
    end
  end %>
  <% dialog.with_footer do %>
    <%= render(Primer::Beta::Button.new(data: { "close-dialog-id": id })) { t("button_cancel") } %>
    <%= render(Primer::Beta::Button.new(scheme: :primary, form: form_id, type: :submit)) { t("button_link") } %>
  <% end %>
<% end %>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, I wouldn't enforce a partial change, only if you want to.

IMHO concat is easier on the eyes, then the rest, but like said before, this is highly subjective. From the hack perspective: concat is essentially the same as an <%= => tag. It appends content to the output buffer. It is design to be used inside a non-output tag.


it "merges classes and data attributes" do
render_component(classes: "custom-class", data: { test_selector: "expandable-text" }) { "Long permission label" }
def id = "link_existing_wiki_page_dialog"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Ids directly inserted in the HTML usually have kebab-case in our application.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

remove: Remove page link
relation_page_links_component:
link_existing: Link existing wiki page
link_new: Link new wiki page
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 here is the same: the figma currently talks about "adding" wiki pages to the work package, and user facing I'd agree. tomorrow titan dev discussion?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figma agrees with this:

image

However, as I explained above, it only does so inconsistently (and after edits from Dominic). I'd say UX daily.

Copy link
Copy Markdown
Contributor Author

@NobodysNightmare NobodysNightmare May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New words:

  • "+ Wiki page:" -> aria label should be "Add wiki page"
  • Then "Existing wiki page" (aria label: "Add existing wiki page")
  • then "New wiki page" (aria label: "Add new wiki page")
  • dialog title: "Add (existing|new) wiki page"
  • dialog submit button: "Add"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bsatarnejad Can I quickly solicit your input on this? We agreed one something in a meeting earlier today for which I don't know if it's feasible and/or even supported in Primer.

Given the menu in the screenshot above, we want to set the aria-label for the button to "Add wiki page". This makes sense, because the icon would otherwise not be properly represented.

However, then we decided that the action menu should have a different aria-label than its normal label/text, mostly to re-assert the contextual "add", which is implicit to sighted users but may be less obvious to non-sighted users:

  1. Is this actually a best practice? (e.g. label "existing wiki page", but aria-label "add existing wiki page" in the action menu)
  2. Would it be the right course of action to add this to the menu item like this:
menu.with_item(
              label: "existing wiki page",
              aria: { label: "add existing wiki page" },
              ...
            )

@NobodysNightmare NobodysNightmare force-pushed the create-wiki-link-dialog branch from 0b0622b to add3f3f Compare May 26, 2026 15:15
Moving a few XWiki translations to the base class
translations and adding more attribute names.
The exception is already intended to nudge devs towards defining a permission.
However, first time developers might not realize in which way permissions are defined,
even though they can see the location where the exception was raised.

This comment is intended to help them find their way.
This allows to use more of the automagic pieces of our BaseServices::Create:

* recognition of the created class without passing it explicitly
* automatic recognition of the correct contract

Furthermore the contract has been adapted, so that it also properly works
when a new page link is created just through params this way. Notably:

* even if type is indicated in `changed`, it doesn't crash and burn
* linkable can be passed in as `linkable_id` + `linkable_type`, instead of
  only working if already passed in as a whole
@NobodysNightmare NobodysNightmare force-pushed the create-wiki-link-dialog branch from add3f3f to 125e0e0 Compare May 27, 2026 05:59
This change is mostly wiring up things, but leaves some things open:

* we still need to use a proper create service (to be built)
* the modal needs to use a treeview to select the identifier
  (requires fetching of a list of available wiki pages)
@NobodysNightmare NobodysNightmare force-pushed the create-wiki-link-dialog branch from 125e0e0 to 7d38ef8 Compare May 27, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants