Browse Source

Webshims and select2 removed, replaced with straight rails datetime select and jquery tags input

rails5
echarp 5 years ago
parent
commit
5b3228dae8
  1. 38
      Gemfile
  2. 123
      Gemfile.lock
  3. 2
      app/admin/orga.rb
  4. 2
      app/admin/translation.rb
  5. 23
      app/assets/javascripts/application.js.coffee
  6. 5
      app/assets/javascripts/events.js.coffee
  7. 13
      app/assets/javascripts/orgas.js.coffee
  8. 12
      app/assets/stylesheets/all.sass
  9. 3
      app/assets/stylesheets/application.sass
  10. 5
      app/assets/stylesheets/form.sass
  11. 4
      app/assets/stylesheets/mobile.sass
  12. 45
      app/assets/stylesheets/tags.sass
  13. 4
      app/controllers/events_controller.rb
  14. 2
      app/controllers/moderations_controller.rb
  15. 2
      app/controllers/orgas_controller.rb
  16. 11
      app/controllers/tags_controller.rb
  17. 9
      app/controllers/users_controller.rb
  18. 4
      app/helpers/events_helper.rb
  19. 4
      app/helpers/tags_helper.rb
  20. 10
      app/models/event.rb
  21. 9
      app/models/event_callbacks.rb
  22. 3
      app/models/orga.rb
  23. 6
      app/views/events/_form.html.haml
  24. 2
      app/views/events/index.html.haml
  25. 4
      app/views/events/show.html.haml
  26. 2
      app/views/events/show.json.jbuilder
  27. 2
      app/views/events/show.text.haml
  28. 2
      app/views/orgas/_form.html.haml
  29. 2
      app/views/orgas/index.html.haml
  30. 2
      app/views/orgas/index.json.jbuilder
  31. 2
      app/views/orgas/show.html.haml
  32. 2
      app/views/orgas/show.json.jbuilder
  33. 2
      app/views/orgas/show.text.haml
  34. 7
      app/views/tags/index.html.haml
  35. 4
      config/application.rb
  36. 2
      config/initializers/acts_as_taggable_on.rb
  37. 4
      config/locales/models/en.yml
  38. 4
      config/locales/models/fr.yml
  39. 9
      config/locales/views/en.yml
  40. 14
      config/locales/views/fr.yml
  41. 35
      db/migrate/20161210105328_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb
  42. 22
      db/migrate/20161210105329_add_missing_unique_indices.acts_as_taggable_on_engine.rb
  43. 15
      db/migrate/20161210105330_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb
  44. 10
      db/migrate/20161210105331_add_missing_taggable_index.acts_as_taggable_on_engine.rb
  45. 10
      db/migrate/20161210105332_change_collation_for_tag_names.acts_as_taggable_on_engine.rb
  46. 14
      db/migrate/20161210105333_add_missing_indexes.acts_as_taggable_on_engine.rb
  47. 20
      db/migrate/20161210154558_populate_tags.rb
  48. 46
      db/schema.rb
  49. 1
      public/assets/.sprockets-manifest-15ceda6913c644f60925b0cd3079d44e.json
  50. 1
      public/assets/.sprockets-manifest-ab661426d97300c73ef9f54813a90d69.json
  51. 1
      public/assets/.sprockets-manifest-cc0c9f43a35675d2248a689be654ce22.json
  52. 4
      public/assets/active_admin-1a6505fe97404d4518ab3540e631c4ba837fd413398b4e75ad4abbcd110398f3.css
  53. BIN
      public/assets/active_admin-1a6505fe97404d4518ab3540e631c4ba837fd413398b4e75ad4abbcd110398f3.css.gz
  54. 25424
      public/assets/active_admin-3ac0f1eff2fd35f310a1bd2242c049f9d2cc006c7b1065541a5d855556e24393.js
  55. BIN
      public/assets/active_admin-3ac0f1eff2fd35f310a1bd2242c049f9d2cc006c7b1065541a5d855556e24393.js.gz
  56. 24141
      public/assets/active_admin-5d8dda85fd2e9296c4f9682a0c4441e4dfc6c2779454e8144be78befe3ff05bb.js
  57. BIN
      public/assets/active_admin-5d8dda85fd2e9296c4f9682a0c4441e4dfc6c2779454e8144be78befe3ff05bb.js.gz
  58. 4
      public/assets/active_admin-5f05779513d42df8ed807ee625244d8e144534286b6c72cecee9151938308901.css
  59. BIN
      public/assets/active_admin-5f05779513d42df8ed807ee625244d8e144534286b6c72cecee9151938308901.css.gz
  60. 4
      public/assets/active_admin-5f668089bbe1957cd779eb439f2df899e5d66673d34ac94110e73ef0ac0e7313.css
  61. BIN
      public/assets/active_admin-5f668089bbe1957cd779eb439f2df899e5d66673d34ac94110e73ef0ac0e7313.css.gz
  62. 6403
      public/assets/active_admin-617b799bade586fce74b4e0121a99adb6ff69314ffc69f4e24529028a7b72538.css
  63. BIN
      public/assets/active_admin-617b799bade586fce74b4e0121a99adb6ff69314ffc69f4e24529028a7b72538.css.gz
  64. 6403
      public/assets/active_admin-68bb37e1af32798e8006da86254602580978bf587ad01d5ae98b3c8eedd8bca9.css
  65. BIN
      public/assets/active_admin-68bb37e1af32798e8006da86254602580978bf587ad01d5ae98b3c8eedd8bca9.css.gz
  66. 24677
      public/assets/active_admin-716bc3a1c121d8ebdfc555d143e5f535aff487ef907952790491e39e34688a2f.js
  67. BIN
      public/assets/active_admin-716bc3a1c121d8ebdfc555d143e5f535aff487ef907952790491e39e34688a2f.js.gz
  68. BIN
      public/assets/active_admin-7b898044797e0f200853d20057f7415d6654d6c44a71b43f9b2da1945f11f920.css.gz
  69. 4
      public/assets/active_admin-bf38e2138315a470aef9b840765c137a33b1520312a5ef0a981c39addb52fbfb.css
  70. BIN
      public/assets/active_admin-bf38e2138315a470aef9b840765c137a33b1520312a5ef0a981c39addb52fbfb.css.gz
  71. BIN
      public/assets/active_admin-c99e2b41c14fcaa52c6ca770ae578392abc42e237158ed560ad73d118e502350.js.gz
  72. 4
      public/assets/active_admin-defbaea5f76144997fe3a36bdbe91b89d5ae69f2c61c1e318ecadbf2cd2b6f9b.css
  73. BIN
      public/assets/active_admin-defbaea5f76144997fe3a36bdbe91b89d5ae69f2c61c1e318ecadbf2cd2b6f9b.css.gz
  74. 47
      public/assets/active_admin/application-3ee24c8b7a313a28f1352e08dc4dc31bd7d4489b6ad5f6331f1f42bbded33a50.js
  75. BIN
      public/assets/active_admin/application-3ee24c8b7a313a28f1352e08dc4dc31bd7d4489b6ad5f6331f1f42bbded33a50.js.gz
  76. 51
      public/assets/active_admin/application-50ffc9f86e474cd52ffb7ce3b3572255ad6646ea17097a056f330b540eae402c.js
  77. BIN
      public/assets/active_admin/application-50ffc9f86e474cd52ffb7ce3b3572255ad6646ea17097a056f330b540eae402c.js.gz
  78. BIN
      public/assets/active_admin/print-87c5ffc1d869a919123bcc1dc5ec51b20bc79fd9aeab9eed77e3438c6acd4f68.css.gz
  79. 596
      public/assets/active_admin/print-cb755dcaacb896fb80d996ba6eee250ea19ee816526e5e5d0137ed2af34d08f1.css
  80. BIN
      public/assets/active_admin/print-cb755dcaacb896fb80d996ba6eee250ea19ee816526e5e5d0137ed2af34d08f1.css.gz
  81. BIN
      public/assets/active_admin_pagedown/wmd-buttons-c2040b12f2d6cb568ddc33587a070a29a18fed20099260c3ecbbfdbd62042f7b.png
  82. 75849
      public/assets/application-02766bae906c2b1d3af44afd44605cfa863adf826ab9a88e5333ac3dbaffd98a.js
  83. BIN
      public/assets/application-02766bae906c2b1d3af44afd44605cfa863adf826ab9a88e5333ac3dbaffd98a.js.gz
  84. 13720
      public/assets/application-04dae2e3e83d47a4e01f16d1fd7598a83a4d7c9c52947b77c44f3203a27ea744.css
  85. BIN
      public/assets/application-04dae2e3e83d47a4e01f16d1fd7598a83a4d7c9c52947b77c44f3203a27ea744.css.gz
  86. 75849
      public/assets/application-08422740ca00279c6943824b28f3ae60c79bb9d2d19657f0fbce3a76c6712e28.js
  87. BIN
      public/assets/application-08422740ca00279c6943824b28f3ae60c79bb9d2d19657f0fbce3a76c6712e28.js.gz
  88. 75631
      public/assets/application-0df2b8e7bf544e75ad6a6bdcc25bc16667215248d72850df1c004024352f9bfb.js
  89. BIN
      public/assets/application-0df2b8e7bf544e75ad6a6bdcc25bc16667215248d72850df1c004024352f9bfb.js.gz
  90. 75789
      public/assets/application-12583549f910cb38404c7ed07661ca2eadbdea267cd3955575a8caffcca548bc.js
  91. BIN
      public/assets/application-12583549f910cb38404c7ed07661ca2eadbdea267cd3955575a8caffcca548bc.js.gz
  92. 75835
      public/assets/application-142ea634c81fb96e584255eadaad6af57ef2a251bb5c912498eebb3967506233.js
  93. BIN
      public/assets/application-142ea634c81fb96e584255eadaad6af57ef2a251bb5c912498eebb3967506233.js.gz
  94. 10
      public/assets/application-2206cdbaf19b5e0a020de5739e2c911351d6bdd80a0dac961f79729f718ae851.css
  95. BIN
      public/assets/application-2206cdbaf19b5e0a020de5739e2c911351d6bdd80a0dac961f79729f718ae851.css.gz
  96. 88160
      public/assets/application-224c876758d567479b1ebc1da354a712a64d27a100fb0ba5b8f1c0ca5188d55c.js
  97. BIN
      public/assets/application-224c876758d567479b1ebc1da354a712a64d27a100fb0ba5b8f1c0ca5188d55c.js.gz
  98. 10
      public/assets/application-2fb50a7174d540a1e61def8f3733ef9b16048a46d710d6b766260ee4589d4840.css
  99. BIN
      public/assets/application-2fb50a7174d540a1e61def8f3733ef9b16048a46d710d6b766260ee4589d4840.css.gz
  100. 76225
      public/assets/application-2ff7281f89f0b69873f09aa96b2121b67d5c245d6be100b00998783e84d58f2d.js

