Permalink
Browse files

Sessions#init: cleanup obtrusive JS

  • Loading branch information...
1 parent b6838a7 commit aa6b6c0266f5dfd521eef7fd69837c9f894966f2 @etdsoft etdsoft committed Jan 28, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 app/views/sessions/init.html.erb
@@ -19,13 +19,11 @@
<div class="form_group">
<div>
<label>New project</label>
- <%= radio_button_tag 'mode', 'new', @new_project,
- :onclick=>"javascript:$(meta_server).hide();" %>
+ <%= radio_button_tag 'mode', 'new', @new_project %>
</div>
<div>
<label>Checkout project</label>
- <%= radio_button_tag 'mode', 'meta-server', !@new_project,
- :onclick=>"javascript:$(meta_server).show();" %>
+ <%= radio_button_tag 'mode', 'meta-server', !@new_project %>
<%= hidden_field_tag 'revision', nil %>
</div>
@@ -42,5 +40,10 @@
</div>
<script type="text/javascript">
- <% if @new_project %>$(meta_server).hide();<% else %>$(meta_server).show();<% end %>
+ $(function(){
+ $("input[name='mode']").change(function(){
+ $("#meta_server").toggle( $("#mode_meta-server").is(":checked") );
+ });
+ <% if @new_project -%>$("#meta_server").hide();<% end -%>
+ });
</script>

0 comments on commit aa6b6c0

Please sign in to comment.