Permalink
Browse files

update

  • Loading branch information...
ranxian committed Oct 31, 2012
1 parent 17b0ee4 commit 832ac8812076648bd7f749c5baab309d2a2db416
@@ -13,4 +13,10 @@ def ensure_admin!
return false
end
end
+
+ def require_login!
+ if not current_user
+ redirect_to :back, notice: '对不起,你需要从右上角登陆以继续进入操作'
+ end
+ end
end
@@ -3,7 +3,7 @@ class DonatesController < ApplicationController
# GET /donates
# GET /donates.json
def index
- @donates = Donate.all.page params[:page]
+ @donates = Donate.all.page(params[:page]).per(10)
respond_to do |format|
format.html # index.html.erb
@@ -1,6 +1,6 @@
# coding: utf-8
class PostsController < ApplicationController
- before_filter :ensure_admin!
+ before_filter :ensure_admin!, :require_login!
# GET /posts
# GET /posts.json
def index
@@ -8,7 +8,6 @@ def simplify_time(time)
end
def admin?
- return true
- current_user && current_user.admin?
+ return current_user && current_user.admin?
end
end
@@ -1,3 +1,8 @@
+h1
+ | 联系方式
+.well
+ p
+ | 我们的联系方式是
h1
| 赞助列表
- if admin?
@@ -12,4 +17,6 @@ h1
small.time = link_to '[编辑]', edit_donate_path(donate)
small.time &nbsp;
small.time = link_to '[删除]', donate, :confirm => '你确定要删除吗?', :method => :delete
+
+= paginate @donates
@@ -1,9 +0,0 @@
-p#notice = notice
-
-p
- strong Content:
- = @donate.content
-
-= link_to 'Edit', edit_donate_path(@donate)
-'|
-= link_to 'Back', donates_path
@@ -24,7 +24,8 @@ html
li = link_to '讨论版', posts_path
li = link_to '支持我们', donates_path
li = link_to '近期活动', events_path
- li = link_to '用户管理', user_manage_index_path
+ - if admin?
+ li = link_to '用户管理', user_manage_index_path
ul.nav.pull-right
- if not user_signed_in?
li: a.login-btn href="javascript:;" 登陆
@@ -65,6 +66,8 @@ html
= link_to event.title, event
.span9
+ - if notice
+ p#notice.alert = notice
== yield
#foot
@@ -22,7 +22,8 @@ html
li = link_to '讨论版', posts_path
li = link_to '支持我们', donates_path
li = link_to '近期活动', events_path
- li = link_to '用户管理', user_manage_index_path
+ - if admin
+ li = link_to '用户管理', user_manage_index_path
ul.nav.pull-right
- if not user_signed_in?
li: a.login-btn href="javascript:;" 登陆
@@ -34,6 +35,8 @@ html
.container
.row
.offset2.span10
+ - if notice
+ p#notice.alert = notice
== yield
#foot
@@ -23,7 +23,8 @@ html
li = link_to '讨论版', posts_path
li = link_to '赞助', donates_path
li = link_to '近期活动', events_path
- li = link_to '用户管理', user_manage_index_path
+ - if admin?
+ li = link_to '用户管理', user_manage_index_path
ul.nav.pull-right
- if not user_signed_in?
li: a.login-btn href="javascript:;" 登陆
@@ -33,6 +34,8 @@ html
#main
.container
+ - if notice
+ p#notice.alert = notice
== yield
#foot
@@ -39,7 +39,8 @@
h1
| 校友列表
- = link_to '新校友', new_mate_path, class: "btn btn-primar-0-y pull-right"
+ - if admin?
+ = link_to '新校友', new_mate_path, class: "btn btn-primar-0-y pull-right"
ul.thumbnails style="margin-left: px;"
- @mates.each_with_index do |mate, index|
@@ -13,9 +13,6 @@
}
}
-- if notice
- p#notice.alert.alert-success = notice
-
.row
.span4
= image_tag(@mate.photo.big, width: 400)
@@ -1,9 +0,0 @@
-p#notice = notice
-
-p
- strong Content:
- = @message.content
-
-= link_to 'Edit', edit_message_path(@message)
-'|
-= link_to 'Back', messages_path
@@ -53,16 +53,16 @@
}
}
}
-- if notice
- p.alert#notice = notice
.post
- if @post.author
= image_tag @post.author.avatar, width: '80', height: '80', class: 'pull-left'
+ - else
+ = image_tag("fallback/default.jpg", width: '80', class: 'pull-left')
div style="margin-left: 90px; min-height: 80px;"
h4 style="margin-top: 0px;" = @post.title
p
- small.author = @post.author.name
+ small.author = @post.author.name if @post.author
| &nbsp;&nbsp;
small.time = beautify_time(@post.created_at)
| &nbsp;&nbsp;
@@ -5,8 +5,6 @@
ul
- @user.errors.full_messages.each do |message|
li = message
- - if notice
- p.alert#notice = notice
.control-group
= f.label :name, '姓名', class: 'control-label'
View
@@ -34,7 +34,7 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
- config.i18n.default_locale = "Beijing"
+ config.i18n.default_locale = "zh-CN"
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
@@ -0,0 +1,107 @@
+# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
+
+zh-CN:
+ errors:
+ messages:
+ expired: "您已过期,请重新申请"
+ not_found: "没有找到"
+ already_confirmed: "已经激活,请重新登录."
+ not_locked: "未锁定"
+ not_saved:
+ one: "因为 1 个错误导致此 %{resource}保存失败:"
+ other: "因为 %{count}个错误导致此 %{resource}保存失败:"
+
+ devise:
+ failure:
+ already_authenticated: '您已经登录.'
+ unauthenticated: '继续操作前请注册或者登录.'
+ unconfirmed: '继续操作前请先激活您的帐号.'
+ locked: '您的帐号已被锁定.'
+ invalid: '邮箱或密码错误'
+ invalid_token: '认证码无效.'
+ timeout: '您已登录超时,请重新登录.'
+ inactive: '您还没有激活帐户.'
+ sessions:
+ signed_in: '登录成功.'
+ signed_out: '退出成功.'
+ passwords:
+ send_instructions: '稍后你将收到帐号激活的电子邮件'
+ updated: '您的密码已修改成功,您现在已登录.'
+ updated_not_active: '您的密码已修改成功.'
+ send_paranoid_instructions: '如果您的邮箱存在于我们的数据库中,您将收到一封找回密码的邮件.'
+ confirmations:
+ send_instructions: '稍后你将收到帐号激活的电子邮件'
+ confirmed: '您的帐号已经激活,您现在已登录.'
+ send_paranoid_instructions: '如果您的邮箱存在于我们的数据库中,您将收到一封激活账号的邮件.'
+ registrations:
+ signed_up: '欢迎您!您已注册成功.'
+ updated: '帐号资料更新成功.'
+ update_needs_confirmation: '您更改了邮箱地址,我们需要验证您的新邮箱地址,请查看您的邮箱,点击激活链接来验证您的新邮箱地址.'
+ destroyed: '再见!您的帐户已成功注销。我们希望很快可以再见到您.'
+ signed_up_but_unconfirmed: '带有激活链接的信息已经发送到你的邮箱。请打开此链接来激活你的帐号'
+ signed_up_but_inactive: '虽然您已经注册成功,但因为你的帐号还未激活,所以你暂时无法登录'
+ signed_up_but_locked: '虽然您已经注册成功,但因为你的帐号已被锁定,所以你暂时无法登录'
+ unlocks:
+ send_instructions: '稍后你将收到帐号激活的电子邮件'
+ unlocked: '您的帐号已成功解锁,您现在已登录.'
+ send_paranoid_instructions: '如果您的邮箱存在于我们的数据库中,您将收到一封解锁账号的邮件.'
+ omniauth_callbacks:
+ success: '成功地从 %{kind}获得授权.'
+ failure: '因为 %{reason},所以您无法从 %{kind}获得授权.'
+ mailer:
+ confirmation_instructions:
+ subject: '激活信息'
+ reset_password_instructions:
+ subject: '重置密码信息'
+ unlock_instructions:
+ subject: '解锁信息'
+ views:
+ commons:
+ sidebar:
+ title: '操作面版'
+ links:
+ sign_in: '登录'
+ sign_up: '注册'
+ forget_pass: '忘记密码?'
+ resend_confirmation: "没有收到确认指令?"
+ resend_unlock: "没有收到解锁指令?"
+ omni_auth: "用%{provider}登录"
+ confirmations:
+ new:
+ title: '重新发送确认指令'
+ submit: '重发确认邮件'
+ passwords:
+ edit:
+ title: '修改密码'
+ submit: '修改'
+ new:
+ title: '忘记密码'
+ submit: '发送重置邮件'
+ registrations:
+ edit:
+ title: '更改注册信息'
+ password: '修改密码'
+ submit: '修改'
+ change_pass_tip: "如果你不想改变,留下空白"
+ new:
+ title: '注册'
+ submit: '注册'
+ binding:
+ title: '绑定'
+ submit: '绑定'
+ sessions:
+ new:
+ title: '登录'
+ submit: '登录'
+ remember_me: '记住我'
+ unlocks:
+ new:
+ title: '重发解锁指令'
+ submit: '重发解锁邮件'
+ navigation:
+ sign_in: '登录'
+ sign_up: '注册'
+ sign_out: '退出'
+ change_password: '修改密码'
+ change_registration: '修改登记'
+

0 comments on commit 832ac88

Please sign in to comment.