38
Gemfile

@ -27,12 +27,12 @@ gem 'haml-rails'
gem 'devise'
gem 'devise-i18n'
gem 'http_accept_language'
gem 'rails-i18n'
# Store some specific content, like application name and static pages contents
gem 'i18n-active_record',
github: 'svenfuchs/i18n-active_record',
require: 'i18n/active_record'
gem 'http_accept_language'
# Remove leading and trailing white spaces
gem 'strip_attributes'
# Track changes to models' data
@ -42,14 +42,15 @@ gem 'piwik_analytics'
# Validate mails submitted
gem 'email_validator'
# Email address obfuscation
gem 'actionview-encoded_mail_to'
# require is necessary to actually use this feature
# see https://github.com/reed/actionview-encoded_mail_to/issues/15
gem 'actionview-encoded_mail_to',
require: 'action_view/encoded_mail_to/mail_to_with_encoding'
# To display a patched diff for event descriptions
gem 'differ'
# A generic library to administrate the tool
gem 'activeadmin', '~> 1.0.0.pre4'
# A nicer markdown editor in active admin
gem 'activeadmin_pagedown'
gem 'activeadmin', github: 'activeadmin'
gem 'jquery-sparkline-rails', github: 'cubus/jquery-sparkline-rails'
@ -57,8 +58,8 @@ gem 'jquery-sparkline-rails', github: 'cubus/jquery-sparkline-rails'
gem 'redcarpet'
# Carte openstreetmap
gem 'leaflet-rails'
gem 'leaflet-markercluster-rails'
gem 'leaflet-rails'
gem 'geocoder'
@ -66,15 +67,18 @@ gem 'geocoder'
gem 'tinymce-rails'
gem 'tinymce-rails-langs'
gem 'acts-as-taggable-on'
gem 'tagsinput-rails'
# SEO optimisations
gem 'meta-tags'
gem 'twitter'
group :development do
gem 'quiet_assets'
gem 'sqlite3'
gem 'webrick'
gem 'quiet_assets'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console'
@ -86,17 +90,17 @@ group :development do
# Scanning the Gemfile for insecure dependencies based on published CVEs
gem 'bundler-audit'
gem 'guard-rails', require: false
gem 'guard-migrate', require: false
gem 'guard-bundler', require: false
gem 'guard-rubocop', require: false
gem 'guard-minitest', require: false
gem 'guard-livereload', require: false
gem 'rack-livereload'
gem 'guard-migrate', require: false
gem 'guard-minitest', require: false
gem 'guard-rubocop', require: false
gem 'haml_lint'
gem 'rack-livereload'
# Security checks
gem 'brakeman', require: false
gem 'guard-brakeman', require: false
gem 'guard-rails', require: false
end
group :test do
@ -116,8 +120,7 @@ group :development, :test, :assets do
gem 'coffee-rails'
# Use jquery as the JavaScript library
# Limited to before 4.1, because later version breaks the date/time selector
gem 'jquery-rails', '< 4.1'
gem 'jquery-rails'
# Turbolinks makes following links in your web application
# faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
@ -126,13 +129,6 @@ group :development, :test, :assets do
gem 'modernizr-rails'
# Patch older browsers so they do understand html5
gem 'webshims-rails'
# Improve the html select element
# Later version disabled the tag selector...
gem 'select2-rails', '< 4'
# A superb font to use as icons
gem 'font-awesome-sass'
end

