Commit 2deaf32f authored by Paulo Macasaet's avatar Paulo Macasaet

macasaet number 3 show

parent 612d6f20
This diff is collapsed.
I"app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=1b3c36d5f285b2719bc5159390394a976b907fd41370aa7117688ae6aa419a5d:ET
\ No newline at end of file
[o:Set:
@hash}
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///Users/normanmacasaet/.rvm/gems/ruby-2.3.1@rails4.2/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery_ujs.js;TTF
\ No newline at end of file
I"app/assets/javascripts/application.js?type=application/javascript&pipeline=debug&id=6b848ec31e5cdcab42f4b4c139e428508e2a0c341ba18c9526733ca8839eae33:ET
\ No newline at end of file
I"app/assets/javascripts/application.js?type=application/javascript&id=5a29b0f3f0468473ffecd5e074b6d71c5d27279ec2b5876d1c11a6a04c1406f9:ET
\ No newline at end of file
I"app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=8ee551d7267dbb58839c97fe1f4f7610d0f2d2e56ba5f09769d31f2ab5ea4d19:ET
\ No newline at end of file
I"/Users/normanmacasaet/.rvm/gems/ruby-2.3.1@myapp/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery_ujs.js?type=application/javascript&pipeline=self&id=095293534c44f73b6846dc880929b0f8b99f773540fa5681837d38e9d683cace:ET
\ No newline at end of file
I"/Users/normanmacasaet/.rvm/gems/ruby-2.3.1@rails4.2/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery.js?type=application/javascript&pipeline=self&id=95faf1d9ad2b6408be50635cee383dd62bd4a8550461ae0fb6cd19dfcb1b31bf:ET
\ No newline at end of file
I"/Users/normanmacasaet/.rvm/gems/ruby-2.3.1@rails4.2/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery_ujs.js?type=application/javascript&pipeline=self&id=b65e5cd7ea543a78f345c38822f7b8d71bea30b52a3cd75dea0f0accfb26ce12:ET
\ No newline at end of file
[o:Set:
@hash}
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///Users/normanmacasaet/.rvm/gems/ruby-2.3.1@myapp/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery.js;TTF
\ No newline at end of file
I"app/assets/stylesheets/application.css?type=text/css&pipeline=debug&id=3cfde69ecab4959e40a9d9284b7cc6ded17c6b3f349db23990a0a40481339056:ET
\ No newline at end of file
I"}app/assets/stylesheets/application.css?type=text/css&id=6e230bf0056e6e3b8b46dc8b29bf16db7ba8908b60c788649e4b52595d530ef6:ET
\ No newline at end of file
I"/Users/normanmacasaet/.rvm/gems/ruby-2.3.1@myapp/gems/turbolinks-source-5.0.0/lib/assets/javascripts/turbolinks.js?type=application/javascript&pipeline=self&id=2026250ecb7a84ad7a8b1770a57117458b446919a45461f595092e90ef5b4a64:ET
\ No newline at end of file
I"app/assets/javascripts/application.js?type=application/javascript&id=1eb696f56a38c412aba2cb79df60854aa333b5f9a7f9220148bc3496e72a514f:ET
\ No newline at end of file
I"/Users/normanmacasaet/.rvm/gems/ruby-2.3.1@myapp/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery.js?type=application/javascript&pipeline=self&id=50daee48b212c728d4641f557feb2706438bf238bc0c525bbcfe46ebd35574a2:ET
\ No newline at end of file
I"app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=e3cf978234841e6d052b29c10421c6101c981bcac3546f32c7fa94207d22a1f6:ET
\ No newline at end of file
I"app/assets/stylesheets/application.css?type=text/css&pipeline=debug&id=2f636b2f4ed21d188c944fce0f03af9d309b40a24b96e5d69d688a6215b95d45:ET
\ No newline at end of file
[o:Set:
@hash}
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"~file-digest:///Users/normanmacasaet/.rvm/gems/ruby-2.3.1@myapp/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery_ujs.js;TTF
\ No newline at end of file
[o:Set:
@hash}
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///Users/normanmacasaet/.rvm/gems/ruby-2.3.1@myapp/gems/turbolinks-source-5.0.0/lib/assets/javascripts/turbolinks.js;TTF
\ No newline at end of file
[o:Set:
@hash}
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"file-digest:///Users/normanmacasaet/.rvm/gems/ruby-2.3.1@rails4.2/gems/turbolinks-source-5.0.0/lib/assets/javascripts/turbolinks.js;TTF
\ No newline at end of file
I"}app/assets/stylesheets/application.css?type=text/css&id=5d1d206da1c6851ad0998722ce3652d8858c634bfd12a5bf3ce65ada6687a273:ET
\ No newline at end of file
I"app/assets/javascripts/application.js?type=application/javascript&pipeline=debug&id=5f83faafaf5071e8a83a6e4f9157798767b9d75f913e9fee9e0042ebd6c4c048:ET
\ No newline at end of file
I"app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=03bc996f65f9726ca9ea0d70a4c644f16adcf97852e70dc53908be76f2bc5f82:ET
\ No newline at end of file
I"/Users/normanmacasaet/.rvm/gems/ruby-2.3.1@rails4.2/gems/turbolinks-source-5.0.0/lib/assets/javascripts/turbolinks.js?type=application/javascript&pipeline=self&id=48adea5f1f1951e4a38115a4d02a3aea3e3fe0104f22a26964477c37b5bb6d2f:ET
\ No newline at end of file
[o:Set:
@hash}
I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"}file-digest:///Users/normanmacasaet/.rvm/gems/ruby-2.3.1@rails4.2/gems/jquery-rails-4.1.1/vendor/assets/javascripts/jquery.js;TTF
\ No newline at end of file
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'simple_form'
gem 'devise'
GEM
remote: http://rubygems.org/
specs:
actionmailer (4.2.5)
actionpack (= 4.2.5)
actionview (= 4.2.5)
activejob (= 4.2.5)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5)
actionview (= 4.2.5)
activesupport (= 4.2.5)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5)
activesupport (= 4.2.5)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.5)
activesupport (= 4.2.5)
globalid (>= 0.3.0)
activemodel (4.2.5)
activesupport (= 4.2.5)
builder (~> 3.1)
activerecord (4.2.5)
activemodel (= 4.2.5)
activesupport (= 4.2.5)
arel (~> 6.0)
activesupport (4.2.5)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.3)
bcrypt (3.1.11)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.2.2)
byebug (9.0.5)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
devise (4.2.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1)
responders
warden (~> 1.2.3)
erubis (2.7.0)
execjs (2.7.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
i18n (0.7.0)
jbuilder (2.5.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.1.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.0)
multi_json (1.12.1)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
orm_adapter (0.5.0)
pkg-config (1.1.7)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.5)
actionmailer (= 4.2.5)
actionpack (= 4.2.5)
actionview (= 4.2.5)
activejob (= 4.2.5)
activemodel (= 4.2.5)
activerecord (= 4.2.5)
activesupport (= 4.2.5)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.5)
actionpack (= 4.2.5)
activesupport (= 4.2.5)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.2.2)
rdoc (4.2.2)
json (~> 1.4)
responders (2.2.0)
railties (>= 4.2.0, < 5.1)
sass (3.4.22)
sass-rails (5.0.5)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
simple_form (3.2.1)
actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1)
spring (1.7.2)
sprockets (3.6.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.1.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
turbolinks (5.0.0)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
warden (1.2.6)
rack (>= 1.0)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
PLATFORMS
ruby
DEPENDENCIES
byebug
coffee-rails (~> 4.1.0)
devise
jbuilder (~> 2.0)
jquery-rails
rails (= 4.2.5)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
simple_form
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)
BUNDLED WITH
1.12.5
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
This diff is collapsed.
module Admin
class CandidatesController < ApplicationController
def index
@candidates = Candidate.all
render "admin/candidates/index.html.erb"
end
def edit
@candidate = Candidate.find(params[:id])
end
def update
@candidate = Candidate.find(params[:id])
if @candidate.update(candidate_params())
redirect_to admin_candidate_path(@candidate.id)
else
render "admin/candidates/edit.html.erb"
end
end
def new
@candidate = Candidate.new
render "admin/candidates/new.html.erb"
end
def create
@candidate = Candidate.new(candidate_params())
if @candidate.save
redirect_to admin_candidate_path(@candidate.id)
else
render "admin/candidates/new.html.erb"
end
end
def show
@candidate = Candidate.find(params[:id])
render "admin/candidates/show.html.erb"
end
def destroy
Candidate.find(params[:id]).delete_all
redirect_to admin_candidates_path
end
def candidate_params
params.require(:candidate).permit!
end
end
end
module Admin
class PositionsController < ApplicationController
def show
@position = Position.find(params[:id])
@candidates = @position.candidates
render "admin/positions/show.html.erb"
end
end
end
\ No newline at end of file
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def after_sign_in_path_for(resource)
candidates_list_path
end
end
class CandidatesController < ApplicationController
before_action :authenticate_user!, except: [:index, :show]
def index
@candidates = Candidate.all
if params[:q].present?
@candidates = Candidate.where(last_name: params[:q])
end
render "candidates/index.html.erb"
end
def edit
@candidate = Candidate.find(params[:id])
end
def update
@candidate = Candidate.find(params[:id])
if @candidate.update(candidate_params())
redirect_to candidate_path(@candidate.id)
else
render "candidates/edit.html.erb"
end
end
def new
@candidate = Candidate.new
render "candidates/new.html.erb"
end
def create
@candidate = Candidate.new(candidate_params())
if @candidate.save
redirect_to candidate_path(@candidate.id)
else
render "candidates/new.html.erb"
end
end
def show
@candidate = Candidate.find(params[:id])
render "candidates/show.html.erb"
end
def destroy
Candidate.where(params[:id]).delete_all
redirect_to candidates_path
end
def candidate_params
params.require(:candidate).permit!
end
end
class PagesController < ApplicationController
def home
@positions = Position.all
render "pages/index.html.erb"
end
def about
render "pages/about.html.erb"
end
def users_summmary
@users = User.all
render "pages/users_summmary.html.erb"
end
end
class PositionsController < ApplicationController
def show
@position = Position.find(params[:id])
@candidates = @position.candidates
render "positions/show.html.erb"
end
end
\ No newline at end of file
class VotesController < ApplicationController
before_action :authenticate_user!, except: [:index]
def index
@candidates = Candidate.all.group_by(&:position_id)
end
def vote
@vote = Vote.new
@candidates = Candidate.all.group_by(&:position_id)
end
def confirm_vote
@vote = Vote.new(vote_params)
@vote.user = current_user
if @vote.save(vote_params)
if current_user.votes.count >= Position.count
redirect_to candidates_list_path, notice: "You have already exceeded your number of votes."
else
redirect_to vote_path, notice: "Vote successful!"
end
else
render :vote
end
end
def vote_history
@votes = current_user.votes
end
def user_profile
@votes = current_user.votes
render "votes/user_profile.html.erb"
end
#private
def vote_params
params.require(:vote).permit!
end
end
class Candidate < ActiveRecord::Base
validates :first_name, presence: true
validates :last_name, presence: true
validates :nickname, presence: true
validates :slogan, presence: true, uniqueness: true
belongs_to :position
has_many :votes
belongs_to :vote
def to_s
"#{first_name} #{last_name}"
end
end
class Position < ActiveRecord::Base
validates :name, presence: true, uniqueness: true
has_many :candidates
end
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :votes
#belongs_to :vote
def to_s
"#{first_name} #{last_name}"
end
end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment