perus 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/perus/server/admin.rb +2 -0
- data/lib/perus/server/app.rb +1 -1
- data/lib/perus/server/helpers.rb +13 -3
- data/lib/perus/server/server.rb +9 -7
- data/lib/perus/server/views/layout.erb +4 -4
- data/lib/perus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 426902fcecc63ec81acf9352f4bafba9fa1988d4
|
4
|
+
data.tar.gz: 36838e6272731efce01b25f8c8773d4ed8622cfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4e06d529a4d1d00f2beba82bd5c118b662fedd4b5b70856d39fadbd9a28781c3a9c2243ab9670dac271c69ace4ad6e8961c6988590b296536816a941995d146
|
7
|
+
data.tar.gz: 2bb970e51ed715718b85078c46c34218d25f4596994136215cf99d313e32a78822ebcba13120848e4b38d542caee7726a4f7a75fc15dd17fc8dd0550339abe02
|
data/lib/perus/server/admin.rb
CHANGED
@@ -40,6 +40,7 @@ module Perus::Server
|
|
40
40
|
else
|
41
41
|
redirect url_prefix + 'admin/#{plural}'
|
42
42
|
end
|
43
|
+
return
|
43
44
|
rescue
|
44
45
|
end
|
45
46
|
end
|
@@ -62,6 +63,7 @@ module Perus::Server
|
|
62
63
|
begin
|
63
64
|
@record.update(params[:record])
|
64
65
|
redirect url_prefix + 'admin/#{plural}'
|
66
|
+
return
|
65
67
|
rescue
|
66
68
|
end
|
67
69
|
end
|
data/lib/perus/server/app.rb
CHANGED
data/lib/perus/server/helpers.rb
CHANGED
@@ -6,11 +6,21 @@ module Perus::Server
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def nav_item(path, name, li = true)
|
9
|
-
|
10
|
-
|
9
|
+
# when hosted behind a fronting server such as nginx, path_info
|
10
|
+
# will start with '/' not url_prefix
|
11
|
+
adjusted_path = path
|
12
|
+
if path.index(url_prefix) == 0
|
13
|
+
adjusted_path = path.sub(url_prefix, '/')
|
14
|
+
end
|
15
|
+
|
16
|
+
# admin links are highlighted for sub pages as well as their own
|
17
|
+
# top level page. e.g 'groups' matches '/groups/1'
|
18
|
+
if adjusted_path.start_with?('/admin/')
|
19
|
+
klass = request.path_info.start_with?(adjusted_path) ? 'selected' : ''
|
11
20
|
else
|
12
|
-
klass = request.path_info ==
|
21
|
+
klass = request.path_info == adjusted_path ? 'selected' : ''
|
13
22
|
end
|
23
|
+
|
14
24
|
anchor = "<a class=\"#{klass}\" href=\"#{path}\">#{name}</a>"
|
15
25
|
li ? "<li>#{anchor}</li>" : anchor
|
16
26
|
end
|
data/lib/perus/server/server.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
require 'thin'
|
2
2
|
|
3
3
|
DEFAULT_SERVER_OPTIONS = {
|
4
|
-
'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
'__anonymous__' => {
|
5
|
+
'uploads_dir' => './uploads',
|
6
|
+
'uploads_url' => 'http://localhost:3000/uploads/',
|
7
|
+
'db_path' => './perus.db',
|
8
|
+
'listen' => '0.0.0.0',
|
9
|
+
'port' => 3000,
|
10
|
+
'site_name' => 'Perus',
|
11
|
+
'url_prefix' => '/'
|
12
|
+
}
|
11
13
|
}
|
12
14
|
|
13
15
|
module Perus::Server
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<link rel="stylesheet" type="text/css" href="
|
4
|
-
<link rel="stylesheet" type="text/css" href="
|
5
|
-
<link rel="stylesheet" type="text/css" href="
|
3
|
+
<link rel="stylesheet" type="text/css" href="<%= url_prefix %>fonts/opensans/stylesheet.css">
|
4
|
+
<link rel="stylesheet" type="text/css" href="<%= url_prefix %>css/reset.css">
|
5
|
+
<link rel="stylesheet" type="text/css" href="<%= url_prefix %>css/style.css">
|
6
6
|
<title>Overview</title>
|
7
7
|
<script src="<%= url_prefix %>js/jquery.js"></script>
|
8
8
|
</head>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
</li>
|
25
25
|
<li>
|
26
26
|
<a href="<%= url_prefix %>admin">Admin</a>
|
27
|
-
<% if request.path.start_with?(
|
27
|
+
<% if request.path.start_with?('/admin') %>
|
28
28
|
<ul>
|
29
29
|
<%= nav_item("#{url_prefix}admin/systems", 'Systems') %>
|
30
30
|
<%= nav_item("#{url_prefix}admin/groups", 'Groups') %>
|
data/lib/perus/version.rb
CHANGED