Replaced Pen with Quill and removed dead CSS rules
This commit is contained in:
@@ -150,24 +150,24 @@ module FormHelper
|
||||
html_name = name.to_s + (options[:index] ? "[#{options[:index]}]" : '')
|
||||
if options[:plain]
|
||||
html += (text_area_tag html_name, value,
|
||||
id: id,
|
||||
lang: options[:lang],
|
||||
aria: aria,
|
||||
class: css_class
|
||||
id: id,
|
||||
lang: options[:lang],
|
||||
aria: aria,
|
||||
class: css_class
|
||||
)
|
||||
else
|
||||
html += content_tag(:div, value.present? ? value.html_safe : '',
|
||||
html += content_tag(:div,
|
||||
content_tag(:div, (value || '').html_safe, class: :editor).html_safe,
|
||||
id: id,
|
||||
data: { name: html_name, 'edit-on': options[:edit_on] || :load },
|
||||
data: { name: html_name },
|
||||
lang: options[:lang],
|
||||
aria: aria,
|
||||
tabindex: 0,
|
||||
class: [:textarea] + css_class
|
||||
)
|
||||
|
||||
add_stylesheet :editor
|
||||
add_inline_script :pen
|
||||
add_inline_script :markdown
|
||||
add_stylesheet 'quill.css'
|
||||
add_javascript :quill
|
||||
add_inline_script :editor
|
||||
end
|
||||
|
||||
|
||||
+20
-12
@@ -2,24 +2,32 @@
|
||||
module I18nHelper
|
||||
def url_for_locale(locale, url = nil)
|
||||
return url unless locale.present?
|
||||
|
||||
unless url.present?
|
||||
new_params = params.merge({action: (params[:_original_action] || params[:action])})
|
||||
new_params.delete(:_original_action)
|
||||
|
||||
if Rails.env.development? || Rails.env.test?
|
||||
return url_for(new_params.merge({lang: locale.to_s}))
|
||||
end
|
||||
|
||||
subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s
|
||||
return url_for(new_params.merge(host: "#{subdomain}.bikebike.org"))
|
||||
end
|
||||
url ||= current_path
|
||||
|
||||
return url if Rails.env.development? || Rails.env.test?
|
||||
return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview?
|
||||
"https://#{locale.to_s}.bikebike.org#{url}"
|
||||
end
|
||||
|
||||
def current_path
|
||||
new_params = params.merge({action: (params[:_original_action] || params[:action])})
|
||||
new_params.delete(:_original_action)
|
||||
|
||||
if Rails.env.development? || Rails.env.test?
|
||||
return url_for(new_params.merge({lang: locale.to_s}))
|
||||
end
|
||||
|
||||
subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s
|
||||
url_for(new_params.merge(host: "#{subdomain}.bikebike.org"))
|
||||
end
|
||||
|
||||
def canonical_url
|
||||
url = current_path
|
||||
return url if Rails.env.development? || Rails.env.test?
|
||||
return "https://preview.bikebike.org#{url}" if Rails.env.preview?
|
||||
"https://bikebike.org#{url}"
|
||||
end
|
||||
|
||||
def date(date, format = :long)
|
||||
I18n.l(date.is_a?(String) ? Date.parse(date) : date, :format => format)
|
||||
end
|
||||
|
||||
@@ -24,8 +24,8 @@ module PageHelper
|
||||
end
|
||||
|
||||
def add_stylesheet(sheet)
|
||||
@stylesheets ||= []
|
||||
@stylesheets << sheet unless @stylesheets.include?(sheet)
|
||||
@stylesheets ||= Set.new
|
||||
@stylesheets << sheet
|
||||
end
|
||||
|
||||
def stylesheets
|
||||
@@ -35,22 +35,35 @@ module PageHelper
|
||||
end
|
||||
(@stylesheets || []).each do |css|
|
||||
Rack::MiniProfiler.step("inject_css #{css}") do
|
||||
html += inject_css! css.to_s
|
||||
if css =~ /\.css$/
|
||||
html += stylesheet_link_tag css
|
||||
else
|
||||
html += inject_css! css.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
html += stylesheet_link_tag 'i18n-debug' if request.params['i18nDebug']
|
||||
return html.html_safe
|
||||
end
|
||||
|
||||
def add_javascript(script)
|
||||
@javascripts ||= Set.new
|
||||
@javascripts << script
|
||||
end
|
||||
|
||||
def javascripts
|
||||
(@javascripts || []).map { |js| javascript_include_tag js.to_s }.join.html_safe
|
||||
end
|
||||
|
||||
def add_inline_script(script)
|
||||
@_inline_scripts ||= []
|
||||
@_inline_scripts ||= Set.new
|
||||
script = Rails.application.assets.find_asset("#{script.to_s}.js").to_s
|
||||
@_inline_scripts << script unless @_inline_scripts.include?(script)
|
||||
@_inline_scripts << script
|
||||
end
|
||||
|
||||
def inline_scripts
|
||||
return '' unless @_inline_scripts.present?
|
||||
"<script>#{@_inline_scripts.join("\n")}</script>".html_safe
|
||||
javascript_tag @_inline_scripts.to_a.join("\n").html_safe
|
||||
end
|
||||
|
||||
def dom_ready(&block)
|
||||
|
||||
Reference in New Issue
Block a user