diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 05045ab12..445a1a393 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -306,9 +306,11 @@ class AdminController < ApplicationController
if request.get?
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page = FirstPage.where("page_type = 'project'").first
+ @notification = ContestNotification.all.first;
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.where("page_type = 'contest'").first
+ @notification = ContestNotification.all.first;
@first_page.web_title = params[:web_title]
@contest_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
diff --git a/app/controllers/contest_notification_controller.rb b/app/controllers/contest_notification_controller.rb
new file mode 100644
index 000000000..143941cc0
--- /dev/null
+++ b/app/controllers/contest_notification_controller.rb
@@ -0,0 +1,5 @@
+class ContestNotificationController
+ def show
+
+ end
+end
\ No newline at end of file
diff --git a/app/models/contest_notification.rb b/app/models/contest_notification.rb
new file mode 100644
index 000000000..c1f2fde6f
--- /dev/null
+++ b/app/models/contest_notification.rb
@@ -0,0 +1,3 @@
+class ContestNotification < ActiveRecord::Base
+ attr_accessible :content, :title
+end
diff --git a/app/views/admin/contest_page_made.html.erb b/app/views/admin/contest_page_made.html.erb
index ef99abf7d..d9a9b2f65 100644
--- a/app/views/admin/contest_page_made.html.erb
+++ b/app/views/admin/contest_page_made.html.erb
@@ -36,9 +36,8 @@
- <% labelled_form_for %>
- <%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
-
+ <%= text_area 'contest_notification', 'content', :value => @notification.content,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
+ <%= wikitoolbar_for 'contest_notification_content' %>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
diff --git a/app/views/contest_notification/show.html.erb b/app/views/contest_notification/show.html.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb
index 6fe6b55f0..cdf6c459d 100644
--- a/app/views/projects/_member_list.html.erb
+++ b/app/views/projects/_member_list.html.erb
@@ -24,7 +24,7 @@
<%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %>
- <%= l(:label_user_for_project_grade) %>: <%= UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade %>
+ <%= l(:label_user_for_project_grade) %>: <%= format("%.2f" ,UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade).to_i %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 08183f55e..948eee4a5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -42,6 +42,8 @@ RedmineApp::Application.routes.draw do
end
end
+ resources :contest_notification
+
resources :open_source_projects do
collection do
match 'search', via: [:get, :post]
diff --git a/db/migrate/20140722080529_create_contest_notifications.rb b/db/migrate/20140722080529_create_contest_notifications.rb
new file mode 100644
index 000000000..0aff8d268
--- /dev/null
+++ b/db/migrate/20140722080529_create_contest_notifications.rb
@@ -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
diff --git a/db/migrate/20140722080924_set_notification.rb b/db/migrate/20140722080924_set_notification.rb
new file mode 100644
index 000000000..87e90318c
--- /dev/null
+++ b/db/migrate/20140722080924_set_notification.rb
@@ -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 = "一等奖: 消灭那怪兽
+ 二等奖: 兄弟向前冲
+ 二等奖: 鸟鸟文件管理器(银河之光版)
+ 三等奖: 疯狂猜图
+ 三等奖: 愉快的定向越野
+ 三等奖: 体能训练助手
+ 三等奖: 迷你日记本
+ 三等奖: 永齐飞机大战
"
+ notification.save
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index c4d359dab..870703254 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# 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|
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", ["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|
t.integer "project_id"
t.string "contest_id"