12479: Old tag editor files removal. Tests commented out.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 2 Jan 2018 16:19:07 +0000 (13:19 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Tue, 2 Jan 2018 16:19:07 +0000 (13:19 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

apps/workbench/app/assets/javascripts/edit_collection_tags.js [deleted file]
apps/workbench/app/views/collections/_show_tag_rows.html.erb [deleted file]
apps/workbench/app/views/collections/save_tags.js.erb [deleted file]
apps/workbench/app/views/collections/tags.js.erb [deleted file]
apps/workbench/test/integration/collections_test.rb

diff --git a/apps/workbench/app/assets/javascripts/edit_collection_tags.js b/apps/workbench/app/assets/javascripts/edit_collection_tags.js
deleted file mode 100644 (file)
index e1c1515..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-jQuery(function($){
-  $(document).
-    on('click', '.collection-tag-save, .collection-tag-cancel', function(event) {
-        $('.edit-collection-tags').removeClass('disabled');
-        $('#edit-collection-tags').attr("title", "Edit tags");
-        $('.collection-tag-add').addClass('hide');
-        $('.collection-tag-remove').addClass('hide');
-        $('.collection-tag-save').addClass('hide');
-        $('.collection-tag-cancel').addClass('hide');
-        $('.collection-tag-field').prop("contenteditable", false);
-    }).
-    on('click', '.edit-collection-tags', function(event) {
-        $('.edit-collection-tags').addClass('disabled');
-        $('#edit-collection-tags').attr("title", "");
-        $('.collection-tag-add').removeClass('hide');
-        $('.collection-tag-remove').removeClass('hide');
-        $('.collection-tag-save').removeClass('hide');
-        $('.collection-tag-cancel').removeClass('hide');
-        $('.collection-tag-field').prop("contenteditable", true);
-        $('div').remove('.collection-tags-status-label');
-    }).
-    on('click', '.collection-tag-save', function(event) {
-      var tag_data = {};
-      var has_tags = false;
-
-      var $tags = $(".collection-tags-table");
-      $tags.find('tr').each(function (i, el) {
-        var $tds = $(this).find('td');
-        var $key = $tds.eq(1).text();
-        if ($key && $key.trim().length > 0) {
-          has_tags = true;
-          tag_data[$key.trim()] = $tds.eq(2).text().trim();
-        }
-      });
-
-      var to_send;
-      if (has_tags == false) {
-        to_send = {tag_data: "empty"}
-      } else {
-        to_send = {tag_data: tag_data}
-      }
-
-      $.ajax($(location).attr('pathname')+'/save_tags', {
-          type: 'POST',
-          data: to_send
-      }).success(function(data, status, jqxhr) {
-        $('.collection-tags-status').append('<div class="collection-tags-status-label alert alert-success"><p class="contain-align-left">Saved successfully.</p></div>');
-      }).fail(function(jqxhr, status, error) {
-        $('.collection-tags-status').append('<div class="collection-tags-status-label alert alert-danger"><p class="contain-align-left">We are sorry. There was an error saving tags. Please try again.</p></div>');
-      });
-    }).
-    on('click', '.collection-tag-cancel', function(event) {
-      $.ajax($(location).attr('pathname')+'/tags', {
-          type: 'GET'
-      });
-    }).
-    on('click', '.collection-tag-remove', function(event) {
-      $(this).parents('tr').detach();
-    }).
-    on('click', '.collection-tag-add', function(event) {
-      var $collection_tags = $(this).closest('.collection-tags-container');
-      var $clone = $collection_tags.find('tr.hide').clone(true).removeClass('hide');
-      $collection_tags.find('table').append($clone);
-    }).
-    on('keypress', '.collection-tag-field', function(event){
-      return event.which != 13;
-    });
-});
diff --git a/apps/workbench/app/views/collections/_show_tag_rows.html.erb b/apps/workbench/app/views/collections/_show_tag_rows.html.erb
deleted file mode 100644 (file)
index eb57913..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<%# Copyright (C) The Arvados Authors. All rights reserved.
-
-SPDX-License-Identifier: AGPL-3.0 %>
-
-<%
-  tags = object.properties
-%>
-      <% if tags.andand.is_a?(Hash) %>
-        <% tags.each do |k, v| %>
-          <tr class="collection-tag-<%=k%>">
-            <td>
-              <% if object.editable? %>
-                <i class="glyphicon glyphicon-remove collection-tag-remove hide" style="cursor: pointer;"></i>
-              <% end %>
-            </td>
-            <td class="collection-tag-field collection-tag-field-key">
-              <%= k %>
-            </td>
-            <td class="collection-tag-field collection-tag-field-value">
-              <%= v %>
-            </td>
-          </tr>
-        <% end %>
-      <% end %>
-
-      <% if @object.editable? %>
-        <!-- A hidden row to add new tag -->
-        <tr class="collection-tag-hidden hide">
-          <td>
-            <i class="glyphicon glyphicon-remove collection-tag-remove hide" style="cursor: pointer"></i>
-          </td>
-          <td class="collection-tag-field collection-tag-field-key"></td>
-          <td class="collection-tag-field collection-tag-field-value"></td>
-        </tr>
-      <% end %>
diff --git a/apps/workbench/app/views/collections/save_tags.js.erb b/apps/workbench/app/views/collections/save_tags.js.erb
deleted file mode 100644 (file)
index 073db7d..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<%# Copyright (C) The Arvados Authors. All rights reserved.
-
-SPDX-License-Identifier: AGPL-3.0 %>
-
-<% if @saved_tags %>
-$(".collection-tag-rows").html("<%= escape_javascript(render partial: 'show_tag_rows', locals: {object: @object}) %>");
-<% end %>
diff --git a/apps/workbench/app/views/collections/tags.js.erb b/apps/workbench/app/views/collections/tags.js.erb
deleted file mode 100644 (file)
index e2154d6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<%# Copyright (C) The Arvados Authors. All rights reserved.
-
-SPDX-License-Identifier: AGPL-3.0 %>
-
-$(".collection-tag-rows").html("<%= escape_javascript(render partial: 'show_tag_rows', locals: {object: @object}) %>");
index 71cfe38abfda32b2d5b5ce943ecdbf26f46ff52b..88aa7dbdae104e52ede4ca22ca91c4847b701d0a 100644 (file)
@@ -435,87 +435,86 @@ class CollectionsTest < ActionDispatch::IntegrationTest
     accept_alert
   end
 
-  test "collection tags tab" do
-    visit page_with_token('active', '/collections/zzzzz-4zz18-bv31uwvy3neko21')
-
-    click_link 'Tags'
-    wait_for_ajax
-
-    # verify initial state
-    assert_selector 'a', text: 'Edit'
-    assert_no_selector 'a', text: 'Add new tag'
-    assert_no_selector 'a', text: 'Save'
-    assert_no_selector 'a', text: 'Cancel'
-
-    # Verify controls in edit mode
-    first('.edit-collection-tags').click
-    assert_selector 'a.disabled', text: 'Edit'
-    assert_selector 'a', text: 'Add new tag'
-    assert_selector 'a', text: 'Save'
-    assert_selector 'a', text: 'Cancel'
-
-    # add two tags
-    first('.glyphicon-plus').click
-    first('.collection-tag-field-key').click
-    first('.collection-tag-field-key').set('key 1')
-    first('.collection-tag-field-value').click
-    first('.collection-tag-field-value').set('value 1')
-
-    first('.glyphicon-plus').click
-    editable_key_fields = page.all('.collection-tag-field-key')
-    editable_key_fields[1].click
-    editable_key_fields[1].set('key 2')
-    editable_val_fields = page.all('.collection-tag-field-value')
-    editable_val_fields[1].click
-    editable_val_fields[1].set('value 2')
-
-    click_on 'Save'
-    wait_for_ajax
-
-    # added tags; verify
-    assert_text 'key 1'
-    assert_text 'value 1'
-    assert_text 'key 2'
-    assert_text 'value 2'
-    assert_selector 'a', text: 'Edit'
-    assert_no_selector 'a', text: 'Save'
-
-    # remove first tag
-    first('.edit-collection-tags').click
-    assert_not_nil first('.glyphicon-remove')
-    first('.glyphicon-remove').click
-    click_on 'Save'
-    wait_for_ajax
-
-    assert_text 'key 2'
-    assert_text 'value 2'
-    assert_no_text 'key 1'
-    assert_no_text 'value 1'
-    assert_selector 'a', text: 'Edit'
-
-    # Click on cancel and verify
-    first('.edit-collection-tags').click
-    first('.collection-tag-field-key').click
-    first('.collection-tag-field-key').set('this key wont stick')
-    first('.collection-tag-field-value').click
-    first('.collection-tag-field-value').set('this value wont stick')
-
-    click_on 'Cancel'
-    wait_for_ajax
-
-    assert_text 'key 2'
-    assert_text 'value 2'
-    assert_no_text 'this key wont stick'
-    assert_no_text 'this value wont stick'
-
-    # remove all tags
-    first('.edit-collection-tags').click
-    first('.glyphicon-remove').click
-    click_on 'Save'
-    wait_for_ajax
-
-    assert_selector 'a', text: 'Edit'
-    assert_no_text 'key 2'
-    assert_no_text 'value 2'
-  end
+  # test "collection tags tab" do
+  #   visit page_with_token('active', '/collections/zzzzz-4zz18-bv31uwvy3neko21')
+
+  #   click_link 'Tags'
+  #   wait_for_ajax
+
+  #   # verify initial state
+  #   assert_selector 'a.disabled', text: ' Saved '
+  #   assert_selector 'a', text: 'Add new tag'
+
+  #   # Verify controls in edit mode
+  #   # first('.edit-collection-tags').click
+  #   # assert_selector 'a.disabled', text: 'Edit'
+  #   # assert_selector 'a', text: 'Add new tag'
+  #   # assert_selector 'a', text: 'Save'
+  #   # assert_selector 'a', text: 'Cancel'
+
+  #   # add two tags
+  #   first('.glyphicon-plus').click
+  #   assert_selector 'a', text: 'Save changes'
+  #   first('.collection-tag-field-key').click
+  #   first('.collection-tag-field-key').set('key 1')
+  #   first('.collection-tag-field-value').click
+  #   first('.collection-tag-field-value').set('value 1')
+
+  #   first('.glyphicon-plus').click
+  #   editable_key_fields = page.all('.collection-tag-field-key')
+  #   editable_key_fields[1].click
+  #   editable_key_fields[1].set('key 2')
+  #   editable_val_fields = page.all('.collection-tag-field-value')
+  #   editable_val_fields[1].click
+  #   editable_val_fields[1].set('value 2')
+
+  #   click_on 'Save'
+  #   wait_for_ajax
+
+  #   # added tags; verify
+  #   assert_text 'key 1'
+  #   assert_text 'value 1'
+  #   assert_text 'key 2'
+  #   assert_text 'value 2'
+  #   assert_selector 'a', text: 'Edit'
+  #   assert_no_selector 'a', text: 'Save'
+
+  #   # remove first tag
+  #   first('.edit-collection-tags').click
+  #   assert_not_nil first('.glyphicon-remove')
+  #   first('.glyphicon-remove').click
+  #   click_on 'Save'
+  #   wait_for_ajax
+
+  #   assert_text 'key 2'
+  #   assert_text 'value 2'
+  #   assert_no_text 'key 1'
+  #   assert_no_text 'value 1'
+  #   assert_selector 'a', text: 'Edit'
+
+  #   # Click on cancel and verify
+  #   first('.edit-collection-tags').click
+  #   first('.collection-tag-field-key').click
+  #   first('.collection-tag-field-key').set('this key wont stick')
+  #   first('.collection-tag-field-value').click
+  #   first('.collection-tag-field-value').set('this value wont stick')
+
+  #   click_on 'Cancel'
+  #   wait_for_ajax
+
+  #   assert_text 'key 2'
+  #   assert_text 'value 2'
+  #   assert_no_text 'this key wont stick'
+  #   assert_no_text 'this value wont stick'
+
+  #   # remove all tags
+  #   first('.edit-collection-tags').click
+  #   first('.glyphicon-remove').click
+  #   click_on 'Save'
+  #   wait_for_ajax
+
+  #   assert_selector 'a', text: 'Edit'
+  #   assert_no_text 'key 2'
+  #   assert_no_text 'value 2'
+  # end
 end