Commit 278813ae authored by 神楽坂玲奈's avatar 神楽坂玲奈

主题管理初步

git-svn-id: http://glupx.googlecode.com/svn/trunk/Reliz@31 189f022a-1064-8ae2-3e6f-c4a67275c50b
parent 4f8d7508
......@@ -40,7 +40,6 @@ GEM
treetop (~> 1.4.8)
mime-types (1.16)
mysql (2.8.1-x86-mingw32)
mysql (2.8.1-x86-mswin32)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
......
class ModcpController < ApplicationController
def delete
end
def displayorder
end
def highlight
end
def digest
end
def lock
end
def move
end
def merge
end
def split
end
end
......@@ -94,4 +94,44 @@ class TopicsController < ApplicationController
format.xml { head :ok }
end
end
#主题管理:
#删除:/topic/control?id=1&deleted=1
#反删除:/topic/control?id=1&deleted=0
#置顶 3 /topic/control?id=1&displayorder=3
#沉底 /topic/control?id=1&displayorder=-1
#恢复正常排序 /topic/control?id=1&displayorder=-1
#高亮 /topic/control?id=1&highlight= //TODO
#精华 3 /topic/control?id=1&digest=3
#取消精华 /topic/control?id=1&digest=0
#锁定 /topic/control?id=1&locked=1
#打开 /topic/control?id=1&locked=0
#移动 /topic/control?id=1&category_id=1
#分类 /topic/control?id=1&type_id=1
#以上操作可以多重进行
#例如把1,2,3号id的主题进行精华3和置顶1
#/topic/control?id=1,2,3&digest=3&displayorder=1
Data_Control = ['deleted', 'displayorder', 'highlight', 'digest', 'locked', 'category_id', 'type_id']
def control
if params['id']
id = params['id'].split(/,/)
return if id.empty?
else
return
end
data_control = {}
Data_Control.each do |key| #喵你妹的Hash不带交集运算
data_control[key] = params[key] if params[key]
end
unless data_control.empty?
@topics = Topic.update_all(data_control, {:id => id})
end
if params['merge']
#TODO
end
if params['split']
#TODO
end
end
end
module ModcpHelper
end
<h1>Modcp#delete</h1>
<p>Find me in app/views/modcp/delete.html.erb</p>
<h1>Modcp#digest</h1>
<p>Find me in app/views/modcp/digest.html.erb</p>
<h1>Modcp#displayorder</h1>
<p>Find me in app/views/modcp/displayorder.html.erb</p>
<h1>Modcp#highlight</h1>
<p>Find me in app/views/modcp/highlight.html.erb</p>
<h1>Modcp#lock</h1>
<p>Find me in app/views/modcp/lock.html.erb</p>
<h1>Modcp#merge</h1>
<p>Find me in app/views/modcp/merge.html.erb</p>
<h1>Modcp#modcp</h1>
<p>Find me in app/views/modcp/modcp.html.erb</p>
<h1>Modcp#move</h1>
<p>Find me in app/views/modcp/move.html.erb</p>
<h1>Modcp#split</h1>
<p>Find me in app/views/modcp/split.html.erb</p>
<%#
# To change this template, choose Tools | Templates
# and open the template in the editor.
%>
<%= @info.inspect %>
......@@ -8,7 +8,7 @@
development:
adapter: mysql
reconnect: false
database: Reliz
database: reliz
pool: 5
username: zh99998-test
password: zh99998
......
Reliz::Application.routes.draw do
resources :moderations
resources :boards
resources :moderations
resources :boards
root :to => 'boards#index'
resources :users
......@@ -14,14 +14,18 @@ Reliz::Application.routes.draw do
match 'forum/:id/(/:page)' => 'boards#show', :id => /\d+/, :page => /\d+/
resources :posts
match 'forum/:topic_id/new' => 'posts#new', :topic_id => /\d+/ #·¢±í»Ø¸´
match 'forum/:topic_id/new' => 'posts#new', :topic_id => /\d+/ #����ظ�
resources :topics
match 'topic/:id/(/:page)' => 'topics#show', :id => /\d+/, :page => /\d+/
match 'forum/:forum_id/new' => 'topics#new', :forum_id => /\d+/ #·¢±íÖ÷Ìâ
match 'forum/:forum_id/new' => 'topics#new', :forum_id => /\d+/ #
get 'topic/control' => 'topics#control'
match ':something/:anything', :controller => 'application', :action => 'redirect_to_thc', :something => /forum|boards|topic|topics|posts/, :anything => /.*/
match '/:anything', :controller => 'application', :action => 'redirect_to_thc', :anything => /.*/
# The priority is based upon order of creation:
# first created -> highest priority.
......
......@@ -9,9 +9,11 @@ class CreateTopics < ActiveRecord::Migration
t.integer :views
t.integer :readperm
t.boolean :locked
t.boolean :deleted
t.boolean :reverse
t.boolean :private
t.timestamps
end
end
......
......@@ -25,18 +25,6 @@ ActiveRecord::Schema.define(:version => 20101226125042) do
t.datetime "updated_at"
end
create_table "boards_copy", :force => true do |t|
t.integer "super_id"
t.string "name"
t.text "introduction"
t.text "notice"
t.string "logo"
t.string "banner"
t.integer "readperm"
t.integer "topicperm"
t.integer "postperm"
end
create_table "comments", :force => true do |t|
t.integer "post_id"
t.integer "user_id"
......@@ -45,14 +33,6 @@ ActiveRecord::Schema.define(:version => 20101226125042) do
t.datetime "updated_at"
end
create_table "comments_copy", :force => true do |t|
t.integer "post_id"
t.integer "user_id"
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "moderations", :force => true do |t|
t.integer "user_id"
t.integer "association_id"
......@@ -73,16 +53,6 @@ ActiveRecord::Schema.define(:version => 20101226125042) do
t.datetime "updated_at"
end
create_table "notices_copy", :force => true do |t|
t.integer "user_id"
t.string "type"
t.integer "assocaion_id"
t.string "assocaion_type"
t.integer "from_user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "pms", :force => true do |t|
t.integer "user_id"
t.integer "from_user_id"
......@@ -91,14 +61,6 @@ ActiveRecord::Schema.define(:version => 20101226125042) do
t.datetime "updated_at"
end
create_table "pms_copy", :force => true do |t|
t.integer "user_id"
t.integer "from_user_id"
t.text "content"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "posts", :force => true do |t|
t.integer "topic_id"
t.integer "user_id"
......@@ -113,25 +75,6 @@ ActiveRecord::Schema.define(:version => 20101226125042) do
t.datetime "updated_at"
end
create_table "posts_copy", :force => true do |t|
t.integer "topic_id"
t.integer "user_id"
t.text "content"
t.integer "displayorder"
t.integer "readperm"
t.boolean "private"
t.boolean "anonymous"
t.boolean "ubb"
t.boolean "html"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "schema_migrations_copy", :primary_key => "version", :force => true do |t|
end
add_index "schema_migrations_copy", ["version"], :name => "unique_schema_migrations", :unique => true
create_table "topics", :force => true do |t|
t.integer "user_id"
t.integer "type_id"
......@@ -148,22 +91,6 @@ ActiveRecord::Schema.define(:version => 20101226125042) do
t.datetime "updated_at"
end
create_table "topics_copy", :force => true do |t|
t.integer "user_id"
t.integer "type_id"
t.integer "category_id"
t.string "category_type"
t.string "name"
t.integer "displayorder"
t.integer "views"
t.integer "readperm"
t.boolean "locked"
t.boolean "reverse"
t.boolean "private"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", :force => true do |t|
t.string "name"
t.string "nickname"
......@@ -189,29 +116,4 @@ ActiveRecord::Schema.define(:version => 20101226125042) do
t.datetime "updated_at"
end
create_table "users_copy", :force => true do |t|
t.string "name"
t.string "nickname"
t.string "password"
t.string "email"
t.integer "usergroup_id"
t.integer "admingroup_id"
t.string "regip"
t.string "lastloginip"
t.integer "readnum"
t.integer "viewnum"
t.integer "onlinetime"
t.integer "credit"
t.integer "credit1"
t.integer "credit2"
t.integer "credit3"
t.integer "credit4"
t.integer "credit5"
t.integer "credit6"
t.integer "credit7"
t.integer "credit8"
t.datetime "created_at"
t.datetime "updated_at"
end
end
This source diff could not be displayed because it is too large. You can view the blob instead.
require 'test_helper'
class ModcpControllerTest < ActionController::TestCase
test "should get delete" do
get :delete
assert_response :success
end
test "should get displayorder" do
get :displayorder
assert_response :success
end
test "should get highlight" do
get :highlight
assert_response :success
end
test "should get digest" do
get :digest
assert_response :success
end
test "should get lock" do
get :lock
assert_response :success
end
test "should get move" do
get :move
assert_response :success
end
test "should get merge" do
get :merge
assert_response :success
end
test "should get split" do
get :split
assert_response :success
end
end
require 'test_helper'
class ModcpHelperTest < ActionView::TestCase
end
4656
\ No newline at end of file
6100
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment