forked from saurabh/orbit4-5
fixed member infos,attribute sets, member values
This commit is contained in:
parent
264e61df15
commit
28aab34c95
|
|
@ -96,7 +96,7 @@ function inputAppendLength() {
|
||||||
|
|
||||||
// Role Attribute Template Data
|
// Role Attribute Template Data
|
||||||
function setData(l, type, ol) {
|
function setData(l, type, ol) {
|
||||||
var fields = $('#info').length ? "member_profile_field" : $('#sub_role').length ? "sub_role[attribute_fields]" : "role[attribute_fields]",
|
var fields = $('#info').length ? "info[attribute_fields]" : $('#sub_role').length ? "sub_role[attribute_fields]" : "role[attribute_fields]",
|
||||||
data = {
|
data = {
|
||||||
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
|
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
|
||||||
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
|
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,13 @@ class Admin::MemberInfosController < OrbitMemberController
|
||||||
helper Admin::AttributeValuesViewHelper
|
helper Admin::AttributeValuesViewHelper
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@attributes = MemberProfileField.order('created_at DESC')
|
@attributes = MemberInfo.order('created_at DESC')
|
||||||
@roles = Role.excludes('disabled' => true)
|
@roles = Role.excludes('disabled' => true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@attribute = MemberProfileField.new
|
@attribute = MemberInfo.new
|
||||||
|
render layout: false
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
@ -20,14 +21,30 @@ class Admin::MemberInfosController < OrbitMemberController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@attribute = MemberProfileField.new(member_info_params)
|
@attribute = MemberInfo.new(info_params)
|
||||||
@attribute.save
|
@attribute.save
|
||||||
|
|
||||||
redirect_to action: :index
|
redirect_to action: :index
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@attribute.update_params(member_info_params)
|
if info_params[:attribute_fields].present?
|
||||||
|
info_params[:attribute_fields].each do |a|
|
||||||
|
field_status = a.last[:id].present?
|
||||||
|
@attribute_field = MemberProfileField.add_attribute_field(@attribute, a.last, a.last[:id], field_status)
|
||||||
|
end
|
||||||
|
flash.now[:notice] = "Updated Fields"
|
||||||
|
respond_to do |format|
|
||||||
|
format.js { render 'admin/member_infos/add_attribute_field' }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@attribute.update_attributes(info_params)
|
||||||
|
@attribute.member_profile_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to(admin_member_infos_path) }
|
||||||
|
format.js { render 'admin/member_infos/toggle_enable' }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
@ -38,12 +55,11 @@ class Admin::MemberInfosController < OrbitMemberController
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_member_info
|
def set_member_info
|
||||||
@attribute = MemberProfileField.find(params[:id])
|
@attribute = MemberInfo.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
def info_params
|
||||||
def member_info_params
|
params.require(:info).permit!
|
||||||
params.require(:member_profile_field).permit!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
||||||
|
|
@ -114,9 +114,9 @@ class Admin::MembersController < OrbitMemberController
|
||||||
if @member.save
|
if @member.save
|
||||||
@user.member_profile_id = @member.id
|
@user.member_profile_id = @member.id
|
||||||
|
|
||||||
if !params[:member_profile_field_value].nil?
|
if !params[:member_profile_field_values].nil?
|
||||||
params[:member_profile_field_value].each_with_index do |m,i|
|
params[:member_profile_field_values].each_with_index do |m,i|
|
||||||
@custom_field_value = @member.member_profile_field_values.new(value: m.second["value"], member_profile_field_id: m.second["member_profile_field_id"])
|
@custom_field_value = @member.member_profile_field_values.build(value: m.second["value"], member_profile_field_id: m.second["member_profile_field_id"])
|
||||||
@custom_field_value.save
|
@custom_field_value.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -130,7 +130,7 @@ class Admin::MembersController < OrbitMemberController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @member.update(member_profile_params)
|
if @member.update_attributes(member_profile_params)
|
||||||
if @member.user.present?
|
if @member.user.present?
|
||||||
@member.user.update(user_params)
|
@member.user.update(user_params)
|
||||||
else
|
else
|
||||||
|
|
@ -138,6 +138,18 @@ class Admin::MembersController < OrbitMemberController
|
||||||
@user.save
|
@user.save
|
||||||
@user.update_attributes(member_profile_id: @member.id)
|
@user.update_attributes(member_profile_id: @member.id)
|
||||||
end
|
end
|
||||||
|
if !params[:member_profile_field_values].nil?
|
||||||
|
params[:member_profile_field_values].each_with_index do |m,i|
|
||||||
|
field_value = m.last[:id].present?
|
||||||
|
@custom_field_value = MemberProfileFieldValue.put_field_values(@member, m.last, m.last[:id], field_value)
|
||||||
|
end
|
||||||
|
# elsif !params[:member_profile_field_value].nil?
|
||||||
|
# params[:member_profile_field_value].each_with_index do |m,i|
|
||||||
|
# field_value = m.last[:id].present?
|
||||||
|
# @custom_field_value = MemberProfileFieldValue.put_field_values(@member, m.last, nil, field_value)
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
format.html { redirect_to admin_members_path, notice: 'Successfully Updated the User' }
|
format.html { redirect_to admin_members_path, notice: 'Successfully Updated the User' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ module AttributeFieldsHelper
|
||||||
def render_checkbox
|
def render_checkbox
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
control_group_wrapper do
|
control_group_wrapper do
|
||||||
a = self[:option_list].collect do |key,value|
|
a = self.typeE[:option_list].collect do |key,value|
|
||||||
label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
|
label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
|
||||||
end.join rescue ""
|
end.join rescue ""
|
||||||
end
|
end
|
||||||
|
|
@ -132,22 +132,22 @@ module AttributeFieldsHelper
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_radio_button
|
def render_radio_button
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
control_group_wrapper do
|
control_group_wrapper do
|
||||||
self[:option_list].collect do |key,value|
|
self.typeE[: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=>"radio inline"))
|
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
|
||||||
|
|
||||||
def render_select
|
def render_select
|
||||||
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil
|
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil
|
||||||
@markup_options.merge!(:prompt => prompt) unless prompt.nil?
|
@markup_options.merge!(:prompt => prompt) unless prompt.nil?
|
||||||
control_group_wrapper{select_tag( get_field_name_base,options_for_select(self.option_list.collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue ""
|
control_group_wrapper{select_tag( get_field_name_base,options_for_select(self.typeB["option_list"].collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue ""
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_text_area
|
def render_text_area
|
||||||
control_group_wrapper do |key,value|
|
control_group_wrapper do |key,value|
|
||||||
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value
|
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value
|
||||||
key = can_muti_lang_input? ? "[#{key}]" : ""
|
key = can_muti_lang_input? ? "[#{key}]" : ""
|
||||||
|
|
@ -422,7 +422,7 @@ protected
|
||||||
|
|
||||||
def get_basic_field_name_base
|
def get_basic_field_name_base
|
||||||
if @new_attribute
|
if @new_attribute
|
||||||
"member_profile_field_value[#{@index}]"
|
"member_profile_field_values[#{@index}]"
|
||||||
else
|
else
|
||||||
"member_profile_field_values[#{@index}]"
|
"member_profile_field_values[#{@index}]"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
class MemberInfo
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :key, type: String
|
||||||
|
field :built_in, type: Boolean, default: false
|
||||||
|
field :disabled, type: Boolean, default: false
|
||||||
|
field :title, localize: true
|
||||||
|
|
||||||
|
field :to_search, type: Boolean, default: false
|
||||||
|
field :to_show, type: Boolean, default: true
|
||||||
|
|
||||||
|
has_many :member_profile_fields, autosave: true, dependent: :destroy
|
||||||
|
accepts_nested_attributes_for :member_profile_fields, allow_destroy: true
|
||||||
|
|
||||||
|
|
||||||
|
def is_built_in?
|
||||||
|
self.built_in
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_disabled?
|
||||||
|
self.disabled
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_enabled_attribute_fields
|
||||||
|
self.member_profile_fields.excludes('disabled' => true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -10,7 +10,7 @@ class MemberProfile
|
||||||
field :sid
|
field :sid
|
||||||
field :office_tel
|
field :office_tel
|
||||||
field :birthday, type: DateTime
|
field :birthday, type: DateTime
|
||||||
field :address
|
field :address, type: String, localize: true
|
||||||
field :personal_website
|
field :personal_website
|
||||||
field :autobiography, type: String, localize: true
|
field :autobiography, type: String, localize: true
|
||||||
field :email, type: String
|
field :email, type: String
|
||||||
|
|
@ -22,7 +22,6 @@ class MemberProfile
|
||||||
|
|
||||||
has_one :user
|
has_one :user
|
||||||
has_and_belongs_to_many :roles
|
has_and_belongs_to_many :roles
|
||||||
has_many :role_field_values
|
|
||||||
has_and_belongs_to_many :role_statuses
|
has_and_belongs_to_many :role_statuses
|
||||||
|
|
||||||
has_many :member_profile_field_values
|
has_many :member_profile_field_values
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
class MemberProfileField
|
class MemberProfileField
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
include Mongoid::Attributes::Dynamic
|
||||||
include ::AttributeFieldsHelper
|
include ::AttributeFieldsHelper
|
||||||
|
|
||||||
field :key, type: String
|
field :key, type: String
|
||||||
|
field :af_count
|
||||||
field :title, type: String, localize: true
|
field :title, type: String, localize: true
|
||||||
field :markup, default: "text_field"
|
field :markup, default: "text_field"
|
||||||
field :option_list, type: Hash,default: {}
|
field :option_list, type: Hash,default: {}
|
||||||
|
|
@ -21,6 +23,7 @@ class MemberProfileField
|
||||||
field :typeD, type: Hash, default: {cross_lang: false}
|
field :typeD, type: Hash, default: {cross_lang: false}
|
||||||
field :typeE, type: Hash, default: {}
|
field :typeE, type: Hash, default: {}
|
||||||
|
|
||||||
|
belongs_to :member_info
|
||||||
has_many :member_profile_field_values
|
has_many :member_profile_field_values
|
||||||
|
|
||||||
def markup_value
|
def markup_value
|
||||||
|
|
@ -35,9 +38,17 @@ class MemberProfileField
|
||||||
get_data["cross_lang"] == "true" ? false : true
|
get_data["cross_lang"] == "true" ? false : true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self_defined_markup_options?
|
||||||
|
(self.member_info.method(self[:key].pluralize.to_sym) && self.member_info.method(self[:key].pluralize+"_for_"+markup)) rescue false
|
||||||
|
end
|
||||||
|
|
||||||
def option_list
|
def option_list
|
||||||
if self[:option_list].nil? || (self[:option_list].empty?)
|
if self_defined_markup_options?
|
||||||
|
#Class need to have corresponding field and value agent
|
||||||
|
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
|
||||||
|
method = self.attribute.role.method(self[:key].pluralize+"_for_"+markup)
|
||||||
|
return (method.call rescue {})
|
||||||
|
elsif self[:option_list].nil? || (self[:option_list].empty?)
|
||||||
return {}
|
return {}
|
||||||
else
|
else
|
||||||
return self[:option_list]
|
return self[:option_list]
|
||||||
|
|
@ -58,7 +69,7 @@ class MemberProfileField
|
||||||
end
|
end
|
||||||
|
|
||||||
def role
|
def role
|
||||||
self.attribute.role
|
self.member_info
|
||||||
end
|
end
|
||||||
|
|
||||||
def panel
|
def panel
|
||||||
|
|
@ -88,8 +99,37 @@ class MemberProfileField
|
||||||
self.disabled
|
self.disabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.add_attribute_field(member_info,attribute_param, attribute_field_id=nil,field_status)
|
||||||
|
if field_status.eql?(true)
|
||||||
|
@attribute_field_counter = member_info.member_profile_fields.count rescue nil
|
||||||
|
@attribute_field = self.find(attribute_field_id) rescue nil
|
||||||
|
@attribute_field.update(attribute_param)
|
||||||
|
@attribute_field.save
|
||||||
|
@attribute_field[:af_count] = @attribute_field_counter
|
||||||
|
else
|
||||||
|
@attribute_field_counter = member_info.member_profile_fields.count rescue nil
|
||||||
|
@attribute_field = member_info.member_profile_fields.build(attribute_param) rescue nil
|
||||||
|
@attribute_field.save
|
||||||
|
@attribute_field[:af_count] = @attribute_field_counter
|
||||||
|
end
|
||||||
|
return @attribute_field
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def check_option_list
|
||||||
|
self[:option_list] = self[panel]["option_list"] rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_more_convert(opt)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def cross_lang_convert(opt)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def check_cross_lang_convert(var,field)
|
def check_cross_lang_convert(var,field)
|
||||||
if self[field]["cross_lang"] != var["cross_lang"]
|
if self[field]["cross_lang"] != var["cross_lang"]
|
||||||
case var["cross_lang"]
|
case var["cross_lang"]
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,17 @@ class MemberProfileFieldValue
|
||||||
# Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil
|
# Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.put_field_values(member, field_value_param, field_value_id=nil,field_value_status)
|
||||||
|
if field_value_status.eql?(true)
|
||||||
|
@attribute_field_value = self.find(field_value_id) rescue nil
|
||||||
|
@attribute_field_value.update(field_value_param)
|
||||||
|
@attribute_field_value.save
|
||||||
|
else
|
||||||
|
@attribute_field_value = member.member_profile_field_values.build(field_value_param) rescue nil
|
||||||
|
@attribute_field_value.save
|
||||||
|
end
|
||||||
|
return @attribute_field_value
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<%= label_tag "key","key", :class=>"muted" %>
|
||||||
|
<%= f.text_field :key, :value => @attribute.key,:class=>"input-large", placeholder: t(:key) %>
|
||||||
|
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<% current_site.in_use_locales.each do |locale| %>
|
||||||
|
<%= label_tag "name-#{locale}", "#{t(:name)} (#{t(locale.to_s)})" %>
|
||||||
|
<%= f.text_field locale, :class => 'input-large', :value => (@attribute.title_translations[locale] rescue ''), placeholder: t(:name) %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<table class="table main-list" id="roles_index">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<th class="span3"><a href="#"><%= t('key') %></a></th>
|
||||||
|
<th class="span4"><a href="#"><%= t('title') %></a></th>
|
||||||
|
<th class="span4"><a href="#"><%= t('title') %></a></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @attributes.each do |attribute|%>
|
||||||
|
<%= render partial: 'admin/member_infos/member_info', locals: { attribute: attribute } %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><%= attribute.key %></td>
|
||||||
|
<td>
|
||||||
|
<%= attribute.title %>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<%= content_tag(:li, link_to(t(:add_attribute_field),edit_admin_member_info_path(attribute))) if current_user.is_admin? %>
|
||||||
|
<%= content_tag(:li, link_to(t(:delete_),admin_member_info_path(attribute, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"text-error", :remote => true)) if current_user.is_admin? %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><%= attribute.key %></td>
|
||||||
|
</tr>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<%= form_for @attribute, url: admin_member_infos_path(id: @attribute.id), remote: true, :html => { :id => 'form_role_filter' } do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Add</legend>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
</fieldset>
|
||||||
|
<div class="form-actions">
|
||||||
|
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||||
|
<%= f.submit t(:create_), class: 'btn btn-primary btn-small' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
$('<%= j render :partial => 'shared/attribute_field/attribute_field', :collection => [@attribute_field] %>').appendTo('#attribute_field_list').hide().fadeIn();
|
||||||
|
|
@ -14,20 +14,58 @@
|
||||||
<%= javascript_include_tag "lib/member/role-forms.js" %>
|
<%= javascript_include_tag "lib/member/role-forms.js" %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<%= form_for @attribute,:url => admin_member_info_path(@attribute) , :html => { :class=> "form-horizontal main-forms", :id=>'info' } do |f| %>
|
<%= form_for @attribute,:url => admin_member_info_path(@attribute) , :html => { :class=> "form-horizontal main-forms", :id=>'info', remote: true } do |f| %>
|
||||||
<h3>Basic Info</h3>
|
<h3><%= t(eval(":#{@attribute_type}"))%></h3>
|
||||||
|
<fieldset>
|
||||||
<fieldset>
|
<div id="basic-area" class="input-area">
|
||||||
|
<div class="basic">
|
||||||
|
<div class="attributes-header clearfix">
|
||||||
|
<h4>Basic</h4>
|
||||||
|
</div>
|
||||||
|
<div class="attributes-body">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted" for="key_0">Key</label>
|
||||||
|
<div class="controls">
|
||||||
|
|
||||||
|
<% if @attribute.new_record? %>
|
||||||
|
<%= f.text_field :key, :placeholder => t(:key) %>
|
||||||
|
<% else %>
|
||||||
|
<div><%= @attribute.key %></div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>@attribute.title_translations,:class_ext=>"pull-left",:label_ext=>t(:item_name),:field_name=>"#{@attribute_type}[title_translations]"}%>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted" for=""><%= t(:to_search) %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :to_search, true %>
|
||||||
|
<%= t(:yes_)%>
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :to_search, false %>
|
||||||
|
<%= t(:no_)%>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<h3><%= @attribute.title %></h3>
|
||||||
|
<fieldset>
|
||||||
|
|
||||||
<div id="attributes-area" class="input-area">
|
<div id="attributes-area" class="input-area">
|
||||||
|
|
||||||
|
<%= render :partial=>"shared/attribute_field/attribute_field",:collection=>@attribute.member_profile_fields%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
||||||
<%= hidden_field_tag 'id', params[:role_id] if !params[:role_id].blank? %>
|
<%= hidden_field_tag 'id', params[:role_id] if !params[:role_id].blank? %>
|
||||||
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
|
<%= f.submit t(:save),:class=>"btn btn-primary"%>
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
<%= link_to t('done'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,32 +2,12 @@
|
||||||
<%= render :partial => 'admin/members/side_bar' %>
|
<%= render :partial => 'admin/members/side_bar' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
<div id="list-view">
|
<div class="action pull-right">
|
||||||
<table id="member-list" class="table main-list">
|
<%= link_to content_tag(:i,t("new.attribute"),:class=>"icon-plus"),eval("new_admin_member_info_path"),:class=>"btn btn-primary open-slide"%>
|
||||||
<thead>
|
</div>
|
||||||
<tr class="sort-header">
|
</div>
|
||||||
<th class="span3"><a href="#"><%= t('key') %></a></th>
|
|
||||||
<th class="span4"><a href="#"><%= t('title') %></a></th>
|
<div id="attributes_index">
|
||||||
<th><a href="#"><%= t('type') %></a></th>
|
<%= render 'admin/member_infos/index' %>
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% @attributes.each do |attribute| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= attribute.key %></td>
|
|
||||||
<td>
|
|
||||||
<%= attribute.title %>
|
|
||||||
<div class="quick-edit">
|
|
||||||
<ul class="nav nav-pills">
|
|
||||||
<%= content_tag(:li, link_to(t(:edit),edit_admin_member_info_path(attribute))) if current_user.is_admin? %>
|
|
||||||
<%= content_tag(:li, link_to(t(:delete_),admin_member_info_path(attribute, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"text-error", :remote => true)) if current_user.is_admin? %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td><%= attribute.key %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
// $("#role_filters_index").html("<%= j render 'index' %>")
|
||||||
|
location.reload();
|
||||||
|
$.pageslide.close();
|
||||||
|
openSlide();
|
||||||
|
|
@ -1,38 +1 @@
|
||||||
<% content_for :side_bar do %>
|
<%= render 'new' %>
|
||||||
<%= render :partial => 'admin/members/side_bar' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% content_for :page_specific_css do -%>
|
|
||||||
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
|
|
||||||
<%= stylesheet_link_tag "lib/pageslide.css" %>
|
|
||||||
<%= stylesheet_link_tag "lib/main-forms.css" %>
|
|
||||||
<%= stylesheet_link_tag "lib/togglebox.css" %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do -%>
|
|
||||||
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
|
|
||||||
<%= javascript_include_tag "lib/member/role-forms.js" %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
||||||
<%= form_for @attribute,:url => admin_member_infos_path(@attribute) , :html => { :class=> "form-horizontal main-forms", :id=>'info' } do |f| %>
|
|
||||||
<h3>Basic Info</h3>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
|
|
||||||
<div id="attributes-area" class="input-area">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
|
||||||
<%= hidden_field_tag 'id', params[:role_id] if !params[:role_id].blank? %>
|
|
||||||
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
|
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do -%>
|
|
||||||
<%= render 'js/support_member_form_js' %>
|
|
||||||
<% end -%>
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
$("#form > form").replaceWith("<%= j render "form" %>");
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
$("#enable_<%= @attribute.id %>").toggle();
|
||||||
|
$("#disable_<%= @attribute.id %>").toggle();
|
||||||
|
$("#attribute_<%= @attribute.id %>").toggleClass('disable');
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<% content_for :page_specific_javascript do -%>
|
<% content_for :page_specific_javascript do -%>
|
||||||
|
|
||||||
<% ( params[:id].blank? ? @fname = 'new_attribute_values' : @fname = 'member_profile_field_values' ) %>
|
<% ( params[:id].blank? ? @fname = 'member_profile_field_value' : @fname = 'member_profile_field_values' ) %>
|
||||||
console.log(<%= @fname%>);
|
console.log(<%= @fname%>);
|
||||||
<!-- Text -->
|
<!-- Text -->
|
||||||
<script id="template-text" type="text/x-tmpl">
|
<script id="template-text" type="text/x-tmpl">
|
||||||
|
|
|
||||||
|
|
@ -140,14 +140,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
|
||||||
<div class="control-group">
|
|
||||||
<label for="address" class="control-label muted"><%= t("users.address")%></label>
|
|
||||||
<div class="controls add-input">
|
|
||||||
<%= f.text_area :address %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Language Tabs -->
|
<!-- Language Tabs -->
|
||||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||||
<ul class="nav nav-pills language-nav">
|
<ul class="nav nav-pills language-nav">
|
||||||
|
|
@ -158,6 +150,23 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content language-area">
|
||||||
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||||
|
<!-- Address -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label for="autobiography" class="control-label muted"><%= t("users.address")%></label>
|
||||||
|
<div class="controls add-input">
|
||||||
|
<%= f.fields_for :address_translations do |f| %>
|
||||||
|
<%= f.text_area locale, rows: 5, class: "input-block-level", :value => (@member.address_translations[locale] rescue nil) %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tab-content language-area">
|
<div class="tab-content language-area">
|
||||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<% if member_for_listing.user.present? %>
|
<% if member_for_listing.user.present? %>
|
||||||
<%= content_tag(:li, link_to(t("users.setting_privilege"),admin_member_edit_privilege_path(member_for_listing))) if current_user.is_admin? and current_user.id != (member_for_listing.user.id if member_for_listing.user.present? ) %>
|
<%= content_tag(:li, link_to(t("users.setting_privilege"),admin_member_edit_privilege_path(member_for_listing))) if current_user.is_admin? and current_user.id != (member_for_listing.user.id if member_for_listing.user.present? ) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= content_tag(:li, link_to(t(:delete_),admin_member_path(member_for_listing, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"text-error", :remote => true)) if current_user.is_admin? %>
|
<%= content_tag(:li, link_to(t(:delete_),admin_member_path(member_for_listing, at: params[:at]), data: { confirm: t('sure?') }, method: :delete, class: "text-error", remote: true)) if current_user.is_admin? %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
<% end if show_type_panel(attribute_field,"typeD") != 'typeD hide' %>
|
<% end if show_type_panel(attribute_field,"typeD") != 'typeD hide' %>
|
||||||
|
|
||||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeE")}" do%>
|
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeE")}" do%>
|
||||||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[attribute_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["option_list"]}%>
|
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[attribute_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
|
||||||
<% end if show_type_panel(attribute_field,"typeE") != 'typeE hide' %>
|
<% end if show_type_panel(attribute_field,"typeE") != 'typeE hide' %>
|
||||||
|
|
||||||
<%= hidden_field "#{@field_name}[attribute_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
|
<%= hidden_field "#{@field_name}[attribute_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
<% site = Site.first%>
|
||||||
<div id="address-field" class="modal hide fade">
|
<div id="address-field" class="modal hide fade">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
|
@ -6,7 +7,7 @@
|
||||||
<div class="modal-body form-horizontal address-modal">
|
<div class="modal-body form-horizontal address-modal">
|
||||||
<div class="tabbable">
|
<div class="tabbable">
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<% VALID_LOCALES.each do |locale|%>
|
<% site.valid_locales.each do |locale|%>
|
||||||
<% active = (locale == I18n.locale.to_s ? ["active"] : [] ) %>
|
<% active = (locale == I18n.locale.to_s ? ["active"] : [] ) %>
|
||||||
<%= content_tag :li,:class=>active,:for=>locale do%>
|
<%= content_tag :li,:class=>active,:for=>locale do%>
|
||||||
<%= link_to I18nVariable.from_locale(locale),".#{btn_class}.address_modal.#{locale}",:data=>{:toggle=>"tab"}%>
|
<%= link_to I18nVariable.from_locale(locale),".#{btn_class}.address_modal.#{locale}",:data=>{:toggle=>"tab"}%>
|
||||||
|
|
@ -15,7 +16,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<% VALID_LOCALES.each do |locale|%>
|
<% site.valid_locales.each do |locale|%>
|
||||||
<!-- start of lang tab context -->
|
<!-- start of lang tab context -->
|
||||||
<% active = (locale == I18n.locale.to_s ? "active" : "" ) %>
|
<% active = (locale == I18n.locale.to_s ? "active" : "" ) %>
|
||||||
<div class="tab-pane fade <%= active %> in %>" for="<%= locale %>">
|
<div class="tab-pane fade <%= active %> in %>" for="<%= locale %>">
|
||||||
|
|
|
||||||
|
|
@ -79,11 +79,10 @@
|
||||||
|
|
||||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeB")}" do %>
|
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeB")}" do %>
|
||||||
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{@af_counter}][typeB][initial]"}%>
|
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"info[attribute_fields][#{@af_counter}][typeB][initial]"}%>
|
||||||
|
|
||||||
<% if attribute_field.self_defined_markup_options?%>
|
<% if attribute_field.self_defined_markup_options?%>
|
||||||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{@af_counter}][attribute][role][statuses]"} %>
|
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{@af_counter}][attribute][role][statuses]"} %>
|
||||||
<%else #normal list%>
|
<%else #normal list%>
|
||||||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "info[attribute_fields][#{@af_counter}][typeB][option_list]"} %>
|
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["typeB"]["option_list"],:field_name=> "info[attribute_fields][#{@af_counter}][typeB][option_list]"} %>
|
||||||
<% end #of self_defined_markup_options?%>
|
<% end #of self_defined_markup_options?%>
|
||||||
|
|
||||||
<% end if show_type_panel(attribute_field,"typeB") != 'typeB hide' %>
|
<% end if show_type_panel(attribute_field,"typeB") != 'typeB hide' %>
|
||||||
|
|
@ -133,7 +132,7 @@
|
||||||
<% end if show_type_panel(attribute_field,"typeD") != 'typeD hide' %>
|
<% end if show_type_panel(attribute_field,"typeD") != 'typeD hide' %>
|
||||||
|
|
||||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeE")}" do%>
|
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeE")}" do%>
|
||||||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"info[attribute_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["option_list"]}%>
|
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"info[attribute_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
|
||||||
<% end if show_type_panel(attribute_field,"typeE") != 'typeE hide' %>
|
<% end if show_type_panel(attribute_field,"typeE") != 'typeE hide' %>
|
||||||
|
|
||||||
<%= hidden_field "info[attribute_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
|
<%= hidden_field "info[attribute_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
# This model initially had no columns defined. If you add columns to the
|
one:
|
||||||
# model remove the '{}' from the fixture names and add the columns immediately
|
key: MyString
|
||||||
# below each fixture, per the syntax in the comments below
|
title: MyString
|
||||||
#
|
|
||||||
one: {}
|
two:
|
||||||
# column: value
|
key: MyString
|
||||||
#
|
title: MyString
|
||||||
two: {}
|
|
||||||
# column: value
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue