Permalink
Browse files

Merge pull request #426 from alphagov/user_needs_are_handled_in_conte…

…nt_tagger_too

Content is now tagged to user needs in Content Tagger instead of here
  • Loading branch information...
2 parents 73c736a + e25c5a4 commit cd4e3a8e1dfb5c4e7d397ac348f81ccaea38bf7c @issyl0 issyl0 committed Feb 13, 2017
@@ -20,8 +20,6 @@
<% if f.object.content_id %>
<%= render partial: "artefacts/use_content_tagger", locals: { f: f, artefact: artefact } %>
<% end %>
- <%= render partial: "artefacts/form/need", locals: { f: f } %>
-
</div>
<div class="col-md-4">
@@ -3,8 +3,8 @@
Improved tagging
</div>
<div class="callout-body">
- Tagging and related links for this item
- <%= link_to "has moved", Plek.find('content-tagger') + "/content/#{artefact.content_id}" %>.
+ Tagging, user needs and related links for this item
+ <%= link_to "have moved to Content Tagger", Plek.find('content-tagger') + "/content/#{artefact.content_id}" %>.
</div>
</div>
</br>
@@ -1,10 +0,0 @@
-<div class="well user-needs-form form-inline">
- <%= f.inputs "User need", :id => "user-need" do %>
- <%= f.input :need_ids,
- label: raw('Need IDs <span class="non-js-hint">(add a comma-separated list of related need ids)</span>'),
- input_html: { class: "js-artefact-need-ids need-id-input",
- value: f.object.need_ids.present? ? f.object.need_ids.reject(&:blank?).join(",") : nil,
- data: { 'maslow-needs-url' => Plek.current.find('maslow') + "/needs/",
- 'needotron-needs-url' => Plek.current.find('needotron') + "/needs/" }} %>
- <% end %>
-</div>
@@ -14,7 +14,6 @@
<table class="table table-striped table-bordered table-condensed" id="artefact-list" summary="List of everything">
<thead>
<tr class="table-header">
- <th scope="col"><%= sortable "need_id", "Needs" %></th>
<th scope="col"><%= sortable "name", "Title" %></th>
<th scope="col"><%= sortable "kind", "Format" %></th>
<th scope="col"><%= sortable "owning_app", "App" %></th>
@@ -24,13 +23,6 @@
<tbody>
<% @artefacts.each do |artefact| %>
<tr class="<%= artefact.state %>">
- <td>
- <% if artefact.need_ids %>
- <% artefact.need_ids.each do |need_id| %>
- <%= content_tag "span", need_id, :class => "label label-default need-id" %>
- <% end %>
- <% end %>
- </td>
<td><%= link_to artefact.name, edit_artefact_path(artefact.id) %></td>
<td>
<small><%= artefact.kind.humanize %></small>
View
@@ -2,25 +2,7 @@ Feature: Editing artefacts
In order to maintain GOV.UK metadata
I want to edit artefacts
- Background:
- Given I am an admin
-
- @javascript
- Scenario: Editing an artefact and returning to edit some more
- Given two artefacts exist
- When I change the need ID of the first artefact
- And I save, indicating that I want to continue editing afterwards
- Then I should be redirected back to the edit page
- And I should see an indication that the save worked
-
- @javascript
- Scenario: Editing an item that's draft
- Given two artefacts exist
- And the first artefact is in draft
- When I change the need ID of the first artefact
- And I save
-
- Scenario: Editing the links of an Artefact
+ Scenario: Editing an Artefact
Given an artefact exists
When I visit the edit page
Then I should see a callout
@@ -14,12 +14,6 @@
Artefact.first.update_attributes!('state' => 'draft')
end
-When /^I change the need ID of the first artefact$/ do
- visit edit_artefact_path(@artefact)
- @new_need_id = "100001"
- add_need_id @new_need_id
-end
-
When /^I change the slug of the first artefact to "([^"]*)"$/ do |slug|
visit edit_artefact_path(@artefact)
fill_in "Slug", :with => slug
@@ -71,7 +65,7 @@
end
Then /^I should see a callout$/ do
- callout = "Tagging and related links for this item has moved"
+ callout = "Tagging, user needs and related links for this item have moved to Content Tagger"
assert page.has_content?(callout)
end
View
@@ -62,5 +62,3 @@
Capybara.current_driver = Capybara.javascript_driver
end
-require Rails.root + 'test/helpers/artefact_need_ids_form_filler'
-World(ArtefactNeedIdsFormFiller)
@@ -1,15 +0,0 @@
-module ArtefactNeedIdsFormFiller
- def add_need_id(need_id)
- # needs ids are entered in an input field
- # which has a mask. hence, this is needed.
- page.execute_script(%Q<$("#artefact_need_ids").val("#{need_id}")>)
- within '#user-need' do
- click_link 'Add Maslow Need ID'
- # the click above triggers a page javascript
- # so an explicit wait is needed, or else capybara
- # doesn't wait before adding another need_id, which
- # happens too fast.
- sleep 0.5
- end
- end
-end
@@ -3,61 +3,14 @@
class ArtefactsEditTest < ActionDispatch::IntegrationTest
setup do
create_test_user
- stub_all_router_api_requests
end
- context "need_ids" do
- setup do
- Capybara.current_driver = Capybara.javascript_driver
- end
+ test "it should display the 'Tagging and user needs have moved' message" do
+ artefact = FactoryGirl.create(:artefact, owning_app: OwningApp::PUBLISHER, paths: ["/foo"])
- should "allow editing of need IDs when a Maslow need ID is present" do
- artefact = FactoryGirl.create(:artefact, :need_ids => ["100123"])
+ visit "/artefacts/#{artefact.id}/edit"
- visit "/artefacts/#{artefact.id}/edit"
-
- add_need_id "100123"
- click_on "Save and continue editing"
-
- artefact.reload
- assert_equal ["100123"], artefact.need_ids
- end
-
- should "allow editing of the need ID when a Need-o-tron ID present" do
- artefact = FactoryGirl.create(:artefact)
- artefact.update_attribute(:need_ids, ["99999"])
-
- visit "/artefacts/#{artefact.id}/edit"
-
- add_need_id "100012"
- click_on "Save and continue editing"
-
- artefact.reload
- assert_equal ["99999", "100012"], artefact.need_ids
- end
-
- should "allow editing of the Need ID" do
- artefact = FactoryGirl.create(:artefact)
- artefact.update_attribute(:need_ids, ["B241"])
-
- visit "/artefacts/#{artefact.id}/edit"
-
- add_need_id "100012"
- click_on "Save and continue editing"
-
- artefact.reload
- assert_equal ["B241", "100012"], artefact.need_ids
- end
-
- should "allow editing of the Need IDs when need IDs is blank" do
- artefact = FactoryGirl.create(:artefact, :need_ids => [])
- visit "/artefacts/#{artefact.id}/edit"
-
- add_need_id "100012"
- click_on "Save and continue editing"
-
- artefact.reload
- assert_equal ["100012"], artefact.need_ids
- end
+ assert page.has_selector? ".callout-title", text: "Improved tagging"
+ assert page.has_link? "have moved to Content Tagger", href: Plek.find('content-tagger') + "/content/#{artefact.content_id}"
end
end
@@ -1,22 +0,0 @@
-require_relative '../integration_test_helper'
-
-class AssociateArtefactsWithMultipleNeedsTest < ActionDispatch::IntegrationTest
- setup do
- create_test_user
- Capybara.current_driver = Capybara.javascript_driver
- end
-
- should "associate multiple needs to an artefact" do
- artefact = FactoryGirl.create(:artefact)
-
- visit "/artefacts/#{artefact.id}/edit"
-
- add_need_id "100123"
- add_need_id "100124"
- add_need_id "100125"
- click_on "Save and continue editing"
-
- visit "/artefacts"
- assert_equal ["100123", "100124", "100125"], page.all("#artefact-list span.need-id").map(&:text)
- end
-end
@@ -1,13 +1,11 @@
require_relative 'test_helper'
-require_relative 'helpers/artefact_need_ids_form_filler'
require 'capybara/rails'
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
class ActionDispatch::IntegrationTest
include Capybara::DSL
- include ArtefactNeedIdsFormFiller
teardown do
Capybara.use_default_driver

0 comments on commit cd4e3a8

Please sign in to comment.