Added hints to the edit form so a user will not edit a locked Rate. #1919
This commit is contained in:
1 parent
a52afb7a2b
commit
3fccd98102
2 files changed
+19
No files matched your search
@@ -24,7 +24,11 @@
|
|||||||
<td align="center">
|
<td align="center">
|
||||||
<%= f.hidden_field "user_id" %>
|
<%= f.hidden_field "user_id" %>
|
||||||
<%= hidden_field_tag "back_url", @back_url %>
|
<%= hidden_field_tag "back_url", @back_url %>
|
||||||
|
<% if @rate.unlocked? %>
|
||||||
<%= submit_tag((@rate.new_record? ? l(:button_add) : l(:button_update)), :class => 'button-small')-%>
|
<%= submit_tag((@rate.new_record? ? l(:button_add) : l(:button_update)), :class => 'button-small')-%>
|
||||||
|
<% else %>
|
||||||
|
<%= image_tag('locked.png') %>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -257,6 +257,21 @@ describe RatesController, "as an administrator" do
|
|||||||
assigns[:rate].should equal(mock_rate)
|
assigns[:rate].should equal(mock_rate)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "on a locked rate" do
|
||||||
|
it 'should not have a Update button' do
|
||||||
|
Rate.should_receive(:find).with("37").and_return(mock_rate(:unlocked? => false))
|
||||||
|
get :edit, :id => "37"
|
||||||
|
response.should_not have_tag("input[type=submit]")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should show the locked icon' do
|
||||||
|
Rate.should_receive(:find).with("37").and_return(mock_rate(:unlocked? => false))
|
||||||
|
get :edit, :id => "37"
|
||||||
|
response.should have_tag("img[src*=locked.png]")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "responding to POST create" do
|
describe "responding to POST create" do
|
||||||
|
|||||||
Reference in new issue
Block a user