Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge in branch title-not-edited-in-panopticon

  • Loading branch information...
commit 9ac7c3da77da5f55194d70582cb45bb27728d7cf 2 parents 7b34275 + c3977ea
Mazz authored
View
4 app/helpers/artefacts_helper.rb
@@ -10,4 +10,8 @@ def published_url(artefact)
def human_timestamp(timestamp)
timestamp ? timestamp.strftime("%d/%m/%Y %R") : "(no timestamp)"
end
+
+ def name_hint_for(artefact)
+ artefact.persisted? ? "This should be edited in #{artefact.owning_app}" : "A name/title for the item"
+ end
end
View
2  app/views/artefacts/_form.html.erb
@@ -20,7 +20,7 @@
<div class="well">
<%= semantic_form_for(artefact, :html => { :class => '', :id => 'edit_artefact'}) do |f| %>
<%= f.inputs do %>
- <%= f.input :name, :input_html => { :class => "span6" } %>
+ <%= f.input :name, :input_html => { :class => "span6", :disabled => f.object.persisted?}, :hint => name_hint_for(f.object) %>
<%= f.input :description, :input_html => { :class => "span6", :disabled => true, :rows => 6 }, :hint => 'Managed through API and/or owning app', :as => :text %>
<%= f.input :slug, :input_html => { :class => "span6", :disabled => f.object.live? }, :hint => "A valid slug might look like this: i-am-a-good-slug-with-no-spaces" %>
<%= f.input :need_id, :input_html => { :class => "span6", :disabled => f.object.persisted? } %>
View
6 features/editing.feature
@@ -51,8 +51,8 @@ Feature: Editing artefacts
Then rummager should not be notified
Scenario: Editing a live item
- Given two artefacts exist
+ Given an artefact exists
And the first artefact is live
- When I change the title of the first artefact
- And I save
+ And a section exists
+ When I add the section to the artefact
Then rummager should be told to do a partial update
View
4 features/step_definitions/registration_steps.rb
@@ -101,9 +101,9 @@
Then /^rummager should be told to do a partial update$/ do
amendments = {
- title: @new_name,
+ title: "Child Benefit rates",
format: "answer",
- section: "",
+ section: @section.tag_id,
subsection: ""
}
assert_requested :post, artefact_search_url(@artefact), body: amendments
View
6 test/functional/artefacts_controller_test.rb
@@ -190,6 +190,12 @@ class ArtefactsControllerTest < ActionController::TestCase
assert_equal ['fooey', 'gooey', 'kablooey'], assigns["tag_collection"].map(&:tag_id)
end
+
+ should "disable the name field as it's managed by the owning app" do
+ artefact = FactoryGirl.create(:artefact)
+ get :edit, id: artefact.id, format: :html
+ assert_select 'input[id=artefact_name][disabled=disabled]'
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.