Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webui] Fix add DoD link #1767

Merged
merged 1 commit into from
May 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ $(document).on(

$(document).on(
'click',
'a#add-dod-repository-link',
'a[data-dod-repository-add]',
function(e) {
e.preventDefault();
$(this).
parent('.add-dod-repository-link-container').
hide().
next('.add-dod-repository-form').
show();
}
);

$(document).on(
'click',
'#add-dod-repository-link',
function(e) {
e.preventDefault();
$(this).hide();
Expand Down
13 changes: 3 additions & 10 deletions src/api/app/views/webui/download_on_demand/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@
<b>Download on demand sources</b>
<% if User.current.is_admin? %>
&nbsp;
<span id="<%= "add_dod_repository_link_container_#{repository_id}" %>">
<span class="add-dod-repository-link-container">
<%= sprite_tag('drive_add') %>
<%= link_to('Add', '#', id: "add_dod_repository_link_#{repository_id}") %>
<%= link_to('Add', '#', data: { "dod-repository-add": true }) %>
</span>
<div class="hidden" id="<%= "add_dod_repository_form_#{repository_id}" %>">
<div class="hidden add-dod-repository-form">
<%= render partial: 'webui/download_on_demand/add', locals: { project: project, repository: repository, download_on_demand: DownloadRepository.new(repository_id: repository.id) } %>
</div>
<% content_for :ready_function do %>
$("#<%= "add_dod_repository_link_#{repository_id}" %>").click(function(e) {
e.preventDefault();
$("#<%= "add_dod_repository_form_#{repository_id}" %>").show();
$("#<%= "add_dod_repository_link_container_#{repository_id}" %>").hide();
});
<% end -%>
<% end -%>
<ul style="list-style-type: none;">
<% repository.download_repositories.each do |dod_element| %>
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/features/webui/projects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
expect(page).to have_text("My DoD repository")
expect(page).to have_link("Delete repository")
expect(page).to have_text("Download on demand sources")
expect(page).to have_css("#add_dod_repository_link_container_My_DoD_repository", text: "Add")
expect(page).to have_link("Add")
expect(page).to have_link("Edit")
expect(page).to have_link("Delete")
expect(page).to have_link("http://somerandomurl.es")
Expand Down Expand Up @@ -187,7 +187,7 @@
expect(page).to have_link("standard")
expect(page).to have_link("Delete repository")
expect(page).to have_text("Download on demand sources")
expect(page).to have_css("#add_dod_repository_link_container_standard", text: "Add")
expect(page).to have_link("Add")
expect(page).to have_link("Edit")
expect(page).to have_link("Delete")
expect(page).to have_link("http://mola.org2")
Expand Down