Commit 648dd122 authored by 神楽坂玲奈's avatar 神楽坂玲奈

Settings没删 没启用

换肤泥煤啊..

git-svn-id: http://glupx.googlecode.com/svn/trunk/Reliz@53 189f022a-1064-8ae2-3e6f-c4a67275c50b
parent 051882e1
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery protect_from_forgery
before_filter :check_user
before_filter :check_actions
before_filter :set_language
before_filter :load_settings before_filter :load_settings
before_filter :load_user
before_filter :load_locale
before_filter :load_theme before_filter :load_theme
before_filter :check_actions #for debug
def check_actions def check_actions
@actions = ["warning: no actions here"] unless @actions @actions = ["warning: no actions here"] unless @actions
end end
def load_theme def load_user
#if cookices
#prepend_view_path(File.join(Rails.root, "app/themes/abitno"))
prepend_view_path("app/themes/lotus")
end
def check_user
if session[:user_id] if session[:user_id]
@correct_user = User.find session[:user_id] @correct_user = User.find session[:user_id]
end end
...@@ -21,21 +18,31 @@ class ApplicationController < ActionController::Base ...@@ -21,21 +18,31 @@ class ApplicationController < ActionController::Base
@correct_user = User::Guest @correct_user = User::Guest
end end
end end
def set_language def load_locale
request_language = request.env['HTTP_ACCEPT_LANGUAGE'] p request.env['HTTP_ACCEPT_LANGUAGE']
request_language = request_language.nil? ? nil : request_language[/[^,;]+/] #locale = @correct_user.locale || (
# request_language # request_language =
I18n.locale = request_language if request_language && File.exist?("#{RAILS_ROOT}/config/locales/#{request_language}.yml") #request_language && request_language['HTTP_ACCEPT_LANGUAGE'][/[^,;]+/]
#p I18n.locale, "#{RAILS_ROOT}/config/locales/#{request_language}.yml" #)
#p I18n.load_path #I18n.locale = locale if File.exist?("#{RAILS_ROOT}/config/locales/#{request_language}.yml")
User::Guest.name = t 'user.guest' User::Guest.name = t 'user.guest'
end end
def load_theme
if !@correct_user.theme.blank?
theme_path = "app/themes/#{@correct_user.theme}"
prepend_view_path theme_path if File.directory? theme_path
elsif !@site.theme.blank?
theme_path = "app/themes/#{@site.theme}"
prepend_view_path theme_path if File.directory? theme_path
end
end
def load_settings def load_settings
@site = { @site = {
:name => "Reliz" :name => "Reliz",
:theme => nil
} }
def @site.method_missing(method, *args) def @site.method_missing(method, *args)
self[method] || super self[method]# || super
end end
def @site.to_s def @site.to_s
"<a href=\"/\">#{name}</a>".html_safe "<a href=\"/\">#{name}</a>".html_safe
......
...@@ -10,7 +10,9 @@ class Board < ActiveRecord::Base ...@@ -10,7 +10,9 @@ class Board < ActiveRecord::Base
def to_s def to_s
"<a href=\"/boards/#{id}\">#{name}</a>".html_safe "<a href=\"/boards/#{id}\">#{name}</a>".html_safe
end end
alias_method :logo_url, :logo def logo_url
read_attribute(:logo)
end
def logo def logo
"<a href=\"/boards/#{id}\"><img src=\"#{logo_url}\"/></a>".html_safe "<a href=\"/boards/#{id}\"><img src=\"#{logo_url}\"/></a>".html_safe
end end
......
...@@ -14,7 +14,15 @@ class User < ActiveRecord::Base ...@@ -14,7 +14,15 @@ class User < ActiveRecord::Base
"<a href=\"/users/#{id}\">#{name}</a>".html_safe "<a href=\"/users/#{id}\">#{name}</a>".html_safe
end end
def avatar(size=nil) def avatar(size=nil)
"<a href=\"/users/#{id}\"><img src=\"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.strip.downcase)}\" /></a>".html_safe size = case size
when :small
48
when Integer
size
else
120
end
"<a href=\"/users/#{id}\"><img src=\"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.strip.downcase)}?size=#{size}\" /></a>".html_safe
end end
=begin =begin
t.string :name, :null => false t.string :name, :null => false
......
<div style="height:30px;"> <div style="height:30px;">
</div> </div>
<div id="body" class=" box ui-widget-content ui-corner-all ui-helper-clearfix"> <div id="body" class=" box ui-widget-content ui-corner-all ui-helper-clearfix">
<div id="b1">
</div>
<div class=" box ui-widget-content ui-corner-all ui-helper-clearfix"> <div class=" box ui-widget-content ui-corner-all ui-helper-clearfix">
<div id="fuzhu"> <div id="fuzhu">
</div> </div>
...@@ -19,15 +18,16 @@ ...@@ -19,15 +18,16 @@
</table> </table>
</div> </div>
<% @boards.each do |board| %> <% @boards.each do |board| %>
<div id=b2_2> <div id=b2_2>
<table width="100%" height="93px" border="0" cellspacing="0" cellpadding="0"> <table width="100%" height="93px" border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td width="171px"> <td width="171px">
<div id=b2_2_d1>
<div id=b2_2_d1_avatar>
</div> <%= board.logo %>
</div>
</td> </td>
<td width: "686px"> <td width: "686px">
<div id=b2_2_d2> <div id=b2_2_d2>
......
<div id="header"> <div id="header">
<div id="h2" class="ui-dialog-titlebar ui-widget-header ui-corner-all"> <div id="h2" class="ui-dialog-titlebar ui-widget-header ui-corner-all">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="h2_t"> <style type="text/css">
<tr> #userbar{margin-left: 900px;}
<td width="900px" ;> </style>
</td> <%= render 'layouts/userbar' %>
<td width="50px" ; style="color:#000000">
名字
</td>
<td width="50px" ; style="color:#000000">
空間
</td>
<td width="50px" ; style="color:#000000">
消息
</td>
<td width="50px" ; style="color:#000000">
設置
</td>
<td width="50px" ; style="color:#000000">
退出
</td>
<td width="50px" ; style="color:#000000">
</td>
</tr>
</table>
</div> </div>
<div id="h3"> <div id="h3">
<div class="toggler"> <div class="toggler">
...@@ -35,56 +16,32 @@ ...@@ -35,56 +16,32 @@
<div id="h4" class="ui-dialog-titlebar ui-widget-header ui-corner-all"> <div id="h4" class="ui-dialog-titlebar ui-widget-header ui-corner-all">
<table border="0" cellspacing="0" cellpadding="0" id="tb1"> <table border="0" cellspacing="0" cellpadding="0" id="tb1">
<tr> <tr>
<td width="80" align="right"> <%= render "layouts/navibar" %>
論壇 <label style="align: right">
</td>
<td width="80" align="right">
小屋
</td>
<td width="80" align="right">
搜索
</td>
<td width="80" align="right">
幫助
</td>
<td width="80" align="right">
導航
</td>
<td width="80" align="right">
插件
</td>
<td width="400" align="right">
&nbsp;
</td>
<td width="100">
<label>
<input name="textfield" type="text" value="請輸入搜索內容 " /> <input name="textfield" type="text" value="請輸入搜索內容 " />
</label> </label>
</td>
<td width="80" align="center">
<input type="submit" name="Submit" value="搜索" /> <input type="submit" name="Submit" value="搜索" />
</td>
<td width="80" align="center">
<input type="submit" name="Submit2" value="高級搜索" /> <input type="submit" name="Submit2" value="高級搜索" />
</td>
</tr> </tr>
</table> </table>
</div> </div>
<div id="h5"> <div id="h5">
<table border="0" cellspacing="0" cellpadding="0" id="tb2"> <table border="0" cellspacing="0" cellpadding="0" id="tb2">
<% if logged? %>
<tr> <tr>
<td rowspan="2" width="80"> <td rowspan="2" width="80">
<div id="dtx"> <div id="dtx">
頭像 <%= @correct_user.avatar :small %>
</div> </div>
</td> </td>
<td width="700" height="28" style="padding-left:5px"> <td width="700" height="28" style="padding-left:5px">
歡迎回來XX 歡迎回來 <%= @correct_user %>
</td> </td>
<td width="400" align="right" style="padding-right:10px"> <td width="400" align="right" style="padding-right:10px">
歡迎新會員 歡迎新會員 <%= User.last %>
</td> </td>
</tr> </tr>
<% end %>
<tr> <tr>
<td width="700" style="padding-left:5px"> <td width="700" style="padding-left:5px">
公告: 公告:
...@@ -99,7 +56,7 @@ ...@@ -99,7 +56,7 @@
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="tb3"> <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tb3">
<tr> <tr>
<td width="600" style="padding-left:15px"> <td width="600" style="padding-left:15px">
東方幻想鄉->幻想鄉溫泉 <%= render 'layouts/actionbar' %>
</td> </td>
<td width="600" align="right" style="padding-right:20px"> <td width="600" align="right" style="padding-right:20px">
<select name="effects" id="effectTypes" style="visibility:hidden"> <select name="effects" id="effectTypes" style="visibility:hidden">
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<tbody id="board<%= board.id %>"> <tbody id="board<%= board.id %>">
<tr> <tr>
<th> <th>
<%= link_to image_tag(board.logo), board %> <%= board.logo %>
<div class="left"> <div class="left">
<h2><%= board %></h2> <h2><%= board %></h2>
......
<div id="actionbar">
<%= @site %>
<% @actions.each do |action| %>
&raquo; <%= action %>
<% end %>
</div>
\ No newline at end of file
<ul>
<li class="menu_1"><%=link_to t('navi.forum'), :root, :hidefocus => true, :id => :mn_index %></li>
</ul>
<!--<script type="text/javascript">
var currentMenu = $('mn_index') ? $('mn_index') : $('mn_index');
currentMenu.parentNode.className = 'current';
</script>-->
\ No newline at end of file
...@@ -8,24 +8,8 @@ ...@@ -8,24 +8,8 @@
<div id="topbar" name="TOP"> <div id="topbar" name="TOP">
<div class="topanel"> <div class="topanel">
<div id="memberp"> <div id="memberp">
<% if logged? %> <%= render 'layouts/userbar' %>
<cite><a href="space.php?uid=359" class="noborder"><%= @correct_user %> </a></cite>
<span class="pipe">|</span>
<%= link_to t('user.my'), @correct_user %>
<%= link_to t('user.space'), @correct_user %>
<%= link_to t('user.notice'), @correct_user %>
<span id="myprompt_check"></span>
<%= link_to t('user.pm'), @correct_user %>
<span class="pipe">|</span>
<%= link_to t('user.logout'), logout_path %>
<% else %>
<%= link_to t('user.login'), login_path %>
<%= link_to t('user.register'), new_user_path %>
<% end %>
</div> </div>
<form method="post" id="searchform" action="search.php"> <form method="post" id="searchform" action="search.php">
<div style="width:190px;float:left;"> <div style="width:190px;float:left;">
<input type="hidden" name="formhash" value="eed723b8" /> <input type="hidden" name="formhash" value="eed723b8" />
...@@ -45,16 +29,7 @@ ...@@ -45,16 +29,7 @@
<div class="bg-dmenuleft"></div> <div class="bg-dmenuleft"></div>
<div class="bg-dmenu" style="position: relative;"> <div class="bg-dmenu" style="position: relative;">
<div id="menu"> <div id="menu">
<ul> <%= render "layouts/navibar" %>
<li class="menu_1"><%=link_to t('navi.forum'), :root, :hidefocus => true, :id => :mn_index %></li>
</ul>
<script type="text/javascript">
var currentMenu = $('mn_index') ? $('mn_index') : $('mn_index');
currentMenu.parentNode.className = 'current';
</script>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function setstyle(styleid) { function setstyle(styleid) {
...@@ -78,8 +53,6 @@ location.href = 'index.php?' + str; ...@@ -78,8 +53,6 @@ location.href = 'index.php?' + str;
</div> </div>
<div id="nav"> <div id="nav">
<%= @site %> <%= render 'layouts/actionbar' %>
<% @actions.each do |action| %> </div>
&raquo; <%= action %>
<% end %></div>
<div id="ad_text"></div> <div id="ad_text"></div>
\ No newline at end of file
<div id="userbar">
<% if logged? %>
<cite><a href="space.php?uid=359" class="noborder"><%= @correct_user %> </a></cite>
<span class="pipe">|</span>
<%= link_to t('user.my'), @correct_user %>
<%= link_to t('user.space'), @correct_user %>
<%= link_to t('user.notice'), @correct_user %>
<span id="myprompt_check"></span>
<%= link_to t('user.pm'), @correct_user %>
<span class="pipe">|</span>
<%= link_to t('user.logout'), logout_path %>
<% else %>
<%= link_to t('user.login'), login_path %>
<%= link_to t('user.register'), new_user_path %>
<% end %>
</div>
\ No newline at end of file
...@@ -19,6 +19,7 @@ zh-CN: ...@@ -19,6 +19,7 @@ zh-CN:
post: "帖子" post: "帖子"
topic: "主题" topic: "主题"
digest: "精华" digest: "精华"
guest: "游客"
forum: forum:
next: "下一页" next: "下一页"
prev: "上一页" prev: "上一页"
...@@ -33,6 +34,8 @@ zh-CN: ...@@ -33,6 +34,8 @@ zh-CN:
topicperm: "主题权限" topicperm: "主题权限"
postperm: "回帖权限" postperm: "回帖权限"
submit: "提交" submit: "提交"
topic: "主题"
post: "回复"
stat: stat:
onlineuser: "在线人数" onlineuser: "在线人数"
total: "总计" total: "总计"
......
...@@ -22,6 +22,8 @@ class CreateUsers < ActiveRecord::Migration ...@@ -22,6 +22,8 @@ class CreateUsers < ActiveRecord::Migration
t.integer :credit6, :default => 0, :null => false t.integer :credit6, :default => 0, :null => false
t.integer :credit7, :default => 0, :null => false t.integer :credit7, :default => 0, :null => false
t.integer :credit8, :default => 0, :null => false t.integer :credit8, :default => 0, :null => false
t.string :locale
t.string :theme
t.timestamps t.timestamps
end end
end end
......
This source diff could not be displayed because it is too large. You can view the blob instead.
2360 880
\ No newline at end of file \ 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