parent
41ea3a1baf
commit
0b6168c7fd
|
@ -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]
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class ContestNotificationController
|
||||
def show
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class ContestNotification < ActiveRecord::Base
|
||||
attr_accessible :content, :title
|
||||
end
|
|
@ -36,9 +36,8 @@
|
|||
</p>
|
||||
<div style="margin-left:60px;padding-right: 20px;" id="notification">
|
||||
<label for='contest_description' style="vertical-align: top"> </label>
|
||||
<% 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' %>
|
||||
</div>
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %>
|
||||
<div class="clear avatar_user">
|
||||
<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>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
|
@ -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> <span style='color: #1166AD'>消灭那怪兽</span></div>
|
||||
<div><span style='color: red'>二等奖:</span> <span style='color: #1166AD'>兄弟向前冲 </span></div>
|
||||
<div><span style='color: red'>二等奖:</span> <span style='color: #1166AD'>鸟鸟文件管理器(银河之光版)</span></div>
|
||||
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>疯狂猜图</span></div>
|
||||
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>愉快的定向越野 </span></div>
|
||||
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>体能训练助手 </span></div>
|
||||
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>迷你日记本 </span></div>
|
||||
<div><span style='color: red'>三等奖:</span> <span style='color: #1166AD'>永齐飞机大战</span></div>"
|
||||
notification.save
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue