Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GaiaXalter
Ygopro Arena Web
Commits
12882eb8
Commit
12882eb8
authored
Mar 30, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
c4efed9c
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
13035 additions
and
28 deletions
+13035
-28
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-3
app/controllers/boards_controller.rb
app/controllers/boards_controller.rb
+2
-1
app/models/board.rb
app/models/board.rb
+7
-5
app/models/post.rb
app/models/post.rb
+1
-1
app/models/topic.rb
app/models/topic.rb
+2
-1
app/models/user.rb
app/models/user.rb
+6
-1
app/views/boards/show.html.erb
app/views/boards/show.html.erb
+3
-3
app/views/topics/show.html.erb
app/views/topics/show.html.erb
+11
-5
config/locales/zh-CN.yml
config/locales/zh-CN.yml
+4
-0
config/routes.rb
config/routes.rb
+8
-8
db/migrate/20101226015150_create_topics.rb
db/migrate/20101226015150_create_topics.rb
+1
-0
log/development.log
log/development.log
+12989
-0
No files found.
app/controllers/application_controller.rb
View file @
12882eb8
...
...
@@ -13,10 +13,7 @@ class ApplicationController < ActionController::Base
end
unless
@correct_user
@correct_user
=
User
::
Guest
@correct_user
.
id
=
0
@correct_user
.
name
=
t
'user.anonymous'
end
p
@correct_user
end
def
set_language
request_language
=
request
.
env
[
'HTTP_ACCEPT_LANGUAGE'
]
...
...
@@ -25,6 +22,7 @@ class ApplicationController < ActionController::Base
I18n
.
locale
=
request_language
if
request_language
&&
File
.
exist?
(
"
#{
RAILS_ROOT
}
/config/locales/
#{
request_language
}
.yml"
)
#p I18n.locale, "#{RAILS_ROOT}/config/locales/#{request_language}.yml"
#p I18n.load_path
User
::
Guest
.
name
=
t
'user.guest'
end
def
load_settings
@site
=
{
...
...
app/controllers/boards_controller.rb
View file @
12882eb8
...
...
@@ -19,7 +19,8 @@ class BoardsController < ApplicationController
@page
=
params
[
:page
]
&&
!
params
[
:page
].
empty?
?
params
[:
page
].
to_i
:
1
@board
=
Board
.
find
(
params
[
:id
])
@actions
=
[
@board
]
@topics
=
@board
.
topics
.
all
(
:offset
=>
20
*
@page
-
20
,
:limit
=>
20
,
:order
=>
[
:displayorder
,
:id
])
order
=
'displayorder DESC, updated_at DESC'
if
params
[
:order
].
blank?
@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
}
...
...
app/models/board.rb
View file @
12882eb8
...
...
@@ -4,13 +4,15 @@ class Board < ActiveRecord::Base
#why it doesn't work?
has_many
:topics
,
:foreign_key
=>
:category_id
has_many
:posts
,
:through
=>
:topics
def
to_s
"<a href=
\"
/forum/
#{
id
}
\"
>
#{
name
}
</a>"
.
html_safe
end
alias
topics_with_deleted
topics
def
topics
topics_with_deleted
.
where
({
:deleted
=>
false
})
"<a href=
\"
/boards/
#{
id
}
\"
>
#{
name
}
</a>"
.
html_safe
end
#alias topics_with_deleted topics
#def topics
# topics_with_deleted.where({:deleted => false}).order('').order('name')
#end
#def superboard
# board
#end
...
...
app/models/post.rb
View file @
12882eb8
...
...
@@ -9,6 +9,6 @@ class Post < ActiveRecord::Base
Post
.
where
([
'created_at < ? and created_at > ?'
,
Date
.
today
,
Date
.
today
-
1
])
end
def
to_s
"
#{
topic
}
, <a href=/topic/
#{
topic
.
id
}
#post
#{
id
}
>
#{
displayorder
}
#</a>"
.
html_safe
"
#{
topic
}
, <a href=/topic
s
/
#{
topic
.
id
}
#post
#{
id
}
>
#{
displayorder
}
#</a>"
.
html_safe
end
end
app/models/topic.rb
View file @
12882eb8
...
...
@@ -3,13 +3,14 @@ class Topic < ActiveRecord::Base
#belongs_to :type
belongs_to
:board
,
:foreign_key
=>
:category_id
has_many
:posts
default_scope
where
(
:deleted
=>
false
)
alias
category
board
def
to_s
result
=
name
if
color?
result
=
"<font color=
\"
#{
color
}
\"
>
#{
result
}
</font>"
end
result
=
"<a href=
\"
/topic/
#{
id
}
\"
>
#{
result
}
</a>"
.
html_safe
result
=
"<a href=
\"
/topic
s
/
#{
id
}
\"
>
#{
result
}
</a>"
.
html_safe
end
def
floor
self
.
posts
.
order
(
'displayorder DESC'
).
first
.
displayorder
+
1
...
...
app/models/user.rb
View file @
12882eb8
...
...
@@ -7,9 +7,14 @@ class User < ActiveRecord::Base
:length
=>
{
:minimum
=>
3
,
:maximum
=>
254
},
:uniqueness
=>
true
,
:format
=>
{
:with
=>
/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
}
has_many
:topics
has_many
:posts
,
:through
=>
:topics
before_save
proc
{
!
locked
}
def
to_s
"<a href=
\"
/space/
#{
id
}
\"
>
#{
name
}
</a>"
.
html_safe
"<a href=
\"
/users/
#{
id
}
\"
>
#{
name
}
</a>"
.
html_safe
end
def
avatar
(
size
=
nil
)
"<a href=
\"
/users/
#{
id
}
\"
><img src=
\"
http://www.gravatar.com/avatar/
#{
Digest
::
MD5
.
hexdigest
(
email
.
strip
.
downcase
)
}
\"
/></a>"
.
html_safe
end
=begin
t.string :name, :null => false
...
...
app/views/boards/show.html.erb
View file @
12882eb8
...
...
@@ -43,7 +43,7 @@
<td
class=
"author"
><a
href=
"boarddisplay.php?fid=68&filter=&orderby=dateline"
class=
"order "
>
<%=
t
'topic.user_name'
%>
<%=
link_to
(
t
(
'topic.created_at'
),
:order
=>
'crea
ded_at'
)
%>
</a></td>
<%=
link_to
(
t
(
'topic.created_at'
),
:order
=>
'crea
ted_at%20DESC'
.
html_safe
)
%>
</a></td>
<td
class=
"nums"
><a
href=
"boarddisplay.php?fid=68&filter=&orderby=replies"
class=
"order "
>
<%=
t
'topic.reply_num'
%>
</a>
<a
href=
"boarddisplay.php?fid=68&filter=&orderby=views"
class=
"order "
>
<%=
t
'topic.view_num'
%>
</a></td>
...
...
@@ -60,7 +60,7 @@
when
topic
.
locked
"topic/locked.gif"
when
topic
.
displayorder
!=
0
"topic/displayorder
#{
topic
.
displayorder
}
.gif"
"topic/displayorder
_
#{
topic
.
displayorder
}
.gif"
else
"topic/new.gif"
end
),
topic
,
:target
=>
:_blank
%>
...
...
@@ -83,7 +83,7 @@
<cite>
<%=
topic
.
user
%>
</cite>
<em>
<%=
l
topic
.
posts
.
last
.
upd
ated_at
,
:format
=>
:short
%>
</em>
<em>
<%=
l
topic
.
cre
ated_at
,
:format
=>
:short
%>
</em>
</td>
<td
class=
"nums"
><strong>
<%=
topic
.
posts
.
size
-
1
%>
</strong></td>
...
...
app/views/topics/show.html.erb
View file @
12882eb8
...
...
@@ -33,7 +33,7 @@
<div
class=
"postinfo"
style=
"margin-left: 20px; font-weight: 800"
>
<%=
post
.
user
%>
</div>
<div
class=
"popupmenu_popup userinfopanel"
id=
"userinfo751931"
style=
"display: none; position: absolute;margin-top: -11px;"
>
<
!--<
div class="popupmenu_popup userinfopanel" id="userinfo751931" style="display: none; position: absolute;margin-top: -11px;">
<div class="popavatar">
<div id="userinfo751931_ma"></div>
<ul class="profile_side">
...
...
@@ -55,15 +55,21 @@
</div>
<div id="avatarfeed"><span id="threadsortswait"></span></div>
</div>
</div>
</div>
-->
<div>
<div
class=
"avatar"
onmouseover=
"showauthor(this, 'userinfo751931')"
><
a
href=
"space.php?uid=14806"
target=
"_blank"
><img
src=
"http://www.touhou.cc/ucenter/avatar.php?uid=14806&size=middle"
></a
></div>
<div
class=
"avatar"
onmouseover=
"showauthor(this, 'userinfo751931')"
>
<
%=
post
.
user
.
avatar
%
>
</div>
<p>
<em>
<%=
post
.
user
.
nickname
%>
</em>
</div>
<p><img
src=
"images/default/star_level2.gif"
alt=
"Rank: 2"
></p>
<dl
class=
"profile s_clear"
><dt>
帖子
</dt><dd>
65
</dd><dt>
精华
</dt><dd>
0
</dd><dt>
积分
</dt><dd>
116
</dd><dt>
点数
</dt><dd>
16
</dd><dt>
威望
</dt><dd>
0
</dd><dt>
贡献
</dt><dd>
9
</dd><dt>
人气
</dt><dd>
9
</dd><dt>
人品
</dt><dd>
0
</dd><dt>
在线时间
</dt><dd>
15 小时
</dd></dl><p><img
src=
"images/common/26.gif"
alt=
"NEET"
title=
"NEET"
></p>
<dl
class=
"profile s_clear"
>
<dt>
<%=
t
'user.id'
%>
</dt><dd>
<%=
post
.
user
.
id
%>
</dd>
<dt>
<%=
t
'user.post'
%>
</dt><dd>
<%=
post
.
user
.
posts
.
count
%>
</dd>
<dt>
<%=
t
'user.topic'
%>
</dt><dd>
<%=
post
.
user
.
topics
.
count
%>
</dd>
<dt>
<%=
t
'user.digest'
%>
</dt><dd>
<%=
post
.
user
.
topics
.
where
(
:digest
=>
true
).
count
%>
</dd>
<dt>
<%=
t
'user.credit'
%>
</dt><dd>
<%=
post
.
user
.
credit
%>
</dd>
</dl>
<p><a
href=
"magic.php?action=mybox&operation=use&type=1&pid=751931&magicid=7"
onclick=
"showWindow('magics', this.href);doane(event);"
><img
src=
"images/magics/rtk_s.gif"
title=
"对博丽开水使用狗仔卡"
></a></p>
<hr
class=
"shadowline"
>
<p>
...
...
@@ -178,7 +184,7 @@
<table
cellspacing=
"0"
cellpadding=
"0"
>
<tbody><tr>
<td
class=
"postauthor"
>
<div
class=
"avatar"
><
img
src=
"http://www.touhou.cc/ucenter/avatar.php?uid=359&size=middle"
></div
></td>
<div
class=
"avatar"
>
<
%=
@correct_user
.
avatar
%
>
</td>
<td
class=
"postcontent"
>
<!--<input type="hidden" name="formhash" value="ba0236f6">
<input type="hidden" name="subject" value="">
...
...
config/locales/zh-CN.yml
View file @
12882eb8
...
...
@@ -15,6 +15,10 @@ zh-CN:
password_repeat
:
"
重复密码"
email
:
"
邮箱"
credit
:
"
积分"
id
:
"
ID"
post
:
"
帖子"
topic
:
"
主题"
digest
:
"
精华"
forum
:
next
:
"
下一页"
prev
:
"
上一页"
...
...
config/routes.rb
View file @
12882eb8
...
...
@@ -14,20 +14,20 @@ Reliz::Application.routes.draw do
resources
:blocks
resources
:boards
match
'forum'
=>
'boards#index'
match
'forum/:id/edit'
=>
'boards#edit'
,
:id
=>
/\d+/
match
'forum/:id/(/:page)'
=>
'boards#show'
,
:id
=>
/\d+/
,
:page
=>
/\d+/
#
match 'forum' => 'boards#index'
#
match 'forum/:id/edit' => 'boards#edit', :id => /\d+/
#match 'forum/:id' => 'boards#show', :id => /\d+/
resources
:posts
match
'topic/:topic_id/new'
=>
'posts#new'
,
:topic_id
=>
/\d+/
#����ظ�
match
'topic
s
/: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+/
#
get
'topic
/control'
=>
'topics#control'
#
match 'topic/:id/(/:page)' => 'topics#show', :id => /\d+/, :page => /\d+/
match
'
boards/:board_id/new'
=>
'topics#new'
,
:board
_id
=>
/\d+/
#
#get 'topics
/control' => 'topics#control'
match
'(:something)(/:id)/:anything/'
,
:controller
=>
'application'
,
:action
=>
'redirect_to_thc'
,
:something
=>
/
forum|boards|topic
|topics|posts|users/
,
:id
=>
/\d+/
,
:anything
=>
/.*/
match
'(:something)(/:id)/:anything/'
,
:controller
=>
'application'
,
:action
=>
'redirect_to_thc'
,
:something
=>
/
boards
|topics|posts|users/
,
:id
=>
/\d+/
,
:anything
=>
/.*/
...
...
db/migrate/20101226015150_create_topics.rb
View file @
12882eb8
...
...
@@ -5,6 +5,7 @@ class CreateTopics < ActiveRecord::Migration
t
.
references
:type
t
.
references
:category
,
:polymorphic
=>
true
,
:null
=>
false
t
.
string
:name
,
:null
=>
false
t
.
boolean
:digest
,
:default
=>
false
,
:null
=>
false
t
.
integer
:displayorder
,
:default
=>
0
,
:null
=>
false
t
.
integer
:highlight
,
:default
=>
0
,
:null
=>
false
t
.
integer
:views
,
:default
=>
0
,
:null
=>
false
...
...
log/development.log
View file @
12882eb8
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment