Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Illuna-Minecraft
illuna-minecraft.tk
Commits
a486da55
Commit
a486da55
authored
Jul 24, 2016
by
Milan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add basic logviewer to admin page
parent
948f9253
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
2 deletions
+36
-2
app/controllers/admin_controller.rb
app/controllers/admin_controller.rb
+2
-1
app/helpers/admin_helper.rb
app/helpers/admin_helper.rb
+2
-0
app/views/admin/index.html.erb
app/views/admin/index.html.erb
+30
-0
config/initializers/user.rb
config/initializers/user.rb
+2
-0
config/routes.rb
config/routes.rb
+0
-1
No files found.
app/controllers/admin_controller.rb
View file @
a486da55
class
AdminController
<
ApplicationController
before_filter
:authenticate
,
:except
=>
[
:login
]
def
index
end
@logs
=
`tail -n 100 log/minetest.log`
end
end
app/helpers/admin_helper.rb
0 → 100644
View file @
a486da55
module
AdminHelper
end
app/views/admin/index.html.erb
0 → 100644
View file @
a486da55
<%
if
logged_in?
%>
<h1>
Admin
</h1>
<button
type=
"button"
class=
"btn btn-primary pull-right"
style=
"margin-top:-5rem;"
>
Refresh
</button>
<pre
id=
"tail"
style=
"height:600px;"
>
<%=
@logs
%>
</pre>
<%
content_for
(
:after
)
do
%>
<script>
tailScroll
();
function
updateDiv
(){
$
(
'
#tail
'
).
triggerevent
(
function
(){
$
(
'
#tail
'
).
html
(
newContent
);
});
setInterval
(
updateDiv
,
1000
);
}
$
(
"
button
"
).
click
(
function
(
e
)
{
window
.
location
.
reload
(
true
);
});
function
tailScroll
()
{
var
height
=
$
(
"
#tail
"
).
get
(
0
).
scrollHeight
;
$
(
"
#tail
"
).
animate
({
scrollTop
:
height
},
500
);
}
</script>
<%
end
%>
<%
else
%>
<h1>
nope
</h1>
<%
end
%>
config/initializers/user.rb
0 → 100644
View file @
a486da55
USER
=
'admin'
PASSWORD
=
'123'
config/routes.rb
View file @
a486da55
...
...
@@ -30,7 +30,6 @@ end
controller
:admin
do
get
'admin'
=>
'admin#index'
,
:as
=>
'admin'
get
'login'
=>
'admin#login'
,
:as
=>
'login'
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment