Commit 4571fbfa authored by 神楽坂玲奈's avatar 神楽坂玲奈

友情链接

git-svn-id: http://glupx.googlecode.com/svn/trunk/Reliz@75 189f022a-1064-8ae2-3e6f-c4a67275c50b
parent d888e5cc
class ApplicationController < ActionController::Base
Themes_Dir = 'app/themes'
protect_from_forgery
before_filter :load_settings
before_filter :load_user
before_filter :load_locale
before_filter :load_theme
......
class LinksController < ApplicationController
# GET /links
# GET /links.xml
def index
@links = Link.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @links }
end
end
# GET /links/1
# GET /links/1.xml
def show
@link = Link.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @link }
end
end
# GET /links/new
# GET /links/new.xml
def new
@link = Link.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @link }
end
end
# GET /links/1/edit
def edit
@link = Link.find(params[:id])
end
# POST /links
# POST /links.xml
def create
@link = Link.new(params[:link])
respond_to do |format|
if @link.save
format.html { redirect_to(@link, :notice => 'Link was successfully created.') }
format.xml { render :xml => @link, :status => :created, :location => @link }
else
format.html { render :action => "new" }
format.xml { render :xml => @link.errors, :status => :unprocessable_entity }
end
end
end
# PUT /links/1
# PUT /links/1.xml
def update
@link = Link.find(params[:id])
respond_to do |format|
if @link.update_attributes(params[:link])
format.html { redirect_to(@link, :notice => 'Link was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @link.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /links/1
# DELETE /links/1.xml
def destroy
@link = Link.find(params[:id])
@link.destroy
respond_to do |format|
format.html { redirect_to(links_url) }
format.xml { head :ok }
end
end
end
......@@ -117,7 +117,7 @@ class UsersController < ApplicationController
end
end
def theme
p params[:theme], @site[:themes].has_key?(params[:theme])
#p params[:theme], @site[:themes].has_key?(params[:theme])
if params[:theme].blank?
cookies[:theme] = nil
@correct_user.update_attribute(:theme, nil)
......
module LinksHelper
end
class Link < ActiveRecord::Base
end
<div class=" box ui-widget-content ui-corner-all ui-helper-clearfix">
<div id="fuzhu"></div>
<%= render @boards %>
<div id="fuzhu"></div>
<%= render @boards %>
</div>
<div class="box ui-widget-content ui-corner-all ui-helper-clearfix">
<div id="fuzhu"></div>
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all" >
<table width="100%" height="27px" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="590px"style="padding-left:5px">友情鏈接</td>
<td width="590px" style="padding-right:5px" align="right">-</td>
</tr>
</table></div>
<div id=footer2>
<div id=ft_1>
<table id="ft_1_t" width="100%" border="0" cellspacing="0" cellpadding="0">
<div id="fuzhu"></div>
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all" >
<table width="100%" height="27px" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="590px"style="padding-left:5px"><%=t 'forum.link'%> </td>
<td width="590px" style="padding-right:5px" align="right">-</td>
</tr>
</table></div>
<div id=footer2>
<div id=ft_1>
<table id="ft_1_t" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="590px">
<div id="ft_1_t_d1">
<div id="ft_1_t_d2"> </div>
</div>
</td>
<%= render Link.all %>
</td>
<td width="590px"></td>
</tr>
</table>
</div>
<div id=ft_2>
</div>
<div id=ft_3></div>
</div>
<div></div>
</div>
<div id=ft_2>
</div>
<div id=ft_3></div>
</div>
<div></div>
</div>
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all">
<table width="100%" height="27px"border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="590px"style="padding-left:5px"><%= render 'layouts/onlineuserbar' %> </td>
<td width="590px" style="padding-right:5px" align="right">-</td>
</tr>
</table></div>
<table width="100%" height="27px"border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="590px"style="padding-left:5px"><%= render 'layouts/onlineuserbar' %> </td>
<td width="590px" style="padding-right:5px" align="right">-</td>
</tr>
</table></div>
</div>
\ No newline at end of file
......@@ -207,15 +207,15 @@
}
#b2_2_d1
{
width:200px;
height:93px;
width:auto;
height:auto;
border-width:1px;
border-style:hidden;
}
#b2_2_d1_avatar
{
width:171px;
height:68px;
width:auto;
height:auto;
border-width:1px;
border-style:solid;
border-color:#CCCCCC;
......
......@@ -7,15 +7,24 @@
</p>
</div>
<%= render @boards %>
<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 class="mainbox list">
<span class="headactions"><%= image_tag 'common/collapsed_no.gif' %></span>
<h3><%=link_to t('forum.link'), links_path %></h3>
<div id="forumlinks">
<!--<div class="forumlinks">
<ul class="s_clear"><li><div class="forumlogo"><img src="http://www.touhou.cc/logo.gif" border="0" alt="东方幻想乡"></div><div class="forumcontent"><h5><a href="http://www.touhou.cc/bbs" target="_blank">东方幻想乡</a></h5><p>这里是幻想乡,一片充满生机和幸福的乐土.</p></div></li></ul>
</div>--> <!--详细-->
<div class="forumimglink">
<%= render Link.all %>
</div>
<!--<div class="forumtxtlink">
<ul class="s_clear">
<li><a href="http://www.sakuracountry.cn/" target="_blank" title="樱之国度">樱之国度</a></li><li><a href="http://www.awawh.com/bbs/" target="_blank" title="聚合网">聚合网</a></li><li><a href="http://www.thactclub.cn/bbs" target="_blank" title="TAC触手乡">TAC触手乡</a></li><li><a href="http://www.bilibili.us/" target="_blank" title="哔哩哔哩">哔哩哔哩</a></li><li><a href="http://www.moeloli.cn" target="_blank" title="萝莉学园">萝莉学园</a></li><li><a href="http://www.0ymt.net/" target="_blank" title="零乐漫坛">零乐漫坛</a></li><li><a href="http://www.fulifuli.org/" target="_blank" title="炮姐大逃杀">炮姐大逃杀</a></li><li><a href="http://www.hgacg.com/" target="_blank" title="后宫动漫论坛">后宫动漫论坛</a></li><li><a href="http://www.lv8n.com" target="_blank" title="中国本土同人联盟">中国本土同人联盟</a></li><li><a href="http://bbs.u17.com/" target="_blank" title="有妖气漫画论坛">有妖气漫画论坛</a></li><li><a href="http://www.touhou.cc/bbs/plugin.php?id=xh_forumlinks:forumlinks" target="_blank" title="点击申请">点击申请</a></li></ul>
</div>--><!--文字-->
</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>
......@@ -23,4 +32,4 @@
<%= render 'layouts/onlineuserbar' %>
</h3>
</div>
</div>
\ No newline at end of file
</div>
<div id="footer">
<div class="footerc">
<div style="margin: 0 auto; width: 160px; padding-top: 5px; text-align: center;">
<a href="javascript:;" onclick="scrollTo(0,0);">TOP</a>
</div>
<div id="footlink">
<div style="width: 500px; height: 58px; float: left;">
<ul class="fmenu">
<li style="width: 100px;"><%= link_to '66RPG 实验室', 'http://lab.66rpg.com' %></li>
</ul>
<div style="height: 16px; clear: both;">Powered by <%= link_to 'Reliz Project', 'http://lab.66rpg.com' %></div>
</div>
<div class="bhoge">Powered by:</div>
<div class="bw3c">Validated by:</div>
<div class="bexa">CSS Modify By:</div></div>
</div>
<div class="footerc">
<div style="margin: 0 auto; width: 160px; padding-top: 5px; text-align: center;">
<a href="javascript:;" onclick="scrollTo(0,0);">TOP</a>
</div>
<div id="footlink">
<div style="width: 500px; height: 58px; float: left;">
<ul class="fmenu">
<li style="width: 100px;"><%= link_to '66RPG 实验室', 'http://lab.66rpg.com' %></li>
</ul>
<div style="height: 16px; clear: both;">Powered by <%= link_to 'Reliz Project', 'http://lab.66rpg.com' %></div>
</div>
<div class="bhoge">Powered by:</div>
<div class="bw3c">Validated by:</div>
<div class="bexa">CSS Modify By:</div></div>
</div>
</div>
\ No newline at end of file
<% unless @site.themes.empty? %>
<div id ="themebar">
<ul>
<% @site.themes.each_pair do |name, theme| %>
<li><%= link_to name, theme_path(name), :title => name %></li>
<% end %>
</ul>
</div>
<div id ="themebar">
<ul>
<% @site.themes.each_pair do |name, theme| %>
<li><%= link_to name, theme_path(name), :title => name %></li>
<% end %>
</ul>
</div>
<% end %>
\ No newline at end of file
<%= form_for(@link) do |f| %>
<% if @link.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@link.errors.count, "error") %> prohibited this link from being saved:</h2>
<ul>
<% @link.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :url %><br />
<%= f.text_field :url %>
</div>
<div class="field">
<%= f.label :logo %><br />
<%= f.text_field :logo %>
</div>
<div class="field">
<%= f.label :introduction %><br />
<%= f.text_field :introduction %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
<%= link_to image_tag(link.logo, :alt => link.name), link.url %>
\ No newline at end of file
<h1>Editing link</h1>
<%= render 'form' %>
<%= link_to 'Show', @link %> |
<%= link_to 'Back', links_path %>
<h1>Listing links</h1>
<table>
<tr>
<th>Name</th>
<th>Url</th>
<th>Logo</th>
<th>Introduction</th>
<th></th>
<th></th>
<th></th>
</tr>
<% @links.each do |link| %>
<tr>
<td><%= link.name %></td>
<td><%= link.url %></td>
<td><%= link.logo %></td>
<td><%= link.introduction %></td>
<td><%= link_to 'Show', link %></td>
<td><%= link_to 'Edit', edit_link_path(link) %></td>
<td><%= link_to 'Destroy', link, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Link', new_link_path %>
<h1>New link</h1>
<%= render 'form' %>
<%= link_to 'Back', links_path %>
<p id="notice"><%= notice %></p>
<p>
<b>Name:</b>
<%= @link.name %>
</p>
<p>
<b>Url:</b>
<%= @link.url %>
</p>
<p>
<b>Logo:</b>
<%= @link.logo %>
</p>
<p>
<b>Introduction:</b>
<%= @link.introduction %>
</p>
<%= link_to 'Edit', edit_link_path(@link) %> |
<%= link_to 'Back', links_path %>
......@@ -17,11 +17,11 @@
</div>
<div class="field">
<%= f.label t('user.password') %><br />
<%= f.text_field :password %>
<%= f.password_field :password %>
</div>
<div class="field">
<%= f.label t('user.password_repeat') %><br />
<%= f.text_field :password %>
<%= f.password_field :password %>
</div>
<div class="field">
<%= f.label t('user.email') %><br />
......
......@@ -41,4 +41,4 @@ module Reliz
config.i18n.default_locale = 'zh-CN'
end
end
end
\ No newline at end of file
......@@ -23,6 +23,7 @@ zh-CN:
forum:
next: "下一页"
prev: "上一页"
link: "友情链接"
board:
control: "管理面板"
name: "版块名称"
......
Reliz::Application.routes.draw do
resources :links
resources :settings
resources :moderations
......
class CreateLinks < ActiveRecord::Migration
def self.up
create_table :links do |t|
t.string :name
t.string :url
t.string :logo
t.string :introduction
t.integer :displayorder
t.timestamps
end
end
def self.down
drop_table :links
end
end
......@@ -11,7 +11,13 @@ class DemoData < ActiveRecord::Migration
: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"
Link.create :id => 1,
:name => "66RPG 实验室",
:displayorder => 0,
:introduction => "Reliz 开发组",
:url => "http://lab.66rpg.com:3000/",
:logo => "http://bbs.66rpg.com/logo.gif"
end
def self.down
......
......@@ -10,10 +10,11 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111042572025) do
ActiveRecord::Schema.define(:version => 20111042772025) do
create_table "boards", :force => true do |t|
t.string "name", :default => "", :null => false
t.integer "displayorder", :default => 0, :null => false
t.text "introduction", :null => false
t.text "notice", :null => false
t.string "logo", :default => "", :null => false
......@@ -34,6 +35,16 @@ ActiveRecord::Schema.define(:version => 20111042572025) do
t.datetime "updated_at"
end
create_table "links", :force => true do |t|
t.string "name"
t.string "url"
t.string "logo"
t.string "introduction"
t.integer "displayorder"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "moderations", :force => true do |t|
t.integer "user_id"
t.integer "association_id"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
name: MyString
url: MyString
logo: MyString
introduction: MyString
two:
name: MyString
url: MyString
logo: MyString
introduction: MyString
require 'test_helper'
class LinksControllerTest < ActionController::TestCase
setup do
@link = links(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:links)
end
test "should get new" do
get :new
assert_response :success
end
test "should create link" do
assert_difference('Link.count') do
post :create, :link => @link.attributes
end
assert_redirected_to link_path(assigns(:link))
end
test "should show link" do
get :show, :id => @link.to_param
assert_response :success
end
test "should get edit" do
get :edit, :id => @link.to_param
assert_response :success
end
test "should update link" do
put :update, :id => @link.to_param, :link => @link.attributes
assert_redirected_to link_path(assigns(:link))
end
test "should destroy link" do
assert_difference('Link.count', -1) do
delete :destroy, :id => @link.to_param
end
assert_redirected_to links_path
end
end
require 'test_helper'
class LinksHelperTest < ActionView::TestCase
end
require 'test_helper'
class LinkTest < ActiveSupport::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
1712
\ No newline at end of file
7668
\ 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