Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Final-Elections-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
Christiana Tan
Final-Elections-Project
Commits
1571aa7f
Commit
1571aa7f
authored
Jul 14, 2016
by
Christiana Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed voting count
parent
6c386672
Changes
65
Show whitespace changes
Inline
Side-by-side
Showing
65 changed files
with
8687 additions
and
8687 deletions
+8687
-8687
.gitignore
.gitignore
+17
-17
Gemfile
Gemfile
+51
-51
Gemfile.lock
Gemfile.lock
+187
-187
README.rdoc
README.rdoc
+28
-28
Rakefile
Rakefile
+6
-6
application.js
app/assets/javascripts/application.js
+16
-16
candidates.coffee
app/assets/javascripts/candidates.coffee
+3
-3
positions.coffee
app/assets/javascripts/positions.coffee
+3
-3
application.css
app/assets/stylesheets/application.css
+15
-15
bootstrap.css
app/assets/stylesheets/bootstrap.css
+6760
-6760
candidates.scss
app/assets/stylesheets/candidates.scss
+3
-3
positions.scss
app/assets/stylesheets/positions.scss
+3
-3
application_controller.rb
app/controllers/application_controller.rb
+5
-5
candidates_controller.rb
app/controllers/candidates_controller.rb
+49
-49
positions_controller.rb
app/controllers/positions_controller.rb
+52
-52
application_helper.rb
app/helpers/application_helper.rb
+2
-2
candidates_helper.rb
app/helpers/candidates_helper.rb
+2
-2
positions_helper.rb
app/helpers/positions_helper.rb
+2
-2
admin.rb
app/models/admin.rb
+6
-6
candidate.rb
app/models/candidate.rb
+10
-10
position.rb
app/models/position.rb
+5
-5
user.rb
app/models/user.rb
+7
-7
vote.rb
app/models/vote.rb
+4
-4
edit.html.erb
app/views/candidates/edit.html.erb
+5
-5
index.html.erb
app/views/candidates/index.html.erb
+54
-54
new.html.erb
app/views/candidates/new.html.erb
+43
-43
application.html.erb
app/views/layouts/application.html.erb
+46
-46
edit.html.erb
app/views/positions/edit.html.erb
+17
-17
index.html.erb
app/views/positions/index.html.erb
+21
-21
new.html.erb
app/views/positions/new.html.erb
+19
-19
show.html.erb
app/views/positions/show.html.erb
+25
-25
bundle
bin/bundle
+3
-3
rails
bin/rails
+4
-4
rake
bin/rake
+4
-4
setup
bin/setup
+29
-29
config.ru
config.ru
+4
-4
application.rb
config/application.rb
+26
-26
boot.rb
config/boot.rb
+3
-3
database.yml
config/database.yml
+25
-25
environment.rb
config/environment.rb
+5
-5
development.rb
config/environments/development.rb
+41
-41
production.rb
config/environments/production.rb
+79
-79
test.rb
config/environments/test.rb
+42
-42
assets.rb
config/initializers/assets.rb
+11
-11
backtrace_silencers.rb
config/initializers/backtrace_silencers.rb
+7
-7
cookies_serializer.rb
config/initializers/cookies_serializer.rb
+3
-3
devise.rb
config/initializers/devise.rb
+274
-274
filter_parameter_logging.rb
config/initializers/filter_parameter_logging.rb
+4
-4
inflections.rb
config/initializers/inflections.rb
+16
-16
mime_types.rb
config/initializers/mime_types.rb
+4
-4
session_store.rb
config/initializers/session_store.rb
+3
-3
simple_form.rb
config/initializers/simple_form.rb
+165
-165
simple_form_bootstrap.rb
config/initializers/simple_form_bootstrap.rb
+149
-149
wrap_parameters.rb
config/initializers/wrap_parameters.rb
+14
-14
devise.en.yml
config/locales/devise.en.yml
+62
-62
en.yml
config/locales/en.yml
+23
-23
simple_form.en.yml
config/locales/simple_form.en.yml
+31
-31
routes.rb
config/routes.rb
+40
-40
secrets.yml
config/secrets.yml
+22
-22
20160708033423_create_positions.rb
db/migrate/20160708033423_create_positions.rb
+10
-10
20160708033606_create_candidates.rb
db/migrate/20160708033606_create_candidates.rb
+13
-13
20160711034137_devise_create_admins.rb
db/migrate/20160711034137_devise_create_admins.rb
+42
-42
20160712083205_devise_create_users.rb
db/migrate/20160712083205_devise_create_users.rb
+46
-46
20160712083445_create_votes.rb
db/migrate/20160712083445_create_votes.rb
+11
-11
schema.rb
db/schema.rb
+6
-6
No files found.
.gitignore
View file @
1571aa7f
Gemfile
View file @
1571aa7f
Gemfile.lock
View file @
1571aa7f
README.rdoc
View file @
1571aa7f
Rakefile
View file @
1571aa7f
app/assets/javascripts/application.js
View file @
1571aa7f
app/assets/javascripts/candidates.coffee
View file @
1571aa7f
app/assets/javascripts/positions.coffee
View file @
1571aa7f
app/assets/stylesheets/application.css
View file @
1571aa7f
app/assets/stylesheets/bootstrap.css
View file @
1571aa7f
app/assets/stylesheets/candidates.scss
View file @
1571aa7f
app/assets/stylesheets/positions.scss
View file @
1571aa7f
app/controllers/application_controller.rb
View file @
1571aa7f
app/controllers/candidates_controller.rb
View file @
1571aa7f
class
CandidatesController
<
ApplicationController
before_action
:authenticate_user!
,
except:
[
:index
]
#or except
before_action
:authenticate_user!
,
only:
[
:vote
]
#or except
before_action
:authenticate_admin!
,
except:
[
:index
]
def
index
@candidates
=
Candidate
.
all
end
...
...
app/controllers/positions_controller.rb
View file @
1571aa7f
app/helpers/application_helper.rb
View file @
1571aa7f
app/helpers/candidates_helper.rb
View file @
1571aa7f
app/helpers/positions_helper.rb
View file @
1571aa7f
app/models/admin.rb
View file @
1571aa7f
app/models/candidate.rb
View file @
1571aa7f
app/models/position.rb
View file @
1571aa7f
app/models/user.rb
View file @
1571aa7f
app/models/vote.rb
View file @
1571aa7f
class
Vote
<
ActiveRecord
::
Base
belongs_to
:user
_id
belongs_to
:candidate
_id
belongs_to
:user
belongs_to
:candidate
end
app/views/candidates/edit.html.erb
View file @
1571aa7f
app/views/candidates/index.html.erb
View file @
1571aa7f
...
...
@@ -27,7 +27,7 @@
<td>
<%=
c
.
last_name
%>
</td>
<td>
<%=
c
.
nickname
%>
</td>
<%
if
!
admin_signed_in?
%>
<td>
<%=
%>
</td>
<td>
<%=
c
.
votes
.
count
%>
</td>
<%
end
%>
<%
if
admin_signed_in?
%>
<td>
<%=
c
.
slogan
%>
...
...
app/views/candidates/new.html.erb
View file @
1571aa7f
app/views/layouts/application.html.erb
View file @
1571aa7f
...
...
@@ -15,7 +15,7 @@
</div>
<ul
class=
"nav navbar-nav"
>
<li><
a
href=
"positions"
>
View Positions
</a></li>
<li>
<
%=
link_to
'View Positions'
,
positions_path
%>
</a></li>
</ul>
...
...
app/views/positions/edit.html.erb
View file @
1571aa7f
app/views/positions/index.html.erb
View file @
1571aa7f
app/views/positions/new.html.erb
View file @
1571aa7f
app/views/positions/show.html.erb
View file @
1571aa7f
bin/bundle
View file @
1571aa7f
bin/rails
View file @
1571aa7f
bin/rake
View file @
1571aa7f
bin/setup
View file @
1571aa7f
config.ru
View file @
1571aa7f
config/application.rb
View file @
1571aa7f
config/boot.rb
View file @
1571aa7f
config/database.yml
View file @
1571aa7f
config/environment.rb
View file @
1571aa7f
config/environments/development.rb
View file @
1571aa7f
config/environments/production.rb
View file @
1571aa7f
config/environments/test.rb
View file @
1571aa7f
config/initializers/assets.rb
View file @
1571aa7f
config/initializers/backtrace_silencers.rb
View file @
1571aa7f
config/initializers/cookies_serializer.rb
View file @
1571aa7f
config/initializers/devise.rb
View file @
1571aa7f
config/initializers/filter_parameter_logging.rb
View file @
1571aa7f
config/initializers/inflections.rb
View file @
1571aa7f
config/initializers/mime_types.rb
View file @
1571aa7f
config/initializers/session_store.rb
View file @
1571aa7f
config/initializers/simple_form.rb
View file @
1571aa7f
config/initializers/simple_form_bootstrap.rb
View file @
1571aa7f
config/initializers/wrap_parameters.rb
View file @
1571aa7f
config/locales/devise.en.yml
View file @
1571aa7f
config/locales/en.yml
View file @
1571aa7f
config/locales/simple_form.en.yml
View file @
1571aa7f
config/routes.rb
View file @
1571aa7f
config/secrets.yml
View file @
1571aa7f
db/migrate/20160708033423_create_positions.rb
View file @
1571aa7f
db/migrate/20160708033606_create_candidates.rb
View file @
1571aa7f
db/migrate/20160711034137_devise_create_admins.rb
View file @
1571aa7f
db/migrate/20160712083205_devise_create_users.rb
View file @
1571aa7f
db/migrate/20160712083445_create_votes.rb
View file @
1571aa7f
class
CreateVotes
<
ActiveRecord
::
Migration
def
change
create_table
:votes
do
|
t
|
t
.
references
:user
_id
,
index:
true
,
foreign_key:
true
t
.
references
:candidate
_id
,
index:
true
,
foreign_key:
true
t
.
references
:user
,
index:
true
,
foreign_key:
true
t
.
references
:candidate
,
index:
true
,
foreign_key:
true
t
.
text
:comments
t
.
timestamps
null:
false
...
...
db/schema.rb
View file @
1571aa7f
...
...
@@ -73,14 +73,14 @@ ActiveRecord::Schema.define(version: 20160712083445) do
add_index
"users"
,
[
"reset_password_token"
],
name:
"index_users_on_reset_password_token"
,
unique:
true
create_table
"votes"
,
force: :cascade
do
|
t
|
t
.
integer
"user_id
_id
"
t
.
integer
"candidate_id
_id
"
t
.
integer
"user_id"
t
.
integer
"candidate_id"
t
.
text
"comments"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
end
add_index
"votes"
,
[
"candidate_id
_id"
],
name:
"index_votes_on_candidate_id
_id"
add_index
"votes"
,
[
"user_id
_id"
],
name:
"index_votes_on_user_id
_id"
add_index
"votes"
,
[
"candidate_id
"
],
name:
"index_votes_on_candidate
_id"
add_index
"votes"
,
[
"user_id
"
],
name:
"index_votes_on_user
_id"
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