Permalink
Browse files

修改一些样式

  • Loading branch information...
1 parent e98d741 commit 17b0ee47629f8fe0114e019f299ff145001319cd @ranxian committed Oct 30, 2012
@@ -11,17 +11,6 @@ def index
end
end
- # GET /donates/1
- # GET /donates/1.json
- def show
- @donate = Donate.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @donate }
- end
- end
-
# GET /donates/new
# GET /donates/new.json
def new
@@ -45,7 +34,7 @@ def create
respond_to do |format|
if @donate.save
- format.html { redirect_to @donate, notice: 'Donate was successfully created.' }
+ format.html { redirect_to donates_path, notice: 'Donate was successfully created.' }
format.json { render json: @donate, status: :created, location: @donate }
else
format.html { render action: "new" }
@@ -3,7 +3,7 @@ class EventsController < ApplicationController
# GET /events
# GET /events.json
def index
- @events = Event.all.page params[:page]
+ @events = Event.all.page(params[:page]).per(5)
respond_to do |format|
format.html # index.html.erb
@@ -17,7 +17,7 @@ def show
@event = Event.find(params[:id])
respond_to do |format|
- format.html # show.html.erb
+ format.html { redirect_to events_path.to_s + "?page=#{@event.page}##{@event.id}" }
format.json { render json: @event }
end
end
@@ -45,7 +45,7 @@ def create
respond_to do |format|
if @event.save
- format.html { redirect_to @event, notice: 'Event was successfully created.' }
+ format.html { redirect_to events_path.to_s + "?page=#{@event.page}##{@event.id}", notice: 'Event was successfully created.' }
format.json { render json: @event, status: :created, location: @event }
else
format.html { render action: "new" }
@@ -61,7 +61,7 @@ def update
respond_to do |format|
if @event.update_attributes(params[:event])
- format.html { redirect_to @event, notice: 'Event was successfully updated.' }
+ format.html { redirect_to events_path.to_s + "?page=#{@event.page}##{@event.id}", notice: 'Event was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
@@ -81,4 +81,18 @@ def destroy
format.json { head :no_content }
end
end
+
+ def finish
+ @event = Event.find(params[:id])
+ @event.finished!
+
+ redirect_to :back
+ end
+
+ def unfinish
+ @event = Event.find(params[:id])
+ @event.unfinished!
+
+ redirect_to :back
+ end
end
@@ -62,7 +62,7 @@ def update
respond_to do |format|
if @mate.update_attributes(params[:mate])
- format.html { redirect_to @mate, notice: 'Mate was successfully updated.' }
+ format.html { redirect_to @mate, notice: '校友信息已经保存。' }
format.json { head :no_content }
else
format.html { render action: "edit" }
@@ -3,7 +3,7 @@ class MessagesController < ApplicationController
# GET /messages
# GET /messages.json
def index
- @messages = Message.all.page(params[:page])
+ @messages = Message.all.page(params[:page]).per(20)
@message = Message.new
respond_to do |format|
@@ -12,17 +12,6 @@ def index
end
end
- # # GET /messages/1
- # # GET /messages/1.json
- # def show
- # @message = Message.find(params[:id])
-
- # respond_to do |format|
- # format.html # show.html.erb
- # format.json { render json: @message }
- # end
- # end
-
# GET /messages/new
# GET /messages/new.json
def new
@@ -1,3 +1,4 @@
+# coding: utf-8
class PostsController < ApplicationController
before_filter :ensure_admin!
# GET /posts
@@ -48,7 +49,7 @@ def create
respond_to do |format|
if @post.save
- format.html { redirect_to @post, notice: 'Post was successfully created.' }
+ format.html { redirect_to @post, notice: '帖子已经成功发布!' }
format.json { render json: @post, status: :created, location: @post }
else
format.html { render action: "new" }
@@ -64,7 +65,7 @@ def update
respond_to do |format|
if @post.update_attributes(params[:post])
- format.html { redirect_to @post, notice: 'Post was successfully updated.' }
+ format.html { redirect_to @post, notice: '帖子已经成功更新!'}
format.json { head :no_content }
else
format.html { render action: "edit" }
@@ -1,3 +1,4 @@
+# coding: utf-8
class UserManageController < ApplicationController
before_filter :ensure_admin!
layout 'devise/registrations'
@@ -13,7 +14,8 @@ def edit
def update
@user = User.find(params[:id])
@user.update_attributes(params[:user])
- render :edit
+
+ redirect_to :back, :notice => '用户信息已经更新'
end
def destroy
@@ -6,4 +6,9 @@ def beautify_time(time)
def simplify_time(time)
time.strftime("%Y.%-m.%-d")
end
+
+ def admin?
+ return true
+ current_user && current_user.admin?
+ end
end
View
@@ -14,14 +14,18 @@ def self.unfinished
field :content, type: String
field :finished?, type: Boolean, default: false
- def finished
+ def finished!
self.update_attributes(finished?: true)
end
+ def unfinished!
+ self.update_attributes(finished?: false)
+ end
+
def page
current_page = 1
loop do
- documents = self.all.page current_page
+ documents = Event.all.page current_page
break if documents == nil
return current_page if documents.include?(self)
current_page += 1
@@ -28,4 +28,6 @@ h1
dd = image_tag(bigpic.image, width: 400)
.pull-right
= link_to '[编辑]', edit_bigpic_path(bigpic)
- = link_to '[删除]', bigpic, :confirm => '你确定要删除吗?', :method => :delete
+ = link_to '[删除]', bigpic, :confirm => '你确定要删除吗?', :method => :delete
+ - unless @bigpics.last == bigpic
+ hr
@@ -16,7 +16,7 @@
li = message
.field
- = f.kindeditor :content, width: '608px', height: '500px', placeholder: '正文', items: [ 'source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste',
+ = f.kindeditor :content, width: '608px', rows: 10, placeholder: '正文', items: [ 'source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'subscript',
'superscript', '|', 'clearhtml', 'quickformat', '/',
@@ -1,12 +1,15 @@
h1
| 赞助列表
- = link_to '新建赞助', new_donate_path, class: "btn btn-primar-0-y pull-right"
+ - if admin?
+ = link_to '新的赞助', new_donate_path, class: "btn btn-primar-0-y pull-right"
- @donates.each do |donate|
.well
== donate.content
| &nbsp;&nbsp;
- small.time = link_to '[编辑]', edit_donate_path(donate)
- small.time &nbsp;
- small.time = link_to '[删除]', donate, :confirm => '你确定要删除吗?', :method => :delete
+ - if admin?
+ .pull-right
+ small.time = link_to '[编辑]', edit_donate_path(donate)
+ small.time &nbsp;
+ small.time = link_to '[删除]', donate, :confirm => '你确定要删除吗?', :method => :delete
@@ -1,3 +1,3 @@
-h1 新建赞助
+h1 新的赞助
== render 'form'
@@ -6,15 +6,15 @@
- @event.errors.full_messages.each do |message|
li = message
.control-group
+ = f.label :title , '标题', class: 'control-label'
+ .controls = f.text_field :title
+ .control-group
= f.label :time , '时间', class: 'control-label'
.controls = f.text_field :time
.control-group
= f.label :place , '地点', class: 'control-label'
.controls = f.text_field :place
.control-group
- = f.label :title , '标题', class: 'control-label'
- .controls = f.text_field :title
- .control-group
= f.label :content , '详情', class: 'control-label'
.controls = f.text_area :content, rows: 10
.form-actions = f.submit '保存', class: 'btn btn-primar-0-y'
@@ -12,25 +12,30 @@
h1
| 近期活动
- = link_to '创建活动', new_event_path, class: "btn btn-primar-0-y pull-right"
+ - if admin?
+ = link_to '创建活动', new_event_path, class: "btn btn-primar-0-y pull-right"
- @events.each do |event|
dl.dl-horizontal id="#{event.id}"
+ dt 主题:
+ dd = event.title
dt 时间:
dd = event.time
dt 地点:
- dd = event.place
- dt 标题:
- dd = event.title
+ dd = event.place
dt 详情:
dd = event.content
- - if current_user and current_user.admin?
+ - if admin?
.pull-right
= link_to '[编辑]', edit_event_path(event)
+ - if event.finished?
+ = link_to '[标记未完成]', unfinish_event_path(event)
+ - else
+ = link_to '[标记已完成]', finish_event_path(event)
= link_to '[删除]', event, :confirm => '你确定要删除吗?', :method => :delete
.clearboth
- == false ? '<i class="img-finish"></i>' : '<i class="img-todo"></i>'
+ == event.finished? ? '<i class="img-finish"></i>' : '<i class="img-todo"></i>'
hr
- = paginate @events
+= paginate @events
@@ -1,18 +0,0 @@
-p#notice = notice
-
-p
- strong Title
- = @event.title
-p
- strong Time:
- = @event.time
-p
- strong Place:
- = @event.place
-p
- strong Description:
- = @event.content
-
-= link_to 'Edit', edit_event_path(@event)
-'|
-= link_to 'Back', events_path
@@ -113,7 +113,7 @@
p = pic.description
a.carousel-control.left href="#Carousel" data-slide="prev" &lsaquo;
a.carousel-control.right href="#Carousel" data-slide="next" &rsaquo;
- - if current_user and current_user.admin?
+ - if admin?
= link_to bigpics_path, class: 'manage' do
i.icon-pencil
@@ -13,7 +13,6 @@ html
#top-banner
.container
h1 之江发展论坛
- #debug = debug(params) if Rails.env.development?
#nav-bar
.container
.navbar
@@ -23,7 +22,7 @@ html
li = link_to '校友', mates_path
li = link_to '留言板', messages_path
li = link_to '讨论版', posts_path
- li = link_to '赞助', donates_path
+ li = link_to '支持我们', donates_path
li = link_to '近期活动', events_path
li = link_to '用户管理', user_manage_index_path
ul.nav.pull-right
@@ -11,7 +11,6 @@ html
#top-banner
.container
h1 之江发展论坛
- #debug = debug(params) if Rails.env.development?
#nav-bar
.container
.navbar
@@ -21,8 +20,9 @@ html
li = link_to '校友', mates_path
li = link_to '留言板', messages_path
li = link_to '讨论版', posts_path
- li = link_to '赞助', donates_path
+ li = link_to '支持我们', donates_path
li = link_to '近期活动', events_path
+ li = link_to '用户管理', user_manage_index_path
ul.nav.pull-right
- if not user_signed_in?
li: a.login-btn href="javascript:;" 登陆
@@ -12,7 +12,6 @@ html
#top-banner
.container
h1 之江发展论坛
- #debug = debug(params) if Rails.env.development?
#nav-bar
.container
.navbar
Oops, something went wrong.

0 comments on commit 17b0ee4

Please sign in to comment.