Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
4d3d0798e2
@ -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>
|
@ -1,5 +1,6 @@
|
||||
json.partial! "commons/success"
|
||||
json.data do
|
||||
json.array! @courses, :id, :name, :updated_at, :created_at, :end_date
|
||||
json.data @courses do |course|
|
||||
json.(course, :id, :name, :updated_at, :end_date)
|
||||
json.created_at course.created_at.strftime("%Y-%m-%d")
|
||||
end
|
||||
|
||||
|
@ -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