123
Gemfile.lock

@ -1,3 +1,22 @@
GIT
remote: git://github.com/activeadmin/activeadmin.git
revision: 4f494073c6c0c016ba4902faad65f07ee034bb1a
specs:
activeadmin (1.0.0.pre4)
arbre (~> 1.0, >= 1.0.2)
bourbon
coffee-rails
formtastic (~> 3.1)
formtastic_i18n
inherited_resources (~> 1.6)
jquery-rails
jquery-ui-rails
kaminari (~> 0.15)
railties (>= 3.2, < 5.1)
ransack (~> 1.3)
sass-rails
sprockets (< 4.1)
GIT
remote: git://github.com/cubus/jquery-sparkline-rails.git
revision: c5b531f51e3e734710c7561b06c2c829107f9b38
@ -37,22 +56,6 @@ GEM
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview-encoded_mail_to (1.0.8)
rails
activeadmin (1.0.0.pre4)
arbre (~> 1.0, >= 1.0.2)
bourbon
coffee-rails
formtastic (~> 3.1)
formtastic_i18n
inherited_resources (~> 1.6)
jquery-rails
jquery-ui-rails
kaminari (~> 0.15)
rails (>= 3.2, < 5.1)
ransack (~> 1.3)
sass-rails
sprockets (< 4)
activeadmin_pagedown (0.0.2)
activeadmin (>= 0.5.0)
activejob (4.2.7.1)
activesupport (= 4.2.7.1)
globalid (>= 0.3.0)
@ -69,6 +72,8 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
acts-as-taggable-on (4.0.0)
activerecord (>= 4.0)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
arbre (1.1.1)
@ -93,7 +98,7 @@ GEM
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
devise (4.2.0)
@ -105,18 +110,18 @@ GEM
devise-i18n (1.1.1)
differ (0.1.2)
docile (1.1.5)
domain_name (0.5.20161021)
domain_name (0.5.20161129)
unf (>= 0.0.5, < 1.0.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
email_validator (1.6.0)
activemodel
equalizer (0.0.10)
equalizer (0.0.11)
erubis (2.7.0)
eventmachine (1.2.0.1)
eventmachine (1.2.1)
execjs (2.7.0)
faraday (0.9.2)
faraday (0.10.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.14)
font-awesome-sass (4.7.0)
@ -125,7 +130,7 @@ GEM
formtastic (3.1.4)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
geocoder (1.4.0)
geocoder (1.4.1)
globalid (0.3.7)
activesupport (>= 4.1.0)
guard (2.14.0)
@ -171,9 +176,9 @@ GEM
haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
haml_lint (0.18.4)
haml_lint (0.19.0)
haml (~> 4.0)
rake (>= 10, < 12)
rake (>= 10, < 13)
rubocop (>= 0.36.0)
sysexits (~> 1.1)
has_scope (0.6.0)
@ -185,7 +190,7 @@ GEM
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
http (1.0.4)
http (2.1.0)
addressable (~> 2.3)
http-cookie (~> 1.0)
http-form_data (~> 1.0.1)
@ -202,14 +207,14 @@ GEM
has_scope (~> 0.6.0.rc)
railties (>= 3.2, < 5)
responders
jbuilder (2.6.0)
jbuilder (2.6.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.0.5)
rails-dom-testing (~> 1.0)
jquery-rails (4.2.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.5)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (1.8.3)
kaminari (0.17.0)
@ -218,7 +223,7 @@ GEM
leaflet-markercluster-rails (0.7.0)
railties (>= 3.1)
leaflet-rails (0.7.7)
libv8 (3.16.14.15)
libv8 (3.16.14.17)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
@ -230,14 +235,14 @@ GEM
mime-types (>= 1.16, < 4)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
meta-tags (2.3.1)
meta-tags (2.4.0)
actionpack (>= 3.2.0, <= 5.1.0)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.1)
minitest (5.10.1)
modernizr-rails (2.7.1)
multi_json (1.12.1)
multipart-post (2.0.0)
@ -250,10 +255,10 @@ GEM
nenv (~> 0.1)
shellany (~> 0.0)
orm_adapter (0.5.0)
paper_trail (5.2.2)
activerecord (>= 3.0, < 6.0)
paper_trail (6.0.2)
activerecord (>= 4.0, < 5.2)
request_store (~> 1.1)
parser (2.3.1.4)
parser (2.3.3.1)
ast (~> 2.2)
piwik_analytics (1.0.2)
actionpack
@ -302,7 +307,7 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
rake (11.3.0)
rake (12.0.0)
ransack (1.8.2)
actionpack (>= 3.0)
activerecord (>= 3.0)
@ -318,7 +323,7 @@ GEM
request_store (1.3.1)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rubocop (0.45.0)
rubocop (0.46.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
@ -338,11 +343,9 @@ GEM
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
select2-rails (3.5.10)
thor (~> 0.14)
sexp_processor (4.7.0)
shellany (0.0.1)
simple_calendar (2.2.0)
simple_calendar (2.2.2)
rails (>= 3.0)
simple_oauth (0.3.1)
simplecov (0.12.0)
@ -364,38 +367,39 @@ GEM
strip_attributes (1.8.0)
activemodel (>= 3.0, < 6.0)
sysexits (1.2.0)
tagsinput-rails (1.3.5.1)
railties (>= 3.1)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.5)
tinymce-rails (4.4.3)
tinymce-rails (4.5.1)
railties (>= 3.1.1)
tinymce-rails-langs (4.20160310)
tinymce-rails (~> 4.1, >= 4.1.10)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
twitter (5.16.0)
addressable (~> 2.3)
twitter (6.0.0)
addressable (~> 2.5)
buftok (~> 0.2.0)
equalizer (= 0.0.10)
faraday (~> 0.9.0)
http (~> 1.0)
equalizer (= 0.0.11)
faraday (~> 0.10.0)
http (~> 2.1)
http_parser.rb (~> 0.6.0)
json (~> 1.8)
memoizable (~> 0.4.0)
naught (~> 1.0)
simple_oauth (~> 0.3.0)
memoizable (~> 0.4.2)
naught (~> 1.1)
simple_oauth (~> 0.3.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.3)
uglifier (3.0.4)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
unicode-display_width (1.1.1)
unicode-display_width (1.1.2)
warden (1.2.6)
rack (>= 1.0)
web-console (3.3.0)
@ -403,16 +407,14 @@ GEM
debug_inspector
railties (>= 4.2)
webrick (1.3.1)
webshims-rails (1.15.10)
rails (> 3.1.0)
PLATFORMS
ruby
DEPENDENCIES
actionview-encoded_mail_to
activeadmin (~> 1.0.0.pre4)
activeadmin_pagedown
activeadmin!
acts-as-taggable-on
brakeman
bundler-audit
byebug
@ -438,7 +440,7 @@ DEPENDENCIES
i18n-active_record!
ice_cube
jbuilder
jquery-rails (< 4.1)
jquery-rails
jquery-sparkline-rails!
leaflet-markercluster-rails
leaflet-rails
@ -454,12 +456,12 @@ DEPENDENCIES
redcarpet
sass-rails
sdoc
select2-rails (< 4)
simple_calendar
simplecov
spring
sqlite3
strip_attributes
tagsinput-rails
therubyracer
tinymce-rails
tinymce-rails-langs
@ -468,7 +470,6 @@ DEPENDENCIES
uglifier
web-console
webrick
webshims-rails
BUNDLED WITH
1.12.5
1.13.6

