diff --git a/app/views/rates/_form.html.erb b/app/views/rates/_form.html.erb
index 88b65d2..f5c36e8 100644
--- a/app/views/rates/_form.html.erb
+++ b/app/views/rates/_form.html.erb
@@ -24,7 +24,11 @@
<%= f.hidden_field "user_id" %>
<%= hidden_field_tag "back_url", @back_url %>
+ <% if @rate.unlocked? %>
<%= submit_tag((@rate.new_record? ? l(:button_add) : l(:button_update)), :class => 'button-small')-%>
+ <% else %>
+ <%= image_tag('locked.png') %>
+ <% end %>
|
diff --git a/spec/controllers/rates_controller_spec.rb b/spec/controllers/rates_controller_spec.rb
index 289d75d..9b4060c 100644
--- a/spec/controllers/rates_controller_spec.rb
+++ b/spec/controllers/rates_controller_spec.rb
@@ -256,6 +256,21 @@ describe RatesController, "as an administrator" do
get :edit, :id => "37"
assigns[:rate].should equal(mock_rate)
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