Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
blog_devise
Project
Project
Details
Activity
Releases
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mis-21-2018-intersession
rails
blog_devise
Commits
f5ff1994
Commit
f5ff1994
authored
Jul 11, 2018
by
John Noel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finished Devise User model setup
parent
cab3fb7e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
93 additions
and
5 deletions
+93
-5
publics.coffee
app/assets/javascripts/publics.coffee
+3
-0
application.scss
app/assets/stylesheets/application.scss
+1
-1
publics.scss
app/assets/stylesheets/publics.scss
+3
-0
application_controller.rb
app/controllers/application_controller.rb
+18
-1
posts_controller.rb
app/controllers/posts_controller.rb
+1
-0
publics_controller.rb
app/controllers/publics_controller.rb
+4
-0
publics_helper.rb
app/helpers/publics_helper.rb
+2
-0
application.html.erb
app/views/layouts/application.html.erb
+24
-2
index.html.erb
app/views/publics/index.html.erb
+19
-0
routes.rb
config/routes.rb
+9
-1
publics_controller_test.rb
test/controllers/publics_controller_test.rb
+9
-0
No files found.
app/assets/javascripts/publics.coffee
0 → 100644
View file @
f5ff1994
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
app/assets/stylesheets/application.scss
View file @
f5ff1994
...
...
@@ -3,4 +3,4 @@
*= require_self
*/
@import
"bootstrap"
;
body
{
padding-top
:
5rem
;
}
\ No newline at end of file
#container
{
padding-top
:
5rem
;
}
\ No newline at end of file
app/assets/stylesheets/publics.scss
0 → 100644
View file @
f5ff1994
// Place all the styles related to the Publics controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
app/controllers/application_controller.rb
View file @
f5ff1994
class
ApplicationController
<
ActionController
::
Base
end
protected
def
after_sign_in_path_for
(
resource
)
# if resource.is_a?(AdminUser)
# # Go to this page
# elsif resource.is_a?(User)
# # Go to this page instead
# end
authenticated_root_url
end
def
after_sign_up_path_for
(
resource
)
authenticated_root_url
end
def
after_sign_out_path_for
(
resource
)
unauthenticated_root_url
end
end
\ No newline at end of file
app/controllers/posts_controller.rb
View file @
f5ff1994
class
PostsController
<
ApplicationController
before_action
:authenticate_user!
def
index
@posts
=
Post
.
all
end
...
...
app/controllers/publics_controller.rb
0 → 100644
View file @
f5ff1994
class
PublicsController
<
ApplicationController
def
index
end
end
app/helpers/publics_helper.rb
0 → 100644
View file @
f5ff1994
module
PublicsHelper
end
app/views/layouts/application.html.erb
View file @
f5ff1994
...
...
@@ -12,7 +12,29 @@
</head>
<body>
<div
class=
"container"
>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<%=
link_to
"Blog App"
,
root_path
,
class:
"navbar-brand"
%>
<button
class=
"navbar-toggler"
type=
"button"
data-toggle=
"collapse"
data-target=
"#navbarSupportedContent"
aria-controls=
"navbarSupportedContent"
aria-expanded=
"false"
aria-label=
"Toggle navigation"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<ul
class=
"navbar-nav mr-auto"
>
</ul>
<span
class=
"navbar-text"
>
<%
if
user_signed_in?
%>
Logged in as
<strong>
<%=
current_user
.
email
%>
</strong>
.
<%=
link_to
'Edit profile'
,
edit_user_registration_path
,
:class
=>
'navbar-link'
%>
|
<%=
link_to
"Logout"
,
destroy_user_session_path
,
method: :delete
,
:class
=>
'navbar-link'
%>
<%
else
%>
<%=
link_to
"Sign up"
,
new_user_registration_path
,
:class
=>
'navbar-link'
%>
|
<%=
link_to
"Login"
,
new_user_session_path
,
:class
=>
'navbar-link'
%>
<%
end
%>
</span>
</div>
</nav>
<div
class=
"container"
id=
"container"
>
<%
if
notice
%>
<p
class=
"alert alert-success"
>
<%=
notice
%>
</p>
<%
end
%>
...
...
@@ -22,4 +44,4 @@
<%=
yield
%>
</div>
</body>
</html>
\ No newline at end of file
</html>
app/views/publics/index.html.erb
0 → 100644
View file @
f5ff1994
<div
class=
"row"
>
<div
class=
"col"
>
<h3>
Sign Up
</h3>
<%=
simple_form_for
:user
,
url:
registration_path
(
:user
)
do
|
f
|
%>
<%=
f
.
input
:email
%>
<%=
f
.
input
:password
%>
<%=
f
.
input
:password_confirmation
%>
<%=
f
.
button
:submit
,
"Sign Up"
%>
<%
end
%>
</div>
<div
class=
"col"
>
<h3>
Log In
</h3>
<%=
simple_form_for
:user
,
url:
session_path
(
:user
)
do
|
f
|
%>
<%=
f
.
input
:email
%>
<%=
f
.
input
:password
%>
<%=
f
.
button
:submit
,
"Log In"
%>
<%
end
%>
</div>
</div>
\ No newline at end of file
config/routes.rb
View file @
f5ff1994
Rails
.
application
.
routes
.
draw
do
devise_for
:users
resources
:posts
devise_scope
:user
do
authenticated
:user
do
resources
:posts
root
to:
'posts#index'
,
as: :authenticated_root
end
unauthenticated
:user
do
root
to:
'publics#index'
,
as: :unauthenticated_root
end
end
root
to:
'posts#index'
end
\ No newline at end of file
test/controllers/publics_controller_test.rb
0 → 100644
View file @
f5ff1994
require
'test_helper'
class
PublicsControllerTest
<
ActionDispatch
::
IntegrationTest
test
"should get index"
do
get
publics_index_url
assert_response
:success
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