This commit is contained in:
yafeilee 2014-03-31 16:06:15 +08:00
parent a1c5e52b37
commit 5e7c35d9b3
12 changed files with 124 additions and 72 deletions

View File

@ -0,0 +1,3 @@
.dash-title {
padding-top: 2rem;
}

View File

@ -1,57 +1,12 @@
// Place all the styles related to the admin/posts controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.admin-posts-field {
#post_content {
width: 800px;
height: 390px;
}
#post_content {
min-height: 20rem;
}
div.submit {
display: block;
line-height: 40px;
width: 805px;
background-color: #CCC;
padding-left: 16px;
font-size: 20px;
}
#upload_photo {
float: right;
margin-top: 2rem;
}
ul.tab {
margin: 10px 0 10px 0;
overflow: hidden;
li {
float: left;
padding: 5px 5px;
border: 1px solid #CCC;
cursor: pointer;
}
li.active {
border-bottom: none;
border-top: 1px solid #CCC;
}
li:not(.active) {
border-top: none;
border-top-right-radius: none;
border-top-left-radius: none;
}
li#content {
border-top-left-radius: 10px;
border-right: none;
}
li#preview {
border-right-bottom-radius: 10px;
border-top-right-radius: 10px;
}
}
div.preview {
width: 800px;
min-height: 396px;
border: 1px solid #CCC;
padding: 5px 5px;
display: none;
}
#upload_photo {
float: right;
}

View File

@ -0,0 +1,7 @@
class Admin::DashboardController < ApplicationController
layout 'layouts/admin'
before_action :authericate_user!
def index
end
end

View File

@ -1,4 +1,7 @@
class Admin::PostsController < ApplicationController
layout 'layouts/admin'
before_action :authericate_user!
def new
@post = Post.new
end

View File

@ -10,4 +10,8 @@ class ApplicationController < ActionController::Base
def format_date(time)
time.strftime("%Y.%m.%d")
end
protected
def authericate_user!
end
end

View File

@ -1,2 +0,0 @@
module Admin::PostsHelper
end

View File

@ -0,0 +1,20 @@
.row
.small-12.columns
h2.dash-title 统计信息
hr
table width="100%"
thead
tr
th 条目
th 数据
tbody
tr
td 总博客数
td 1000
tr
td 总评论数
td 1000
tr
td 总浏览量
td 1000

View File

@ -1,14 +1,24 @@
= simple_form_for(@post, :url=> admin_posts_path(@post)) do |f|
= f.input :title
ul.tab
li#content.active
| content
li#preview url=preview_admin_posts_path
| preview
= link_to t(:upload_photo), "#", :id=>'upload_photo'
input[type="file" style="display: none;"]
= f.input :content, :as=> :text, :label=>false
.preview.wikistyle
= f.input :type, :as=>:select, :collection=> [ Post::TECH, Post::LIFE, Post::CREATOR ], :include_blank=>false
.submit
= f.submit
.admin-posts-field
= simple_form_for(@post, :url=> admin_posts_path(@post)) do |f|
.row
.large-6.columns
= f.input :title, label: '标题'
.row
.small-6.large-3.columns
= f.input :type, :as=>:select, :collection=> [ Post::TECH, Post::LIFE, Post::CREATOR ], label: '类别'
.row
.small-12.large-6.columns
= f.simple_fields_for :label do |p|
= p.input :name, label: '标签'
dl.tabs data-tab=""
dd.active
a href="#" 正文
dd
a href="#" 预览
= link_to t(:upload_photo), "#", :id=>'upload_photo'
input[type="file" style="display: none;"]
= f.input :content, :as=> :text, :label=>false
.preview.wikistyle
.row
.small-12.large-6.columns.posts-button
= f.button :submit, '提交', class: 'button'

View File

@ -1,2 +1,4 @@
h3 #{t('new_post')}
= render 'form'
.row
.small-12.columns
h3 #{t('new_post')}
= render 'form'

View File

@ -0,0 +1,38 @@
html
head
meta charset="utf-8"
meta name="viewport" content="width=device-width, initial-scale=1.0"
title Admin Page for WinDy's Blog
= stylesheet_link_tag "application"
= javascript_include_tag "vendor/modernizr"
= javascript_include_tag "application"
= csrf_meta_tags
body
nav.top-bar data-topbar=""
ul.title-area
li.name
h1
a href="#" Admin for WinDy
li.toggle-topbar.menu-icon
a href="#" Menu
section.top-bar-section
ul.left
li
= link_to '创建新博客', new_admin_post_path
li
a href="#" 管理博客
= yield
= render "layouts/footer"
javascript:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-32883596-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

View File

@ -20,8 +20,8 @@ WBlog::Application.routes.draw do
post :preview
end
end
root to: 'dashboard#index'
end
get '/about' => 'home#index'
get '/admin' => 'admin/posts#new'
get '/:type' => 'archives#index'
end

View File

@ -0,0 +1,12 @@
require 'spec_helper'
describe Admin::DashboardController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end