This commit is contained in:
parent
a1c5e52b37
commit
5e7c35d9b3
|
@ -0,0 +1,3 @@
|
||||||
|
.dash-title {
|
||||||
|
padding-top: 2rem;
|
||||||
|
}
|
|
@ -1,57 +1,12 @@
|
||||||
// Place all the styles related to the admin/posts controller here.
|
.admin-posts-field {
|
||||||
// They will automatically be included in application.css.
|
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
||||||
|
|
||||||
#post_content {
|
#post_content {
|
||||||
width: 800px;
|
min-height: 20rem;
|
||||||
height: 390px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.submit {
|
|
||||||
display: block;
|
|
||||||
line-height: 40px;
|
|
||||||
width: 805px;
|
|
||||||
background-color: #CCC;
|
|
||||||
padding-left: 16px;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
#upload_photo {
|
||||||
float: right;
|
float: right;
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
class Admin::DashboardController < ApplicationController
|
||||||
|
layout 'layouts/admin'
|
||||||
|
before_action :authericate_user!
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,4 +1,7 @@
|
||||||
class Admin::PostsController < ApplicationController
|
class Admin::PostsController < ApplicationController
|
||||||
|
layout 'layouts/admin'
|
||||||
|
before_action :authericate_user!
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@post = Post.new
|
@post = Post.new
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,4 +10,8 @@ class ApplicationController < ActionController::Base
|
||||||
def format_date(time)
|
def format_date(time)
|
||||||
time.strftime("%Y.%m.%d")
|
time.strftime("%Y.%m.%d")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
def authericate_user!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
module Admin::PostsHelper
|
|
||||||
end
|
|
|
@ -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
|
||||||
|
|
|
@ -1,14 +1,24 @@
|
||||||
|
.admin-posts-field
|
||||||
= simple_form_for(@post, :url=> admin_posts_path(@post)) do |f|
|
= simple_form_for(@post, :url=> admin_posts_path(@post)) do |f|
|
||||||
= f.input :title
|
.row
|
||||||
ul.tab
|
.large-6.columns
|
||||||
li#content.active
|
= f.input :title, label: '标题'
|
||||||
| content
|
.row
|
||||||
li#preview url=preview_admin_posts_path
|
.small-6.large-3.columns
|
||||||
| preview
|
= 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'
|
= link_to t(:upload_photo), "#", :id=>'upload_photo'
|
||||||
input[type="file" style="display: none;"]
|
input[type="file" style="display: none;"]
|
||||||
= f.input :content, :as=> :text, :label=>false
|
= f.input :content, :as=> :text, :label=>false
|
||||||
.preview.wikistyle
|
.preview.wikistyle
|
||||||
= f.input :type, :as=>:select, :collection=> [ Post::TECH, Post::LIFE, Post::CREATOR ], :include_blank=>false
|
.row
|
||||||
.submit
|
.small-12.large-6.columns.posts-button
|
||||||
= f.submit
|
= f.button :submit, '提交', class: 'button'
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
.row
|
||||||
|
.small-12.columns
|
||||||
h3 #{t('new_post')}
|
h3 #{t('new_post')}
|
||||||
= render 'form'
|
= render 'form'
|
||||||
|
|
|
@ -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);
|
||||||
|
})();
|
|
@ -20,8 +20,8 @@ WBlog::Application.routes.draw do
|
||||||
post :preview
|
post :preview
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
root to: 'dashboard#index'
|
||||||
end
|
end
|
||||||
get '/about' => 'home#index'
|
get '/about' => 'home#index'
|
||||||
get '/admin' => 'admin/posts#new'
|
|
||||||
get '/:type' => 'archives#index'
|
get '/:type' => 'archives#index'
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue