Webshims and select2 removed, replaced with straight rails datetime select and jquery tags input
This commit is contained in:
parent
1849ac942b
commit
5b3228dae8
38
Gemfile
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
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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: [' ']
|
||||
|
|
|
@ -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'
|
|
@ -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
|
||||
|
|
|
@ -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 .
|
||||
*/
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# Helper for the tags views
|
||||
module TagsHelper
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(/ /, '')).gsub /^/, ' '
|
||||
=====================================================
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ActsAsTaggableOn.delimiter = ' ' # use space as delimiter
|
||||
ActsAsTaggableOn.force_lowercase = true
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||