Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project

This commit is contained in:
daiao 2017-03-31 10:43:01 +08:00
commit 9be4370462
8 changed files with 27 additions and 11 deletions

View File

@ -70,6 +70,7 @@ class ShixunsController < ApplicationController
def create def create
@shixun = Shixun.new(params[:shixun]) @shixun = Shixun.new(params[:shixun])
@shixun.user_id = User.current.id @shixun.user_id = User.current.id
@shixun.language = params[:language]
(params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false) (params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false)
respond_to do |format| respond_to do |format|
if @shixun.save if @shixun.save
@ -96,6 +97,7 @@ class ShixunsController < ApplicationController
def update def update
@shixun.attributes = params[:shixun] @shixun.attributes = params[:shixun]
@shixun.language = params[:language]
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0 params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
@shixun.save @shixun.save
respond_to do |format| respond_to do |format|

View File

@ -1,6 +1,6 @@
# status 控制实训的状态0未开启1: 已开启TPM # status 控制实训的状态0未开启1: 已开启TPM
class Shixun < ActiveRecord::Base class Shixun < ActiveRecord::Base
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language
has_many :users, :through => :shixun_members has_many :users, :through => :shixun_members
has_many :shixun_members has_many :shixun_members

View File

@ -11,7 +11,7 @@
<h4 class=" panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red">第<%= game.challenge.try(:position) %>关</span> <h4 class=" panel-inner-title "><i class="fa fa-dot-circle-o font-18 color-green mr5"></i><span class="color-red">第<%= game.challenge.try(:position) %>关</span>
<%= link_to game.challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4> <%= link_to game.challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4>
<p class="ml15 mt15 color-grey"> <p class="ml15 mt15 color-grey">
<span class=" mr10">已闯关:<%#= had_pass(@myshixun) %>人</span> <span class=" mr10">已闯关:<%= had_pass(@myshixun) %>人</span>
<span class=" mr10">平均耗时0小时28分</span> <span class=" mr10">平均耗时0小时28分</span>
</p> </p>
</div> </div>

View File

@ -31,6 +31,10 @@
%> %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class="mb5 ml63">
<label class="fl">&nbsp;语言&nbsp;&nbsp;</label>
<%= select_tag :language, options_for_select(["Java","C","C++","Python","Ruby"], "Java"), :id => 'shixun[language]', :class => "ml5", :style => "height: 28px;" %>
</li>
<li class="mb5 ml70"> <li class="mb5 ml70">
<label >&nbsp;公开&nbsp;</label> <label >&nbsp;公开&nbsp;</label>
<%= f.text_field :is_public, :id => "project_is_public", :name => "shixun[is_public]", :type => "checkbox", :value => "1", :checked => "checked" %> <%= f.text_field :is_public, :id => "project_is_public", :name => "shixun[is_public]", :type => "checkbox", :value => "1", :checked => "checked" %>

View File

@ -23,6 +23,10 @@
:maxlength => 5000 } :maxlength => 5000 }
%> %>
</li> </li>
<li class="clearfix">
<label class="panel-form-label fl">语言:</label>
<%= select_tag :language, options_for_select(["Java","C","C++","Python","Ruby"], @shixun.language), :id => 'shixun[language]', :style => "height: 28px;" %>
</li>
<li class="clearfix"> <li class="clearfix">
<label class="panel-form-label fl">公开:</label> <label class="panel-form-label fl">公开:</label>
<input type="checkbox" <%= @shixun.is_public ? "checked" : ""%> class="fl mt15 mr10" name="shixun[is_public]" /> <input type="checkbox" <%= @shixun.is_public ? "checked" : ""%> class="fl mt15 mr10" name="shixun[is_public]" />

View File

