disable data transform when switching attribute field type. new member stable
This commit is contained in:
parent
0d26f48c9a
commit
6dff83339a
|
@ -13,8 +13,10 @@ $(document).ready(function(){
|
||||||
$(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
|
$(this).parents(".map-block").find(".form-horizontal").toggleClass("hide");
|
||||||
if($(this).parents(".map-block").hasClass("disabled")){
|
if($(this).parents(".map-block").hasClass("disabled")){
|
||||||
$(this).text("OFF");
|
$(this).text("OFF");
|
||||||
|
$(this).siblings(".subrole_disable_field").val("true");
|
||||||
}else{
|
}else{
|
||||||
$(this).text("ON");
|
$(this).text("ON");
|
||||||
|
$(this).siblings(".subrole_disable_field").val("false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($(this).parents("legend").length==1) {
|
if($(this).parents("legend").length==1) {
|
||||||
|
@ -22,8 +24,10 @@ $(document).ready(function(){
|
||||||
$(this).parents("legend").next("div").toggleClass("hide");
|
$(this).parents("legend").next("div").toggleClass("hide");
|
||||||
if($(this).parents("legend").next("div").hasClass("hide")){
|
if($(this).parents("legend").next("div").hasClass("hide")){
|
||||||
$(this).text("OFF");
|
$(this).text("OFF");
|
||||||
|
$(this).siblings(".subrole_disable_field").val("true");
|
||||||
}else{
|
}else{
|
||||||
$(this).text("ON");
|
$(this).text("ON");
|
||||||
|
$(this).siblings(".subrole_disable_field").val("false");
|
||||||
}
|
}
|
||||||
checkSwitch();
|
checkSwitch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
|
||||||
# before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
# before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||||
|
|
||||||
before_filter :force_order_for_visitor,:only=>[:index,:show]
|
before_filter :force_order_for_visitor,:only=>[:index,:show]
|
||||||
before_filter :force_order_for_user,:except => [:index,:show]
|
before_filter :authenticate_user!,:except => [:index,:show]
|
||||||
before_filter :for_app_sub_manager,:except => [:index,:show]
|
before_filter :set_attribute,:except => [:index,:show]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
get_tags
|
get_tags
|
||||||
|
|
|
@ -55,8 +55,20 @@ module AttributeFieldsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_date
|
def render_date
|
||||||
|
if date_is_range?
|
||||||
|
fill_from = @attribute_value.get_date(:from) rescue nil
|
||||||
|
fill_to = @attribute_value.get_date(:to) rescue nil
|
||||||
|
control_group_wrapper do
|
||||||
|
buf = date_select(get_field_name_base+'[from]',nil,@markup_options.merge(:default=>fill_from),:class=>"input-small")
|
||||||
|
buf << ' ~ '
|
||||||
|
buf << date_select(get_field_name_base+'[to]',nil,@markup_options.merge(:default=>fill_to),:class=>"input-small")
|
||||||
|
buf
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@prefiled_value = @attribute_value.get_date
|
||||||
control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
|
control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def render_date_durnation #Need re-write low priority
|
def render_date_durnation #Need re-write low priority
|
||||||
|
|
||||||
|
@ -66,7 +78,7 @@ module AttributeFieldsHelper
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
control_group_wrapper do
|
control_group_wrapper do
|
||||||
self[:option_list].collect do |key,value|
|
self[:option_list].collect do |key,value|
|
||||||
label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label"))
|
label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>" radio inline"))
|
||||||
end.join
|
end.join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -87,13 +99,23 @@ module AttributeFieldsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_text_field
|
def render_text_field
|
||||||
control_group_wrapper do |key,value|
|
a = control_group_wrapper do |key,value|
|
||||||
add_more_blank = can_add_more ? "[]" : ""
|
add_more_blank = can_add_more ? "[]" : ""
|
||||||
key_field = can_muti_lang_input? ? "[#{key}]" : ""
|
key_field = can_muti_lang_input? ? "[#{key}]" : ""
|
||||||
place_holder= @panel_setting["placeholder"][key] rescue ''
|
place_holder= @panel_setting["placeholder"][key] rescue ''
|
||||||
text_field_tag([get_field_name_base,add_more_blank,key_field].join, value,@markup_options.merge(:placeholder=>place_holder))
|
text_field_tag([get_field_name_base,add_more_blank,key_field].join, value,@markup_options.merge(:placeholder=>place_holder))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def date_is_range?
|
||||||
|
is_range = "false"
|
||||||
|
data = get_data
|
||||||
|
if !data.nil?
|
||||||
|
is_range = data['is_range'] if data.has_key? "is_range"
|
||||||
|
end
|
||||||
|
is_range == "true"
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def lang_panel_tabbable_wrapper(add_more_params,&block)
|
def lang_panel_tabbable_wrapper(add_more_params,&block)
|
||||||
|
@ -117,17 +139,15 @@ protected
|
||||||
content_tag(:div,yield(key,value),:class=>div_class)
|
content_tag(:div,yield(key,value),:class=>div_class)
|
||||||
end# of VALID_LOCALES.collect for tabed input
|
end# of VALID_LOCALES.collect for tabed input
|
||||||
buff << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window",:class=>'btn edit-btn',:type=>'button',:data=>{:toggle=>"modal"}) if self.markup == 'address'
|
buff << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window",:class=>'btn edit-btn',:type=>'button',:data=>{:toggle=>"modal"}) if self.markup == 'address'
|
||||||
buff << link_to((content_tag :i,'',:class=>'icon-trash'),"#") if self.add_more
|
buff << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn removeInput") if self.add_more
|
||||||
|
|
||||||
|
buff.join('').html_safe
|
||||||
# buff << '<a href="#" class="btn removeInput" type="button"><i class="icon-trash"></i></a>' if self.add_more
|
|
||||||
buff.join("\n").html_safe
|
|
||||||
end
|
end
|
||||||
tmp << content_tag(:ul,:class=> 'nav nav-pills') do
|
tmp << content_tag(:ul,:class=> 'nav nav-pills') do
|
||||||
VALID_LOCALES.each.collect do |key|
|
VALID_LOCALES.each.collect do |key|
|
||||||
# link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}"
|
# link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}"
|
||||||
link_entry_ary = [".#{get_pairing_tab_class({})}",".#{key}"]
|
link_entry_ary = [".#{get_pairing_tab_class({})}",".#{key}"]
|
||||||
# link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
|
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
|
||||||
link_entry = link_entry_ary.join
|
link_entry = link_entry_ary.join
|
||||||
content_tag(:li,link_to(I18n.t("langs."+key),link_entry,:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil),:for=>key)
|
content_tag(:li,link_to(I18n.t("langs."+key),link_entry,:data=>{:toggle=>"tab"}),:class=>(key == I18n.locale.to_s ? "active" : nil),:for=>key)
|
||||||
end.join.html_safe # of VALID_LOCALES.collect for tabs
|
end.join.html_safe # of VALID_LOCALES.collect for tabs
|
||||||
|
@ -151,16 +171,18 @@ protected
|
||||||
if can_muti_lang_input?
|
if can_muti_lang_input?
|
||||||
result << lang_panel_tabbable_wrapper(add_more_params,&block)
|
result << lang_panel_tabbable_wrapper(add_more_params,&block)
|
||||||
result << gen_modal_dialog if self.markup == "address"
|
result << gen_modal_dialog if self.markup == "address"
|
||||||
else
|
else #cross lang field
|
||||||
|
|
||||||
value = case can_add_more
|
case can_add_more
|
||||||
when true
|
when true
|
||||||
add_more_params[0]
|
value = add_more_params[0][:value]
|
||||||
|
result << content_tag(:div,:class=>"input-append"){yield(nil,value) + link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn removeInput") }
|
||||||
else
|
else
|
||||||
@prefiled_value
|
value = @prefiled_value
|
||||||
|
result << yield(nil,value)
|
||||||
end
|
end
|
||||||
|
|
||||||
result << yield(nil,value)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
result.html_safe
|
result.html_safe
|
||||||
|
@ -173,12 +195,12 @@ protected
|
||||||
case self.markup
|
case self.markup
|
||||||
when "text_field"
|
when "text_field"
|
||||||
if can_add_more
|
if can_add_more
|
||||||
multipleInput_ary = %w{multipleInput editMore}
|
multipleInput_ary = %w{multipleInput}
|
||||||
add_more_seri = "add_more_group_#{id}"
|
add_more_seri = "add_more_group_#{id}"
|
||||||
multipleInputs = content_tag :div,:class=> multipleInput_ary.join(' ') ,:ext_class=>get_pairing_tab_class({}) do
|
multipleInputs = content_tag :div,:class=> multipleInput_ary.join(' ') ,:ext_class=>get_pairing_tab_class({}) do
|
||||||
@attribute_value.add_more_counter.times.collect do |t|
|
@attribute_value.add_more_counter.times.collect do |t|
|
||||||
controls_wrapper(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block)
|
controls_wrapper(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block)
|
||||||
end.join("\n").html_safe # of add_more fields
|
end.join('').html_safe # of add_more fields
|
||||||
end # of div multipleInput editMore
|
end # of div multipleInput editMore
|
||||||
result = label + multipleInputs + add_more_unt
|
result = label + multipleInputs + add_more_unt
|
||||||
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
|
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
|
||||||
|
@ -267,7 +289,7 @@ protected
|
||||||
if self.markup == "address"
|
if self.markup == "address"
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
locale and LIST[:markups][markup]["ext_support"] && add_more
|
add_more
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
module AttributeValuesHelper
|
module AttributeValuesHelper
|
||||||
def show_west_calender
|
def show_west_calender(from_to=nil)
|
||||||
|
case from_to
|
||||||
|
when :to
|
||||||
|
date = get_date(:to)
|
||||||
|
when :from
|
||||||
|
date = get_date(:from)
|
||||||
|
when nil
|
||||||
date = get_date
|
date = get_date
|
||||||
|
end
|
||||||
|
|
||||||
case self.attribute_field["typeC"]["format"]
|
case self.attribute_field["typeC"]["format"]
|
||||||
when 'format1' # Y/M/D h:m
|
when 'format1' # Y/M/D h:m
|
||||||
date.strftime("%Y/%m/%d %H:%M")
|
date.strftime("%Y/%m/%d %H:%M")
|
||||||
|
@ -13,9 +21,16 @@ module AttributeValuesHelper
|
||||||
end # of case west cal format
|
end # of case west cal format
|
||||||
end
|
end
|
||||||
|
|
||||||
def show_minguo_calendar
|
def show_minguo_calendar(from_to=nil)
|
||||||
get_minguo
|
get_minguo
|
||||||
|
case from_to
|
||||||
|
when :to
|
||||||
|
date = get_date(:to)
|
||||||
|
when :from
|
||||||
|
date = get_date(:from)
|
||||||
|
when nil
|
||||||
date = get_date
|
date = get_date
|
||||||
|
end
|
||||||
year_str = ""
|
year_str = ""
|
||||||
unless date.year == 1912
|
unless date.year == 1912
|
||||||
m_year = (date.year - 1912).abs.to_s + I18n.t("admin.infos.date.minguo_calendar.year")
|
m_year = (date.year - 1912).abs.to_s + I18n.t("admin.infos.date.minguo_calendar.year")
|
||||||
|
@ -52,17 +67,17 @@ module AttributeValuesHelper
|
||||||
end # of case
|
end # of case
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_date_by_format
|
def get_date_by_format(from_to = nil)
|
||||||
case I18n.locale
|
case I18n.locale
|
||||||
when :zh_tw
|
when :zh_tw
|
||||||
case
|
case
|
||||||
when self.attribute_field["typeC"]["claendar"] == "west_claendar"
|
when self.attribute_field["typeC"]["claendar"] == "west_claendar"
|
||||||
show_west_calender
|
show_west_calender(from_to)
|
||||||
when self.attribute_field["typeC"]["claendar"] == "tw_claendar"
|
when self.attribute_field["typeC"]["claendar"] == "tw_claendar"
|
||||||
show_minguo_calendar
|
show_minguo_calendar(from_to)
|
||||||
end #case self.attribute_field["typeC"]["claendar"]
|
end #case self.attribute_field["typeC"]["claendar"]
|
||||||
when :en
|
when :en
|
||||||
show_west_calender
|
show_west_calender(from_to)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -30,12 +30,7 @@ class AttributeField
|
||||||
end
|
end
|
||||||
|
|
||||||
def locale
|
def locale
|
||||||
default = true
|
get_data["cross_lang"] == "true" ? false : true
|
||||||
if get_data["locale"].nil?
|
|
||||||
return default
|
|
||||||
else
|
|
||||||
(get_data["locale"] == "true" ? true : false) rescue default
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self_defined_markup_options?
|
def self_defined_markup_options?
|
||||||
|
@ -107,56 +102,63 @@ protected
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_more_convert(opt)
|
def add_more_convert(opt)
|
||||||
case opt
|
# case opt
|
||||||
when :to_add_more
|
# when :to_add_more
|
||||||
self.attribute_values.each do |av|
|
# self.attribute_values.each do |av|
|
||||||
VALID_LOCALES.each do |loc|
|
# VALID_LOCALES.each do |loc|
|
||||||
splited_str = av[loc].split(",") rescue []
|
# splited_str = av[loc].split(",") rescue []
|
||||||
av["val"] = [] if av["val"].nil?
|
# av["val"] = [] if av["val"].nil?
|
||||||
splited_str.each_with_index{|value,index| av["val"][index] = av["val"][index].nil? ? {loc=>value} : av["val"][index].merge(loc=>value) }
|
|
||||||
end
|
# old_data = av["val"]
|
||||||
av.unset_all_lang_values
|
# av["val"] = []
|
||||||
av.save
|
# splited_str.each_with_index do |value,index|
|
||||||
end #of self.attribute_values.each
|
# av["val"][index] = {loc=>value}
|
||||||
when :to_no_add_more
|
# end
|
||||||
self.attribute_values.each do |av|
|
# av["val"] << old_data
|
||||||
VALID_LOCALES.each do |loc|
|
# end
|
||||||
if av["val"].kind_of? Array
|
# av.unset_all_lang_values
|
||||||
av[loc] = av["val"].collect{|t| t[loc]}.join(",")
|
# av.save
|
||||||
else
|
# end #of self.attribute_values.each
|
||||||
av[loc] = av["val"]
|
# when :to_no_add_more
|
||||||
end
|
# self.attribute_values.each do |av|
|
||||||
end
|
# VALID_LOCALES.each do |loc|
|
||||||
av.unset("val")
|
# binding.pry
|
||||||
av.save
|
# if av["val"].kind_of? Array
|
||||||
end #of self.attribute_values.each
|
# av[loc] = av["val"].collect{|t| t[loc]}.join(",")
|
||||||
end
|
# else
|
||||||
|
# av[loc] = av["val"]
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# av.unset("val")
|
||||||
|
# av.save
|
||||||
|
# end #of self.attribute_values.each
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def cross_lang_convert(opt)
|
def cross_lang_convert(opt)
|
||||||
case opt
|
# case opt
|
||||||
when :to_cross_lang
|
# when :to_cross_lang
|
||||||
self.attribute_values.each do |av|
|
# self.attribute_values.each do |av|
|
||||||
if add_more
|
# if add_more
|
||||||
av["val"] = av["val"].collect{|t| t.invert.keys.join(",")}
|
# av["val"] = av["val"].collect{|t| t.invert.keys.join(",")}
|
||||||
else
|
# else
|
||||||
av["val"] = VALID_LOCALES.collect{|t| av[t]}.join(",")
|
# av["val"] = VALID_LOCALES.collect{|t| av[t]}.join(",")
|
||||||
av.unset_all_lang_values
|
# av.unset_all_lang_values
|
||||||
end
|
# end
|
||||||
av.save
|
# av.save
|
||||||
end #of self.attribute_values.each
|
# end #of self.attribute_values.each
|
||||||
when :to_no_cross_lang
|
# when :to_no_cross_lang
|
||||||
default_locale = I18n.default_locale.to_s
|
# default_locale = I18n.default_locale.to_s
|
||||||
self.attribute_values.each do |av|
|
# self.attribute_values.each do |av|
|
||||||
if add_more
|
# if add_more
|
||||||
av["val"] = av["val"].collect{|t| {default_locale => t} } #unless av["val"].nil?
|
# av["val"] = av["val"].collect{|t| {default_locale => t} } #unless av["val"].nil?
|
||||||
else
|
# else
|
||||||
av[default_locale] = av["val"]
|
# av[default_locale] = av["val"]
|
||||||
av.unset("val")
|
# av.unset("val")
|
||||||
end
|
# end
|
||||||
av.save
|
# av.save
|
||||||
end #of self.attribute_values.each
|
# end #of self.attribute_values.each
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_add_more_convert(var)
|
def check_add_more_convert(var)
|
||||||
|
|
|
@ -49,7 +49,12 @@ class AttributeValue
|
||||||
when "text_field"
|
when "text_field"
|
||||||
case self.attribute_field.add_more
|
case self.attribute_field.add_more
|
||||||
when true
|
when true
|
||||||
|
if self.attribute_field.locale
|
||||||
add_more_index.nil? ? self.value.collect{|t| t[locale]}.join(",") : self.value(add_more_index)[locale]
|
add_more_index.nil? ? self.value.collect{|t| t[locale]}.join(",") : self.value(add_more_index)[locale]
|
||||||
|
else
|
||||||
|
add_more_index.nil? ? self.value.join(",") : self.value(add_more_index)
|
||||||
|
end
|
||||||
|
|
||||||
when false
|
when false
|
||||||
self.attribute_field.locale ? self[locale.to_s] : self.value
|
self.attribute_field.locale ? self[locale.to_s] : self.value
|
||||||
end
|
end
|
||||||
|
@ -62,7 +67,11 @@ class AttributeValue
|
||||||
self.attribute_field.locale ? self[locale.to_s] : self.value
|
self.attribute_field.locale ? self[locale.to_s] : self.value
|
||||||
|
|
||||||
when "date"
|
when "date"
|
||||||
|
if self.attribute_field.date_is_range?
|
||||||
|
get_date_by_format(:from) + ' ~ ' + get_date_by_format(:to)
|
||||||
|
else
|
||||||
get_date_by_format
|
get_date_by_format
|
||||||
|
end
|
||||||
|
|
||||||
when "address"
|
when "address"
|
||||||
self.value[locale.to_s]
|
self.value[locale.to_s]
|
||||||
|
@ -83,6 +92,18 @@ class AttributeValue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_date(item = nil)
|
||||||
|
case item
|
||||||
|
when :from
|
||||||
|
data = self[:val]["from"]
|
||||||
|
when :to
|
||||||
|
data = self[:val]["to"]
|
||||||
|
when nil
|
||||||
|
data = self[:val]
|
||||||
|
end
|
||||||
|
Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
@ -130,9 +151,4 @@ def unset_all_lang_values
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def get_date
|
|
||||||
Date.new(self[:val]["(1i)"].to_i,self[:val]["(2i)"].to_i,self[:val]["(3i)"].to_i) rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= render :partial=>"placeholder_block",:locals=>{:value=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.item_name"),:field_name=>"info[title_translations]"}%>
|
<%= render :partial=>"placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t("admin.infos.item_name"),:field_name=>"info[title_translations]"}%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -66,10 +66,10 @@
|
||||||
<label class="control-label"><%= t("admin.infos.date.range")%></label>
|
<label class="control-label"><%= t("admin.infos.date.range")%></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<label class="radio inline">
|
<label class="radio inline">
|
||||||
<%= radio_button("info[attribute_fields][#{attribute_field_counter}][typeC]", "is_range", "false",:checked => (attribute_field["typeC"]["is_range"]== "false" ? true : false)) %><%= t("admin.infos.not_range")%>
|
<%= radio_button("info[attribute_fields][#{attribute_field_counter}][typeC]", "is_range", "false",:checked => (!attribute_field.date_is_range? ? true : false)) %><%= t("admin.infos.not_range")%>
|
||||||
</label>
|
</label>
|
||||||
<label class="radio inline">
|
<label class="radio inline">
|
||||||
<%= radio_button("info[attribute_fields][#{attribute_field_counter}][typeC]", "is_range", "true",:checked => (attribute_field["typeC"]["is_range"]== "true" ? true : false)) %><%= t("admin.infos.is_range")%>
|
<%= radio_button("info[attribute_fields][#{attribute_field_counter}][typeC]", "is_range", "true",:checked => (attribute_field.date_is_range? ? true : false)) %><%= t("admin.infos.is_range")%>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<% active = (locale == @site_valid_locales.first ? "active in" : "'") %>
|
<% active = (locale == @site_valid_locales.first ? "active in" : "'") %>
|
||||||
<%= content_tag :div,:class=>"tab-pane fade #{active}",:id=>"#{name_to_id(field_name)}_#{locale}" do%>
|
<%= content_tag :div,:class=>"tab-pane fade #{active}",:id=>"#{name_to_id(field_name)}_#{locale}" do%>
|
||||||
<% value = values[locale.to_s] rescue nil%>
|
<% locale_value = values[locale.to_s] rescue nil%>
|
||||||
<%= text_field(field_name, locale,:value=>value,:placeholder=>t("langs.#{locale}")) %>
|
<%= text_field(field_name, locale,:value=>locale_value,:placeholder=>t("langs.#{locale}")) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
<% role.sub_roles.each do |sub_role| %>
|
<% role.sub_roles.each do |sub_role| %>
|
||||||
<% sub_role_disable = @user.sub_roles.include?(sub_role) ? false : true %>
|
<% sub_role_disable = @user.sub_roles.include?(sub_role) ? false : true %>
|
||||||
<%= hidden_field_tag("user[disable_sub_role][id][#{sub_role.id}]",sub_role_disable,:for=>@form_index,:class=>"subrole_disable_field",:value=>sub_role_disable)%>
|
|
||||||
<%#= hidden_field_tag("[user][new_attribute_values][sub_role][disable][#{sub_role.id}]",sub_role_disable)%>
|
<%#= hidden_field_tag("[user][new_attribute_values][sub_role][disable][#{sub_role.id}]",sub_role_disable)%>
|
||||||
<legend>
|
<legend>
|
||||||
<button for=<%=@form_index%> class="onoff pull-right <%= sub_role_disable ? 'disabled' : '' %> ">ON</button><%= sub_role.title %>
|
<button for=<%=@form_index%> class="onoff pull-right <%= sub_role_disable ? 'disabled' : '' %> ">ON</button><%= sub_role.title %>
|
||||||
|
<%= hidden_field_tag("user[disable_sub_role][id][#{sub_role.id}]",sub_role_disable,:for=>@form_index,:class=>"subrole_disable_field",:value=>sub_role_disable)%>
|
||||||
</legend>
|
</legend>
|
||||||
<div class="controls-block <%= sub_role_disable ? 'hide' : '' %>" >
|
<div class="controls-block <%= sub_role_disable ? 'hide' : '' %>" >
|
||||||
<% sub_role.attribute_fields.each do |af|%>
|
<% sub_role.attribute_fields.each do |af|%>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('users_new_interface')) do -%>
|
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('users_new_interface')) do -%>
|
||||||
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.all_user') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, admin_users_new_interface_index_path), :class => active_for_action('users_new_interface', 'index') %>
|
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.all_user') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, admin_users_new_interface_index_path), :class => active_for_action('users_new_interface', 'index') %>
|
||||||
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.add_user') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') %>
|
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.add_user') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') %>
|
||||||
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.user_roles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, ), :class => active_for_action('users_new_interfacexx', 'index') %>
|
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.user_roles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe,admin_infos_path ), :class => active_for_action('users_new_interfacexx', 'index') %>
|
||||||
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.user_info') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, ), :class => active_for_action('users_new_interfacexx', 'index') %>
|
<%= content_tag :li, link_to((t('admin.new_admin.side_bar.user_info') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, admin_roles_path), :class => active_for_action('users_new_interfacexx', 'index') %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ defaults: &defaults
|
||||||
host: localhost
|
host: localhost
|
||||||
# slaves:
|
# slaves:
|
||||||
# - host: slave1.local
|
# - host: slave1.local
|
||||||
port: 37017
|
port: 27017
|
||||||
# - host: slave2.local
|
# - host: slave2.local
|
||||||
# port: 27019
|
# port: 27019
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,25 @@
|
||||||
require 'resque_scheduler/tasks'
|
require 'resque_scheduler/tasks'
|
||||||
|
|
||||||
namespace :data_migration do
|
namespace :data_migration do
|
||||||
|
task :migrate_user_infos_from_1121 => :environment do
|
||||||
|
AttributeField.all.each do |af|
|
||||||
|
|
||||||
|
if af.has_attribute?('locale')
|
||||||
|
af.title_translations = case af[:locale]
|
||||||
|
when true
|
||||||
|
af[:locale_title]
|
||||||
|
when false
|
||||||
|
{af[:neutral_for] => af[:neutral_title]}
|
||||||
|
end
|
||||||
|
af.unset("locale")
|
||||||
|
af.unset("locale_title")
|
||||||
|
af.unset("neutral_for")
|
||||||
|
af.unset("neutral_title")
|
||||||
|
af.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
task :add_order_to_announcement_tag_0703 => :environment do
|
task :add_order_to_announcement_tag_0703 => :environment do
|
||||||
AnnouncementTag.first({conditions:{ key: 'students' }}).update_attributes(:order=>1)
|
AnnouncementTag.first({conditions:{ key: 'students' }}).update_attributes(:order=>1)
|
||||||
|
|
Reference in New Issue