Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
evilla_gomez_guian_principe
final_project
Commits
20ed913c
Commit
20ed913c
authored
Jul 20, 2016
by
Galen Evilla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic web design! please improve this haha!
parent
8f091499
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
421 additions
and
180 deletions
+421
-180
_form.html.erb
Halalan-trial/app/views/admin/candidates/_form.html.erb
+3
-0
edit.html.erb
Halalan-trial/app/views/admin/candidates/edit.html.erb
+9
-3
index.html.erb
Halalan-trial/app/views/admin/candidates/index.html.erb
+1
-1
new.html.erb
Halalan-trial/app/views/admin/candidates/new.html.erb
+9
-2
show.html.erb
Halalan-trial/app/views/admin/candidates/show.html.erb
+64
-57
edit.html.erb
Halalan-trial/app/views/admin/positions/edit.html.erb
+9
-3
index.html.erb
Halalan-trial/app/views/admin/positions/index.html.erb
+28
-13
new.html.erb
Halalan-trial/app/views/admin/positions/new.html.erb
+10
-2
show.html.erb
Halalan-trial/app/views/admin/positions/show.html.erb
+19
-13
new.html.erb
Halalan-trial/app/views/devise/registrations/new.html.erb
+25
-19
new.html.erb
Halalan-trial/app/views/devise/sessions/new.html.erb
+18
-12
_footer.html.erb
Halalan-trial/app/views/layouts/_footer.html.erb
+6
-0
_navbar.html.erb
Halalan-trial/app/views/layouts/_navbar.html.erb
+6
-5
application.html.erb
Halalan-trial/app/views/layouts/application.html.erb
+3
-0
about.html.erb
Halalan-trial/app/views/pages/about.html.erb
+3
-5
profile.html.erb
Halalan-trial/app/views/pages/profile.html.erb
+20
-15
index.html.erb
Halalan-trial/app/views/voting/votes/index.html.erb
+30
-27
new.html.erb
Halalan-trial/app/views/voting/votes/new.html.erb
+9
-3
simple_form_bootstrap.rb
Halalan-trial/config/initializers/simple_form_bootstrap.rb
+149
-0
No files found.
Halalan-trial/app/views/admin/candidates/_form.html.erb
View file @
20ed913c
<%=
simple_form_for
([
:admin
,
@candidate
])
do
|
f
|
%>
<%=
simple_form_for
([
:admin
,
@candidate
])
do
|
f
|
%>
<div
class=
"col-sm-12"
>
<%=
f
.
input
:first_name
,
label:
'First Name: '
%>
<%=
f
.
input
:first_name
,
label:
'First Name: '
%>
</div>
<%=
f
.
input
:last_name
,
label:
'Last Name: '
%>
<%=
f
.
input
:last_name
,
label:
'Last Name: '
%>
<%=
f
.
input
:slogan
,
label:
'Slogan: '
%>
<%=
f
.
input
:slogan
,
label:
'Slogan: '
%>
<%=
f
.
association
:position
,
label:
'Position: '
%>
<%=
f
.
association
:position
,
label:
'Position: '
%>
...
...
Halalan-trial/app/views/admin/candidates/edit.html.erb
View file @
20ed913c
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:title
,
"Edit Candidate"
)
%>
<%
provide
(
:title
,
"Edit Candidate"
)
%>
<h1>
Edit Candidate's Information
</h1>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h1>
Edit Candidate's Information
</h1>
<%=
render
partial:
"form"
%>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
\ No newline at end of file
</div>
</div>
</div>
\ No newline at end of file
Halalan-trial/app/views/admin/candidates/index.html.erb
View file @
20ed913c
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
</center>
</center>
<%
@positions
.
each
do
|
p
|
%>
<%
@positions
.
each
do
|
p
|
%>
<hr>
<hr>
<h
1><center>
<%=
p
.
name
%>
</center></h1
>
<h
3><center>
<%=
p
.
name
%>
</center></h3
>
<table
class=
"table table-hover"
>
<table
class=
"table table-hover"
>
<thead>
<thead>
<th><center>
Name
</center></th>
<th><center>
Name
</center></th>
...
...
Halalan-trial/app/views/admin/candidates/new.html.erb
View file @
20ed913c
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:title
,
"New Candidate"
)
%>
<%
provide
(
:title
,
"New Candidate"
)
%>
<h1>
New Candidate
</h1>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h1>
New Candidate
</h1>
<%=
render
partial:
"form"
%>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
</div>
</div>
</div>
Halalan-trial/app/views/admin/candidates/show.html.erb
View file @
20ed913c
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:title
,
"
#{
@candidate
.
full_name
}
"
)
%>
<%
provide
(
:title
,
"
#{
@candidate
.
full_name
}
"
)
%>
<h1>
Name of the Candidate:
<%=
@candidate
.
full_name
%>
</h1>
<div
class=
"container"
>
<%=
link_to
"Edit"
,
edit_admin_candidate_path
(
@candidate
.
id
)
%>
<div
class=
"row"
>
<br>
<div
class=
"col-md-12"
>
<%=
link_to
"Delete"
,
admin_candidate_path
(
@candidate
.
id
),
method: :delete
%>
<h1>
Name of the Candidate:
<%=
@candidate
.
full_name
%>
</h1>
<br>
<%=
link_to
"Edit"
,
edit_admin_candidate_path
(
@candidate
.
id
)
%>
<h3>
Position:
<%=
@candidate
.
position
.
name
%>
</h3>
<br>
<%
<%=
link_to
"Delete"
,
admin_candidate_path
(
@candidate
.
id
),
method: :delete
%>
m
=
0
<br>
f
=
0
<h3>
Position:
<%=
@candidate
.
position
.
name
%>
</h3>
l
=
0
<%
@candidate
.
votes
.
each
do
|
v
|
m
=
0
if
v
.
user
!=
nil
f
=
0
if
v
.
user
.
gender
==
"Male"
l
=
0
m
=
m
+
1
@candidate
.
votes
.
each
do
|
v
|
else
if
v
.
user
!=
nil
if
v
.
user
.
gender
==
"Female"
if
v
.
user
.
gender
==
"Male"
f
=
f
+
1
m
=
m
+
1
else
else
l
=
l
+
1
if
v
.
user
.
gender
==
"Female"
end
f
=
f
+
1
end
else
end
l
=
l
+
1
%>
end
<%
end
%>
end
<hr>
end
<h3>
Slogan:
<%=
@candidate
.
slogan
%>
</h3>
%>
<hr>
<%
end
%>
<br>
<h3>
Slogan:
<%=
@candidate
.
slogan
%>
</h3>
<br>
<center>
<table
class=
"table table-hover"
>
<h4>
Gender of Voters
</h4>
<tr>
<th><center>
Male Voters
</center></th>
<th><center>
Female Voters
</center></th>
<th><center>
LGBT Voters
</center></th>
<th><center>
Total Votes
</center></th>
</tr>
<tr>
<td><center>
<%=
m
%>
Votes
<br>
<progress
value=
"
<%=
m
%>
"
max=
"
<%=
@candidate
.
votes
.
count
%>
"
></center></td>
<td><center>
<%=
f
%>
Votes
<br>
<progress
value=
"
<%=
f
%>
"
max=
"
<%=
@candidate
.
votes
.
count
%>
"
></center></td>
<td><center>
<%=
l
%>
Votes
<br>
<progress
value=
"
<%=
l
%>
"
max=
"
<%=
@candidate
.
votes
.
count
%>
"
></center></td>
<td><center>
<%=
@candidate
.
votes
.
count
%>
</center></td>
</tr>
</table>
</center>
<hr>
<table
width=
"100%"
>
<h3>
Voters who voted for
<%=
@candidate
.
full_name
%>
</h3>
<h4>
Gender of Voters
</h4>
<ul>
<tr>
<li>
<th>
Male Voters
</th>
<%
@candidate
.
votes
.
each
do
|
v
|
%>
<th>
Female Voters
</th>
<%=
"
#{
v
.
user
.
full_name
}
"
%>
<th>
LGBT Voters
</th>
<p>
<th>
Total Votes
</th>
Comments:
<%=
v
.
comment
%>
</tr>
</p>
<tr>
</li>
<td>
<%=
m
%>
<progress
value=
"
<%=
m
%>
"
max=
"
<%=
@candidate
.
votes
.
count
%>
"
>
</td>
<%
end
%>
<td>
<%=
f
%>
<progress
value=
"
<%=
f
%>
"
max=
"
<%=
@candidate
.
votes
.
count
%>
"
></td>
</ul>
<td>
<%=
l
%>
<progress
value=
"
<%=
l
%>
"
max=
"
<%=
@candidate
.
votes
.
count
%>
"
></td>
<td>
<%=
@candidate
.
votes
.
count
%>
</td>
</tr>
</table>
<hr>
<h3>
Voters who voted for
<%=
@candidate
.
full_name
%>
</h3>
<hr>
<ul>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
<li>
</div>
<%
@candidate
.
votes
.
each
do
|
v
|
%>
</div>
<%=
"
#{
v
.
user
.
full_name
}
"
%>
</div>
<p>
\ No newline at end of file
Comments:
<%=
v
.
comment
%>
</p>
</li>
<%
end
%>
</ul>
<hr>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
\ No newline at end of file
Halalan-trial/app/views/admin/positions/edit.html.erb
View file @
20ed913c
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"Edit Position"
)
%>
<%
provide
(
:title
,
"Edit Position"
)
%>
<h1>
Edit Position
</h1>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h1>
Edit Position
</h1>
<%=
render
partial:
"form"
%>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
\ No newline at end of file
</div>
</div>
</div>
\ No newline at end of file
Halalan-trial/app/views/admin/positions/index.html.erb
View file @
20ed913c
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"Positions"
)
%>
<%
provide
(
:title
,
"Positions"
)
%>
<h1>
Positions
</h1>
<div
class =
"container"
>
<div
class=
"row"
>
<%=
link_to
"Add New Position"
,
new_admin_position_path
%>
<div
class=
"col-md-12"
>
<hr>
<center>
<h1>
Positions
</h1>
<%
@positions
.
each
do
|
p
|
%>
<%=
link_to
"Add New Position"
,
new_admin_position_path
%>
<h2>
<%=
link_to
p
.
name
,
admin_position_path
(
p
.
id
)
%>
</h2>
</center>
<ul>
<%
@positions
.
each
do
|
p
|
%>
<%
p
.
candidates
.
each
do
|
c
|
%>
<hr>
<li>
<%=
link_to
c
.
full_name
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<h3><center>
<%=
link_to
p
.
name
,
admin_position_path
(
p
.
id
)
%>
</center></h3>
<%
end
%>
<table
class=
"table table-hover"
>
</ul>
<thead>
<%
end
%>
<th><center>
Name
</center></th>
\ No newline at end of file
</thead>
<%
p
.
candidates
.
each
do
|
c
|
%>
<tr>
<td>
<center>
<%=
link_to
c
.
full_name
,
admin_candidate_path
(
c
.
id
)
%>
</center>
</td>
</tr>
<%
end
%>
</table>
<%
end
%>
</div>
</div>
</div>
Halalan-trial/app/views/admin/positions/new.html.erb
View file @
20ed913c
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"New Position"
)
%>
<%
provide
(
:title
,
"New Position"
)
%>
<h1>
New Position
</h1>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h1>
New Position
</h1>
<%=
render
partial:
"form"
%>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
</div>
</div>
</div>
Halalan-trial/app/views/admin/positions/show.html.erb
View file @
20ed913c
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"
#{
@position
.
name
}
"
)
%>
<%
provide
(
:title
,
"
#{
@position
.
name
}
"
)
%>
<h1>
<%=
@position
.
name
%>
</h1>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h1>
<%=
@position
.
name
%>
</h1>
<%=
link_to
"Edit"
,
edit_admin_position_path
(
@position
.
id
)
%>
<%=
link_to
"Edit"
,
edit_admin_position_path
(
@position
.
id
)
%>
<br>
<br>
<%=
link_to
"Delete"
,
admin_position_path
(
@position
.
id
),
method: :delete
%>
<%=
link_to
"Delete"
,
admin_position_path
(
@position
.
id
),
method: :delete
%>
<br>
<br>
<hr>
<hr>
<h2>
Candidates for
<%=
@position
.
name
%>
</h2>
<h2>
Candidates for
<%=
@position
.
name
%>
</h2>
<ul>
<ul>
<%
@position
.
candidates
.
each
do
|
c
|
%>
<%
@position
.
candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
full_name
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<li>
<%=
link_to
c
.
full_name
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
<%
end
%>
</ul>
</ul>
<%=
link_to
"<Back to Positions"
,
admin_positions_path
%>
<%=
link_to
"Back to Positions"
,
admin_positions_path
%>
\ No newline at end of file
</div>
</div>
</div>
\ No newline at end of file
Halalan-trial/app/views/devise/registrations/new.html.erb
View file @
20ed913c
<h2>
Sign up
</h2>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h2>
Sign up
</h2>
<%=
simple_form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
:html
=>
{
:role
=>
'form'
})
do
|
f
|
%>
<%=
simple_form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
),
:html
=>
{
:role
=>
'form'
})
do
|
f
|
%>
<%=
f
.
error_notification
%>
<%=
f
.
error_notification
%>
<div
class=
"form-inputs"
>
<div
class=
"form-inputs"
>
<%=
f
.
input
:first_name
,
required:
true
,
autofocus:
true
%>
<%=
f
.
input
:first_name
,
required:
true
,
autofocus:
true
%>
<%=
f
.
input
:last_name
,
required:
true
%>
<%=
f
.
input
:last_name
,
required:
true
%>
<%=
<%=
f
.
input
:birthday
,
:start_year
=>
Date
.
today
.
year
-
18
,
:end_year
=>
1920
,
:order
=>
[
:day
,
:month
,
:year
],
:required
=>
true
f
.
input
:birthday
,
:start_year
=>
Date
.
today
.
year
-
18
,
:end_year
=>
1920
,
:order
=>
[
:day
,
:month
,
:year
],
:required
=>
true
%>
%>
<%=
f
.
input
:gender
,
as: :select
,
collection:
[
"Male"
,
"Female"
,
"LGBT"
],
required:
true
%>
<%=
f
.
input
:gender
,
as: :select
,
collection:
[
"Male"
,
"Female"
,
"LGBT"
],
required:
true
%>
<%=
f
.
input
:email
,
required:
true
%>
<%=
f
.
input
:email
,
required:
true
%>
<%=
f
.
input
:password
,
required:
true
,
hint:
(
"
#{
@minimum_password_length
}
characters minimum"
if
@minimum_password_length
)
%>
<%=
f
.
input
:password
,
required:
true
,
hint:
(
"
#{
@minimum_password_length
}
characters minimum"
if
@minimum_password_length
)
%>
<%=
f
.
input
:password_confirmation
,
required:
true
%>
<%=
f
.
input
:password_confirmation
,
required:
true
%>
</div>
</div>
<div
class=
"form-actions"
>
<div
class=
"form-actions"
>
<%=
f
.
button
:submit
,
"Sign up"
%>
<%=
f
.
button
:submit
,
"Sign up"
%>
</div>
</div>
<%
end
%>
<%
end
%>
<%=
render
"devise/shared/links"
%>
<%=
render
"devise/shared/links"
%>
</div>
</div>
</div>
Halalan-trial/app/views/devise/sessions/new.html.erb
View file @
20ed913c
<h2>
Log in
</h2>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h2>
Log in
</h2>
<%=
simple_form_for
(
resource
,
as:
resource_name
,
url:
session_path
(
resource_name
))
do
|
f
|
%>
<%=
simple_form_for
(
resource
,
as:
resource_name
,
url:
session_path
(
resource_name
))
do
|
f
|
%>
<div
class=
"form-inputs"
>
<div
class=
"form-inputs"
>
<%=
f
.
input
:email
,
required:
false
,
autofocus:
true
%>
<%=
f
.
input
:email
,
required:
false
,
autofocus:
true
%>
<%=
f
.
input
:password
,
required:
false
%>
<%=
f
.
input
:password
,
required:
false
%>
<%=
f
.
input
:remember_me
,
as: :boolean
if
devise_mapping
.
rememberable?
%>
<%=
f
.
input
:remember_me
,
as: :boolean
if
devise_mapping
.
rememberable?
%>
</div>
</div>
<div
class=
"form-actions"
>
<div
class=
"form-actions"
>
<%=
f
.
button
:submit
,
"Log in"
%>
<%=
f
.
button
:submit
,
"Log in"
%>
</div>
</div>
<%
end
%>
<%
end
%>
<%=
render
"devise/shared/links"
%>
<%=
render
"devise/shared/links"
%>
</div>
</div>
</div>
Halalan-trial/app/views/layouts/_footer.html.erb
0 → 100644
View file @
20ed913c
<hr>
<footer
class=
"footer"
>
<div
class=
"container"
>
<p>
©
2016 HalalanPhMIS21, Inc.
</p>
</div>
</footer>
\ No newline at end of file
Halalan-trial/app/views/layouts/_navbar.html.erb
View file @
20ed913c
...
@@ -20,14 +20,15 @@
...
@@ -20,14 +20,15 @@
</ul>
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
<ul
class=
"nav navbar-nav navbar-right"
>
<%
if
user_signed_in?
%>
<%
if
user_signed_in?
%>
<li
class=
"
<%=
yield
(
:vote
)
%>
"
><a
href=
"/voting/votes"
>
Vote now
</a></li>
<li
class=
"dropdown"
>
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
Hello,
<%=
current_user
.
first_name
%>
!
<b
class=
"caret"
></b></a>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
>
Hello,
<%=
current_user
.
first_name
%>
!
<b
class=
"caret"
></b></a>
<ul
class=
"dropdown-menu"
>
<ul
class=
"dropdown-menu"
>
<li>
<a
href=
"/profile"
>
My Profile
</a></li>
<li><a
href=
"/profile"
>
My Profile
</a></li>
<li>
<%=
link_to
"Logout"
,
destroy_user_session_path
,
method: :delete
%>
</li>
<li>
<%=
link_to
"Logout"
,
destroy_user_session_path
,
method: :delete
%>
</li>
</u1>
</u1>
</li>
</ul>
</li>
<li
class=
"
<%=
yield
(
:vote
)
%>
"
><a
href=
"/voting/votes"
>
Vote now
</a></li>
<%
else
%>
<%
else
%>
<li>
<%=
link_to
"Log-in"
,
new_user_session_path
%>
</li>
<li>
<%=
link_to
"Log-in"
,
new_user_session_path
%>
</li>
<li>
<%=
link_to
"Register"
,
new_user_registration_path
%>
</li>
<li>
<%=
link_to
"Register"
,
new_user_registration_path
%>
</li>
...
...
Halalan-trial/app/views/layouts/application.html.erb
View file @
20ed913c
...
@@ -9,8 +9,11 @@
...
@@ -9,8 +9,11 @@
<body>
<body>
<%=
render
'/layouts/navbar'
%>
<%=
render
'/layouts/navbar'
%>
<%=
yield
%>
<%=
yield
%>
</body>
</body>
<%=
render
'/layouts/footer'
%>
</html>
</html>
Halalan-trial/app/views/pages/about.html.erb
View file @
20ed913c
...
@@ -3,14 +3,12 @@
...
@@ -3,14 +3,12 @@
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-
7
"
>
<div
class=
"col-md-
12
"
>
<h1
class=
"heading"
>
About The Developers
</h1>
<h1
class=
"heading"
>
About The Developers
</h1>
<h3><a
href=
"/about/evilla"
>
Evilla, Galen Solo E.
</a></h3>
<h3><a
href=
"/about/evilla"
>
Evilla, Galen Solo E.
</a></h3>
<h3><a
href=
"/about/gomez"
>
Gomez, Feliz Marie B.
</a></h3>
<h3><a
href=
"/about/gomez"
>
Gomez, Feliz Marie B.
</a></h3>
<h3><a
href=
"/about/guian"
>
Guian, April D.
</a></h3>
<h3><a
href=
"/about/guian"
>
Guian, April D.
</a></h3>
<h3><a
href=
"/about/principe"
>
Principe, Jasmine Nicole G.
</a></h3>
<h3><a
href=
"/about/principe"
>
Principe, Jasmine Nicole G.
</a></h3>
</div>
</div>
</div>
</div>
Halalan-trial/app/views/pages/profile.html.erb
View file @
20ed913c
<h2>
Hey
<%=
current_user
.
first_name
%>
!
</h2>
<div
class =
"container"
>
<br>
<div
class=
"row"
>
You Voted for:
<div
class=
"col-md-12"
>
<br>
<h2>
Hey
<%=
current_user
.
first_name
%>
!
</h2>
<br>
<ul>
You Voted for:
<%
current_user
.
votes
.
each
do
|
v
|
%>
<br>
<li>
<ul>
<%=
"
#{
v
.
candidate
.
position
.
name
}
:
#{
v
.
candidate
.
full_name
}
"
%>
<%
current_user
.
votes
.
each
do
|
v
|
%>
<p>
<li>
Comments:
<%=
v
.
comment
%>
<%=
"
#{
v
.
candidate
.
position
.
name
}
:
#{
v
.
candidate
.
full_name
}
"
%>
</p>
<p>
</li>
Comments:
<%=
v
.
comment
%>
<%
end
%>
</p>
</ul>
</li>
\ No newline at end of file
<%
end
%>
</ul>
</div>
</div>
</div>
\ No newline at end of file
Halalan-trial/app/views/voting/votes/index.html.erb
View file @
20ed913c
<%
provide
(
:vote
,
"active"
)
%>
<%
provide
(
:vote
,
"active"
)
%>
<%
provide
(
:title
,
"Vote now!"
)
%>
<%
provide
(
:title
,
"Vote now!"
)
%>
<h1><center>
VOTES
</center></h1>
<div
class =
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h1><center>
VOTES
</center></h1>
<hr>
<h2><center>
Hello,
<%=
current_user
.
full_name
%>
!
</center></h2>
<hr>
<h4>
Vote now for:
</h4>
<ul>
<h2><center>
Hello,
<%=
current_user
.
full_name
%>
!
</center></h2>
<%
@positions
.
each
do
|
p
|
%>
<h4>
Vote now for:
</h4>
<li>
<%=
p
.
name
%>
<br>
<ul>
<%
voted_for
=
false
%>
<%
@positions
.
each
do
|
p
|
%>
<%
p
.
candidates
.
each
do
|
c
|
%>
<li>
<%=
p
.
name
%>
<br>
<%
c
.
votes
.
each
do
|
v
|
%>
<%
voted_for
=
false
%>
<%
if
v
.
user_id
==
current_user
.
id
%>
<%
p
.
candidates
.
each
do
|
c
|
%>
You have already voted for
<%=
v
.
candidate
.
full_name
%>
<%
c
.
votes
.
each
do
|
v
|
%>
<%
voted_for
=
true
%>
<%
if
v
.
user_id
==
current_user
.
id
%>
<%
end
%>
You have already voted for
<%=
v
.
candidate
.
full_name
%>
<%
end
%>
<%
voted_for
=
true
%>
<%
end
%>
<%
end
%>
</ol>
<%
if
!
voted_for
%>
<%=
link_to
"Vote for a
#{
p
.
name
}
"
,
"/voting/new/
#{
p
.
id
}
"
%>
<%
else
%>
<%
end
%>
</li>
<%
end
%>
<%
end
%>
<%
end
%>
</ul>
</ol>
<hr>
<%
if
!
voted_for
%>
<br>
<%=
link_to
"Vote for a
#{
p
.
name
}
"
,
"/voting/new/
#{
p
.
id
}
"
%>
</div>
<%
else
%>
</div>
<%
end
%>
</div>
</li>
<%
end
%>
</ul>
<hr>
<br>
\ No newline at end of file
Halalan-trial/app/views/voting/votes/new.html.erb
View file @
20ed913c
<%
provide
(
:vote
,
"active"
)
%>
<%
provide
(
:vote
,
"active"
)
%>
<%
provide
(
:title
,
"Vote"
)
%>
<%
provide
(
:title
,
"Vote"
)
%>
<h1>
Vote
</h1>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<h1>
Vote
</h1>
<%=
render
partial:
"form"
%>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Votes"
,
voting_votes_path
%>
<%=
link_to
"Back to Votes"
,
voting_votes_path
%>
</div>
</div>
</div>
Halalan-trial/config/initializers/simple_form_bootstrap.rb
0 → 100644
View file @
20ed913c
# Use this setup block to configure all options available in SimpleForm.
SimpleForm
.
setup
do
|
config
|
config
.
error_notification_class
=
'alert alert-danger'
config
.
button_class
=
'btn btn-default'
config
.
boolean_label_class
=
nil
config
.
wrappers
:vertical_form
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
use
:placeholder
b
.
optional
:maxlength
b
.
optional
:pattern
b
.
optional
:min_max
b
.
optional
:readonly
b
.
use
:label
,
class:
'control-label'
b
.
use
:input
,
class:
'form-control'
b
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
b
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
config
.
wrappers
:vertical_file_input
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
use
:placeholder
b
.
optional
:maxlength
b
.
optional
:readonly
b
.
use
:label
,
class:
'control-label'
b
.
use
:input
b
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
b
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
config
.
wrappers
:vertical_boolean
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
optional
:readonly
b
.
wrapper
tag:
'div'
,
class:
'checkbox'
do
|
ba
|
ba
.
use
:label_input
end
b
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
b
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
config
.
wrappers
:vertical_radio_and_checkboxes
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
optional
:readonly
b
.
use
:label
,
class:
'control-label'
b
.
use
:input
b
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
b
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
config
.
wrappers
:horizontal_form
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
use
:placeholder
b
.
optional
:maxlength
b
.
optional
:pattern
b
.
optional
:min_max
b
.
optional
:readonly
b
.
use
:label
,
class:
'col-sm-3 control-label'
b
.
wrapper
tag:
'div'
,
class:
'col-sm-9'
do
|
ba
|
ba
.
use
:input
,
class:
'form-control'
ba
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
ba
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
end
config
.
wrappers
:horizontal_file_input
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
use
:placeholder
b
.
optional
:maxlength
b
.
optional
:readonly
b
.
use
:label
,
class:
'col-sm-3 control-label'
b
.
wrapper
tag:
'div'
,
class:
'col-sm-9'
do
|
ba
|
ba
.
use
:input
ba
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
ba
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
end
config
.
wrappers
:horizontal_boolean
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
optional
:readonly
b
.
wrapper
tag:
'div'
,
class:
'col-sm-offset-3 col-sm-9'
do
|
wr
|
wr
.
wrapper
tag:
'div'
,
class:
'checkbox'
do
|
ba
|
ba
.
use
:label_input
end
wr
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
wr
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
end
config
.
wrappers
:horizontal_radio_and_checkboxes
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
optional
:readonly
b
.
use
:label
,
class:
'col-sm-3 control-label'
b
.
wrapper
tag:
'div'
,
class:
'col-sm-9'
do
|
ba
|
ba
.
use
:input
ba
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
ba
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
end
config
.
wrappers
:inline_form
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
use
:placeholder
b
.
optional
:maxlength
b
.
optional
:pattern
b
.
optional
:min_max
b
.
optional
:readonly
b
.
use
:label
,
class:
'sr-only'
b
.
use
:input
,
class:
'form-control'
b
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
b
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
config
.
wrappers
:multi_select
,
tag:
'div'
,
class:
'form-group'
,
error_class:
'has-error'
do
|
b
|
b
.
use
:html5
b
.
optional
:readonly
b
.
use
:label
,
class:
'control-label'
b
.
wrapper
tag:
'div'
,
class:
'form-inline'
do
|
ba
|
ba
.
use
:input
,
class:
'form-control'
ba
.
use
:error
,
wrap_with:
{
tag:
'span'
,
class:
'help-block'
}
ba
.
use
:hint
,
wrap_with:
{
tag:
'p'
,
class:
'help-block'
}
end
end
# Wrappers for forms and inputs using the Bootstrap toolkit.
# Check the Bootstrap docs (http://getbootstrap.com)
# to learn about the different styles for forms and inputs,
# buttons and other elements.
config
.
default_wrapper
=
:vertical_form
config
.
wrapper_mappings
=
{
check_boxes: :vertical_radio_and_checkboxes
,
radio_buttons: :vertical_radio_and_checkboxes
,
file: :vertical_file_input
,
boolean: :vertical_boolean
,
datetime: :multi_select
,
date: :multi_select
,
time: :multi_select
}
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