app/views/help_popups/topics/edit.html.erb in help_popups-1.0.0 vs app/views/help_popups/topics/edit.html.erb in help_popups-1.0.1

- old
+ new

@@ -1,18 +1,28 @@ -<script> - function deleteTopic(topic_id){ - if (confirm("Are you sure you want to delete this help topic?")){ - formObj = document.getElementById("deleteForm"); - formObj.submit(); +<% if !(session[:help_popups_clearance].nil?) || (Rails.configuration.help_popups_simple_auth == false) %> + <script> + function deleteTopic(topic_id){ + if (confirm("Are you sure you want to delete this help topic?")){ + formObj = document.getElementById("deleteForm"); + formObj.submit(); + } } - } -</script> + </script> -<%= form_for @topic do |f| %> - <h2>Editing Topic</h2> - <%= render 'shared/error_messages', :object => f.object %><br/> - <%= render 'fields', :f => f %> - <br/> - <%= f.submit "Edit Topic" %> <input type="button" class="redButton" value="Delete" onclick="deleteTopic(<%= @topic.id %>)"> &nbsp; &nbsp; <input type="button" value="Cancel" onclick="document.location='<%= topics_path %>'"> -<% end %> + <%= form_for @topic do |f| %> + <h2>Editing Topic</h2> + <%= render 'shared/error_messages', :object => f.object %><br/> + <%= render 'fields', :f => f %> + <br/> + <%= f.submit "Edit Topic" %> <input type="button" class="redButton" value="Delete" onclick="deleteTopic(<%= @topic.id %>)"> &nbsp; &nbsp; <input type="button" value="Cancel" onclick="document.location='<%= topics_path %>'"> + <% end %> -<%= form_tag(topic_path, :method => :delete, :id => "deleteForm") %> + <%= form_tag(topic_path, :method => :delete, :id => "deleteForm") %> +<% else %> + You must login before you can access the Help Popups administration.<br/> + Please enter the password you defined for <b>config.help_popups_password</b>: <br/> + <br/> + <% flash.each do |key, value| %> + <%= content_tag(:div, value, :class => "flash #{key}") %> + <% end %> + <form action='/help_popups/login' method='post'><input type='text' size='20' id='help_popups_password' name='help_popups_password'> &nbsp; &nbsp; <input type='submit' value='Submit'></form> +<% end %> \ No newline at end of file