添加竞赛首页发布通知通告相关代码

项目个人得分去除小数点
This commit is contained in:
z9hang 2014-07-23 09:24:26 +08:00
parent 41ea3a1baf
commit 0b6168c7fd
10 changed files with 52 additions and 5 deletions

View File

@ -306,9 +306,11 @@ class AdminController < ApplicationController
if request.get? if request.get?
@contest_page = FirstPage.where("page_type = 'contest'").first @contest_page = FirstPage.where("page_type = 'contest'").first
@first_page = FirstPage.where("page_type = 'project'").first @first_page = FirstPage.where("page_type = 'project'").first
@notification = ContestNotification.all.first;
elsif request.post? elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first @first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.where("page_type = 'contest'").first @contest_page = FirstPage.where("page_type = 'contest'").first
@notification = ContestNotification.all.first;
@first_page.web_title = params[:web_title] @first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title] @contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title] @contest_page.title = params[:contest_title]

View File

@ -0,0 +1,5 @@
class ContestNotificationController
def show
end
end

View File

@ -0,0 +1,3 @@
class ContestNotification < ActiveRecord::Base
attr_accessible :content, :title
end

View File

@ -36,9 +36,8 @@
</p> </p>
<div style="margin-left:60px;padding-right: 20px;" id="notification"> <div style="margin-left:60px;padding-right: 20px;" id="notification">
<label for='contest_description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;</label> <label for='contest_description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;</label>
<% labelled_form_for %> <%= text_area 'contest_notification', 'content', :value => @notification.content,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %> <%= wikitoolbar_for 'contest_notification_content' %>
</div> </div>
<%= submit_tag l(:button_save), :class => "small", :name => nil %> <%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %> <% end %>

View File

@ -24,7 +24,7 @@
<%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %> <%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %>
<div class="clear avatar_user"> <div class="clear avatar_user">
<p> <p>
<%= l(:label_user_for_project_grade) %>: <span style="color:#ec6300"><%= UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade %></span> <%= l(:label_user_for_project_grade) %>: <span style="color:#ec6300"><%= format("%.2f" ,UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade).to_i %></span>
</p> </p>
</div> </div>
<% end %> <% end %>

View File

@ -42,6 +42,8 @@ RedmineApp::Application.routes.draw do
end end
end end
resources :contest_notification
resources :open_source_projects do resources :open_source_projects do
collection do collection do
match 'search', via: [:get, :post] match 'search', via: [:get, :post]

View File

@ -0,0 +1,10 @@
class CreateContestNotifications < ActiveRecord::Migration
def change
create_table :contest_notifications do |t|
t.text :title
t.text :content
t.timestamps
end
end
end

View File

@ -0,0 +1,19 @@
# -*coding:utf-8 -*-
class SetNotification < ActiveRecord::Migration
def change
notifications = ContestNotification.all
if notifications.nil? || notifications.count == 0
notification = ContestNotification.new
notification.title = "2014年Android程序设计大赛获奖名单"
notification.content = "<div><span style='color: red'>一等奖:</span>&nbsp;<span style='color: #1166AD'>消灭那怪兽</span></div>
<div><span style='color: red'>:</span>&nbsp;<span style='color: #1166AD'>兄弟向前冲 </span></div>
<div><span style='color: red'>:</span>&nbsp;<span style='color: #1166AD'>鸟鸟文件管理器(银河之光版)</span></div>
<div><span style='color: red'>:</span>&nbsp;<span style='color: #1166AD'>疯狂猜图</span></div>
<div><span style='color: red'>:</span>&nbsp;<span style='color: #1166AD'>愉快的定向越野 </span></div>
<div><span style='color: red'>:</span>&nbsp;<span style='color: #1166AD'>体能训练助手 </span></div>
<div><span style='color: red'>:</span>&nbsp;<span style='color: #1166AD'>迷你日记本 </span></div>
<div><span style='color: red'>:</span>&nbsp;<span style='color: #1166AD'>永齐飞机大战</span></div>"
notification.save
end
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 => 20140722024513) do ActiveRecord::Schema.define(:version => 20140722080924) 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
@ -241,6 +241,13 @@ ActiveRecord::Schema.define(:version => 20140722024513) do
add_index "comments", ["author_id"], :name => "index_comments_on_author_id" add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type" add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
create_table "contest_notifications", :force => true do |t|
t.text "title"
t.text "content"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "contesting_projects", :force => true do |t| create_table "contesting_projects", :force => true do |t|
t.integer "project_id" t.integer "project_id"
t.string "contest_id" t.string "contest_id"