Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
6c4e5dc4
Commit
6c4e5dc4
authored
Dec 20, 2013
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ログアウト
parent
2bade347
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletions
+11
-1
app/controllers/application_controller.rb
+8
-0
app/controllers/posts_controller.rb
+2
-0
app/helpers/posts_helper.rb
+1
-1
app/views/posts/index.html.erb
+0
-0
No files found.
app/controllers/application_controller.rb
View file @
6c4e5dc4
...
...
@@ -3,4 +3,12 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery
with: :exception
def
require_login
unless
user_signed_in?
flash
[
:alert
]
=
'You need Login!'
redirect_to
root_path
end
end
end
app/controllers/posts_controller.rb
View file @
6c4e5dc4
class
PostsController
<
ApplicationController
before_action
:set_post
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_action
:require_login
,
except:
[
:index
]
include
ApplicationHelper
...
...
app/helpers/posts_helper.rb
View file @
6c4e5dc4
...
...
@@ -3,7 +3,7 @@ module PostsHelper
# @param {ActiveRecord::Relation} node
def
h_display_tree
(
node
)
_html
=
'<ul>'
_html
<<
%Q{<li><a href="
#{
root_path
(
q:
'#'
+
node
.
name
)
}
">
#{
node
.
name
}
<
a/
></li>}
_html
<<
%Q{<li><a href="
#{
root_path
(
q:
'#'
+
node
.
name
)
}
">
#{
node
.
name
}
<
/a
></li>}
node
.
children
.
each
do
|
_child
|
_html
<<
h_display_tree
(
_child
)
end
...
...
app/views/posts/index.html.erb
View file @
6c4e5dc4
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