Commit 6dd8020e authored by 神楽坂玲奈's avatar 神楽坂玲奈

论坛界面大量修正,版主初步

parent e8ff0271
source 'https://rubygems.org'
source 'http://rubygems.org'
gem 'rails', '3.2.2'
gem "activerecord-import", ">= 0.2.0"
......
GEM
remote: https://rubygems.org/
remote: http://rubygems.org/
specs:
actionmailer (3.2.2)
actionpack (= 3.2.2)
......
app/assets/images/common/forum.gif

1.28 KB | W: | H:

app/assets/images/common/forum.gif

3.25 KB | W: | H:

app/assets/images/common/forum.gif
app/assets/images/common/forum.gif
app/assets/images/common/forum.gif
app/assets/images/common/forum.gif
  • 2-up
  • Swipe
  • Onion skin
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
//= require jquery.markitup
//= require jquery.markitup.set
\ No newline at end of file
This diff is collapsed.
Markup language:
BBCode
Description:
A basic BBCode markup set with Bold, Italic, Underline, Picture, Link, Size, List, Quotes, Code, Clean button, Preview button.
Install:
- Download the zip file
- Unzip it in your markItUp! sets folder
- Modify your JS link to point at this set.js
- Modify your CSS link to point at this style.css
\ No newline at end of file
// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2011 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Html tags
// http://en.wikipedia.org/wiki/html
// ----------------------------------------------------------------------------
// Basic set. Feel free to add more tags
// ----------------------------------------------------------------------------
var mySettings = {
onShiftEnter: {keepDefault:false, replaceWith:'<br />\n'},
onCtrlEnter: {keepDefault:false, openWith:'\n<p>', closeWith:'</p>'},
onTab: {keepDefault:false, replaceWith:' '},
markupSet: [
{name:'Bold', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
{name:'Italic', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
{name:'Stroke through', key:'S', openWith:'<del>', closeWith:'</del>' },
{separator:'---------------' },
{name:'Bulleted List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ul>\n', closeBlockWith:'\n</ul>'},
{name:'Numeric List', openWith:' <li>', closeWith:'</li>', multiline:true, openBlockWith:'<ol>\n', closeBlockWith:'\n</ol>'},
{separator:'---------------' },
{name:'Picture', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
{name:'Link', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
{separator:'---------------' },
{name:'Clean', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
{name:'Preview', className:'preview', call:'preview'}
]
}
/* -------------------------------------------------------------------
// markItUp!
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
.markItUp .markItUpButton1 a {
background-image:url(images/bold.png);
}
.markItUp .markItUpButton2 a {
background-image:url(images/italic.png);
}
.markItUp .markItUpButton3 a {
background-image:url(images/stroke.png);
}
.markItUp .markItUpButton4 a {
background-image:url(images/list-bullet.png);
}
.markItUp .markItUpButton5 a {
background-image:url(images/list-numeric.png);
}
.markItUp .markItUpButton6 a {
background-image:url(images/picture.png);
}
.markItUp .markItUpButton7 a {
background-image:url(images/link.png);
}
.markItUp .markItUpButton8 a {
background-image:url(images/clean.png);
}
.markItUp .preview a {
background-image:url(images/preview.png);
}
/* -------------------------------------------------------------------
// markItUp! Universal MarkUp Engine, JQuery plugin
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
.markItUp * {
margin:0px; padding:0px;
outline:none;
}
.markItUp a:link,
.markItUp a:visited {
color:#000;
text-decoration:none;
}
.markItUp {
width:700px;
margin:5px 0 5px 0;
border:5px solid #F5F5F5;
}
.markItUpContainer {
border:1px solid #3C769D;
background:#FFF url(images/bg-container.png) repeat-x top left;
padding:5px 5px 2px 5px;
font:11px Verdana, Arial, Helvetica, sans-serif;
}
.markItUpEditor {
font:12px 'Courier New', Courier, monospace;
padding:5px 5px 5px 35px;
border:3px solid #3C769D;
width:643px;
height:320px;
background:#FFF url(images/bg-editor.png) no-repeat;
clear:both;
line-height:18px;
overflow:auto;
}
.markItUpPreviewFrame {
overflow:auto;
background-color:#FFFFFF;
border:1px solid #3C769D;
width:99.9%;
height:300px;
margin:5px 0;
}
.markItUpFooter {
width:100%;
cursor:n-resize;
}
.markItUpResizeHandle {
overflow:hidden;
width:22px; height:5px;
margin-left:auto;
margin-right:auto;
background-image:url(images/handle.png);
cursor:n-resize;
}
/***************************************************************************************/
/* first row of buttons */
.markItUpHeader ul li {
list-style:none;
float:left;
position:relative;
}
.markItUpHeader ul li ul{
display:none;
}
.markItUpHeader ul li:hover > ul{
display:block;
}
.markItUpHeader ul .markItUpDropMenu {
background:transparent url(images/menu.png) no-repeat 115% 50%;
margin-right:5px;
}
.markItUpHeader ul .markItUpDropMenu li {
margin-right:0px;
}
.markItUpHeader ul .markItUpSeparator {
margin:0 10px;
width:1px;
height:16px;
overflow:hidden;
background-color:#CCC;
}
.markItUpHeader ul ul .markItUpSeparator {
width:auto; height:1px;
margin:0px;
}
/* next rows of buttons */
.markItUpHeader ul ul {
display:none;
position:absolute;
top:18px; left:0px;
background:#F5F5F5;
border:1px solid #3C769D;
height:inherit;
}
.markItUpHeader ul ul li {
float:none;
border-bottom:1px solid #3C769D;
}
.markItUpHeader ul ul .markItUpDropMenu {
background:#F5F5F5 url(images/submenu.png) no-repeat 100% 50%;
}
/* next rows of buttons */
.markItUpHeader ul ul ul {
position:absolute;
top:-1px; left:150px;
}
.markItUpHeader ul ul ul li {
float:none;
}
.markItUpHeader ul a {
display:block;
width:16px; height:16px;
text-indent:-10000px;
background-repeat:no-repeat;
padding:3px;
margin:0px;
}
.markItUpHeader ul ul a {
display:block;
padding-left:0px;
text-indent:0;
width:120px;
padding:5px 5px 5px 25px;
background-position:2px 50%;
}
.markItUpHeader ul ul a:hover {
color:#FFF;
background-color:#3C769D;
}
/***************************************************************************************/
.html .markItUpEditor {
background-image:url(images/bg-editor-html.png);
}
.markdown .markItUpEditor {
background-image:url(images/bg-editor-markdown.png);
}
.textile .markItUpEditor {
background-image:url(images/bg-editor-textile.png);
}
.bbcode .markItUpEditor {
background-image:url(images/bg-editor-bbcode.png);
}
.wiki .markItUpEditor,
.dotclear .markItUpEditor {
background-image:url(images/bg-editor-wiki.png);
}
\ No newline at end of file
/* preview style examples */
body {
background-color:#EFEFEF;
font:70% Verdana, Arial, Helvetica, sans-serif;
}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>markItUp! preview template</title>
<link rel="stylesheet" type="text/css" href="~/templates/preview.css" />
</head>
<body>
<!-- content -->
</body>
</html>
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
//= require jquery.markitup
//= require jquery.markitup.set
\ No newline at end of file
// Place all the styles related to the cards controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
//= require markitup
//= require markitup.set
#topic_name{
width:300px;
height:25px;
margin:0 0 10px 20px;
border:0px;
border-radius:5px;
box-shadow:0 0 5px #a7a7a7;
}
#topic_name:focus{
box-shadow:0 0 5px #5785A7 !important;
}
#topic_name:hover{
box-shadow:0 0 5px #939393;
}
This diff is collapsed.
......@@ -55,6 +55,7 @@ FOOTER .main{
#bar{
float:right;
width:200px;
overflow:auto;
}
.online{
font-size:13px;
......
......@@ -2,6 +2,7 @@
// markItUp! Universal MarkUp Engine, JQuery plugin
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
.markItUp * {
margin:0px; padding:0px;
outline:none;
......@@ -13,15 +14,22 @@
}
.markItUp {
width:700px;
margin:5px 0 5px 0;
margin:5px 0 5px 0;
padding:5px;
box-shadow:0 0 5px #8e8e8e;
border-radius:5px;
}
.markItUpHeader ul {
border-bottom:1px dashed #a7a7a7;
height:20px;
}
.markItUpContainer {
.markItUpContainer {
padding:5px 5px 2px 5px;
font:11px Verdana, Arial, Helvetica, sans-serif;
}
.markItUpEditor {
font:12px 'Courier New', Courier, monospace;
padding:5px;
width:690px;
border:0px;
height:320px;
clear:both;
line-height:18px;
......@@ -29,22 +37,27 @@
}
.markItUpPreviewFrame {
overflow:auto;
background-color:#FFF;
background-color:#FFFFFF;
border:1px solid #3C769D;
width:99.9%;
height:300px;
margin:5px 0;
}
.markItUpFooter {
width:100%;
cursor:n-resize;
}
.markItUpResizeHandle {
overflow:hidden;
width:22px; height:5px;
margin-left:auto;
margin-right:auto;
background-image:url(images/handle.png);
background-image:image-url("markitup/handle.png");
cursor:n-resize;
}
.markItUpContainer textarea{
width:100%;
}
/***************************************************************************************/
/* first row of buttons */
.markItUpHeader ul li {
......@@ -52,31 +65,19 @@
float:left;
position:relative;
}
.markItUpHeader ul li ul{
display:none;
}
.markItUpHeader ul li:hover > ul{
display:block;
}
.markItUpHeader ul .markItUpDropMenu {
background:transparent url(images/menu.png) no-repeat 115% 50%;
background:transparent image-url("markitup/menu.png") no-repeat 115% 50%;
margin-right:5px;
}
.markItUpHeader ul .markItUpDropMenu li {
margin-right:0px;
}
/* next rows of buttons */
.markItUpHeader ul ul {
display:none;
position:absolute;
top:18px; left:0px;
background:#FFF;
border:1px solid #000;
}
.markItUpHeader ul ul li {
float:none;
border-bottom:1px solid #000;
}
.markItUpHeader ul ul .markItUpDropMenu {
background:#FFF url(images/submenu.png) no-repeat 100% 50%;
}
.markItUpHeader ul .markItUpSeparator {
margin:0 10px;
width:1px;
......@@ -89,9 +90,25 @@
margin:0px;
}
/* next rows of buttons */
.markItUpHeader ul ul {
display:none;
position:absolute;
top:18px; left:0px;
background:#F5F5F5;
border:1px solid #3C769D;
height:inherit;
}
.markItUpHeader ul ul li {
float:none;
border-bottom:1px solid #3C769D;
}
.markItUpHeader ul ul .markItUpDropMenu {
background:#F5F5F5 image-url("markitup/submenu.png") no-repeat 100% 50%;
}
/* next rows of buttons */
.markItUpHeader ul ul ul {
position:absolute;
top:-1px; left:150px;
top:-1px; left:150px;
}
.markItUpHeader ul ul ul li {
float:none;
......@@ -114,5 +131,5 @@
}
.markItUpHeader ul ul a:hover {
color:#FFF;
background-color:#000;
}
background-color:#3C769D;
}
\ No newline at end of file
......@@ -3,45 +3,45 @@
// By Jay Salvat - http://markitup.jaysalvat.com/
// ------------------------------------------------------------------*/
.markItUp .markItUpButton1 a {
background-image:url(images/bold.png);
background-image:image-url("markitup/bbcode/bold.png");
}
.markItUp .markItUpButton2 a {
background-image:url(images/italic.png);
background-image:image-url("markitup/bbcode/italic.png");
}
.markItUp .markItUpButton3 a {
background-image:url(images/underline.png);
background-image:image-url("markitup/bbcode/underline.png");
}
.markItUp .markItUpButton4 a {
background-image:url(images/picture.png);
background-image:image-url("markitup/bbcode/picture.png");
}
.markItUp .markItUpButton5 a {
background-image:url(images/link.png);
background-image:image-url("markitup/bbcode/link.png");
}
.markItUp .markItUpButton6 a {
background-image:url(images/fonts.png);
background-image:image-url("markitup/bbcode/fonts.png");
}
.markItUp .markItUpButton7 a {
background-image:url(images/list-bullet.png);
background-image:image-url("markitup/bbcode/list-bullet.png");
}
.markItUp .markItUpButton8 a {
background-image:url(images/list-numeric.png);
background-image:image-url("markitup/bbcode/list-numeric.png");
}
.markItUp .markItUpButton9 a {
background-image:url(images/list-item.png);
background-image:image-url("markitup/bbcode/list-item.png");
}
.markItUp .markItUpButton10 a {
background-image:url(images/quotes.png);
background-image:image-url("markitup/bbcode/quotes.png");
}
.markItUp .markItUpButton11 a {
background-image:url(images/code.png);
background-image:image-url("markitup/bbcode/code.png");
}
.markItUp .clean a {
background-image:url(images/clean.png);
background-image:image-url("markitup/bbcode/clean.png");
}
.markItUp .preview a {
background-image:url(images/preview.png);
background-image:image-url("markitup/bbcode/preview.png");
}
\ No newline at end of file
#modlayer{position:absolute;right:0;padding:12px;width:275px;background-color:#FFF;border:4px solid #7FCAE2;}#modlayer a{color:#09C;}#modlayer label{float:right;margin-top:5px;}#modcount{padding:0 2px;font-size:24px;font-weight:400;color:#F60;}#modlayer .collapse{position:absolute;right:0;top:5px;padding:0 5px;}#modlayer.collapsed{margin-right:-23px;padding:0;width:27px;height:35px;border:none;background:#F60;overflow:hidden;}#modlayer.collapsed #modcount{display:block;position:absolute;left:0;top:0;z-index:999;width:27px;height:35px;border-color:#09C;background-color:#09C;color:#FFF;font-size:12px;text-align:center;line-height:35px;cursor:pointer;}.listtopicadmin{margin:10px 0;border-top:1px solid #C5DAEB;}.listtopicadmin li{*overflow:hidden;*margin-bottom:-2px;height:28px;line-height:18px;border-top:1px solid #FFF;border-bottom:1px solid #C5DAEB;zoom:1;}.listtopicadmin .currentopt{height:auto;}.detailopt{visibility:hidden;overflow:hidden;white-space:nowrap;}.currentopt .detailopt{visibility:visible;}.detailopt p .txt{width:100px;}.detailopt span .txt{width:18px;border-right:none;}.detailopt a{float:left;text-indent:-999px;margin-right:3px;width:22px;height:20px;text-align:center;}.detailopt_bold,.detailopt_italic,.detailopt_underline{border:1px solid #F1F5FA;outline:none;}.detailopt .current{border:1px solid #999;background-color:#FFF;}.listtopicadmin table{width:100%;}.listtopicadmin td{vertical-align:top;}.listtopicadmin .labeltxt{display:block;cursor:pointer;width:100%;background:url(/images/common/arrow_down.gif) no-repeat 100% 8px;}.currentopt .labeltxt{float:left;cursor:default;width:45px;background:none;color:#09C;}.listtopicadmin .checkbox{margin-top:3px;*margin-top:-2px;}.listtopicadmin img{vertical-align:middle;}.tah_fixiesel{overflow:hidden;white-space:nowrap;width:217px;*border-right:1px solid #CCC;}.tah_fixiesel select{width:160px;*width:expression(this.offsetWidth > 180 ? 'auto':'180');}
\ No newline at end of file
// Place all the styles related to the moderators controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the cards controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
//= require markitup
//= require markitup.set
\ No newline at end of file
......@@ -17,13 +17,11 @@ class BoardsController < ApplicationController
# GET /boards/1
# GET /boards/1.xml
def show
@board = Board.find(params[:id])
@actions = [{Board.human_attribute_name(:index) => boards_path}, @board]
@actions = [@board]
order = params[:order].blank? ? 'displayorder DESC, updated_at DESC' : params[:order]
order = params[:order].blank? ? 'displayorder DESC, id DESC' : params[:order]
@topics = @board.topics.page(params[:page]).order(order)
#@topics = @board.topics.all(:offset => 20*@page-20, :limit => 20, :order => order)
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => params[:page] && !params[:page].empty? ? @topics : @board}
......
class ModeratorsController < ApplicationController
# GET /moderators
# GET /moderators.json
def index
@moderators = Moderator.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @moderators }
end
end
# GET /moderators/1
# GET /moderators/1.json
def show
@moderator = Moderator.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @moderator }
end
end
# GET /moderators/new
# GET /moderators/new.json
def new
@moderator = Moderator.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @moderator }
end
end
# GET /moderators/1/edit
def edit
@moderator = Moderator.find(params[:id])
end
# POST /moderators
# POST /moderators.json
def create
@moderator = Moderator.new(params[:moderator])
respond_to do |format|
if @moderator.save
format.html { redirect_to @moderator, notice: 'Moderator was successfully created.' }
format.json { render json: @moderator, status: :created, location: @moderator }
else
format.html { render action: "new" }
format.json { render json: @moderator.errors, status: :unprocessable_entity }
end
end
end
# PUT /moderators/1
# PUT /moderators/1.json
def update
@moderator = Moderator.find(params[:id])
respond_to do |format|
if @moderator.update_attributes(params[:moderator])
format.html { redirect_to @moderator, notice: 'Moderator was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @moderator.errors, status: :unprocessable_entity }
end
end
end
# DELETE /moderators/1
# DELETE /moderators/1.json
def destroy
@moderator = Moderator.find(params[:id])
@moderator.destroy
respond_to do |format|
format.html { redirect_to moderators_url }
format.json { head :no_content }
end
end
end
module ModeratorsHelper
end
......@@ -4,6 +4,7 @@ class Board < ActiveRecord::Base
has_many :subboards, :foreign_key => :superboard_id, :class_name => "Board"
has_many :topics, :foreign_key => :category_id
has_many :posts, :through =>:topics
has_and_belongs_to_many :moderators, :class_name => "User", :join_table => :moderators
default_scope order(:displayorder)
def to_s
......
class Moderator < ActiveRecord::Base
belongs_to :user
belongs_to :board
end
......@@ -6,10 +6,10 @@ class Post < ActiveRecord::Base
super || User::Guest
end
def self.today
Post.where(['created_at > ?', Date.today ])
Post.where(['created_at > ?', Time.now.beginning_of_day ])
end
def self.yesterday
Post.where(['created_at < ? and created_at > ?', Date.today, Date.today - 1 ])
Post.where(['created_at < ? and created_at > ?', Time.now.beginning_of_day, Time.now.yesterday.beginning_of_day ])
end
def to_s
"#{topic}, <a href=/topics/#{topic.id}#post#{id}>#{displayorder}#</a>".html_safe
......
......@@ -3,7 +3,7 @@ class Topic < ActiveRecord::Base
#belongs_to :type
belongs_to :board, :foreign_key => :category_id
has_many :posts
default_scope where(:deleted => false).order(:id).reverse_order
default_scope where(:deleted => false)
self.per_page = 20
alias category board
......
......@@ -4,15 +4,8 @@
<div id="boardheader" class="s_clear">
<h1 style=""><% @board.name %></h1>
<p class="boardstats">[ <strong><%= @board.topics.size %></strong> 主题 / <%= @board.posts.size %> 帖子]</p>
<div class="boardaction">
<!--<div class="right">
<a href="my.php?item=attention&amp;type=board&amp;action=add&amp;fid=68" id="ajax_attention" class="attention" onclick="ajaxmenu(this);doane(event);">关注</a>
<a href="my.php?item=favorites&amp;fid=68" id="ajax_favorite" onclick="ajaxmenu(this);doane(event);">收藏</a>
<a href="rss.php?fid=68&amp;auth=80baas4p%2BS%2FNnT%2BlQanrr%2Blzuk13j9xswULkRK6FhUrlnnrhZxiBsSc%2FwKk" target="_blank" class="feed">RSS</a></div>-->
</div>
<p class="channelinfo"><%= @board.notice %></p><p id="modedby">
版主: *空缺中*</p>
版主: <%=render @board.moderators %> </p>
</div>
<%= image_tag @board.banner %>
......@@ -105,12 +98,10 @@
<!--快速发帖-->
<%= form_tag :controller => :topics do %>
<p>
<div class="field" id="topic_name_field">
<%=t 'topic.title' %><%= text_field_tag "topic[name]" %>
</p>
<p>
</div>
<%= render 'topics/editor_lite' %>
</p>
<%= hidden_field_tag "topic[category_id]", @board.id%>
<%= hidden_field_tag "topic[category_type]", :board%>
<%= submit_tag t("topic.submit") %>
......
<%= form_tag :controller => :topics, :html => {id: search} do %>
<div id="search">
<%= form_tag topics_path do %>
<%= text_field_tag "keyword" %>
<%= submit_tag t("search.search") %>
<%= submit_tag t("search.search"), id: "search_submit" %>
<%= link_to t("search.advanced") %>
<% end %>
</div>
\ No newline at end of file
......@@ -10,12 +10,15 @@
<%= javascript_include_tag 'common' %>
<%= javascript_include_tag params[:controller] %>
<%= csrf_meta_tags %>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<!--TODO:首部待规范化-->
<div id="topbar" class="topanel">
<%= render 'entries/user' %>
<%= render 'entries/search' %>
<div id="top">
<%= render 'entries/user' %>
<%= render 'entries/search' %>
</div>
</div>
<header id="headerbg">
<div class="header">
......
<%= form_for(@moderator) do |f| %>
<% if @moderator.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@moderator.errors.count, "error") %> prohibited this moderator from being saved:</h2>
<ul>
<% @moderator.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :user %><br />
<%= f.text_field :user %>
</div>
<div class="field">
<%= f.label :board %><br />
<%= f.text_field :board %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
<h1>Editing moderator</h1>
<%= render 'form' %>
<%= link_to 'Show', @moderator %> |
<%= link_to 'Back', moderators_path %>
<h1>Listing moderators</h1>
<table>
<tr>
<th>User</th>
<th>Board</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @moderators.each do |moderator| %>
<tr>
<td><%= moderator.user %></td>
<td><%= moderator.board %></td>
<td><%= link_to 'Show', moderator %></td>
<td><%= link_to 'Edit', edit_moderator_path(moderator) %></td>
<td><%= link_to 'Destroy', moderator, confirm: 'Are you sure?', method: :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Moderator', new_moderator_path %>
<h1>New moderator</h1>
<%= render 'form' %>
<%= link_to 'Back', moderators_path %>
<p id="notice"><%= notice %></p>
<p>
<b>User:</b>
<%= @moderator.user %>
</p>
<p>
<b>Board:</b>
<%= @moderator.board %>
</p>
<%= link_to 'Edit', edit_moderator_path(@moderator) %> |
<%= link_to 'Back', moderators_path %>
......@@ -2,14 +2,6 @@
<% content ||= nil %>
<!-- 文本框name的值,看不明白的话不用更改,指定文本框name的时候直接调用name即可 -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<%= javascript_include_tag 'markitup/jquery.markitup.js' %>
<!-- markItUp! toolbar settings -->
<%= javascript_include_tag 'markitup/sets/bbcode/set.js' %>
<!-- markItUp! skin -->
<%= stylesheet_link_tag 'markitup/skins/markitup/style.css' %>
<!-- markItUp! toolbar skin -->
<%= stylesheet_link_tag "markitup/sets/bbcode/style.css" %>
<div class="editor_lite">
<%= text_area_tag name, content, :id => :fastpostmessage, :rows => 5, :cols => 80, :tabindex => 4, :class => :txtarea %>
<!--id和class直接对应于HTML码,从DZ的主题上遗留下来的,应该修改-->
......
<%= link_to user.name, user %>
MycardServerHttp::Application.routes.draw do
resources :moderators
resources :servers
resources :libraries
......
class CreateModerators < ActiveRecord::Migration
def change
create_table :moderators do |t|
t.references :user
t.references :board
t.timestamps
end
add_index :moderators, :user_id
add_index :moderators, :board_id
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120417233009) do
ActiveRecord::Schema.define(:version => 20120510085131) do
create_table "boards", :force => true do |t|
t.string "name", :default => "", :null => false
......@@ -76,11 +76,8 @@ ActiveRecord::Schema.define(:version => 20120417233009) do
t.string "replay"
t.integer "user1_credits"
t.integer "user2_credits"
t.integer "version"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "user1_public", :default => true, :null => false
t.boolean "user2_public", :default => true, :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "duels", ["user1_id"], :name => "index_duels_on_user1_id"
......@@ -127,6 +124,16 @@ ActiveRecord::Schema.define(:version => 20120417233009) do
t.datetime "updated_at", :null => false
end
create_table "moderators", :force => true do |t|
t.integer "user_id"
t.integer "board_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "moderators", ["board_id"], :name => "index_moderators_on_board_id"
add_index "moderators", ["user_id"], :name => "index_moderators_on_user_id"
create_table "navigations", :force => true do |t|
t.string "name"
t.string "url"
......@@ -188,6 +195,16 @@ ActiveRecord::Schema.define(:version => 20120417233009) do
t.datetime "updated_at", :null => false
end
create_table "sessions", :force => true do |t|
t.string "session_id", :null => false
t.text "data"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
create_table "settings", :primary_key => "name", :force => true do |t|
t.text "value"
end
......@@ -214,7 +231,7 @@ ActiveRecord::Schema.define(:version => 20120417233009) do
create_table "users", :force => true do |t|
t.string "name", :null => false
t.string "password"
t.string "email", :default => "", :null => false
t.string "email"
t.string "nickname", :default => "", :null => false
t.text "signature"
t.integer "credits", :default => 0, :null => false
......@@ -246,39 +263,4 @@ ActiveRecord::Schema.define(:version => 20120417233009) do
add_index "users", ["name"], :name => "index_users_on_name"
create_table "users_copy", :force => true do |t|
t.string "name", :null => false
t.string "password"
t.string "email", :default => "", :null => false
t.string "nickname", :default => "", :null => false
t.text "signature"
t.integer "credits", :default => 0, :null => false
t.integer "credit1", :default => 0, :null => false
t.integer "credit2", :default => 0, :null => false
t.integer "credit3", :default => 0, :null => false
t.integer "credit4", :default => 0, :null => false
t.integer "credit5", :default => 0, :null => false
t.integer "credit6", :default => 0, :null => false
t.integer "credit7", :default => 0, :null => false
t.integer "credit8", :default => 0, :null => false
t.integer "win", :default => 0, :null => false
t.integer "lost", :default => 0, :null => false
t.integer "role_id", :default => 5, :null => false
t.boolean "locked", :default => false, :null => false
t.string "regip", :default => "", :null => false
t.string "lastloginip", :default => "", :null => false
t.integer "viewnum", :default => 0, :null => false
t.integer "onlinetime", :default => 0, :null => false
t.string "locale"
t.string "theme"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.datetime "avatar_updated_at"
end
add_index "users_copy", ["name"], :name => "index_users_on_name"
end
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
user:
board:
two:
user:
board:
require 'test_helper'
class ModeratorsControllerTest < ActionController::TestCase
setup do
@moderator = moderators(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:moderators)
end
test "should get new" do
get :new
assert_response :success
end
test "should create moderator" do
assert_difference('Moderator.count') do
post :create, moderator: @moderator.attributes
end
assert_redirected_to moderator_path(assigns(:moderator))
end
test "should show moderator" do
get :show, id: @moderator
assert_response :success
end
test "should get edit" do
get :edit, id: @moderator
assert_response :success
end
test "should update moderator" do
put :update, id: @moderator, moderator: @moderator.attributes
assert_redirected_to moderator_path(assigns(:moderator))
end
test "should destroy moderator" do
assert_difference('Moderator.count', -1) do
delete :destroy, id: @moderator
end
assert_redirected_to moderators_path
end
end
require 'test_helper'
class ModeratorsHelperTest < ActionView::TestCase
end
require 'test_helper'
class ModeratorTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
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