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

SAK-51080 Duplicate Site: New parameter for title #13377

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -1151,20 +1151,29 @@ public void doSaveas(RunData data, Context context)

// read the form
String id = data.getParameters().getString("id");
String title = data.getParameters().getString("title");

// get the site to copy from
Site site = (Site) state.getAttribute("site");

try
{
// make a new site with this id and as a structural copy of site
siteService.addSite(id, site);
Site savedSite = siteService.addSite(id, site);
savedSite.setTitle(title);

siteService.save(savedSite);
}
catch (IdUsedException e)
{
addAlert(state, rb.getFormattedMessage("sitact.thesitid", new Object[]{id}));
return;
}
catch (IdUnusedException e)
{
addAlert(state, rb.getFormattedMessage("sitact.notfound", new Object[]{id}));
return;
}
catch (IdInvalidException e)
{
addAlert(state, rb.getFormattedMessage("sitact.thesitid2", new Object[]{id}));
Expand Down
9 changes: 8 additions & 1 deletion admin-tools/src/webapp/vm/sites/chef_sites_saveas.vm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
$tlang.getString("sitsav.sitid")
</label>
<input type="text" name="id" id="id" />
</p>
</p>
<p class="shorttext required">
<span class="reqStar">*</span>
<label for="title">
$tlang.getString("sittoo.tit")
</label>
<input type="text" name="title" id="title" />
Copy link

Choose a reason for hiding this comment

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

Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that accesslint mentions it, you can also add the same for the id field, thanks!

</p>
<div class="act">
<input type="submit" class="active" name="eventSubmit_doSaveas" value="$tlang.getString("sitsav.sav")" accesskey="s" />
<input type="submit" name="eventSubmit_doCancel_saveas" value="$tlang.getString("sitsav.can")" accesskey="x" />
Expand Down
Loading