Merge branch 'master' into proposal-dashboard
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
# Mac finder artifacts
|
# Mac finder artifacts
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# Intellij IDE project settings
|
||||||
|
/.idea
|
||||||
|
|
||||||
.ruby-gemset
|
.ruby-gemset
|
||||||
|
|
||||||
public/sitemap.xml
|
public/sitemap.xml
|
||||||
|
|||||||
@@ -2,12 +2,18 @@
|
|||||||
|
|
||||||
## Core team members
|
## Core team members
|
||||||
|
|
||||||
* Raimond García [github](https://github.com/voodoorai2000) | [twitter](https://twitter.com/voodoorai2000)
|
* [Alberto García](https://github.com/decabeza)
|
||||||
* Juanjo Bazán [github](https://github.com/xuanxu) | [twitter](https://twitter.com/xuanxu)
|
* [Javi Martín](https://github.com/javierm)
|
||||||
* Enrique García Cota [github](https://github.com/kikito) | [twitter](https://twitter.com/otikik)
|
* [Julián Herrero](https://github.com/microweb10)
|
||||||
* Alberto García Cabeza [github](https://github.com/decabeza)
|
* [Raimond García](https://github.com/voodoorai2000)
|
||||||
* Alberto Calderón [github](https://github.com/bertocq) | [twitter](https://twitter.com/bertocq)
|
|
||||||
* Maria Checa [github](https://github.com/MariaCheca)
|
## All other contributors
|
||||||
|
|
||||||
|
In addition to the formal team, there are [over a hundred contributors](https://github.com/consul/consul/graphs/contributors). Thank you so much for your code! Big thanks too to the people that contribute in many other ways including documentation, translations, evangelism, dev ops, communication, organizing and more!
|
||||||
|
|
||||||
|
Finally a special thanks to the former core team members. Lovingly known as The Alumni:
|
||||||
|
|
||||||
|
[Juanjo Bazán](https://github.com/xuanxu), [Enrique García Cota](https://github.com/kikito), [Alberto Calderón](https://github.com/bertocq), [María Checa](https://github.com/mariacheca)
|
||||||
|
|
||||||
## Code of conduct
|
## Code of conduct
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
# Cómo Contribuir a este Projecto
|
# Cómo Contribuir a este Proyecto
|
||||||
|
|
||||||
## Miembros del equipo
|
## Miembros del equipo core
|
||||||
|
|
||||||
* Raimond García [github](https://github.com/voodoorai2000) | [twitter](https://twitter.com/voodoorai2000)
|
* [Alberto García](https://github.com/decabeza)
|
||||||
* Juanjo Bazán [github](https://github.com/xuanxu) | [twitter](https://twitter.com/xuanxu)
|
* [Javi Martín](https://github.com/javierm)
|
||||||
* Enrique García Cota [github](https://github.com/kikito) | [twitter](https://twitter.com/otikik)
|
* [Julián Herrero](https://github.com/microweb10)
|
||||||
* Alberto García Cabeza [github](https://github.com/decabeza)
|
* [Raimond García](https://github.com/voodoorai2000)
|
||||||
* Alberto Calderón [github](https://github.com/bertocq) | [twitter](https://twitter.com/bertocq)
|
|
||||||
* Maria Checa [github](https://github.com/MariaCheca)
|
## Todos los demás contribuidores
|
||||||
|
|
||||||
|
Además del equipo formal, hay [más de cien contribuidores](https://github.com/consul/consul/graphs/contributors). ¡Muchas gracias por vuestro código! También estamos muy agradecidos a las personas que contribuyen de otras formas, incluida la documentación, traducciones, evangelismo, administración de sistemas, comunicación, organización y más.
|
||||||
|
|
||||||
|
Finalmente, un agradecimiento especial a los antiguos miembros del equipo core. Conocidos con cariño como El Alumni:
|
||||||
|
|
||||||
|
[Juanjo Bazán](https://github.com/xuanxu), [Enrique García Cota](https://github.com/kikito), [Alberto Calderón](https://github.com/bertocq), [María Checa](https://github.com/mariacheca)
|
||||||
|
|
||||||
## Código de conducta
|
## Código de conducta
|
||||||
|
|
||||||
|
|||||||
16
Gemfile
16
Gemfile
@@ -1,6 +1,6 @@
|
|||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
gem "rails", "4.2.11.1"
|
gem "rails", "5.0.7.2"
|
||||||
|
|
||||||
gem "acts-as-taggable-on", "~> 5.0.0"
|
gem "acts-as-taggable-on", "~> 5.0.0"
|
||||||
gem "acts_as_votable", "~> 0.11.1"
|
gem "acts_as_votable", "~> 0.11.1"
|
||||||
@@ -16,11 +16,13 @@ gem "coffee-rails", "~> 4.2.2"
|
|||||||
gem "daemons", "~> 1.2.4"
|
gem "daemons", "~> 1.2.4"
|
||||||
gem "dalli", "~> 2.7.6"
|
gem "dalli", "~> 2.7.6"
|
||||||
gem "delayed_job_active_record", "~> 4.1.3"
|
gem "delayed_job_active_record", "~> 4.1.3"
|
||||||
gem "devise", "~> 3.5.7"
|
gem "devise", "~> 4.6.0"
|
||||||
gem "devise-async", "~> 0.10.2"
|
gem "devise-async", "~> 1.0.0"
|
||||||
gem "devise_security_extension", "~> 0.10.0"
|
gem "devise_security_extension", git: "https://github.com/phatworx/devise_security_extension.git" #, "~> 0.10"
|
||||||
gem "foundation-rails", "~> 6.4.3.0"
|
gem "foundation-rails", "~> 6.4.3.0"
|
||||||
gem "foundation_rails_helper", "~> 2.0.0"
|
gem "foundation_rails_helper", "~> 2.0.0"
|
||||||
|
gem "globalize", "~> 5.2.0"
|
||||||
|
gem "globalize-accessors", "~> 0.2.1"
|
||||||
gem "graphiql-rails", "~> 1.4.1"
|
gem "graphiql-rails", "~> 1.4.1"
|
||||||
gem "graphql", "~> 1.7.8"
|
gem "graphql", "~> 1.7.8"
|
||||||
gem "groupdate", "~> 3.2.0"
|
gem "groupdate", "~> 3.2.0"
|
||||||
@@ -39,6 +41,7 @@ gem "paperclip", "~> 5.2.1"
|
|||||||
gem "paranoia", "~> 2.4.1"
|
gem "paranoia", "~> 2.4.1"
|
||||||
gem "pg", "~> 0.21.0"
|
gem "pg", "~> 0.21.0"
|
||||||
gem "pg_search", "~> 2.0.1"
|
gem "pg_search", "~> 2.0.1"
|
||||||
|
gem "record_tag_helper", "~> 1.0"
|
||||||
gem "redcarpet", "~> 3.4.0"
|
gem "redcarpet", "~> 3.4.0"
|
||||||
gem "responders", "~> 2.4.0"
|
gem "responders", "~> 2.4.0"
|
||||||
gem "rinku", "~> 2.0.2", require: "rails_rinku"
|
gem "rinku", "~> 2.0.2", require: "rails_rinku"
|
||||||
@@ -53,8 +56,6 @@ gem "turnout", "~> 2.4.0"
|
|||||||
gem "uglifier", "~> 4.1.2"
|
gem "uglifier", "~> 4.1.2"
|
||||||
gem "unicorn", "~> 5.4.1"
|
gem "unicorn", "~> 5.4.1"
|
||||||
gem "whenever", "~> 0.10.0", require: false
|
gem "whenever", "~> 0.10.0", require: false
|
||||||
gem "globalize", "~> 5.0.0"
|
|
||||||
gem "globalize-accessors", "~> 0.2.1"
|
|
||||||
gem "recipient_interceptor", "~> 0.2.0"
|
gem "recipient_interceptor", "~> 0.2.0"
|
||||||
gem "wkhtmltopdf-binary", "~> 0.12.4"
|
gem "wkhtmltopdf-binary", "~> 0.12.4"
|
||||||
gem "wicked_pdf", "~> 1.1.0"
|
gem "wicked_pdf", "~> 1.1.0"
|
||||||
@@ -73,7 +74,6 @@ group :development, :test do
|
|||||||
gem "knapsack_pro", "~> 1.1.0"
|
gem "knapsack_pro", "~> 1.1.0"
|
||||||
gem "launchy", "~> 2.4.3"
|
gem "launchy", "~> 2.4.3"
|
||||||
gem "letter_opener_web", "~> 1.3.4"
|
gem "letter_opener_web", "~> 1.3.4"
|
||||||
gem "quiet_assets", "~> 1.1.0"
|
|
||||||
gem "spring", "~> 2.0.1"
|
gem "spring", "~> 2.0.1"
|
||||||
gem "spring-commands-rspec", "~> 1.0.4"
|
gem "spring-commands-rspec", "~> 1.0.4"
|
||||||
end
|
end
|
||||||
@@ -84,7 +84,7 @@ group :test do
|
|||||||
gem "database_cleaner", "~> 1.7.0"
|
gem "database_cleaner", "~> 1.7.0"
|
||||||
gem "email_spec", "~> 2.1.0"
|
gem "email_spec", "~> 2.1.0"
|
||||||
gem "rspec-rails", "~> 3.8"
|
gem "rspec-rails", "~> 3.8"
|
||||||
gem "selenium-webdriver", "~> 3.10"
|
gem "selenium-webdriver", "~> 3.141"
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
|
|||||||
196
Gemfile.lock
196
Gemfile.lock
@@ -1,40 +1,51 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/phatworx/devise_security_extension.git
|
||||||
|
revision: b2ee978af7d49f0fb0e7271c6ac074dfb4d39353
|
||||||
|
specs:
|
||||||
|
devise_security_extension (0.10.0)
|
||||||
|
devise (>= 3.0.0, < 5.0)
|
||||||
|
railties (>= 3.2.6, < 6.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
remote: https://rails-assets.org/
|
remote: https://rails-assets.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (4.2.11.1)
|
actioncable (5.0.7.2)
|
||||||
actionpack (= 4.2.11.1)
|
actionpack (= 5.0.7.2)
|
||||||
actionview (= 4.2.11.1)
|
nio4r (>= 1.2, < 3.0)
|
||||||
activejob (= 4.2.11.1)
|
websocket-driver (~> 0.6.1)
|
||||||
|
actionmailer (5.0.7.2)
|
||||||
|
actionpack (= 5.0.7.2)
|
||||||
|
actionview (= 5.0.7.2)
|
||||||
|
activejob (= 5.0.7.2)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (4.2.11.1)
|
actionpack (5.0.7.2)
|
||||||
actionview (= 4.2.11.1)
|
actionview (= 5.0.7.2)
|
||||||
activesupport (= 4.2.11.1)
|
activesupport (= 5.0.7.2)
|
||||||
rack (~> 1.6)
|
rack (~> 2.0)
|
||||||
rack-test (~> 0.6.2)
|
rack-test (~> 0.6.3)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
actionview (4.2.11.1)
|
actionview (5.0.7.2)
|
||||||
activesupport (= 4.2.11.1)
|
activesupport (= 5.0.7.2)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||||
activejob (4.2.11.1)
|
activejob (5.0.7.2)
|
||||||
activesupport (= 4.2.11.1)
|
activesupport (= 5.0.7.2)
|
||||||
globalid (>= 0.3.0)
|
globalid (>= 0.3.6)
|
||||||
activemodel (4.2.11.1)
|
activemodel (5.0.7.2)
|
||||||
activesupport (= 4.2.11.1)
|
activesupport (= 5.0.7.2)
|
||||||
builder (~> 3.1)
|
activerecord (5.0.7.2)
|
||||||
activerecord (4.2.11.1)
|
activemodel (= 5.0.7.2)
|
||||||
activemodel (= 4.2.11.1)
|
activesupport (= 5.0.7.2)
|
||||||
activesupport (= 4.2.11.1)
|
arel (~> 7.0)
|
||||||
arel (~> 6.0)
|
activesupport (5.0.7.2)
|
||||||
activesupport (4.2.11.1)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (~> 0.7)
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
thread_safe (~> 0.3, >= 0.3.4)
|
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
acts-as-taggable-on (5.0.0)
|
acts-as-taggable-on (5.0.0)
|
||||||
activerecord (>= 4.2.8)
|
activerecord (>= 4.2.8)
|
||||||
@@ -59,7 +70,7 @@ GEM
|
|||||||
nokogiri
|
nokogiri
|
||||||
ancestry (3.0.2)
|
ancestry (3.0.2)
|
||||||
activerecord (>= 3.2.0)
|
activerecord (>= 3.2.0)
|
||||||
arel (6.0.4)
|
arel (7.1.4)
|
||||||
ast (2.4.0)
|
ast (2.4.0)
|
||||||
autoprefixer-rails (9.1.4)
|
autoprefixer-rails (9.1.4)
|
||||||
execjs
|
execjs
|
||||||
@@ -67,7 +78,7 @@ GEM
|
|||||||
babel-transpiler (0.7.0)
|
babel-transpiler (0.7.0)
|
||||||
babel-source (>= 4.0, < 6)
|
babel-source (>= 4.0, < 6)
|
||||||
execjs (~> 2.0)
|
execjs (~> 2.0)
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.12)
|
||||||
best_in_place (3.0.3)
|
best_in_place (3.0.3)
|
||||||
actionpack (>= 3.2)
|
actionpack (>= 3.2)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
@@ -107,7 +118,7 @@ GEM
|
|||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
xpath (>= 2.0, < 4.0)
|
xpath (>= 2.0, < 4.0)
|
||||||
childprocess (0.8.0)
|
childprocess (0.9.0)
|
||||||
ffi (~> 1.0, >= 1.0.11)
|
ffi (~> 1.0, >= 1.0.11)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
ckeditor (4.2.4)
|
ckeditor (4.2.4)
|
||||||
@@ -141,18 +152,15 @@ GEM
|
|||||||
delayed_job_active_record (4.1.3)
|
delayed_job_active_record (4.1.3)
|
||||||
activerecord (>= 3.0, < 5.3)
|
activerecord (>= 3.0, < 5.3)
|
||||||
delayed_job (>= 3.0, < 5)
|
delayed_job (>= 3.0, < 5)
|
||||||
devise (3.5.10)
|
devise (4.6.2)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 3.2.6, < 5)
|
railties (>= 4.1.0, < 6.0)
|
||||||
responders
|
responders
|
||||||
thread_safe (~> 0.1)
|
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
devise-async (0.10.2)
|
devise-async (1.0.0)
|
||||||
devise (>= 3.2, < 4.0)
|
activejob (>= 5.0)
|
||||||
devise_security_extension (0.10.0)
|
devise (>= 4.0)
|
||||||
devise (>= 3.0.0, < 4.0)
|
|
||||||
railties (>= 3.2.6, < 5.0)
|
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
docile (1.3.1)
|
docile (1.3.1)
|
||||||
email_spec (2.1.1)
|
email_spec (2.1.1)
|
||||||
@@ -177,9 +185,9 @@ GEM
|
|||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
faker (1.8.7)
|
faker (1.8.7)
|
||||||
i18n (>= 0.7)
|
i18n (>= 0.7)
|
||||||
faraday (0.12.1)
|
faraday (0.12.2)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
ffi (1.9.25)
|
ffi (1.10.0)
|
||||||
foundation-rails (6.4.3.0)
|
foundation-rails (6.4.3.0)
|
||||||
railties (>= 3.1.0)
|
railties (>= 3.1.0)
|
||||||
sass (>= 3.3.0, < 3.5)
|
sass (>= 3.3.0, < 3.5)
|
||||||
@@ -190,12 +198,13 @@ GEM
|
|||||||
activesupport (>= 4.1)
|
activesupport (>= 4.1)
|
||||||
railties (>= 4.1)
|
railties (>= 4.1)
|
||||||
tzinfo (~> 1.2, >= 1.2.2)
|
tzinfo (~> 1.2, >= 1.2.2)
|
||||||
geocoder (1.4.4)
|
geocoder (1.4.5)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
globalize (5.0.1)
|
globalize (5.2.0)
|
||||||
activemodel (>= 4.2.0, < 4.3)
|
activemodel (>= 4.2, < 5.3)
|
||||||
activerecord (>= 4.2.0, < 4.3)
|
activerecord (>= 4.2, < 5.3)
|
||||||
|
request_store (~> 1.0)
|
||||||
globalize-accessors (0.2.1)
|
globalize-accessors (0.2.1)
|
||||||
globalize (~> 5.0, >= 5.0.0)
|
globalize (~> 5.0, >= 5.0.0)
|
||||||
graphiql-rails (1.4.8)
|
graphiql-rails (1.4.8)
|
||||||
@@ -272,6 +281,7 @@ GEM
|
|||||||
kramdown (~> 1.12, >= 1.12.0)
|
kramdown (~> 1.12, >= 1.12.0)
|
||||||
mixlib-cli (~> 1.7, >= 1.7.0)
|
mixlib-cli (~> 1.7, >= 1.7.0)
|
||||||
mixlib-config (~> 2.2, >= 2.2.1)
|
mixlib-config (~> 2.2, >= 2.2.1)
|
||||||
|
method_source (0.9.2)
|
||||||
mime-types (3.1)
|
mime-types (3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2016.0521)
|
mime-types-data (3.2016.0521)
|
||||||
@@ -289,10 +299,11 @@ GEM
|
|||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (5.0.2)
|
net-ssh (5.0.2)
|
||||||
newrelic_rpm (4.1.0.333)
|
newrelic_rpm (4.1.0.333)
|
||||||
nokogiri (1.10.1)
|
nio4r (2.3.1)
|
||||||
|
nokogiri (1.10.2)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
nori (2.6.0)
|
nori (2.6.0)
|
||||||
oauth (0.5.3)
|
oauth (0.5.4)
|
||||||
oauth2 (1.4.0)
|
oauth2 (1.4.0)
|
||||||
faraday (>= 0.8, < 0.13)
|
faraday (>= 0.8, < 0.13)
|
||||||
jwt (~> 1.0)
|
jwt (~> 1.0)
|
||||||
@@ -312,8 +323,8 @@ GEM
|
|||||||
omniauth-oauth (1.1.0)
|
omniauth-oauth (1.1.0)
|
||||||
oauth
|
oauth
|
||||||
omniauth (~> 1.0)
|
omniauth (~> 1.0)
|
||||||
omniauth-oauth2 (1.4.0)
|
omniauth-oauth2 (1.5.0)
|
||||||
oauth2 (~> 1.0)
|
oauth2 (~> 1.1)
|
||||||
omniauth (~> 1.2)
|
omniauth (~> 1.2)
|
||||||
omniauth-twitter (1.4.0)
|
omniauth-twitter (1.4.0)
|
||||||
omniauth-oauth (~> 1.1)
|
omniauth-oauth (~> 1.1)
|
||||||
@@ -337,39 +348,36 @@ GEM
|
|||||||
arel (>= 6)
|
arel (>= 6)
|
||||||
powerpack (0.1.2)
|
powerpack (0.1.2)
|
||||||
public_suffix (3.0.3)
|
public_suffix (3.0.3)
|
||||||
quiet_assets (1.1.0)
|
rack (2.0.6)
|
||||||
railties (>= 3.1, < 5.0)
|
|
||||||
rack (1.6.11)
|
|
||||||
rack-accept (0.4.5)
|
rack-accept (0.4.5)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-attack (5.0.1)
|
rack-attack (5.0.1)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (4.2.11.1)
|
rails (5.0.7.2)
|
||||||
actionmailer (= 4.2.11.1)
|
actioncable (= 5.0.7.2)
|
||||||
actionpack (= 4.2.11.1)
|
actionmailer (= 5.0.7.2)
|
||||||
actionview (= 4.2.11.1)
|
actionpack (= 5.0.7.2)
|
||||||
activejob (= 4.2.11.1)
|
actionview (= 5.0.7.2)
|
||||||
activemodel (= 4.2.11.1)
|
activejob (= 5.0.7.2)
|
||||||
activerecord (= 4.2.11.1)
|
activemodel (= 5.0.7.2)
|
||||||
activesupport (= 4.2.11.1)
|
activerecord (= 5.0.7.2)
|
||||||
bundler (>= 1.3.0, < 2.0)
|
activesupport (= 5.0.7.2)
|
||||||
railties (= 4.2.11.1)
|
bundler (>= 1.3.0)
|
||||||
sprockets-rails
|
railties (= 5.0.7.2)
|
||||||
rails-assets-leaflet (1.1.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
|
rails-assets-leaflet (1.2.0)
|
||||||
rails-assets-markdown-it (8.2.2)
|
rails-assets-markdown-it (8.2.2)
|
||||||
rails-deprecated_sanitizer (1.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0.alpha)
|
activesupport (>= 4.2.0)
|
||||||
rails-dom-testing (1.0.9)
|
nokogiri (>= 1.6)
|
||||||
activesupport (>= 4.2.0, < 5.0)
|
|
||||||
nokogiri (~> 1.6)
|
|
||||||
rails-deprecated_sanitizer (>= 1.0.1)
|
|
||||||
rails-html-sanitizer (1.0.4)
|
rails-html-sanitizer (1.0.4)
|
||||||
loofah (~> 2.2, >= 2.2.2)
|
loofah (~> 2.2, >= 2.2.2)
|
||||||
railties (4.2.11.1)
|
railties (5.0.7.2)
|
||||||
actionpack (= 4.2.11.1)
|
actionpack (= 5.0.7.2)
|
||||||
activesupport (= 4.2.11.1)
|
activesupport (= 5.0.7.2)
|
||||||
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (3.0.0)
|
rainbow (3.0.0)
|
||||||
@@ -377,12 +385,15 @@ GEM
|
|||||||
rake (12.3.2)
|
rake (12.3.2)
|
||||||
recipient_interceptor (0.2.0)
|
recipient_interceptor (0.2.0)
|
||||||
mail
|
mail
|
||||||
|
record_tag_helper (1.0.0)
|
||||||
|
actionview (~> 5.x)
|
||||||
redcarpet (3.4.0)
|
redcarpet (3.4.0)
|
||||||
referer-parser (0.3.0)
|
referer-parser (0.3.0)
|
||||||
request_store (1.3.2)
|
request_store (1.4.0)
|
||||||
responders (2.4.0)
|
rack (>= 1.4)
|
||||||
actionpack (>= 4.2.0, < 5.3)
|
responders (2.4.1)
|
||||||
railties (>= 4.2.0, < 5.3)
|
actionpack (>= 4.2.0, < 6.0)
|
||||||
|
railties (>= 4.2.0, < 6.0)
|
||||||
rinku (2.0.4)
|
rinku (2.0.4)
|
||||||
rollbar (2.18.0)
|
rollbar (2.18.0)
|
||||||
multi_json
|
multi_json
|
||||||
@@ -394,7 +405,7 @@ GEM
|
|||||||
rspec-mocks (3.8.0)
|
rspec-mocks (3.8.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.8.0)
|
||||||
rspec-rails (3.8.1)
|
rspec-rails (3.8.2)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
@@ -437,9 +448,9 @@ GEM
|
|||||||
scss_lint (0.55.0)
|
scss_lint (0.55.0)
|
||||||
rake (>= 0.9, < 13)
|
rake (>= 0.9, < 13)
|
||||||
sass (~> 3.4.20)
|
sass (~> 3.4.20)
|
||||||
selenium-webdriver (3.10.0)
|
selenium-webdriver (3.141.0)
|
||||||
childprocess (~> 0.5)
|
childprocess (~> 0.5)
|
||||||
rubyzip (~> 1.2)
|
rubyzip (~> 1.2, >= 1.2.2)
|
||||||
simplecov (0.16.1)
|
simplecov (0.16.1)
|
||||||
docile (~> 1.1)
|
docile (~> 1.1)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
@@ -478,9 +489,9 @@ GEM
|
|||||||
tilt (2.0.8)
|
tilt (2.0.8)
|
||||||
tins (1.16.3)
|
tins (1.16.3)
|
||||||
tomlrb (1.2.7)
|
tomlrb (1.2.7)
|
||||||
turbolinks (2.5.3)
|
turbolinks (2.5.4)
|
||||||
coffee-rails
|
coffee-rails
|
||||||
turnout (2.4.0)
|
turnout (2.4.1)
|
||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
rack (>= 1.3, < 3)
|
rack (>= 1.3, < 3)
|
||||||
rack-accept (~> 0.4)
|
rack-accept (~> 0.4)
|
||||||
@@ -494,10 +505,10 @@ GEM
|
|||||||
kgio (~> 2.6)
|
kgio (~> 2.6)
|
||||||
raindrops (~> 0.7)
|
raindrops (~> 0.7)
|
||||||
uniform_notifier (1.11.0)
|
uniform_notifier (1.11.0)
|
||||||
user_agent_parser (2.3.1)
|
user_agent_parser (2.4.1)
|
||||||
uuidtools (2.1.5)
|
uuidtools (2.1.5)
|
||||||
warden (1.2.7)
|
warden (1.2.8)
|
||||||
rack (>= 1.0)
|
rack (>= 2.0.6)
|
||||||
wasabi (3.5.0)
|
wasabi (3.5.0)
|
||||||
httpi (~> 2.0)
|
httpi (~> 2.0)
|
||||||
nokogiri (>= 1.4.2)
|
nokogiri (>= 1.4.2)
|
||||||
@@ -505,6 +516,9 @@ GEM
|
|||||||
activemodel (>= 4.2)
|
activemodel (>= 4.2)
|
||||||
debug_inspector
|
debug_inspector
|
||||||
railties (>= 4.2)
|
railties (>= 4.2)
|
||||||
|
websocket-driver (0.6.5)
|
||||||
|
websocket-extensions (>= 0.1.0)
|
||||||
|
websocket-extensions (0.1.3)
|
||||||
whenever (0.10.0)
|
whenever (0.10.0)
|
||||||
chronic (>= 0.6.3)
|
chronic (>= 0.6.3)
|
||||||
wicked_pdf (1.1.0)
|
wicked_pdf (1.1.0)
|
||||||
@@ -539,16 +553,16 @@ DEPENDENCIES
|
|||||||
dalli (~> 2.7.6)
|
dalli (~> 2.7.6)
|
||||||
database_cleaner (~> 1.7.0)
|
database_cleaner (~> 1.7.0)
|
||||||
delayed_job_active_record (~> 4.1.3)
|
delayed_job_active_record (~> 4.1.3)
|
||||||
devise (~> 3.5.7)
|
devise (~> 4.6.0)
|
||||||
devise-async (~> 0.10.2)
|
devise-async (~> 1.0.0)
|
||||||
devise_security_extension (~> 0.10.0)
|
devise_security_extension!
|
||||||
email_spec (~> 2.1.0)
|
email_spec (~> 2.1.0)
|
||||||
erb_lint
|
erb_lint
|
||||||
factory_bot_rails (~> 4.8.2)
|
factory_bot_rails (~> 4.8.2)
|
||||||
faker (~> 1.8.7)
|
faker (~> 1.8.7)
|
||||||
foundation-rails (~> 6.4.3.0)
|
foundation-rails (~> 6.4.3.0)
|
||||||
foundation_rails_helper (~> 2.0.0)
|
foundation_rails_helper (~> 2.0.0)
|
||||||
globalize (~> 5.0.0)
|
globalize (~> 5.2.0)
|
||||||
globalize-accessors (~> 0.2.1)
|
globalize-accessors (~> 0.2.1)
|
||||||
graphiql-rails (~> 1.4.1)
|
graphiql-rails (~> 1.4.1)
|
||||||
graphql (~> 1.7.8)
|
graphql (~> 1.7.8)
|
||||||
@@ -573,11 +587,11 @@ DEPENDENCIES
|
|||||||
paranoia (~> 2.4.1)
|
paranoia (~> 2.4.1)
|
||||||
pg (~> 0.21.0)
|
pg (~> 0.21.0)
|
||||||
pg_search (~> 2.0.1)
|
pg_search (~> 2.0.1)
|
||||||
quiet_assets (~> 1.1.0)
|
rails (= 5.0.7.2)
|
||||||
rails (= 4.2.11.1)
|
|
||||||
rails-assets-leaflet!
|
rails-assets-leaflet!
|
||||||
rails-assets-markdown-it (~> 8.2.1)!
|
rails-assets-markdown-it (~> 8.2.1)!
|
||||||
recipient_interceptor (~> 0.2.0)
|
recipient_interceptor (~> 0.2.0)
|
||||||
|
record_tag_helper (~> 1.0)
|
||||||
redcarpet (~> 3.4.0)
|
redcarpet (~> 3.4.0)
|
||||||
responders (~> 2.4.0)
|
responders (~> 2.4.0)
|
||||||
rinku (~> 2.0.2)
|
rinku (~> 2.0.2)
|
||||||
@@ -589,7 +603,7 @@ DEPENDENCIES
|
|||||||
sass-rails (~> 5.0, >= 5.0.4)
|
sass-rails (~> 5.0, >= 5.0.4)
|
||||||
savon (~> 2.12.0)
|
savon (~> 2.12.0)
|
||||||
scss_lint (~> 0.55.0)
|
scss_lint (~> 0.55.0)
|
||||||
selenium-webdriver (~> 3.10)
|
selenium-webdriver (~> 3.141)
|
||||||
sitemap_generator (~> 6.0.1)
|
sitemap_generator (~> 6.0.1)
|
||||||
social-share-button (~> 1.1)
|
social-share-button (~> 1.1)
|
||||||
spring (~> 2.0.1)
|
spring (~> 2.0.1)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
|||||||
if @investment.update(budget_investment_params)
|
if @investment.update(budget_investment_params)
|
||||||
redirect_to admin_budget_budget_investment_path(@budget,
|
redirect_to admin_budget_budget_investment_path(@budget,
|
||||||
@investment,
|
@investment,
|
||||||
Budget::Investment.filter_params(params)),
|
Budget::Investment.filter_params(params).to_h),
|
||||||
notice: t("flash.actions.update.budget_investment")
|
notice: t("flash.actions.update.budget_investment")
|
||||||
else
|
else
|
||||||
load_admins
|
load_admins
|
||||||
@@ -69,7 +69,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resource_name
|
def resource_name
|
||||||
resource_model.parameterize("_")
|
resource_model.parameterize(separator: "_")
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_investments
|
def load_investments
|
||||||
@@ -107,7 +107,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load_tags
|
def load_tags
|
||||||
@tags = Budget::Investment.tags_on(:valuation).order(:name).uniq
|
@tags = Budget::Investment.tags_on(:valuation).order(:name).distinct
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_ballot
|
def load_ballot
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ class Admin::Legislation::HomepagesController < Admin::Legislation::BaseControll
|
|||||||
def update
|
def update
|
||||||
if @process.update(process_params)
|
if @process.update(process_params)
|
||||||
link = legislation_process_path(@process).html_safe
|
link = legislation_process_path(@process).html_safe
|
||||||
redirect_to :back, notice: t("admin.legislation.processes.update.notice", link: link)
|
redirect_back(fallback_location: (request.referrer || root_path),
|
||||||
|
notice: t("admin.legislation.processes.update.notice", link: link))
|
||||||
else
|
else
|
||||||
flash.now[:error] = t("admin.legislation.processes.update.error")
|
flash.now[:error] = t("admin.legislation.processes.update.error")
|
||||||
render :edit
|
render :edit
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll
|
|||||||
set_tag_list
|
set_tag_list
|
||||||
|
|
||||||
link = legislation_process_path(@process).html_safe
|
link = legislation_process_path(@process).html_safe
|
||||||
redirect_to :back, notice: t("admin.legislation.processes.update.notice", link: link)
|
redirect_back(fallback_location: (request.referrer || root_path),
|
||||||
|
notice: t("admin.legislation.processes.update.notice", link: link))
|
||||||
else
|
else
|
||||||
flash.now[:error] = t("admin.legislation.processes.update.error")
|
flash.now[:error] = t("admin.legislation.processes.update.error")
|
||||||
render :edit
|
render :edit
|
||||||
|
|||||||
@@ -7,13 +7,11 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
before_action :load_geozones, only: [:new, :create, :edit, :update]
|
before_action :load_geozones, only: [:new, :create, :edit, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@polls = Poll.order(starts_at: :desc)
|
@polls = Poll.not_budget.order(starts_at: :desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@poll = Poll.includes(:questions).
|
@poll = Poll.find(params[:id])
|
||||||
order("poll_questions.title").
|
|
||||||
find(params[:id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@@ -22,7 +20,12 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
def create
|
def create
|
||||||
@poll = Poll.new(poll_params.merge(author: current_user))
|
@poll = Poll.new(poll_params.merge(author: current_user))
|
||||||
if @poll.save
|
if @poll.save
|
||||||
redirect_to [:admin, @poll], notice: t("flash.actions.create.poll")
|
notice = t("flash.actions.create.poll")
|
||||||
|
if @poll.budget.present?
|
||||||
|
redirect_to admin_poll_booth_assignments_path(@poll), notice: notice
|
||||||
|
else
|
||||||
|
redirect_to [:admin, @poll], notice: notice
|
||||||
|
end
|
||||||
else
|
else
|
||||||
render :new
|
render :new
|
||||||
end
|
end
|
||||||
@@ -62,8 +65,9 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def poll_params
|
def poll_params
|
||||||
|
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||||
attributes = [:name, :starts_at, :ends_at, :geozone_restricted, :results_enabled,
|
attributes = [:name, :starts_at, :ends_at, :geozone_restricted, :results_enabled,
|
||||||
:stats_enabled, geozone_ids: [],
|
:stats_enabled, :budget_id, geozone_ids: [],
|
||||||
image_attributes: image_attributes]
|
image_attributes: image_attributes]
|
||||||
params.require(:poll).permit(*attributes, translation_params(Poll))
|
params.require(:poll).permit(*attributes, translation_params(Poll))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Admin::Poll::Questions::Answers::VideosController < Admin::Poll::BaseContr
|
|||||||
else
|
else
|
||||||
t("flash.actions.destroy.error")
|
t("flash.actions.destroy.error")
|
||||||
end
|
end
|
||||||
redirect_to :back, notice: notice
|
redirect_back(fallback_location: (request.referrer || root_path), notice: notice)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
|
|||||||
load_and_authorize_resource :question, class: "Poll::Question"
|
load_and_authorize_resource :question, class: "Poll::Question"
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@polls = Poll.all
|
@polls = Poll.not_budget
|
||||||
@search = search_params[:search]
|
@search = search_params[:search]
|
||||||
|
|
||||||
@questions = @questions.search(search_params).page(params[:page]).order("created_at DESC")
|
@questions = @questions.search(search_params).page(params[:page]).order("created_at DESC")
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Admin::SiteCustomization::InformationTextsController < Admin::SiteCustomiz
|
|||||||
.keys
|
.keys
|
||||||
|
|
||||||
languages_to_delete.each do |locale|
|
languages_to_delete.each do |locale|
|
||||||
I18nContentTranslation.destroy_all(locale: locale)
|
I18nContentTranslation.where(locale: locale).destroy_all
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class Admin::SpendingProposalsController < Admin::BaseController
|
class Admin::SpendingProposalsController < Admin::BaseController
|
||||||
include FeatureFlags
|
include FeatureFlags
|
||||||
|
before_action :load_filter_params
|
||||||
feature_flag :spending_proposals
|
feature_flag :spending_proposals
|
||||||
|
|
||||||
has_filters %w{valuation_open without_admin managed valuating valuation_finished all}, only: :index
|
has_filters %w{valuation_open without_admin managed valuating valuation_finished all}, only: :index
|
||||||
@@ -7,7 +8,7 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
|||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@spending_proposals = SpendingProposal.scoped_filter(params, @current_filter)
|
@spending_proposals = SpendingProposal.scoped_filter(filter_params, @current_filter)
|
||||||
.order(cached_votes_up: :desc, created_at: :desc)
|
.order(cached_votes_up: :desc, created_at: :desc)
|
||||||
.page(params[:page])
|
.page(params[:page])
|
||||||
end
|
end
|
||||||
@@ -23,7 +24,7 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @spending_proposal.update(spending_proposal_params)
|
if @spending_proposal.update(spending_proposal_params)
|
||||||
redirect_to admin_spending_proposal_path(@spending_proposal, SpendingProposal.filter_params(params)),
|
redirect_to admin_spending_proposal_path(@spending_proposal, filter_params),
|
||||||
notice: t("flash.actions.update.spending_proposal")
|
notice: t("flash.actions.update.spending_proposal")
|
||||||
else
|
else
|
||||||
load_admins
|
load_admins
|
||||||
@@ -46,6 +47,14 @@ class Admin::SpendingProposalsController < Admin::BaseController
|
|||||||
:administrator_id, :tag_list, valuator_ids: [])
|
:administrator_id, :tag_list, valuator_ids: [])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def filter_params
|
||||||
|
params.permit(:geozone_id, :administrator_id, :tag_name, :valuator_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_filter_params
|
||||||
|
@filter_params ||= filter_params
|
||||||
|
end
|
||||||
|
|
||||||
def load_admins
|
def load_admins
|
||||||
@admins = Administrator.includes(:user).all
|
@admins = Administrator.includes(:user).all
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Admin::Widget::FeedsController < Admin::BaseController
|
|||||||
@feed = ::Widget::Feed.find(params[:id])
|
@feed = ::Widget::Feed.find(params[:id])
|
||||||
@feed.update(feed_params)
|
@feed.update(feed_params)
|
||||||
|
|
||||||
render nothing: true
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base
|
|||||||
before_action :set_locale
|
before_action :set_locale
|
||||||
before_action :track_email_campaign
|
before_action :track_email_campaign
|
||||||
before_action :set_return_url
|
before_action :set_return_url
|
||||||
|
before_action :set_fallbacks_to_all_available_locales
|
||||||
|
|
||||||
check_authorization unless: :devise_controller?
|
check_authorization unless: :devise_controller?
|
||||||
self.responder = ApplicationResponder
|
self.responder = ApplicationResponder
|
||||||
@@ -128,4 +129,8 @@ class ApplicationController < ActionController::Base
|
|||||||
def current_budget
|
def current_budget
|
||||||
Budget.current
|
Budget.current
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_fallbacks_to_all_available_locales
|
||||||
|
Globalize.set_fallbacks_to_all_available_locales
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module Budgets
|
|||||||
.group_by(&:heading)
|
.group_by(&:heading)
|
||||||
else
|
else
|
||||||
@budget.investments.winners
|
@budget.investments.winners
|
||||||
.joins(:milestones).includes(:milestones)
|
.joins(milestones: :translations)
|
||||||
.distinct.group_by(&:heading)
|
.distinct.group_by(&:heading)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class FollowsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def followable_translation_key(followable)
|
def followable_translation_key(followable)
|
||||||
followable.class.name.parameterize("_")
|
followable.class.name.parameterize(separator: "_")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::AnnotationsController < ApplicationController
|
class Legislation::AnnotationsController < Legislation::BaseController
|
||||||
skip_before_action :verify_authenticity_token
|
skip_before_action :verify_authenticity_token
|
||||||
|
|
||||||
before_action :authenticate_user!, only: [:create, :new_comment]
|
before_action :authenticate_user!, only: [:create, :new_comment]
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Management::DocumentVerificationsController < Management::BaseController
|
|||||||
elsif @document_verification.user?
|
elsif @document_verification.user?
|
||||||
render :new
|
render :new
|
||||||
elsif @document_verification.in_census?
|
elsif @document_verification.in_census?
|
||||||
redirect_to new_management_email_verification_path(email_verification: document_verification_params)
|
redirect_to new_management_email_verification_path(email_verification: document_verification_params.to_h)
|
||||||
else
|
else
|
||||||
render :invalid_document
|
render :invalid_document
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Management::UsersController < Management::BaseController
|
|||||||
@user.residence_verified_at = Time.current
|
@user.residence_verified_at = Time.current
|
||||||
@user.verified_at = Time.current
|
@user.verified_at = Time.current
|
||||||
|
|
||||||
if @user.save then
|
if @user.save
|
||||||
render :show
|
render :show
|
||||||
else
|
else
|
||||||
render :new
|
render :new
|
||||||
|
|||||||
70
app/controllers/officing/ballot_sheets_controller.rb
Normal file
70
app/controllers/officing/ballot_sheets_controller.rb
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
class Officing::BallotSheetsController < Officing::BaseController
|
||||||
|
|
||||||
|
before_action :verify_booth
|
||||||
|
before_action :load_poll
|
||||||
|
before_action :load_officer_assignments, only: [:new, :create]
|
||||||
|
|
||||||
|
helper_method :namespace
|
||||||
|
|
||||||
|
def index
|
||||||
|
load_ballot_sheets
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
load_ballot_sheet
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
load_officer_assignment
|
||||||
|
|
||||||
|
@ballot_sheet = Poll::BallotSheet.new(ballot_sheet_params)
|
||||||
|
|
||||||
|
if @ballot_sheet.save
|
||||||
|
redirect_to officing_poll_ballot_sheet_path(@poll, @ballot_sheet)
|
||||||
|
else
|
||||||
|
flash.now[:alert] = @ballot_sheet.errors.full_messages.join(", ")
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def namespace
|
||||||
|
"officing"
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_poll
|
||||||
|
@poll = Poll.find(params[:poll_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_ballot_sheets
|
||||||
|
@ballot_sheets = Poll::BallotSheet.where(poll: @poll)
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_ballot_sheet
|
||||||
|
@ballot_sheet = Poll::BallotSheet.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_officer_assignments
|
||||||
|
@officer_assignments = ::Poll::OfficerAssignment.
|
||||||
|
includes(booth_assignment: [:booth]).
|
||||||
|
joins(:booth_assignment).
|
||||||
|
final.
|
||||||
|
where(id: current_user.poll_officer.officer_assignment_ids).
|
||||||
|
where("poll_booth_assignments.poll_id = ?", @poll.id).
|
||||||
|
where(date: Date.current)
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_officer_assignment
|
||||||
|
@officer_assignment = current_user.poll_officer.officer_assignments.final
|
||||||
|
.find_by(id: ballot_sheet_params[:officer_assignment_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def ballot_sheet_params
|
||||||
|
params.permit(:data, :poll_id, :officer_assignment_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -13,6 +13,12 @@ class Officing::BaseController < ApplicationController
|
|||||||
raise CanCan::AccessDenied unless current_user.try(:poll_officer?)
|
raise CanCan::AccessDenied unless current_user.try(:poll_officer?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_officer_assignment
|
||||||
|
if @officer_assignment.blank?
|
||||||
|
go_back_to_new(t("officing.results.flash.error_wrong_booth"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def load_officer_assignment
|
def load_officer_assignment
|
||||||
@officer_assignments ||= current_user.poll_officer.
|
@officer_assignments ||= current_user.poll_officer.
|
||||||
officer_assignments.
|
officer_assignments.
|
||||||
|
|||||||
@@ -33,12 +33,6 @@ class Officing::ResultsController < Officing::BaseController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_officer_assignment
|
|
||||||
if @officer_assignment.blank?
|
|
||||||
go_back_to_new(t("officing.results.flash.error_wrong_booth"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_results
|
def build_results
|
||||||
@results = []
|
@results = []
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class PollsController < ApplicationController
|
|||||||
::Poll::Answer # trigger autoload
|
::Poll::Answer # trigger autoload
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@polls = @polls.public_polls.send(@current_filter).includes(:geozones)
|
@polls = @polls.not_budget.public_polls.send(@current_filter).includes(:geozones)
|
||||||
.sort_for_list.page(params[:page])
|
.sort_for_list.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Users::ConfirmationsController < Devise::ConfirmationsController
|
|||||||
def show
|
def show
|
||||||
# In the default implementation, this already confirms the resource:
|
# In the default implementation, this already confirms the resource:
|
||||||
# self.resource = self.resource = resource_class.confirm_by_token(params[:confirmation_token])
|
# self.resource = self.resource = resource_class.confirm_by_token(params[:confirmation_token])
|
||||||
self.resource = resource_class.find_by(confirmation_token: params[:confirmation_token])
|
self.resource = resource_class.find_by!(confirmation_token: params[:confirmation_token])
|
||||||
|
|
||||||
yield resource if block_given?
|
yield resource if block_given?
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||||||
def sign_in_with(feature, provider)
|
def sign_in_with(feature, provider)
|
||||||
raise ActionController::RoutingError.new("Not Found") unless Setting["feature.#{feature}"]
|
raise ActionController::RoutingError.new("Not Found") unless Setting["feature.#{feature}"]
|
||||||
|
|
||||||
auth = env["omniauth.auth"]
|
auth = request.env["omniauth.auth"]
|
||||||
|
|
||||||
identity = Identity.first_or_create_from_oauth(auth)
|
identity = Identity.first_or_create_from_oauth(auth)
|
||||||
@user = current_user || identity.user || User.first_or_initialize_for_oauth(auth)
|
@user = current_user || identity.user || User.first_or_initialize_for_oauth(auth)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Users::RegistrationsController < Devise::RegistrationsController
|
class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy, :finish_signup, :do_finish_signup]
|
prepend_before_action :authenticate_scope!, only: [:edit, :update, :destroy, :finish_signup, :do_finish_signup]
|
||||||
before_filter :configure_permitted_parameters
|
before_action :configure_permitted_parameters
|
||||||
|
|
||||||
invisible_captcha only: [:create], honeypot: :address, scope: :user
|
invisible_captcha only: [:create], honeypot: :address, scope: :user
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def configure_permitted_parameters
|
def configure_permitted_parameters
|
||||||
devise_parameter_sanitizer.for(:account_update).push(:email)
|
devise_parameter_sanitizer.permit(:account_update, keys: [:email])
|
||||||
end
|
end
|
||||||
|
|
||||||
def erase_params
|
def erase_params
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def resource_name
|
def resource_name
|
||||||
resource_model.parameterize("_")
|
resource_model.parameterize(separator: "_")
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_budget
|
def load_budget
|
||||||
@@ -97,8 +97,8 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def params_for_current_valuator
|
def params_for_current_valuator
|
||||||
Budget::Investment.filter_params(params).merge(valuator_id: current_user.valuator.id,
|
Budget::Investment.filter_params(params).to_h.merge({ valuator_id: current_user.valuator.id,
|
||||||
budget_id: @budget.id)
|
budget_id: @budget.id })
|
||||||
end
|
end
|
||||||
|
|
||||||
def valuation_params
|
def valuation_params
|
||||||
|
|||||||
@@ -72,4 +72,8 @@ module ApplicationHelper
|
|||||||
render custom_partial_path if lookup_context.exists?(custom_partial_path, [], true)
|
render custom_partial_path if lookup_context.exists?(custom_partial_path, [], true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def management_controller?
|
||||||
|
controller.class.to_s.include?("Management")
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ module BudgetsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def csv_params
|
def csv_params
|
||||||
csv_params = params.clone.merge(format: :csv).symbolize_keys
|
csv_params = params.clone.merge(format: :csv)
|
||||||
|
csv_params = csv_params.to_unsafe_h.map { |k, v| [k.to_sym, v] }.to_h
|
||||||
csv_params.delete(:page)
|
csv_params.delete(:page)
|
||||||
csv_params
|
csv_params
|
||||||
end
|
end
|
||||||
@@ -96,4 +97,16 @@ module BudgetsHelper
|
|||||||
!current_user.voted_in_group?(investment.group) &&
|
!current_user.voted_in_group?(investment.group) &&
|
||||||
investment.group.headings.count > 1
|
investment.group.headings.count > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_to_create_budget_poll(budget)
|
||||||
|
balloting_phase = budget.phases.where(kind: "balloting").first
|
||||||
|
|
||||||
|
link_to t("admin.budgets.index.admin_ballots"),
|
||||||
|
admin_polls_path(poll: {
|
||||||
|
name: budget.name,
|
||||||
|
budget_id: budget.id,
|
||||||
|
starts_at: balloting_phase.starts_at,
|
||||||
|
ends_at: balloting_phase.ends_at }),
|
||||||
|
method: :post
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
module DocumentablesHelper
|
module DocumentablesHelper
|
||||||
|
|
||||||
def documentable_class(documentable)
|
def documentable_class(documentable)
|
||||||
documentable.class.name.parameterize("_")
|
documentable.class.name.parameterize(separator: "_")
|
||||||
end
|
end
|
||||||
|
|
||||||
def max_documents_allowed(documentable)
|
def max_documents_allowed(documentable)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module FollowablesHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def followable_class_name(followable)
|
def followable_class_name(followable)
|
||||||
followable.class.to_s.parameterize("_")
|
followable.class.to_s.parameterize(separator: "_")
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_or_build_follow(user, followable)
|
def find_or_build_follow(user, followable)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ module GlobalizeHelper
|
|||||||
|
|
||||||
def display_translation?(resource, locale)
|
def display_translation?(resource, locale)
|
||||||
if !resource || resource.translations.blank? ||
|
if !resource || resource.translations.blank? ||
|
||||||
resource.translations.map(&:locale).include?(I18n.locale)
|
resource.locales_not_marked_for_destruction.include?(I18n.locale)
|
||||||
locale == I18n.locale
|
locale == I18n.locale
|
||||||
else
|
else
|
||||||
locale == resource.translations.first.locale
|
locale == resource.translations.first.locale
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ module ImageablesHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def imageable_class(imageable)
|
def imageable_class(imageable)
|
||||||
imageable.class.name.parameterize("_")
|
imageable.class.name.parameterize(separator: "_")
|
||||||
end
|
end
|
||||||
|
|
||||||
def imageable_max_file_size
|
def imageable_max_file_size
|
||||||
|
|||||||
@@ -6,7 +6,13 @@ module TranslatableFormHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
class TranslatableFormBuilder < FoundationRailsHelper::FormBuilder
|
class TranslatableFormBuilder < FoundationRailsHelper::FormBuilder
|
||||||
|
attr_accessor :translations
|
||||||
|
|
||||||
def translatable_fields(&block)
|
def translatable_fields(&block)
|
||||||
|
@translations = {}
|
||||||
|
@object.globalize_locales.map do |locale|
|
||||||
|
@translations[locale] = translation_for(locale)
|
||||||
|
end
|
||||||
@object.globalize_locales.map do |locale|
|
@object.globalize_locales.map do |locale|
|
||||||
Globalize.with_locale(locale) { fields_for_locale(locale, &block) }
|
Globalize.with_locale(locale) { fields_for_locale(locale, &block) }
|
||||||
end.join.html_safe
|
end.join.html_safe
|
||||||
@@ -15,7 +21,7 @@ module TranslatableFormHelper
|
|||||||
private
|
private
|
||||||
|
|
||||||
def fields_for_locale(locale, &block)
|
def fields_for_locale(locale, &block)
|
||||||
fields_for_translation(translation_for(locale)) do |translations_form|
|
fields_for_translation(@translations[locale]) do |translations_form|
|
||||||
@template.content_tag :div, translations_options(translations_form.object, locale) do
|
@template.content_tag :div, translations_options(translations_form.object, locale) do
|
||||||
@template.concat translations_form.hidden_field(
|
@template.concat translations_form.hidden_field(
|
||||||
:_destroy,
|
:_destroy,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class ActivePoll < ActiveRecord::Base
|
class ActivePoll < ApplicationRecord
|
||||||
include Measurable
|
include Measurable
|
||||||
|
|
||||||
translates :description, touch: true
|
translates :description, touch: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Activity < ActiveRecord::Base
|
class Activity < ApplicationRecord
|
||||||
belongs_to :actionable, -> { with_hidden }, polymorphic: true
|
belongs_to :actionable, -> { with_hidden }, polymorphic: true
|
||||||
belongs_to :user, -> { with_hidden }
|
belongs_to :user, -> { with_hidden }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class AdminNotification < ActiveRecord::Base
|
class AdminNotification < ApplicationRecord
|
||||||
include Notifiable
|
include Notifiable
|
||||||
|
|
||||||
translates :title, touch: true
|
translates :title, touch: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Administrator < ActiveRecord::Base
|
class Administrator < ApplicationRecord
|
||||||
belongs_to :user, touch: true
|
belongs_to :user, touch: true
|
||||||
delegate :name, :email, :name_and_email, to: :user
|
delegate :name, :email, :name_and_email, to: :user
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Ahoy
|
module Ahoy
|
||||||
class Event < ActiveRecord::Base
|
class Event < ApplicationRecord
|
||||||
self.table_name = "ahoy_events"
|
self.table_name = "ahoy_events"
|
||||||
|
|
||||||
belongs_to :visit
|
belongs_to :visit
|
||||||
|
|||||||
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
|
self.abstract_class = true
|
||||||
|
end
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
class Banner < ActiveRecord::Base
|
class Banner < ApplicationRecord
|
||||||
|
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Banner::Section < ActiveRecord::Base
|
class Banner::Section < ApplicationRecord
|
||||||
belongs_to :banner
|
belongs_to :banner
|
||||||
belongs_to :web_section
|
belongs_to :web_section
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Budget < ActiveRecord::Base
|
class Budget < ApplicationRecord
|
||||||
|
|
||||||
include Measurable
|
include Measurable
|
||||||
include Sluggable
|
include Sluggable
|
||||||
@@ -6,6 +6,18 @@ class Budget < ActiveRecord::Base
|
|||||||
translates :name, touch: true
|
translates :name, touch: true
|
||||||
include Globalizable
|
include Globalizable
|
||||||
|
|
||||||
|
class Translation
|
||||||
|
validate :name_uniqueness_by_budget
|
||||||
|
|
||||||
|
def name_uniqueness_by_budget
|
||||||
|
if Budget.joins(:translations)
|
||||||
|
.where(name: name)
|
||||||
|
.where.not("budget_translations.budget_id": budget_id).any?
|
||||||
|
errors.add(:name, I18n.t("errors.messages.taken"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze
|
CURRENCY_SYMBOLS = %w(€ $ £ ¥).freeze
|
||||||
|
|
||||||
before_validation :assign_model_to_translations
|
before_validation :assign_model_to_translations
|
||||||
@@ -21,6 +33,8 @@ class Budget < ActiveRecord::Base
|
|||||||
has_many :headings, through: :groups
|
has_many :headings, through: :groups
|
||||||
has_many :phases, class_name: Budget::Phase
|
has_many :phases, class_name: Budget::Phase
|
||||||
|
|
||||||
|
has_one :poll
|
||||||
|
|
||||||
before_validation :sanitize_descriptions
|
before_validation :sanitize_descriptions
|
||||||
|
|
||||||
after_create :generate_phases
|
after_create :generate_phases
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class Ballot < ActiveRecord::Base
|
class Ballot < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :budget
|
belongs_to :budget
|
||||||
|
belongs_to :poll_ballot, class_name: "Poll::Ballot"
|
||||||
|
|
||||||
has_many :lines, dependent: :destroy
|
has_many :lines, dependent: :destroy
|
||||||
has_many :investments, through: :lines
|
has_many :investments, through: :lines
|
||||||
has_many :groups, -> { uniq }, through: :lines
|
has_many :groups, -> { distinct }, through: :lines
|
||||||
has_many :headings, -> { uniq }, through: :groups
|
has_many :headings, -> { distinct }, through: :groups
|
||||||
|
|
||||||
def add_investment(investment)
|
def add_investment(investment)
|
||||||
lines.create(investment: investment).persisted?
|
lines.create(investment: investment).persisted?
|
||||||
@@ -70,5 +71,9 @@ class Budget
|
|||||||
investments.where(group: group).first.heading
|
investments.where(group: group).first.heading
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def casted_offline?
|
||||||
|
budget.poll&.voted_by?(user)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class Ballot
|
class Ballot
|
||||||
class Line < ActiveRecord::Base
|
class Line < ApplicationRecord
|
||||||
belongs_to :ballot
|
belongs_to :ballot
|
||||||
belongs_to :investment, counter_cache: :ballot_lines_count
|
belongs_to :investment, counter_cache: :ballot_lines_count
|
||||||
belongs_to :heading
|
belongs_to :heading
|
||||||
@@ -16,6 +16,7 @@ class Budget
|
|||||||
scope :by_investment, ->(investment_id) { where(investment_id: investment_id) }
|
scope :by_investment, ->(investment_id) { where(investment_id: investment_id) }
|
||||||
|
|
||||||
before_validation :set_denormalized_ids
|
before_validation :set_denormalized_ids
|
||||||
|
after_save :store_user_heading
|
||||||
|
|
||||||
def check_sufficient_funds
|
def check_sufficient_funds
|
||||||
errors.add(:money, "insufficient funds") if ballot.amount_available(investment.heading) < investment.price.to_i
|
errors.add(:money, "insufficient funds") if ballot.amount_available(investment.heading) < investment.price.to_i
|
||||||
@@ -37,6 +38,10 @@ class Budget
|
|||||||
self.group_id ||= investment.try(:group_id)
|
self.group_id ||= investment.try(:group_id)
|
||||||
self.budget_id ||= investment.try(:budget_id)
|
self.budget_id ||= investment.try(:budget_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def store_user_heading
|
||||||
|
ballot.user.update(balloted_heading_id: heading.id) unless ballot.physical == true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class ContentBlock < ActiveRecord::Base
|
class ContentBlock < ApplicationRecord
|
||||||
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
|
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
|
||||||
validates :heading, presence: true
|
validates :heading, presence: true
|
||||||
validates_uniqueness_of :heading, scope: :locale
|
validates_uniqueness_of :heading, scope: :locale
|
||||||
|
|||||||
@@ -1,9 +1,22 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class Group < ActiveRecord::Base
|
class Group < ApplicationRecord
|
||||||
include Sluggable
|
include Sluggable
|
||||||
|
|
||||||
translates :name, touch: true
|
translates :name, touch: true
|
||||||
include Globalizable
|
include Globalizable
|
||||||
|
translation_class_delegate :budget
|
||||||
|
|
||||||
|
class Translation
|
||||||
|
validate :name_uniqueness_by_budget
|
||||||
|
|
||||||
|
def name_uniqueness_by_budget
|
||||||
|
if budget.groups.joins(:translations)
|
||||||
|
.where(name: name)
|
||||||
|
.where.not("budget_group_translations.budget_group_id": budget_group_id).any?
|
||||||
|
errors.add(:name, I18n.t("errors.messages.taken"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
belongs_to :budget
|
belongs_to :budget
|
||||||
|
|
||||||
@@ -15,7 +28,7 @@ class Budget
|
|||||||
validates :budget_id, presence: true
|
validates :budget_id, presence: true
|
||||||
validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/
|
validates :slug, presence: true, format: /\A[a-z0-9\-_]+\z/
|
||||||
|
|
||||||
scope :sort_by_name, -> { includes(:translations).order(:name) }
|
scope :sort_by_name, -> { joins(:translations).order(:name) }
|
||||||
|
|
||||||
def single_heading_group?
|
def single_heading_group?
|
||||||
headings.count == 1
|
headings.count == 1
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
class Budget::Group::Translation < Globalize::ActiveRecord::Translation
|
|
||||||
delegate :budget, to: :globalized_model
|
|
||||||
|
|
||||||
validate :name_uniqueness_by_budget
|
|
||||||
|
|
||||||
def name_uniqueness_by_budget
|
|
||||||
if budget.groups.joins(:translations)
|
|
||||||
.where(name: name)
|
|
||||||
.where.not("budget_group_translations.budget_group_id": budget_group_id).any?
|
|
||||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,11 +1,25 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class Heading < ActiveRecord::Base
|
class Heading < ApplicationRecord
|
||||||
OSM_DISTRICT_LEVEL_ZOOM = 12.freeze
|
OSM_DISTRICT_LEVEL_ZOOM = 12.freeze
|
||||||
|
|
||||||
include Sluggable
|
include Sluggable
|
||||||
|
|
||||||
translates :name, touch: true
|
translates :name, touch: true
|
||||||
include Globalizable
|
include Globalizable
|
||||||
|
translation_class_delegate :budget
|
||||||
|
|
||||||
|
class Translation
|
||||||
|
validate :name_uniqueness_by_budget
|
||||||
|
|
||||||
|
def name_uniqueness_by_budget
|
||||||
|
if budget.headings
|
||||||
|
.joins(:translations)
|
||||||
|
.where(name: name)
|
||||||
|
.where.not("budget_heading_translations.budget_heading_id": budget_heading_id).any?
|
||||||
|
errors.add(:name, I18n.t("errors.messages.taken"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
|
|
||||||
@@ -26,8 +40,8 @@ class Budget
|
|||||||
|
|
||||||
delegate :budget, :budget_id, to: :group, allow_nil: true
|
delegate :budget, :budget_id, to: :group, allow_nil: true
|
||||||
|
|
||||||
scope :i18n, -> { includes(:translations) }
|
scope :i18n, -> { joins(:translations) }
|
||||||
scope :allow_custom_content, -> { i18n.where(allow_custom_content: true).order(:name) }
|
scope :allow_custom_content, -> { i18n.where(allow_custom_content: true).order("budget_heading_translations.name") }
|
||||||
|
|
||||||
def self.sort_by_name
|
def self.sort_by_name
|
||||||
all.sort do |heading, other_heading|
|
all.sort do |heading, other_heading|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
class Budget::Heading::Translation < Globalize::ActiveRecord::Translation
|
|
||||||
delegate :budget, to: :globalized_model
|
|
||||||
|
|
||||||
validate :name_uniqueness_by_budget
|
|
||||||
|
|
||||||
def name_uniqueness_by_budget
|
|
||||||
if budget.headings
|
|
||||||
.joins(:translations)
|
|
||||||
.where(name: name)
|
|
||||||
.where.not("budget_heading_translations.budget_heading_id": budget_heading_id).any?
|
|
||||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class Investment < ActiveRecord::Base
|
class Investment < ApplicationRecord
|
||||||
SORTING_OPTIONS = {id: "id", title: "title", supports: "cached_votes_up"}.freeze
|
SORTING_OPTIONS = {id: "id", title: "title", supports: "cached_votes_up"}.freeze
|
||||||
|
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
@@ -109,7 +109,7 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.filter_params(params)
|
def self.filter_params(params)
|
||||||
params.select{ |x, _| %w{heading_id group_id administrator_id tag_name valuator_id}.include?(x.to_s) }
|
params.permit(%i[heading_id group_id administrator_id tag_name valuator_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.scoped_filter(params, current_filter)
|
def self.scoped_filter(params, current_filter)
|
||||||
@@ -248,6 +248,7 @@ class Budget
|
|||||||
return :no_ballots_allowed unless budget.balloting?
|
return :no_ballots_allowed unless budget.balloting?
|
||||||
return :different_heading_assigned_html unless ballot.valid_heading?(heading)
|
return :different_heading_assigned_html unless ballot.valid_heading?(heading)
|
||||||
return :not_enough_money_html if ballot.present? && !enough_money?(ballot)
|
return :not_enough_money_html if ballot.present? && !enough_money?(ballot)
|
||||||
|
return :casted_offline if ballot.casted_offline?
|
||||||
end
|
end
|
||||||
|
|
||||||
def permission_problem(user)
|
def permission_problem(user)
|
||||||
@@ -367,7 +368,7 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.with_milestone_status_id(status_id)
|
def self.with_milestone_status_id(status_id)
|
||||||
joins(:milestones).includes(:milestones).select do |investment|
|
includes(milestones: :translations).select do |investment|
|
||||||
investment.milestone_status_id == status_id.to_i
|
investment.milestone_status_id == status_id.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class Phase < ActiveRecord::Base
|
class Phase < ApplicationRecord
|
||||||
PHASE_KINDS = %w(drafting informing accepting reviewing selecting valuating publishing_prices balloting
|
PHASE_KINDS = %w(drafting informing accepting reviewing selecting valuating publishing_prices balloting
|
||||||
reviewing_ballots finished).freeze
|
reviewing_ballots finished).freeze
|
||||||
PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze
|
PUBLISHED_PRICES_PHASES = %w(publishing_prices balloting reviewing_ballots finished).freeze
|
||||||
@@ -9,6 +9,7 @@ class Budget
|
|||||||
translates :summary, touch: true
|
translates :summary, touch: true
|
||||||
translates :description, touch: true
|
translates :description, touch: true
|
||||||
include Globalizable
|
include Globalizable
|
||||||
|
include Sanitizable
|
||||||
|
|
||||||
belongs_to :budget
|
belongs_to :budget
|
||||||
belongs_to :next_phase, class_name: "Budget::Phase", foreign_key: :next_phase_id
|
belongs_to :next_phase, class_name: "Budget::Phase", foreign_key: :next_phase_id
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
class Budget::Phase::Translation < Globalize::ActiveRecord::Translation
|
|
||||||
before_validation :sanitize_description
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def sanitize_description
|
|
||||||
self.description = WYSIWYGSanitizer.new.sanitize(description)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class ReclassifiedVote < ActiveRecord::Base
|
class ReclassifiedVote < ApplicationRecord
|
||||||
REASONS = %w(heading_changed unfeasible)
|
REASONS = %w(heading_changed unfeasible)
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
class Budget::Translation < Globalize::ActiveRecord::Translation
|
|
||||||
validate :name_uniqueness_by_budget
|
|
||||||
|
|
||||||
def name_uniqueness_by_budget
|
|
||||||
if Budget.joins(:translations)
|
|
||||||
.where(name: name)
|
|
||||||
.where.not("budget_translations.budget_id": budget_id).any?
|
|
||||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class ValuatorAssignment < ActiveRecord::Base
|
class ValuatorAssignment < ApplicationRecord
|
||||||
belongs_to :valuator, counter_cache: :budget_investments_count
|
belongs_to :valuator, counter_cache: :budget_investments_count
|
||||||
belongs_to :investment, counter_cache: true
|
belongs_to :investment, counter_cache: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Budget
|
class Budget
|
||||||
class ValuatorGroupAssignment < ActiveRecord::Base
|
class ValuatorGroupAssignment < ApplicationRecord
|
||||||
belongs_to :valuator_group, counter_cache: :budget_investments_count
|
belongs_to :valuator_group, counter_cache: :budget_investments_count
|
||||||
belongs_to :investment, counter_cache: true
|
belongs_to :investment, counter_cache: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
class Campaign < ActiveRecord::Base
|
class Campaign < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Ckeditor::Asset < ActiveRecord::Base
|
class Ckeditor::Asset < ApplicationRecord
|
||||||
include Ckeditor::Orm::ActiveRecord::AssetBase
|
include Ckeditor::Orm::ActiveRecord::AssetBase
|
||||||
include Ckeditor::Backend::Paperclip
|
include Ckeditor::Backend::Paperclip
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Comment < ActiveRecord::Base
|
class Comment < ApplicationRecord
|
||||||
include Flaggable
|
include Flaggable
|
||||||
include HasPublicAuthor
|
include HasPublicAuthor
|
||||||
include Graphqlable
|
include Graphqlable
|
||||||
@@ -22,7 +22,7 @@ class Comment < ActiveRecord::Base
|
|||||||
validate :validate_body_length
|
validate :validate_body_length
|
||||||
validate :comment_valuation, if: -> { valuation }
|
validate :comment_valuation, if: -> { valuation }
|
||||||
|
|
||||||
belongs_to :commentable, -> { with_hidden }, polymorphic: true, counter_cache: true
|
belongs_to :commentable, -> { with_hidden }, polymorphic: true, counter_cache: true, touch: true
|
||||||
belongs_to :user, -> { with_hidden }
|
belongs_to :user, -> { with_hidden }
|
||||||
|
|
||||||
before_save :calculate_confidence_score
|
before_save :calculate_confidence_score
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Community < ActiveRecord::Base
|
class Community < ApplicationRecord
|
||||||
has_one :proposal
|
has_one :proposal
|
||||||
has_one :investment, class_name: Budget::Investment
|
has_one :investment, class_name: Budget::Investment
|
||||||
has_many :topics
|
has_many :topics
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module Galleryable
|
|||||||
accepts_nested_attributes_for :images, allow_destroy: true, update_only: true
|
accepts_nested_attributes_for :images, allow_destroy: true, update_only: true
|
||||||
|
|
||||||
def image_url(style)
|
def image_url(style)
|
||||||
image.attachment.url(style) if image && image.attachment.exists?
|
image&.attachment&.url(style) || ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -12,6 +12,10 @@ module Globalizable
|
|||||||
def assign_model_to_translations
|
def assign_model_to_translations
|
||||||
translations.each { |translation| translation.globalized_model = self }
|
translations.each { |translation| translation.globalized_model = self }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def description
|
||||||
|
self.read_attribute(:description).try :html_safe
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
@@ -19,5 +23,9 @@ module Globalizable
|
|||||||
validates(method, options.merge(if: lambda { |resource| resource.translations.blank? }))
|
validates(method, options.merge(if: lambda { |resource| resource.translations.blank? }))
|
||||||
translation_class.instance_eval { validates method, options }
|
translation_class.instance_eval { validates method, options }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def translation_class_delegate(method)
|
||||||
|
translation_class.instance_eval { delegate method, to: :globalized_model }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module Imageable
|
|||||||
accepts_nested_attributes_for :image, allow_destroy: true, update_only: true
|
accepts_nested_attributes_for :image, allow_destroy: true, update_only: true
|
||||||
|
|
||||||
def image_url(style)
|
def image_url(style)
|
||||||
image.attachment.url(style) if image && image.attachment.exists?
|
image&.attachment&.url(style) || ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module Randomizable
|
|||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
def sort_by_random(seed = rand(10_000_000))
|
def sort_by_random(seed = rand(10_000_000))
|
||||||
ids = pluck(:id).shuffle(random: Random.new(seed))
|
ids = order(:id).pluck(:id).shuffle(random: Random.new(seed))
|
||||||
|
|
||||||
return all if ids.empty?
|
return all if ids.empty?
|
||||||
|
|
||||||
|
|||||||
@@ -4,20 +4,47 @@ module Sanitizable
|
|||||||
included do
|
included do
|
||||||
before_validation :sanitize_description
|
before_validation :sanitize_description
|
||||||
before_validation :sanitize_tag_list
|
before_validation :sanitize_tag_list
|
||||||
end
|
|
||||||
|
|
||||||
|
unless included_modules.include? Globalizable
|
||||||
def description
|
def description
|
||||||
super.try :html_safe
|
super.try :html_safe
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def sanitize_description
|
def sanitize_description
|
||||||
|
if translatable_description?
|
||||||
|
sanitize_description_translations
|
||||||
|
else
|
||||||
self.description = WYSIWYGSanitizer.new.sanitize(description)
|
self.description = WYSIWYGSanitizer.new.sanitize(description)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def sanitize_tag_list
|
def sanitize_tag_list
|
||||||
self.tag_list = TagSanitizer.new.sanitize_tag_list(tag_list) if self.class.taggable?
|
self.tag_list = TagSanitizer.new.sanitize_tag_list(tag_list) if self.class.taggable?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def translatable_description?
|
||||||
|
self.class.included_modules.include?(Globalizable) &&
|
||||||
|
self.class.translated_attribute_names.include?(:description)
|
||||||
|
end
|
||||||
|
|
||||||
|
def sanitize_description_translations
|
||||||
|
# Sanitize description when using attribute accessor in place of nested translations.
|
||||||
|
# This is because Globalize gem create translations on after save callback
|
||||||
|
# https://github.com/globalize/globalize/blob/e37c471775d196cd4318e61954572c300c015467/lib/globalize/active_record/act_macro.rb#L105
|
||||||
|
if translations.empty?
|
||||||
|
Globalize.with_locale(I18n.locale) do
|
||||||
|
self.description = WYSIWYGSanitizer.new.sanitize(description)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
translations.reject(&:_destroy).each do |translation|
|
||||||
|
Globalize.with_locale(translation.locale) do
|
||||||
|
self.description = WYSIWYGSanitizer.new.sanitize(description)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
require "numeric"
|
require "numeric"
|
||||||
class Debate < ActiveRecord::Base
|
class Debate < ApplicationRecord
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
include Flaggable
|
include Flaggable
|
||||||
include Taggable
|
include Taggable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class DirectMessage < ActiveRecord::Base
|
class DirectMessage < ApplicationRecord
|
||||||
belongs_to :sender, class_name: "User", foreign_key: "sender_id"
|
belongs_to :sender, class_name: "User", foreign_key: "sender_id"
|
||||||
belongs_to :receiver, class_name: "User", foreign_key: "receiver_id"
|
belongs_to :receiver, class_name: "User", foreign_key: "receiver_id"
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class DirectUpload
|
|||||||
@relation.valid?
|
@relation.valid?
|
||||||
|
|
||||||
if @relation.errors.key? :attachment
|
if @relation.errors.key? :attachment
|
||||||
errors[:attachment] = @relation.errors[:attachment]
|
errors.add(:attachment, @relation.errors.full_messages_for(:attachment))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Document < ActiveRecord::Base
|
class Document < ApplicationRecord
|
||||||
include DocumentsHelper
|
include DocumentsHelper
|
||||||
include DocumentablesHelper
|
include DocumentablesHelper
|
||||||
has_attached_file :attachment, url: "/system/:class/:prefix/:style/:hash.:extension",
|
has_attached_file :attachment, url: "/system/:class/:prefix/:style/:hash.:extension",
|
||||||
@@ -80,24 +80,26 @@ class Document < ActiveRecord::Base
|
|||||||
def validate_attachment_size
|
def validate_attachment_size
|
||||||
if documentable_class.present? &&
|
if documentable_class.present? &&
|
||||||
attachment_file_size > documentable_class.max_file_size
|
attachment_file_size > documentable_class.max_file_size
|
||||||
errors[:attachment] = I18n.t("documents.errors.messages.in_between",
|
errors.add(:attachment, I18n.t("documents.errors.messages.in_between",
|
||||||
min: "0 Bytes",
|
min: "0 Bytes",
|
||||||
max: "#{max_file_size(documentable_class)} MB")
|
max: "#{max_file_size(documentable_class)} MB"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_attachment_content_type
|
def validate_attachment_content_type
|
||||||
if documentable_class &&
|
if documentable_class &&
|
||||||
!accepted_content_types(documentable_class).include?(attachment_content_type)
|
!accepted_content_types(documentable_class).include?(attachment_content_type)
|
||||||
errors[:attachment] = I18n.t("documents.errors.messages.wrong_content_type",
|
accepted_content_types = documentable_humanized_accepted_content_types(documentable_class)
|
||||||
|
message = I18n.t("documents.errors.messages.wrong_content_type",
|
||||||
content_type: attachment_content_type,
|
content_type: attachment_content_type,
|
||||||
accepted_content_types: documentable_humanized_accepted_content_types(documentable_class))
|
accepted_content_types: accepted_content_types)
|
||||||
|
errors.add(:attachment, message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def attachment_presence
|
def attachment_presence
|
||||||
if attachment.blank? && cached_attachment.blank?
|
if attachment.blank? && cached_attachment.blank?
|
||||||
errors[:attachment] = I18n.t("errors.messages.blank")
|
errors.add(:attachment, I18n.t("errors.messages.blank"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class FailedCensusCall < ActiveRecord::Base
|
class FailedCensusCall < ApplicationRecord
|
||||||
belongs_to :user, counter_cache: true
|
belongs_to :user, counter_cache: true
|
||||||
belongs_to :poll_officer, class_name: "Poll::Officer", counter_cache: true
|
belongs_to :poll_officer, class_name: "Poll::Officer", counter_cache: true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Flag < ActiveRecord::Base
|
class Flag < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :flaggable, polymorphic: true, counter_cache: true, touch: true
|
belongs_to :flaggable, polymorphic: true, counter_cache: true, touch: true
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Follow < ActiveRecord::Base
|
class Follow < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :followable, polymorphic: true
|
belongs_to :followable, polymorphic: true
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Geozone < ActiveRecord::Base
|
class Geozone < ApplicationRecord
|
||||||
|
|
||||||
include Graphqlable
|
include Graphqlable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class I18nContent < ActiveRecord::Base
|
class I18nContent < ApplicationRecord
|
||||||
|
|
||||||
scope :by_key, ->(key) { where(key: key) }
|
scope :by_key, ->(key) { where(key: key) }
|
||||||
scope :begins_with_key, ->(key) { where("key ILIKE ?", "#{key}%") }
|
scope :begins_with_key, ->(key) { where("key ILIKE ?", "#{key}%") }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class I18nContentTranslation < ActiveRecord::Base
|
class I18nContentTranslation < ApplicationRecord
|
||||||
def self.existing_languages
|
def self.existing_languages
|
||||||
self.select(:locale).uniq.map{ |l| l.locale.to_sym }.to_a
|
self.select(:locale).distinct.map { |l| l.locale.to_sym }.to_a
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Identity < ActiveRecord::Base
|
class Identity < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates :provider, presence: true
|
validates :provider, presence: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Image < ActiveRecord::Base
|
class Image < ApplicationRecord
|
||||||
include ImagesHelper
|
include ImagesHelper
|
||||||
include ImageablesHelper
|
include ImageablesHelper
|
||||||
|
|
||||||
@@ -79,23 +79,24 @@ class Image < ActiveRecord::Base
|
|||||||
def validate_attachment_size
|
def validate_attachment_size
|
||||||
if imageable_class &&
|
if imageable_class &&
|
||||||
attachment_file_size > 1.megabytes
|
attachment_file_size > 1.megabytes
|
||||||
errors[:attachment] = I18n.t("images.errors.messages.in_between",
|
errors.add(:attachment, I18n.t("images.errors.messages.in_between",
|
||||||
min: "0 Bytes",
|
min: "0 Bytes",
|
||||||
max: "#{imageable_max_file_size} MB")
|
max: "#{imageable_max_file_size} MB"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_attachment_content_type
|
def validate_attachment_content_type
|
||||||
if imageable_class && !attachment_of_valid_content_type?
|
if imageable_class && !attachment_of_valid_content_type?
|
||||||
errors[:attachment] = I18n.t("images.errors.messages.wrong_content_type",
|
message = I18n.t("images.errors.messages.wrong_content_type",
|
||||||
content_type: attachment_content_type,
|
content_type: attachment_content_type,
|
||||||
accepted_content_types: imageable_humanized_accepted_content_types)
|
accepted_content_types: imageable_humanized_accepted_content_types)
|
||||||
|
errors.add(:attachment, message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def attachment_presence
|
def attachment_presence
|
||||||
if attachment.blank? && cached_attachment.blank?
|
if attachment.blank? && cached_attachment.blank?
|
||||||
errors[:attachment] = I18n.t("errors.messages.blank")
|
errors.add(:attachment, I18n.t("errors.messages.blank"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::Annotation < ActiveRecord::Base
|
class Legislation::Annotation < ApplicationRecord
|
||||||
COMMENTS_PAGE_SIZE = 5
|
COMMENTS_PAGE_SIZE = 5
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::Answer < ActiveRecord::Base
|
class Legislation::Answer < ApplicationRecord
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::DraftVersion < ActiveRecord::Base
|
class Legislation::DraftVersion < ApplicationRecord
|
||||||
VALID_STATUSES = %w(draft published)
|
VALID_STATUSES = %w(draft published)
|
||||||
|
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::Process < ActiveRecord::Base
|
class Legislation::Process < ApplicationRecord
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
include Taggable
|
include Taggable
|
||||||
include Milestoneable
|
include Milestoneable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::Proposal < ActiveRecord::Base
|
class Legislation::Proposal < ApplicationRecord
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
include Flaggable
|
include Flaggable
|
||||||
include Taggable
|
include Taggable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::Question < ActiveRecord::Base
|
class Legislation::Question < ApplicationRecord
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
include Notifiable
|
include Notifiable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Legislation::QuestionOption < ActiveRecord::Base
|
class Legislation::QuestionOption < ApplicationRecord
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class LocalCensusRecord < ActiveRecord::Base
|
class LocalCensusRecord < ApplicationRecord
|
||||||
validates :document_number, presence: true
|
validates :document_number, presence: true
|
||||||
validates :document_type, presence: true
|
validates :document_type, presence: true
|
||||||
validates :date_of_birth, presence: true
|
validates :date_of_birth, presence: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Lock < ActiveRecord::Base
|
class Lock < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
before_save :set_locked_until
|
before_save :set_locked_until
|
||||||
@@ -21,7 +21,7 @@ class Lock < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.increase_tries(user)
|
def self.increase_tries(user)
|
||||||
Lock.find_or_create_by(user: user).increment!(:tries)
|
Lock.find_or_create_by(user: user).increment!(:tries).save
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.max_tries
|
def self.max_tries
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Manager < ActiveRecord::Base
|
class Manager < ApplicationRecord
|
||||||
belongs_to :user, touch: true
|
belongs_to :user, touch: true
|
||||||
delegate :name, :email, :name_and_email, to: :user
|
delegate :name, :email, :name_and_email, to: :user
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class MapLocation < ActiveRecord::Base
|
class MapLocation < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :proposal, touch: true
|
belongs_to :proposal, touch: true
|
||||||
belongs_to :investment, class_name: Budget::Investment, touch: true
|
belongs_to :investment, class_name: Budget::Investment, touch: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Milestone < ActiveRecord::Base
|
class Milestone < ApplicationRecord
|
||||||
include Imageable
|
include Imageable
|
||||||
include Documentable
|
include Documentable
|
||||||
documentable max_documents_allowed: 3,
|
documentable max_documents_allowed: 3,
|
||||||
@@ -7,6 +7,7 @@ class Milestone < ActiveRecord::Base
|
|||||||
|
|
||||||
translates :title, :description, touch: true
|
translates :title, :description, touch: true
|
||||||
include Globalizable
|
include Globalizable
|
||||||
|
translation_class_delegate :status_id
|
||||||
|
|
||||||
belongs_to :milestoneable, polymorphic: true
|
belongs_to :milestoneable, polymorphic: true
|
||||||
belongs_to :status
|
belongs_to :status
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Milestone::Status < ActiveRecord::Base
|
class Milestone::Status < ApplicationRecord
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
|
|
||||||
has_many :milestones
|
has_many :milestones
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
class Milestone::Translation < Globalize::ActiveRecord::Translation
|
|
||||||
delegate :status_id, to: :globalized_model
|
|
||||||
end
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
class Moderator < ActiveRecord::Base
|
class Moderator < ApplicationRecord
|
||||||
belongs_to :user, touch: true
|
belongs_to :user, touch: true
|
||||||
delegate :name, :email, to: :user
|
delegate :name, :email, to: :user
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Newsletter < ActiveRecord::Base
|
class Newsletter < ApplicationRecord
|
||||||
has_many :activities, as: :actionable
|
has_many :activities, as: :actionable
|
||||||
|
|
||||||
validates :subject, presence: true
|
validates :subject, presence: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Notification < ActiveRecord::Base
|
class Notification < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :user, counter_cache: true
|
belongs_to :user, counter_cache: true
|
||||||
belongs_to :notifiable, polymorphic: true
|
belongs_to :notifiable, polymorphic: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Organization < ActiveRecord::Base
|
class Organization < ApplicationRecord
|
||||||
|
|
||||||
include Graphqlable
|
include Graphqlable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Poll < ActiveRecord::Base
|
class Poll < ApplicationRecord
|
||||||
include Imageable
|
include Imageable
|
||||||
acts_as_paranoid column: :hidden_at
|
acts_as_paranoid column: :hidden_at
|
||||||
include ActsAsParanoidAliases
|
include ActsAsParanoidAliases
|
||||||
@@ -20,10 +20,12 @@ class Poll < ActiveRecord::Base
|
|||||||
has_many :officers, through: :officer_assignments
|
has_many :officers, through: :officer_assignments
|
||||||
has_many :questions, inverse_of: :poll
|
has_many :questions, inverse_of: :poll
|
||||||
has_many :comments, as: :commentable
|
has_many :comments, as: :commentable
|
||||||
|
has_many :ballot_sheets
|
||||||
|
|
||||||
has_and_belongs_to_many :geozones
|
has_and_belongs_to_many :geozones
|
||||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||||
belongs_to :related, polymorphic: true
|
belongs_to :related, polymorphic: true
|
||||||
|
belongs_to :budget
|
||||||
|
|
||||||
validates_translation :name, presence: true
|
validates_translation :name, presence: true
|
||||||
validate :date_range
|
validate :date_range
|
||||||
@@ -39,7 +41,9 @@ class Poll < ActiveRecord::Base
|
|||||||
scope :published, -> { where("published = ?", true) }
|
scope :published, -> { where("published = ?", true) }
|
||||||
scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) }
|
scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
scope :sort_for_list, -> { order(:geozone_restricted, :starts_at, :name) }
|
scope :not_budget, -> { where(budget_id: nil) }
|
||||||
|
|
||||||
|
scope :sort_for_list, -> { joins(:translations).order(:geozone_restricted, :starts_at, "poll_translations.name") }
|
||||||
|
|
||||||
def self.overlaping_with(poll)
|
def self.overlaping_with(poll)
|
||||||
where("? < ends_at and ? >= starts_at", poll.starts_at.beginning_of_day,
|
where("? < ends_at and ? >= starts_at", poll.starts_at.beginning_of_day,
|
||||||
@@ -82,10 +86,15 @@ class Poll < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def votable_by?(user)
|
def votable_by?(user)
|
||||||
|
return false if user_has_an_online_ballot(user)
|
||||||
answerable_by?(user) &&
|
answerable_by?(user) &&
|
||||||
not_voted_by?(user)
|
not_voted_by?(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def user_has_an_online_ballot(user)
|
||||||
|
budget.present? && budget.ballots.find_by(user: user)&.lines.present?
|
||||||
|
end
|
||||||
|
|
||||||
def self.not_voted_by(user)
|
def self.not_voted_by(user)
|
||||||
where("polls.id not in (?)", poll_ids_voted_by(user))
|
where("polls.id not in (?)", poll_ids_voted_by(user))
|
||||||
end
|
end
|
||||||
@@ -132,4 +141,8 @@ class Poll < ActiveRecord::Base
|
|||||||
def answer_count
|
def answer_count
|
||||||
Poll::Answer.where(question: questions).count
|
Poll::Answer.where(question: questions).count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def budget_poll?
|
||||||
|
budget.present?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Poll::Answer < ActiveRecord::Base
|
class Poll::Answer < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :question, -> { with_hidden }
|
belongs_to :question, -> { with_hidden }
|
||||||
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id"
|
||||||
|
|||||||
36
app/models/poll/ballot.rb
Normal file
36
app/models/poll/ballot.rb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
class Poll::Ballot < ActiveRecord::Base
|
||||||
|
belongs_to :ballot_sheet, class_name: Poll::BallotSheet
|
||||||
|
|
||||||
|
validates :ballot_sheet_id, presence: true
|
||||||
|
|
||||||
|
def verify
|
||||||
|
investments.each do |investment_id|
|
||||||
|
add_investment(investment_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_investment(investment_id)
|
||||||
|
investment = find_investment(investment_id)
|
||||||
|
|
||||||
|
if investment.present? && not_already_added?(investment)
|
||||||
|
ballot.add_investment(investment)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def investments
|
||||||
|
data.split(",")
|
||||||
|
end
|
||||||
|
|
||||||
|
def ballot
|
||||||
|
Budget::Ballot.where(poll_ballot: self).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_investment(investment_id)
|
||||||
|
ballot.budget.investments.where(id: investment_id).first
|
||||||
|
end
|
||||||
|
|
||||||
|
def not_already_added?(investment)
|
||||||
|
ballot.lines.where(investment: investment).blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user