修改项目部分文件,start run

This commit is contained in:
tanhuazhe 2016-01-06 19:39:35 +08:00
parent 86af01ae3b
commit 689c5f7ad3
31 changed files with 1031 additions and 225 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -1,73 +0,0 @@
source 'https://ruby.taobao.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
#Use kaminari page
gem 'kaminari'
#Use settingslogic
gem 'settingslogic'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Use jquery as the JavaScript library
#gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use haml template
gem 'haml-rails'
# Use bootstrap css
gem 'bootstrap-sass'
gem 'font-awesome-sass-rails', '~> 3.0.2.2'
gem 'twitter-bootstrap-rails-confirm', github: 'fxhover/twitter-bootstrap-rails-confirm', branch: 'bootstrap3'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
#gem 'jbuilder', '~> 2.0'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development do
gem 'thin'
end
#Avatar
gem 'gravatar_image_tag'
#markdown
gem 'markdown-toolbar', git: 'https://github.com/fuksito/markdown-toolbar.git'
gem 'redcarpet'
gem 'simple_fileupload'
gem 'remotipart'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
#gem 'spring'
end

BIN
app/.DS_Store vendored

Binary file not shown.

View File

@ -14,3 +14,20 @@
//= require jquery_ujs
//= require turbolinks
//= require_tree .
$.fn.twitter_bootstrap_confirmbox.defaults = {
title: '提示',
cancel: '取消',
cancel_class: 'btn cancel',
proceed: '确定',
proceed_class: 'btn proceed btn-primary'
}
//markdown preview
function preview(text_area_id, content_id){
content = $('#' + text_area_id).val();
$.post('/blogs/preview', {content: content}, function(data){
if (data.status){
$('#' + content_id).html(data.message);
}
});
}

View File

@ -0,0 +1,4 @@
/**
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);

5
app/assets/javascripts/respond.min.js vendored Normal file
View File

@ -0,0 +1,5 @@
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
* */
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);

View File

@ -13,3 +13,214 @@
*= require_tree .
*= require_self
*/
.body_content {
margin-top: 60px;
}
.nav li a {
display: block;
position: relative;
}
.site-header .navbar-nav li {
margin-left: 20px;
}
.site-header .navbar-button li {
float: left;
}
.site-header .navbar-button li a {
width: 80px;
margin-top: 7px;
}
ul {
list-style: none outside none;
}
#keyword {
width: 200px;
}
.navbar-avatar img {
margin-top: 4px;
margin-right: 2px;
width: 40px;
height: 40px;
}
.active a {
color: #428bca !important;
background-color: #eeeeee !important;
}
#article_content {
height: 400px;
}
.article_content {
border: 1px solid #dddddd;
border-radius: 5px;
background-color: #ffffff;
margin-top: 10px;
padding: 5px 20px 5px 20px;
}
.article_content p {
height: 25px;
line-height: 25px;
font-size: 13px;
}
.article_des {
min-height: 100px;
display: block;
margin-bottom: 30px;
}
.sidebar {
padding-left: 50px !important;
}
body {
background-color: #f5f5f5 !important;
}
.label {
padding: 4px 10px 4px 10px !important;
margin-right: 10px !important;
}
.article_content p {
margin-top: 20px;
}
.article_content h3 {
font-size: 23px;
color: green;
}
p .icon {
margin-right: 20px;
}
.sub-tab a {
margin-left: 10px;
}
.sub-tab a:hover {
text-decoration: none;
}
.sort_navbar {
margin-top: 25px;
}
.sort_navbar a.current {
color: #666666;
}
#search_button {
color: #666666;
}
#search_button a:hover{
cursor: hand;
text-decoration: none !important;
}
.article-title {
color: #666666;
}
a .icon {
text-decoration: none;
}
a.disabled {
color: #333333;
}
a.disabled:hover {
color: #333333;
cursor: none;
}
h3 .icon {
font-size: 18px;
margin-left: 15px;
}
#article_comment_content {
height: 200px;
}
.comment_content {
margin-left: 20px;
}
.comment_content img{
max-width: 100%;
}
.comment_footer {
padding-right: 40px;
}
.comment_footer a {
font-size: 18px;
}
.comment_footer a {
margin-left: 8px;
}
.panel-body {
padding: 15px 30px 15px 30px !important;
}
.markdown-toolbar-panel {
padding-left: 5px !important;
width: 100% !important;
max-width: 100% !important;
height: 30px !important;
line-height: 30px !important;
}
.markdown-toolbar-panel .mdt_buttons div {
margin-right: 7px !important;
margin-top: 5px !important;
}
.error {
color: red;
}
.set_title {
margin-left: 20px;
}
#set_user_avatar {
margin-bottom: 10px;
max-width: 100px;
}
.avatar-field {
margin-top: 30px;
}
.set-btn {
padding: 10px 40px !important;
}
.blog-description {
height: 200px !important;
}
.footer {
height: 80px;
line-height: 80px;
}
.comment_avatar img {
max-width: 80px;
}
.new_comments li {
margin-top: 10px;
}

