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
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Prevent "No rows found" message from displaying in tables when data is loading (#7790)
- Prevent ZIP files from being previewed in the assignment file viewer (#7802)
- Display descriptive error message when scanned exam template name exceeds the 20-character limit (#7796)
- Made repository URL not a link for student assignment view when version control is enabled (#7807)
Comment thread
Karl-Michaud marked this conversation as resolved.

### 🔧 Internal changes
- Updated autotest seed files to ensure settings follow tester JSON schema (#7775)
Expand Down
7 changes: 7 additions & 0 deletions app/assets/stylesheets/common/_markus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,13 @@ kbd {
li {
margin-bottom: 0.5em;
}

.copy-url-button {
margin-left: 0.5em;
margin-bottom: 0.3em;
min-width: auto;
padding: 0.2em 0.1em 0.2em 0.4em;
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/common/fontawesome_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
faClose,
faComments,
faCompress,
faCopy,
faDice,
faDownload,
faEnvelopeCircleCheck,
Expand Down Expand Up @@ -77,6 +78,7 @@ library.add(
faClose,
faComments,
faCompress,
faCopy,
faDice,
faDownload,
faEnvelopeCircleCheck,
Expand Down
25 changes: 23 additions & 2 deletions app/views/assignments/_read.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,16 @@
<% if allowed_to?(:access_repo?, @grouping) %>
<h3><%= t('groups.student_interface.url_repository') %></h3>
<div class='sub_block'>
HTTPS: <a href='#'><%= @grouping.group.repository_external_access_url %></a>
HTTPS: <code><%= @grouping.group.repository_external_access_url %></code>
<button class="copy-url-button" data-clipboard-text="<%= @grouping.group.repository_external_access_url %>">
<i class="fa-solid fa-copy"></i>
</button>
<% if allowed_to?(:view?, with: KeyPairPolicy) %>
<br>
SSH: <a href='#'><%= @grouping.group.repository_ssh_access_url %></a>
SSH: <code><%= @grouping.group.repository_ssh_access_url %></code>
<button class="copy-url-button" data-clipboard-text="<%= @grouping.group.repository_ssh_access_url %>">
<i class="fa-solid fa-copy"></i>
</button>
<% end %>
</div>
<% end %>
Expand Down Expand Up @@ -201,3 +207,18 @@
<% end %>
<% end %>
</div>

<%= javascript_tag nonce: true do %>
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll('.copy-url-button').forEach(button => {
button.addEventListener('click', () => {
navigator.clipboard.writeText(button.dataset.clipboardText).then(() => {
var flashDiv = document.getElementsByClassName("success")[0];
var contents = flashDiv.getElementsByClassName("flash-content")[0] || flashDiv;
contents.innerHTML = "<p><%= t('groups.student_interface.copied_to_clipboard') %></p>";
flashDiv.style.display = "block";
});
});
});
});
<% end %>
1 change: 1 addition & 0 deletions config/locales/views/groups/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ en:
student_interface:
confirm_create_group: This action will decline your pending invitations. Are you sure?
confirm_delete_group: 'WARNING: You will lose access to your submitted files after deleting your group. Make sure you have a local copy of your files before clicking OK.'
copied_to_clipboard: Successfully copied to clipboard.
form_group: Create a group
group_information: Group information
group_options: Group options
Expand Down