scinote-web/app/views/repositories/_repository.html.erb
2017-06-21 17:39:20 +02:00

139 lines
6 KiB
Text

<%= render partial: "repositories/delete_record_modal.html.erb" %>
<%= render partial: "repositories/delete_column_modal.html.erb" %>
<%= render partial: 'repositories/export_repository_modal.html.erb',
locals: { repository: repository } %>
<div id="alert-container"></div>
<div id="repository-toolbar">
<% if can_create_repository_records(repository) %>
<button type="button" class="btn btn-default editAdd" id="addRepositoryRecord" onclick="onClickAddRecord()">
<span class="glyphicon glyphicon-plus"></span>
<span class="hidden-xs"><%= t("repositories.add_new_record") %></span>
</button>
<% end %>
<% if can_import_repository_records(repository) %>
<button type="button" class="btn btn-default" id="importRecordsButton">
<span class="glyphicon glyphicon-cloud-upload"></span>
<span class="hidden-xs"><%= t('repositories.import_records.import') %></span>
</button>
<% end %>
<% if can_view_repository(repository) %>
<a href="#" class="btn btn-default" id="exportRepositoriesButton">
<span class="glyphicon glyphicon-cloud-download"></span>
<span class="hidden-xs"><%= t("my_modules.repository.export") %></span>
</a>
<% end %>
<div class="repository-cog">
<div class="dropdown">
<div class="btn btn-default"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="true"
<%= "disabled='disabled'" if !can_edit_and_destroy_repository repository and !can_copy_repository repository %>>
<span class="glyphicon glyphicon-cog"></span>
<span class="caret"></span>
</div>
<% if can_edit_and_destroy_repository repository or can_copy_repository repository %>
<ul class="dropdown-menu pull-right">
<li class="dropdown-header">
<%= t("repositories.index.options_dropdown.header") %>
</li>
<% if can_edit_and_destroy_repository repository %>
<li>
<%= link_to t('repositories.index.options_dropdown.rename'),
team_repository_rename_modal_path(repository_id: repository),
class: "rename-repo-option",
remote: true %>
</li>
<% end %>
<% if can_copy_repository(repository) %>
<li>
<%= link_to t('repositories.index.options_dropdown.copy'),
team_repository_copy_modal_path(repository_id: repository),
class: "copy-repo-option",
remote: true %>
</li>
<% end %>
<% if can_edit_and_destroy_repository repository %>
<li role="separator" class="divider"></li>
<li>
<%= link_to t('repositories.index.modal_delete.delete'),
team_repository_destroy_modal_path(repository_id: repository),
class: "delete-repo-option",
remote: true %>
</li>
<% end %>
</ul>
<% end %>
</div>
</div>
<div id="datatables-buttons" style="display: inline;">
<div id="repository-columns-dropdown" class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
<%= t('repositories.columns') %>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right smart-dropdown" id="repository-columns-list">
<% if can_create_columns_in_repository(repository) %>
<li class="add-new-column-form">
<div id="new-column-form" class="form-group" data-action="<%= repository_repository_columns_path(repository) %>">
<div class="input-group">
<input class="form-control" id="new-column-name" placeholder="<%= t("repositories.column_new_text") %>">
<span class="input-group-btn">
<a id="add-new-column-button" class="btn btn-primary">
<%= t("repositories.column_create") %>
</a>
</span>
</div>
</div>
</li>
<% end %>
</ul>
</div>
</div>
</div>
<div class="btn-group inline" id="saveCancel" data-toggle="buttons" style="display:none">
<button type="button" class="btn btn-primary" id="saveRecord" onclick="onClickSave()">
<span class="glyphicon glyphicon-save"></span>
<%= t("repositories.save_record") %>
</button>
<button type="button" class="btn btn-default" id="cancelSave" onclick="onClickCancel()">
<span class="glyphicon glyphicon-remove visible-xs-inline"></span>
<span class="hidden-xs"><%= t("repositories.cancel_save") %></span>
</button>
</div>
<!-- These buttons are appended to table in javascript, after table initialization. -->
<div class="toolbarButtons" style="display:none">
<button type="button" class="btn btn-default editAdd" id="editRepositoryRecord" onclick="onClickEdit()" disabled>
<span class="glyphicon glyphicon-pencil"></span>
<span class="hidden-xs-custom"><%= t("repositories.edit_record") %></span>
</button>
<% if can_delete_repository_records(repository) %>
<button type="button" class="btn btn-default"
id="deleteRepositoryRecordsButton" data-target="#deleteRepositoryRecord" data-toggle="modal" disabled>
<span class="glyphicon glyphicon-trash"></span>
<span class="hidden-xs-custom"><%= t'repositories.delete_record' %></span>
<%= submit_tag I18n.t('repositories.delete_record'), :class => "hidden
delete_repository_records_submit" %>
</button>
<% end %>
</div>
<%= render partial: "repositories/repository_table.html.erb",
locals: {
repository: repository,
repository_index_link: repository_table_index_path(repository)
}
%>
<%= render partial: 'repositories/import_repository_records_modal.html.erb',
locals: { repository: repository } %>
<%= javascript_include_tag 'repositories/edit', 'data-turbolinks-track' => true %>