Commit 9bbaf7c0 authored by 神楽坂玲奈's avatar 神楽坂玲奈

父版块 子版块支持,夜露only

git-svn-id: http://glupx.googlecode.com/svn/trunk/Reliz@72 189f022a-1064-8ae2-3e6f-c4a67275c50b
parent dceca8d0
......@@ -5,7 +5,8 @@ class BoardsController < ApplicationController
# GET /boards
# GET /boards.xml
def index
@boards = Board.all#[Board.find(1)]#_all_by_id 1
@board = Board.root
@boards = @board.subboards
@actions = []
respond_to do |format|
format.html # index.html.erb
......
......@@ -49,11 +49,9 @@ class UsersController < ApplicationController
respond_to do |format|
if @user.save
session[:user_id] = @user.id
#p session
format.html { redirect_to(@user, :notice => 'User was successfully created.') }
format.html { redirect_to(:root, :notice => 'User was successfully created.') }
format.xml { render :xml => @user, :status => :created, :location => @user }
else
#return render :text => [@user.errors.class, @user.errors]
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
......
class Board < ActiveRecord::Base
belongs_to :superboard, :foreign_key => :super_id, :class_name => "::Board"
has_many :subboards, :foreign_key => :super_id, :class_name => "::Board"#, :as => :boards
#why it doesn't work?
belongs_to :superboard, :class_name => "::Board"
has_many :subboards, :foreign_key => :superboard_id, :class_name => "::Board"
has_many :topics, :foreign_key => :category_id
has_many :posts, :through =>:topics
default_scope order(:displayorder)
def to_s
"<a href=\"/boards/#{id}\">#{name}</a>".html_safe
end
def logo_url
read_attribute(:logo)
end
def logo
"<a href=\"/boards/#{id}\"><img src=\"#{logo_url}\"/></a>".html_safe
end
#alias topics_with_deleted topics
#def topics
# topics_with_deleted.where({:deleted => false}).order('').order('name')
#def logo_url
# read_attribute(:logo)
#end
#def superboard
# board
#end
#def subboards
# p "-------------------------"
# p boards
# boards
#
#def logo
# "<a href=\"/boards/#{id}\"><img src=\"#{logo_url}\"/></a>".html_safe
#end
def self.root
Board.find_by_superboard_id 0
end
end
<div id="wrapper">
<div id="wrap" class="wrap s_clear">
<div class="itemtitle s_clear">
<p class="right boardcount">
<%=t 'datetime.today' %>: <em><%= Post.today.count %> </em>,
<%=t 'datetime.yesterday' %>: <em><%= Post.yesterday.count %></em>,
<%=t 'stat.total' %>: <em><%= Post.count %></em>
</p>
</div><div class="mainbox list">
<span class="headactions">
<%= image_tag 'common/collapsed_no.gif', :id => 'category_3_img', :title => 'sq/zk '%>
<div class="itemtitle s_clear">
<p class="right boardcount">
<%=t 'datetime.today' %>: <em><%= Post.today.count %> </em>,
<%=t 'datetime.yesterday' %>: <em><%= Post.yesterday.count %></em>,
<%=t 'stat.total' %>: <em><%= Post.count %></em>
</p>
</div>
<% @boards.each do |superboard| %>
<div class="mainbox list">
<span class="headactions">
<%= image_tag 'common/collapsed_no.gif', :id => 'category_3_img', :title => 'sq/zk '%>
</span>
</span>
<%# @boards.each do |area| %>
<%# next if area.subboards.empty? %>
<h3><a href="index.php?gid=3" style="">测试版块</a></h3>
<table id="category_3" summary="category3" cellspacing="0" cellpadding="0" style="">
<% @boards.each do |board| %>
<tbody id="board<%= board.id %>">
<tr>
<th>
<%= board.logo %>
<div class="left">
<h2><%= board %></h2>
<p><%= board.introduction %></p></div>
</th>
<td class="boardnums">
<em><%= board.topics.size %></em> / <%= board.posts.size %></td>
<td class="boardlast">
<% if board.topics.last %>
<p><%= board.topics.last %></p>
<cite><%= board.posts.last.user %> - <span title="<%= board.posts.last.updated_at %>"><%=l board.posts.last.updated_at, :format => :short %></span></cite>
<% else %>
none
<% end %>
</td>
</tr>
</tbody>
<% end %>
</table>
</div>
<%# end %>
<div id="ad_intercat_16"></div>
<div class="mainbox list">
<span class="headactions">
<%= image_tag 'common/collapsed_no.gif' %>
<h3>link</h3>
<div id="boardlinks" style="">
</div>
</div>
<div class="mainbox list" id="online">
<span class="headactions"><a href="index.php?showoldetails=yes#online" class="nobdr"><%= image_tag 'common/collapsed_yes.gif' %></a></span>
<h3><%= superboard %></h3>
<table id="category_<%= superboard.id %> " summary="category<%= superboard.id %>" cellspacing="0" cellpadding="0" style="">
<% superboard.subboards.each do |board| %>
<tbody id="board<%= board.id %>">
<tr>
<th>
<%= image_tag board.logo, :style => "float:left; margin-right: 10px" %>
<div class="left">
<h3>
<%= render 'layouts/onlineuserbar' %>
</h3>
</div>
<h2><%= board %></h2>
<p><%= board.introduction %></p>
<% unless board.subboards.empty? %>
<p><%=t 'board.subboard' %>:
<% board.subboards.each do |subboard| %>
<%= subboard %>
<% end %>
</p>
<% end %>
</div>
</th>
<td class="boardnums">
<em><%= board.topics.size %></em> / <%= board.posts.size %></td>
<td class="boardlast">
<% if board.topics.last %>
<p><%= board.topics.last %></p>
<cite><%= board.posts.last.user %> - <span title="<%= board.posts.last.updated_at %>"><%=l board.posts.last.updated_at, :format => :short %></span></cite>
<% else %>
<%=t 'board.none' %>
<% end %>
</td>
</tr>
</tbody>
<% end %>
</table>
</div>
<% end %>
<div id="ad_intercat_16"></div>
<div class="mainbox list">
<span class="headactions">
<%= image_tag 'common/collapsed_no.gif' %>
<h3>link</h3>
<div id="boardlinks" style="">
</div>
</div>
<div class="mainbox list" id="online">
<span class="headactions"><a href="index.php?showoldetails=yes#online" class="nobdr"><%= image_tag 'common/collapsed_yes.gif' %></a></span>
<h3>
<%= render 'layouts/onlineuserbar' %>
</h3>
</div>
</div>
\ No newline at end of file
<h1>New board</h1>
<%= form_for(@board) do |f| %>
<% if @board.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@board.errors.count, "error") %> prohibited this board from being saved:</h2>
<%= render 'form' %>
<ul>
<% @board.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= link_to 'Back', boards_path %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :introduction %><br />
<%= f.text_area :introduction %>
</div>
<div class="field">
<%= f.label :notice %><br />
<%= f.text_area :notice %>
</div>
<div class="field">
<%= f.label :logo %><br />
<%= f.text_field :logo %>
</div>
<div class="field">
<%= f.label :banner %><br />
<%= f.text_field :banner %>
</div>
<div class="field">
<%= f.label :readperm %><br />
<%= f.text_field :readperm %>
</div>
<div class="field">
<%= f.label :topicperm %><br />
<%= f.text_field :topicperm %>
</div>
<div class="field">
<%= f.label :postperm %><br />
<%= f.text_field :postperm %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
<div id="wrapper">
<div id="wrap" class="wrap s_clear">
<div class="main">
<div class="content">
......@@ -144,4 +143,3 @@
</div><ul class="popupmenu_popup headermenu_popup" id="plugin_menu" style="display: none"> <li><a id="mn_plugin_family_family" href="plugin.php?id=family:family">家族门派</a></li>
</ul>
<ul class="popupmenu_popup headermenu_popup" id="1nNcin_menu" style="display: none"><li><a href="plugin.php?id=moodwall" hidefocus="true" >心情墙壁</a></li><li><a href="plugin.php?id=dps_medalcenter" hidefocus="true" >勋章中心</a></li><li><a href="magic.php" hidefocus="true" >道具中心</a></li><li><a href="plugin.php?id=rs_sign:sign" hidefocus="true" >每日签到</a></li><li><a href="pet.php" hidefocus="true" >口袋东方</a></li><li><a href="plugin.php?id=promotion:promotion" hidefocus="true" >宣传中心</a></li><li><a href="bank.php" hidefocus="true" >社区银行</a></li><li><a href="plugin.php?id=family:family" hidefocus="true" >家族领地</a></li></ul>
</div>
\ No newline at end of file
<!--<h1>Glupx</h1>
<h2><%#= @actions.shift %>
<%# @actions.each do |action| %>
- <%#= action %>
<%# end %></h2>-->
<body id="index" onkeydown="if(event.keyCode==27) return false;">
<div id="append_parent"></div><div id="ajaxwaitid"></div>
<div id="topbar" name="TOP">
<div class="topanel">
<div id="memberp">
<%= render 'layouts/userbar' %>
</div>
<%= render 'layouts/searchbar' %>
</div>
<div class="topanel">
<div id="memberp">
<%= render 'layouts/userbar' %>
</div>
<%= render 'layouts/searchbar' %>
</div>
</div>
<div id="headerbg">
<div class="header">
<embed src="<%= image_path('common/banner.swf') %>" quality="high" wmode="transparent" style=" float:left; " pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="898" height="116"></embed>
<div id="ad_headerbanner"></div>
</div>
<div id="dmenu">
<div class="bg-dmenuleft"></div>
<div class="bg-dmenu" style="position: relative;">
<div id="menu">
<%= render "layouts/navibar" %>
</div>
<div id="style_switch">
<%= render 'layouts/themebar' %>
<div class="header">
<embed src="<%= image_path('common/banner.swf') %>" quality="high" wmode="transparent" style=" float:left; " pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="898" height="116"></embed>
<div id="ad_headerbanner"></div>
</div>
</div>
</div>
<div id="myprompt_menu" style="display:none" class="promptmenu">
<div class="promptcontent">
<div id="dmenu">
<div class="bg-dmenuleft"></div>
<div class="bg-dmenu" style="position: relative;">
<div id="menu">
<%= render "layouts/navibar" %>
</div>
<div id="style_switch">
<%= render 'layouts/themebar' %>
</div>
<ul class="s_clear"><li style="display:none"><!--<a id="prompt_pm" href="pm.php?filter=newpm" target="_blank">private (0)</a> TODO--></li><li style="display:none"><a id="prompt_announcepm" href="pm.php?filter=announcepm" target="_blank">public (0)</a></li><li style="display:none"><a id="prompt_systempm" href="notice.php?filter=systempm" target="_blank">system (0)</a></li><li style="display:none"><a id="prompt_friend" href="notice.php?filter=friend" target="_blank">friend (0)</a></li><li style="display:none"><a id="prompt_threads" href="notice.php?filter=threads" target="_blank">post (0)</a></li></ul>
</div>
</div>
</div>
</div>
<div id="myprompt_menu" style="display:none" class="promptmenu">
<div class="promptcontent">
<ul class="s_clear"><li style="display:none"><!--<a id="prompt_pm" href="pm.php?filter=newpm" target="_blank">private (0)</a> TODO--></li><li style="display:none"><a id="prompt_announcepm" href="pm.php?filter=announcepm" target="_blank">public (0)</a></li><li style="display:none"><a id="prompt_systempm" href="notice.php?filter=systempm" target="_blank">system (0)</a></li><li style="display:none"><a id="prompt_friend" href="notice.php?filter=friend" target="_blank">friend (0)</a></li><li style="display:none"><a id="prompt_threads" href="notice.php?filter=threads" target="_blank">post (0)</a></li></ul>
</div>
</div>
</div>
<div id="nav">
<%= render 'layouts/actionbar' %>
<%= render 'layouts/actionbar' %>
</div>
<div id="ad_text"></div>
\ No newline at end of file
<div id="wrapper">
<ul class="popupmenu_popup headermenu_popup inlinelist" id="modopt_menu" style="width: 180px; display: none"><li class="wide"><a href="javascript:;" onclick="modthreads(3, 'delete')">删除主题</a></li><li class="wide"><a href="javascript:;" onclick="modthreads(3, 'down')">提升下沉</a></li><li class="wide"><a href="javascript:;" onclick="modthreads(1, 'stick')">主题置顶</a></li><li class="wide"><a href="javascript:;" onclick="modthreads(1, 'highlight')">高亮显示</a></li><li class="wide"><a href="javascript:;" onclick="modthreads(1, 'digest')">设置精华</a></li><li class="wide"><a href="javascript:;" onclick="modaction('stamp')">主题鉴定</a></li><li class="wide"><a href="javascript:;" onclick="modthreads(4)">关闭打开</a></li><li class="wide"><a href="javascript:;" onclick="modthreads(2, 'move')">移动主题</a></li><li class="wide"><a href="javascript:;" onclick="modthreads(2, 'type')">主题分类</a></li><li class="wide"><a href="javascript:;" onclick="modaction('copy')">复制主题</a></li><li class="wide"><a href="javascript:;" onclick="modaction('merge')">合并主题</a></li><li class="wide"><a href="javascript:;" onclick="modaction('split')">分割主题</a></li><li class="wide"><a href="javascript:;" onclick="modaction('repair')">修复主题</a></li><li class="wide"><a href="plugin.php?id=dps_postawards:postawards&amp;tid=29727" onclick="showWindow('paward', this.href);return false;">楼层奖惩</a></li></ul>
<div id="modlayer" style="display:none;position:position;width:165px;">
<span>选中</span><strong id="modcount"></strong><span>篇: </span>
......@@ -226,4 +225,3 @@
<div id="ad_footerbanner1"></div><div id="ad_footerbanner2"></div><div id="ad_footerbanner3"></div>
<script>$('umenu').innerHTML = '<span id="myrepeats" onmouseover="showMenu(this.id)">[切换]</span>' + $('umenu').innerHTML;</script><ul id="myrepeats_menu" class="popupmenu_popup" style="display:none;"><li class="wide"><a href="plugin.php?id=myrepeats:switch&amp;username=%B2%A4%C2%DC%B0%FC">菠萝包</a></li><li class="wide" style="clear:both"><a href="plugin.php?id=myrepeats:memcp">设置马甲</a></li></ul></div>
</div>
\ No newline at end of file
......@@ -36,6 +36,8 @@ zh-CN:
submit: "提交"
topic: "主题"
post: "回复"
none: "从未"
subboard: "子版快"
search:
search: "搜索"
advanced: "高级搜索"
......
class CreateBoards < ActiveRecord::Migration
def self.up
drop_table :boards if self.table_exists?(:boards)
create_table :boards do |t|
t.string :name, :default => '', :null => false
t.references :superboard, :null => false
t.integer :displayorder, :default => '0', :null => false
t.text :introduction, :default => '', :null => false
t.text :notice, :default => '', :null => false
t.string :logo, :default => '', :null => false
......@@ -9,7 +13,7 @@ class CreateBoards < ActiveRecord::Migration
t.integer :readperm, :default => 0, :null => false
t.integer :topicperm, :default => 0, :null => false
t.integer :postperm, :default => 0, :null => false
#t.reference :
t.timestamps
end
......
class DemoData < ActiveRecord::Migration
def self.up
Board.create :id => 1,
:superboard_id => 0,
:name => "综合讨论中心"
Board.create :id => 2,
:superboard_id => 1,
:name => "测试版块",
:introduction => "版块简介",
:notice => "版块公告",
:logo => "http://bbs.66rpg.com/data/attachment/common/skin/VX.png",
:banner => "http://ftp.66rpg.com/WEB_PLUS/attachment/forum/201104/24/221009dzbmkp6666pp3mue.jpg"
end
def self.down
end
end
......@@ -10,17 +10,18 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111036031160) do
ActiveRecord::Schema.define(:version => 20111042572025) do
create_table "boards", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "introduction", :null => false
t.text "notice", :null => false
t.string "logo", :default => "", :null => false
t.string "banner", :default => "", :null => false
t.integer "readperm", :default => 0, :null => false
t.integer "topicperm", :default => 0, :null => false
t.integer "postperm", :default => 0, :null => false
t.string "name", :default => "", :null => false
t.text "introduction", :null => false
t.text "notice", :null => false
t.string "logo", :default => "", :null => false
t.string "banner", :default => "", :null => false
t.integer "readperm", :default => 0, :null => false
t.integer "topicperm", :default => 0, :null => false
t.integer "postperm", :default => 0, :null => false
t.integer "superboard_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
5380
\ No newline at end of file
1108
\ 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