2
app/admin/orga.rb

@ -29,7 +29,7 @@ ActiveAdmin.register Orga do
attributes_table do
row :kind
row :name
row :description, as: :pagedown_text
row :description
row :city
row :department
row :region

2
app/admin/translation.rb

@ -5,7 +5,7 @@ ActiveAdmin.register I18n::Backend::ActiveRecord::Translation do
f.inputs do
f.input :locale
f.input :key
f.input :value, as: :pagedown_text
f.input :value
f.actions
end
end

23
app/assets/javascripts/application.js.coffee

@ -13,33 +13,24 @@
#= require jquery
#= require jquery_ujs
#= require jquery.sparkline
# For tags input
#= require jquery-ui/widgets/autocomplete
#= require jquery.tagsinput
#= require turbolinks
#= require tinymce-jquery
#= require modernizr
#= require webshims/polyfiller
#= require select2
#= require select2_locale_fr
#= require leaflet
#= require leaflet.markercluster
#= require leaflet.awesome-markers
#= require_tree .
# Setup polyfills, so that older browsers can also take advantage of html5!
$.webshims.setOptions 'basePath', '/webshims/1.15.10/shims/'
$.webshims.setOptions 'forms-ext',
'widgets':
'startView': 2,
'stepfactor': 10,
'classes': 'show-yearbtns hide-btnrow show-uparrow'
$.webshims.polyfill 'forms forms-ext'
$(document).on 'turbolinks:load', ->
# Reload polyfill when turbolinks loads a new page
$(this).updatePolyfill()
# Hides the chrome broken image when image is absent
if !Modernizr.testAllProps('forceBrokenImageIcon')
$('img.favicon').one 'error', ->
$(this).css visibility: 'hidden'
# $('select').select2()
$('.field.tags input').tagsInput
delimiter: [' ']
defaultText: ''
autocomplete_url: '/tags.json'

5
app/assets/javascripts/events.js.coffee

@ -1,7 +1,4 @@
$(document).on 'turbolinks:load', ->
# Manage the tags label so it points the proper select2 input
$('label[for=event_tags]').attr 'for', 's2id_autogen1'
$('#event_start_time').change ->
if $('#event_start_time').val() >= $('#event_end_time').val()
$('#event_end_time').val($('#event_start_time').val())
@ -27,5 +24,3 @@ $(document).on 'turbolinks:load', ->
url: '/tags.json'
.done (data) ->
tags = jQuery.map data, (n) -> n[0]
elt.select2 tags: tags, separator: [' '], tokenSeparators: [' ']

13
app/assets/javascripts/orgas.js.coffee

@ -1,13 +0,0 @@
$(document).on 'turbolinks:load', ->
# Manage orga tags edition
$('#orga_tags').each ->
elt = $(this)
$.ajax
url: '/tags/orgas.json'
.done (data) ->
tags = jQuery.map data, (n) -> n[0]
elt.select2 tags: tags, separator: [' '], tokenSeparators: [' ']
# Manage the tags label so it points the proper select2 input
$('label[for=orga_tags]').attr 'for', 's2id_autogen1'

12
app/assets/stylesheets/all.sass

