Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21_Final_Project
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
Chanelle Lunod
MIS21_Final_Project
Commits
d5c4efc5
Commit
d5c4efc5
authored
Jul 16, 2018
by
Chanelle Lunod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
864ef5bf
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
72 additions
and
1 deletion
+72
-1
comments.coffee
app/assets/javascripts/comments.coffee
+3
-0
comments.scss
app/assets/stylesheets/comments.scss
+3
-0
comments_controller.rb
app/controllers/comments_controller.rb
+4
-0
comments_helper.rb
app/helpers/comments_helper.rb
+2
-0
comment.rb
app/models/comment.rb
+4
-0
new.html.erb
app/views/comments/new.html.erb
+2
-0
index.html.erb
app/views/products/index.html.erb
+3
-0
routes.rb
config/routes.rb
+2
-0
20180716132511_create_comments.rb
db/migrate/20180716132511_create_comments.rb
+11
-0
schema.rb
db/schema.rb
+11
-1
comments_controller_test.rb
test/controllers/comments_controller_test.rb
+9
-0
comments.yml
test/fixtures/comments.yml
+11
-0
comment_test.rb
test/models/comment_test.rb
+7
-0
No files found.
app/assets/javascripts/comments.coffee
0 → 100644
View file @
d5c4efc5
# 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/comments.scss
0 → 100644
View file @
d5c4efc5
// Place all the styles related to the Comments controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
app/controllers/comments_controller.rb
0 → 100644
View file @
d5c4efc5
class
CommentsController
<
ApplicationController
def
new
end
end
app/helpers/comments_helper.rb
0 → 100644
View file @
d5c4efc5
module
CommentsHelper
end
app/models/comment.rb
0 → 100644
View file @
d5c4efc5
class
Comment
<
ApplicationRecord
belongs_to
:user
belongs_to
:post
end
app/views/comments/new.html.erb
0 → 100644
View file @
d5c4efc5
<h1>
Comments#new
</h1>
<p>
Find me in app/views/comments/new.html.erb
</p>
app/views/products/index.html.erb
View file @
d5c4efc5
...
...
@@ -33,6 +33,9 @@
</td>
<td>
<%=
time_ago_in_words
(
product
.
created_at
)
%>
ago
</td>
<td>
<%=
link_to
"Add Comment"
,
new_post_comment_path
(
post
),
class:
"btn btn-info"
%>
</td>
<td>
<%=
link_to
"Edit"
,
edit_product_path
(
product
),
class:
"btn btn-primary"
%>
...
...
config/routes.rb
View file @
d5c4efc5
Rails
.
application
.
routes
.
draw
do
get
'comments/new'
devise_for
:admin_users
devise_scope
:admin_user
do
authenticated
:admin_user
do
...
...
@@ -14,6 +15,7 @@ Rails.application.routes.draw do
resources
:products
,
only:
[]
do
resources
:orders
,
only:
[
:new
,
:create
]
resources
:supplies
,
only:
[
:new
,
:create
]
resources
:comments
,
only:
[
:new
,
:create
]
end
root
to:
'transactions#index'
,
as: :authenticated_user_root
end
...
...
db/migrate/20180716132511_create_comments.rb
0 → 100644
View file @
d5c4efc5
class
CreateComments
<
ActiveRecord
::
Migration
[
5.2
]
def
change
create_table
:comments
do
|
t
|
t
.
text
:comment
t
.
references
:user
,
foreign_key:
true
t
.
references
:post
,
foreign_key:
true
t
.
timestamps
end
end
end
db/schema.rb
View file @
d5c4efc5
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2018_07_1
5_111200
)
do
ActiveRecord
::
Schema
.
define
(
version:
2018_07_1
6_132511
)
do
create_table
"admin_users"
,
force: :cascade
do
|
t
|
t
.
string
"email"
,
default:
""
,
null:
false
...
...
@@ -29,6 +29,16 @@ ActiveRecord::Schema.define(version: 2018_07_15_111200) do
t
.
index
[
"reset_password_token"
],
name:
"index_admin_users_on_reset_password_token"
,
unique:
true
end
create_table
"comments"
,
force: :cascade
do
|
t
|
t
.
text
"comment"
t
.
integer
"user_id"
t
.
integer
"post_id"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
index
[
"post_id"
],
name:
"index_comments_on_post_id"
t
.
index
[
"user_id"
],
name:
"index_comments_on_user_id"
end
create_table
"products"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
text
"description"
...
...
test/controllers/comments_controller_test.rb
0 → 100644
View file @
d5c4efc5
require
'test_helper'
class
CommentsControllerTest
<
ActionDispatch
::
IntegrationTest
test
"should get new"
do
get
comments_new_url
assert_response
:success
end
end
test/fixtures/comments.yml
0 → 100644
View file @
d5c4efc5
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one
:
comment
:
MyText
user
:
one
post
:
one
two
:
comment
:
MyText
user
:
two
post
:
two
test/models/comment_test.rb
0 → 100644
View file @
d5c4efc5
require
'test_helper'
class
CommentTest
<
ActiveSupport
::
TestCase
# test "the truth" do
# assert true
# 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