modify competition path

dev_aliyun
p31729568 5 years ago
parent 3953b52a09
commit 3532564c68

@ -25,7 +25,15 @@ class CompetitionsController < ApplicationController
end
def index
@competitions = Competition.where('status = 1 or published_at is not null').reorder("published_at desc, online_time desc")
competitions = Competition.where('status = 1 or published_at is not null')
case params[:category]
when 'progressing' then
competitions = competitions.where('end_time > NOW()')
when 'end' then
competitions = competitions.where('end_time < NOW()')
end
@competitions = competitions.reorder("published_at desc, online_time desc")
respond_to do |format|
format.html { render :layout => "base_edu"}
format.js

@ -2996,6 +2996,8 @@ module ApplicationHelper
else
title << "教学案例"
end
elsif params[:controller] == "project_packages"
title << "众包社区"
elsif @course
title << (@course.name.nil? ? "课堂" : @course.name)
elsif params[:controller] == "homework_bank" || params[:controller] == "question_banks" || params[:controller] == "exercise_bank"
@ -7468,7 +7470,7 @@ def tiding_url tiding
tiding.tiding_type == 'Apply' ? library_applies_path : library_path(tiding.container_id)
when 'ProjectPackage'
if tiding.container.present?
tiding.tiding_type == 'Apply' ? project_package_applies_path : "/project_packages/#{tiding.container_id}"
tiding.tiding_type == 'Apply' ? project_package_applies_path : "/crowdsourcing/#{tiding.container_id}"
else
'javascript:void(0)'
end

@ -2,7 +2,7 @@ module LibrariesHelper
def show_library_tags(library)
html = ''
library.library_tags.each do |tag|
html += content_tag(:span, tag.name, class: "edu-filter-btn fl cdefault mt3 ml10 " + library_tag_class(tag))
html += content_tag(:span, tag.name, class: "edu-filter-btn fl cdefault mt3 ml10 #{library_tag_class(tag)}")
end
raw html

@ -5,7 +5,9 @@
<% if competition.status? %>
<div class="competitionsList-item mb20">
<div class="edu-back-white pr">
<div class="applycompetitions">报名中</div>
<% if competition.enroll_end_time.present? && competition.enroll_end_time > Time.now %>
<div class="applycompetitions">报名中</div>
<% end %>
<a href="<%= competition_path(competition) %>" class="competition-Img" target="_blank">
<%= image_tag(url_to_avatar(competition), :width => "100%", :height => "100%") %>
</a>

@ -57,7 +57,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get :publish_success, on: :collection
end
resources :project_packages, only: [:index, :show, :new, :edit, :destroy] do
resources :project_packages, path: 'crowdsourcing', only: [:index, :show, :new, :edit, :destroy] do
get :apply_success, on: :member
end

Loading…
Cancel
Save