@ -0,0 +1,5 @@
class AddLanguageToShixuns < ActiveRecord::Migration
def change
add_column :shixuns, :language, :string
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20170328082148) do ActiveRecord::Schema.define(:version => 20170331013652) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -350,15 +350,15 @@ ActiveRecord::Schema.define(:version => 20170328082148) do
t.string "subject" t.string "subject"
t.text "description" t.text "description"
t.integer "user_id" t.integer "user_id"
t.integer "status", :limit => 1, :default => 0 t.integer "status", :limit => 1, :default => 0
t.integer "position", :limit => 1, :default => 1 t.integer "position", :limit => 1, :default => 1
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.text "ready_knowledge" t.text "ready_knowledge"
t.text "task_pass" t.text "task_pass", :limit => 2147483647
t.text "answer" t.text "answer", :limit => 2147483647
t.integer "score" t.integer "score"
t.integer "visits", :default => 0 t.integer "visits", :default => 0
t.string "path" t.string "path"
end end
@ -2147,6 +2147,7 @@ ActiveRecord::Schema.define(:version => 20170328082148) do
t.text "task_pass" t.text "task_pass"
t.text "answer" t.text "answer"
t.integer "score" t.integer "score"
t.string "language"
end end
create_table "softapplications", :force => true do |t| create_table "softapplications", :force => true do |t|

View File

@ -89,7 +89,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.ml10{ margin-left:10px;}.ml14{ margin-left:14px;}.ml15{ margin-left:15px;}.ml16{ margin-left:16px;}.ml20{ margin-left:20px;}.ml21{ margin-left:21px;} .ml10{ margin-left:10px;}.ml14{ margin-left:14px;}.ml15{ margin-left:15px;}.ml16{ margin-left:16px;}.ml20{ margin-left:20px;}.ml21{ margin-left:21px;}
.ml24{margin-left:24px;}.ml25{margin-left:25px;}.ml30{margin-left:30px !important;}.ml35{margin-left: 35px;}.ml36{ margin-left:36px; }.ml38{ margin-left:38px;} .ml24{margin-left:24px;}.ml25{margin-left:25px;}.ml30{margin-left:30px !important;}.ml35{margin-left: 35px;}.ml36{ margin-left:36px; }.ml38{ margin-left:38px;}
.ml39{ margin-left:39px;}.ml40{ margin-left:40px;}.ml41{ margin-left:41px;}.ml42{ margin-left:42px;}.ml45{ margin-left:45px;}.ml48{ margin-left:48px;}.ml50{ margin-left: 50px;} .ml39{ margin-left:39px;}.ml40{ margin-left:40px;}.ml41{ margin-left:41px;}.ml42{ margin-left:42px;}.ml45{ margin-left:45px;}.ml48{ margin-left:48px;}.ml50{ margin-left: 50px;}
.ml53{margin-left:53px;}.ml55{ margin-left:55px;}.ml56{ margin-left:56px !important;}.ml58{margin-left:58px;}.ml60{ margin-left:60px;}.ml65{ margin-left:65px;} .ml53{margin-left:53px;}.ml55{ margin-left:55px;}.ml56{ margin-left:56px !important;}.ml58{margin-left:58px;}.ml60{ margin-left:60px;}.ml65{ margin-left:65px;}.ml63{ margin-left:63px;}
.ml70{margin-left: 70px;}.ml78{ margin-left:78px;}.ml80{ margin-left:80px;}.ml85{margin-left:85px;}.ml90{ margin-left:90px;}.ml95{margin-left:95px;}.ml100{ margin-left:100px;} .ml70{margin-left: 70px;}.ml78{ margin-left:78px;}.ml80{ margin-left:80px;}.ml85{margin-left:85px;}.ml90{ margin-left:90px;}.ml95{margin-left:95px;}.ml100{ margin-left:100px;}
.ml110{ margin-left:110px;}.ml125 { margin-left:125px;}.ml130 { margin-left:130px;}.ml140 { margin-left:140px;}.ml150 { margin-left:150px;} .ml110{ margin-left:110px;}.ml125 { margin-left:125px;}.ml130 { margin-left:130px;}.ml140 { margin-left:140px;}.ml150 { margin-left:150px;}
.ml160 {margin-left:160px;}.ml250 {margin-left:250px;}.ml258{ margin-left:258px;}.ml320{ margin-left:320px;}.ml358{ margin-left:358px;}.mr-5 {margin-right:-5px;} .ml160 {margin-left:160px;}.ml250 {margin-left:250px;}.ml258{ margin-left:258px;}.ml320{ margin-left:320px;}.ml358{ margin-left:358px;}.mr-5 {margin-right:-5px;}