commit
						130045dcc7
					
				| @ -0,0 +1,15 @@ | ||||
| class Admins::CompetitionsController < Admins::BaseController | ||||
| 
 | ||||
|   def index | ||||
|     params[:sort_by] = params[:sort_by].presence || 'created_on' | ||||
|     params[:sort_direction] = params[:sort_direction].presence || 'desc' | ||||
|     @competitions = custom_sort Competition.all, params[:sort_by], params[:sort_direction] | ||||
|     @params_page = params[:page] || 1 | ||||
|     @competitions = paginate @competitions | ||||
| 
 | ||||
|     respond_to do |format| | ||||
|       format.js | ||||
|       format.html | ||||
|     end | ||||
|   end | ||||
| end | ||||
| @ -0,0 +1,3 @@ | ||||
| class CompetitionModeSetting < ApplicationRecord | ||||
|   belongs_to :course | ||||
| end | ||||
| @ -0,0 +1,7 @@ | ||||
| <% define_admin_breadcrumbs do %> | ||||
|   <% add_admin_breadcrumb('竞赛列表', admins_competitions_path) %> | ||||
| <% end %> | ||||
| 
 | ||||
| <div class="box competitions-list-container"> | ||||
|   <%= render partial: 'admins/shixuns/shared/list', locals: { shixuns: @shixuns } %> | ||||
| </div> | ||||
| @ -0,0 +1,6 @@ | ||||
| class AddNewColumnToCompetitions < ActiveRecord::Migration[5.2] | ||||
|   def change | ||||
|     add_column :competitions, :bonus, :integer, default: 0 | ||||
|     add_column :competitions, :mode, :integer, default: 0 | ||||
|   end | ||||
| end | ||||
| @ -0,0 +1,11 @@ | ||||
| class CreateCompetitionModeSettings < ActiveRecord::Migration[5.2] | ||||
|   def change | ||||
|     create_table :competition_mode_settings do |t| | ||||
|       t.references :course | ||||
|       t.datetime :start_time | ||||
|       t.datetime :end_time | ||||
| 
 | ||||
|       t.timestamps | ||||
|     end | ||||
|   end | ||||
| end | ||||
| @ -0,0 +1,5 @@ | ||||
| require 'rails_helper' | ||||
| 
 | ||||
| RSpec.describe CompetitionModeSetting, type: :model do | ||||
|   pending "add some examples to (or delete) #{__FILE__}" | ||||
| end | ||||
					Loading…
					
					
				
		Reference in new issue