@ -193,7 +193,7 @@ label
border: 1px solid darkgray
box-shadow: 1px 1px 2px lightgray
border-radius: 0.4em
input, textarea, select, a.button, button, .select2-container ul
input, textarea, select, a.button, button
color: black
margin: 3px 0
border: 1px solid darkgray
@ -281,13 +281,3 @@ footer.bottom nav
display: none
span.next
display: block
.select2-container ul
min-width: 46em
.select2-container-multi.select2-container-active .select2-choices, .select2-drop
border: none !important
box-shadow: 1px 1px 4px gray
// Otherwise the cross to remove tags is centered
.select2-container *, .select2-choices *
margin: initial
transition-duration: 0

3
app/assets/stylesheets/application.sass

@ -10,7 +10,8 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require select2
*= require jquery-ui
*= require jquery.tagsinput
*= require_tree .
*/

5
app/assets/stylesheets/form.sass

@ -17,7 +17,7 @@
label
width: 8em
display: inline-block
input, select, .select2-container ul
input, select
border-top-left-radius: 0
border-bottom-left-radius: 0
input[type=radio] + label
@ -25,8 +25,7 @@
&:after
content: ''
input[type=text], input[type=url], input[type=email],
.select2-container, .select2-container ul, .mce-tinymce
input[type=text], input[type=url], input[type=email], .mce-tinymce
min-width: 22em
.mce-tinymce

4
app/assets/stylesheets/mobile.sass

@ -125,8 +125,6 @@
display: block
text-align: left
margin-left: 0
input, .select2-container ul, .mce-tinymce
input, .mce-tinymce
width: 100%
border-bottom-left-radius: 0.4em
.select2-container ul
min-width: 20em

45
app/assets/stylesheets/tags.sass

@ -7,21 +7,30 @@ p.tags a:last-child:after
.tag
vertical-align: middle
&.size_1
font-size: 60%
letter-spacing: -1px
&.size_2
font-size: 80%
letter-spacing: -1px
&.size_3
font-size: 100%
&.size_4
font-size: 120%
&.size_5
font-size: 180%
&.size_6
font-size: 200%
&.size_7
font-size: 220%
&.size_8
font-size: 240%
&.css1
font-size: 1.0em
&.css2
font-size: 1.2em
&.css3
font-size: 1.4em
&.css4
font-size: 1.6em
.tagsinput
border: none !important
padding: 0 !important
display: inline-block
min-width: 22em
vertical-align: top
input, .ui-autocomplete-input
border: 1px solid darkgray
padding: 0.2em 0.4em
font-size: inherit
margin-right: 0
*:first-child
input, .ui-autocomplete-input
min-width: 22em
.ui-widget-content
text-align: left

4
app/controllers/events_controller.rb

@ -1,7 +1,7 @@
# Event life cycle
# This is a central part to this project
class EventsController < ApplicationController
has_scope :region, :locality, :tag, :daylimit
has_scope :region, :locality, :tag, :daylimit, :year
has_scope :near, type: :hash, using: [:location, :distance]
before_action :set_events, only: [:index]
@ -105,7 +105,7 @@ class EventsController < ApplicationController
params.require(:event)
.permit :lock_version, :title, :start_time, :end_time, :repeat, :rule,
:description, :place_name, :address, :city, :region_id,
:locality, :url, :contact, :submitter, :tags
:locality, :url, :contact, :submitter, :tag_list
end
def filter_for_rss

2
app/controllers/moderations_controller.rb

@ -66,7 +66,7 @@ class ModerationsController < ApplicationController
params.require(:event)
.permit :lock_version, :title, :start_time, :end_time, :repeat, :rule,
:description, :place_name, :address, :city, :region_id,
:locality, :url, :contact, :submitter, :tags
:locality, :url, :contact, :submitter, :tag_list
end
# Useful to manage absolute url in mails

2
app/controllers/orgas_controller.rb

@ -92,7 +92,7 @@ class OrgasController < ApplicationController
params.require(:orga)
.permit :lock_version, :kind_id, :name, :description, :place_name,
:address, :city, :department, :region_id, :url, :diaspora,
:feed, :contact, :submitter, :tags, :active
:feed, :contact, :submitter, :tag_list, :active
end
# Check that you can only edit an existing event if you know its secret

11
app/controllers/tags_controller.rb

@ -5,7 +5,12 @@ class TagsController < InheritedResources::Base
has_scope :tag, as: :id
def index
@tags = organise_tags apply_scopes(Event.moderated)
@tags = ActsAsTaggableOn::Tag.all
if params[:term]
# Used to autocomplete tags
@tags = @tags.select(:id, :name, 'name AS label')
.where('name LIKE ?', "#{params[:term]}%")
end
respond_to do |format|
format.html
@ -14,8 +19,8 @@ class TagsController < InheritedResources::Base
end
def show
@events_future = apply_scopes(Event).moderated.future
@events_past = apply_scopes(Event).moderated.past
@events_future = apply_scopes Event.moderated.future
@events_past = apply_scopes Event.moderated.past
respond_to do |format|
format.html

9
app/controllers/users_controller.rb

@ -9,20 +9,11 @@ class UsersController < ApplicationController
@users = User.all
end
# GET /users/1
# GET /users/1.json
def show
end
# GET /users/new
def new
@user = User.new
end
# GET /users/1/edit
def edit
end
# POST /users
# POST /users.json
def create

4
app/helpers/events_helper.rb

