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 {
<template>
<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">
<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" />
<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>
<h1>{{ s__('SlackIntegration|GitLab for Slack') }}</h1>
<h2>{{ s__('SlackIntegration|GitLab for Slack') }}</h2>
<div class="gl-mt-6" data-testid="gitlab-slack-content">
<template v-if="isSignedIn">
......@@ -94,7 +98,6 @@ export default {
<gl-button
category="primary"
variant="confirm"
class="float-right"
:disabled="!selectedProject"
@click="addToSlack"
>
......@@ -102,9 +105,7 @@ export default {
</gl-button>
</div>
</template>
<template v-else>
<p>{{ __("You don't have any projects available.") }}</p>
</template>
<p v-else>{{ __("You don't have any projects available.") }}</p>
</template>
<template v-else>
......
......@@ -36,7 +36,7 @@ module EE
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'),
is_signed_in: current_user.present?.to_s,
slack_link_path: slack_link_profile_slack_path,
......@@ -62,16 +62,5 @@ module EE
super
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
......@@ -16190,6 +16190,9 @@ msgstr ""
msgid "GitLab is undergoing maintenance and is operating in read-only mode."
msgstr ""
msgid "GitLab logo"
msgstr ""
msgid "GitLab member or Email address"
msgstr ""
......@@ -33079,6 +33082,9 @@ msgstr ""
msgid "Slack integration allows you to interact with GitLab via slash commands in a chat window."
msgstr ""
msgid "Slack logo"
msgstr ""
msgid "SlackIntegration|GitLab for Slack"
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