File tree 10 files changed +64
-67
lines changed
10 files changed +64
-67
lines changed Original file line number Diff line number Diff line change @@ -40,4 +40,4 @@ group :test do
40
40
gem 'rack-test' , :require => "rack/test"
41
41
gem 'factory_girl'
42
42
gem 'database_cleaner'
43
- end
43
+ end
Original file line number Diff line number Diff line change 20
20
* default website favicon
21
21
22
22
- Bug
23
+ * upload attachment and delete immediately
23
24
* IE compatiablity
Original file line number Diff line number Diff line change 1
1
# encoding: utf-8
2
+
2
3
RobbinSite . controllers :admin do
4
+
3
5
before do
4
6
halt 403 unless account_admin?
5
7
end
35
37
36
38
get :edit_blog , :map => '/admin/blog/:id/edit' do
37
39
@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' )
39
41
render 'admin/edit_blog'
40
42
end
41
43
54
56
@blog = Blog . find params [ :id ] . to_i
55
57
@blog . destroy
56
58
flash [ :notice ] = '文章已经删除'
57
- redirect url ( :blog , : index)
59
+ redirect url ( :index )
58
60
end
59
61
60
62
delete :comment , :map => '/admin/comment/:id' do
112
114
end
113
115
114
116
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' )
117
119
render 'admin/accounts'
118
120
end
119
121
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 55
55
<% end %>
56
56
< div id ="attachment_iframes ">
57
57
< 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 "/>
59
58
</ div >
60
59
< ul >
61
60
提示信息:
Original file line number Diff line number Diff line change 14
14
15
15
< script type ="text/javascript ">
16
16
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 ( ) ;
20
18
$ ( '#spinner' ) . show ( ) ;
21
19
var iframes = window . parent . $ ( "#attachment_iframes" ) [ 0 ] ;
22
20
iframes . appendChild ( iframes . getElementsByTagName ( 'iframe' ) [ 0 ] . cloneNode ( false ) ) ;
Original file line number Diff line number Diff line change 23
23
<%= current_account . name -%>
24
24
<% if account_admin? -%>
25
25
<%= link_to '写文章' , url ( :admin , :new_blog ) -%>
26
- <%= link_to '设置 ' , url ( :admin , :index ) -%>
26
+ <%= link_to '管理 ' , url ( :admin , :index ) -%>
27
27
<% end -%>
28
28
<%= button_to '退出' , url ( :logout ) , :method => :delete %>
29
29
<% end %>
Original file line number Diff line number Diff line change
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
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments