更新代码效果

This commit is contained in:
huang 2017-09-30 15:29:46 +08:00
parent cb16a1b4b7
commit 7904f693f0
2 changed files with 18 additions and 5 deletions

View File

@ -67,7 +67,7 @@ class GamesController < ApplicationController
shixun_new_commit = g.commits(@myshixun.shixun.try(:gpid)).first.try(:id)
@myshixun.update_column(:commit_id, shixun_new_commit)
sleep(2) # g
render :json => {status:200}
render :json => {:status => 200}
end
def index

View File

@ -121,7 +121,8 @@
<!--代码更新提示-->
<p class="ml5 color-dark-grey" style="line-height: 20px">关卡任务的代码文件有更新,点击立即更新获取最新代码!</p>
<div class="tip-operator-btn">
<%= link_to "立即更新", sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun), :remote => true, :class => "fl color-orange03", :onclick => "hide_tip_content();" %>
<%#= link_to "立即更新", sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun), :remote => true, :class => "fl color-orange03", :onclick => "sync_hide_tip_content();" %>
<a href="javascript:void(0)" class="fl color-orange03" onclick="sync_hide_tip_content();">立即更新</a>
<a href="javascript:void(0)" class="fl color-grey" onclick="hide_tip_content();">稍后再说</a>
</div>
</div>
@ -199,14 +200,26 @@
var praiseStatus = <%= @praise.nil? ? false : true %>; // 是否点赞
var treadStatus = <%= @tread.nil? ? false : true %>; // 是否踩
//显示更新提示方法
// 显示更新提示方法
function show_tip_content(){
$(".tip-panel-animate").addClass("animate-tip");
$(".tip-panel-animate").show();
}
//隐藏更新提示方法
function hide_tip_content(){
// 隐藏更新提示方法
function sync_hide_tip_content(){
$(".tip-panel-animate").addClass("animate-tip-hide");
setTimeout('$(".tip-panel-animate").hide();', 700);
alert("test");
$.ajax({
url: "<%= sync_codes_myshixun_game_path(@game, :myshixun_id => @myshixun) %>",
dataType: "script",
success: function(data){
alert(data.status);
if(data.status == 200){
$('#'+target).html(data);
}
}
})
}
</script>