fix error
This commit is contained in:
parent
d8a35034f5
commit
93ab471abd
|
@ -1,4 +1,4 @@
|
||||||
class AsksController < ActionController::Base
|
class AsksController < ApplicationController
|
||||||
helper Admin::AsksHelper
|
helper Admin::AsksHelper
|
||||||
include Admin::AsksHelper
|
include Admin::AsksHelper
|
||||||
include ActionView::Helpers::FormHelper
|
include ActionView::Helpers::FormHelper
|
||||||
|
@ -75,8 +75,7 @@ class AsksController < ActionController::Base
|
||||||
page.select_option_items.each do |select_option_item|
|
page.select_option_items.each do |select_option_item|
|
||||||
if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys.first.to_s
|
if !(@show_option_items.nil?) && select_option_item.field_name == @show_option_items.keys.first.to_s
|
||||||
value = YAML.load(select_option_item.value)
|
value = YAML.load(select_option_item.value)
|
||||||
locale = I18n.default_locale
|
I18n.with_locale(:en) do
|
||||||
I18n.with_locale(locale) do
|
|
||||||
if value[locale] == t('ask.widget.index')
|
if value[locale] == t('ask.widget.index')
|
||||||
@layout_type = 'index'
|
@layout_type = 'index'
|
||||||
elsif value[locale] == t('ask.is_published')
|
elsif value[locale] == t('ask.is_published')
|
||||||
|
@ -219,11 +218,11 @@ class AsksController < ActionController::Base
|
||||||
@group_mail = email_er.email_address
|
@group_mail = email_er.email_address
|
||||||
@mail_sentdate = DateTime.now
|
@mail_sentdate = DateTime.now
|
||||||
|
|
||||||
site = Site.first
|
site = current_site rescue Site.first
|
||||||
mail_from = site['title'][site['default_locale']]
|
mail_from = site.title_translations[site.default_locale]
|
||||||
|
|
||||||
email_er.email.update_attributes(
|
email_er.email.update_attributes(
|
||||||
:mail_lang=> site['default_locale'],
|
:mail_lang=> site.default_locale,
|
||||||
:create_user=>(current_user rescue nil),
|
:create_user=>(current_user rescue nil),
|
||||||
:mail_sentdate=>@mail_sentdate,
|
:mail_sentdate=>@mail_sentdate,
|
||||||
:module_app=>@module_app,
|
:module_app=>@module_app,
|
||||||
|
@ -393,7 +392,7 @@ class AsksController < ActionController::Base
|
||||||
switch_form = ''
|
switch_form = ''
|
||||||
default_idx = 0
|
default_idx = 0
|
||||||
if categories.count != 0
|
if categories.count != 0
|
||||||
default_idx = ask_settings[1..-1].map{|a| a.category_id.to_s}.index(categories[0].id.to_s)
|
default_idx = ask_settings[1..-1].to_a.map{|a| a.category_id.to_s}.index(categories[0].id.to_s)
|
||||||
default_idx = default_idx.nil? ? 0 : default_idx + 1
|
default_idx = default_idx.nil? ? 0 : default_idx + 1
|
||||||
end
|
end
|
||||||
switch_form = script_text + ask_settings.collect.with_index do |ask_setting,i|
|
switch_form = script_text + ask_settings.collect.with_index do |ask_setting,i|
|
||||||
|
|
Loading…
Reference in New Issue