├── .gitignore ├── Gemfile ├── Gemfile.lock ├── Guardfile ├── README.md ├── Rakefile ├── app ├── admin │ ├── admin_user.rb │ └── dashboard.rb ├── assets │ ├── images │ │ ├── logo-ciudadanoi.png │ │ ├── rails.png │ │ └── statusicon │ │ │ ├── approved.png │ │ │ ├── directives.png │ │ │ ├── discarded.png │ │ │ ├── filed.png │ │ │ ├── go-forward.png │ │ │ ├── insistence.png │ │ │ ├── introduced.png │ │ │ ├── paperwork.png │ │ │ ├── priority-withdrawal.png │ │ │ ├── priority.png │ │ │ ├── published.png │ │ │ ├── rejected.png │ │ │ ├── report.png │ │ │ └── vote.png │ ├── javascripts │ │ ├── active_admin.js │ │ ├── application.js │ │ ├── billit │ │ │ └── paperworks.js │ │ ├── bills.js │ │ ├── counts.js │ │ ├── motions.js │ │ ├── vote_events.js │ │ └── votes.js │ └── stylesheets │ │ ├── active_admin.css.scss │ │ ├── application.css │ │ ├── billit │ │ └── paperworks.css │ │ ├── bills.css │ │ ├── bootstrap.min.css │ │ ├── counts.css.scss │ │ ├── main.css │ │ ├── motions.css.scss │ │ ├── scaffold.css │ │ ├── scaffolds.css.scss │ │ ├── vote_events.css.scss │ │ └── votes.css.scss ├── controllers │ ├── application_controller.rb │ ├── bills_controller.rb │ ├── counts_controller.rb │ ├── motions_controller.rb │ ├── paperworks_controller.rb │ ├── vote_events_controller.rb │ └── votes_controller.rb ├── helpers │ ├── application_helper.rb │ ├── billit │ │ └── paperworks_helper.rb │ ├── bills_helper.rb │ ├── counts_helper.rb │ ├── motions_helper.rb │ ├── vote_events_helper.rb │ └── votes_helper.rb ├── mailers │ └── .gitkeep ├── models │ ├── .gitkeep │ ├── admin_user.rb │ ├── attachment.rb │ ├── bill.rb │ ├── count.rb │ ├── directive.rb │ ├── document.rb │ ├── motion.rb │ ├── paperwork.rb │ ├── priority.rb │ ├── remark.rb │ ├── report.rb │ ├── revision.rb │ ├── vote.rb │ └── vote_event.rb └── views │ ├── billit │ └── paperworks │ │ ├── _form.html.haml │ │ ├── edit.html.haml │ │ ├── index.html.haml │ │ ├── new.html.haml │ │ └── show.html.haml │ ├── bills │ ├── _bill.html.haml │ ├── _bill_header.html.haml │ ├── _box_bills_result.html.haml │ ├── _filter_search_form.html.haml │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── new.html.haml │ ├── remove_index.html.haml │ ├── search.html.haml │ ├── show.html.haml │ └── show.xls.eku │ ├── counts │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── new.html.haml │ └── show.html.haml │ ├── layouts │ └── application.html.erb │ ├── motions │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── new.html.haml │ └── show.html.haml │ ├── vote_events │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── new.html.haml │ └── show.html.haml │ └── votes │ ├── _form.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── new.html.haml │ └── show.html.haml ├── config.ru.example ├── config ├── application.rb ├── boot.rb ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── hateoas.yml.example ├── holidays.yml ├── initializers │ ├── active_admin.rb │ ├── backtrace_silencers.rb │ ├── devise.rb │ ├── holidays.rb │ ├── inflections.rb │ ├── load_hateoas.rb │ ├── mime_types.rb │ ├── secret_token.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ ├── en.yml │ ├── es.yml │ └── transliterate_special.yml ├── log.yml.example ├── mongoid.yml.example ├── newrelic.yml.example ├── routes.rb ├── schedule.rb.example └── sunspot.yml.example ├── db └── seeds.rb ├── doc └── README_FOR_APP ├── lib ├── assets │ └── .gitkeep └── tasks │ ├── .gitkeep │ └── sunspot_mongoid.rake ├── log └── .gitignore ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── script └── rails ├── solr ├── conf │ ├── admin-extra.html │ ├── elevate.xml │ ├── mapping-ISOLatin1Accent.txt │ ├── protwords.txt │ ├── schema.xml │ ├── scripts.conf │ ├── solrconfig.xml │ ├── spellings.txt │ ├── stopwords.txt │ └── synonyms.txt └── lib │ ├── apache-mime4j-core-0.7.jar │ ├── apache-mime4j-dom-0.7.jar │ ├── apache-solr-cell-3.5-SNAPSHOT.jar │ ├── asm-3.1.jar │ ├── bcmail-jdk15-1.45.jar │ ├── bcprov-jdk15-1.45.jar │ ├── boilerpipe-1.1.0.jar │ ├── commons-compress-1.2.jar │ ├── dom4j-1.6.1.jar │ ├── fontbox-1.6.0.jar │ ├── icu4j-4_8_1_1.jar │ ├── jempbox-1.6.0.jar │ ├── metadata-extractor-2.4.0-beta-1.jar │ ├── netcdf-4.2-min.jar │ ├── pdfbox-1.6.0.jar │ ├── poi-3.8-beta4.jar │ ├── poi-ooxml-3.8-beta4.jar │ ├── poi-ooxml-schemas-3.8-beta4.jar │ ├── poi-scratchpad-3.8-beta4.jar │ ├── rome-0.9.jar │ ├── tagsoup-1.2.1.jar │ ├── tika-core-0.10.jar │ ├── tika-parsers-0.10.jar │ ├── xercesImpl-2.8.1.jar │ ├── xml-apis-1.0.b2.jar │ └── xmlbeans-2.3.0.jar ├── spec ├── controllers │ ├── bills_controller_spec.rb │ ├── counts_controller_spec.rb │ ├── motions_controller_spec.rb │ ├── paperworks_controller_spec.rb │ ├── vote_events_controller_spec.rb │ └── votes_controller_spec.rb ├── example_files │ ├── boletin_3773-06.doc │ └── ley_19029.xml ├── factories │ ├── admin_users.rb │ ├── bills.rb │ ├── counts.rb │ ├── documents.rb │ ├── motions.rb │ ├── paperworks.rb │ ├── priorities.rb │ ├── reports.rb │ ├── vote_events.rb │ └── votes.rb ├── models │ ├── admin_user_spec.rb │ ├── bill_spec.rb │ ├── count_spec.rb │ ├── motion_spec.rb │ ├── paperwork_spec.rb │ ├── vote_event_spec.rb │ └── vote_spec.rb ├── routing │ └── bills_routing_spec.rb └── spec_helper.rb ├── sunspot-solr.pid ├── test ├── fixtures │ └── .gitkeep ├── functional │ └── .gitkeep ├── integration │ └── .gitkeep ├── performance │ └── browsing_test.rb ├── test_helper.rb └── unit │ └── .gitkeep └── vendor ├── assets ├── javascripts │ └── .gitkeep └── stylesheets │ └── .gitkeep └── plugins └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | *.sassc 3 | .sass-cache 4 | capybara-*.html 5 | .rspec 6 | /.bundle 7 | /vendor/bundle 8 | /log/* 9 | /tmp/* 10 | /db/*.sqlite3 11 | /public/system/* 12 | /coverage/ 13 | /spec/tmp/* 14 | **.orig 15 | rerun.txt 16 | pickle-email-*.html 17 | 18 | solr/data/* 19 | solr/pids/* 20 | *.log 21 | unindexed_bills 22 | 23 | #configuration files 24 | hateoas.yml 25 | mongoid.yml 26 | sunspot.yml 27 | config.ru 28 | log.yml 29 | config/schedule.rb 30 | config/newrelic.yml 31 | 32 | #for local gem installations 33 | /vendor/* 34 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rails', '~> 3.2' 4 | gem "jquery-rails", "~> 2.2" 5 | gem 'haml-rails', '~> 0.4' 6 | gem 'uglifier' 7 | gem 'newrelic_rpm' 8 | 9 | #Search 10 | gem 'sunspot_mongoid2' 11 | gem 'sunspot_solr' 12 | gem 'sunspot_cell', :git => 'git://github.com/zheileman/sunspot_cell.git' 13 | gem 'sunspot_cell_jars' 14 | gem 'progress_bar' 15 | 16 | #Representers 17 | # gem 'roar', '~> 0.11.19' 18 | gem 'roar-rails', "0.1.0" 19 | gem 'billit_representers', '0.9.7' 20 | gem 'will_paginate', '~> 3.0' 21 | 22 | #Dates 23 | gem 'business_time' 24 | 25 | #ActiveAdmin 26 | gem 'activeadmin-mongoid' 27 | gem 'coffee-script', '~> 2.2.0' 28 | # Clean ruby syntax for writing and deploying cron jobs (for rvm) 29 | gem 'whenever', :git => 'https://github.com/Insomniware/whenever.git', :require => false 30 | #gem 'whenever', :require => false #for non rvm 31 | 32 | group :development, :test do 33 | gem 'rspec-rails' 34 | gem 'factory_girl_rails' 35 | gem 'guard-bundler' 36 | gem 'guard-rails' 37 | gem 'guard-rspec' 38 | gem 'awesome_print' 39 | end 40 | 41 | group :development do 42 | gem 'thin' 43 | # Replaces default rails error page with a much better and more useful error page 44 | gem 'better_errors' 45 | gem 'binding_of_caller' 46 | # Turns off the rails asset pipeline log 47 | gem 'quiet_assets' 48 | end 49 | 50 | group :test do 51 | gem 'database_cleaner' 52 | gem 'faker' 53 | gem 'webmock' 54 | end 55 | 56 | #Javascript Runtime, If you have nodejs you can comment this line 57 | gem 'therubyracer' 58 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | # A sample Guardfile 2 | # More info at https://github.com/guard/guard#readme 3 | 4 | guard :bundler do 5 | watch('Gemfile') 6 | # Uncomment next line if your Gemfile contains the `gemspec' command. 7 | # watch(/^.+\.gemspec/) 8 | end 9 | 10 | guard 'rails' do 11 | watch('Gemfile.lock') 12 | watch(%r{^(config|lib)/.*}) 13 | end 14 | 15 | 16 | guard :rspec, :cmd => "bundle exec rspec spec --format documentation" do 17 | watch(%r{^spec/.+_spec\.rb$}) 18 | watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } 19 | watch('spec/spec_helper.rb') { "spec" } 20 | 21 | # Rails example 22 | watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } 23 | watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" } 24 | watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } 25 | watch(%r{^spec/support/(.+)\.rb$}) { "spec" } 26 | watch('config/routes.rb') { "spec/routing" } 27 | watch('app/controllers/application_controller.rb') { "spec/controllers" } 28 | 29 | # Capybara features specs 30 | watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" } 31 | 32 | # Turnip features and steps 33 | watch(%r{^spec/acceptance/(.+)\.feature$}) 34 | watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } 35 | end 36 | 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | bill-it 2 | ======= 3 | 4 | Bill management system for the Poplus project. 5 | 6 | ##Install 7 | 8 | Make sure you have ruby 2.0 and bundler installed. If not visit 9 | https://rvm.io/rvm/install and http://bundler.io/ 10 | 11 | Make sure you have mongodb installed 12 | if not follow instructions at http://docs.mongodb.org/manual/tutorial/ 13 | 14 | Java is needed for Solr. OpenJDK 7 is the recommended package. In Debian / Ubuntu run 15 | ``` 16 | apt-get install openjdk-7-jdk 17 | ``` 18 | 19 | 20 | clone the billit project 21 | ``` 22 | git clone git@github.com:ciudadanointeligente/bill-it.git 23 | ``` 24 | 25 | go to the bill-it project folder install gems 26 | ``` 27 | bundle install 28 | ``` 29 | 30 | create all config files, and modify according to server 31 | ``` 32 | cp config.ru.example config.ru 33 | cp config/sunspot.yml.example config/sunspot.yml 34 | cp config/mongoid.yml.example config/mongoid.yml 35 | cp config/hateoas.yml.example config/hateoas.yml 36 | ``` 37 | 38 | start solr for search indexing 39 | ``` 40 | bundle exec rake sunspot:solr:start 41 | ``` 42 | 43 | make sure solr is running. Type the following url in your browser: 44 | ``` 45 | http://localhost:8983 46 | ``` 47 | 48 | run the service: 49 | ``` 50 | bundle exec rails s 51 | ``` 52 | 53 | If you are running a development environment and you want to monitor file changes and respond immediately, then run this instead: 54 | ``` 55 | bundle exec guard 56 | ``` 57 | visit http://localhost:3000 to see billit running 58 | 59 | ### Deploying to production 60 | 61 | #### Tasks using cron 62 | 63 | To run tasks like send notifications emails of changes in bills the project use [whenever](https://github.com/javan/whenever), this tool generate cron jobs from the `config/schedule.rb` file. 64 | 65 | Add the jobs to crontab: 66 | 67 | bundle exec whenever --update-crontab bill-it 68 | 69 | Clear the jobs associated with a app name: 70 | 71 | bundle exec whenever --clear-crontab bill-it 72 | 73 | ##Usage 74 | ###GET bill 75 | * /bills/id.json => bill by id in json format 76 | * /bills/id.json?callback=my_function => bill by id in jsonp format, with my_function as wrapper funcition 77 | * /bills/id.xml => bill by id in xml format 78 | * /bills/new => create a new bill by filling in a form 79 | * /bills/id/edit => edit bill 80 | 81 | ###GET search 82 | * /bills/search.json?q=term => search for "term" in all fields 83 | * /bills/search.json?q=term&callback=my_function => search for "term" in jsonp format, with my_function as wrapper funcition 84 | * /bills/search.json?title=hello|hola&tags=world => search for bills with title similar to "hello" or "hola" and with the tag "world" 85 | 86 | ####Example from the app's search: 87 | * /bills/search?utf8=✓q=&bill_id=&authors=&stage=&initial_chamber=¤t_priority=&creation_date_min=2010-10-10&creation_date_max=2014-09-16&bills=1 88 | 89 | ###POST 90 | * /bills => creates new bill 91 | 92 | ###PUT 93 | * /bills/id => modifies bill 94 | 95 | ###DELETE 96 | * /bills/id => deletes bill 97 | 98 | ##ROAR usage (the nice way) 99 | For info of how ROAR works go to https://github.com/apotonick/roar 100 | Essentially, you can work on your application as if you had local objects, when they're really in another server 101 | 102 | require gems "billit_representers" and "roar" in your local project, or add them to your gemfile 103 | ``` 104 | gem 'billit_representers' 105 | gem 'roar' 106 | ``` 107 | 108 | ###Bills 109 | extend your local model. Example model: 110 | ``` 111 | require 'roar/representer/feature/client' 112 | require 'billit_representers/representers/bill_representer' 113 | 114 | class Bill 115 | include Roar::Representer::Feature::HttpVerbs 116 | 117 | def initialize(*) 118 | extend Billit::BillRepresenter 119 | extend Roar::Representer::Feature::Client 120 | # transport_engine = Roar::Representer::Transport::Faraday 121 | @persisted = true if @persisted.nil? 122 | end 123 | end 124 | ``` 125 | 126 | GET bill 127 | ``` 128 | bill = Bill.new 129 | bill.get('http://billit.ciudadanointeligente.org/bills/1-07', 'application/json') 130 | ``` 131 | 132 | POST (create new bill) 133 | ``` 134 | bill = Bill.new 135 | bill.uid = '0-00' 136 | bill.title = 'new title' 137 | bill.post('http://billit.ciudadanointeligente.org/bills') 138 | ``` 139 | 140 | PUT (modify existing bill) 141 | ``` 142 | bill = Bill.new 143 | bill.get('http://billit.ciudadanointeligente.org/bills/0-00', 'application/json') 144 | bill.tags.push('tag') 145 | bill.put('http://billit.ciudadanointeligente.org/bills/0-00', 'application/json') 146 | ``` 147 | 148 | ###Bill Collections 149 | extend your local page model. Example model: 150 | ``` 151 | require 'billit_representers/representers/bill_collection_page_representer' 152 | 153 | class BillCollectionPage < OpenStruct 154 | include Roar::Representer::Feature::HttpVerbs 155 | 156 | def initialize 157 | extend Billit::BillCollectionPageRepresenter 158 | extend Roar::Representer::Feature::Client 159 | transport_engine = Roar::Representer::Transport::Faraday 160 | end 161 | 162 | def self 163 | links[:self].href if links[:self] 164 | end 165 | 166 | def next 167 | links[:next].href if links[:next] 168 | end 169 | 170 | def previous 171 | links[:previous].href if links[:previous] 172 | end 173 | end 174 | ``` 175 | 176 | GET search 177 | ``` 178 | bill_page = BillCollectionPage.new 179 | bill_page.get('http://billit.ciudadanointeligente.org/bills/search?q=term', 'application/json') 180 | #bill array 181 | bill_array = bill_page.bills 182 | #next page 183 | bill_next_page = BillCollectionPage.new 184 | bill_next_page.get(bill_page.next, 'application/json') 185 | ``` 186 | 187 | ### Reindexing 188 | If you add information, like bills, through the post or put method, it gets automatically reindexed. If you add them manually or through the database the indexing has to be done manually. This can be done by executing the rails console 189 | ``` 190 | bundle exec rails console 191 | ``` 192 | and then executing the reindex method on your model name, for instance: 193 | ``` 194 | Sunspot.index! Bills.all 195 | ``` 196 | 197 | In this method you can actually write any query instead of Bills.all and it will only reindex that query. 198 | 199 | There are other commands that perform a reindexing, but they can be resource intensive and not so granular: 200 | ``` 201 | bundle exec rake sunspot:solr:reindex 202 | ``` 203 | 204 | The bundle exec command needs to have the ENV variable set, you can just run it as this: 205 | ``` 206 | ENV=production bundle exec rails console 207 | ``` 208 | 209 | Change production for development or test, depending on the environment you want to run the console in. 210 | 211 | And 212 | 213 | ``` 214 | Bill.reindex 215 | ``` 216 | 217 | ### How to deploy as an permanent service 218 | 219 | If you want to configure BillIt as a service, once way of doing it is with nginx and passenger 220 | 221 | ``` 222 | gem install passenger 223 | ``` 224 | 225 | Follow the instructions here: 226 | http://www.modrails.com/documentation/Users%20guide%20Nginx.html#install_on_debian_ubuntu 227 | 228 | Step 2.3 is the only thing needed. Or 2.4 for Fedora. 229 | 230 | WARNING: If you have the project installed in it's own user folder (eg: /home/billit) and you have bundles installed in vendor/bundle, then setting a global `passenger_ruby` interpreter in the nginx.conf file will prevent the interpreter from finding the correct bundle. So please comment out the `passenger_ruby` in nginx.conf 231 | 232 | Then you need to add the application to nginx, here you have a sample configuration file: 233 | https://gist.github.com/rezzo/9bda60d84eacafc1e39d 234 | 235 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | BillIt::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/admin/admin_user.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register AdminUser do 2 | index do 3 | column :email 4 | column :current_sign_in_at 5 | column :last_sign_in_at 6 | column :sign_in_count 7 | default_actions 8 | end 9 | 10 | filter :email 11 | 12 | form do |f| 13 | f.inputs "Admin Details" do 14 | f.input :email 15 | f.input :password 16 | f.input :password_confirmation 17 | end 18 | f.actions 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/admin/dashboard.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register_page "Dashboard" do 2 | 3 | menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") } 4 | 5 | content :title => proc{ I18n.t("active_admin.dashboard") } do 6 | div :class => "blank_slate_container", :id => "dashboard_default_message" do 7 | span :class => "blank_slate" do 8 | span I18n.t("active_admin.dashboard_welcome.welcome") 9 | small I18n.t("active_admin.dashboard_welcome.call_to_action") 10 | end 11 | end 12 | 13 | # Here is an example of a simple dashboard with columns and panels. 14 | # 15 | # columns do 16 | # column do 17 | # panel "Recent Posts" do 18 | # ul do 19 | # Post.recent(5).map do |post| 20 | # li link_to(post.title, admin_post_path(post)) 21 | # end 22 | # end 23 | # end 24 | # end 25 | 26 | # column do 27 | # panel "Info" do 28 | # para "Welcome to ActiveAdmin." 29 | # end 30 | # end 31 | # end 32 | end # content 33 | end 34 | -------------------------------------------------------------------------------- /app/assets/images/logo-ciudadanoi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/logo-ciudadanoi.png -------------------------------------------------------------------------------- /app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/rails.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/approved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/approved.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/directives.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/directives.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/discarded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/discarded.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/filed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/filed.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/go-forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/go-forward.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/insistence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/insistence.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/introduced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/introduced.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/paperwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/paperwork.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/priority-withdrawal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/priority-withdrawal.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/priority.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/priority.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/published.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/published.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/rejected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/rejected.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/report.png -------------------------------------------------------------------------------- /app/assets/images/statusicon/vote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/assets/images/statusicon/vote.png -------------------------------------------------------------------------------- /app/assets/javascripts/active_admin.js: -------------------------------------------------------------------------------- 1 | //= require active_admin/base 2 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // the compiled file. 9 | // 10 | // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 11 | // GO AFTER THE REQUIRES BELOW. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require_tree . 16 | -------------------------------------------------------------------------------- /app/assets/javascripts/billit/paperworks.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/bills.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/counts.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/motions.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/vote_events.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/javascripts/votes.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | -------------------------------------------------------------------------------- /app/assets/stylesheets/active_admin.css.scss: -------------------------------------------------------------------------------- 1 | // SASS variable overrides must be declared before loading up Active Admin's styles. 2 | // 3 | // To view the variables that Active Admin provides, take a look at 4 | // `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the 5 | // Active Admin source. 6 | // 7 | // For example, to change the sidebar width: 8 | // $sidebar-width: 242px; 9 | 10 | // Active Admin's got SASS! 11 | @import "active_admin/mixins"; 12 | @import "active_admin/base"; 13 | 14 | // Overriding any non-variable SASS must be done after the fact. 15 | // For example, to change the default status-tag color: 16 | // 17 | // .status_tag { background: #6090DB; } 18 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the top of the 9 | * compiled file, but it's generally better to create a new file per style scope. 10 | * 11 | *= require_self 12 | *= require_tree . 13 | */ 14 | -------------------------------------------------------------------------------- /app/assets/stylesheets/billit/paperworks.css: -------------------------------------------------------------------------------- 1 | /* 2 | Place all the styles related to the matching controller here. 3 | They will automatically be included in application.css. 4 | */ 5 | -------------------------------------------------------------------------------- /app/assets/stylesheets/bills.css: -------------------------------------------------------------------------------- 1 | /* 2 | Place all the styles related to the matching controller here. 3 | They will automatically be included in application.css. 4 | */ 5 | -------------------------------------------------------------------------------- /app/assets/stylesheets/counts.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Counts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/motions.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Motions controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffold.css: -------------------------------------------------------------------------------- 1 | body { background-color: #fff; color: #333; } 2 | 3 | body, p, ol, ul, td { 4 | font-family: verdana, arial, helvetica, sans-serif; 5 | font-size: 13px; 6 | line-height: 18px; 7 | } 8 | 9 | pre { 10 | background-color: #eee; 11 | padding: 10px; 12 | font-size: 11px; 13 | } 14 | 15 | a { color: #000; } 16 | a:visited { color: #666; } 17 | a:hover { color: #fff; background-color:#000; } 18 | 19 | div.field, div.actions { 20 | margin-bottom: 10px; 21 | } 22 | 23 | #notice { 24 | color: green; 25 | } 26 | 27 | .field_with_errors { 28 | padding: 2px; 29 | background-color: red; 30 | display: table; 31 | } 32 | 33 | #error_explanation { 34 | width: 450px; 35 | border: 2px solid red; 36 | padding: 7px; 37 | padding-bottom: 0; 38 | margin-bottom: 20px; 39 | background-color: #f0f0f0; 40 | } 41 | 42 | #error_explanation h2 { 43 | text-align: left; 44 | font-weight: bold; 45 | padding: 5px 5px 5px 15px; 46 | font-size: 12px; 47 | margin: -7px; 48 | margin-bottom: 0px; 49 | background-color: #c00; 50 | color: #fff; 51 | } 52 | 53 | #error_explanation ul li { 54 | font-size: 12px; 55 | list-style: square; 56 | } 57 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.css.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | font-family: verdana, arial, helvetica, sans-serif; 5 | font-size: 13px; 6 | line-height: 18px; 7 | } 8 | 9 | p, ol, ul, td { 10 | font-family: verdana, arial, helvetica, sans-serif; 11 | font-size: 13px; 12 | line-height: 18px; 13 | } 14 | 15 | pre { 16 | background-color: #eee; 17 | padding: 10px; 18 | font-size: 11px; 19 | } 20 | 21 | a { 22 | color: #000; 23 | &:visited { 24 | color: #666; 25 | } 26 | &:hover { 27 | color: #fff; 28 | background-color: #000; 29 | } 30 | } 31 | 32 | div { 33 | &.field, &.actions { 34 | margin-bottom: 10px; 35 | } 36 | } 37 | 38 | #notice { 39 | color: green; 40 | } 41 | 42 | .field_with_errors { 43 | padding: 2px; 44 | background-color: red; 45 | display: table; 46 | } 47 | 48 | #error_explanation { 49 | width: 450px; 50 | border: 2px solid red; 51 | padding: 7px; 52 | padding-bottom: 0; 53 | margin-bottom: 20px; 54 | background-color: #f0f0f0; 55 | h2 { 56 | text-align: left; 57 | font-weight: bold; 58 | padding: 5px 5px 5px 15px; 59 | font-size: 12px; 60 | margin: -7px; 61 | margin-bottom: 0px; 62 | background-color: #c00; 63 | color: #fff; 64 | } 65 | ul li { 66 | font-size: 12px; 67 | list-style: square; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/assets/stylesheets/vote_events.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the VoteEvents controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/votes.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Votes controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | end 4 | -------------------------------------------------------------------------------- /app/controllers/counts_controller.rb: -------------------------------------------------------------------------------- 1 | class CountsController < InheritedResources::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/controllers/motions_controller.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # require 'billit_representers/models/motion' 3 | # require 'billit_representers/models/motion_page' 4 | require 'billit_representers/representers/motion_representer' 5 | # require 'billit_representers/representers/bill_representer' 6 | # require 'billit_representers/representers/motion_page_representer' 7 | # Dir['./app/models/billit/*'].each { |model| require model } 8 | 9 | class MotionsController < InheritedResources::Base 10 | include Roar::Rails::ControllerAdditions 11 | respond_to :json, :xml, :html 12 | def show 13 | # if params[:fields] 14 | # fields = params[:fields].split(',') 15 | # @bill = Bill.only(fields).find_by(uid: params[:id]) 16 | # # render json: @bill.to_json(only: fields) 17 | # respond_with @bill, :callback => params['callback'], :represent_with => Billit::BillBasicRepresenter 18 | # else 19 | @motion = Motion.find(params[:id]) 20 | if @motion.nil? 21 | render text: "", :status => 404 22 | else 23 | respond_with @motion, :represent_with => Billit::MotionRepresenter 24 | # respond_with @motion, :callback => params['callback'], :represent_with => Billit::MotionRepresenter 25 | end 26 | # end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/controllers/paperworks_controller.rb: -------------------------------------------------------------------------------- 1 | require 'billit_representers/representers/paperwork_collection_representer' 2 | class PaperworksController < ApplicationController 3 | respond_to :json, :xml 4 | # GET /paperworks 5 | # GET /paperworks.json 6 | def index 7 | @paperworks = Paperwork.all 8 | 9 | respond_to do |format| 10 | format.html # index.html.erb 11 | format.json { render json: @paperworks } 12 | end 13 | end 14 | 15 | # GET /paperworks/1 16 | # GET /paperworks/1.json 17 | def show 18 | @paperwork = Paperwork.find(params[:id]) 19 | 20 | respond_to do |format| 21 | format.html # show.html.erb 22 | format.json { render json: @paperwork } 23 | end 24 | end 25 | 26 | # GET /paperworks/new 27 | # GET /paperworks/new.json 28 | def new 29 | @paperwork = Paperwork.new 30 | 31 | respond_to do |format| 32 | format.html # new.html.erb 33 | format.json { render json: @paperwork } 34 | end 35 | end 36 | 37 | # GET /paperworks/1/edit 38 | def edit 39 | @paperwork = Paperwork.find(params[:id]) 40 | end 41 | 42 | # POST /paperworks 43 | # POST /paperworks.json 44 | def create 45 | @paperwork = Paperwork.new(params[:paperwork]) 46 | 47 | respond_to do |format| 48 | if @paperwork.save 49 | format.html { redirect_to @paperwork, notice: 'Paperwork was successfully created.' } 50 | format.json { render json: @paperwork, status: :created, location: @paperwork } 51 | else 52 | format.html { render action: "new" } 53 | format.json { render json: @paperwork.errors, status: :unprocessable_entity } 54 | end 55 | end 56 | end 57 | 58 | # PUT /paperworks/1 59 | # PUT /paperworks/1.json 60 | def update 61 | @paperwork = Paperwork.find(params[:id]) 62 | 63 | respond_to do |format| 64 | if @paperwork.update_attributes(params[:paperwork]) 65 | format.html { redirect_to @paperwork, notice: 'Paperwork was successfully updated.' } 66 | format.json { head :no_content } 67 | else 68 | format.html { render action: "edit" } 69 | format.json { render json: @paperwork.errors, status: :unprocessable_entity } 70 | end 71 | end 72 | end 73 | 74 | # DELETE /paperworks/1 75 | # DELETE /paperworks/1.json 76 | def destroy 77 | @paperwork = Paperwork.find(params[:id]) 78 | @paperwork.destroy 79 | 80 | respond_to do |format| 81 | format.html { redirect_to paperworks_url } 82 | format.json { head :no_content } 83 | end 84 | end 85 | 86 | # GET paperworks/search.json?q=search_string 87 | def search 88 | require 'will_paginate/array' 89 | # Sunspot.remove_all(Paperwork) # descomentar para reindexar, 90 | # Sunspot.index!(Paperwork.all) # en caso de cambio en modelo 91 | search = search_for(params) 92 | @paperworks = search.results 93 | @paperworks.extend(Billit::PaperworkCollectionRepresenter) 94 | respond_with @paperworks.to_json(params), represent_with: Billit::PaperworkCollectionRepresenter 95 | end 96 | 97 | def filter_conditions(conditions) 98 | @mongoid_attribute_names = ["_id", "created_at"] #FIX should probably have a greater scope 99 | @search_attribute_names = ["q", "bill_id", "law_text"] 100 | @range_field_types = [DateTime] 101 | @range_modifier_min = "_min" 102 | @range_modifier_max = "_max" 103 | 104 | bill_range_fields = Paperwork.fields.dup 105 | @range_field_types.each do |type| 106 | bill_range_fields.reject! {|field_name, metadata| metadata.options[:type]!= type} 107 | end 108 | bill_range_attributes = bill_range_fields.keys 109 | 110 | bill_public_attributes = Paperwork.attribute_names - @mongoid_attribute_names 111 | 112 | equivalence_attributes = bill_public_attributes + @search_attribute_names 113 | range_attributes_min = bill_range_attributes.map {|attribute| attribute + @range_modifier_min} 114 | range_attributes_max = bill_range_attributes.map {|attribute| attribute + @range_modifier_max} 115 | 116 | filtered_conditions = {} 117 | equivalence_conditions = {} 118 | range_conditions_min = {} 119 | range_conditions_max = {} 120 | conditions.each do |key, value| 121 | next if value.nil?() || value == "" 122 | if equivalence_attributes.include?(key) 123 | equivalence_conditions[key] = value 124 | elsif range_attributes_min.include?(key) 125 | range_conditions_min[key.gsub(@range_modifier_min, "")] = value 126 | elsif range_attributes_max.include?(key) 127 | range_conditions_max[key.gsub(@range_modifier_max, "")] = value 128 | end 129 | end 130 | 131 | return {equivalence_conditions: equivalence_conditions,\ 132 | range_conditions_min: range_conditions_min, range_conditions_max: range_conditions_max} 133 | end 134 | 135 | def search_for(conditions) 136 | filtered_conditions = filter_conditions(conditions) 137 | 138 | search = Sunspot.search(Paperwork) do 139 | # FIX the equivalence conditions settings should be in a conf file 140 | # search over all fields 141 | if filtered_conditions[:equivalence_conditions].key?("q") 142 | fulltext filtered_conditions[:equivalence_conditions]["q"] do 143 | # boost_fields :tags => 3.0 144 | # boost_fields :subject_areas => 2.9 145 | # boost_fields :title => 2.5 146 | # boost_fields :abstract => 2.0 147 | end 148 | filtered_conditions[:equivalence_conditions].delete("q") 149 | end 150 | # search over bill identifiers, both uid and short uid 151 | if filtered_conditions[:equivalence_conditions].key?("bill_id") 152 | text_fields do 153 | any_of do 154 | with(:uid, filtered_conditions[:equivalence_conditions]["bill_id"]) 155 | with(:short_uid, filtered_conditions[:equivalence_conditions]["bill_id"]) 156 | end 157 | end 158 | filtered_conditions[:equivalence_conditions].delete("bill_id") 159 | end 160 | #search over specific fields 161 | text_fields do 162 | all_of do 163 | filtered_conditions[:equivalence_conditions].each do |key, value| 164 | any_of do 165 | value.split("|").each do |term| 166 | with(key, term) 167 | end 168 | end 169 | end 170 | end 171 | end 172 | 173 | all_of do 174 | #range_conditions_min might be asdf_min instead of asdf 175 | filtered_conditions[:range_conditions_min].each do |key, value| 176 | with(key).greater_than(value) 177 | end 178 | filtered_conditions[:range_conditions_max].each do |key, value| 179 | with(key).less_than(value) 180 | end 181 | end 182 | 183 | paginate page:conditions[:page], per_page:conditions[:per_page] 184 | end 185 | search 186 | end 187 | 188 | end 189 | -------------------------------------------------------------------------------- /app/controllers/vote_events_controller.rb: -------------------------------------------------------------------------------- 1 | class VoteEventsController < InheritedResources::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/controllers/votes_controller.rb: -------------------------------------------------------------------------------- 1 | class VotesController < InheritedResources::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/billit/paperworks_helper.rb: -------------------------------------------------------------------------------- 1 | module Billit::PaperworksHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/bills_helper.rb: -------------------------------------------------------------------------------- 1 | module BillsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/counts_helper.rb: -------------------------------------------------------------------------------- 1 | module CountsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/motions_helper.rb: -------------------------------------------------------------------------------- 1 | module MotionsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/vote_events_helper.rb: -------------------------------------------------------------------------------- 1 | module VoteEventsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/votes_helper.rb: -------------------------------------------------------------------------------- 1 | module VotesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/mailers/.gitkeep -------------------------------------------------------------------------------- /app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/app/models/.gitkeep -------------------------------------------------------------------------------- /app/models/admin_user.rb: -------------------------------------------------------------------------------- 1 | class AdminUser 2 | include Mongoid::Document 3 | # Include default devise modules. Others available are: 4 | # :confirmable, :lockable, :timeoutable and :omniauthable 5 | devise :database_authenticatable, 6 | :recoverable, :rememberable, :trackable, :validatable 7 | 8 | # Setup accessible (or protected) attributes for your model 9 | attr_accessible :email, :password, :password_confirmation, :remember_me 10 | 11 | ## Database authenticatable 12 | field :email, type: String, default: "" 13 | field :encrypted_password, type: String, default: "" 14 | 15 | ## Recoverable 16 | field :reset_password_token, type: String 17 | field :reset_password_sent_at, type: Time 18 | 19 | ## Rememberable 20 | field :remember_created_at, type: Time 21 | 22 | ## Trackable 23 | field :sign_in_count, type: Integer, default: 0 24 | field :current_sign_in_at, type: Time 25 | field :last_sign_in_at, type: Time 26 | field :current_sign_in_ip, type: String 27 | field :last_sign_in_ip, type: String 28 | 29 | ## Confirmable 30 | # field :confirmation_token, type: String 31 | # field :confirmed_at, type: Time 32 | # field :confirmation_sent_at, type: Time 33 | # field :unconfirmed_email, type: String # Only if using reconfirmable 34 | 35 | ## Lockable 36 | # field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts 37 | # field :unlock_token, type: String # Only if unlock strategy is :email or :both 38 | # field :locked_at, type: Time 39 | end 40 | -------------------------------------------------------------------------------- /app/models/attachment.rb: -------------------------------------------------------------------------------- 1 | class Attachment 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | # The user who uploaded the file owns it 5 | # belongs_to :user 6 | belongs_to :bill 7 | # Attachment is polymorphic because a variety of things (project, team) 8 | # are "attachable", i.e. accept file uploads 9 | # belongs_to :attachable, :polymorphic => true 10 | 11 | # If you recall attachment_fu, this is kind of like "has_attachment": 12 | # mount_uploader :upload, UploadUploader 13 | # before_save :update_upload_attributes 14 | 15 | field :file_name, type: String 16 | 17 | # Sunspot indexing configuration 18 | include Sunspot::Mongoid2 19 | searchable do 20 | # Regular fields that I want indexed 21 | # integer :id 22 | time :created_at 23 | time :updated_at 24 | text :file_name 25 | 26 | # For Sunspot Cell. The 'attachment' directive instructs 27 | # Cell how to get the binary data. My understanding is that 28 | # this *must* end in _attachment 29 | attachment :document_attachment 30 | end 31 | 32 | # Goes hand-in-hand with the item above. Now, this is important: 33 | # the return value from this method is NOT the binary data itself, 34 | # but rather the full URI to the file. Cell will use this to locate 35 | # the file and index it. 36 | def document_attachment 37 | "#{Rails.root}/public/uploads/ps.doc" 38 | end 39 | 40 | # private 41 | 42 | # https://github.com/jnicklas/carrierwave/wiki/How-to%3A-Store-the-uploaded-file-size-and-content-type 43 | # def update_upload_attributes 44 | # if upload.present? && upload_changed? 45 | # self.content_type = upload.file.content_type 46 | # self.file_size = upload.file.size 47 | # self.file_name = File.basename(upload.url) 48 | # end 49 | # end 50 | end -------------------------------------------------------------------------------- /app/models/bill.rb: -------------------------------------------------------------------------------- 1 | class Bill 2 | require 'open-uri' 3 | include Mongoid::Document 4 | include Mongoid::Timestamps 5 | 6 | validates_presence_of :uid 7 | validates_uniqueness_of :uid 8 | 9 | before_save :arrayify, :standardize_tags, :set_current_priority 10 | after_save :index! 11 | 12 | has_many :paperworks, autosave: true, class_name: "Paperwork" 13 | has_many :priorities, autosave: true, class_name: "Priority" 14 | has_many :reports, autosave: true, class_name: "Report" 15 | has_many :documents, autosave: true, class_name: "Document" 16 | has_many :directives, autosave: true, class_name: "Directive" 17 | has_many :remarks, autosave: true, class_name: "Remark" 18 | has_many :motions, autosave: true, class_name: "Motion" 19 | embeds_many :revisions 20 | 21 | field :uid, type: String 22 | field :title, type: String 23 | field :abstract, type: String 24 | field :creation_date, type: Time 25 | field :source, type: String 26 | field :initial_chamber, type: String 27 | field :stage, type: String 28 | field :sub_stage, type: String 29 | field :status, type: String 30 | field :resulting_document, type: String 31 | field :merged_bills, type: Array 32 | field :subject_areas, type: Array 33 | field :authors, type: Array 34 | field :publish_date, type: Time 35 | field :tags, type: Array 36 | field :bill_draft_link, type: String 37 | field :current_priority, type: String 38 | 39 | scope :urgent, where(:current_priority.in => ["Discusión inmediata", "Suma", "Simple"]) 40 | 41 | include Sunspot::Mongoid2 42 | searchable do 43 | text :uid 44 | text :short_uid 45 | text :title 46 | text :abstract 47 | time :creation_date 48 | text :source 49 | text :initial_chamber 50 | text :current_priority 51 | text :stage 52 | text :sub_stage 53 | text :status 54 | text :subject_areas 55 | text :authors 56 | time :publish_date 57 | text :tags 58 | time :updated_at 59 | #attachment type has to be a uri (local or remote) 60 | #if it's a string it will not get indexed 61 | attachment :bill_draft 62 | attachment :law_text 63 | end 64 | 65 | def get_current_priority 66 | return "Sin urgencia" if self.priorities.blank? 67 | all_priorities = self.priorities.in_memory.blank? ? self.priorities : self.priorities.in_memory 68 | latest_priority = all_priorities.reject{|x| x.entry_date.blank?}.sort{ |x,y| y.entry_date <=> x.entry_date }.first 69 | return "Sin urgencia" if latest_priority.type == "Sin urgencia" or latest_priority.entry_date > Date.today 70 | 71 | days_in_force = case latest_priority.type 72 | when "Discusión inmediata" 73 | 6 74 | when "Suma" 75 | 15 76 | when "Simple" 77 | 30 78 | else 79 | return "Sin urgencia" 80 | end 81 | 82 | if (latest_priority.entry_date + days_in_force.days) >= Date.today 83 | latest_priority.type 84 | else 85 | "Sin urgencia" 86 | end 87 | end 88 | 89 | def set_current_priority 90 | self.current_priority = get_current_priority 91 | end 92 | 93 | def law_id 94 | self.resulting_document.gsub(/Ley[^\d]*(\d+)\.?(\d*)/, '\1\2') if resulting_document =~ /Ley[^\d]*(\d+)\.?(\d*)/ 95 | end 96 | 97 | def law_xml_link 98 | if !self.law_id.blank? 99 | "http://www.leychile.cl/Consulta/obtxml?opt=7&idLey=" + law_id 100 | end 101 | end 102 | 103 | def law_web_link 104 | if !self.law_id.blank? 105 | "http://www.leychile.cl/Navegar?idLey=" + law_id 106 | end 107 | end 108 | 109 | def to_param 110 | uid 111 | end 112 | 113 | def arrayify 114 | ["subject_areas", "authors", "tags"].each do |field| 115 | if field.class == String 116 | field = field.split(/;|\|/) 117 | end 118 | end 119 | end 120 | 121 | 122 | def standardize_tags 123 | if self.tags.class == Array 124 | self.tags.map! do |tag| 125 | tag = I18n.transliterate(tag, locale: :transliterate_special).downcase.strip 126 | end 127 | end 128 | end 129 | 130 | def short_uid 131 | self.uid.split("-")[0] 132 | end 133 | 134 | # The two methods below only exist so the query fields have nicer names 135 | def bill_draft 136 | self.bill_draft_link 137 | end 138 | 139 | def law_text 140 | law_xml_link 141 | end 142 | 143 | def icon 144 | if ! self.status.blank? 145 | case self.status.strip 146 | when "Archivado" 147 | return 'filed.png' 148 | when "Publicado" 149 | return 'published.png' 150 | when "En tramitación" 151 | return 'paperwork.png' #icono pendiente 152 | when "Rechazado" 153 | return 'rejected.png' 154 | when "Retirado" 155 | return 'discarded.png' 156 | else 157 | return 'paperwork.png' 158 | end 159 | end 160 | return 'paperwork.png' 161 | end 162 | 163 | def self.update_priority 164 | Bill.urgent.each do |bill| 165 | bill.save 166 | end 167 | end 168 | end 169 | -------------------------------------------------------------------------------- /app/models/count.rb: -------------------------------------------------------------------------------- 1 | class Count 2 | include Mongoid::Document 3 | 4 | embedded_in :vote_event 5 | 6 | field :option, type: String 7 | field :value, type: Integer 8 | end 9 | -------------------------------------------------------------------------------- /app/models/directive.rb: -------------------------------------------------------------------------------- 1 | class Directive 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | belongs_to :bill 6 | 7 | field :date, :type => DateTime 8 | field :step, :type => String 9 | field :stage, :type => String 10 | field :link, :type => String 11 | end -------------------------------------------------------------------------------- /app/models/document.rb: -------------------------------------------------------------------------------- 1 | class Document 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | belongs_to :bill 6 | 7 | field :number, :type => String 8 | field :date, :type => DateTime 9 | field :step, :type => String 10 | field :stage, :type => String 11 | field :type, :type => String 12 | field :chamber, :type => String 13 | field :link, :type => String 14 | end -------------------------------------------------------------------------------- /app/models/motion.rb: -------------------------------------------------------------------------------- 1 | class Motion 2 | include Mongoid::Document 3 | 4 | belongs_to :bill 5 | has_many :vote_events, autosave: true, class_name: "VoteEvent" 6 | 7 | field :organization, type: String 8 | field :context, type: String 9 | field :creator, type: String 10 | field :text, type: String 11 | field :date, type: Time 12 | field :requirement, type: String 13 | field :result, type: String 14 | field :session, type: String 15 | end 16 | -------------------------------------------------------------------------------- /app/models/paperwork.rb: -------------------------------------------------------------------------------- 1 | class Paperwork 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | belongs_to :bill 6 | 7 | before_save :save_bill_uid, :index_paperwork, :define_timeline_status 8 | 9 | field :session, :type => String 10 | field :date, :type => DateTime 11 | field :description, :type => String 12 | field :stage, :type => String 13 | field :chamber, :type => String 14 | field :bill_uid, :type => String 15 | field :timeline_status, :type => String 16 | 17 | include Sunspot::Mongoid2 18 | searchable do 19 | text :session 20 | time :date 21 | text :description 22 | text :stage 23 | text :chamber 24 | end 25 | 26 | def save_bill_uid 27 | bill = Bill.find(self.bill_id) 28 | self.bill_uid = bill.uid 29 | end 30 | 31 | def index_paperwork 32 | Sunspot.index!(self) 33 | end 34 | 35 | def define_timeline_status 36 | timeline_status_value = 'Estado por Defecto' 37 | timeline_status_hash.values.each do |match_strings| 38 | match_strings.each do |match_string| 39 | if self.description =~ /(?imx:#{Regexp.quote(match_string)})/ 40 | timeline_status_value = timeline_status_hash.key match_strings 41 | end 42 | end 43 | end 44 | self.timeline_status = timeline_status_value 45 | end 46 | 47 | # The order in which these appear matters. The latter override the previous. 48 | def timeline_status_hash 49 | { 50 | 'Descartado' => ['retira', 'retirado'], 51 | 'Rechazado' => ['rechazado', 'rechazo'], 52 | 'Votación' => ['discusión'], 53 | 'Ingreso' => ['ingreso', 'iniciativa'], 54 | 'Inasistencia' => ['insistencia'], 55 | 'Indicaciones' => ['indicaciones', 'indicación'], 56 | 'Informe' => ['informe'], 57 | 'Avanza' => ['pasa a', 'a cámara'], 58 | 'Tramitación Terminada' => ['al ejecutivo'], 59 | 'Urgencia' => ['hace presente la urgencia'], 60 | 'Retiro de Urgencia' => ['retira la urgencia'] 61 | } 62 | end 63 | 64 | def icon_event 65 | case self.timeline_status 66 | when "Ingreso" 67 | return "introduced.png" 68 | when "Avanza" 69 | return "go-forward.png" 70 | when "Indicaciones" 71 | return "directives.png" 72 | when "Votación" 73 | return "vote.png" 74 | when "Urgencia" 75 | return "priority.png" 76 | when "Rechazado" 77 | return "rejected.png" 78 | when "Insistencia" 79 | return "insistence.png" 80 | when "Descartado" 81 | return "discarded.png" 82 | when "Informe" 83 | return "report.png" 84 | when "Retiro de Urgencia" 85 | return "priority-withdrawal.png" 86 | when "Tramitación Terminada" 87 | return "published.png" 88 | else 89 | return "paperwork.png" 90 | end 91 | end 92 | end -------------------------------------------------------------------------------- /app/models/priority.rb: -------------------------------------------------------------------------------- 1 | class Priority 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | belongs_to :bill 6 | 7 | field :type, :type => String 8 | field :entry_date, :type => DateTime 9 | field :entry_message, :type => String 10 | field :entry_chamber, :type => String 11 | field :withdrawal_date, :type => DateTime 12 | field :withdrawal_message, :type => String 13 | field :withdrawal_chamber, :type => String 14 | end -------------------------------------------------------------------------------- /app/models/remark.rb: -------------------------------------------------------------------------------- 1 | class Remark 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | belongs_to :bill 6 | 7 | field :date, :type => DateTime 8 | field :event, :type => String 9 | field :stage, :type => String 10 | end -------------------------------------------------------------------------------- /app/models/report.rb: -------------------------------------------------------------------------------- 1 | class Report 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | belongs_to :bill 6 | 7 | field :date, :type => DateTime 8 | field :step, :type => String 9 | field :stage, :type => String 10 | field :link, :type => String 11 | end -------------------------------------------------------------------------------- /app/models/revision.rb: -------------------------------------------------------------------------------- 1 | class Revision 2 | include Mongoid::Document 3 | include Mongoid::Timestamps 4 | 5 | belongs_to :bill 6 | 7 | field :description, :type => String 8 | field :link, :type => String 9 | end -------------------------------------------------------------------------------- /app/models/vote.rb: -------------------------------------------------------------------------------- 1 | class Vote 2 | include Mongoid::Document 3 | 4 | embedded_in :vote_event 5 | 6 | field :voter_id, type: String 7 | field :option, type: String 8 | end 9 | -------------------------------------------------------------------------------- /app/models/vote_event.rb: -------------------------------------------------------------------------------- 1 | class VoteEvent 2 | include Mongoid::Document 3 | 4 | belongs_to :motion 5 | embeds_many :counts#, autosave: true, class_name: "Count" 6 | embeds_many :votes 7 | 8 | field :start_date, type: Time 9 | field :end_date, type: Time 10 | end 11 | -------------------------------------------------------------------------------- /app/views/billit/paperworks/_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_for @billit_paperwork do |f| 2 | - if @billit_paperwork.errors.any? 3 | #error_explanation 4 | %h2= "#{pluralize(@billit_paperwork.errors.count, "error")} prohibited this billit_paperwork from being saved:" 5 | %ul 6 | - @billit_paperwork.errors.full_messages.each do |msg| 7 | %li= msg 8 | 9 | .field 10 | = f.label :session 11 | = f.text_field :session 12 | .field 13 | = f.label :date 14 | = f.datetime_select :date 15 | .field 16 | = f.label :description 17 | = f.text_field :description 18 | .field 19 | = f.label :stage 20 | = f.text_field :stage 21 | .field 22 | = f.label :chamber 23 | = f.text_field :chamber 24 | .actions 25 | = f.submit 'Save' 26 | -------------------------------------------------------------------------------- /app/views/billit/paperworks/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Editing billit_paperwork 2 | 3 | = render 'form' 4 | 5 | = link_to 'Show', @billit_paperwork 6 | \| 7 | = link_to 'Back', billit_paperworks_path 8 | -------------------------------------------------------------------------------- /app/views/billit/paperworks/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Listing billit_paperworks 2 | 3 | %table 4 | %tr 5 | %th Session 6 | %th Date 7 | %th Description 8 | %th Stage 9 | %th Chamber 10 | %th 11 | %th 12 | %th 13 | 14 | - @billit_paperworks.each do |billit_paperwork| 15 | %tr 16 | %td= billit_paperwork.session 17 | %td= billit_paperwork.date 18 | %td= billit_paperwork.description 19 | %td= billit_paperwork.stage 20 | %td= billit_paperwork.chamber 21 | %td= link_to 'Show', billit_paperwork 22 | %td= link_to 'Edit', edit_billit_paperwork_path(billit_paperwork) 23 | %td= link_to 'Destroy', billit_paperwork, :method => :delete, :data => { :confirm => 'Are you sure?' } 24 | 25 | %br 26 | 27 | = link_to 'New Paperwork', new_billit_paperwork_path 28 | -------------------------------------------------------------------------------- /app/views/billit/paperworks/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1 New billit_paperwork 2 | 3 | = render 'form' 4 | 5 | = link_to 'Back', billit_paperworks_path 6 | -------------------------------------------------------------------------------- /app/views/billit/paperworks/show.html.haml: -------------------------------------------------------------------------------- 1 | %p#notice= notice 2 | 3 | %p 4 | %b Session: 5 | = @billit_paperwork.session 6 | %p 7 | %b Date: 8 | = @billit_paperwork.date 9 | %p 10 | %b Description: 11 | = @billit_paperwork.description 12 | %p 13 | %b Stage: 14 | = @billit_paperwork.stage 15 | %p 16 | %b Chamber: 17 | = @billit_paperwork.chamber 18 | 19 | = link_to 'Edit', edit_billit_paperwork_path(@billit_paperwork) 20 | \| 21 | = link_to 'Back', billit_paperworks_path 22 | -------------------------------------------------------------------------------- /app/views/bills/_bill.html.haml: -------------------------------------------------------------------------------- 1 | %div.row.result.whitewithaside 2 | %div.col-md-1 3 | %h5.light 4 | = bill.uid 5 | %div.col-md-10 6 | %h5 7 | = link_to bill.title, bill_path(bill.uid), :onclick => "ga('send','paperwork','bill', '"+bill.uid+"')" 8 | %p 9 | - if ! bill.stage.blank? 10 | %span.light 11 | = t('search.stage') 12 | = bill.stage 13 | %br/ 14 | - if ! bill.creation_date.blank? 15 | %span.light 16 | = t('search.creation_date') 17 | = localize bill.creation_date.to_date, :format => :long 18 | %br/ 19 | - if ! bill.source.blank? 20 | %span.light 21 | = t('search.initiative') 22 | = bill.source -------------------------------------------------------------------------------- /app/views/bills/_bill_header.html.haml: -------------------------------------------------------------------------------- 1 | %div.hero-space-bill 2 | %div.container 3 | %div.row 4 | %div.col-md-9 5 | %ol.breadcrumb 6 | %li 7 | = link_to t('layout.home'), root_path 8 | %li 9 | = link_to t('bill.breadcrumb_bill'), bills_path 10 | %li.active 11 | = @bill.title[0..30] + '...' 12 | %div.col-md-3 13 | %ul.list-inline.action-btn 14 | %div.row 15 | %div.col-md-1.side 16 | %h5.light 17 | = @bill.uid 18 | - if ! @bill.icon.blank? 19 | - title = '' 20 | - if ! @bill.status.blank? 21 | - title = @bill.status.strip 22 | = image_tag("statusicon/" + @bill.icon, class:"hidden-xs", title:title) 23 | %div.col-md-11 24 | %h4 25 | = @bill.title 26 | %p 27 | -if !@bill.creation_date.blank? 28 | %span.light 29 | = t('bill.creation_date') + ":" 30 | = localize @bill.creation_date.to_date 31 | %br/ 32 | -if !@bill.source.blank? 33 | %span.light 34 | = t('bill.source') + ":" 35 | = @bill.source 36 | %br/ 37 | -if !@bill.initial_chamber.blank? 38 | %span.light 39 | = t('bill.initial_chamber') + ":" 40 | = @bill.initial_chamber 41 | %br/ 42 | -if !@bill.current_priority.blank? 43 | %span.light 44 | = t('bill.current_priority') + ":" 45 | = @bill.current_priority 46 | %br/ 47 | -if !@bill.stage.blank? 48 | %span.light 49 | = t('bill.stage') + ":" 50 | = @bill.stage 51 | %br/ 52 | -if !@bill.status.blank? 53 | %span.light 54 | = t('bill.status') + ":" 55 | = @bill.status 56 | %br/ 57 | -if !@bill.publish_date.blank? 58 | %span.light 59 | = t('bill.publish_date') + ":" 60 | = localize @bill.publish_date.to_date 61 | %br/ 62 | -if !@bill.abstract.blank? 63 | %span.light 64 | = t('bill.abstract') + ":" 65 | = @bill.abstract 66 | %p 67 | -if !@authors.blank? 68 | %span.light 69 | = t('bill.authors') + ':' 70 | - @authors.each_with_index do |author, index| 71 | %span 72 | - author = author.second 73 | - if !author['uid'].blank? 74 | = link_to author['name'], congressman_path(author['uid']) 75 | - elsif 76 | = author['name'] 77 | - if index < @authors.size - 1 78 | = ', ' 79 | %br/ 80 | -if !@bill.tags.blank? 81 | %ul.list-inline 82 | - if !@bill.tags.blank? 83 | - @bill.tags.each do |tag| 84 | %li 85 | %span.label.label-default= tag 86 | %br/ 87 | -if ! @bill.bill_draft_link.blank? 88 | %a{'href'=> @bill.bill_draft_link} 89 | = t('bill.download_project') 90 | %i.fa.fa-download 91 | -if ! @bill.law_web_link.blank? 92 | %a{'href'=> @bill.law_web_link, 'target'=>'_blank'} 93 | = t('bill.view_law') + ' ' + @bill.law_id 94 | %i.fa.fa-eye -------------------------------------------------------------------------------- /app/views/bills/_box_bills_result.html.haml: -------------------------------------------------------------------------------- 1 | = render partial: "bill", collection: @bills 2 | %div.row 3 | %div.col-md-6.text-center 4 | - if ! @bills_query.previous.blank? 5 | = link_to search_bills_path + '?q='+params[:q]+'&page=' + (params[:page].to_i - 1).to_s + '&bills=1', :class => 'btn btn-default' do 6 | %i.fa.fa-long-arrow-left 7 | = t('pagination.previous') 8 | 9 | %div.col-md-6.text-center 10 | - if ! @bills_query.next.blank? 11 | / we need change this shit 12 | - page = 2 13 | - if ! params[:page].blank? 14 | - page = params[:page].to_i + 1 15 | = link_to search_bills_path + '?q='+params[:q].to_s+'&page=' + page.to_s + '&bills=1', :class => 'btn btn-default' do 16 | = t('pagination.next') 17 | %i.fa.fa-long-arrow-right 18 | 19 | - if @bills.count == 0 20 | %p.text-center 21 | = t('search.there_are_no_results') -------------------------------------------------------------------------------- /app/views/bills/_filter_search_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_tag({controller: "bills", action: "search"}, :method => 'get', :name => 'bills_search', :id => 'bills_search') do 2 | %div.form-group 3 | = label_tag :q, 'Palabra clave' 4 | %input.form-control{:name=>'q', :id=>'q', 'value' => params[:q], :placeholder => t('search.placeholder_search_for'), :onfocus => "ga('send','paperwork','focus_search')"} 5 | 6 | %div.form-group 7 | = label_tag :bill_id, t('search.bulletin') 8 | = text_field_tag :bill_id, params[:bill_id], :class => 'form-control', :placeholder => t('search.placeholder_bulletin'), :onfocus => "ga('send','paperwork','focus_bulletin')" 9 | 10 | %div.form-group 11 | = label_tag :authors, t('search.author') 12 | - if params[:authors] == nil 13 | - params[:authors] = "" 14 | %div 15 | %input{"type" => "text", "value" => params[:authors], "class" => "form-control", "id" => "authors", "name" => "authors", "placeholder" => t('search.placeholder_author'), :autocomplete=>"off"} 16 | 17 | %div.form-group 18 | = label_tag :stage, t('search.stage') 19 | %select{:name => "stage", :class => "form-control", :onfocus => "ga('send','paperwork','focus_stage')"} 20 | %option{:value => "", selected: params[:stage] == ""}= t 'search.all_the_stages' 21 | - @stages = Billit::Bill.class_variable_get(:@@stage_valid_values) 22 | - if @stages != nil 23 | - @stages.each do |stage| 24 | %option{:value => stage, selected: params[:stage] == stage}= stage 25 | 26 | / 27 | %div.form-group 28 | = label_tag :initial_chamber, t('search.bill_type') 29 | %select{:name => "status", :class => "form-control", :onfocus => "ga('send','paperwork','focus_type')"} 30 | %option{:value => "", selected: params[:initial_chamber] == ""}= t 'search.all_the_types' 31 | %option{:value => "Publicado", selected: params[:initial_chamber] == "Publicado"}= 'Ley' 32 | %option{:value => "En tramitación", selected: params[:initial_chamber] == "En tramitación"}= 'Proyecto de ley' 33 | 34 | %div.form-group 35 | = label_tag :initial_chamber, t('search.initial_chamber') 36 | %select{:name => "initial_chamber", :class => "form-control", :onfocus => "ga('send','paperwork','focus_chamber')"} 37 | %option{:value => "", selected: params[:initial_chamber] == ""}= t 'search.all_the_chambers' 38 | - @chambers = Billit::Bill.class_variable_get(:@@initial_chamber_valid_values) 39 | - if @chambers != nil 40 | - @chambers.each do |chamber| 41 | %option{:value => chamber, selected: params[:initial_chamber] == chamber}= chamber 42 | 43 | %div.form-group 44 | = label_tag :initial_chamber, t('search.current_priority') 45 | %select{:name => "current_priority", :class => "form-control", :onfocus => "ga('send','paperwork','focus_priority')"} 46 | %option{:value => "", selected: params[:current_priority] == ""}= t 'search.all_the_priorities' 47 | - @priorities = Billit::Bill.class_variable_get(:@@current_priority_valid_values) 48 | - if @priorities != nil 49 | - @priorities.each do |priority| 50 | %option{:value => priority, selected: params[:current_priority] == priority}= priority 51 | 52 | %div.form-group 53 | = label_tag :creation_date_min, t('search.creation_date_min') 54 | - if params[:creation_date_min] == nil 55 | - params[:creation_date_min] = ENV['parliaments_initial_date'] 56 | %div.input-group 57 | %input{"type" => "date", "value" => params[:creation_date_min], "min" => params[:creation_date_min], "name" => "creation_date_min", "class" => "form-control", "onfocus" => "ga('send','paperwork','focus_min_date')"} 58 | %span.input-group-addon 59 | %i.fa.fa-calendar 60 | 61 | %div.form-group 62 | = label_tag :creation_date_max, t('search.creation_date_max') 63 | - if params[:creation_date_max] == nil 64 | - params[:creation_date_max] = Date.today.to_s 65 | %div.input-group 66 | %input{"type" => "date", "value" => params[:creation_date_max], "min" => ENV['parliaments_initial_date'], "name" => "creation_date_max", "class" => "form-control", "onfocus" => "ga('send','paperwork','focus_max_date')"} 67 | %span.input-group-addon 68 | %i.fa.fa-calendar 69 | 70 | %input{"type" => "hidden", "name" => "bills", "value" => "1"} 71 | 72 | %button.btn.btn-primary.pull-right.btn-lg 73 | Buscar -------------------------------------------------------------------------------- /app/views/bills/_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_for @bill do |f| 2 | - if @bill.errors.any? 3 | #error_explanation 4 | %h2= "#{pluralize(@bill.errors.count, "error")} prohibited this bill from being saved:" 5 | %ul 6 | - @bill.errors.full_messages.each do |msg| 7 | %li= msg 8 | 9 | .field 10 | = f.label :uid 11 | = f.text_field :uid 12 | .field 13 | = f.label :title 14 | = f.text_field :title 15 | .field 16 | = f.label :creation_date 17 | = f.text_field :creation_date 18 | .field 19 | = f.label :source 20 | = f.text_field :source 21 | .field 22 | = f.label :initial_chamber 23 | = f.text_field :initial_chamber 24 | .field 25 | = f.label :current_priority 26 | = f.text_field :current_priority 27 | .field 28 | = f.label :stage 29 | = f.text_field :stage 30 | .field 31 | = f.label :sub_stage 32 | = f.text_field :sub_stage 33 | .field 34 | = f.label :status 35 | = f.text_field :status 36 | .field 37 | = f.label :resulting_document 38 | = f.text_field :resulting_document 39 | .field 40 | = f.label :merged_bills 41 | - merged_bills = @bill.merged_bills.join("; ") if !@bill.merged_bills.blank? 42 | = f.text_field :merged_bills, value: merged_bills 43 | = f.text_field :merged_bills 44 | .field 45 | = f.label :subject_areas 46 | - subject_areas = @bill.subject_areas.join("; ") 47 | = f.text_field :subject_areas, value: subject_areas 48 | .field 49 | = f.label :authors 50 | - authors = @bill.authors.join("; ") 51 | = f.text_field :authors, value: authors 52 | .field 53 | = f.label :publish_date 54 | = f.text_field :publish_date 55 | .field 56 | = f.label :tags 57 | - tags = @bill.tags.join("; ") if !@bill.tags.blank? 58 | = f.text_field :tags, value: tags 59 | .actions 60 | = f.submit 'Save' 61 | -------------------------------------------------------------------------------- /app/views/bills/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Editing bill 2 | 3 | = render 'form' 4 | 5 | = link_to 'Show', @bill 6 | \| 7 | = link_to 'Back', bills_path 8 | -------------------------------------------------------------------------------- /app/views/bills/index.html.haml: -------------------------------------------------------------------------------- 1 | %div.row 2 | %div.col-md-9 3 | %ol.breadcrumb 4 | %li 5 | = link_to t('layout.home'), root_path 6 | %li.current 7 | Resultado de búsqueda 8 | %div.col-md-3 9 | %ul.list-inline.pull-right 10 | %div.row 11 | %h2 12 | Proyectos de ley 13 | 14 | %div.row 15 | %div.col-md-3.aside 16 | = render :partial => "filter_search_form" 17 | %div.col-md-9.whitewithaside 18 | - @bills = @bills_query.bills 19 | = render :partial => "box_bills_result" -------------------------------------------------------------------------------- /app/views/bills/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1 New bill 2 | 3 | = render 'form' 4 | 5 | = link_to 'Back', bills_path 6 | -------------------------------------------------------------------------------- /app/views/bills/remove_index.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Listing bills 2 | 3 | %table 4 | %tr 5 | %th Uid 6 | %th Title 7 | %th Abstract 8 | %th Tags 9 | %th Matters 10 | %th Stage 11 | %th Creation date 12 | %th Publish date 13 | %th Authors 14 | %th Origin chamber 15 | %th Current urgency 16 | %th Link law 17 | %th 18 | %th 19 | %th 20 | 21 | - @bills.each do |bill| 22 | %tr 23 | %td= bill.uid 24 | %td= bill.title 25 | %td= bill.abstract 26 | %td= bill.tags 27 | %td= bill.matters 28 | %td= bill.stage 29 | %td= bill.creation_date 30 | %td= bill.publish_date 31 | %td= bill.authors 32 | %td= bill.origin_chamber 33 | %td= bill.current_urgency 34 | %td= bill.link_law 35 | %td= link_to 'Show', bill 36 | %td= link_to 'Edit', edit_bill_path(bill) 37 | %td= link_to 'Destroy', bill, :method => :delete, :data => { :confirm => 'Are you sure?' } 38 | 39 | %br 40 | 41 | = link_to 'New Bill', new_bill_path 42 | -------------------------------------------------------------------------------- /app/views/bills/search.html.haml: -------------------------------------------------------------------------------- 1 | %div.row 2 | %div.col-md-9 3 | %ol.breadcrumb 4 | %li 5 | = link_to t('layout.home'), root_path 6 | %li.current 7 | Resultado de búsqueda 8 | 9 | %div.row 10 | %h2 11 | Proyectos de ley 12 | 13 | %div.row 14 | %div.col-md-3.aside 15 | = render :partial => "filter_search_form" 16 | %div.col-md-9.whitewithaside 17 | - @bills = @bills_query.bills 18 | = render :partial => "box_bills_result" -------------------------------------------------------------------------------- /app/views/bills/show.html.haml: -------------------------------------------------------------------------------- 1 | %section#graph 2 | %ul.list-inline 3 | - if ! @bill.paperworks.blank? 4 | %li 5 | %h4{name:'timeline'} 6 | = t('bill.title_event') 7 | - if ! @bill.paperworks.blank? 8 | %li 9 | = link_to (url_for :controller => 'bills', :action=>'show', :id=>@bill.uid, :format => 'xls'), :onclick => "ga('send','download','download_bill_history_xls')" do 10 | = t('bill.download_history') 11 | %i.fa.fa-download 12 | %li 13 | %a{'href'=>'#', 'data-toggle'=>'modal', 'data-target'=>'#Documents', 'onclick' => "ga('send','view','view_documents')"} 14 | = t('bill.view_documents') 15 | %i.fa.fa-file 16 | %li.pull-right 17 | %div.hidden-xs 18 | = t('bill.sort_time') 19 | %a.down{'href'=>'#','onclick'=>"ga('send','click','desktop_more_recent')"} 20 | %i.fa.fa-chevron-circle-down 21 | %a.up{'href'=>'#','onclick'=>"ga('send','click','desktop_less_recent')"} 22 | %i.fa.fa-chevron-circle-up 23 | 24 | - if ! @bill.paperworks.blank? 25 | %div.row.visible-xs 26 | %div.col-xs-6 27 | %button.down{'onclick'=>"ga('send','click','mobile_more_recent')"} 28 | %i.fa.fa-chevron-circle-down 29 | = t('bill.more_recents') 30 | %div.col-xs-6 31 | %button.up{'onclick'=>"ga('send','click','mobile_less_recent')"} 32 | %i.fa.fa-chevron-circle-up 33 | = t('bill.less_recents') 34 | 35 | 36 | %div.modal.fade#Documents{'tabindex'=>'-1', 'role'=>'dialog', 'aria-labelledby'=>'myModalLabel', 'aria-hidden'=>'true'} 37 | %div.modal-dialog.modal-lg 38 | %div.modal-content 39 | %div.modal-header 40 | %button.close{'type'=>'button', 'data-dismiss'=>'modal', 'aria-hidden'=>'true'} 41 | × 42 | %h4.modal-title#myModalLabel 43 | = t('bill.modal_bulletin_number') 44 | = @bill.uid 45 | %div.modal-body 46 | 47 | - if ! @bill.reports.blank? 48 | %h5 49 | = t('bill.modal_reports') 50 | %table.table.table-striped 51 | %tr 52 | %th 53 | = t('bill.modal_table_date') 54 | %th 55 | = t('bill.modal_table_paperwork') 56 | - @bill.reports.each do | rep | 57 | - if ! rep.link.blank? 58 | %tr 59 | %td 60 | - if ! rep.date.blank? 61 | = localize rep.date.to_date 62 | %td 63 | %a{'href'=>rep.link} 64 | = rep.step 65 | 66 | - if ! @bill.documents.blank? 67 | %h5 68 | = t('bill.modal_documents') 69 | %table.table.table-striped 70 | %tr 71 | %th 72 | = t('bill.modal_table_date') 73 | %th 74 | = t('bill.modal_table_paperwork') 75 | - @bill.documents.each do | doc | 76 | - if ! doc.link.blank? 77 | %tr 78 | %td 79 | - if ! doc.date.blank? 80 | = localize doc.date.to_date 81 | %td 82 | %a{'href'=>doc.link} 83 | = doc.step 84 | 85 | - if ! @bill.directives.blank? 86 | %h5 87 | = t('bill.modal_directives') 88 | %table.table.table-striped 89 | %tr 90 | %th 91 | = t('bill.modal_table_date') 92 | %th 93 | = t('bill.modal_table_paperwork') 94 | - @bill.directives.each do | dir | 95 | - if ! dir.link.blank? 96 | %tr 97 | %td 98 | - if ! dir.date.blank? 99 | = localize dir.date.to_date 100 | %td 101 | %a{'href'=>dir.link} 102 | = dir.step 103 | 104 | - if ! @bill.revisions.blank? 105 | %h5 106 | = t('bill.modal_revision') 107 | %table.table.table-striped 108 | %tr 109 | %th 110 | = t('bill.modal_table_paperwork') 111 | - @bill.revisions.each do | rev | 112 | - if ! rev.link.blank? 113 | %tr 114 | %td 115 | %a{'href'=>rev.link} 116 | = rev.description 117 | 118 | %div#timeline.row 119 | - @bill.paperworks.each_with_index do | paperwork, index | 120 | %div{ 'data-sort' => paperwork.date.to_time.to_i } 121 | %div.timeline-container.col-md-1 122 | = image_tag("statusicon/" + paperwork.icon_event, class:"hidden-xs") 123 | %div.bill_header.col-md-11 124 | %h5 125 | = paperwork.description 126 | %p.light 127 | = localize paperwork.date.to_date, :format => :long 128 | 129 | %p 130 | = paperwork.stage 131 | 132 | - if paperwork.chamber.length > 1 133 | = '•' + t('bill.chamber') + ':' 134 | = paperwork.chamber 135 | 136 | - if paperwork.session.length > 1 137 | = '•' + t('bill.session') + ':' 138 | = paperwork.session 139 | 140 | :javascript 141 | $('.up').on('click', function(e){ 142 | e.preventDefault(); 143 | $("div#timeline>div").tsort({order:'asc', data:'sort'}); 144 | }); 145 | 146 | $('.down').on('click', function(e){ 147 | e.preventDefault(); 148 | $("div#timeline>div").tsort({order:'desc', data:'sort'}); 149 | }); 150 | 151 | $(document).ready(function(){ 152 | $("div#timeline>div").tsort({order:'asc', data:'sort'}); 153 | }) 154 | -------------------------------------------------------------------------------- /app/views/bills/show.xls.eku: -------------------------------------------------------------------------------- 1 | # set the filename sent to the user with __filename variable 2 | # this is optional, if you don't set it, the name will be like products.xls 3 | 4 | __filename = Legislative::Application.config.application_name + '.xls' 5 | 6 | # we get 'xls' variable which is a Workbook object 7 | # then we can create some worksheet to work with, with create_worksheet method 8 | 9 | sheet1 = xls.create_worksheet 10 | 11 | # fill the [0, 0] cell 12 | 13 | sheet1[0, 0] = 'Historia del proyecto' 14 | 15 | sheet1.row(1).concat ['Fecha', 'Descripción', 'Estado', 'Cámara', 'Sesión'] 16 | 17 | @paperworks.each_with_index do |paperwork, i| 18 | fecha = localize paperwork.date.to_date, :format => :long 19 | sheet1.update_row i+2, fecha, paperwork.description, paperwork.stage, paperwork.chamber, paperwork.session 20 | end -------------------------------------------------------------------------------- /app/views/counts/_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_for @count do |f| 2 | - if @count.errors.any? 3 | #error_explanation 4 | %h2= "#{pluralize(@count.errors.count, "error")} prohibited this count from being saved:" 5 | %ul 6 | - @count.errors.full_messages.each do |msg| 7 | %li= msg 8 | 9 | .field 10 | = f.label :option 11 | = f.text_field :option 12 | .field 13 | = f.label :value 14 | = f.text_field :value 15 | .actions 16 | = f.submit 'Save' 17 | -------------------------------------------------------------------------------- /app/views/counts/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Editing count 2 | 3 | = render 'form' 4 | 5 | = link_to 'Show', @count 6 | \| 7 | = link_to 'Back', counts_path 8 | -------------------------------------------------------------------------------- /app/views/counts/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Listing counts 2 | 3 | %table 4 | %tr 5 | %th Option 6 | %th Value 7 | %th 8 | %th 9 | %th 10 | 11 | - @counts.each do |count| 12 | %tr 13 | %td= count.option 14 | %td= count.value 15 | %td= link_to 'Show', count 16 | %td= link_to 'Edit', edit_count_path(count) 17 | %td= link_to 'Destroy', count, :method => :delete, :data => { :confirm => 'Are you sure?' } 18 | 19 | %br 20 | 21 | = link_to 'New Count', new_count_path 22 | -------------------------------------------------------------------------------- /app/views/counts/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1 New count 2 | 3 | = render 'form' 4 | 5 | = link_to 'Back', counts_path 6 | -------------------------------------------------------------------------------- /app/views/counts/show.html.haml: -------------------------------------------------------------------------------- 1 | %p#notice= notice 2 | 3 | %p 4 | %b Option: 5 | = @count.option 6 | %p 7 | %b Value: 8 | = @count.value 9 | 10 | = link_to 'Edit', edit_count_path(@count) 11 | \| 12 | = link_to 'Back', counts_path 13 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <%= @title %><%= BillIt::Application.config.application_name %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | <%= stylesheet_link_tag 'application' %> 18 | <%= stylesheet_link_tag "http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" %> 19 | <%= stylesheet_link_tag "http://cdnjs.cloudflare.com/ajax/libs/chosen/1.0/chosen.min.css" %> 20 | <%= stylesheet_link_tag 'http://fonts.googleapis.com/css?family=Raleway:400,700' %> 21 | <%= stylesheet_link_tag 'http://fonts.googleapis.com/css?family=Lato' %> 22 | 23 | <%= favicon_link_tag '/assets/favicon.ico' %> 24 | 25 | 26 | 27 | 28 | 29 | <%= javascript_include_tag 'application.js', :async => true %> 30 | <%= javascript_include_tag 'http://cdnjs.cloudflare.com/ajax/libs/chosen/1.1.0/chosen.jquery.min.js', :async => true %> 31 | 32 | 33 | 39 | 40 | <%= csrf_meta_tag %> 41 | 42 | 43 | 44 | 45 | 66 | 67 | <% if @condition_bill_header %> 68 | 69 | <%= render :partial => "bill_header"%> 70 | <% end %> 71 | 72 |
73 | 74 |
75 |
76 | <% flash.each do |name, msg| %> 77 |
78 | 79 | <%= content_tag :div, msg, :id => "flash_#{name}" %> 80 |
81 | <% end %> 82 |
83 |
84 | 85 | 86 | <%= yield %> 87 | 88 | 89 |
90 | 91 |
92 | 93 | 94 | 119 | 120 | 121 | 122 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /app/views/motions/_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_for @motion do |f| 2 | - if @motion.errors.any? 3 | #error_explanation 4 | %h2= "#{pluralize(@motion.errors.count, "error")} prohibited this motion from being saved:" 5 | %ul 6 | - @motion.errors.full_messages.each do |msg| 7 | %li= msg 8 | 9 | .field 10 | = f.label :organization 11 | = f.text_field :organization 12 | .field 13 | = f.label :context 14 | = f.text_field :context 15 | .field 16 | = f.label :creator 17 | = f.text_field :creator 18 | .field 19 | = f.label :text 20 | = f.text_field :text 21 | .field 22 | = f.label :date 23 | = f.datetime_select :date 24 | .field 25 | = f.label :requirement 26 | = f.text_field :requirement 27 | .field 28 | = f.label :result 29 | = f.text_field :result 30 | .field 31 | = f.label :session 32 | = f.text_field :session 33 | .actions 34 | = f.submit 'Save' 35 | -------------------------------------------------------------------------------- /app/views/motions/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Editing motion 2 | 3 | = render 'form' 4 | 5 | = link_to 'Show', @motion 6 | \| 7 | = link_to 'Back', motions_path 8 | -------------------------------------------------------------------------------- /app/views/motions/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Listing motions 2 | 3 | %table 4 | %tr 5 | %th Organization 6 | %th Context 7 | %th Creator 8 | %th Text 9 | %th Date 10 | %th Requirement 11 | %th Result 12 | %th Session 13 | %th 14 | %th 15 | %th 16 | 17 | - @motions.each do |motion| 18 | %tr 19 | %td= motion.organization 20 | %td= motion.context 21 | %td= motion.creator 22 | %td= motion.text 23 | %td= motion.date 24 | %td= motion.requirement 25 | %td= motion.result 26 | %td= motion.session 27 | %td= link_to 'Show', motion 28 | %td= link_to 'Edit', edit_motion_path(motion) 29 | %td= link_to 'Destroy', motion, :method => :delete, :data => { :confirm => 'Are you sure?' } 30 | 31 | %br 32 | 33 | = link_to 'New Motion', new_motion_path 34 | -------------------------------------------------------------------------------- /app/views/motions/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1 New motion 2 | 3 | = render 'form' 4 | 5 | = link_to 'Back', motions_path 6 | -------------------------------------------------------------------------------- /app/views/motions/show.html.haml: -------------------------------------------------------------------------------- 1 | %p#notice= notice 2 | 3 | %p 4 | %b Organization: 5 | = @motion.organization 6 | %p 7 | %b Context: 8 | = @motion.context 9 | %p 10 | %b Creator: 11 | = @motion.creator 12 | %p 13 | %b Text: 14 | = @motion.text 15 | %p 16 | %b Date: 17 | = @motion.date 18 | %p 19 | %b Requirement: 20 | = @motion.requirement 21 | %p 22 | %b Result: 23 | = @motion.result 24 | %p 25 | %b Session: 26 | = @motion.session 27 | 28 | = link_to 'Edit', edit_motion_path(@motion) 29 | \| 30 | = link_to 'Back', motions_path 31 | -------------------------------------------------------------------------------- /app/views/vote_events/_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_for @vote_event do |f| 2 | - if @vote_event.errors.any? 3 | #error_explanation 4 | %h2= "#{pluralize(@vote_event.errors.count, "error")} prohibited this vote_event from being saved:" 5 | %ul 6 | - @vote_event.errors.full_messages.each do |msg| 7 | %li= msg 8 | 9 | .field 10 | = f.label :start_date 11 | = f.datetime_select :start_date 12 | .field 13 | = f.label :end_date 14 | = f.datetime_select :end_date 15 | .actions 16 | = f.submit 'Save' 17 | -------------------------------------------------------------------------------- /app/views/vote_events/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Editing vote_event 2 | 3 | = render 'form' 4 | 5 | = link_to 'Show', @vote_event 6 | \| 7 | = link_to 'Back', vote_events_path 8 | -------------------------------------------------------------------------------- /app/views/vote_events/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Listing vote_events 2 | 3 | %table 4 | %tr 5 | %th Startdate 6 | %th Enddate 7 | %th 8 | %th 9 | %th 10 | 11 | - @vote_events.each do |vote_event| 12 | %tr 13 | %td= vote_event.start_date 14 | %td= vote_event.end_date 15 | %td= link_to 'Show', vote_event 16 | %td= link_to 'Edit', edit_vote_event_path(vote_event) 17 | %td= link_to 'Destroy', vote_event, :method => :delete, :data => { :confirm => 'Are you sure?' } 18 | 19 | %br 20 | 21 | = link_to 'New Vote event', new_vote_event_path 22 | -------------------------------------------------------------------------------- /app/views/vote_events/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1 New vote_event 2 | 3 | = render 'form' 4 | 5 | = link_to 'Back', vote_events_path 6 | -------------------------------------------------------------------------------- /app/views/vote_events/show.html.haml: -------------------------------------------------------------------------------- 1 | %p#notice= notice 2 | 3 | %p 4 | %b Startdate: 5 | = @vote_event.start_date 6 | %p 7 | %b Enddate: 8 | = @vote_event.end_date 9 | 10 | = link_to 'Edit', edit_vote_event_path(@vote_event) 11 | \| 12 | = link_to 'Back', vote_events_path 13 | -------------------------------------------------------------------------------- /app/views/votes/_form.html.haml: -------------------------------------------------------------------------------- 1 | = form_for @vote do |f| 2 | - if @vote.errors.any? 3 | #error_explanation 4 | %h2= "#{pluralize(@vote.errors.count, "error")} prohibited this vote from being saved:" 5 | %ul 6 | - @vote.errors.full_messages.each do |msg| 7 | %li= msg 8 | 9 | .field 10 | = f.label :voter_id 11 | = f.text_field :voter_id 12 | .field 13 | = f.label :option 14 | = f.text_field :option 15 | .actions 16 | = f.submit 'Save' 17 | -------------------------------------------------------------------------------- /app/views/votes/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Editing vote 2 | 3 | = render 'form' 4 | 5 | = link_to 'Show', @vote 6 | \| 7 | = link_to 'Back', votes_path 8 | -------------------------------------------------------------------------------- /app/views/votes/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Listing votes 2 | 3 | %table 4 | %tr 5 | %th Voter 6 | %th Option 7 | %th 8 | %th 9 | %th 10 | 11 | - @votes.each do |vote| 12 | %tr 13 | %td= vote.voter_id 14 | %td= vote.option 15 | %td= link_to 'Show', vote 16 | %td= link_to 'Edit', edit_vote_path(vote) 17 | %td= link_to 'Destroy', vote, :method => :delete, :data => { :confirm => 'Are you sure?' } 18 | 19 | %br 20 | 21 | = link_to 'New Vote', new_vote_path 22 | -------------------------------------------------------------------------------- /app/views/votes/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1 New vote 2 | 3 | = render 'form' 4 | 5 | = link_to 'Back', votes_path 6 | -------------------------------------------------------------------------------- /app/views/votes/show.html.haml: -------------------------------------------------------------------------------- 1 | %p#notice= notice 2 | 3 | %p 4 | %b Voter: 5 | = @vote.voter_id 6 | %p 7 | %b Option: 8 | = @vote.option 9 | 10 | = link_to 'Edit', edit_vote_path(@vote) 11 | \| 12 | = link_to 'Back', votes_path 13 | -------------------------------------------------------------------------------- /config.ru.example: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run BillIt::Application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | # require "active_record/railtie" 5 | require "action_controller/railtie" 6 | require "action_mailer/railtie" 7 | require "active_resource/railtie" 8 | require "sprockets/railtie" 9 | require "rails/test_unit/railtie" 10 | 11 | if defined?(Bundler) 12 | # If you precompile assets before deploying to production, use this line 13 | Bundler.require(*Rails.groups(:assets => %w(development test))) 14 | # If you want your assets lazily compiled in production, use this line 15 | # Bundler.require(:default, :assets, Rails.env) 16 | end 17 | 18 | # Load application ENV vars and merge with existing ENV vars. Loaded here so can use values in initializers. 19 | ENV.update YAML.load_file('config/hateoas.yml')[Rails.env] rescue {} 20 | 21 | 22 | module BillIt 23 | class Application < Rails::Application 24 | # Settings in config/environments/* take precedence over those specified here. 25 | # Application configuration should go into files in config/initializers 26 | # -- all .rb files in that directory are automatically loaded. 27 | 28 | # Custom directories with classes and modules you want to be autoloadable. 29 | # config.autoload_paths += %W(#{config.root}/extras) 30 | config.autoload_paths += %W(#{Rails.root}/app/models/billit) 31 | 32 | # Only load the plugins named here, in the order given (default is alphabetical). 33 | # :all can be used as a placeholder for all plugins not explicitly named. 34 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 35 | 36 | # Activate observers that should always be running. 37 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 38 | 39 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 40 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 41 | # config.time_zone = 'Central Time (US & Canada)' 42 | 43 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 44 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 45 | # config.i18n.default_locale = :de 46 | 47 | # Configure the default encoding used in templates for Ruby 1.9. 48 | config.encoding = "utf-8" 49 | 50 | # Configure sensitive parameters which will be filtered from the log file. 51 | config.filter_parameters += [:password] 52 | 53 | # Enable escaping HTML in JSON. 54 | config.active_support.escape_html_entities_in_json = true 55 | 56 | # Use SQL instead of Active Record's schema dumper when creating the database. 57 | # This is necessary if your schema can't be completely dumped by the schema dumper, 58 | # like if you have constraints or database-specific column types 59 | # config.active_record.schema_format = :sql 60 | 61 | # Enforce whitelist mode for mass assignment. 62 | # This will create an empty whitelist of attributes available for mass-assignment for all models 63 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible 64 | # parameters by using an attr_accessible or attr_protected declaration. 65 | # config.active_record.whitelist_attributes = true 66 | 67 | # Enable the asset pipeline 68 | config.assets.enabled = true 69 | 70 | # Version of your assets, change this if you want to expire all your assets 71 | config.assets.version = '1.0' 72 | 73 | config.generators do |g| 74 | g.orm :mongoid 75 | g.template_engine :haml 76 | g.test_framework :rspec, 77 | :fixtures => true, 78 | :view_specs => false, 79 | :helper_specs => false, 80 | :routing_specs => false, 81 | :controller_specs => true, 82 | :request_specs => true 83 | g.fixture_replacement :factory_girl, :dir => "spec/factories" 84 | g.integration_tool nil 85 | g.performance_tool nil 86 | end 87 | 88 | # Application name 89 | config.application_name = "Bill-it" 90 | end 91 | end 92 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | BillIt::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | BillIt::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger 20 | config.active_support.deprecation = :log 21 | 22 | # Only use best-standards-support built into browsers 23 | config.action_dispatch.best_standards_support = :builtin 24 | 25 | 26 | # Do not compress assets 27 | config.assets.compress = false 28 | 29 | # Expands the lines which load the assets 30 | config.assets.debug = true 31 | 32 | #Representers 33 | config.representer.default_url_options = {:host => ENV['root_url']} 34 | 35 | #ActiveAdmin 36 | config.action_mailer.default_url_options = { host: 'localhost:3000' } 37 | 38 | # Limit log disk space 39 | config.logger = Logger.new("log/#{Rails.env}.log", 1, ENV['log_size_limit']) 40 | end 41 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | BillIt::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Full error reports are disabled and caching is turned on 8 | config.consider_all_requests_local = false 9 | config.action_controller.perform_caching = true 10 | 11 | # Disable Rails's static asset server (Apache or nginx will already do this) 12 | config.serve_static_assets = false 13 | 14 | # Compress JavaScripts and CSS 15 | config.assets.compress = true 16 | 17 | # Don't fallback to assets pipeline if a precompiled asset is missed 18 | config.assets.compile = true 19 | 20 | # Generate digests for assets URLs 21 | config.assets.digest = true 22 | 23 | # Defaults to nil and saved in location specified by config.assets.prefix 24 | # config.assets.manifest = YOUR_PATH 25 | 26 | # Specifies the header that your server uses for sending files 27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 29 | 30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 31 | # config.force_ssl = true 32 | 33 | # See everything in the log (default is :info) 34 | config.log_level = :error 35 | 36 | # Prepend all log lines with the following tags 37 | # config.log_tags = [ :subdomain, :uuid ] 38 | 39 | # Use a different logger for distributed setups 40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 41 | 42 | # Use a different cache store in production 43 | # config.cache_store = :mem_cache_store 44 | 45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 46 | # config.action_controller.asset_host = "http://assets.example.com" 47 | 48 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 49 | # config.assets.precompile += %w( search.js ) 50 | 51 | # Disable delivery errors, bad email addresses will be ignored 52 | # config.action_mailer.raise_delivery_errors = false 53 | 54 | # Enable threaded mode 55 | # config.threadsafe! 56 | 57 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 58 | # the I18n.default_locale when a translation can not be found) 59 | config.i18n.fallbacks = true 60 | 61 | # Send deprecation notices to registered listeners 62 | config.active_support.deprecation = :notify 63 | 64 | # Representers 65 | config.representer.default_url_options = {:host => ENV['root_url']} 66 | 67 | # Limit log disk space 68 | config.logger = Logger.new("log/#{Rails.env}.log", 1, ENV['log_size_limit']) 69 | end 70 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | BillIt::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | config.action_mailer.delivery_method = :test 31 | 32 | 33 | # Print deprecation notices to the stderr 34 | config.active_support.deprecation = :stderr 35 | 36 | #Representers 37 | config.representer.default_url_options = {:host => ENV['root_url']} 38 | end 39 | -------------------------------------------------------------------------------- /config/hateoas.yml.example: -------------------------------------------------------------------------------- 1 | production: 2 | root_url: "production.site.org" 3 | development: 4 | root_url: "development.site.org" 5 | test: 6 | root_url: "test.site.org" -------------------------------------------------------------------------------- /config/holidays.yml: -------------------------------------------------------------------------------- 1 | 2014: 2 | Año_Nuevo: 2014/01/01 3 | Viernes_Santo: 2014/04/18 4 | Sábado_Santo: 2014/04/19 5 | Día_Nacional_del_Trabajo: 2014/05/01 6 | Día_de_las_Glorias_Navales: 2014/05/21 7 | San_Pedro_y_San_Pablo: 2014/06/29 8 | Día_de_la_Virgen_del_Carmen: 2014/08/15 9 | Independencia_Nacional: 2014/09/18 10 | Día_de_las_Glorias_del_Ejército: 2014/09/19 11 | Encuentro_de_Dos_Mundos: 2014/10/12 12 | Día_de_las_Iglesias_Evangélicas_y_Protestantes: 2014/10/31 13 | Día_de_Todos_los_Santos: 2014/11/01 14 | Inmaculada_Concepción: 2014/12/08 15 | Navidad: 2014/12/25 16 | 2015: 17 | Año_Nuevo: 2015/01/01 18 | Viernes_Santo: 2015/04/03 19 | Sábado_Santo: 2015/04/04 20 | Día_Nacional_del_Trabajo: 2015/05/01 21 | Día_de_las_Glorias_Navales: 2015/05/21 22 | San_Pedro_y_San_Pablo: 2015/06/29 23 | Día_de_la_Virgen_del_Carmen: 2015/08/15 24 | Independencia_Nacional: 2015/09/18 25 | Día_de_las_Glorias_del_Ejército: 2015/09/19 26 | Encuentro_de_Dos_Mundos: 2015/10/12 27 | Día_de_las_Iglesias_Evangélicas_y_Protestantes: 2015/10/31 28 | Día_de_Todos_los_Santos: 2015/11/01 29 | Inmaculada_Concepción: 2015/12/08 30 | Navidad: 2015/12/25 -------------------------------------------------------------------------------- /config/initializers/active_admin.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.setup do |config| 2 | 3 | # == Site Title 4 | # 5 | # Set the title that is displayed on the main layout 6 | # for each of the active admin pages. 7 | # 8 | config.site_title = "Bill It" 9 | 10 | # Set the link url for the title. For example, to take 11 | # users to your main site. Defaults to no link. 12 | # 13 | # config.site_title_link = "/" 14 | 15 | # Set an optional image to be displayed for the header 16 | # instead of a string (overrides :site_title) 17 | # 18 | # Note: Recommended image height is 21px to properly fit in the header 19 | # 20 | # config.site_title_image = "/images/logo.png" 21 | 22 | # == Default Namespace 23 | # 24 | # Set the default namespace each administration resource 25 | # will be added to. 26 | # 27 | # eg: 28 | # config.default_namespace = :hello_world 29 | # 30 | # This will create resources in the HelloWorld module and 31 | # will namespace routes to /hello_world/* 32 | # 33 | # To set no namespace by default, use: 34 | # config.default_namespace = false 35 | # 36 | # Default: 37 | # config.default_namespace = :admin 38 | # 39 | # You can customize the settings for each namespace by using 40 | # a namespace block. For example, to change the site title 41 | # within a namespace: 42 | # 43 | # config.namespace :admin do |admin| 44 | # admin.site_title = "Custom Admin Title" 45 | # end 46 | # 47 | # This will ONLY change the title for the admin section. Other 48 | # namespaces will continue to use the main "site_title" configuration. 49 | 50 | # == User Authentication 51 | # 52 | # Active Admin will automatically call an authentication 53 | # method in a before filter of all controller actions to 54 | # ensure that there is a currently logged in admin user. 55 | # 56 | # This setting changes the method which Active Admin calls 57 | # within the controller. 58 | config.authentication_method = :authenticate_admin_user! 59 | 60 | # == User Authorization 61 | # 62 | # Active Admin will automatically call an authorization 63 | # method in a before filter of all controller actions to 64 | # ensure that there is a user with proper rights. You can use 65 | # CanCanAdapter or make your own. Please refer to documentation. 66 | # config.authorization_adapter = ActiveAdmin::CanCanAdapter 67 | 68 | # You can customize your CanCan Ability class name here. 69 | # config.cancan_ability_class = "Ability" 70 | 71 | # You can specify a method to be called on unauthorized access. 72 | # This is necessary in order to prevent a redirect loop which happens 73 | # because, by default, user gets redirected to Dashboard. If user 74 | # doesn't have access to Dashboard, he'll end up in a redirect loop. 75 | # Method provided here should be defined in application_controller.rb. 76 | # config.on_unauthorized_access = :access_denied 77 | 78 | # == Current User 79 | # 80 | # Active Admin will associate actions with the current 81 | # user performing them. 82 | # 83 | # This setting changes the method which Active Admin calls 84 | # to return the currently logged in user. 85 | config.current_user_method = :current_admin_user 86 | 87 | 88 | # == Logging Out 89 | # 90 | # Active Admin displays a logout link on each screen. These 91 | # settings configure the location and method used for the link. 92 | # 93 | # This setting changes the path where the link points to. If it's 94 | # a string, the strings is used as the path. If it's a Symbol, we 95 | # will call the method to return the path. 96 | # 97 | # Default: 98 | config.logout_link_path = :destroy_admin_user_session_path 99 | 100 | # This setting changes the http method used when rendering the 101 | # link. For example :get, :delete, :put, etc.. 102 | # 103 | # Default: 104 | # config.logout_link_method = :get 105 | 106 | 107 | # == Root 108 | # 109 | # Set the action to call for the root path. You can set different 110 | # roots for each namespace. 111 | # 112 | # Default: 113 | # config.root_to = 'dashboard#index' 114 | 115 | 116 | # == Admin Comments 117 | # 118 | # This allows your users to comment on any resource registered with Active Admin. 119 | # 120 | # You can completely disable comments: 121 | # config.allow_comments = false 122 | # 123 | # You can disable the menu item for the comments index page: 124 | # config.show_comments_in_menu = false 125 | # 126 | # You can change the name under which comments are registered: 127 | # config.comments_registration_name = 'AdminComment' 128 | 129 | 130 | # == Batch Actions 131 | # 132 | # Enable and disable Batch Actions 133 | # 134 | config.batch_actions = true 135 | 136 | 137 | # == Controller Filters 138 | # 139 | # You can add before, after and around filters to all of your 140 | # Active Admin resources and pages from here. 141 | # 142 | # config.before_filter :do_something_awesome 143 | 144 | 145 | # == Setting a Favicon 146 | # 147 | # config.favicon = '/assets/favicon.ico' 148 | 149 | 150 | # == Register Stylesheets & Javascripts 151 | # 152 | # We recommend using the built in Active Admin layout and loading 153 | # up your own stylesheets / javascripts to customize the look 154 | # and feel. 155 | # 156 | # To load a stylesheet: 157 | # config.register_stylesheet 'my_stylesheet.css' 158 | # 159 | # You can provide an options hash for more control, which is passed along to stylesheet_link_tag(): 160 | # config.register_stylesheet 'my_print_stylesheet.css', :media => :print 161 | # 162 | # To load a javascript file: 163 | # config.register_javascript 'my_javascript.js' 164 | 165 | 166 | # == CSV options 167 | # 168 | # Set the CSV builder separator 169 | # config.csv_options = { :col_sep => ';' } 170 | # 171 | # Force the use of quotes 172 | # config.csv_options = { :force_quotes => true } 173 | 174 | 175 | # == Menu System 176 | # 177 | # You can add a navigation menu to be used in your application, or configure a provided menu 178 | # 179 | # To change the default utility navigation to show a link to your website & a logout btn 180 | # 181 | # config.namespace :admin do |admin| 182 | # admin.build_menu :utility_navigation do |menu| 183 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } 184 | # admin.add_logout_button_to_menu menu 185 | # end 186 | # end 187 | # 188 | # If you wanted to add a static menu item to the default menu provided: 189 | # 190 | # config.namespace :admin do |admin| 191 | # admin.build_menu :default do |menu| 192 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } 193 | # end 194 | # end 195 | 196 | 197 | # == Download Links 198 | # 199 | # You can disable download links on resource listing pages, 200 | # or customize the formats shown per namespace/globally 201 | # 202 | # To disable/customize for the :admin namespace: 203 | # 204 | # config.namespace :admin do |admin| 205 | # 206 | # # Disable the links entirely 207 | # admin.download_links = false 208 | # 209 | # # Only show XML & PDF options 210 | # admin.download_links = [:xml, :pdf] 211 | # 212 | # end 213 | 214 | 215 | # == Pagination 216 | # 217 | # Pagination is enabled by default for all resources. 218 | # You can control the default per page count for all resources here. 219 | # 220 | # config.default_per_page = 30 221 | 222 | 223 | # == Filters 224 | # 225 | # By default the index screen includes a “Filters” sidebar on the right 226 | # hand side with a filter for each attribute of the registered model. 227 | # You can enable or disable them for all resources here. 228 | # 229 | # config.filters = true 230 | 231 | end 232 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/holidays.rb: -------------------------------------------------------------------------------- 1 | all_holidays = YAML.load_file("#{Rails.root}/config/holidays.yml") 2 | all_holidays.values.each do |year| 3 | year.values.each do |holiday| 4 | BusinessTime::Config.holidays << holiday.to_date 5 | end 6 | end -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /config/initializers/load_hateoas.rb: -------------------------------------------------------------------------------- 1 | HATEOAS = YAML.load_file("#{Rails.root}/config/hateoas.yml")[Rails.env] -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | BillIt::Application.config.secret_token = '75cc973db60d3e07beaa1630c4cb37ded228e5bb71853be068a573b1a2ee385379111f9b12847b285a7e2c2b2f918b2902f4edb04046319cf41148a642fa53d3' 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | BillIt::Application.config.session_store :cookie_store, key: '_bill-it_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # BillIt::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your account was successfully confirmed." 7 | send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid email or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account will be locked." 15 | not_found_in_database: "Invalid email or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your account before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock Instructions" 26 | omniauth_callbacks: 27 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 28 | success: "Successfully authenticated from %{kind} account." 29 | passwords: 30 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 31 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 32 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 33 | updated: "Your password was changed successfully. You are now signed in." 34 | updated_not_active: "Your password was changed successfully." 35 | registrations: 36 | destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon." 37 | signed_up: "Welcome! You have signed up successfully." 38 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 39 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 40 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account." 41 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." 42 | updated: "You updated your account successfully." 43 | sessions: 44 | signed_in: "Signed in successfully." 45 | signed_out: "Signed out successfully." 46 | unlocks: 47 | send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes." 48 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes." 49 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 50 | errors: 51 | messages: 52 | already_confirmed: "was already confirmed, please try signing in" 53 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 54 | expired: "has expired, please request a new one" 55 | not_found: "not found" 56 | not_locked: "was not locked" 57 | not_saved: 58 | one: "1 error prohibited this %{resource} from being saved:" 59 | other: "%{count} errors prohibited this %{resource} from being saved:" 60 | -------------------------------------------------------------------------------- /config/locales/transliterate_special.yml: -------------------------------------------------------------------------------- 1 | transliterate_special: 2 | i18n: 3 | transliterate: 4 | rule: 5 | ñ: "ñ" 6 | Ñ: "ñ" -------------------------------------------------------------------------------- /config/log.yml.example: -------------------------------------------------------------------------------- 1 | production: 2 | log_size_limit: 5.megabytes 3 | development: 4 | log_size_limit: 5.megabytes 5 | test: 6 | log_size_limit: 5.megabytes -------------------------------------------------------------------------------- /config/mongoid.yml.example: -------------------------------------------------------------------------------- 1 | development: 2 | # Configure available database sessions. (required) 3 | sessions: 4 | # Defines the default session. (required) 5 | default: 6 | # Defines the name of the default database that Mongoid can connect to. 7 | # (required). 8 | database: bill_it_development 9 | # Provides the hosts the default session can connect to. Must be an array 10 | # of host:port pairs. (required) 11 | hosts: 12 | - localhost:27017 13 | options: 14 | # Change whether the session persists in safe mode by default. 15 | # (default: false) 16 | # safe: false 17 | 18 | # Change the default consistency model to :eventual or :strong. 19 | # :eventual will send reads to secondaries, :strong sends everything 20 | # to master. (default: :eventual) 21 | # consistency: :eventual 22 | 23 | # How many times Moped should attempt to retry an operation after 24 | # failure. (default: 30) 25 | # max_retries: 30 26 | 27 | # The time in seconds that Moped should wait before retrying an 28 | # operation on failure. (default: 1) 29 | # retry_interval: 1 30 | # Configure Mongoid specific options. (optional) 31 | options: 32 | raise_not_found_error: false 33 | # Configuration for whether or not to allow access to fields that do 34 | # not have a field definition on the model. (default: true) 35 | # allow_dynamic_fields: true 36 | 37 | # Enable the identity map, needed for eager loading. (default: false) 38 | # identity_map_enabled: false 39 | 40 | # Includes the root model name in json serialization. (default: false) 41 | # include_root_in_json: false 42 | 43 | # Include the _type field in serializaion. (default: false) 44 | # include_type_for_serialization: false 45 | 46 | # Preload all models in development, needed when models use 47 | # inheritance. (default: false) 48 | # preload_models: false 49 | 50 | # Protect id and type from mass assignment. (default: true) 51 | # protect_sensitive_fields: true 52 | 53 | # Raise an error when performing a #find and the document is not found. 54 | # (default: true) 55 | # raise_not_found_error: true 56 | 57 | # Raise an error when defining a scope with the same name as an 58 | # existing method. (default: false) 59 | # scope_overwrite_exception: false 60 | 61 | # Skip the database version check, used when connecting to a db without 62 | # admin access. (default: false) 63 | # skip_version_check: false 64 | 65 | # User Active Support's time zone in conversions. (default: true) 66 | # use_activesupport_time_zone: true 67 | 68 | # Ensure all times are UTC in the app side. (default: false) 69 | # use_utc: false 70 | test: 71 | sessions: 72 | default: 73 | database: bill_it_test 74 | hosts: 75 | - localhost:27017 76 | options: 77 | consistency: :strong 78 | # In the test environment we lower the retries and retry interval to 79 | # low amounts for fast failures. 80 | max_retries: 1 81 | retry_interval: 0 82 | options: 83 | raise_not_found_error: false -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | BillIt::Application.routes.draw do 2 | 3 | resources :votes 4 | 5 | 6 | resources :counts 7 | 8 | 9 | resources :vote_events 10 | 11 | 12 | resources :motions 13 | 14 | 15 | devise_for :admin_users, ActiveAdmin::Devise.config 16 | ActiveAdmin.routes(self) 17 | 18 | root :to => "bills#index" 19 | 20 | resources :paperworks do 21 | get 'search', on: :collection 22 | end 23 | 24 | resources :bills do 25 | get 'feed', on: :member 26 | get 'search', on: :collection 27 | get 'last_update', on: :collection 28 | end 29 | end -------------------------------------------------------------------------------- /config/schedule.rb.example: -------------------------------------------------------------------------------- 1 | # Use this file to easily define all of your cron jobs. 2 | # 3 | # It's helpful, but not entirely necessary to understand cron before proceeding. 4 | # http://en.wikipedia.org/wiki/Cron 5 | 6 | set :output, 'log/cron.log' 7 | 8 | every :day, :at => '12:00am' do 9 | runner 'Bill.update_priority' 10 | end 11 | 12 | # Learn more: http://github.com/javan/whenever 13 | -------------------------------------------------------------------------------- /config/sunspot.yml.example: -------------------------------------------------------------------------------- 1 | production: 2 | solr: 3 | hostname: localhost 4 | port: 8983 5 | log_level: WARNING 6 | # read_timeout: 2 7 | # open_timeout: 0.5 8 | 9 | development: 10 | solr: 11 | hostname: localhost 12 | port: 8983 13 | log_level: INFO 14 | 15 | test: 16 | solr: 17 | hostname: localhost 18 | port: 8983 19 | log_level: WARNING 20 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/lib/assets/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/sunspot_mongoid.rake: -------------------------------------------------------------------------------- 1 | # auto load rails tasks 2 | require 'sunspot/rails/tasks' 3 | 4 | # hack to remove 'sunspot:reindex' task and add our own 5 | Rake::TaskManager.class_eval do 6 | def remove_task(task_name) 7 | @tasks.delete(task_name.to_s) 8 | end 9 | end 10 | 11 | Rake.application.remove_task('sunspot:reindex') 12 | 13 | # override the tasks that depends on active record 14 | namespace :sunspot do 15 | 16 | desc "Reindex all solr models that are located in your application's models directory. (Batch size ignored)" 17 | # This task depends on the standard Rails file naming \ 18 | # conventions, in that the file name matches the defined class name. \ 19 | # By default the indexing system works in batches of 50 records, you can \ 20 | # set your own value for this by using the batch_size argument. You can \ 21 | # also optionally define a list of models to separated by a forward slash '/' 22 | # 23 | # $ rake sunspot:reindex # reindex all models 24 | # $ rake sunspot:reindex[1000] # reindex in batches of 1000 25 | # $ rake sunspot:reindex[false] # reindex without batching 26 | # $ rake sunspot:reindex[,Post] # reindex only the Post model 27 | # $ rake sunspot:reindex[1000,Post] # reindex only the Post model in 28 | # # batchs of 1000 29 | # $ rake sunspot:reindex[,Post+Author] # reindex Post and Author model 30 | task :reindex, [:batch_size, :models] => [:environment] do |t, args| 31 | unless args[:models] 32 | all_files = Dir.glob(Rails.root.join('app', 'models', '*.rb')) 33 | all_models = all_files.map { |path| File.basename(path, '.rb').camelize.constantize } 34 | sunspot_models = all_models.select { |m| m.respond_to?(:searchable?) and m.searchable? } 35 | else 36 | sunspot_models = args[:models].split('+').map{|m| m.constantize} 37 | end 38 | sunspot_models.each do |model| 39 | puts "Re-indexing #{model.name}" 40 | bar = ProgressBar.new(model.count) 41 | Sunspot.remove_all(model) 42 | model.each do |element| 43 | Sunspot.index!(element) 44 | bar.increment! 45 | end 46 | end 47 | end 48 | end -------------------------------------------------------------------------------- /log/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

You may have mistyped the address or the page may have moved.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

Maybe you tried to change something you didn't have access to.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-Agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /script/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. 3 | 4 | APP_PATH = File.expand_path('../../config/application', __FILE__) 5 | require File.expand_path('../../config/boot', __FILE__) 6 | require 'rails/commands' 7 | -------------------------------------------------------------------------------- /solr/conf/admin-extra.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 32 | -------------------------------------------------------------------------------- /solr/conf/elevate.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /solr/conf/mapping-ISOLatin1Accent.txt: -------------------------------------------------------------------------------- 1 | # The ASF licenses this file to You under the Apache License, Version 2.0 2 | # (the "License"); you may not use this file except in compliance with 3 | # the License. You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | # Syntax: 14 | # "source" => "target" 15 | # "source".length() > 0 (source cannot be empty.) 16 | # "target".length() >= 0 (target can be empty.) 17 | 18 | # example: 19 | # "À" => "A" 20 | # "\u00C0" => "A" 21 | # "\u00C0" => "\u0041" 22 | # "ß" => "ss" 23 | # "\t" => " " 24 | # "\n" => "" 25 | 26 | # À => A 27 | "\u00C0" => "A" 28 | 29 | # Á => A 30 | "\u00C1" => "A" 31 | 32 | #  => A 33 | "\u00C2" => "A" 34 | 35 | # à => A 36 | "\u00C3" => "A" 37 | 38 | # Ä => A 39 | "\u00C4" => "A" 40 | 41 | # Å => A 42 | "\u00C5" => "A" 43 | 44 | # Æ => AE 45 | "\u00C6" => "AE" 46 | 47 | # Ç => C 48 | "\u00C7" => "C" 49 | 50 | # È => E 51 | "\u00C8" => "E" 52 | 53 | # É => E 54 | "\u00C9" => "E" 55 | 56 | # Ê => E 57 | "\u00CA" => "E" 58 | 59 | # Ë => E 60 | "\u00CB" => "E" 61 | 62 | # Ì => I 63 | "\u00CC" => "I" 64 | 65 | # Í => I 66 | "\u00CD" => "I" 67 | 68 | # Î => I 69 | "\u00CE" => "I" 70 | 71 | # Ï => I 72 | "\u00CF" => "I" 73 | 74 | # IJ => IJ 75 | "\u0132" => "IJ" 76 | 77 | # Ð => D 78 | "\u00D0" => "D" 79 | 80 | # Ñ => N 81 | "\u00D1" => "N" 82 | 83 | # Ò => O 84 | "\u00D2" => "O" 85 | 86 | # Ó => O 87 | "\u00D3" => "O" 88 | 89 | # Ô => O 90 | "\u00D4" => "O" 91 | 92 | # Õ => O 93 | "\u00D5" => "O" 94 | 95 | # Ö => O 96 | "\u00D6" => "O" 97 | 98 | # Ø => O 99 | "\u00D8" => "O" 100 | 101 | # Œ => OE 102 | "\u0152" => "OE" 103 | 104 | # Þ 105 | "\u00DE" => "TH" 106 | 107 | # Ù => U 108 | "\u00D9" => "U" 109 | 110 | # Ú => U 111 | "\u00DA" => "U" 112 | 113 | # Û => U 114 | "\u00DB" => "U" 115 | 116 | # Ü => U 117 | "\u00DC" => "U" 118 | 119 | # Ý => Y 120 | "\u00DD" => "Y" 121 | 122 | # Ÿ => Y 123 | "\u0178" => "Y" 124 | 125 | # à => a 126 | "\u00E0" => "a" 127 | 128 | # á => a 129 | "\u00E1" => "a" 130 | 131 | # â => a 132 | "\u00E2" => "a" 133 | 134 | # ã => a 135 | "\u00E3" => "a" 136 | 137 | # ä => a 138 | "\u00E4" => "a" 139 | 140 | # å => a 141 | "\u00E5" => "a" 142 | 143 | # æ => ae 144 | "\u00E6" => "ae" 145 | 146 | # ç => c 147 | "\u00E7" => "c" 148 | 149 | # è => e 150 | "\u00E8" => "e" 151 | 152 | # é => e 153 | "\u00E9" => "e" 154 | 155 | # ê => e 156 | "\u00EA" => "e" 157 | 158 | # ë => e 159 | "\u00EB" => "e" 160 | 161 | # ì => i 162 | "\u00EC" => "i" 163 | 164 | # í => i 165 | "\u00ED" => "i" 166 | 167 | # î => i 168 | "\u00EE" => "i" 169 | 170 | # ï => i 171 | "\u00EF" => "i" 172 | 173 | # ij => ij 174 | "\u0133" => "ij" 175 | 176 | # ð => d 177 | "\u00F0" => "d" 178 | 179 | # ñ => n 180 | "\u00F1" => "n" 181 | 182 | # ò => o 183 | "\u00F2" => "o" 184 | 185 | # ó => o 186 | "\u00F3" => "o" 187 | 188 | # ô => o 189 | "\u00F4" => "o" 190 | 191 | # õ => o 192 | "\u00F5" => "o" 193 | 194 | # ö => o 195 | "\u00F6" => "o" 196 | 197 | # ø => o 198 | "\u00F8" => "o" 199 | 200 | # œ => oe 201 | "\u0153" => "oe" 202 | 203 | # ß => ss 204 | "\u00DF" => "ss" 205 | 206 | # þ => th 207 | "\u00FE" => "th" 208 | 209 | # ù => u 210 | "\u00F9" => "u" 211 | 212 | # ú => u 213 | "\u00FA" => "u" 214 | 215 | # û => u 216 | "\u00FB" => "u" 217 | 218 | # ü => u 219 | "\u00FC" => "u" 220 | 221 | # ý => y 222 | "\u00FD" => "y" 223 | 224 | # ÿ => y 225 | "\u00FF" => "y" 226 | 227 | # ff => ff 228 | "\uFB00" => "ff" 229 | 230 | # fi => fi 231 | "\uFB01" => "fi" 232 | 233 | # fl => fl 234 | "\uFB02" => "fl" 235 | 236 | # ffi => ffi 237 | "\uFB03" => "ffi" 238 | 239 | # ffl => ffl 240 | "\uFB04" => "ffl" 241 | 242 | # ſt => ft 243 | "\uFB05" => "ft" 244 | 245 | # st => st 246 | "\uFB06" => "st" 247 | -------------------------------------------------------------------------------- /solr/conf/protwords.txt: -------------------------------------------------------------------------------- 1 | # The ASF licenses this file to You under the Apache License, Version 2.0 2 | # (the "License"); you may not use this file except in compliance with 3 | # the License. You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | #----------------------------------------------------------------------- 14 | # Use a protected word file to protect against the stemmer reducing two 15 | # unrelated words to the same base word. 16 | 17 | # Some non-words that normally won't be encountered, 18 | # just to test that they won't be stemmed. 19 | dontstems 20 | zwhacky 21 | 22 | -------------------------------------------------------------------------------- /solr/conf/scripts.conf: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | user= 17 | solr_hostname=localhost 18 | solr_port=8983 19 | rsyncd_port=18983 20 | data_dir= 21 | webapp_name=solr 22 | master_host= 23 | master_data_dir= 24 | master_status_dir= 25 | -------------------------------------------------------------------------------- /solr/conf/spellings.txt: -------------------------------------------------------------------------------- 1 | pizza 2 | history -------------------------------------------------------------------------------- /solr/conf/stopwords.txt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | #----------------------------------------------------------------------- 17 | # a couple of test stopwords to test that the words are really being 18 | # configured from this file: 19 | stopworda 20 | stopwordb 21 | 22 | #Standard english stop words taken from Lucene's StopAnalyzer 23 | a 24 | an 25 | and 26 | are 27 | as 28 | at 29 | be 30 | but 31 | by 32 | for 33 | if 34 | in 35 | into 36 | is 37 | it 38 | no 39 | not 40 | of 41 | on 42 | or 43 | s 44 | such 45 | t 46 | that 47 | the 48 | their 49 | then 50 | there 51 | these 52 | they 53 | this 54 | to 55 | was 56 | will 57 | with 58 | 59 | -------------------------------------------------------------------------------- /solr/conf/synonyms.txt: -------------------------------------------------------------------------------- 1 | # The ASF licenses this file to You under the Apache License, Version 2.0 2 | # (the "License"); you may not use this file except in compliance with 3 | # the License. You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | #----------------------------------------------------------------------- 14 | #some test synonym mappings unlikely to appear in real input text 15 | aaa => aaaa 16 | bbb => bbbb1 bbbb2 17 | ccc => cccc1,cccc2 18 | a\=>a => b\=>b 19 | a\,a => b\,b 20 | fooaaa,baraaa,bazaaa 21 | 22 | # Some synonym groups specific to this example 23 | GB,gib,gigabyte,gigabytes 24 | MB,mib,megabyte,megabytes 25 | Television, Televisions, TV, TVs 26 | #notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming 27 | #after us won't split it into two words. 28 | 29 | # Synonym mappings can be used for spelling correction too 30 | pixima => pixma 31 | 32 | -------------------------------------------------------------------------------- /solr/lib/apache-mime4j-core-0.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/apache-mime4j-core-0.7.jar -------------------------------------------------------------------------------- /solr/lib/apache-mime4j-dom-0.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/apache-mime4j-dom-0.7.jar -------------------------------------------------------------------------------- /solr/lib/apache-solr-cell-3.5-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/apache-solr-cell-3.5-SNAPSHOT.jar -------------------------------------------------------------------------------- /solr/lib/asm-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/asm-3.1.jar -------------------------------------------------------------------------------- /solr/lib/bcmail-jdk15-1.45.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/bcmail-jdk15-1.45.jar -------------------------------------------------------------------------------- /solr/lib/bcprov-jdk15-1.45.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/bcprov-jdk15-1.45.jar -------------------------------------------------------------------------------- /solr/lib/boilerpipe-1.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/boilerpipe-1.1.0.jar -------------------------------------------------------------------------------- /solr/lib/commons-compress-1.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/commons-compress-1.2.jar -------------------------------------------------------------------------------- /solr/lib/dom4j-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/dom4j-1.6.1.jar -------------------------------------------------------------------------------- /solr/lib/fontbox-1.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/fontbox-1.6.0.jar -------------------------------------------------------------------------------- /solr/lib/icu4j-4_8_1_1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/icu4j-4_8_1_1.jar -------------------------------------------------------------------------------- /solr/lib/jempbox-1.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/jempbox-1.6.0.jar -------------------------------------------------------------------------------- /solr/lib/metadata-extractor-2.4.0-beta-1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/metadata-extractor-2.4.0-beta-1.jar -------------------------------------------------------------------------------- /solr/lib/netcdf-4.2-min.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/netcdf-4.2-min.jar -------------------------------------------------------------------------------- /solr/lib/pdfbox-1.6.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/pdfbox-1.6.0.jar -------------------------------------------------------------------------------- /solr/lib/poi-3.8-beta4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/poi-3.8-beta4.jar -------------------------------------------------------------------------------- /solr/lib/poi-ooxml-3.8-beta4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/poi-ooxml-3.8-beta4.jar -------------------------------------------------------------------------------- /solr/lib/poi-ooxml-schemas-3.8-beta4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/poi-ooxml-schemas-3.8-beta4.jar -------------------------------------------------------------------------------- /solr/lib/poi-scratchpad-3.8-beta4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/poi-scratchpad-3.8-beta4.jar -------------------------------------------------------------------------------- /solr/lib/rome-0.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/rome-0.9.jar -------------------------------------------------------------------------------- /solr/lib/tagsoup-1.2.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/tagsoup-1.2.1.jar -------------------------------------------------------------------------------- /solr/lib/tika-core-0.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/tika-core-0.10.jar -------------------------------------------------------------------------------- /solr/lib/tika-parsers-0.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/tika-parsers-0.10.jar -------------------------------------------------------------------------------- /solr/lib/xercesImpl-2.8.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/xercesImpl-2.8.1.jar -------------------------------------------------------------------------------- /solr/lib/xml-apis-1.0.b2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/xml-apis-1.0.b2.jar -------------------------------------------------------------------------------- /solr/lib/xmlbeans-2.3.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/solr/lib/xmlbeans-2.3.0.jar -------------------------------------------------------------------------------- /spec/controllers/counts_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # This spec was generated by rspec-rails when you ran the scaffold generator. 4 | # It demonstrates how one might use RSpec to specify the controller code that 5 | # was generated by Rails when you ran the scaffold generator. 6 | # 7 | # It assumes that the implementation code is generated by the rails scaffold 8 | # generator. If you are using any extension libraries to generate different 9 | # controller code, this generated spec may or may not pass. 10 | # 11 | # It only uses APIs available in rails and/or rspec-rails. There are a number 12 | # of tools you can use to make these specs even more expressive, but we're 13 | # sticking to rails and rspec-rails APIs to keep things simple and stable. 14 | # 15 | # Compared to earlier versions of this generator, there is very limited use of 16 | # stubs and message expectations in this spec. Stubs are only used when there 17 | # is no simpler way to get a handle on the object needed for the example. 18 | # Message expectations are only used when there is no simpler way to specify 19 | # that an instance is receiving a specific message. 20 | 21 | describe CountsController, pending: "not clear what methods it should have" do 22 | 23 | # This should return the minimal set of attributes required to create a valid 24 | # Count. As you add validations to Count, be sure to 25 | # adjust the attributes here as well. 26 | let(:valid_attributes) { { "option" => "MyString" } } 27 | 28 | # This should return the minimal set of values that should be in the session 29 | # in order to pass any filters (e.g. authentication) defined in 30 | # CountsController. Be sure to keep this updated too. 31 | let(:valid_session) { {} } 32 | 33 | describe "GET index" do 34 | it "assigns all counts as @counts" do 35 | count = Count.create! valid_attributes 36 | get :index, {}, valid_session 37 | assigns(:counts).should eq([count]) 38 | end 39 | end 40 | 41 | describe "GET show" do 42 | it "assigns the requested count as @count" do 43 | count = Count.create! valid_attributes 44 | get :show, {:id => count.to_param}, valid_session 45 | assigns(:count).should eq(count) 46 | end 47 | end 48 | 49 | describe "GET new" do 50 | it "assigns a new count as @count" do 51 | get :new, {}, valid_session 52 | assigns(:count).should be_a_new(Count) 53 | end 54 | end 55 | 56 | describe "GET edit" do 57 | it "assigns the requested count as @count" do 58 | count = Count.create! valid_attributes 59 | get :edit, {:id => count.to_param}, valid_session 60 | assigns(:count).should eq(count) 61 | end 62 | end 63 | 64 | describe "POST create" do 65 | describe "with valid params" do 66 | it "creates a new Count" do 67 | expect { 68 | post :create, {:count => valid_attributes}, valid_session 69 | }.to change(Count, :count).by(1) 70 | end 71 | 72 | it "assigns a newly created count as @count" do 73 | post :create, {:count => valid_attributes}, valid_session 74 | assigns(:count).should be_a(Count) 75 | assigns(:count).should be_persisted 76 | end 77 | 78 | it "redirects to the created count" do 79 | post :create, {:count => valid_attributes}, valid_session 80 | response.should redirect_to(Count.last) 81 | end 82 | end 83 | 84 | describe "with invalid params" do 85 | it "assigns a newly created but unsaved count as @count" do 86 | # Trigger the behavior that occurs when invalid params are submitted 87 | Count.any_instance.stub(:save).and_return(false) 88 | post :create, {:count => { "option" => "invalid value" }}, valid_session 89 | assigns(:count).should be_a_new(Count) 90 | end 91 | 92 | it "re-renders the 'new' template" do 93 | # Trigger the behavior that occurs when invalid params are submitted 94 | Count.any_instance.stub(:save).and_return(false) 95 | post :create, {:count => { "option" => "invalid value" }}, valid_session 96 | response.should render_template("new") 97 | end 98 | end 99 | end 100 | 101 | describe "PUT update" do 102 | describe "with valid params" do 103 | it "updates the requested count" do 104 | count = Count.create! valid_attributes 105 | # Assuming there are no other counts in the database, this 106 | # specifies that the Count created on the previous line 107 | # receives the :update_attributes message with whatever params are 108 | # submitted in the request. 109 | Count.any_instance.should_receive(:update_attributes).with({ "option" => "MyString" }) 110 | put :update, {:id => count.to_param, :count => { "option" => "MyString" }}, valid_session 111 | end 112 | 113 | it "assigns the requested count as @count" do 114 | count = Count.create! valid_attributes 115 | put :update, {:id => count.to_param, :count => valid_attributes}, valid_session 116 | assigns(:count).should eq(count) 117 | end 118 | 119 | it "redirects to the count" do 120 | count = Count.create! valid_attributes 121 | put :update, {:id => count.to_param, :count => valid_attributes}, valid_session 122 | response.should redirect_to(count) 123 | end 124 | end 125 | 126 | describe "with invalid params" do 127 | it "assigns the count as @count" do 128 | count = Count.create! valid_attributes 129 | # Trigger the behavior that occurs when invalid params are submitted 130 | Count.any_instance.stub(:save).and_return(false) 131 | put :update, {:id => count.to_param, :count => { "option" => "invalid value" }}, valid_session 132 | assigns(:count).should eq(count) 133 | end 134 | 135 | it "re-renders the 'edit' template" do 136 | count = Count.create! valid_attributes 137 | # Trigger the behavior that occurs when invalid params are submitted 138 | Count.any_instance.stub(:save).and_return(false) 139 | put :update, {:id => count.to_param, :count => { "option" => "invalid value" }}, valid_session 140 | response.should render_template("edit") 141 | end 142 | end 143 | end 144 | 145 | describe "DELETE destroy" do 146 | it "destroys the requested count" do 147 | count = Count.create! valid_attributes 148 | expect { 149 | delete :destroy, {:id => count.to_param}, valid_session 150 | }.to change(Count, :count).by(-1) 151 | end 152 | 153 | it "redirects to the counts list" do 154 | count = Count.create! valid_attributes 155 | delete :destroy, {:id => count.to_param}, valid_session 156 | response.should redirect_to(counts_url) 157 | end 158 | end 159 | 160 | end 161 | -------------------------------------------------------------------------------- /spec/controllers/motions_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # This spec was generated by rspec-rails when you ran the scaffold generator. 4 | # It demonstrates how one might use RSpec to specify the controller code that 5 | # was generated by Rails when you ran the scaffold generator. 6 | # 7 | # It assumes that the implementation code is generated by the rails scaffold 8 | # generator. If you are using any extension libraries to generate different 9 | # controller code, this generated spec may or may not pass. 10 | # 11 | # It only uses APIs available in rails and/or rspec-rails. There are a number 12 | # of tools you can use to make these specs even more expressive, but we're 13 | # sticking to rails and rspec-rails APIs to keep things simple and stable. 14 | # 15 | # Compared to earlier versions of this generator, there is very limited use of 16 | # stubs and message expectations in this spec. Stubs are only used when there 17 | # is no simpler way to get a handle on the object needed for the example. 18 | # Message expectations are only used when there is no simpler way to specify 19 | # that an instance is receiving a specific message. 20 | 21 | describe MotionsController do 22 | 23 | # This should return the minimal set of attributes required to create a valid 24 | # Motion. As you add validations to Motion, be sure to 25 | # adjust the attributes here as well. 26 | let(:valid_attributes) { { "organization" => "MyString" } } 27 | 28 | # This should return the minimal set of values that should be in the session 29 | # in order to pass any filters (e.g. authentication) defined in 30 | # MotionsController. Be sure to keep this updated too. 31 | let(:valid_session) { {} } 32 | 33 | describe "GET index" do 34 | it "assigns all motions as @motions" do 35 | motion = Motion.create! valid_attributes 36 | get :index, {}, valid_session 37 | assigns(:motions).should eq([motion]) 38 | end 39 | end 40 | 41 | describe "GET show" do 42 | it "assigns the requested motion as @motion" do 43 | motion = Motion.create! valid_attributes 44 | get :show, {:id => motion.to_param}, valid_session 45 | assigns(:motion).should eq(motion) 46 | end 47 | 48 | it "returns the correct motion in json format" do 49 | motion = FactoryGirl.create(:motion) 50 | get :show, id: motion.id, format: :json 51 | response.should be_success 52 | response.body.should eq(assigns(:motion).to_json) 53 | end 54 | end 55 | 56 | describe "GET new" do 57 | it "assigns a new motion as @motion" do 58 | get :new, {}, valid_session 59 | assigns(:motion).should be_a_new(Motion) 60 | end 61 | end 62 | 63 | describe "GET edit" do 64 | it "assigns the requested motion as @motion" do 65 | motion = Motion.create! valid_attributes 66 | get :edit, {:id => motion.to_param}, valid_session 67 | assigns(:motion).should eq(motion) 68 | end 69 | end 70 | 71 | describe "POST create" do 72 | describe "with valid params" do 73 | it "creates a new Motion" do 74 | expect { 75 | post :create, {:motion => valid_attributes}, valid_session 76 | }.to change(Motion, :count).by(1) 77 | end 78 | 79 | it "assigns a newly created motion as @motion" do 80 | post :create, {:motion => valid_attributes}, valid_session 81 | assigns(:motion).should be_a(Motion) 82 | assigns(:motion).should be_persisted 83 | end 84 | 85 | it "redirects to the created motion" do 86 | post :create, {:motion => valid_attributes}, valid_session 87 | response.should redirect_to(Motion.last) 88 | end 89 | end 90 | 91 | describe "with invalid params" do 92 | it "assigns a newly created but unsaved motion as @motion" do 93 | # Trigger the behavior that occurs when invalid params are submitted 94 | Motion.any_instance.stub(:save).and_return(false) 95 | post :create, {:motion => { "organization" => "invalid value" }}, valid_session 96 | assigns(:motion).should be_a_new(Motion) 97 | end 98 | 99 | # it "re-renders the 'new' template" do 100 | # # Trigger the behavior that occurs when invalid params are submitted 101 | # Motion.any_instance.stub(:save).and_return(false) 102 | # post :create, {:motion => { "organization" => "invalid value" }}, valid_session 103 | # response.should render_template("new") 104 | # end 105 | end 106 | end 107 | 108 | describe "PUT update" do 109 | describe "with valid params" do 110 | it "updates the requested motion" do 111 | motion = Motion.create! valid_attributes 112 | # Assuming there are no other motions in the database, this 113 | # specifies that the Motion created on the previous line 114 | # receives the :update_attributes message with whatever params are 115 | # submitted in the request. 116 | Motion.any_instance.should_receive(:update_attributes).with({ "organization" => "MyString" }) 117 | put :update, {:id => motion.to_param, :motion => { "organization" => "MyString" }}, valid_session 118 | end 119 | 120 | it "assigns the requested motion as @motion" do 121 | motion = Motion.create! valid_attributes 122 | put :update, {:id => motion.to_param, :motion => valid_attributes}, valid_session 123 | assigns(:motion).should eq(motion) 124 | end 125 | 126 | it "redirects to the motion" do 127 | motion = Motion.create! valid_attributes 128 | put :update, {:id => motion.to_param, :motion => valid_attributes}, valid_session 129 | response.should redirect_to(motion) 130 | end 131 | end 132 | 133 | describe "with invalid params" do 134 | it "assigns the motion as @motion" do 135 | motion = Motion.create! valid_attributes 136 | # Trigger the behavior that occurs when invalid params are submitted 137 | Motion.any_instance.stub(:save).and_return(false) 138 | put :update, {:id => motion.to_param, :motion => { "organization" => "invalid value" }}, valid_session 139 | assigns(:motion).should eq(motion) 140 | end 141 | 142 | # it "re-renders the 'edit' template" do 143 | # motion = Motion.create! valid_attributes 144 | # # Trigger the behavior that occurs when invalid params are submitted 145 | # Motion.any_instance.stub(:save).and_return(false) 146 | # put :update, {:id => motion.to_param, :motion => { "organization" => "invalid value" }}, valid_session 147 | # response.should render_template("edit") 148 | # end 149 | end 150 | end 151 | 152 | describe "DELETE destroy" do 153 | it "destroys the requested motion" do 154 | motion = Motion.create! valid_attributes 155 | expect { 156 | delete :destroy, {:id => motion.to_param}, valid_session 157 | }.to change(Motion, :count).by(-1) 158 | end 159 | 160 | it "redirects to the motions list" do 161 | motion = Motion.create! valid_attributes 162 | delete :destroy, {:id => motion.to_param}, valid_session 163 | response.should redirect_to(motions_url) 164 | end 165 | end 166 | 167 | end 168 | -------------------------------------------------------------------------------- /spec/controllers/paperworks_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # This spec was generated by rspec-rails when you ran the scaffold generator. 4 | # It demonstrates how one might use RSpec to specify the controller code that 5 | # was generated by Rails when you ran the scaffold generator. 6 | # 7 | # It assumes that the implementation code is generated by the rails scaffold 8 | # generator. If you are using any extension libraries to generate different 9 | # controller code, this generated spec may or may not pass. 10 | # 11 | # It only uses APIs available in rails and/or rspec-rails. There are a number 12 | # of tools you can use to make these specs even more expressive, but we're 13 | # sticking to rails and rspec-rails APIs to keep things simple and stable. 14 | # 15 | # Compared to earlier versions of this generator, there is very limited use of 16 | # stubs and message expectations in this spec. Stubs are only used when there 17 | # is no simpler way to get a handle on the object needed for the example. 18 | # Message expectations are only used when there is no simpler way to specify 19 | # that an instance is receiving a specific message. 20 | 21 | describe PaperworksController do 22 | 23 | # This should return the minimal set of attributes required to create a valid 24 | # Paperwork. As you add validations to Paperwork, be sure to 25 | # adjust the attributes here as well. 26 | let(:valid_attributes) { { "session" => "MyString" } } 27 | 28 | # This should return the minimal set of values that should be in the session 29 | # in order to pass any filters (e.g. authentication) defined in 30 | # PaperworksController. Be sure to keep this updated too. 31 | let(:valid_session) { {} } 32 | 33 | describe "GET index", broken: true do 34 | it "assigns all paperworks as @paperworks" do 35 | paperwork = Paperwork.create! valid_attributes 36 | get :index, {}, valid_session 37 | assigns(:paperworks).should eq([paperwork]) 38 | end 39 | end 40 | 41 | describe "GET show", broken: true do 42 | it "assigns the requested paperwork as @paperwork" do 43 | paperwork = Paperwork.create! valid_attributes 44 | get :show, {:id => paperwork.to_param}, valid_session 45 | assigns(:paperwork).should eq(paperwork) 46 | end 47 | end 48 | 49 | describe "GET new", broken: true do 50 | it "assigns a new paperwork as @paperwork" do 51 | get :new, {}, valid_session 52 | assigns(:paperwork).should be_a_new(Paperwork) 53 | end 54 | end 55 | 56 | describe "GET edit", broken: true do 57 | it "assigns the requested paperwork as @paperwork" do 58 | paperwork = Paperwork.create! valid_attributes 59 | get :edit, {:id => paperwork.to_param}, valid_session 60 | assigns(:paperwork).should eq(paperwork) 61 | end 62 | end 63 | 64 | describe "GET search" do 65 | 66 | before(:each) do 67 | @paperwork1 = FactoryGirl.build(:paperwork1) 68 | @paperwork2 = FactoryGirl.build(:paperwork2) 69 | @bill = FactoryGirl.create(:bill1) 70 | @bill.paperworks = [@paperwork1, @paperwork2] 71 | @bill.save 72 | @paperwork1.save 73 | @paperwork2.save 74 | Sunspot.remove_all(Paperwork) 75 | Sunspot.index!(Paperwork.all) 76 | end 77 | 78 | it "searches over a date range" do 79 | get :search, date_min: "2012-01-01T00:00:00Z", date_max: "2013-06-06T00:00:00Z", format: :json 80 | assigns(:paperworks).should eq([@paperwork2]) 81 | end 82 | 83 | context "doing a simple 'q' query" do 84 | context "with a single result" do 85 | it "assigns query results to @paperworks" do 86 | get :search, q: "Ingreso de proyecto", format: :json 87 | assigns(:paperworks).should eq([@paperwork1]) 88 | end 89 | end 90 | 91 | context "with multiple results" do 92 | it "assigns multiple query results to @paperworks" do 93 | get :search, q: "trámite", format: :json 94 | assigns(:paperworks).should eq([@paperwork1, @paperwork2]) 95 | end 96 | 97 | it "paginates results", broken: true do 98 | get :search, q: "", per_page: '1', page: '1', format: :json 99 | assigns(:bills).should eq([@paperwork1]) 100 | get :search, q: "", per_page: '1', page: '2', format: :json 101 | assigns(:bills).should eq([@paperwork2]) 102 | end 103 | end 104 | end 105 | end 106 | 107 | describe "POST create", broken: true do 108 | describe "with valid params" do 109 | it "creates a new Paperwork" do 110 | expect { 111 | post :create, {:paperwork => valid_attributes}, valid_session 112 | }.to change(Paperwork, :count).by(1) 113 | end 114 | 115 | it "assigns a newly created paperwork as @paperwork" do 116 | post :create, {:paperwork => valid_attributes}, valid_session 117 | assigns(:paperwork).should be_a(Paperwork) 118 | assigns(:paperwork).should be_persisted 119 | end 120 | 121 | it "redirects to the created paperwork" do 122 | post :create, {:paperwork => valid_attributes}, valid_session 123 | response.should redirect_to(Paperwork.last) 124 | end 125 | end 126 | 127 | describe "with invalid params" do 128 | it "assigns a newly created but unsaved paperwork as @paperwork" do 129 | # Trigger the behavior that occurs when invalid params are submitted 130 | Paperwork.any_instance.stub(:save).and_return(false) 131 | post :create, {:paperwork => { "session" => "invalid value" }}, valid_session 132 | assigns(:paperwork).should be_a_new(Paperwork) 133 | end 134 | 135 | it "re-renders the 'new' template" do 136 | # Trigger the behavior that occurs when invalid params are submitted 137 | Paperwork.any_instance.stub(:save).and_return(false) 138 | post :create, {:paperwork => { "session" => "invalid value" }}, valid_session 139 | response.should render_template("new") 140 | end 141 | end 142 | end 143 | 144 | describe "PUT update", broken: true do 145 | describe "with valid params" do 146 | it "updates the requested paperwork" do 147 | paperwork = Paperwork.create! valid_attributes 148 | # Assuming there are no other paperworks in the database, this 149 | # specifies that the Paperwork created on the previous line 150 | # receives the :update_attributes message with whatever params are 151 | # submitted in the request. 152 | Paperwork.any_instance.should_receive(:update_attributes).with({ "session" => "MyString" }) 153 | put :update, {:id => paperwork.to_param, :paperwork => { "session" => "MyString" }}, valid_session 154 | end 155 | 156 | it "assigns the requested paperwork as @paperwork" do 157 | paperwork = Paperwork.create! valid_attributes 158 | put :update, {:id => paperwork.to_param, :paperwork => valid_attributes}, valid_session 159 | assigns(:paperwork).should eq(paperwork) 160 | end 161 | 162 | it "redirects to the paperwork" do 163 | paperwork = Paperwork.create! valid_attributes 164 | put :update, {:id => paperwork.to_param, :paperwork => valid_attributes}, valid_session 165 | response.should redirect_to(paperwork) 166 | end 167 | end 168 | 169 | describe "with invalid params" do 170 | it "assigns the paperwork as @paperwork" do 171 | paperwork = Paperwork.create! valid_attributes 172 | # Trigger the behavior that occurs when invalid params are submitted 173 | Paperwork.any_instance.stub(:save).and_return(false) 174 | put :update, {:id => paperwork.to_param, :paperwork => { "session" => "invalid value" }}, valid_session 175 | assigns(:paperwork).should eq(paperwork) 176 | end 177 | 178 | it "re-renders the 'edit' template" do 179 | paperwork = Paperwork.create! valid_attributes 180 | # Trigger the behavior that occurs when invalid params are submitted 181 | Paperwork.any_instance.stub(:save).and_return(false) 182 | put :update, {:id => paperwork.to_param, :paperwork => { "session" => "invalid value" }}, valid_session 183 | response.should render_template("edit") 184 | end 185 | end 186 | end 187 | 188 | describe "DELETE destroy", broken: true do 189 | it "destroys the requested paperwork" do 190 | paperwork = Paperwork.create! valid_attributes 191 | expect { 192 | delete :destroy, {:id => paperwork.to_param}, valid_session 193 | }.to change(Paperwork, :count).by(-1) 194 | end 195 | 196 | it "redirects to the paperworks list" do 197 | paperwork = Paperwork.create! valid_attributes 198 | delete :destroy, {:id => paperwork.to_param}, valid_session 199 | response.should redirect_to(paperworks_url) 200 | end 201 | end 202 | 203 | end 204 | -------------------------------------------------------------------------------- /spec/controllers/vote_events_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # This spec was generated by rspec-rails when you ran the scaffold generator. 4 | # It demonstrates how one might use RSpec to specify the controller code that 5 | # was generated by Rails when you ran the scaffold generator. 6 | # 7 | # It assumes that the implementation code is generated by the rails scaffold 8 | # generator. If you are using any extension libraries to generate different 9 | # controller code, this generated spec may or may not pass. 10 | # 11 | # It only uses APIs available in rails and/or rspec-rails. There are a number 12 | # of tools you can use to make these specs even more expressive, but we're 13 | # sticking to rails and rspec-rails APIs to keep things simple and stable. 14 | # 15 | # Compared to earlier versions of this generator, there is very limited use of 16 | # stubs and message expectations in this spec. Stubs are only used when there 17 | # is no simpler way to get a handle on the object needed for the example. 18 | # Message expectations are only used when there is no simpler way to specify 19 | # that an instance is receiving a specific message. 20 | 21 | describe VoteEventsController, pending: "not clear what methods it should have" do 22 | 23 | # This should return the minimal set of attributes required to create a valid 24 | # VoteEvent. As you add validations to VoteEvent, be sure to 25 | # adjust the attributes here as well. 26 | let(:valid_attributes) { { "start_date" => "2014-05-28 17:07:28" } } 27 | 28 | # This should return the minimal set of values that should be in the session 29 | # in order to pass any filters (e.g. authentication) defined in 30 | # VoteEventsController. Be sure to keep this updated too. 31 | let(:valid_session) { {} } 32 | 33 | describe "GET index" do 34 | it "assigns all vote_events as @vote_events" do 35 | vote_event = VoteEvent.create! valid_attributes 36 | get :index, {}, valid_session 37 | assigns(:vote_events).should eq([vote_event]) 38 | end 39 | end 40 | 41 | describe "GET show" do 42 | it "assigns the requested vote_event as @vote_event" do 43 | vote_event = VoteEvent.create! valid_attributes 44 | get :show, {:id => vote_event.to_param}, valid_session 45 | assigns(:vote_event).should eq(vote_event) 46 | end 47 | end 48 | 49 | describe "GET new" do 50 | it "assigns a new vote_event as @vote_event" do 51 | get :new, {}, valid_session 52 | assigns(:vote_event).should be_a_new(VoteEvent) 53 | end 54 | end 55 | 56 | describe "GET edit" do 57 | it "assigns the requested vote_event as @vote_event" do 58 | vote_event = VoteEvent.create! valid_attributes 59 | get :edit, {:id => vote_event.to_param}, valid_session 60 | assigns(:vote_event).should eq(vote_event) 61 | end 62 | end 63 | 64 | describe "POST create" do 65 | describe "with valid params" do 66 | it "creates a new VoteEvent" do 67 | expect { 68 | post :create, {:vote_event => valid_attributes}, valid_session 69 | }.to change(VoteEvent, :count).by(1) 70 | end 71 | 72 | it "assigns a newly created vote_event as @vote_event" do 73 | post :create, {:vote_event => valid_attributes}, valid_session 74 | assigns(:vote_event).should be_a(VoteEvent) 75 | assigns(:vote_event).should be_persisted 76 | end 77 | 78 | it "redirects to the created vote_event" do 79 | post :create, {:vote_event => valid_attributes}, valid_session 80 | response.should redirect_to(VoteEvent.last) 81 | end 82 | end 83 | 84 | describe "with invalid params" do 85 | it "assigns a newly created but unsaved vote_event as @vote_event" do 86 | # Trigger the behavior that occurs when invalid params are submitted 87 | VoteEvent.any_instance.stub(:save).and_return(false) 88 | post :create, {:vote_event => { "start_date" => "invalid value" }}, valid_session 89 | assigns(:vote_event).should be_a_new(VoteEvent) 90 | end 91 | 92 | it "re-renders the 'new' template" do 93 | # Trigger the behavior that occurs when invalid params are submitted 94 | VoteEvent.any_instance.stub(:save).and_return(false) 95 | post :create, {:vote_event => { "start_date" => "invalid value" }}, valid_session 96 | response.should render_template("new") 97 | end 98 | end 99 | end 100 | 101 | describe "PUT update" do 102 | describe "with valid params" do 103 | it "updates the requested vote_event" do 104 | vote_event = VoteEvent.create! valid_attributes 105 | # Assuming there are no other vote_events in the database, this 106 | # specifies that the VoteEvent created on the previous line 107 | # receives the :update_attributes message with whatever params are 108 | # submitted in the request. 109 | VoteEvent.any_instance.should_receive(:update_attributes).with({ "start_date" => "2014-05-28 17:07:28" }) 110 | put :update, {:id => vote_event.to_param, :vote_event => { "start_date" => "2014-05-28 17:07:28" }}, valid_session 111 | end 112 | 113 | it "assigns the requested vote_event as @vote_event" do 114 | vote_event = VoteEvent.create! valid_attributes 115 | put :update, {:id => vote_event.to_param, :vote_event => valid_attributes}, valid_session 116 | assigns(:vote_event).should eq(vote_event) 117 | end 118 | 119 | it "redirects to the vote_event" do 120 | vote_event = VoteEvent.create! valid_attributes 121 | put :update, {:id => vote_event.to_param, :vote_event => valid_attributes}, valid_session 122 | response.should redirect_to(vote_event) 123 | end 124 | end 125 | 126 | describe "with invalid params" do 127 | it "assigns the vote_event as @vote_event" do 128 | vote_event = VoteEvent.create! valid_attributes 129 | # Trigger the behavior that occurs when invalid params are submitted 130 | VoteEvent.any_instance.stub(:save).and_return(false) 131 | put :update, {:id => vote_event.to_param, :vote_event => { "start_date" => "invalid value" }}, valid_session 132 | assigns(:vote_event).should eq(vote_event) 133 | end 134 | 135 | it "re-renders the 'edit' template" do 136 | vote_event = VoteEvent.create! valid_attributes 137 | # Trigger the behavior that occurs when invalid params are submitted 138 | VoteEvent.any_instance.stub(:save).and_return(false) 139 | put :update, {:id => vote_event.to_param, :vote_event => { "start_date" => "invalid value" }}, valid_session 140 | response.should render_template("edit") 141 | end 142 | end 143 | end 144 | 145 | describe "DELETE destroy" do 146 | it "destroys the requested vote_event" do 147 | vote_event = VoteEvent.create! valid_attributes 148 | expect { 149 | delete :destroy, {:id => vote_event.to_param}, valid_session 150 | }.to change(VoteEvent, :count).by(-1) 151 | end 152 | 153 | it "redirects to the vote_events list" do 154 | vote_event = VoteEvent.create! valid_attributes 155 | delete :destroy, {:id => vote_event.to_param}, valid_session 156 | response.should redirect_to(vote_events_url) 157 | end 158 | end 159 | 160 | end 161 | -------------------------------------------------------------------------------- /spec/controllers/votes_controller_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # This spec was generated by rspec-rails when you ran the scaffold generator. 4 | # It demonstrates how one might use RSpec to specify the controller code that 5 | # was generated by Rails when you ran the scaffold generator. 6 | # 7 | # It assumes that the implementation code is generated by the rails scaffold 8 | # generator. If you are using any extension libraries to generate different 9 | # controller code, this generated spec may or may not pass. 10 | # 11 | # It only uses APIs available in rails and/or rspec-rails. There are a number 12 | # of tools you can use to make these specs even more expressive, but we're 13 | # sticking to rails and rspec-rails APIs to keep things simple and stable. 14 | # 15 | # Compared to earlier versions of this generator, there is very limited use of 16 | # stubs and message expectations in this spec. Stubs are only used when there 17 | # is no simpler way to get a handle on the object needed for the example. 18 | # Message expectations are only used when there is no simpler way to specify 19 | # that an instance is receiving a specific message. 20 | 21 | describe VotesController, pending: "not clear what methods it should have" do 22 | 23 | # This should return the minimal set of attributes required to create a valid 24 | # Vote. As you add validations to Vote, be sure to 25 | # adjust the attributes here as well. 26 | let(:valid_attributes) { { "voter_id" => "" } } 27 | 28 | # This should return the minimal set of values that should be in the session 29 | # in order to pass any filters (e.g. authentication) defined in 30 | # VotesController. Be sure to keep this updated too. 31 | let(:valid_session) { {} } 32 | 33 | describe "GET index" do 34 | it "assigns all votes as @votes" do 35 | vote = Vote.create! valid_attributes 36 | get :index, {}, valid_session 37 | assigns(:votes).should eq([vote]) 38 | end 39 | end 40 | 41 | describe "GET show" do 42 | it "assigns the requested vote as @vote" do 43 | vote = Vote.create! valid_attributes 44 | get :show, {:id => vote.to_param}, valid_session 45 | assigns(:vote).should eq(vote) 46 | end 47 | end 48 | 49 | describe "GET new" do 50 | it "assigns a new vote as @vote" do 51 | get :new, {}, valid_session 52 | assigns(:vote).should be_a_new(Vote) 53 | end 54 | end 55 | 56 | describe "GET edit" do 57 | it "assigns the requested vote as @vote" do 58 | vote = Vote.create! valid_attributes 59 | get :edit, {:id => vote.to_param}, valid_session 60 | assigns(:vote).should eq(vote) 61 | end 62 | end 63 | 64 | describe "POST create" do 65 | describe "with valid params" do 66 | it "creates a new Vote" do 67 | expect { 68 | post :create, {:vote => valid_attributes}, valid_session 69 | }.to change(Vote, :count).by(1) 70 | end 71 | 72 | it "assigns a newly created vote as @vote" do 73 | post :create, {:vote => valid_attributes}, valid_session 74 | assigns(:vote).should be_a(Vote) 75 | assigns(:vote).should be_persisted 76 | end 77 | 78 | it "redirects to the created vote" do 79 | post :create, {:vote => valid_attributes}, valid_session 80 | response.should redirect_to(Vote.last) 81 | end 82 | end 83 | 84 | describe "with invalid params" do 85 | it "assigns a newly created but unsaved vote as @vote" do 86 | # Trigger the behavior that occurs when invalid params are submitted 87 | Vote.any_instance.stub(:save).and_return(false) 88 | post :create, {:vote => { "voter_id" => "invalid value" }}, valid_session 89 | assigns(:vote).should be_a_new(Vote) 90 | end 91 | 92 | it "re-renders the 'new' template" do 93 | # Trigger the behavior that occurs when invalid params are submitted 94 | Vote.any_instance.stub(:save).and_return(false) 95 | post :create, {:vote => { "voter_id" => "invalid value" }}, valid_session 96 | response.should render_template("new") 97 | end 98 | end 99 | end 100 | 101 | describe "PUT update" do 102 | describe "with valid params" do 103 | it "updates the requested vote" do 104 | vote = Vote.create! valid_attributes 105 | # Assuming there are no other votes in the database, this 106 | # specifies that the Vote created on the previous line 107 | # receives the :update_attributes message with whatever params are 108 | # submitted in the request. 109 | Vote.any_instance.should_receive(:update_attributes).with({ "voter_id" => "" }) 110 | put :update, {:id => vote.to_param, :vote => { "voter_id" => "" }}, valid_session 111 | end 112 | 113 | it "assigns the requested vote as @vote" do 114 | vote = Vote.create! valid_attributes 115 | put :update, {:id => vote.to_param, :vote => valid_attributes}, valid_session 116 | assigns(:vote).should eq(vote) 117 | end 118 | 119 | it "redirects to the vote" do 120 | vote = Vote.create! valid_attributes 121 | put :update, {:id => vote.to_param, :vote => valid_attributes}, valid_session 122 | response.should redirect_to(vote) 123 | end 124 | end 125 | 126 | describe "with invalid params" do 127 | it "assigns the vote as @vote" do 128 | vote = Vote.create! valid_attributes 129 | # Trigger the behavior that occurs when invalid params are submitted 130 | Vote.any_instance.stub(:save).and_return(false) 131 | put :update, {:id => vote.to_param, :vote => { "voter_id" => "invalid value" }}, valid_session 132 | assigns(:vote).should eq(vote) 133 | end 134 | 135 | it "re-renders the 'edit' template" do 136 | vote = Vote.create! valid_attributes 137 | # Trigger the behavior that occurs when invalid params are submitted 138 | Vote.any_instance.stub(:save).and_return(false) 139 | put :update, {:id => vote.to_param, :vote => { "voter_id" => "invalid value" }}, valid_session 140 | response.should render_template("edit") 141 | end 142 | end 143 | end 144 | 145 | describe "DELETE destroy" do 146 | it "destroys the requested vote" do 147 | vote = Vote.create! valid_attributes 148 | expect { 149 | delete :destroy, {:id => vote.to_param}, valid_session 150 | }.to change(Vote, :count).by(-1) 151 | end 152 | 153 | it "redirects to the votes list" do 154 | vote = Vote.create! valid_attributes 155 | delete :destroy, {:id => vote.to_param}, valid_session 156 | response.should redirect_to(votes_url) 157 | end 158 | end 159 | 160 | end 161 | -------------------------------------------------------------------------------- /spec/example_files/boletin_3773-06.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/spec/example_files/boletin_3773-06.doc -------------------------------------------------------------------------------- /spec/example_files/ley_19029.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | "Artículo 1°.- Introdúcense las siguientes modificaciones al Código de Justicia Militar: 1) Reemplázanse en el encabezamiento del artículo 245 la frase "presidio militar mayor en su grado máximo a muerte", por la frase "presidio militar mayor en su grado máximo a presidio militar perpetuo". 2) Reemplázanse en el número 1° del artículo 245 las palabras "que pueda favorecer" por "que favorezca", y el término "perjudicar "por perjudique" respectivamente. 3) Suprímese en el artículo 247 la expresión final "a muerte". 4) Refúndense el encabezamiento del artículo 248 con su número 1°, reemplazado en los siguientes términos: "Artículo 248.- Incurrirá en la pena de presidio mayor en su grado máximo a presidio perpetuo el que pusiere en libertad a prisioneros de guerra con el objeto de que regresen a las filas enemigas". 5) Derógase el número 2° del artículo 248. 6) Elimínase en el artículo 252 la expresión "a muerte". 7) Reemplázase en el inciso segundo del artículo 263 la frase "la de muerte", por la frase "la de presidio perpetuo". 8) Reemplázase en el inciso primero del artículo 300, la frase "presidio militar mayor en su grado máximo a muerte" por la frase "presidio militar mayor en su grado máximo a presidio militar perpetuo". Elimínase en el inciso segundo del mismo artículo, la frase "a presidio militar perpetuo". 9) Reemplázase en el número 1° del artículo 301 la frase "presidio militar mayor en su grado máximo a muerte", por la frase "presidio militar mayor en su grado máximo a presidio militar perpetuo". 10) Reemplázase el artículo 305 por el siguiente: "Artículo 305.- Cualquier otro militar que abandonare los servicios en los casos a que se refieren los números 1° a 4° del artículo anterior, será castigado con las penas que cada uno de ellos contempla, rebajadas en un grado.". 11) Reemplázanse en el artículo 310 las frases "presidio militar perpetuo a muerte" y "presidio militar mayor en su grado medio a presidio militar perpetuo" por las frases "presidio militar perpetuo" y "presidio militar mayor en su grado medio a presidio militar mayor en su grado máximo", respectivamente. 12) Reemplázase en el número 1° del inciso primero del artículo 320, la frase "presidio militar mayor en su grado máximo a muerte", por la frase "presidio militar mayor en su grado máximo a presidio militar perpetuo". 13) Reemplázase en el número 1° del artículo 331 la frase "presidio mayor en su grado medio a muerte" por la frase "presidio mayor en su grado medio a presidio perpetuo". 14) Reemplázase en el inciso primero del artículo 346 la frase "presidio mayor en su grado máximo a muerte" por la frase "presidio mayor en su grado máximo a presidio perpetuo". 15) Reemplázase en el inciso segundo del artículo 348 la frase "presidio mayor en su grado máximo a muerte" por la frase "presidio mayor en su grado medio a presidio perpetuo". 16) Reemplázase en el inciso primero del artículo 350 la frase "presidio perpetuo a muerte" por "presidio mayor en su grado medio a presidio perpetuo". En su inciso segundo, reemplázase la frase "presidio perpetuo" por "presidio mayor en su grado máximo". 17) Reemplázase en el inciso primero del artículo 351 la frase "presidio mayor en su grado máximo a presidio perpetuo" por la frase "presidio mayor en su grado medio a máximo". 18) Reemplázase en el inciso final del artículo 372, la expresión "muerte" por la frase "presidio perpetuo". 19) Reemplázase el artículo 375, por el siguiente: "Artículo 375.- En caso de sublevación o motín de prisioneros de guerra, los participantes sufrirán la pena de presidio mayor en cualquiera de sus grados, y en el caso de los cabecillas, la pena podrá elevarse hasta la de presidio perpetuo. Lo anterior es sin perjuicio de lo que pueda acordarse en los tratados de paz o pactos de tregua". 20) Reemplázase en el artículo 381, la frase "presidio mayor en su grado máximo a muerte" por la frase "presidio mayor en su grado máximo a presidio perpetuo". 5 | 6 | 7 | -------------------------------------------------------------------------------- /spec/factories/admin_users.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :admin_user do 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /spec/factories/bills.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | FactoryGirl.define do 3 | factory :bill do 4 | 5 | uid '0-0' 6 | 7 | factory :bill1 do |f| 8 | f.uid "1-07" 9 | f.title "Modifica los Códigos de Justicia Militar, Penal y Aeronáutico para abolir la Pena de Muerte." 10 | f.abstract "Abolición de la pena de muerte." 11 | f.tags ["pena de muerte", "justicia"] 12 | f.subject_areas ["Derechos Fundamentales"] 13 | f.stage "Tramitación terminada" 14 | f.creation_date "1990-03-20T00:00:00Z" 15 | f.publish_date "1991-01-23T00:00:00Z" 16 | f.authors [] 17 | f.initial_chamber "C.Diputados" 18 | f.resulting_document "Ley Nº 19.029" 19 | end 20 | factory :bill2 do |f| 21 | f.uid "01-07" 22 | f.title "Fake bill with terms pena de muerte" 23 | f.abstract "Abolición de la pena de muerte." 24 | f.tags ["pena de muerte", "justicia"] 25 | f.subject_areas ["Derechos Fundamentales"] 26 | f.stage "Tramitación terminada" 27 | f.creation_date "1990-03-20T00:00:00Z" 28 | f.publish_date "1991-01-23T00:00:00Z" 29 | f.authors [] 30 | f.initial_chamber "C.Diputados" 31 | f.resulting_document "Ley Nº 19.029" 32 | end 33 | factory :bill3 do |f| 34 | f.uid "3773-06" 35 | f.title "Sobre acceso a la información pública" 36 | f.abstract "Ley de transparencia" 37 | f.tags ["transparencia", "acceso a la informacion publica"] 38 | f.subject_areas ["Transparencia", "Participación"] 39 | f.stage "Tramitación terminada" 40 | f.creation_date "2005-01-04T00:00:00Z" 41 | f.publish_date "2008-08-11T00:00:00Z" 42 | f.authors ["Gazmuri Mujica, Jaime", "Larraín Fernández, Hernán"] 43 | f.initial_chamber "Senado" 44 | f.bill_draft_link "http://www.senado.cl/appsenado/index.php?mo=tramitacion&ac=getDocto&iddocto=202&tipodoc=compa" 45 | end 46 | factory :bill4 do |f| 47 | f.uid "03773-06" 48 | f.title "Fake bill with terms información pública" 49 | f.abstract "Ley de transparencia" 50 | f.tags ["transparencia", "acceso a la informacion publica"] 51 | f.subject_areas ["Transparencia", "Participación"] 52 | f.stage "Tramitación terminada" 53 | f.creation_date "2007-01-04T00:00:00Z" 54 | f.publish_date "2009-08-11T00:00:00Z" 55 | f.authors ["Gazmuri Mujica, Jorge", "Larraín Fernández, Hernán"] 56 | f.initial_chamber "C.Diputados" 57 | f.bill_draft_link "http://www.senado.cl/appsenado/index.php?mo=tramitacion&ac=getDocto&iddocto=202&tipodoc=compa" 58 | end 59 | end 60 | end -------------------------------------------------------------------------------- /spec/factories/counts.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :count do 5 | option "si" 6 | value 42 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/factories/documents.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :document, :class => 'Document' do 3 | 4 | factory :document1 do |b| 5 | b.date "2014-01-01 11:35:01" 6 | b.step "Ingreso de proyecto ." 7 | b.stage "Primer trámite constitucional" 8 | b.link "http://document-example-site.org" 9 | end 10 | 11 | factory :inconsistent_data_document do |b| 12 | b.date "2014-01-01 11:35:01" 13 | b.step "Ingreso de proyecto ." 14 | b.stage "Primer tramite cónstitucional . " 15 | b.link "http://docuent-example-site.org" 16 | end 17 | end 18 | end -------------------------------------------------------------------------------- /spec/factories/motions.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :motion do 5 | organization "MyString" 6 | context "MyString" 7 | creator "MyString" 8 | text "MyString" 9 | date "2014-05-28 17:03:01" 10 | requirement "MyString" 11 | result "MyString" 12 | session "MyString" 13 | vote_events { [FactoryGirl.build(:vote_event)] } 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/factories/paperworks.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :paperwork, :class => 'Paperwork' do 5 | 6 | factory :paperwork1 do |b| 7 | b.session "/" 8 | b.date "2014-01-01 11:35:01" 9 | b.description "Ingreso de proyecto ." 10 | b.stage "Primer trámite constitucional" 11 | b.chamber "C.Diputados" 12 | end 13 | factory :paperwork2 do |b| 14 | b.session "20/343" 15 | b.date "2013-01-01 11:35:01" 16 | b.description "Oficio de ley al Ejecutivo ." 17 | b.stage "Trámite finalización en Cámara de Origen" 18 | b.chamber "Senado" 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/factories/priorities.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :priority, :class => 'Priority' do 3 | 4 | factory :priority1 do |p| 5 | p.type "Ingreso de proyecto ." 6 | p.entry_date "2014-01-01 11:35:01" 7 | end 8 | 9 | factory :priority2 do |p| 10 | p.type "Ingreso de proyecto ." 11 | p.entry_date "2014-01-01 11:35:01" 12 | end 13 | end 14 | end -------------------------------------------------------------------------------- /spec/factories/reports.rb: -------------------------------------------------------------------------------- 1 | FactoryGirl.define do 2 | factory :report, :class => 'Report' do 3 | 4 | factory :report1 do |r| 5 | r.date "2014-01-01 11:35:01" 6 | r.step "Ingreso de proyecto ." 7 | r.stage "Primer trámite constitucional" 8 | r.link "http://report-example-site.org" 9 | end 10 | end 11 | end -------------------------------------------------------------------------------- /spec/factories/vote_events.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :vote_event do 5 | start_date "2014-05-28 17:07:28" 6 | end_date "2014-05-28 17:07:28" 7 | counts { [FactoryGirl.build(:count)] } 8 | votes { [FactoryGirl.build(:vote)] } 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/factories/votes.rb: -------------------------------------------------------------------------------- 1 | # Read about factories at https://github.com/thoughtbot/factory_girl 2 | 3 | FactoryGirl.define do 4 | factory :vote do 5 | voter_id "" 6 | option "MyString" 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /spec/models/admin_user_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe AdminUser do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/bill_spec.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | require 'spec_helper' 3 | 4 | describe Bill do 5 | 6 | it "has a valid factory" do 7 | FactoryGirl.create(:bill).should be_valid 8 | end 9 | 10 | it "is invalid without an uique id (uid)" do 11 | FactoryGirl.build(:bill, uid: nil).should_not be_valid 12 | end 13 | 14 | it "is invalid with an existing id (uid)" do 15 | FactoryGirl.create(:bill, uid: 123456) 16 | FactoryGirl.build(:bill, uid: 123456).should_not be_valid 17 | end 18 | 19 | it "saves tags in lowercase" do 20 | bill = FactoryGirl.create(:bill, uid: 123456) 21 | bill.tags = ['áéíóúüñ', 'ÑÜÚÓÍÉÁ'] 22 | bill.save 23 | bill = Bill.find_by(uid: 123456) 24 | bill.tags.should eq(['aeiouuñ', 'ñuuoiea']) 25 | end 26 | 27 | it "creates the law_xml_link field when saved" do 28 | bill1 = FactoryGirl.create(:bill, uid: 1, resulting_document: "Ley Nº 20.000") 29 | bill2 = FactoryGirl.create(:bill, uid: 2, resulting_document: "D.S. Nº 1.358") 30 | bill1.save 31 | bill2.save 32 | bill1.law_xml_link.should eq("http://www.leychile.cl/Consulta/obtxml?opt=7&idLey=20000") 33 | bill2.law_xml_link.should be_nil 34 | end 35 | 36 | it "creates the law_web_link field when saved" do 37 | bill1 = FactoryGirl.create(:bill, uid: 1, resulting_document: "Ley Nº 20.000") 38 | bill2 = FactoryGirl.create(:bill, uid: 2, resulting_document: "D.S. Nº 1.358") 39 | bill1.save 40 | bill2.save 41 | bill1.law_web_link.should eq("http://www.leychile.cl/Navegar?idLey=20000") 42 | bill2.law_web_link.should be_nil 43 | end 44 | 45 | it "gets indexed after save" do 46 | search = Sunspot.search Bill do 47 | fulltext "pena" 48 | end 49 | search.results.count.should eq 0 50 | bill1 = FactoryGirl.create(:bill1) 51 | search = Sunspot.search Bill do 52 | fulltext "pena" 53 | end 54 | search.results.count.should eq 1 55 | end 56 | 57 | describe "current_priority" do 58 | it "returns the right priority" do 59 | bill1 = FactoryGirl.build(:bill1) 60 | priority1 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.today) 61 | priority2 = FactoryGirl.create(:priority1, type: "Suma", entry_date: Date.yesterday) 62 | bill1.priorities = [priority1, priority2] 63 | bill1.save 64 | bill1.current_priority.should eq "Discusión inmediata" 65 | end 66 | it "returns the right value when no priority is set" do 67 | bill1 = FactoryGirl.create(:bill1) 68 | bill1.current_priority.should eq "Sin urgencia" 69 | end 70 | it "returns no priority value with future dates" do 71 | bill1 = FactoryGirl.create(:bill1) 72 | priority1 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.tomorrow) 73 | bill1.priorities = [priority1] 74 | bill1.save 75 | bill1.current_priority.should eq "Sin urgencia" 76 | end 77 | it "works with more than 1 priority" do 78 | bill1 = FactoryGirl.build(:bill1) 79 | priority1 = FactoryGirl.create(:priority1, type: "Simple", entry_date: Date.yesterday) 80 | priority2 = FactoryGirl.create(:priority1, type: "Suma", entry_date: Date.today) 81 | bill1.priorities = [priority1, priority2] 82 | bill1.save 83 | bill1.current_priority.should eq "Suma" 84 | end 85 | it "returns the right value when priority is outdated" do 86 | bill1 = FactoryGirl.build(:bill1) 87 | priority1 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: 6.days.ago) 88 | bill1.priorities = [priority1] 89 | bill1.save 90 | bill1.current_priority.should eq "Discusión inmediata" 91 | bill2 = FactoryGirl.build(:bill2) 92 | priority2 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: 7.days.ago) 93 | bill2.priorities = [priority2] 94 | bill2.save 95 | bill2.current_priority.should eq "Sin urgencia" 96 | end 97 | it "counts weekends" do 98 | Date.stub(:today){"2014-01-13".to_date} 99 | bill1 = FactoryGirl.build(:bill1) 100 | priority1 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.today - 6) 101 | bill1.priorities = [priority1] 102 | bill1.save 103 | bill1.current_priority.should eq "Discusión inmediata" 104 | 105 | bill2 = FactoryGirl.build(:bill2) 106 | priority2 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.today - 7) 107 | bill2.priorities = [priority2] 108 | bill2.save 109 | bill2.current_priority.should eq "Sin urgencia" 110 | end 111 | it "counts holidays" do 112 | Date.stub(:today){"2014-01-06".to_date} 113 | bill1 = FactoryGirl.build(:bill1) 114 | priority1 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.today - 6) 115 | bill1.priorities = [priority1] 116 | bill1.save 117 | bill1.current_priority.should eq "Discusión inmediata" 118 | 119 | bill2 = FactoryGirl.build(:bill2) 120 | priority2 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.today - 7) 121 | bill2.priorities = [priority2] 122 | bill2.save 123 | bill2.current_priority.should eq "Sin urgencia" 124 | end 125 | end 126 | 127 | describe "self.update_priority" do 128 | before(:each) do 129 | Date.stub(:today){"2014-01-06".to_date} 130 | @bill1 = FactoryGirl.build(:bill1) 131 | @bill2 = FactoryGirl.build(:bill2) 132 | priority1 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.today - 6) 133 | priority2 = FactoryGirl.create(:priority1, type: "Discusión inmediata", entry_date: Date.today - 7) 134 | @bill1.priorities = [priority1] 135 | @bill2.priorities = [priority2] 136 | @bill1.save 137 | @bill2.save 138 | end 139 | it "updates outdated bill priorities for all bills" do 140 | # Day 1 141 | @bill1.current_priority.should eq "Discusión inmediata" 142 | @bill2.current_priority.should eq "Sin urgencia" 143 | # The next day 144 | Date.stub(:today){"2014-01-07".to_date} 145 | Bill.update_priority 146 | updated_bill1 = Bill.find_by uid: @bill1.uid 147 | updated_bill2 = Bill.find_by uid: @bill2.uid 148 | updated_bill1.current_priority.should eq "Sin urgencia" 149 | updated_bill2.current_priority.should eq "Sin urgencia" 150 | end 151 | 152 | it "indexes the updated bill priorities" do 153 | Bill.update_priority 154 | 155 | Sunspot.remove_all(Bill) 156 | Sunspot.index!(@bill1) 157 | Sunspot.index!(@bill2) 158 | search = Sunspot.search Bill do 159 | text_fields do 160 | with :current_priority, "Sin urgencia" 161 | end 162 | end 163 | search.results.count.should eq 1 164 | end 165 | end 166 | end -------------------------------------------------------------------------------- /spec/models/count_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Count do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/motion_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Motion do 4 | it "has a valid factory" do 5 | FactoryGirl.create(:motion).should be_valid 6 | end 7 | 8 | # it "is invalid without an uique id (uid)" do 9 | # FactoryGirl.build(:bill, uid: nil).should_not be_valid 10 | # end 11 | end 12 | -------------------------------------------------------------------------------- /spec/models/paperwork_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Paperwork do 4 | it "saves a valid timeline_status" do 5 | @paperwork1 = FactoryGirl.build(:paperwork1) 6 | @paperwork2 = FactoryGirl.build(:paperwork2) 7 | @bill = FactoryGirl.create(:bill1) 8 | @bill.paperworks = [@paperwork1, @paperwork2] 9 | @bill.save 10 | @paperwork1.save 11 | @paperwork2.save 12 | @paperwork1.timeline_status.should eq 'Ingreso' 13 | @paperwork2.timeline_status.should eq 'Tramitación Terminada' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /spec/models/vote_event_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe VoteEvent do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/models/vote_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe Vote do 4 | pending "add some examples to (or delete) #{__FILE__}" 5 | end 6 | -------------------------------------------------------------------------------- /spec/routing/bills_routing_spec.rb: -------------------------------------------------------------------------------- 1 | require "spec_helper" 2 | 3 | describe BillsController do 4 | describe "routing" do 5 | 6 | it "routes to #index" do 7 | get("/bills").should route_to("bills#index") 8 | end 9 | 10 | it "routes to #new" do 11 | get("/bills/new").should route_to("bills#new") 12 | end 13 | 14 | it "routes to #show" do 15 | get("/bills/1").should route_to("bills#show", :id => "1") 16 | end 17 | 18 | it "routes to #edit" do 19 | get("/bills/1/edit").should route_to("bills#edit", :id => "1") 20 | end 21 | 22 | it "routes to #create" do 23 | post("/bills").should route_to("bills#create") 24 | end 25 | 26 | it "routes to #update" do 27 | put("/bills/1").should route_to("bills#update", :id => "1") 28 | end 29 | 30 | it "routes to #destroy" do 31 | delete("/bills/1").should route_to("bills#destroy", :id => "1") 32 | end 33 | 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is copied to spec/ when you run 'rails generate rspec:install' 2 | ENV["RAILS_ENV"] ||= 'test' 3 | require File.expand_path("../../config/environment", __FILE__) 4 | require 'rspec/rails' 5 | require 'rspec/autorun' 6 | require 'webmock/rspec' 7 | 8 | # Requires supporting ruby files with custom matchers and macros, etc, 9 | # in spec/support/ and its subdirectories. 10 | Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} 11 | 12 | # Enables localhost connections for solr indexing 13 | WebMock.disable_net_connect!(:allow_localhost => true) 14 | 15 | RSpec.configure do |config| 16 | # ## Mock Framework 17 | # 18 | # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: 19 | # 20 | # config.mock_with :mocha 21 | # config.mock_with :flexmock 22 | # config.mock_with :rr 23 | 24 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures 25 | # config.fixture_path = "#{::Rails.root}/spec/fixtures" 26 | 27 | # If you're not using ActiveRecord, or you'd prefer not to run each of your 28 | # examples within a transaction, remove the following line or assign false 29 | # instead of true. 30 | # config.use_transactional_fixtures = true 31 | 32 | # If true, the base class of anonymous controllers will be inferred 33 | # automatically. This will be the default behavior in future versions of 34 | # rspec-rails. 35 | config.infer_base_class_for_anonymous_controllers = false 36 | 37 | # Run specs in random order to surface order dependencies. If you find an 38 | # order dependency and want to debug it, you can fix the order by providing 39 | # the seed, which is printed after each run. 40 | # --seed 1234 41 | config.order = "random" 42 | 43 | # Database_cleaner 44 | config.before :each do 45 | DatabaseCleaner[:mongoid].strategy = :truncation 46 | DatabaseCleaner[:mongoid].start 47 | end 48 | config.after do 49 | DatabaseCleaner[:mongoid].clean 50 | end 51 | 52 | # To skip groups of tests 53 | config.filter_run_excluding :broken => true 54 | 55 | end 56 | -------------------------------------------------------------------------------- /sunspot-solr.pid: -------------------------------------------------------------------------------- 1 | 10753 -------------------------------------------------------------------------------- /test/fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/test/fixtures/.gitkeep -------------------------------------------------------------------------------- /test/functional/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/test/functional/.gitkeep -------------------------------------------------------------------------------- /test/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/test/integration/.gitkeep -------------------------------------------------------------------------------- /test/performance/browsing_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | require 'rails/performance_test_help' 3 | 4 | class BrowsingTest < ActionDispatch::PerformanceTest 5 | # Refer to the documentation for all available options 6 | # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] 7 | # :output => 'tmp/performance', :formats => [:flat] } 8 | 9 | def test_homepage 10 | get '/' 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] = "test" 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Add more helper methods to be used by all tests here... 7 | end 8 | -------------------------------------------------------------------------------- /test/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/test/unit/.gitkeep -------------------------------------------------------------------------------- /vendor/assets/javascripts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/vendor/assets/javascripts/.gitkeep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/vendor/assets/stylesheets/.gitkeep -------------------------------------------------------------------------------- /vendor/plugins/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ciudadanointeligente/bill-it/25d9c6480d09dc7f0969f447b9f31a23acc18200/vendor/plugins/.gitkeep --------------------------------------------------------------------------------