parent
b22077033a
commit
005e0802d4
@ -0,0 +1,10 @@
|
||||
class JoinInContest < ActiveRecord::Base
|
||||
attr_accessible :bid_id, :user_id
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :bid
|
||||
|
||||
validates_presence_of :user_id, :bid_id
|
||||
|
||||
|
||||
end
|
@ -0,0 +1,59 @@
|
||||
<!-- added by fq -->
|
||||
<style>
|
||||
input[type="submit"].bid_btn {
|
||||
vertical-align: middle;
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
/*margin-top: -10px;*/
|
||||
/*margin-right: -4px;*/
|
||||
}
|
||||
input[type="button"].bid_btn {
|
||||
width: 60px;/*modified by ming*/
|
||||
height: 25px;
|
||||
line-height: 19px;
|
||||
font-size: 14px;
|
||||
color: rgb(0, 0, 0);
|
||||
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||
padding: 0px 0px 4px 0px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid rgb(148, 148, 148);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
/*margin-top: -10px;*/
|
||||
margin-right: -2px;
|
||||
}
|
||||
textarea:focus {
|
||||
border: #d5dee9 1px solid;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h3 class="title">请输入竞赛密码</h3>
|
||||
|
||||
<%= form_tag({:controller => 'bids',
|
||||
:action => 'join_in_contest',
|
||||
:id => course.id},
|
||||
:remote => true,
|
||||
:method => :post,
|
||||
:id => 'new-watcher-form') do %>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td align="cneter">
|
||||
</td>
|
||||
|
||||
<%= text_field_tag 'course_password', nil, :size => 45 %>
|
||||
|
||||
<p class="buttons" style="padding-top: 10px; padding-bottom: 1px; margin-bottom: 1px">
|
||||
<%= submit_tag l(:label_new_join), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);" %>
|
||||
<%= submit_tag l(:button_cancel), :name => nil, :class => "bid_btn", :onclick => "hideModal(this);", :type => 'button' %>
|
||||
</td>
|
||||
</tr></table>
|
||||
<% end %>
|
@ -0,0 +1,8 @@
|
||||
$("#<%=object_id%>").replaceWith('<%= escape_javascript join_in_contest(@bid, user) %>');
|
||||
<% if @state %>
|
||||
<% if @state == 0 %>
|
||||
alert("加入成功")
|
||||
<% else %>
|
||||
alert("密码错误")
|
||||
<% end %>
|
||||
<% end %>
|
@ -0,0 +1,3 @@
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'bids/new_join', :locals => {:course => @bid}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
$('#ajax-modal').addClass('new-watcher');
|
@ -0,0 +1,5 @@
|
||||
class AddPasswordToBids < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :bids, :password, :string
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateJoinInContests < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :join_in_contests do |t|
|
||||
t.integer :user_id
|
||||
t.integer :bid_id
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue