Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21FinalsElection
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
Dean Krisitan Bardeloza
MIS21FinalsElection
Commits
670ee722
Commit
670ee722
authored
Jul 20, 2016
by
Bianca Tarun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed position simple form
parent
ca6be502
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
95 additions
and
38 deletions
+95
-38
candidates_controller.rb
Election/app/controllers/candidates_controller.rb
+0
-5
positions_controller.rb
Election/app/controllers/positions_controller.rb
+0
-9
view.rb
Election/app/models/view.rb
+6
-0
_form.html.erb
Election/app/views/admin/candidates/_form.html.erb
+1
-0
index.html.erb
Election/app/views/admin/candidates/index.html.erb
+5
-22
routes.rb
Election/config/routes.rb
+4
-1
20160720021955_devise_create_views.rb
Election/db/migrate/20160720021955_devise_create_views.rb
+42
-0
schema.rb
Election/db/schema.rb
+19
-1
views.yml
Election/test/fixtures/views.yml
+11
-0
view_test.rb
Election/test/models/view_test.rb
+7
-0
No files found.
Election/app/controllers/candidates_controller.rb
deleted
100644 → 0
View file @
ca6be502
class
CandidatesController
<
ApplicationController
def
index
@candidates
=
Candidates
.
all
end
end
\ No newline at end of file
Election/app/controllers/positions_controller.rb
deleted
100644 → 0
View file @
ca6be502
class
PositionsController
<
ApplicationController
before_action
:authenticate_user!
def
show
@position
=
Position
.
find
(
params
[
:id
])
@candidates
=
@position
.
candidates
render
"positions/show.html.erb"
end
end
\ No newline at end of file
Election/app/models/view.rb
0 → 100644
View file @
670ee722
class
View
<
ActiveRecord
::
Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise
:database_authenticatable
,
:registerable
,
:recoverable
,
:rememberable
,
:trackable
,
:validatable
end
Election/app/views/admin/candidates/_form.html.erb
View file @
670ee722
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<%=
f
.
input
:first_name
%>
<%=
f
.
input
:first_name
%>
<%=
f
.
input
:last_name
%>
<%=
f
.
input
:last_name
%>
<%=
f
.
input
:nickname
%>
<%=
f
.
input
:nickname
%>
<%=
f
.
association
:position
%>
<%=
f
.
input
:slogan
%>
<%=
f
.
input
:slogan
%>
<%=
f
.
submit
%>
<%=
f
.
submit
%>
<%
end
%>
<%
end
%>
\ No newline at end of file
Election/app/views/admin/candidates/index.html.erb
View file @
670ee722
...
@@ -2,26 +2,9 @@
...
@@ -2,26 +2,9 @@
<hr>
<hr>
<%=
link_to
(
"New Candidate"
,
new_admin_candidate_path
)
%>
<%=
link_to
(
"New Candidate"
,
new_admin_candidate_path
)
%>
<hr>
<hr>
<table
width=
"100%"
>
<%
@positions
.
each
do
|
position
|
%>
<tr>
<h2>
<%=
@position
.
name
%>
</h2>
<th>
First Name
</th>
<%
end
%>
<th>
Last Name
</th>
<hr>
<th>
Nickname
</th>
<th>
Slogan
</th>
<th>
Actions
</th>
</tr>
<%
@candidates
.
each
do
|
candidate
|
%>
<tr>
<td>
<%=
candidate
.
first_name
%>
</td>
<td>
<%=
candidate
.
last_name
%>
</td>
<td>
<%=
candidate
.
nickname
%>
</td>
<td>
<%=
candidate
.
slogan
%>
</td>
<td>
<%=
link_to
"Show"
,
admin_candidate_path
(
candidate
.
id
)
%>
<%=
link_to
"Edit"
,
edit_admin_candidate_path
(
candidate
.
id
)
%>
<%=
link_to
"Delete"
,
admin_candidate_path
(
candidate
.
id
),
method: :delete
,
data:
{
confirm:
'Are you sure?'
}
%>
</td>
</tr>
<%
end
%>
</table>
Election/config/routes.rb
View file @
670ee722
Rails
.
application
.
routes
.
draw
do
Rails
.
application
.
routes
.
draw
do
devise_for
:views
devise_for
:users
devise_for
:users
namespace
:admin
do
namespace
:admin
do
resources
:positions
resources
:positions
resources
:candidates
resources
:candidates
end
end
resources
:positions
resources
:candidates
resources
:candidates
resources
:positions
resources
:votes
root
to:
"pages#index"
root
to:
"pages#index"
end
end
Election/db/migrate/20160720021955_devise_create_views.rb
0 → 100644
View file @
670ee722
class
DeviseCreateViews
<
ActiveRecord
::
Migration
def
change
create_table
:views
do
|
t
|
## Database authenticatable
t
.
string
:email
,
null:
false
,
default:
""
t
.
string
:encrypted_password
,
null:
false
,
default:
""
## Recoverable
t
.
string
:reset_password_token
t
.
datetime
:reset_password_sent_at
## Rememberable
t
.
datetime
:remember_created_at
## Trackable
t
.
integer
:sign_in_count
,
default:
0
,
null:
false
t
.
datetime
:current_sign_in_at
t
.
datetime
:last_sign_in_at
t
.
string
:current_sign_in_ip
t
.
string
:last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t
.
timestamps
null:
false
end
add_index
:views
,
:email
,
unique:
true
add_index
:views
,
:reset_password_token
,
unique:
true
# add_index :views, :confirmation_token, unique: true
# add_index :views, :unlock_token, unique: true
end
end
Election/db/schema.rb
View file @
670ee722
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# 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:
201607
18031721
)
do
ActiveRecord
::
Schema
.
define
(
version:
201607
20021955
)
do
create_table
"candidates"
,
force: :cascade
do
|
t
|
create_table
"candidates"
,
force: :cascade
do
|
t
|
t
.
string
"first_name"
t
.
string
"first_name"
...
@@ -50,6 +50,24 @@ ActiveRecord::Schema.define(version: 20160718031721) do
...
@@ -50,6 +50,24 @@ ActiveRecord::Schema.define(version: 20160718031721) do
add_index
"users"
,
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
add_index
"users"
,
[
"email"
],
name:
"index_users_on_email"
,
unique:
true
add_index
"users"
,
[
"reset_password_token"
],
name:
"index_users_on_reset_password_token"
,
unique:
true
add_index
"users"
,
[
"reset_password_token"
],
name:
"index_users_on_reset_password_token"
,
unique:
true
create_table
"views"
,
force: :cascade
do
|
t
|
t
.
string
"email"
,
default:
""
,
null:
false
t
.
string
"encrypted_password"
,
default:
""
,
null:
false
t
.
string
"reset_password_token"
t
.
datetime
"reset_password_sent_at"
t
.
datetime
"remember_created_at"
t
.
integer
"sign_in_count"
,
default:
0
,
null:
false
t
.
datetime
"current_sign_in_at"
t
.
datetime
"last_sign_in_at"
t
.
string
"current_sign_in_ip"
t
.
string
"last_sign_in_ip"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
add_index
"views"
,
[
"email"
],
name:
"index_views_on_email"
,
unique:
true
add_index
"views"
,
[
"reset_password_token"
],
name:
"index_views_on_reset_password_token"
,
unique:
true
create_table
"votes"
,
force: :cascade
do
|
t
|
create_table
"votes"
,
force: :cascade
do
|
t
|
t
.
text
"comments"
t
.
text
"comments"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
...
...
Election/test/fixtures/views.yml
0 → 100644
View file @
670ee722
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one
:
{}
# column: value
#
two
:
{}
# column: value
Election/test/models/view_test.rb
0 → 100644
View file @
670ee722
require
'test_helper'
class
ViewTest
<
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