Skip to content

Commit 1726573

Browse files
committed
add nginx conf and remove unused files.
1 parent 2a157fe commit 1726573

File tree

10 files changed

+64
-67
lines changed

10 files changed

+64
-67
lines changed

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ group :test do
4040
gem 'rack-test', :require => "rack/test"
4141
gem 'factory_girl'
4242
gem 'database_cleaner'
43-
end
43+
end

TODO

+1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
* default website favicon
2121

2222
- Bug
23+
* upload attachment and delete immediately
2324
* IE compatiablity

app/controllers/admin.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# encoding: utf-8
2+
23
RobbinSite.controllers :admin do
4+
35
before do
46
halt 403 unless account_admin?
57
end
@@ -35,7 +37,7 @@
3537

3638
get :edit_blog, :map => '/admin/blog/:id/edit' do
3739
@blog = Blog.find params[:id].to_i
38-
@attachments = current_account.attachments.where(:blog_id => [nil, @blog.id])
40+
@attachments = current_account.attachments.where(:blog_id => [nil, @blog.id]).order('id ASC')
3941
render 'admin/edit_blog'
4042
end
4143

@@ -54,7 +56,7 @@
5456
@blog = Blog.find params[:id].to_i
5557
@blog.destroy
5658
flash[:notice] = '文章已经删除'
57-
redirect url(:blog, :index)
59+
redirect url(:index)
5860
end
5961

6062
delete :comment, :map => '/admin/comment/:id' do
@@ -112,8 +114,8 @@
112114
end
113115

114116
get :accounts, :map => '/admin/accounts' do
115-
@admin_accounts = Account.where(:role => 'admin').order('id ASC');
116-
@commenters = Account.where(:role => 'commenter').order('id DESC');
117+
@admin_accounts = Account.where(:role => 'admin').order('id ASC')
118+
@commenters = Account.where(:role => 'commenter').order('id DESC')
117119
render 'admin/accounts'
118120
end
119121

app/controllers/test.rb

-12
This file was deleted.

app/views/admin/_form.erb

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
<% end %>
5656
<div id="attachment_iframes">
5757
<iframe src="<%= url(:admin, :new_attachment) %>" style="border:0px;height:30px;width:100%;" frameborder="0" border="0" cellspacing="0" allowTransparency="true" scrolling="no" resizable="no"></iframe>
58-
<input type="hidden" value="0" class="max-value-0" id="attachments_counter"/>
5958
</div>
6059
<ul>
6160
提示信息:

app/views/admin/new_attachment.erb

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
<script type="text/javascript">
1616
function upload(fileName) {
17-
var counter = parseInt(window.parent.$('#attachments_counter').val()) + 1;
18-
window.parent.$('#attachments_counter').val(counter);
19-
$('#upload-tip').html(counter + " 个文件正在上传中,请等待完成后再提交").show();
17+
$('#upload-tip').html("文件正在上传中,请等待完成后再提交").show();
2018
$('#spinner').show();
2119
var iframes = window.parent.$("#attachment_iframes")[0];
2220
iframes.appendChild(iframes.getElementsByTagName('iframe')[0].cloneNode(false));

app/views/layouts/application.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<%= current_account.name -%>
2424
<% if account_admin? -%>
2525
<%= link_to '写文章', url(:admin, :new_blog) -%>
26-
<%= link_to '设置', url(:admin, :index) -%>
26+
<%= link_to '管理', url(:admin, :index) -%>
2727
<% end -%>
2828
<%= button_to '退出', url(:logout), :method => :delete %>
2929
<% end %>

app/views/test/index.erb

Whitespace-only changes.

config/nginx.conf

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
http {
2+
include mime.types;
3+
default_type application/octet-stream;
4+
access_log off;
5+
server_tokens off;
6+
charset utf-8;
7+
client_max_body_size 5M;
8+
keepalive_timeout 60 20;
9+
send_timeout 10;
10+
sendfile on;
11+
tcp_nopush on;
12+
tcp_nodelay off;
13+
14+
gzip on;
15+
gzip_min_length 1k;
16+
gzip_disable "MSIE [1-6]\.";
17+
gzip_http_version 1.1;
18+
gzip_types text/plain text/css application/x-javascript application/xml application/json application/atom+xml application/rss+xml;
19+
gzip_vary on;
20+
21+
server {
22+
listen 80;
23+
server_name www.robbinfan.com;
24+
root /webroot/robbin_site/public;
25+
rewrite ^/(.*)$ http://robbinfan.com/$1 permanent;
26+
}
27+
server {
28+
listen 80;
29+
server_name robbinfan.com;
30+
root /webroot/robbin_site/public;
31+
rewrite /leanstartup/lean_startup_note.html /blog/27/lean-startup permanent;
32+
location / {
33+
add_header X-UA-Compatible IE=Edge,chrome=1;
34+
try_files $uri @rainbows;
35+
}
36+
location ~ ^/(images|javascripts|skins|stylesheets|uploads)/ {
37+
access_log off;
38+
error_log /dev/null crit;
39+
# expires max;
40+
expires 1w;
41+
add_header Cache-Control public;
42+
add_header ETag "";
43+
break;
44+
}
45+
location @rainbows {
46+
proxy_set_header X-Real-IP $remote_addr;
47+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
48+
proxy_set_header Host $http_host;
49+
proxy_pass http://127.0.0.1:8080;
50+
}
51+
error_page 404 406 /404.html;
52+
error_page 500 502 503 504 /500.html;
53+
}
54+
}

sample/factories.rb

-45
This file was deleted.

0 commit comments

Comments
 (0)