Make share status icon dynamic (#2007)

This commit is contained in:
aignatov-bio 2019-08-21 15:32:57 +02:00 committed by GitHub
parent 5e3f1d59f5
commit d70b7e2272
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 5 deletions

View file

@ -145,6 +145,7 @@
if (data.warnings) {
alert(data.warnings);
}
$('.repository-share-status').toggleClass('hidden', !data.status);
$('.share-repo-modal').modal('hide');
},
error: function(data) {

View file

@ -111,6 +111,7 @@
#repo-tree {
.fas-custom {
float: right;
top: 2px;
}
.active {

View file

@ -22,6 +22,13 @@
}
}
.repository-share-status {
display: contents !important;
&.hidden {
display: none !important;
}
}
.repository-table {
margin-top: 20px;

View file

@ -43,7 +43,7 @@ class TeamRepositoriesController < ApplicationController
team_ids_for_update: teams_to_update,
**share_all_params)
if service_call.succeed?
render json: { warnings: service_call.warnings.join(', ') }, status: :ok
render json: { warnings: service_call.warnings.join(', '), status: @repository.i_shared?(current_team) }, status: :ok
else
render json: { errors: service_call.errors.map { |_, v| v }.join(', ') }, status: :unprocessable_entity
end

View file

@ -30,8 +30,10 @@
<% else %>
<%= draw_custom_icon('shared-read') %>
<% end %>
<% elsif repository.i_shared?(current_team) %>
<%= draw_custom_icon('i-shared') %>
<% else %>
<span class="repository-share-status <%= "hidden" unless @repository.i_shared?(current_team) %>" >
<%= draw_custom_icon('i-shared') %>
</span>
<% end %>
</span>
</li>

View file

@ -18,8 +18,10 @@
<% else %>
<%= draw_custom_icon('shared-read') %>
<% end %>
<% elsif @repository.i_shared?(current_team) %>
<%= draw_custom_icon('i-shared') %>
<% else %>
<span class="repository-share-status <%= "hidden" unless @repository.i_shared?(current_team) %>" >
<%= draw_custom_icon('i-shared') %>
</span>
<% end %>
</span>
<div class="repository-title">