Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
candi-date-tayo
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
George Nicole Balmaceda
candi-date-tayo
Commits
9eb07b37
Commit
9eb07b37
authored
Jul 18, 2016
by
royce-matthew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added basic pages
parent
f00bfcee
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
82 additions
and
1 deletion
+82
-1
pages_controller.rb
app/controllers/pages_controller.rb
+17
-0
candidate.rb
app/models/candidate.rb
+2
-0
index.html.erb
app/views/pages/index.html.erb
+3
-0
profile.html.erb
app/views/pages/profile.html.erb
+13
-0
routes.rb
config/routes.rb
+1
-0
20160718135122_create_candidates.rb
db/migrate/20160718135122_create_candidates.rb
+13
-0
schema.rb
db/schema.rb
+11
-1
candidates.yml
test/fixtures/candidates.yml
+15
-0
candidate_test.rb
test/models/candidate_test.rb
+7
-0
No files found.
app/controllers/pages_controller.rb
0 → 100644
View file @
9eb07b37
class
PagesController
<
ApplicationController
def
index
@votes
=
Vote
.
all
@candidates
=
Candidate
.
all
@positions
=
Position
.
all
render
"pages/index.html.erb"
end
def
profile
before_action
:authenticate_user!
@votes
=
Vote
.
all
@candidates
=
Candidate
.
all
@positions
=
Position
.
all
render
"pages/index.html.erb"
end
end
\ No newline at end of file
app/models/candidate.rb
0 → 100644
View file @
9eb07b37
class
Candidate
<
ApplicationRecord
end
app/views/pages/index.html.erb
0 → 100644
View file @
9eb07b37
<center>
Voting App
</center>
app/views/pages/profile.html.erb
0 → 100644
View file @
9eb07b37
<h4>
Howdy
<%=
current_user
.
email
%>
</h4>
You Voted for
<br>
<ul>
<%
current_user
.
votes
.
each
do
|
v
|
%>
<li>
<%=
"
#{
v
.
candidate
.
position
.
name
}
:
#{
v
.
candidate
.
full_name
}
"
%>
<p
style=
""
>
Comments:
<%=
v
.
comments
%>
</p>
</li>
<%
end
%>
</ul>
\ No newline at end of file
config/routes.rb
View file @
9eb07b37
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
devise_for
:users
devise_for
:users
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root
"pages#index"
end
end
db/migrate/20160718135122_create_candidates.rb
0 → 100644
View file @
9eb07b37
class
CreateCandidates
<
ActiveRecord
::
Migration
[
5.0
]
def
change
create_table
:candidates
do
|
t
|
t
.
string
:first_name
t
.
string
:last_name
t
.
string
:nickname
t
.
text
:slogan
t
.
integer
:position_id
t
.
timestamps
end
end
end
db/schema.rb
View file @
9eb07b37
...
@@ -10,7 +10,17 @@
...
@@ -10,7 +10,17 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20160718134705
)
do
ActiveRecord
::
Schema
.
define
(
version:
20160718135122
)
do
create_table
"candidates"
,
force: :cascade
do
|
t
|
t
.
string
"first_name"
t
.
string
"last_name"
t
.
string
"nickname"
t
.
text
"slogan"
t
.
integer
"position_id"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
create_table
"users"
,
force: :cascade
do
|
t
|
create_table
"users"
,
force: :cascade
do
|
t
|
t
.
string
"email"
,
default:
""
,
null:
false
t
.
string
"email"
,
default:
""
,
null:
false
...
...
test/fixtures/candidates.yml
0 → 100644
View file @
9eb07b37
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one
:
first_name
:
MyString
last_name
:
MyString
nickname
:
MyString
slogan
:
MyText
position_id
:
1
two
:
first_name
:
MyString
last_name
:
MyString
nickname
:
MyString
slogan
:
MyText
position_id
:
1
test/models/candidate_test.rb
0 → 100644
View file @
9eb07b37
require
'test_helper'
class
CandidateTest
<
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