View File

@ -0,0 +1,751 @@
html {
height: 100%;
}
body {
min-height: 100%;
background-repeat: repeat-x;
background-position-y: 150px;
background-position-x: -500px;
}
a > img{
display:none;
}
/*overwrite bt style*/
.form-control:focus {
border-color: #a6a6a6;
outline: none;
-webkit-box-shadow: none;
box-shadow: none;
}
.content {
}
.content > h1{
height: 1px;
text-indent: -9999px;
}
/* ---------------------- */
.brand {
display: block;
margin: auto auto;
width: 250px;
height: 30px;
background-size: 185px 36px;
background-position: center;
background-repeat: no-repeat;
}
.brand:hover {
text-decoration: none;
}
.brand-third {
display: block;
margin: 0px auto;
background-position: center;
background-repeat: no-repeat;
}
.brand-xdf h1,.brand-github h1, .brand-evernote h1 {
text-indent: -9999px;
margin-top: 0px;
}
.brand h1 {
margin-top: 0px;
text-align: center;
}
.binding > div {
float: left;
height: 40px;
background-repeat: no-repeat;
}
.binding .cooperator.github{
width: 92px;
background-image: url(https://dn-st.qbox.me/pages/images/github@2x.jpg);
background-position: left center;
background-size: 92px 36px;
}
.binding .cooperator.mingdao{
width: 60px;
background-image: url(https://dn-st.qbox.me/pages/images/mingdao@2x.jpg);
background-position: -4px bottom;
background-size: 60px 36px;
}
.binding .arrow{
width: 27px;
height: 38px;
margin-left: 16px;
background-image: url(https://dn-st.qbox.me/pages/images/arrow@2x.png);
background-position: left center;
background-size: 27px 25px;
}
.binding .teambition {
width: 185px;
margin-left: 20px;
background-position: left top;
background-size: 185px 36px;
}
.slide-wrapper {
width: 300px;
overflow: hidden;
}
.slide-wrapper .slider{
position: relative;
width: 620px;
min-height: 500px;
/*white-space: nowrap;*/
-webkit-transition: -webkit-transform 0.3s ease-in-out;
-moz-transition: -moz-transform 0.3s ease-in-out;
-o-transition: -o-transform 0.3s ease-in-out;
transition: transform 0.3s ease-in-out;
}
.slide-wrapper .slider.active{
-webkit-transform: translate3d(-320px,0,0);
-moz-transform: translate3d(-320px,0,0);
-o-transform: translate3d(-320px,0,0);
transform: translate3d(-320px,0,0);
}
.slide-wrapper .slider .form-unit.create{
position: absolute;
left: 0;
opacity: 100;
}
.slide-wrapper .slider.active .form-unit.create{
opacity: 0;
}
.slide-wrapper .slider .form-unit.bind{
opacity: 0;
position: absolute;
left: 320px;
}
.slide-wrapper .slider.active .form-unit.bind{
opacity: 100;
}
.slide-wrapper .form-unit{
display: inline-block;
vertical-align: top;
margin-right: 20px;
-webkit-transition: opacity 0.6s ease-in-out;
-moz-transition: opacity 0.6s ease-in-out;
-o-transition: opacity 0.6s ease-in-out;
transition: opacity 0.6s ease-in-out;
}
.form-unit {
width: 480px;
margin: 30px auto;
padding: 50px;
box-shadow: 0 0 10px 4px rgba(0, 0, 0, .04);
background-color: white;
}
.form-unit > h2 {
text-align: center;
font-family: 'Open Sans', arial;
-webkit-font-smoothing: antialiased; color: #555;
font-size: 24px;
margin-top: 0px;
margin-bottom: 30px;
}
.form-unit > h3 {
text-align: center;
font-family: 'Open Sans', arial;
-webkit-font-smoothing: antialiased;
color: #555;
font-size: 18px;
font-weight: 400;
margin: 25px 0;
}
.form-unit.info{
width: 500px;
margin-top: 100px;
text-align: left;
}
.form-unit.info .success-icon{
/*display: inline-block;*/
float: left;
width: 100px;
height: 100px;
background-image: url('https://dn-st.qbox.me/pages/images/success-info-icon.png');
background-repeat: no-repeat;
background-position: left 23px;
background-size: 70px 71px;
}
.form-unit.info .error-icon{
/*display: inline-block;*/
float: left;
width: 100px;
height: 100px;
background-image: url('https://dn-st.qbox.me/pages/images/error-info-icon.png');
background-repeat: no-repeat;
background-position: left 23px;
background-size: 70px 71px;
}
.form-unit.info .info-content{
float: left;
width: 400px;
}
.form-unit .info-content h1{
margin-top: 20px;
font-size: 34px;
color: #66819d;
font-weight: normal;
}
.form-unit .info-content h2 {
margin-bottom: 20px;
font-size: 18px;
font-weight: normal;
font-family: Helvetica;
color: #a7b5c4;
}
.form-unit .button-wrapper .btn{
display: inline-block;
width: 160px;
height: 40px;
margin-right: 10px;
padding: 0;
line-height: 40px;
font-size: 16px;
color: #66819d;
}
.form-unit .button-wrapper .btn-primary{
color: #fff;
text-shadow: 0 1px #111;
}
.form-unit .error-block{
position: relative;
display: inline-block;
padding: 5px 7px;
margin-bottom: 13px;
color: #d58a8a;
border: 1px solid #d58a8a;
border-radius: 3px;
background-color: #fff4f4;
}
.third-accounts-login {
margin-top: 30px;
margin-bottom: -20px;
color: #aaa;
}
.third-accounts-login a {
text-indent: -10000px;
display: inline-block;
margin-right: 10px;
height: 22px;
width: 22px;
}
.third-accounts-login a.github {
background-position:0 -66px;
}
.third-accounts-login a.evernote {
background-position:0 -22px;
}
.third-accounts-login a.github:hover {
background-position:0 -44px;
}
.third-accounts-login a.evernote:hover {
background-position:0 0px;
}
.production-list {
text-align: center;
margin-top: 100px;
}
.production-list ul {
list-style: none;
padding-left: 0px;
}
.production-list li {
display: inline-block;
}
.production-list li a {
text-decoration: none;
}
.production-list li {
display: inline-block;
width: 230px;
}
.production-list li div {
text-indent: -9999px;
width: 40px;
height: 40px;
margin: 0 5px;
background-size: 80px 40px;
margin: auto;
}
.production-list li p {
color: gray;
}
.production-list li h4 {
color: #383838;
}
.production-list .teambition-app, .production-list .today-app {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transition: box-shadow ease-in-out 218ms,-webkit-transform 218ms ease-in-out;
transition: box-shadow ease-in-out 218ms,transform 218ms ease-in-out;
}
.production-list .teambition-app:hover, .production-list .today-app:hover {
-webkit-transform: translate3d(0, -3px, 0);
transform: translate3d(0, -3px, 0);
}
.production-list .teambition-app {
box-shadow: 0 0 3px #ccc;
border-radius: 3px;
}
.production-list .today-app {
background-position: -40px 0;
}
.auth-form .form-field {
position: relative;
}
.auth-form .form-field .icon {
position: absolute;
font-size: 20px;
top: 10px;
left: 12px;
color: #c0c0c0;
}
.auth-form .form-control {
-webkit-box-shadow: none;
box-shadow: none;
}
.auth-form input {
height: 48px;
width: 100%;
margin-bottom: 20px;
font-size: 16px;
}
.auth-form input:focus + .icon {
color: gray;
}
.auth-form .email {
padding-left: 50px;
}
.auth-form .password {
padding-left: 50px;
}
.auth-form .name {
padding-left: 50px;
}
.auth-form label {
position: absolute;
left: 350px;
top: 50px;
color: #b94a48;
}
.auth-form .btn {
padding: 12px;
font-size: 18px;
border-radius: 4px;
width: 100%;
margin: 10px 0;
display: inline-block;
outline: none;
}
.auth-form .btn:focus {
outline: none;
}
/*认证 授权*/
.authorize-unit .btn {
width: 49%;
display:inline-block;
}
.authorize-unit .btn-link {
color: #aaa;
}
.authorize-unit .authorize-data {
color: #838383;
text-align: center;
margin-top: -15px;
margin-bottom: 0px;
}
.authorize-unit .avatar {
display: block;
width: 100px;
height: 100px;
background-size: 100px 100px;
background-color: #eee;
margin: 30px auto;
margin-bottom: 0px;
}
.authorize-unit h3 {
text-align: center;
margin-top: 10px;
}
.authorize-unit .account-email {
text-align: center;
margin-top: 8px;
}
.auth-form .action-wrapper > a,
.auth-form .action-wrapper > span {
color: #aaa;
font-size: 14px;
}
.action-wrapper {
margin-top: 10px;
text-align: right;
}
.action-wrapper > a:hover {
text-decoration: none;
}
.cooperator-wrapper{
position: absolute;
left: 400px;
top: 200px;
padding-left: 30px;
}
.cooperator-wrapper::before{
content: '';
position: absolute;
height: 130px;
width: 1px;
background-color: #ddd;
left: 0;
top: 30px;
}
.cooperator-wrapper > p{
opacity: 0;
margin-bottom: 10px;
font-size: 13px;
font-weight: normal;
color: #a6a6a6;
}
.cooperator-wrapper a.btn{
display: block;
width: 200px;
height: 50px;
line-height: 34px;
margin-bottom: 30px;
color: #808080;
text-align: left;
background-image: -webkit-linear-gradient(top, #fefefe, #fcfcfc);
background-image: -moz-linear-gradient(top, #fefefe, #fcfcfc);
background-image: -o-linear-gradient(top, #fefefe, #fcfcfc);
background-image: -linear-gradient(top, #fefefe, #fcfcfc);
}
.cooperator-wrapper a.btn:hover{
border: 1px solid #bbb;
}
.cooperator-wrapper a.btn i.icon{
display: inline-block;
width: 25px;
height: 25px;
margin: -4px 15px 0 5px;
background-size: 25px 25px;
vertical-align: middle;
}
.cooperator-wrapper a.btn i.icon.github-icon{
background-image: url(https://dn-st.qbox.me/pages/images/icon-github@2x.jpg);
}
.cooperator-wrapper a.btn i.icon.mingdao-icon{
background-image: url(https://dn-st.qbox.me/pages/images/icon-mingdao@2x.jpg);
}
/* members list */
.member-list-container {
margin-top: 30px;
}
.member-list {
list-style: none;
padding-left: 0;
margin-top: 20px;
margin-bottom: 0;
}
.member {
position: relative;
padding-left: 50px;
margin-top: 26px;
}
.member div {
position: absolute;
left: 0;
}
.member h5 {
margin-top: 0px;
margin-bottom: 4px;
}
.member p {
color: #a0a0a0;
}
.img-36 {
display: inline-block;
width: 36px;
height: 36px;
background-size: 36px 36px;
background-color: #eee
}
.img-48 {
display: inline-block;
width: 48px;
height: 48px;
background-size: 48px 48px;
background-color: #eee
}
.img-60 {
display: inline-block;
width: 60px;
height: 60px;
background-size: 60px 60px;
background-color: #eee
}
.use-loged-account {
color: #838383;
margin-top: 30px;
margin-bottom: 28px;
}
.yourself {
margin-bottom: 20px;
background-color: #f5f6f7;
width: 100%;
padding: 20px;
padding-left: 100px;
border-radius: 4px;
}
.yourself .avatar {
left: 20px;
}
.yourself h4 {
margin-top: 5px;
margin-bottom: 10px;
}
.notify-box {
width: 700px;
margin: 200px auto;
background-color: white;
height: 250px;
padding: 55px;
border-radius: 6px;
box-shadow: 0 0 10px 4px rgba(0, 0, 0, .05);
position: relative;
}
.notify-box .btn {
padding: 10px 15px;
font-size: 14px;
border-radius: 2px;
margin: 10px 0;
}
.notify-box .info,
.notify-box .success,
.notify-box .error {
position: absolute;
height: 80px;
width: 80px;
}
.notify-box .info .icon,
.notify-box .success .icon,
.notify-box .error .icon {
font-size: 80px;
position: absolute;
top: -20px;
}
.notify-box .info .icon {
color: #428bca;
}
.notify-box .success .icon {
color: #6AB83A;
}
.notify-box .error .icon {
color: #d9534f;
}
.notify-box .message {
margin-left: 135px;
}
.notify-box .message h3 {
margin-top: 0px;
margin-bottom: 15px;
}
.notify-box .message p {
font-size: 16px;
margin-bottom: 20px;
color: #838383;
}
@media (max-width: 650px) {
.notify-box {
width: auto;
margin: 100px 30px;
height:auto;
background-color: white;
padding: 10px;
box-shadow: none;
position: relative;
min-width: 240px;
}
.notify-box .info,
.notify-box .success,
.notify-box .error {
height: 24px;
width: 24px;
}
.notify-box .info .icon,
.notify-box .success .icon,
.notify-box .error .icon {
font-size: 24px;
top: 0px;
}
.notify-box .message {
margin-left: 0px;
}
.notify-box .message h3 {
margin-top: 8px;
margin-bottom: 15px;
margin-left: 30px;
font-size: 18px;
}
.notify-box .message p {
font-size: 16px;
margin-bottom: 5px;
color: #838383;
}
.notify-box .message .btn {
display: block;
margin: 10px auto;
width: 60%;
}
}
@media (max-width: 580px) {
html, body {
height: 100%;
width: 100%;
}
body {
background-position: center bottom;
background-size: 200%;
}
.form-unit {
width: 250px;
padding: 0;
box-shadow: none;
background-color: none;
margin-top: 100px;
}
.form-unit h3 {
font-size: 15px;
}
.production-list {
display: none;
}
}
@media (min-height: 800px) {
body {
background-position-y: 250px;
}
.form-unit {
margin: 110px auto;
}
}
.btn-lg {
width: 100%;
}

View File

@ -1,5 +1,7 @@
class ArticlesController < ApplicationController
before_filter :check_current_user_is_admin, only: [:new, :create, :edit, :update]
before_filter :article, only: [:show, :edit, :update, :destroy, :star]
def index
res = Article
order = 'updated_at desc'

View File

@ -1,111 +0,0 @@
class ArticlesController < ApplicationController
def index
res = Article
order = 'updated_at desc'
if params[:sort].present?
order = case params[:sort]
when 'star'
'star_count desc'
when 'comments'
'comments_count desc'
else
'updated_at desc'
end
end
if params[:c].present?
category = Category.find params[:c]
res = res.where("category_id=#{category.id}") if category
end
res = res.where("title like ?", "%#{params[:keyword]}%") if params[:keyword].present?
@articles = res.order(order).page(params[:page]).per(Settings.blog.aritcle_page_size)
respond_to do |format|
format.html
format.js
end
end
def new
@article = Article.new
end
def create
@article = Article.new params.require(:article).permit(:title, :tags, :source, :content)
@article.user_id = @current_user.id
if params[:article].present? && params[:article][:category_id].present?
@article.category_id = params[:article][:category_id]
elsif params[:article].present? && params[:article][:category_name].present?
category = Category.find_or_create params[:article][:category_name]
@article.category_id = category.id
end
if @article.save
redirect_to article_path(@article)
else
render 'new'
end
end
def show
@article.add_view request.remote_ip, @current_user, params.inspect
@comment = @article.comments.new
@comments = @article.comments.order('updated_at asc').page(params[:page]).per(Settings.blog.comments_page_size)
respond_to do |format|
format.html
format.js
end
end
def edit
end
def update
attributes = params.require(:article).permit(:title, :tags, :source, :content)
if params[:article].present? && params[:article][:category_id].present?
attributes[:category_id] = params[:article][:category_id]
elsif params[:article].present? && params[:article][:category_name].present?
category = Category.find_or_create params[:article][:category_name]
attributes[:category_id] = category.id
end
if @article.update_attributes attributes
redirect_to article_path(@article)
else
render 'edit'
end
end
def destroy
if @article.destroy
redirect_to articles_path
else
flash[:error] = '删除失败'
redirect_to article_path(@article)
end
end
def star
if current_user_can_star? @article
@result = {status: false, message: '', star_count: 0}
star = @article.article_stars.new user_id: @current_user.id
if star.save
@result[:star_count] = (@article.star_count || 0) + 1
@result[:status] = true
else
@result[:message] = '称赞失败'
end
respond_to do |format|
format.js
end
end
end
protected
def check_current_user_is_admin
redirect_to root_path unless (@current_user && @current_user.admin)
end
def article
end
end

View File

@ -14,7 +14,6 @@ class UsersController < ApplicationController
else
render 'register', layout: 'register'
end
end
def login

View File

@ -22,6 +22,6 @@ module ApplicationHelper
def blog_title
blog = BlogInfo.first
blog.present? ? blog.blog_title : 'Blog'
blog.present? ? blog.blog_title : 'E2S'
end
end

View File

@ -1,16 +0,0 @@
class Article < ActiveRecord::Base
attr_accessor :category_name
belongs_to :category, counter_cache: 'articles_count'
belongs_to :user
has_many :article_stars
has_many :article_views
has_many :comments, class_name: 'ArticleComment'
validates :title, length: {minimum: 10, maximum: 50}
validates :tags, presence: true
validates :source, allow_blank: true, format: {with: /[a-zA-Z0-9-]+\.[a-zA-Z0-9]+/}
validates :content, length: {minimum: 10}
validate :validate_category
end

View File

@ -53,4 +53,43 @@ Rails.application.routes.draw do
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
root "blogs#index"
resources :blogs, only:[:index] do
collection do
post 'upload_img'
get 'set'
post 'set_userinfo'
get 'set_blog'
post 'update_blog'
get 'about'
get 'change_password'
post 'update_password'
post 'preview'
end
end
resources :articles do
member do
post 'star'
end
resources :comments
end
get 'register' => 'users#register'
get 'login' => 'users#login'
get 'logout' => 'users#logout'
resources :users do
collection do
get 'register'
post 'register_confirm'
get 'login'
post 'login_confirm'
get 'logout'
end
end
end

View File

@ -1,22 +0,0 @@
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 6938efe794286cdef1a2929153f78aa17f3005ab4e671e0ba21bf09057b448152f1725ca939d77d392bec467487e40e4d7e9e9ed9ba785e746e80c5dea106e0e
test:
secret_key_base: 38e245a613b00c6701f3525867eb0c2e0b9d8f1395d54a2d7a3c1e3f35480fa331272f5cf1a74a130a60ed922131a00851c09a5819330652cd73e85378d0ca0a
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>