@ -3,7 +3,7 @@ module EventsHelper
def set_events_meta
set_meta_tags \
description: t('layouts.application.subtitle'),
keywords: @events.map(&:tags).join(' ').split.group_by { |i| i }
keywords: @events.map(&:tags).join(', ').split.group_by { |i| i }
.reject { |_k, v| v.size < 2 }.map { |k, _v| k },
DC: {
title: t('layouts.application.title'),
@ -14,7 +14,7 @@ module EventsHelper
def set_event_meta
set_meta_tags \
keywords: @event.tags,
keywords: @event.tag_list,
DC: { title: @event.title, date: @event.start_time.to_s },
geo: {
placename: @event.city,

4
app/helpers/tags_helper.rb

@ -0,0 +1,4 @@
# Helper for the tags views
module TagsHelper
include ActsAsTaggableOn::TagsHelper
end

10
app/models/event.rb

@ -4,6 +4,7 @@ require 'schedule'
class Event < ActiveRecord::Base
extend SimpleCalendar
include Schedule
acts_as_taggable
strip_attributes
has_paper_trail ignore: [:last_updated, :lock_version, :secret, :submitter,
:decision_time, :latitude, :longitude]
@ -24,7 +25,6 @@ class Event < ActiveRecord::Base
validates :url, presence: true, format: %r{\Ahttps?:\/\/.*\..*\z}
validates :contact, email: true
validates :submitter, email: true
validates :tags, presence: true, format: /\A[\p{Alnum}\s-]*\z/
geocoded_by :full_address
# after_validation :geocode, if: -> (obj) { obj.address_changed? }
@ -33,8 +33,6 @@ class Event < ActiveRecord::Base
# Mechanism to store some reason which can be used when sending notifications
attr_accessor :reason
before_validation EventCallbacks
before_create EventCallbacks
after_create EventCallbacks
@ -66,7 +64,7 @@ class Event < ActiveRecord::Base
end)
scope :region, ->(region) { where region: region unless region == 'all' }
scope :locality, ->(locality) { where locality: locality }
scope :tag, ->(tag) { where 'tags like ?', "%#{tag}%" }
scope :tag, ->(tag) { tagged_with tag }
scope :geo, -> { where 'latitude is not null and longitude is not null' }
before_validation on: :create do
@ -86,7 +84,7 @@ class Event < ActiveRecord::Base
{ type: 'Feature', properties: {
id: id, name: title, start_time: start_time, end_time: end_time,
place_name: place_name, address: address, city: city, locality: locality,
tags: tags, popupContent: "<a href=\"/events/#{id}\">#{self}</a>"
tags: tag_list, popupContent: "<a href=\"/events/#{id}\">#{self}</a>"
}, geometry: { type: 'Point', coordinates: [longitude, latitude] } }
end
@ -97,7 +95,7 @@ class Event < ActiveRecord::Base
end
def hashtags
tags.split.map { |tag| "##{tag.tr('-', '_').camelize :lower}" }
tag_list.map { |tag| "##{tag.tr('-', '_').camelize :lower}" }
end
def to_s

9
app/models/event_callbacks.rb

@ -1,11 +1,6 @@
# All the mail and tweet related callbacks to event's lifecycle
# also the scheduled events
class EventCallbacks
def self.before_validation(event)
# Tags are always downcased
event.tags = event.tags.mb_chars.downcase if event.tags
end
def self.before_create(event)
event.secret ||= SecureRandom.urlsafe_base64(32)[0...32]
event.moderator_mail_id ||= SecureRandom.urlsafe_base64(32)[0...32]
@ -59,7 +54,9 @@ class EventCallbacks
end
def self.create_sub_event(event, schedule)
att = event.attributes.reject { |a| a == 'id' || a == 'lock_version' }
att = event.attributes.reject do |a|
a == 'id' || a == 'lock_version' || a == 'tags'
end
att[:start_time] = schedule.start_time
att[:end_time] = schedule.end_time
att

3
app/models/orga.rb

@ -1,5 +1,6 @@
# Organisations related to this agenda
class Orga < ActiveRecord::Base
acts_as_taggable
strip_attributes
has_paper_trail ignore: [:last_updated, :secret, :submitter, :decision_time,
:lock_version, :latitude, :longitude]
@ -31,7 +32,7 @@ class Orga < ActiveRecord::Base
scope :period, ->(_year, _week) {}
scope :region, ->(region) { where region: region unless region == 'all' }
scope :tag, ->(tag) { where 'tags like ?', "%#{tag}%" }
scope :tag, ->(tag) { tagged_with tag }
scope :geo, -> { where 'latitude is not null and longitude is not null' }
before_validation do

6
app/views/events/_form.html.haml

@ -15,10 +15,10 @@
= f.text_field :title, required: true, placeholder: t('.title_helper')
.field.start_time
= f.label :start_time
= f.datetime_local_field :start_time, required: true
= f.datetime_select :start_time, default: 1.day.from_now
.field.end_time
= f.label :end_time
= f.datetime_local_field :end_time, required: true
= f.datetime_select :end_time, default: 1.day.from_now
- unless @event.moderated?
.field.repeat
@ -100,7 +100,7 @@
:markdown
#{t '.tags_helper'}
= f.label :tags
= f.text_field :tags
= f.text_field :tag_list, value: f.object.tag_list.to_s
.actions
= f.button formaction: :preview do

2
app/views/events/index.html.haml

@ -1,8 +1,6 @@
= render '/orgas/search'
- if params[:year]
-# Whole year calendar
- @events = @events.year params[:year]
%header.calendar-header.year
= link_to year: params[:year].to_i - 1, tag: params[:tag],
region: params[:region] do

4
app/views/events/show.html.haml

@ -48,7 +48,7 @@
region_id: @event.region.id,
locality: @event.locality,
url: @event.url,
tags: @event.tags }),
tag_list: @event.tag_list }),
method: :post do
%em.fa.fa-copy
= t '.copy'
@ -112,7 +112,7 @@
%p.tags
%em.fa.fa-tags
%span.label= Event.human_attribute_name :tags
- @event.tags.split.each do |tag|
- @event.tags.each do |tag|
= link_to tag, tag_path(tag), rel: :tag
- if @event.repeat > 0

2
app/views/events/show.json.jbuilder

@ -1,3 +1,3 @@
json.extract! @event, :id, :title, :description, :start_time, :end_time,
:place_name, :address, :city, :region, :locality, :url, :contact,
:tags
:tag_list

2
app/views/events/show.text.haml

