Skip to content

Commit

Permalink
Improve the tooltip text when the lock author is anonymous
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcornu committed May 3, 2019
1 parent 48b1c02 commit be75dbe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/helpers/shipit/stacks_helper.rb
Expand Up @@ -78,5 +78,13 @@ def pull_request_link(pull_request_or_commit)
def render_raw_commit_id_link(commit)
link_to(commit.short_sha, github_commit_url(commit), target: '_blank', class: 'number')
end

def unlock_commit_tooltip(commit)
if commit.lock_author.present?
t('commit.unlock_with_author', author: commit.lock_author.name)
else
t('commit.unlock')
end
end
end
end
2 changes: 1 addition & 1 deletion app/views/shipit/commits/_commit.html.erb
Expand Up @@ -27,7 +27,7 @@
<%= link_to stack_commit_path(commit.stack, commit), class: 'action-lock-commit', data: {tooltip: t('commit.lock')} do %>
<i class="icon icon--lock"></i>
<% end %>
<%= link_to stack_commit_path(commit.stack, commit), class: 'action-unlock-commit', data: {tooltip: t('commit.unlock', author: commit.lock_author.name), confirm: t('commit.confirm_unlock')} do %>
<%= link_to stack_commit_path(commit.stack, commit), class: 'action-unlock-commit', data: {tooltip: unlock_commit_tooltip(commit), confirm: t('commit.confirm_unlock')} do %>
<i class="icon icon--lock"></i>
<% end %>
</div>
Expand Down
3 changes: 2 additions & 1 deletion config/locales/en.yml
Expand Up @@ -22,7 +22,8 @@
en:
commit:
lock: This commit is safe to deploy. Click to mark it as unsafe.
unlock: "%{author} marked this commit as unsafe to deploy. Click to mark it as safe."
unlock: This commit was marked as unsafe to deploy. Click to mark it as safe.
unlock_with_author: "%{author} marked this commit as unsafe to deploy. Click to mark it as safe."
confirm_unlock: Mark this commit as safe to deploy?
release:
validate: Mark the release as healthy
Expand Down

0 comments on commit be75dbe

Please sign in to comment.