编辑 上移 下移动功能
This commit is contained in:
parent
59608d5f1d
commit
d021dbb522
|
@ -2,7 +2,7 @@
|
|||
class ChallengesController < ApplicationController
|
||||
layout "base_shixun"
|
||||
before_filter :find_shixun, :only => [:index, :new, :create, :destroy, :challenge_build]
|
||||
before_filter :find_challenge, :only => [:show, :update, :challenge_build]
|
||||
before_filter :find_challenge, :only => [:show, :edit, :update, :challenge_build, :index_up, :index_down]
|
||||
before_filter :authorize_tpi, :only => [:new, :create]
|
||||
before_filter :build_challege_from_params, :only => [:new, :create]
|
||||
before_filter :tpi_manager_allowed, :only => [:challenge_build]
|
||||
|
@ -71,6 +71,25 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
end
|
||||
|
||||
def index_down
|
||||
@challenges = @shixun.challenges
|
||||
position = @challenge.position
|
||||
@challenge.update_attribute(:position, (position + 1))
|
||||
|
||||
end
|
||||
|
||||
def index_up
|
||||
@challenges = @shixun.challenges
|
||||
end
|
||||
|
||||
# build job 只负责发送请求
|
||||
def challenge_build
|
||||
gitUrl = git_repository_url(@shixun, "Shixun")
|
||||
|
|
|
@ -9,4 +9,12 @@ class Challenge < ActiveRecord::Base
|
|||
validates_presence_of :task_pass
|
||||
validates_length_of :subject, :maximum => 255
|
||||
|
||||
def next_challenge
|
||||
|
||||
end
|
||||
|
||||
def last_challenge
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
<% challenges.each do |challenge| -%>
|
||||
<tr>
|
||||
<td>
|
||||
<% if challenge.status == 1 %>
|
||||
<div class="issues_ciricons fl ml15"><span class="issues_ciricons_02 "></span></div>
|
||||
<% else %>
|
||||
<div class="issues_ciricons fl ml15 mt5"><i class="icon-flag fb " style="color:#49a547; font-size:15px;"></i></div>
|
||||
<% end %>
|
||||
<div class=" fl ml5">
|
||||
<div class="issues_list_titlebox clear">
|
||||
<a href="<%= shixun_challenge_path(challenge, :shixun_id => @shixun.id) %>" class="issues_list_title fl task-list-title" target="_blank" title="<%= challenge.subject.to_s %>" >
|
||||
<span class="task-step mr5">step<%= challenge.position %></span>
|
||||
<%= challenge.subject.to_s %>
|
||||
</a>
|
||||
<% if challenge.status == 1 %>
|
||||
<span class="task-linebtn-green fl ml5 mt3">已解决</span>
|
||||
<% else %>
|
||||
<span class="task-linebtn-green fl ml5 mt3">正在解决中</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="issues_list_small">
|
||||
<p class="fl issues_list_name" ><span class="mr5"><%= format_time(challenge.created_at) %></span>发布</p>
|
||||
<p class="fl ml10"> <span class="mr5"><%= format_time(challenge.updated_at) %></span>更新</p>
|
||||
</div>
|
||||
<div class="task-pm-box mt20 mb20">
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl mt5">全部任务</h3><span class="btn-cir btn-cir-grey ml5 mt8 fl"><%= @challenges.count %></span>
|
||||
<a href="<%= new_shixun_challenge_path(@shixun) %>" class=" task-btn task-btn-green fr">新建阶段</a>
|
||||
</div>
|
||||
<div class="panel-list">
|
||||
<% @challenges.each_with_index do |challenge, index| -%>
|
||||
<div class=" clearfix panel-inner" id="shixun_index_<%= index %>">
|
||||
<h4 class="fl panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red mr10">第<%= challenge.position %>关</span><%= challenge.subject %></h4>
|
||||
<p class="fr" style="display: none" id="shixun_icon_<%= index %>">
|
||||
<a href="<%= index_up_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="上移" data-remote="true"><i class="fa fa-long-arrow-up color-grey font-16 mr5" ></i></a>
|
||||
<a href="<%= index_down_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="下移" data-remote="true"><i class="fa fa-long-arrow-down color-grey font-16 mr5" ></i></a>
|
||||
<a href="<%= edit_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="编辑" ><i class="fa fa-pencil-square-o color-grey font-16 mr5" ></i></a>
|
||||
<a href="#" title="删除" ><i class="fa fa-trash-o color-grey font-16 mr5" ></i></a>
|
||||
<!--<a href="#" title="排名" ><i class="fa fa-signal color-grey font-16 mr5 " ></i></a>-->
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">正在挑战:129</span>
|
||||
<span class=" mr10">完成挑战:1.6万</span>
|
||||
<span class=" mr10">最佳表现:98分</span>
|
||||
<span class=" mr10">测评次数:3次</span>
|
||||
<span class=" mr10">平均表现:80分 </span>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
<td >
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#shixun_index_<%= index %>").mouseenter(function(){
|
||||
$("#shixun_icon_<%= index %>").show();
|
||||
});
|
||||
$("#shixun_index_<%= index %>").mouseleave(function(){
|
||||
$("#shixun_icon_<%= index %>").hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,35 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<div class="task-pm-content mb20">
|
||||
<div class="task-pm-box mt20">
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl mt5">编辑阶段</h3>
|
||||
</div>
|
||||
<div class=" panel-form ">
|
||||
<ul>
|
||||
<%= labelled_form_for @challenge, :url => shixun_challenges_path(@shixun) do |f| %>
|
||||
<%= render :partial => "form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if false %>
|
||||
<!--新建缺陷开始-->
|
||||
<div class="pro_new_con mb10">
|
||||
<div class="pro-task-new-con clear">
|
||||
<%#= call_hook(:view_issues_new_top, {:training_task => @training_task}) %>
|
||||
<%= labelled_form_for @challenge, :url => shixun_challenges_path(@shixun) do |f| %>
|
||||
<%= error_messages_for 'training_task' %>
|
||||
<div>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -14,42 +14,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="task-pm-box mt20 mb20">
|
||||
<div class="panel-header clearfix">
|
||||
<h3 class="fl mt5">全部任务</h3><span class="btn-cir btn-cir-grey ml5 mt8 fl"><%= @challenges.count %></span>
|
||||
<a href="<%= new_shixun_challenge_path(@shixun) %>" class=" task-btn task-btn-green fr">新建阶段</a>
|
||||
</div>
|
||||
<div class="panel-list">
|
||||
<% @challenges.each_with_index do |challenge, index| -%>
|
||||
<div class=" clearfix panel-inner" id="shixun_index_<%= index %>">
|
||||
<h4 class="fl panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red mr10">第<%= challenge.position %>关</span><%= challenge.subject %></h4>
|
||||
<p class="fr" style="display: none" id="shixun_icon_<%= index %>">
|
||||
<a href="#" title="上移" ><i class="fa fa-long-arrow-up color-grey font-16 mr5" ></i></a>
|
||||
<a href="#" title="下移" ><i class="fa fa-long-arrow-down color-grey font-16 mr5" ></i></a>
|
||||
<a href="#" title="编辑" ><i class="fa fa-pencil-square-o color-grey font-16 mr5" ></i></a>
|
||||
<a href="#" title="删除" ><i class="fa fa-trash-o color-grey font-16 mr5" ></i></a>
|
||||
<a href="#" title="排名" ><i class="fa fa-signal color-grey font-16 mr5 " ></i></a>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml15 mt15 color-grey">
|
||||
<span class=" mr10">正在挑战:129</span>
|
||||
<span class=" mr10">完成挑战:1.6万</span>
|
||||
<span class=" mr10">最佳表现:98分</span>
|
||||
<span class=" mr10">测评次数:3次</span>
|
||||
<span class=" mr10">平均表现:80分 </span>
|
||||
</p>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#shixun_index_<%= index %>").mouseenter(function(){
|
||||
$("#shixun_icon_<%= index %>").show();
|
||||
});
|
||||
$("#shixun_index_<%= index %>").mouseleave(function(){
|
||||
$("#shixun_icon_<%= index %>").hide();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="challenge_list">
|
||||
<%= render :partial => "content_list" %>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
$("#challenge_list").html('<%= escape_javascript( render :partial => 'resource_search_form', :locals => {:user => @user, :type => @type} ) %>');
|
|
@ -45,6 +45,8 @@ RedmineApp::Application.routes.draw do
|
|||
member do
|
||||
match 'challenge_build', :via => [:get, :post]
|
||||
match 'game_build_result', :via => [:get, :post]
|
||||
get 'index_up'
|
||||
get 'index_down'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue