Permalink
Browse files

Merge branch 'develop' of http://github.com/Th0ar/zjforum into develop

Conflicts:
	app/views/events/_form.html.slim
	app/views/user_manage/_form.html.slim
  • Loading branch information...
2 parents 1bad461 + 4b17616 commit e98d741965b69cb41f7ffa366cd8b374fdb2fdd3 @ranxian committed Oct 30, 2012
Showing with 394 additions and 158 deletions.
  1. BIN app/assets/images/fallback/big_default.jpg
  2. 0 app/assets/images/fallback/{thumb_default .jpg → thumb_default.jpg}
  3. 0 app/assets/images/icon/{finish.png → finished.png}
  4. BIN app/assets/images/icon/todo.png
  5. BIN app/assets/images/icon/unfinished.png
  6. +5 −0 app/assets/javascripts/application.js
  7. +21 −2 app/assets/stylesheets/application.css.less
  8. +2 −2 app/assets/stylesheets/bootstrap/bootstrap.less
  9. +3 −3 app/controllers/home_controller.rb
  10. +1 −1 app/controllers/messages_controller.rb
  11. +1 −1 app/controllers/user_manage_controller.rb
  12. +1 −0 app/models/bigpic.rb
  13. +2 −1 app/models/message.rb
  14. +2 −0 app/models/post.rb
  15. +15 −12 app/views/bigpics/_form.html.slim
  16. +2 −7 app/views/bigpics/edit.html.slim
  17. +27 −15 app/views/bigpics/index.html.slim
  18. +2 −4 app/views/bigpics/new.html.slim
  19. +1 −1 app/views/devise/registrations/edit.html.slim
  20. +18 −3 app/views/donates/_form.html.slim
  21. +2 −7 app/views/donates/edit.html.slim
  22. +12 −19 app/views/donates/index.html.slim
  23. +1 −3 app/views/donates/new.html.slim
  24. +1 −1 app/views/events/index.html.slim
  25. +18 −10 app/views/home/index.html.slim
  26. +2 −2 app/views/kaminari/_first_page.html.slim
  27. +1 −1 app/views/kaminari/_gap.html.slim
  28. +2 −2 app/views/kaminari/_last_page.html.slim
  29. +2 −2 app/views/kaminari/_next_page.html.slim
  30. +2 −2 app/views/kaminari/_page.html.slim
  31. +11 −10 app/views/kaminari/_paginator.html.slim
  32. +2 −2 app/views/kaminari/_prev_page.html.slim
  33. +1 −0 app/views/layouts/application.html.slim
  34. +1 −0 app/views/layouts/devise/registrations.html.slim
  35. +3 −1 app/views/layouts/home.html.slim
  36. +1 −1 app/views/mates/index.html.slim
  37. +2 −3 app/views/mates/show.html.slim
  38. +2 −2 app/views/news/_form.html.slim
  39. +3 −3 app/views/posts/_form.html.slim
  40. +2 −7 app/views/posts/edit.html.slim
  41. +7 −8 app/views/posts/index.html.slim
  42. +4 −1 app/views/posts/show.html.slim
  43. +18 −14 app/views/user_manage/_form.html.slim
  44. +55 −3 app/views/user_manage/index.html.slim
  45. +136 −2 db/seeds.rb