@ -13,7 +13,7 @@
#{Event.human_attribute_name(:url).concat(':').ljust 12 } #{@event.url}
#{Event.human_attribute_name(:contact).concat(':').ljust 12 } #{@event.contact}
#{Event.human_attribute_name(:submitter).concat(':').ljust 12 } #{@event.submitter}
#{Event.human_attribute_name(:tags).concat(':').ljust 12 } #{@event.tags}
#{Event.human_attribute_name(:tags).concat(':').ljust 12 } #{@event.tag_list}
#{Event.human_attribute_name(:description).concat(':').ljust 12}
= wrap(strip_tags(@event.description).gsub(/&#13;/, '')).gsub /^/, ' '
=====================================================

2
app/views/orgas/_form.html.haml

@ -76,7 +76,7 @@
:markdown
#{t '.tags_helper'}
= f.label :tags
= f.text_field :tags
= f.text_field :tag_list, value: f.object.tag_list.to_s
.field.active
= f.label :active

2
app/views/orgas/index.html.haml

@ -37,7 +37,7 @@
%td.city= orga.city
%td.department= orga.department
%td.region= orga.region
%td.tags= orga.tags
%td.tags= orga.tag_list
%td.updated_at
- if orga.updated_at.present?
= l orga.updated_at.to_date

2
app/views/orgas/index.json.jbuilder

@ -1,6 +1,6 @@
json.array!(@orgas) do |orga|
json.extract! orga, :id, :name, :description,
:place_name, :address, :city, :region_id, :url,
:contact, :tags
:contact, :tag_list
json.url orga_url(orga, format: :json)
end

2
app/views/orgas/show.html.haml

@ -110,7 +110,7 @@
%dt
%em.fa.fa-tags
= Event.human_attribute_name :tags
%dd= @orga.tags
%dd= @orga.tag_list
%dt
%em.fa.fa-heartbeat
= Orga.human_attribute_name :active

2
app/views/orgas/show.json.jbuilder

@ -1,2 +1,2 @@
json.extract! @orga, :id, :name, :description,
:place_name, :address, :city, :region, :url, :contact, :tags
:place_name, :address, :city, :region, :url, :contact, :tag_list

2
app/views/orgas/show.text.haml

@ -11,7 +11,7 @@
#{Orga.human_attribute_name(:feed).concat(':').ljust 12 } #{@orga.feed}
#{Orga.human_attribute_name(:contact).concat(':').ljust 12 } #{@orga.contact}
#{Orga.human_attribute_name(:submitter).concat(':').ljust 12 } #{@orga.submitter}
#{Orga.human_attribute_name(:tags).concat(':').ljust 12 } #{@orga.tags}
#{Orga.human_attribute_name(:tags).concat(':').ljust 12 } #{@orga.tag_list}
- if @orga.active.present?
#{Orga.human_attribute_name(:active).concat(':').ljust 12 } #{t @orga.active.to_s}
- unless @orga.description.blank?

7
app/views/tags/index.html.haml

@ -2,8 +2,5 @@
%em.fa.fa-tags
= title t '.title'
- @tags.each do |tag|
%span.tag(class="size_#{Math.log2(tag[1]).to_i}")
= link_to tag[0], tag_path(tag[0])
%p=t '.limited'
- tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class|
= link_to tag.name, { action: :show, id: tag.name }, class: css_class

4
config/application.rb

@ -2,10 +2,6 @@ require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Necessary to actually use this feature
# see https://github.com/reed/actionview-encoded_mail_to/issues/15
require 'action_view/encoded_mail_to/mail_to_with_encoding'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

2
config/initializers/acts_as_taggable_on.rb

@ -0,0 +1,2 @@
ActsAsTaggableOn.delimiter = ' ' # use space as delimiter
ActsAsTaggableOn.force_lowercase = true

4
config/locales/models/en.yml

@ -50,7 +50,7 @@ en:
contact: Contact
submitter: Soumetteur
submission_time: En attente depuis
tags: Tags
tag_list: Tags
active: Active
kind:
name_association: Association
@ -81,7 +81,7 @@ en:
contact: Contact
submitter: Submitter
submission_time: Waiting for
tags: Tags
tag_list: Tags
reason: Reason
region:
name_values:

4
config/locales/models/fr.yml

@ -50,7 +50,7 @@ fr:
contact: Contact
submitter: Soumetteur
submission_time: En attente depuis
tags: Mots-clés
tag_list: Mots-clés
active: Actif
kind:
name_association: Association
@ -81,7 +81,7 @@ fr:
contact: Contact
submitter: Soumetteur
submission_time: En attente depuis
tags: Mots-clés
tag_list: Mots-clés
reason: Raison
region:
name_values:

9
config/locales/views/en.yml

@ -24,7 +24,7 @@ en:
propose: Propose an event
propose_orga: Propose an organisation
map: Map
tags: Tags
tag_list: Tags
infos: Infos
stats: Statistics
contact: Contact
@ -102,8 +102,8 @@ it more readable or agreable.
moderators to contact the person who proposed the event, to inform her
about her acceptation or rejection. If this address is absent, the
contact's will be used
tags_helper: Separated with spaces, contain letters, numbers and hyphens.
Add the event's organisation(s), but not the city or region.
tag_list_helper: Separated with spaces, contain letters, numbers and
hyphens. Add the event's organisation(s), but not the city or region.
save: Validate
visualise: Visualise
cancel:
@ -153,7 +153,6 @@ it more readable or agreable.
tags:
index:
title: Tags
limited: Only tags on more than three events are displayed in this list
show:
links: See also
future: Future
@ -279,7 +278,7 @@ description."
inform about her acceptation or rejection. If this address is
present, this organisation will only be editable by the submitter, who
will receive a secret edition link...
tags_helper: Separated with spaces, contain letters, numbers and hyphens
tag_list_helper: Separated with spaces, contain letters, numbers and hyphens
save: Save
validate:
title: Organisation moderation

14
config/locales/views/fr.yml

@ -24,7 +24,7 @@ fr:
propose: Proposer un événement
propose_orga: Proposer une organisation
map: Carte
tags: Mots-clés
tag_list: Mots-clés
infos: Infos
stats: Statistiques
contact: Contact
@ -95,9 +95,9 @@ fr:
sera utilisée que par les modérateurs pour contacter la personne ayant
proposé l'événement, pour l'informer de sa validation ou de son rejet.
Si cette adresse n'est pas présente, l'adresse de contact sera utilisée
tags_helper: Séparés par des espaces, constitués de lettres, chiffres et
tirets. Ajoutez le nom de la ou des organisations de l'événement, mais
pas de la ville ou de la région.
tag_list_helper: Séparés par des espaces, constitués de lettres, chiffres
et tirets. Ajoutez le nom de la ou des organisations de l'événement,
mais pas de la ville ou de la région.
save: Valider
visualise: Visualiser
cancel:
@ -149,8 +149,6 @@ fr:
tags:
index:
title: Mots-clés
limited: Seuls les mots-clés portants sur plus de trois événements sont
affichés dans cette liste
show:
links: Voir aussi
future: Prochainement
@ -282,8 +280,8 @@ description plus complète."
Utilisée par les modérateurs pour informer de sa validation ou de son
rejet. Si cette adresse est présente, l'organisation ne sera modifiable
que par le soumetteur, qui recevra un lien secret d'édition...
tags_helper: Séparés par des espaces, constitués de lettres, chiffres et
tirets
tag_list_helper: Séparés par des espaces, constitués de lettres, chiffres
et tirets
save: Envoyer
validate:
title: Modération d'organisation

35
db/migrate/20161210105328_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb

@ -0,0 +1,35 @@
# This migration comes from acts_as_taggable_on_engine (originally 1)
class ActsAsTaggableOnMigration < ActiveRecord::Migration
def taggings
create_table :taggings do |t|
t.references :tag
# You should make sure that the column created is
# long enough to store the required class names.
t.references :taggable, polymorphic: true
t.references :tagger, polymorphic: true
# Limit is created to prevent MySQL error on index
# length for MyISAM table type: http://bit.ly/vgW2Ql
t.string :context, limit: 128
t.datetime :created_at
end
add_index :taggings, :tag_id
add_index :taggings, [:taggable_id, :taggable_type, :context]
end
def self.up
create_table :tags do |t|
t.string :name
end
taggings
end
def self.down
drop_table :taggings
drop_table :tags
end
end

22
db/migrate/20161210105329_add_missing_unique_indices.acts_as_taggable_on_engine.rb

@ -0,0 +1,22 @@
# This migration comes from acts_as_taggable_on_engine (originally 2)
class AddMissingUniqueIndices < ActiveRecord::Migration
def self.up
add_index :tags, :name, unique: true
remove_index :taggings, :tag_id if index_exists?(:taggings, :tag_id)
remove_index :taggings, [:taggable_id, :taggable_type, :context]
add_index :taggings,
[:tag_id, :taggable_id, :taggable_type, :context, :tagger_id,
:tagger_type],
unique: true, name: 'taggings_idx'
end
def self.down
remove_index :tags, :name
remove_index :taggings, name: 'taggings_idx'
add_index :taggings, :tag_id unless index_exists?(:taggings, :tag_id)
add_index :taggings, [:taggable_id, :taggable_type, :context]
end
end

15
db/migrate/20161210105330_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb

@ -0,0 +1,15 @@
# This migration comes from acts_as_taggable_on_engine (originally 3)
class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
def self.up
add_column :tags, :taggings_count, :integer, default: 0
ActsAsTaggableOn::Tag.reset_column_information
ActsAsTaggableOn::Tag.find_each do |tag|
ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
end
end
def self.down
remove_column :tags, :taggings_count
end
end

10
db/migrate/20161210105331_add_missing_taggable_index.acts_as_taggable_on_engine.rb

@ -0,0 +1,10 @@
# This migration comes from acts_as_taggable_on_engine (originally 4)
class AddMissingTaggableIndex < ActiveRecord::Migration
def self.up
add_index :taggings, [:taggable_id, :taggable_type, :context]
end
def self.down
remove_index :taggings, [:taggable_id, :taggable_type, :context]
end
end

10
db/migrate/20161210105332_change_collation_for_tag_names.acts_as_taggable_on_engine.rb

@ -0,0 +1,10 @@
# This migration comes from acts_as_taggable_on_engine (originally 5)
# This migration is added to circumvent issue #623 and have special characters
# work properly
class ChangeCollationForTagNames < ActiveRecord::Migration
def up
return unless ActsAsTaggableOn::Utils.using_mysql?
execute 'ALTER TABLE tags MODIFY name varchar(255)
CHARACTER SET utf8 COLLATE utf8_bin;'
end
end

14
db/migrate/20161210105333_add_missing_indexes.acts_as_taggable_on_engine.rb

@ -0,0 +1,14 @@
# This migration comes from acts_as_taggable_on_engine (originally 6)
class AddMissingIndexes < ActiveRecord::Migration
def change
add_index :taggings, :tag_id
add_index :taggings, :taggable_id
add_index :taggings, :taggable_type
add_index :taggings, :tagger_id
add_index :taggings, :context
add_index :taggings, [:tagger_id, :tagger_type]
add_index :taggings, [:taggable_id, :taggable_type, :tagger_id, :context],
name: 'taggings_idy'
end
end

20
db/migrate/20161210154558_populate_tags.rb

@ -0,0 +1,20 @@
# Migrate tags from inline attribute to separate table
class PopulateTags < ActiveRecord::Migration
def self.up
execute('SELECT id, tags FROM events;').each do |result|
event = Event.find_by id: result[0]
event.tag_list = result[1] + ' helo world'
event.save
say event.id
say event.tag_list
end
change_column :events, :tags, :text, null: true
change_column :orgas, :tags, :text, null: true
end
def self.down
change_column :events, :tags, :text, null: false
change_column :orgas, :tags, :text, null: false
end
end

46
db/schema.rb

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161031215120) do
ActiveRecord::Schema.define(version: 20161210154558) do
create_table "active_admin_comments", force: :cascade do |t|
t.string "namespace", limit: 255
@ -29,16 +29,16 @@ ActiveRecord::Schema.define(version: 20161031215120) do
add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
create_table "admin_users", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", limit: 4, default: 0, null: false
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -70,7 +70,7 @@ ActiveRecord::Schema.define(version: 20161031215120) do
t.string "contact", limit: 255, default: "", null: false
t.string "submitter", limit: 255, default: "", null: false
t.integer "moderated", limit: 4, default: 0, null: false
t.string "tags", limit: 255, default: "", null: false
t.text "tags", limit: 255, default: ""
t.string "secret", limit: 255, default: "", null: false
t.datetime "decision_time"
t.datetime "submission_time"
@ -124,7 +124,7 @@ ActiveRecord::Schema.define(version: 20161031215120) do
t.datetime "created_at"
t.datetime "updated_at"
t.text "tag"
t.string "tags", limit: 255, default: "", null: false
t.text "tags", default: ""
t.text "diaspora"
t.text "object_changes"
t.text "place_name"
@ -142,23 +142,21 @@ ActiveRecord::Schema.define(version: 20161031215120) do
create_table "taggings", force: :cascade do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type", limit: 255
t.string "taggable_type"
t.integer "tagger_id"
t.string "tagger_type", limit: 255
t.string "tagger_type"