Commit 088d5822 authored by Justin Ho's avatar Justin Ho

Refactor existing code and minor cleanups

- Add alt to images for better a11y.
- Remove unused classes.
- Update helper to use `avatar_url` and refactor
to use the simpler `to_json` helper instead of a
private method to serialize the project.
parent 001e7ca1
...@@ -70,12 +70,16 @@ export default { ...@@ -70,12 +70,16 @@ export default {
<template> <template>
<div class="gitlab-slack-body gl-mx-auto gl-mt-11 gl-text-center"> <div class="gitlab-slack-body gl-mx-auto gl-mt-11 gl-text-center">
<div v-once class="gl-my-5 gl-display-flex gl-justify-content-center gl-align-items-center"> <div v-once class="gl-my-5 gl-display-flex gl-justify-content-center gl-align-items-center">
<img :src="gitlabLogoPath" class="gl-h-11 gl-w-11" /> <img :src="gitlabLogoPath" :alt="__('GitLab logo')" class="gl-h-11 gl-w-11" />
<gl-icon name="arrow-right" :size="32" class="gl-mx-5 gl-text-gray-200" /> <gl-icon name="arrow-right" :size="32" class="gl-mx-5 gl-text-gray-200" />
<img :src="slackLogoPath" class="gitlab-slack-slack-logo gl-h-11 gl-w-11" /> <img
:src="slackLogoPath"
:alt="__('Slack logo')"
class="gitlab-slack-slack-logo gl-h-11 gl-w-11"
/>
</div> </div>
<h1>{{ s__('SlackIntegration|GitLab for Slack') }}</h1> <h2>{{ s__('SlackIntegration|GitLab for Slack') }}</h2>
<div class="gl-mt-6" data-testid="gitlab-slack-content"> <div class="gl-mt-6" data-testid="gitlab-slack-content">
<template v-if="isSignedIn"> <template v-if="isSignedIn">
...@@ -94,7 +98,6 @@ export default { ...@@ -94,7 +98,6 @@ export default {
<gl-button <gl-button
category="primary" category="primary"
variant="confirm" variant="confirm"
class="float-right"
:disabled="!selectedProject" :disabled="!selectedProject"
@click="addToSlack" @click="addToSlack"
> >
...@@ -102,9 +105,7 @@ export default { ...@@ -102,9 +105,7 @@ export default {
</gl-button> </gl-button>
</div> </div>
</template> </template>
<template v-else> <p v-else>{{ __("You don't have any projects available.") }}</p>
<p>{{ __("You don't have any projects available.") }}</p>
</template>
</template> </template>
<template v-else> <template v-else>
......
...@@ -36,7 +36,7 @@ module EE ...@@ -36,7 +36,7 @@ module EE
def gitlab_slack_application_data(projects) def gitlab_slack_application_data(projects)
{ {
projects: (projects || []).map { |p| serialize_project(p) }.to_json, projects: (projects || []).to_json(only: [:id, :name], methods: [:avatar_url, :name_with_namespace]),
sign_in_path: new_session_path(:user, redirect_to_referer: 'yes'), sign_in_path: new_session_path(:user, redirect_to_referer: 'yes'),
is_signed_in: current_user.present?.to_s, is_signed_in: current_user.present?.to_s,
slack_link_path: slack_link_profile_slack_path, slack_link_path: slack_link_profile_slack_path,
...@@ -62,16 +62,5 @@ module EE ...@@ -62,16 +62,5 @@ module EE
super super
end end
private
def serialize_project(project)
{
id: project.id,
name: project.name,
avatar_url: project.avatar.url,
name_with_namespace: project.name_with_namespace
}
end
end end
end end
...@@ -16190,6 +16190,9 @@ msgstr "" ...@@ -16190,6 +16190,9 @@ msgstr ""
msgid "GitLab is undergoing maintenance and is operating in read-only mode." msgid "GitLab is undergoing maintenance and is operating in read-only mode."
msgstr "" msgstr ""
msgid "GitLab logo"
msgstr ""
msgid "GitLab member or Email address" msgid "GitLab member or Email address"
msgstr "" msgstr ""
...@@ -33079,6 +33082,9 @@ msgstr "" ...@@ -33079,6 +33082,9 @@ msgstr ""
msgid "Slack integration allows you to interact with GitLab via slash commands in a chat window." msgid "Slack integration allows you to interact with GitLab via slash commands in a chat window."
msgstr "" msgstr ""
msgid "Slack logo"
msgstr ""
msgid "SlackIntegration|GitLab for Slack" msgid "SlackIntegration|GitLab for Slack"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment