Skip to content

Commit

Permalink
Merge pull request #1767 from bgeuken/fix_add_dod_link
Browse files Browse the repository at this point in the history
[webui] Fix add DoD link
  • Loading branch information
adrianschroeter committed May 2, 2016
2 parents ca55bf7 + 739da1d commit 88d0993
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
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

0 comments on commit 88d0993

Please sign in to comment.