mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 04:32:16 +08:00
Remove repository modal logic (WIP). [SCI-1269]
This commit is contained in:
parent
b92a760a5c
commit
791bb934ca
6 changed files with 67 additions and 6 deletions
|
@ -239,3 +239,15 @@ $.fn.checkboxTreeLogic = function(dependencies, checkAll) {
|
|||
});
|
||||
}).trigger('change');
|
||||
};
|
||||
|
||||
/*
|
||||
* Pass href attribute from clicked link to associated popup modal
|
||||
* @param {object} $modal Associated modal object
|
||||
* @param {object} fn Link object
|
||||
*/
|
||||
$.fn.passUrlToModal = function($modal) {
|
||||
$(this).click(function() {
|
||||
var url = $(this).data('href');
|
||||
$modal.attr('href', url);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -6,6 +6,15 @@ class RepositoriesController < ApplicationController
|
|||
render('repositories/index')
|
||||
end
|
||||
|
||||
def destroy
|
||||
@repo = Repository.find(params[:id])
|
||||
@repo.destroy if @repo
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render inline: 'location.reload();' }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_vars
|
||||
|
|
32
app/views/repositories/_delete_repository_modal.html.erb
Normal file
32
app/views/repositories/_delete_repository_modal.html.erb
Normal file
|
@ -0,0 +1,32 @@
|
|||
<div class="modal fade" id="deleteRepoModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><%= t("repositories.index.modal_delete.title_html", name: "ASD") %></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><%= t("repositories.index.modal_delete.message_html", name: "ASD") %></p>
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<span class="glyphicon glyphicon-exclamation-sign"></span>
|
||||
|
||||
<%= t("repositories.index.modal_delete.alert_heading") %>
|
||||
<ul>
|
||||
<li><%= t("repositories.index.modal_delete.alert_line_1") %></li>
|
||||
<li><%= t("repositories.index.modal_delete.alert_line_2") %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<%= link_to t('repositories.index.modal_delete.delete'),
|
||||
team_repository_path(id: -1),
|
||||
id: "confirm-repo-delete",
|
||||
method: :delete,
|
||||
remote: true,
|
||||
type: 'button',
|
||||
class: 'btn btn-primary' %>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t("general.cancel")%></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,6 +1,7 @@
|
|||
<% provide(:head_title, t("repositories.index.head_title")) %>
|
||||
|
||||
<% if current_team %>
|
||||
<%= render partial: "repositories/delete_repository_modal" %>
|
||||
<%= render partial: "repositories/breadcrumbs.html.erb", locals: { teams: @teams, current_team: current_team, type: @type } %>
|
||||
|
||||
<!-- Nav tabs -->
|
||||
|
@ -47,10 +48,8 @@
|
|||
</a>
|
||||
</li>
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class=>
|
||||
<a href="#">
|
||||
<%= t("repositories.index.options_dropdown.delete") %>
|
||||
</a>
|
||||
<li>
|
||||
<%= link_to t('repositories.index.options_dropdown.delete'), "#deleteRepoModal", class: "delete-repo-option", data: {toggle: "modal", href: team_repository_path(id: repo)} %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -70,3 +69,5 @@
|
|||
<p><%=t 'repositories.index.no_teams.text' %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= javascript_include_tag "repositories/index", "data-turbolinks-track" => true %>
|
||||
|
|
|
@ -161,6 +161,13 @@ en:
|
|||
rename: "Rename"
|
||||
copy: "Copy"
|
||||
delete: "Delete"
|
||||
modal_delete:
|
||||
title_html: "Delete repository <em>%{name}</em>"
|
||||
message_html: "Are you sure you want to delete repository <em>%{name}</em>? This action is irreversible."
|
||||
alert_heading: "Deleting repository has following consequences:"
|
||||
alert_line_1: "all data inside the repository will be lost;"
|
||||
alert_line_2: "all references to repository items will be rendered as invalid."
|
||||
delete: "Delete repository"
|
||||
nav:
|
||||
breadcrumbs:
|
||||
repositories: "Repositories"
|
||||
|
@ -900,7 +907,7 @@ en:
|
|||
modal_delete_custom_field:
|
||||
title: "Delete a column"
|
||||
message: "Are you sure you wish to permanently delete selected column %{cf}? This action is irreversible."
|
||||
alert_heading: "Deleting a column has following consequences:"
|
||||
alert_heading: "Deleting column has following consequences:"
|
||||
alert_line_1: "you will lose information in this column for %{nr} samples;"
|
||||
alert_line_2: "the column will be deleted for all team members."
|
||||
delete: "Delete column"
|
||||
|
|
|
@ -123,7 +123,7 @@ Rails.application.routes.draw do
|
|||
as: 'file_expired'
|
||||
|
||||
resources :teams do
|
||||
resources :repositories, only: [:index]
|
||||
resources :repositories, only: [:index, :edit, :destroy]
|
||||
resources :samples, only: [:new, :create]
|
||||
resources :sample_types, except: [:show, :new] do
|
||||
get 'sample_type_element', to: 'sample_types#sample_type_element'
|
||||
|
|
Loading…
Reference in a new issue