View
BIN app/assets/images/fallback/big_default.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 ...assets/images/fallback/thumb_default .jpg → app/assets/images/fallback/thumb_default.jpg
File renamed without changes
View
0 app/assets/images/icon/finish.png → app/assets/images/icon/finished.png
File renamed without changes
View
BIN app/assets/images/icon/todo.png
Deleted file not rendered
View
BIN app/assets/images/icon/unfinished.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 app/assets/javascripts/application.js
@@ -25,4 +25,9 @@ jQuery(document).ready(function($) {
$('#Login').modal('show');
}
})
+ $('form textarea').keydown(function (e) {
+ if ( (e.metaKey || e.ctrlKey) && e.keyCode == 13) {
+ $(this).closest('form').submit();
+ }
+ });
});
View
23 app/assets/stylesheets/application.css.less
@@ -23,6 +23,9 @@ small.author {
small.time {
color: #999;
font-size: 12px;
+ & > a {
+ color: #999;
+ }
}
a {
@@ -190,13 +193,29 @@ i.img-finish {
display: block;
width: 28px;
height: 28px;
- background-image: url(/assets/icon/finish.png);
+ background-image: url(/assets/icon/finished.png);
background-repeat: no-repeat;
}
i.img-todo {
display: block;
width: 28px;
height: 28px;
- background-image: url(/assets/icon/todo.png);
+ background-image: url(/assets/icon/unfinished.png);
background-repeat: no-repeat;
+}
+
+div.pagination {
+ margin: 0px 10px;
+ a {
+ line-height: 16px;
+ padding: 6px 10px;
+ color: #8b5700;
+ &:hover {
+ color: #d69461;
+ }
+ }
+}
+
+.well {
+ background-color: #FFFFFF;
}
View
4 app/assets/stylesheets/bootstrap/bootstrap.less
@@ -53,10 +53,10 @@
// Components: Misc
@import "thumbnails.less";
@import "labels-badges.less";
-@import "progress-bars.less";
+// @import "progress-bars.less";
// @import "accordion.less";
@import "carousel.less";
-@import "hero-unit.less";
+// @import "hero-unit.less";
// Utility classes
@import "utilities.less"; // Has to be last to override when necessary
View
6 app/controllers/home_controller.rb
@@ -1,8 +1,8 @@
class HomeController < ApplicationController
def index
- @news = News.all.limit(10)
- @events = Event.all.limit(4)
- @posts = Post.all.limit(10)
+ @news = News.all.limit(8)
+ @events = Event.all.limit(3)
+ @posts = Post.all.limit(8)
@bigpics = Bigpic.all
end
end
View
2 app/controllers/messages_controller.rb
@@ -3,7 +3,7 @@ class MessagesController < ApplicationController
# GET /messages
# GET /messages.json
def index
- @messages = Message.all.desc(:create_at).page(params[:page]).per(5)
+ @messages = Message.all.page(params[:page])
@message = Message.new
respond_to do |format|
View
2 app/controllers/user_manage_controller.rb
@@ -1,6 +1,6 @@
class UserManageController < ApplicationController
before_filter :ensure_admin!
- layout 'home'
+ layout 'devise/registrations'
def index
@users = User.all
View
1 app/models/bigpic.rb
@@ -3,5 +3,6 @@ class Bigpic
field :title
field :description
+ field :link
mount_uploader :image, BigpicUploader
end
View
3 app/models/message.rb
@@ -1,7 +1,8 @@
class Message
include Mongoid::Document
include Mongoid::Timestamps::Created
-
+
+ default_scope desc(:created_at)
field :content, type: String
belongs_to :author, class_name: 'User', inverse_of: nil
View
2 app/models/post.rb
@@ -11,6 +11,8 @@ def self.popular
field :title, type: String
field :content, type: String
field :readtimes, type: Integer, default: 0
+
+ validates_presence_of :title
belongs_to :author, class_name: 'User', inverse_of: 'posts'
has_many :comments
View
27 app/views/bigpics/_form.html.slim
@@ -1,18 +1,21 @@
-= form_for @bigpic, html: { multipart: true } do |f|
+= form_for @bigpic, html: { multipart: true, class: 'form-horizontal' } do |f|
- if @bigpic.errors.any?
#error_explanation
h2 = "#{pluralize(@bigpic.errors.count, "error")} prohibited this bigpic from being saved:"
ul
- @bigpic.errors.full_messages.each do |message|
li = message
-
- = f.label "标题"
- = f.text_field :title
-
- = f.label "描述"
- = f.text_area :description
-
- = f.label '待上传图片'
- = f.file_field :image
-
- .actions = f.submit 'Save'
+ .control-group
+ = f.label :title, "标题", class: 'control-label'
+ .controls = f.text_field :title
+ .control-group
+ = f.label :description, "描述", class: 'control-label'
+ .controls = f.text_area :description, rows: '8'
+ .control-group
+ = f.label :link, "链接至", class: 'control-label'
+ .controls = f.text_field :link
+ .control-group
+ = f.label :image, '待上传图片', class: 'control-label'
+ .controls = f.file_field :image
+ .form-actions
+ = f.submit '保存', class: 'btn btn-primar-0-y'
View
9 app/views/bigpics/edit.html.slim
@@ -1,8 +1,3 @@
-h1 Editing bigpic
-
-== render 'form'
-
-= link_to 'Show', @bigpic
-'|
-= link_to 'Back', bigpics_path
+h1 编辑首页图片
+== render 'form'
View
42 app/views/bigpics/index.html.slim
@@ -1,19 +1,31 @@
-h1 Listing bigpics
+- content_for :style do
+ less:
+ dl {
+ position: relative;
+ i {
+ position: absolute;
+ left: 30px;
+ top: 20px;
+ }
+ }
-table
- tr
- th
- th
- th
- - @bigpics.each do |bigpic|
- tr
- td
- = image_tag(bigpic.image, width: 70)
- td = link_to 'Show', bigpic
- td = link_to 'Edit', edit_bigpic_path(bigpic)
- td = link_to 'Destroy', bigpic, :confirm => 'Are you sure?', :method => :delete
+h1
+ | 首页图片
+ = link_to '添加首页图片', new_bigpic_path, class: "btn btn-primar-0-y pull-right"
-br
-= link_to 'New Bigpic', new_bigpic_path
+- @bigpics.each do |bigpic|
+ dl.dl-horizontal id="#{bigpic.id}"
+ dt 标题:
+ dd = bigpic.title
+ dt 详情:
+ dd = bigpic.description
+ dt 链接至:
+ dd = link_to bigpic.link, bigpic.link
+ .clearboth
+ dt 图片:
+ dd = image_tag(bigpic.image, width: 400)
+ .pull-right
+ = link_to '[编辑]', edit_bigpic_path(bigpic)
+ = link_to '[删除]', bigpic, :confirm => '你确定要删除吗?', :method => :delete
View
6 app/views/bigpics/new.html.slim
@@ -1,5 +1,3 @@
-h1 New bigpic
+h1 添加首页图片
-== render 'form'
-
-= link_to 'Back', bigpics_path
+== render 'form'
View
2 app/views/devise/registrations/edit.html.slim
@@ -19,4 +19,4 @@ legend 编辑用户资料
= f.label :avatar, '头像', class: 'control-label'
.controls = f.file_field :avatar
.form-actions
- = f.submit '更新', class: 'btn btn-primar-0-y'
+ = f.submit '更改', class: 'btn btn-primar-0-y'
View
21 app/views/donates/_form.html.slim
@@ -1,3 +1,12 @@
+- content_for :style do
+ less:
+ form .field input, form .field textarea {
+ width: 596px;
+ }
+
+
+
+
= form_for @donate do |f|
- if @donate.errors.any?
#error_explanation
@@ -7,6 +16,12 @@
li = message
.field
- = f.label :content
- = f.text_field :content
- .actions = f.submit 'Save'
+ = f.kindeditor :content, width: '608px', height: '500px', placeholder: '正文', items: [ 'source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste',
+ 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
+ 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'subscript',
+ 'superscript', '|', 'clearhtml', 'quickformat', '/',
+ 'formatblock', 'fontsize','|', 'forecolor', 'hilitecolor', 'bold',
+ 'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image', 'flash',
+ 'media', 'insertfile', '|', 'table', 'hr', 'emoticons',
+ 'anchor', 'link', 'unlink'], cssData: 'img{max-width:600px}'
+ .actions = f.submit '保存', class: 'btn btn-primar-0-y'
View
9 app/views/donates/edit.html.slim
@@ -1,8 +1,3 @@
-h1 Editing donate
-
-== render 'form'
-
-= link_to 'Show', @donate
-'|
-= link_to 'Back', donates_path
+h1 编辑赞助
+== render 'form'
View
31 app/views/donates/index.html.slim
@@ -1,19 +1,12 @@
-h1 Listing donates
-
-table
- tr
- th Content
- th
- th
- th
-
- - @donates.each do |donate|
- tr
- td = donate.content
- td = link_to 'Show', donate
- td = link_to 'Edit', edit_donate_path(donate)
- td = link_to 'Destroy', donate, :confirm => '你确定要删除吗?', :method => :delete
-
-br
-
-= link_to 'New Donate', new_donate_path
+h1
+ | 赞助列表
+ = 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
+
View
4 app/views/donates/new.html.slim
@@ -1,5 +1,3 @@
-h1 New donate
+h1 新建赞助
== render 'form'
-
-= link_to 'Back', donates_path
View
2 app/views/events/index.html.slim
@@ -30,7 +30,7 @@ h1
= link_to '[编辑]', edit_event_path(event)
= link_to '[删除]', event, :confirm => '你确定要删除吗?', :method => :delete
.clearboth
- == 1 ? '<i class="img-finish"></i>' : '<i class="i.img-todo"></i>'
+ == false ? '<i class="img-finish"></i>' : '<i class="img-todo"></i>'
hr
= paginate @events
View
28 app/views/home/index.html.slim
@@ -29,8 +29,14 @@
}
.manage {
position: absolute;
- right: 5px;
- bottom: 5px;
+ right: 6px;
+ top: 6px;
+ padding: 2px;
+ border-radius: 3px;
+ &:hover {
+ background-color: #FFF;
+ background-color: rgba(255,255,255,0.7);
+ }
}
}
.red-block {
@@ -89,6 +95,7 @@
}
- content_for :script do
javascript:
+ $('#Carousel .item:first-child').addClass('active');
$('#Carousel').carousel();
@@ -101,13 +108,14 @@
- @bigpics.each do |pic|
.item
= image_tag pic.image, size: '660x334'
- a.carousel-caption href="#"
+ a.carousel-caption href="#{pic.link}"
h4 = pic.title
p = pic.description
a.carousel-control.left href="#Carousel" data-slide="prev" &lsaquo;
a.carousel-control.right href="#Carousel" data-slide="next" &rsaquo;
- = link_to bigpics_path, class: 'manage' do
- i.icon-pencil
+ - if current_user and current_user.admin?
+ = link_to bigpics_path, class: 'manage' do
+ i.icon-pencil
.row
.span5.red-block
@@ -148,16 +156,16 @@
.yellow-block
.yellow-ribbon
- h4: a href="#" 通讯
+ h4: a 通讯
ul.unstyled.broadcast
- News.reports.each do |press|
li
- a href="#"
- = press.title
- = image_tag(press.images.first)
+ = link_to press do
+ div = press.title
+ = image_tag press.images.first, width: '190'
.yellow-ribbon
- h4 相关链接
+ h4: a 相关链接
.relative-link
a href="http://www.pku.edu.cn/" 北京大学
a href="http://www.bdwm.net/" 北大未名BBS
View
4 app/views/kaminari/_first_page.html.slim
@@ -5,6 +5,6 @@
total_pages : total number of pages
per_page : number of items to fetch per page
remote : data-remote
-span.first
- == link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote
+li.first
+ == link_to_unless current_page.first?, '<<', url, :remote => remote
'
View
2 app/views/kaminari/_gap.html.slim
@@ -4,6 +4,6 @@
total_pages : total number of pages
per_page : number of items to fetch per page
remote : data-remote
-span.page.gap
+li.page.gap
== raw(t 'views.pagination.truncate')
'
View
4 app/views/kaminari/_last_page.html.slim
@@ -5,6 +5,6 @@
total_pages : total number of pages
per_page : number of items to fetch per page
remote : data-remote
-span.last
- == link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote}
+li.last
+ == link_to_unless current_page.last?, '>>', url, {:remote => remote}
'
View
4 app/views/kaminari/_next_page.html.slim
@@ -5,6 +5,6 @@
total_pages : total number of pages
per_page : number of items to fetch per page
remote : data-remote
-span.next
- == link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote
+li.next
+ == link_to_unless current_page.last?, '>', url, :rel => 'next', :remote => remote
'
View
4 app/views/kaminari/_page.html.slim
@@ -6,6 +6,6 @@
total_pages : total number of pages
per_page : number of items to fetch per page
remote : data-remote
-span class="page#{' current' if page.current?}"
- == link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
+li class="page#{' active' if page.current?}"
+ == link_to page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil}
'
View
21 app/views/kaminari/_paginator.html.slim
@@ -7,13 +7,14 @@
paginator : the paginator that renders the pagination tags inside
== paginator.render do
- nav.pagination
- == first_page_tag unless current_page.first?
- == prev_page_tag unless current_page.first?
- - each_page do |page|
- - if page.left_outer? || page.right_outer? || page.inside_window?
- == page_tag page
- - elsif !page.was_truncated?
- == gap_tag
- == next_page_tag unless current_page.last?
- == last_page_tag unless current_page.last?
+ div.pagination.pagination-centered
+ ul
+ == first_page_tag unless current_page.first?
+ == prev_page_tag unless current_page.first?
+ - each_page do |page|
+ - if page.left_outer? || page.right_outer? || page.inside_window?
+ == page_tag page
+ - elsif !page.was_truncated?
+ == gap_tag
+ == next_page_tag unless current_page.last?
+ == last_page_tag unless current_page.last?
View
4 app/views/kaminari/_prev_page.html.slim
@@ -5,6 +5,6 @@
total_pages : total number of pages
per_page : number of items to fetch per page
remote : data-remote
-span.prev
- == link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote
+li.prev
+ == link_to_unless current_page.first?, '<', url, :rel => 'prev', :remote => remote
'
View
1 app/views/layouts/application.html.slim
@@ -25,6 +25,7 @@ html
li = link_to '讨论版', posts_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:;" 登陆
View
1 app/views/layouts/devise/registrations.html.slim
@@ -22,6 +22,7 @@ html
li = link_to '留言板', messages_path
li = link_to '讨论版', posts_path
li = link_to '赞助', donates_path
+ li = link_to '近期活动', events_path
ul.nav.pull-right
- if not user_signed_in?
li: a.login-btn href="javascript:;" 登陆
View
4 app/views/layouts/home.html.slim
@@ -5,9 +5,9 @@ html
meta name="keywords" content=""
meta name="author" content=""
= stylesheet_link_tag "application", :media => "all"
- = javascript_include_tag "application", media: "all"
= csrf_meta_tags
= yield :style
+
body
#top-banner
.container
@@ -23,6 +23,7 @@ html
li = link_to '留言板', messages_path
li = link_to '讨论版', posts_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?
@@ -45,4 +46,5 @@ html
+ = javascript_include_tag "application", media: "all"
= yield :script
View
2 app/views/mates/index.html.slim
@@ -45,7 +45,7 @@ ul.thumbnails style="margin-left: px;"
- @mates.each_with_index do |mate, index|
li.span3
= link_to mate, class: 'thumbnail' do
- = image_tag(mate.photo.small, height: 180, width: 180)
+ = image_tag(mate.photo.small, width: 180)
.caption
h4 = mate.name
p = mate.tagline
View
5 app/views/mates/show.html.slim
@@ -9,7 +9,7 @@
.row
.span4
- = image_tag(@mate.photo.big, height: 400, width: 400)
+ = image_tag(@mate.photo.big, width: 400)
.span5
dl.dl-horizontal
@@ -21,10 +21,9 @@
dd: p = @mate.description
dt 联系方式:
dd: p = @mate.contact
- br
+ br.clearboth
dd
= link_to '[编辑]', edit_mate_path(@mate)
- | &nbsp;|&nbsp;
= link_to '[删除]', @mate, :confirm => '你确定要删除吗?', :method => :delete
View
4 app/views/news/_form.html.slim
@@ -1,6 +1,6 @@
- content_for :style do
less:
- form .field > * {
+ form .field input, form .field textarea {
width: 596px;
}
@@ -23,5 +23,5 @@
'formatblock', 'fontsize','|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image', 'flash',
'media', 'insertfile', '|', 'table', 'hr', 'emoticons',
- 'anchor', 'link', 'unlink']
+ 'anchor', 'link', 'unlink'], cssData: 'img{max-width:600px}'
.actions = f.submit '发布', class: 'btn btn-primar-0-y'
View
6 app/views/posts/_form.html.slim
@@ -1,6 +1,6 @@
- content_for :style do
less:
- form .field > * {
+ form .field input, form .field textarea {
width: 596px;
}
@@ -16,12 +16,12 @@
.field
= f.text_field :title, size: 100, placeholder: '标题'
.field
- = f.kindeditor :content, width: '608px', height: '500px', placeholder: '正文', items: [ 'source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste',
+ = f.kindeditor :content, width: '608px', height: '300px', placeholder: '正文', items: [ 'source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'subscript',
'superscript', '|', 'clearhtml', 'quickformat', '/',
'formatblock', 'fontsize','|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image', 'flash',
'media', 'insertfile', '|', 'table', 'hr', 'emoticons',
- 'anchor', 'link', 'unlink']
+ 'anchor', 'link', 'unlink'], cssData: 'img{max-width:600px}', allowFileManager: false, allowMediaUpload: false, allowFlashUpload: false
.actions = f.submit '发布', class: 'btn btn-primar-0-y'
View
9 app/views/posts/edit.html.slim
@@ -1,8 +1,3 @@
-h1 Editing post
-
-== render 'form'
-
-= link_to 'Show', @post
-'|
-= link_to 'Back', posts_path
+h1 编辑帖子
+== render 'form'
View
15 app/views/posts/index.html.slim
@@ -19,7 +19,7 @@
color: #555;
font-size: 14px;
&.title {
- min-width: 340px;
+ min-width: 300px;
}
&.author {
@@ -50,20 +50,19 @@ table.table
th.author 作者
th.created_at 发布时间
th.reply-count 回复/阅读
- - if current_user and current_user.admin?
- th.delete
- @posts.each do |post|
tr
td = link_to post.title, post, class: 'black'
td = post.author.name if post.author
td = simplify_time(post.created_at)
- td = post.comments.count.to_s + "/" + post.readtimes.to_s
- - if current_user and current_user.admin?
- td
- = link_to post, :method => :delete, remote: true, class: "delete-alert" do
+ td
+ = post.comments.count.to_s + "/" + post.readtimes.to_s
+ - if current_user and current_user.admin?
+ = link_to post, :method => :delete, remote: true, class: "delete-alert pull-right" do
i.icon-remove
- = paginate @posts
+
+= paginate @posts
= content_for :script do
View
5 app/views/posts/show.html.slim
@@ -58,12 +58,15 @@
.post
= image_tag @post.author.avatar, width: '80', height: '80', class: 'pull-left'
- div style="margin-left: 90px;"
+ div style="margin-left: 90px; min-height: 80px;"
h4 style="margin-top: 0px;" = @post.title
p
small.author = @post.author.name
| &nbsp;&nbsp;
small.time = beautify_time(@post.created_at)
+ | &nbsp;&nbsp;
+ = link_to edit_post_path(@post), class: 'pkjsdaull-right' do
+ i.icon-pencil
== @post.content
ul.comments.unstyled
View
32 app/views/user_manage/_form.html.slim
@@ -1,21 +1,25 @@
-= form_for @user, url: { action: :update } do |f|
+= form_for @user, url: { action: :update }, html: { class: 'form-horizontal' } do |f|
- if @user.errors.any?
#error_explanation
h2 = "#{pluralize(@user.errors.count, "error")} prohibited this user from being saved:"
ul
- @user.errors.full_messages.each do |message|
li = message
- .field
- = f.label :name
- = f.text_field :name
- .field
- = f.label :depart
- = f.text_field :depart
- .field
- = f.label :phone
- = f.text_field :phone
- .field
- = f.label :description
- = f.text_field :description
- .actions = f.submit 'Save'
+ .control-group
+ = f.label :name, '姓名', class: 'control-label'
+ .controls = f.text_field :name
+ .control-group
+ = f.label :email, '邮箱', class: 'control-label'
+ .controls = f.text_field :email
+ .control-group
+ = f.label :phone, '联系方式', class: 'control-label'
+ .controls = f.text_field :phone
+ .control-group
+ = f.label :depart, '部门', class: 'control-label'
+ .controls = f.text_field :depart
+ .control-group
+ = f.label :avatar, '头像', class: 'control-label'
+ .controls = f.file_field :avatar
+ .form-actions
+ = f.submit '更新', class: 'btn btn-primar-0-y'
View
58 app/views/user_manage/index.html.slim
@@ -1,3 +1,55 @@
-- @users.each do |user|
- = link_to user.name, edit_user_manage_path(user)
- = link_to "删除", delete_user_manage_path(user), method: :delete
+- content_for :style do
+ less:
+ .user-list > div {
+ position: relative;
+ & > a.card {
+ padding: 5px;
+ margin: 5px;
+ display: block;
+ text-decoration: none;
+ }
+ a.delete {
+ display: none;
+ right: 0px;
+ top: 0px;
+ width: 60px;
+ position: absolute;
+ font-size: 42px;
+ line-height: 60px;
+ text-align: center;
+ &:hover {
+ text-decoration: none;
+ background-color: #e1e2c5;
+ }
+ }
+ &:hover {
+ background-color: #f0f1d7;
+ box-shadow: 0 0 3px rgba(0,0,0,0.2);
+ a.delete {
+ display: block;
+ }
+ }
+ }
+
+
+.offset1.span5.user-list
+ - @users.each do |user|
+ div
+ = link_to edit_user_manage_path(user), class: 'card' do
+ = image_tag user.avatar, size: '50x50', class: 'pull-left'
+ div style="margin-left: 60px;"
+ h5 style="margin: 0px; padding: 3px 0px;"
+ = user.name
+ p style="margin: 0px; color: #999;" = user.email
+ .clearboth
+ = link_to "×", delete_user_manage_path(user), method: :delete, remote: true, class: 'delete'
+
+= content_for :script do
+ javascript:
+ $('.delete').click(function(){
+ if (confirm('确认删除吗?')) {
+ $(this).parent().slideUp('slow');
+ return true;
+ }
+ return false;
+ })
View
138 db/seeds.rb
@@ -23,6 +23,24 @@
news1.clone.save!
news1.clone.save!
news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
+news1.clone.save!
Event.delete_all
event1 = Event.create!(title: '2012北京大学浙江籍和赴浙江工作毕业生欢送酒会',
@@ -41,11 +59,127 @@
event1.clone.save!
User.delete_all
-user1 = User.create(name: '测试用户1', email: 'test1@test.com', password: '12345678')
-admin = User.create(name: 'admin', email: '1100012783@pku.edu.cn', password: 'admin', admin?: true)
+user1 = User.create(name: '测试用户1', email: 'test1@test.com', password: '12345678', admin?: true)
+admin = User.create(name: 'admin', email: 'admin@test.com', password: 'admin', admin?: true)
Post.delete_all
post1 = Post.create(title: '这个项目简单吗?', content: '简单吗?不简单吗?不简单?简单?', author: user1.id)
post1.clone.save
post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
+post1.clone.save
post1.clone.save

0 comments on commit e98d741

Please sign in to comment.