Commit 1ddfc574 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Add chat_name partial

parent 9b86a5e1
class Profiles::ChatNamesController < Profiles::ApplicationController class Profiles::ChatNamesController < Profiles::ApplicationController
before_action :chat_names, only: [:index]
before_action :chat_name_token, only: [:new] before_action :chat_name_token, only: [:new]
before_action :chat_name_params, only: [:new, :create, :deny] before_action :chat_name_params, only: [:new, :create, :deny]
def index def index
@chat_names = current_user.chat_names
end end
def new def new
......
- service = chat_name.service
- project = service.project
%tr
%td
%strong
- if can?(current_user, :read_project, project)
= link_to project.name_with_namespace, project_path(project)
- else
.light N/A
%td
%strong
- if can?(current_user, :admin_project, project)
= link_to service.title, edit_namespace_project_service_path(project.namespace, project, service)
- else
= service.title
%td
= chat_name.team_domain
%td
= chat_name.chat_name
%td
- if chat_name.last_used_at
time_ago_with_tooltip(chat_name.last_used_at)
- else
Never
%td
= link_to 'Remove', profile_chat_name_path(chat_name), method: :delete, class: 'btn btn-danger pull-right', data: { confirm: 'Are you sure you want to revoke this nickname?' }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
You can see your Chat accounts. You can see your Chat accounts.
.col-lg-9 .col-lg-9
%h5 Active chat names (#{@chat_names.length}) %h5 Active chat names (#{@chat_names.size})
- if @chat_names.present? - if @chat_names.present?
.table-responsive .table-responsive
...@@ -23,34 +23,7 @@ ...@@ -23,34 +23,7 @@
%th Last used %th Last used
%th %th
%tbody %tbody
- @chat_names.each do |chat_name| = render @chat_names
- service = chat_name.service
- project = service.project
%tr
%td
%strong
- if can?(current_user, :read_project, project)
= link_to project.name_with_namespace, project_path(project)
- else
.light N/A
%td
%strong
- if can?(current_user, :admin_project, project)
= link_to service.title, edit_namespace_project_service_path(project.namespace, project, service)
- else
= service.title
%td
= chat_name.team_domain
%td
= chat_name.chat_name
%td
- if chat_name.last_used_at
time_ago_with_tooltip(chat_name.last_used_at)
- else
Never
%td
= link_to 'Remove', profile_chat_name_path(chat_name), method: :delete, class: 'btn btn-danger pull-right', data: { confirm: 'Are you sure you want to revoke this nickname?' }
- else - else
.settings-message.text-center .settings-message.text-center
......
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