forked from saurabh/orbit4-5
Member Module - User Signup Changed, Member Summary, Thumbnail
This commit is contained in:
parent
ba32ecbf88
commit
619fef44f5
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 524 B |
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 738 B |
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
@ -96,23 +96,23 @@ function inputAppendLength() {
|
|||
|
||||
// Role Attribute Template Data
|
||||
function setData(l, type, ol) {
|
||||
var fields = $('#info').length ? "info[attribute_fields]" : $('#sub_role').length ? "sub_role[attribute_fields]" : "role[attribute_fields]",
|
||||
var fields = $('#info').length ? "member_profile_field" : $('#sub_role').length ? "sub_role[attribute_fields]" : "role[attribute_fields]",
|
||||
data = {
|
||||
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
|
||||
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
|
||||
_cross_lang: ["cross_lang_" +l, fields+"["+l+"]["+type+"][cross_lang]"],
|
||||
_disabled: ["disabled_" +l, fields+"["+l+"][disabled]"],
|
||||
_format: ["format_" +l, fields+"["+l+"]["+type+"][format]"],
|
||||
_initial: ["initial_" +l, fields+"["+l+"]["+type+"][initial]"],
|
||||
_is_range: ["is_range_" +l, fields+"["+l+"]["+type+"][is_range]"],
|
||||
_key: ["key_" +l, fields+"["+l+"][key]"],
|
||||
_markup: fields+"["+l+"][markup]",
|
||||
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
|
||||
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
|
||||
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
|
||||
_to_delete: ["to_delete_" +l, fields+"["+l+"][to_delete]"],
|
||||
_to_search: ["to_search_" +l, fields+"["+l+"][to_search]"],
|
||||
_to_show: ["to_show_" +l, fields+"["+l+"][to_show]"],
|
||||
_add_more: ["add_more_" +l, fields+"["+type+"][add_more]"],
|
||||
_calendar: ["calendar_" +l, fields+"["+type+"][calendar]"],
|
||||
_cross_lang: ["cross_lang_" +l, fields+"["+type+"][cross_lang]"],
|
||||
_disabled: ["disabled_" +l, fields+"[disabled]"],
|
||||
_format: ["format_" +l, fields+"["+type+"][format]"],
|
||||
_initial: ["initial_" +l, fields+"["+type+"][initial]"],
|
||||
_is_range: ["is_range_" +l, fields+"["+type+"][is_range]"],
|
||||
_key: ["key_" +l, fields+"[key]"],
|
||||
_markup: fields+"[markup]",
|
||||
_option_list: ["option_list_"+l+"_"+ol, fields+"["+type+"][option_list]["+ol+"]", "option_list_"+ol],
|
||||
_placeholder: ["placeholder_" +l, fields+"["+type+"][placeholder]"],
|
||||
_title_translations: ["title_translations_" +l, fields+"[title_translations]"],
|
||||
_to_delete: ["to_delete_" +l, fields+"[to_delete]"],
|
||||
_to_search: ["to_search_" +l, fields+"[to_search]"],
|
||||
_to_show: ["to_show_" +l, fields+"[to_show]"],
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the admin/member_infos controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the member controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,55 @@
|
|||
class Admin::MemberInfosController < OrbitMemberController
|
||||
|
||||
before_action :set_attribute
|
||||
before_action :set_member_info, only: [:edit, :update, :show, :destroy]
|
||||
helper Admin::AttributeValuesViewHelper
|
||||
|
||||
def index
|
||||
@attributes = MemberProfileField.order('created_at DESC')
|
||||
@roles = Role.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
def new
|
||||
@attribute = MemberProfileField.new
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@attribute = MemberProfileField.new(member_info_params)
|
||||
@attribute.save
|
||||
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
def update
|
||||
@attribute.update_params(member_info_params)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@attribute.destroy
|
||||
redirect_to action: :index
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_member_info
|
||||
@attribute = MemberProfileField.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def member_info_params
|
||||
params.require(:member_profile_field).permit!
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_attribute
|
||||
@attribute_type = 'info'
|
||||
@class = 'infos'
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class Admin::MembersController < OrbitMemberController
|
||||
before_action :set_member_profile, only: [:show, :edit, :update, :create]
|
||||
before_action :set_member_profile, only: [:show, :edit, :update]
|
||||
|
||||
def index
|
||||
@roles = Role.all
|
||||
|
@ -27,13 +27,13 @@ class Admin::MembersController < OrbitMemberController
|
|||
|
||||
render case params[:at]
|
||||
when 'summary'
|
||||
@members=User.all.page(page_num).per(12).desc("_id")
|
||||
@members=MemberProfile.all.page(page_num).per(12).desc("_id")
|
||||
"index_summary"
|
||||
when 'thumbnail'
|
||||
@members=User.all.page(page_num).per(36).desc("_id")
|
||||
@members=MemberProfile.all.page(page_num).per(36).desc("_id")
|
||||
"index_thumbnail"
|
||||
else
|
||||
@members=User.all.page(page_num).per(10).desc("_id")
|
||||
@members=MemberProfile.all.page(page_num).per(10).desc("_id")
|
||||
"index"
|
||||
end
|
||||
|
||||
|
@ -41,13 +41,13 @@ class Admin::MembersController < OrbitMemberController
|
|||
|
||||
render case params[:at]
|
||||
when 'summary'
|
||||
@members=User.all.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id")
|
||||
@members=MemberProfile.all.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id")
|
||||
"index_summary"
|
||||
when 'thumbnail'
|
||||
@members=User.all.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id")
|
||||
@members=MemberProfile.all.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id")
|
||||
"index_thumbnail"
|
||||
else
|
||||
@members=User.all.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id")
|
||||
@members=MemberProfile.all.any_of({:user_id => /#{@mq}/i}, {:first_name => /#{@mq}/i}, {:last_name => /#{@mq}/i}, {:email => /#{@mq}/i}, {:office_tel => /#{@mq}/i}).desc("_id")
|
||||
"index"
|
||||
end
|
||||
|
||||
|
@ -55,13 +55,13 @@ class Admin::MembersController < OrbitMemberController
|
|||
|
||||
render case params[:at]
|
||||
when 'summary'
|
||||
@members=User.all.any_in(:role_ids=>@filter['role']).page(page_num).per(12).desc("_id")
|
||||
@members=MemberProfile.all.any_in(:role_ids=>@filter['role']).page(page_num).per(12).desc("_id")
|
||||
"index_summary"
|
||||
when 'thumbnail'
|
||||
@members=User.all.any_in(:role_ids=>@filter['role']).page(page_num).per(36).desc("_id")
|
||||
@members=MemberProfile.all.any_in(:role_ids=>@filter['role']).page(page_num).per(36).desc("_id")
|
||||
"index_thumbnail"
|
||||
else
|
||||
@members=User.all.any_in(:role_ids=>@filter['role']).page(page_num).per(10).desc("_id")
|
||||
@members=MemberProfile.all.any_in(:role_ids=>@filter['role']).page(page_num).per(10).desc("_id")
|
||||
"index"
|
||||
end
|
||||
|
||||
|
@ -73,17 +73,42 @@ class Admin::MembersController < OrbitMemberController
|
|||
end
|
||||
|
||||
def new
|
||||
@member = MemberProfile.new
|
||||
get_info_and_roles
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
def edit
|
||||
if @member.user.present?
|
||||
@user = @member.user
|
||||
else
|
||||
@user = User.new(member_profile_id: @member.id)
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@member = MemberProfile.new(member_profile_params)
|
||||
@user = User.new(user_params)
|
||||
|
||||
if @member.save
|
||||
@user.member_profile_id = @member.id
|
||||
@user.save
|
||||
redirect_to admin_members_path
|
||||
else
|
||||
redirect_to new_admin_member_path
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @member.update(member_profile_params)
|
||||
if @member.user.present?
|
||||
@member.user.update(user_params)
|
||||
else
|
||||
@user = User.new(user_params)
|
||||
@user.save
|
||||
@user.update_attributes(member_profile_id: @member.id)
|
||||
end
|
||||
|
||||
format.html { redirect_to admin_members_path, notice: 'Successfully Updated the User' }
|
||||
format.json { head :no_content }
|
||||
|
@ -98,9 +123,9 @@ class Admin::MembersController < OrbitMemberController
|
|||
if params[:id].eql?(current_user.id.to_s)
|
||||
flash[:error] = t(:cant_delete_self)
|
||||
else
|
||||
@user = User.find(params[:id])
|
||||
@user.member_profile.delete
|
||||
@user.delete
|
||||
@member_profile = MemberProfile.find(params[:id])
|
||||
@member_profile.user.delete if @member_profile.user.present?
|
||||
@member_profile.delete
|
||||
end
|
||||
|
||||
render action: "index"
|
||||
|
@ -118,9 +143,17 @@ class Admin::MembersController < OrbitMemberController
|
|||
params.require(:member_profile).permit!
|
||||
end
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit!
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def get_info_and_roles
|
||||
@roles = Role.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
def set_attribute
|
||||
@class = 'users'
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
class OrbitMemberController < ApplicationController
|
||||
include Authorize
|
||||
include AdminHelper
|
||||
include ApplicationHelper
|
||||
|
||||
include OrbitBackendHelper
|
||||
|
||||
before_action :authenticate_user
|
||||
layout "member"
|
||||
end
|
||||
|
|
|
@ -6,7 +6,10 @@ class UsersController < ApplicationController
|
|||
|
||||
def create
|
||||
@user = User.new(user_params)
|
||||
@member = MemberProfile.new(email: params[:email])
|
||||
if @user.save
|
||||
@member.save
|
||||
@user.update_attributes(member_profile_id: @member.id)
|
||||
redirect_to root_url, :notice => "Signed Up Successfully, Please Check your email for confirmation!"
|
||||
@user.send_confirmation_email
|
||||
else
|
||||
|
@ -32,6 +35,6 @@ class UsersController < ApplicationController
|
|||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def user_params
|
||||
params.require(:user).permit(:email, :password, :password_confirmation, :user_name)
|
||||
params.require(:user).permit(:password, :password_confirmation, :user_name, :member_profile_id, :email)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
module Admin::AttributeValuesViewHelper
|
||||
OPT = [
|
||||
["YYYY / MM / DD hh : mm","format1"],
|
||||
["YYYY / MM / DD","format2"],
|
||||
["YYYY / MM","format3"],
|
||||
["YYYY","format4"]
|
||||
]
|
||||
def show_type_panel(attribute_field,type)
|
||||
markup = attribute_field.markup
|
||||
LIST[:markups][markup]["panel"] == type ? type : [type,'hide'].join(" ")
|
||||
end
|
||||
|
||||
def name_to_id(str)
|
||||
str.gsub(/\]/,'').gsub(/\[/,"_")
|
||||
end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module Admin::MemberInfosHelper
|
||||
end
|
|
@ -0,0 +1,463 @@
|
|||
#encoding: utf-8
|
||||
module AttributeFieldsHelper
|
||||
include ActionView::Helpers::FormTagHelper
|
||||
include ActionView::Helpers::FormOptionsHelper
|
||||
include ActionView::Helpers::DateHelper
|
||||
include ActionView::Helpers::TagHelper
|
||||
include ActionView::Helpers::RenderingHelper
|
||||
include ActionView::Context
|
||||
include OrbitBasis::RenderAnywhere
|
||||
|
||||
include OrbitFormHelper
|
||||
|
||||
def block_helper(user,index,disable = false)
|
||||
unless self.disabled
|
||||
@index = index
|
||||
@markup_options = markup_options.merge(:disabled=>disable,:func=>"input_unit")
|
||||
@user = user
|
||||
@attribute_value = @user.get_value_from_field_id(id)
|
||||
@new_attribute = @attribute_value.nil?
|
||||
@attribute_value = @attribute_value || @user.attribute_values.build( attribute_field_id: id )
|
||||
@prefiled_value = @attribute_value.value
|
||||
@panel_setting = self.get_data
|
||||
return instance_eval("render_#{markup}") #rescue ""
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def lang_tab(str,lang)
|
||||
content_tag(:div,str,:class=>"tab-pane fade",:id=>(get_field_name_base+"tab_#{lang}"))
|
||||
end
|
||||
|
||||
def render_address
|
||||
control_group_wrapper do |key,value|
|
||||
value = (can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value) rescue nil
|
||||
key_field = can_muti_lang_input? ? "[#{key}]" : ""
|
||||
place_holder= @panel_setting["placeholder"][key] rescue ''
|
||||
# result = text_area_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key}))
|
||||
result = text_field_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key}))
|
||||
|
||||
add_ext= @attribute_value.address_ext[key] rescue {}
|
||||
|
||||
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][county]",add_ext["county"],:class=>"county_#{key}")
|
||||
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][street_address]",add_ext["street_address"],:class=>"street_address_#{key}")
|
||||
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][city]",add_ext["city"],:class=>"city_#{key}")
|
||||
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][zip]",add_ext["zip"],:class=>"zip_#{key}")
|
||||
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][country]",add_ext["country"],:class=>"country_#{key}")
|
||||
result << hidden_field_tag(get_basic_field_name_base+"[address_ext][#{key}][indicator]",add_ext["indicator"],:class=>"indicator_#{key}")
|
||||
end
|
||||
end
|
||||
|
||||
def render_checkbox
|
||||
@prefiled_value ||=[]
|
||||
control_group_wrapper do
|
||||
a = self[: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"))
|
||||
end.join rescue ""
|
||||
end
|
||||
end
|
||||
|
||||
def render_date
|
||||
|
||||
d = DateTime.now()
|
||||
|
||||
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
|
||||
|
||||
case self.typeC['format']
|
||||
when 'format1'
|
||||
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m/%d %H:%M")
|
||||
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/%d %H:%M")
|
||||
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM/dd hh:mm', true)
|
||||
buf << ' ~ '
|
||||
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM/dd hh:mm', true)
|
||||
when 'format2'
|
||||
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m/%d")
|
||||
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/%d")
|
||||
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM/dd')
|
||||
buf << ' ~ '
|
||||
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM/dd')
|
||||
when 'format3'
|
||||
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m")
|
||||
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/")
|
||||
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM')
|
||||
buf << ' ~ '
|
||||
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM')
|
||||
when 'format4'
|
||||
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y")
|
||||
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y")
|
||||
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy')
|
||||
buf << ' ~ '
|
||||
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy')
|
||||
end
|
||||
|
||||
# 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
|
||||
# @prefiled_value = @attribute_value.get_date
|
||||
|
||||
case self.typeC['format']
|
||||
when 'format1'
|
||||
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d %H:%M")), 'yyyy/MM/dd hh:mm', true)
|
||||
when 'format2'
|
||||
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd')
|
||||
when 'format3'
|
||||
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
|
||||
when 'format4'
|
||||
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
|
||||
end
|
||||
|
||||
control_group_wrapper{tmp}
|
||||
# control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def datetime_picker(object_name, value, format, time=false)
|
||||
content_tag :div, :class => "input-append datetimepick", "data-date-format"=>format, "data-picktime"=>"#{time}" do
|
||||
concat text_field_tag(object_name, value, :placeholder=>format)
|
||||
concat (content_tag :span, :class => 'add-on clearDate' do
|
||||
content_tag :i, nil, :class => 'icons-cross-3'
|
||||
end)
|
||||
concat (content_tag :span, :class => 'add-on iconbtn' do
|
||||
content_tag :i, nil, 'data-time-icon' => 'icons-clock', 'data-date-icon' => 'icons-calendar', :class=>"icons-calendar"
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
def render_date_durnation #Need re-write low priority
|
||||
|
||||
end
|
||||
|
||||
def render_radio_button
|
||||
@prefiled_value ||=[]
|
||||
control_group_wrapper do
|
||||
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=>"radio inline"))
|
||||
end.join
|
||||
end
|
||||
end
|
||||
|
||||
def render_select
|
||||
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue 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 ""
|
||||
end
|
||||
|
||||
def render_text_area
|
||||
control_group_wrapper do |key,value|
|
||||
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value
|
||||
key = can_muti_lang_input? ? "[#{key}]" : ""
|
||||
place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue ''
|
||||
text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder))
|
||||
end
|
||||
end
|
||||
|
||||
def render_text_field
|
||||
a = control_group_wrapper do |key,value|
|
||||
add_more_blank = can_add_more ? "[]" : ""
|
||||
key_field = can_muti_lang_input? ? "[#{key}]" : ""
|
||||
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))
|
||||
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
|
||||
|
||||
def lang_panel_tabbable_wrapper(add_more_params,&block)
|
||||
add_more_counter = ''
|
||||
|
||||
if self.markup=='text_area' #or self.markup=='address'
|
||||
|
||||
tmp1 = VALID_LOCALES.collect do |key|
|
||||
value = @prefiled_value[key] rescue nil
|
||||
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
|
||||
div_class_ary = ["tab-pane" ,"fade"]
|
||||
|
||||
div_id = "#{get_pairing_tab_class({})}_#{key}"
|
||||
|
||||
if can_add_more
|
||||
add_more_value = add_more_params[0][:value]
|
||||
add_more_counter = add_more_params[0][:counter]
|
||||
value = add_more_value[key] rescue nil
|
||||
div_class_ary << "add_more_item_#{add_more_counter}"
|
||||
end
|
||||
|
||||
div_class = div_class_ary.join(" ")
|
||||
div_class << (key == I18n.locale.to_s ? " active in" : '')
|
||||
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
|
||||
end# of VALID_LOCALES.collect for tabed input
|
||||
|
||||
|
||||
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
|
||||
buff2 = 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_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
|
||||
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
|
||||
link_entry = link_entry_ary.join
|
||||
link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key)
|
||||
end # of VALID_LOCALES.collect for tabs
|
||||
|
||||
buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address'
|
||||
buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more
|
||||
buff2.join.html_safe
|
||||
end # of content ul
|
||||
|
||||
|
||||
tmp = content_tag :div,:class=> "tab-content textarea-lang" do
|
||||
tmp2 << tmp1.join('').html_safe
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
# tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do
|
||||
tmp1 =
|
||||
content_tag :div,:class=> "tab-content" do
|
||||
|
||||
buff = VALID_LOCALES.collect do |key|
|
||||
value = @prefiled_value[key] rescue nil
|
||||
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
|
||||
div_class_ary = ["tab-pane" ,"fade"]
|
||||
|
||||
div_id = "#{get_pairing_tab_class({})}_#{key}"
|
||||
|
||||
|
||||
if can_add_more
|
||||
add_more_value = add_more_params[0][:value]
|
||||
add_more_counter = add_more_params[0][:counter]
|
||||
value = add_more_value[key] rescue nil
|
||||
div_class_ary << "add_more_item_#{add_more_counter}"
|
||||
end
|
||||
|
||||
div_class = div_class_ary.join(" ")
|
||||
div_class << (key == I18n.locale.to_s ? " active in" : '')
|
||||
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
|
||||
end# of VALID_LOCALES.collect for tabed input
|
||||
|
||||
buff.join('').html_safe
|
||||
|
||||
end
|
||||
|
||||
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
|
||||
buff2 = 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_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
|
||||
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
|
||||
link_entry = link_entry_ary.join
|
||||
link_to(I18nVariable.from_locale(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale.to_s ? "active" : nil)}",:for=>key)
|
||||
end # of VALID_LOCALES.collect for tabs
|
||||
|
||||
buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"#address-field", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address'
|
||||
buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more
|
||||
buff2.join.html_safe
|
||||
end # of content ul
|
||||
|
||||
|
||||
|
||||
tmp = content_tag :div,:class=> "input-append" do
|
||||
tmp1 << tmp2
|
||||
end
|
||||
|
||||
# tmp << content_tag(:ul,:class=> 'nav nav-pills') do
|
||||
# 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_ary = [".#{get_pairing_tab_class({})}",".#{key}"]
|
||||
# link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
|
||||
# link_entry = link_entry_ary.join
|
||||
# content_tag(:li,link_to(I18nVariable.from_locale(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 # of content ul
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def controls_wrapper(*add_more_params,&block)
|
||||
result = ''
|
||||
add_more_counter = ""
|
||||
|
||||
if can_add_more
|
||||
add_more_counter = add_more_params[0][:counter]
|
||||
add_more_value = add_more_params[0][:value]
|
||||
end
|
||||
|
||||
|
||||
|
||||
if can_muti_lang_input?
|
||||
result << lang_panel_tabbable_wrapper(add_more_params,&block)
|
||||
result << gen_modal_dialog if self.markup == "address"
|
||||
|
||||
# result << add_more_unt if can_add_more
|
||||
else #cross lang field
|
||||
|
||||
case can_add_more
|
||||
when true
|
||||
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 remove-input") }
|
||||
# result << add_more_unt
|
||||
else
|
||||
value = @prefiled_value
|
||||
result << yield(nil,value)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
result.html_safe
|
||||
|
||||
end # of def controls_wrapper(&block)
|
||||
|
||||
def control_group_wrapper(&block)
|
||||
div_class = can_muti_lang_input? ? "control-group" : "control-group"
|
||||
# div_class = can_muti_lang_input? ? "control-group language-swich" : "control-group"
|
||||
result =""
|
||||
|
||||
case self.markup
|
||||
|
||||
when "text_field"
|
||||
|
||||
if can_add_more
|
||||
|
||||
multipleInputs =
|
||||
content_tag(:div,:class=>"add-target") do
|
||||
@attribute_value.add_more_counter.times.collect do |t|
|
||||
controls_wrapper(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block)
|
||||
end.join('').html_safe # of add_more fields
|
||||
end
|
||||
|
||||
|
||||
temp = label + content_tag(:div, multipleInputs + add_more_unt, :class=>'controls add-input')
|
||||
|
||||
result = content_tag(:div,temp,:class=>div_class)
|
||||
|
||||
# result = label + multipleInputs + add_more_unt
|
||||
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
|
||||
else
|
||||
temp = label + content_tag(:div, controls_wrapper(&block), :class=>'controls')
|
||||
result = content_tag(:div,temp,:class=>div_class)
|
||||
|
||||
end
|
||||
|
||||
when "address"
|
||||
|
||||
# address = content_tag :div,:class=>"multipleInput editMore" do
|
||||
address = content_tag :div,:class=>"control-group" do
|
||||
label + content_tag(:div, controls_wrapper(&block), :class=>'controls add-input')
|
||||
end # of div multipleInput editMore
|
||||
|
||||
result = address
|
||||
|
||||
else
|
||||
temp = label + content_tag(:div, controls_wrapper(&block), :class=>'controls')
|
||||
result = content_tag(:div,temp,:class=>div_class)
|
||||
|
||||
end
|
||||
|
||||
result << end_block
|
||||
result.html_safe
|
||||
|
||||
end
|
||||
|
||||
|
||||
def add_more_unt
|
||||
temp_field_name = get_basic_field_name_base + '[temp]'
|
||||
add_more = content_tag :p,:class=> 'add-btn' do
|
||||
content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus"),"#","data-roles"=>"role_a",:class=>"trigger #{can_muti_lang_input? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary"
|
||||
content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count")
|
||||
content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name")
|
||||
content
|
||||
end # of div
|
||||
# add_more = content_tag :div,:class=> 'controls' do
|
||||
# content_tag :span,:class=> 'help-block' do
|
||||
# content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus-sign"),"#",:class=>'addinput'
|
||||
# content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count")
|
||||
# content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name")
|
||||
# content
|
||||
# end # of span
|
||||
# end # of div
|
||||
end
|
||||
|
||||
def end_block
|
||||
if @new_attribute
|
||||
hidden_field_tag(get_basic_field_name_base+"[attribute_field_id]",id,:for=>"field_#{@index}")
|
||||
else
|
||||
hidden_field_tag(get_basic_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}")
|
||||
end
|
||||
end
|
||||
|
||||
def add_more_tab(mode,counter,key)
|
||||
case mode
|
||||
when :input_field
|
||||
get_pairing_tab_class(:suffix=>['','tab'+counter.to_s,key].join('-'))
|
||||
when :tab_btn
|
||||
".#{get_pairing_tab_class(:suffix=>['','tab'+counter.to_s,key].join('-'))}"
|
||||
end
|
||||
end
|
||||
|
||||
def get_pairing_tab_class(opts)
|
||||
prefix = opts[:prefix]
|
||||
suffix = opts[:suffix]
|
||||
str = get_basic_field_name_base.gsub("[","_").gsub("]",'')
|
||||
str = prefix.nil? ? str : prefix+ str
|
||||
suffix.nil? ? str : str + suffix
|
||||
end
|
||||
|
||||
def get_basic_field_name_base
|
||||
if @new_attribute
|
||||
"user[new_attribute_values][#{@index}]"
|
||||
else
|
||||
"user[attribute_values][#{@index}]"
|
||||
end
|
||||
end
|
||||
|
||||
def get_field_name_base
|
||||
get_basic_field_name_base + "[value]"
|
||||
end
|
||||
|
||||
def label
|
||||
label_tag(key,title,:class=>"control-label muted",:func => "field_label")
|
||||
end
|
||||
|
||||
def can_muti_lang_input?
|
||||
if self.markup == "address"
|
||||
return true
|
||||
else
|
||||
LIST[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
|
||||
end
|
||||
end
|
||||
|
||||
def can_add_more
|
||||
if self.markup == "address"
|
||||
return false
|
||||
else
|
||||
add_more
|
||||
end
|
||||
end
|
||||
|
||||
def gen_modal_dialog
|
||||
render_anywhere("shared/attribute_field/address_modal_dialog",{
|
||||
:field_name=>title,
|
||||
:html_id=>"address-field",
|
||||
:btn_class => "#{get_pairing_tab_class({})}",
|
||||
:field_name_basic => get_basic_field_name_base
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,109 @@
|
|||
module AttributeValuesHelper
|
||||
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
|
||||
end
|
||||
|
||||
# case self.attribute_field["typeC"]["format"]
|
||||
# when 'format1' # Y/M/D h:m
|
||||
# date.strftime("%Y/%m/%d %H:%M")
|
||||
# when 'format2' # Y/M/D
|
||||
# date.strftime("%Y/%m/%d")
|
||||
# when 'format3' # Y/M
|
||||
# date.strftime("%Y/%m")
|
||||
# when 'format4' # Y
|
||||
# date.strftime("%Y")
|
||||
# end # of case west cal format
|
||||
end
|
||||
|
||||
def show_minguo_calendar(from_to=nil)
|
||||
get_minguo
|
||||
|
||||
case from_to
|
||||
when :to
|
||||
date = get_date(:to)
|
||||
when :from
|
||||
date = get_date(:from)
|
||||
when nil
|
||||
date = get_date
|
||||
end
|
||||
|
||||
@date = date.split('/')
|
||||
date_year = @date[0].to_i
|
||||
|
||||
year_str = ""
|
||||
unless date_year == 1912
|
||||
m_year = (date_year - 1912).abs.to_s + I18n.t("date.minguo_calendar.year")
|
||||
year_str = minguo_format_year(m_year)
|
||||
end
|
||||
get_minguo_year(from_to) + minguo_m_y_d_time(from_to)
|
||||
end
|
||||
|
||||
def get_minguo_year(from_to=nil)
|
||||
case from_to
|
||||
when :to
|
||||
date = get_date(:to)
|
||||
when :from
|
||||
date = get_date(:from)
|
||||
when nil
|
||||
date = get_date
|
||||
end
|
||||
|
||||
@date = date.split('/')
|
||||
date_year = @date[0].to_i
|
||||
|
||||
m_year = (date_year - 1911).abs
|
||||
year_end = I18n.t("date.minguo_calendar.year")
|
||||
case
|
||||
when date_year <1912
|
||||
I18n.t("date.minguo_calendar.before") + (m_year+1).to_s + year_end
|
||||
when date_year ==1912
|
||||
I18n.t("date.minguo_calendar.first_year")
|
||||
when date_year >1912
|
||||
I18n.t("date.minguo_calendar.after")+ (m_year).to_s + year_end
|
||||
end # of case tw_calendar year
|
||||
end
|
||||
|
||||
def minguo_m_y_d_time(from_to=nil)
|
||||
case from_to
|
||||
when :to
|
||||
date = get_date(:to)
|
||||
when :from
|
||||
date = get_date(:from)
|
||||
when nil
|
||||
date = get_date
|
||||
end
|
||||
@date = date.split('/')
|
||||
|
||||
case self.attribute_field["typeC"]["format"]
|
||||
when 'format1' # Y/M/D h:m
|
||||
"/#{@date[1]}/#{@date[2]}"
|
||||
when 'format2' # Y/M/D
|
||||
"/#{@date[1]}/#{@date[2]}"
|
||||
when 'format3' # Y/M
|
||||
|
||||
"/#{@date[1]}#{I18n.t("date.minguo_calendar.month")}"\
|
||||
when 'format4' # Y
|
||||
''
|
||||
end # of case
|
||||
end
|
||||
|
||||
def get_date_by_format(from_to = nil)
|
||||
case I18n.locale
|
||||
when :zh_tw
|
||||
case
|
||||
when self.attribute_field["typeC"]["calendar"] == "west_calendar"
|
||||
show_west_calender(from_to)
|
||||
when self.attribute_field["typeC"]["calendar"] == "tw_calendar"
|
||||
show_minguo_calendar(from_to)
|
||||
end #case self.attribute_field["typeC"]["calendar"]
|
||||
when :en
|
||||
show_west_calender(from_to)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module MemberHelper
|
||||
end
|
|
@ -0,0 +1,108 @@
|
|||
module OrbitFormHelper
|
||||
def self.included(base)
|
||||
ActionView::Helpers::FormBuilder.send(:include, Orbit::FormBuilder)
|
||||
end
|
||||
|
||||
def datetime_picker(object_name, method, options = {})
|
||||
options[:icon_time] ||= 'icons-clock'
|
||||
options[:icon_date] ||= 'icons-calendar'
|
||||
options[:icon_clear] ||= 'icons-cross-3'
|
||||
options[:input_class] ||= 'input-large'
|
||||
options[:value] ||= options[:object].send(method) if options[:object] && options[:object][method]
|
||||
case options[:picker_type]
|
||||
when 'date'
|
||||
content_tag :div, :id => options[:id], :class => options[:class] do
|
||||
date_picker(object_name, method, options)
|
||||
end
|
||||
when 'time'
|
||||
content_tag :div, :id => options[:id], :class => options[:class] do
|
||||
time_picker(object_name, method, options)
|
||||
end
|
||||
when 'separated'
|
||||
options[:label] ||= I18n.t('datetime_picker.separated.label')
|
||||
content_tag :div, :id => options[:id], :class => "separated_picker #{options[:class]}" do
|
||||
concat label_tag options[:label] unless options[:no_label]
|
||||
concat hidden_field(object_name, method, :value => options[:value])
|
||||
concat separated_picker(object_name, method, options)
|
||||
end
|
||||
else
|
||||
content_tag :div, :id => options[:id], :class => options[:class] do
|
||||
default_picker(object_name, method, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def date_picker(object_name, method, options)
|
||||
custom = {}
|
||||
custom[:format] = options[:format] || 'yyyy/MM'
|
||||
custom[:value] = format_value(options[:value], custom[:format]) if options[:value]
|
||||
custom[:picker_class] = 'date_picker'
|
||||
custom[:label] = options[:label] || I18n.t('datetime_picker.date.label')
|
||||
custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.date.placeholder')
|
||||
picker(object_name, method, options.merge(custom))
|
||||
end
|
||||
|
||||
def default_picker(object_name, method, options)
|
||||
custom = {}
|
||||
custom[:format] = options[:format] || 'yyyy/MM/dd hh:mm'
|
||||
custom[:value] = format_value(options[:value], custom[:format]) if options[:value]
|
||||
custom[:picker_class] = 'default_picker'
|
||||
custom[:label] = options[:label] || I18n.t('datetime_picker.default.label')
|
||||
custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.default.placeholder')
|
||||
picker(object_name, method, options.merge(custom))
|
||||
end
|
||||
|
||||
def time_picker(object_name, method, options)
|
||||
custom = {}
|
||||
custom[:format] = options[:format] || 'hh:mm'
|
||||
custom[:value] = format_value(options[:value], custom[:format]) if options[:value]
|
||||
custom[:picker_class] = 'time_picker'
|
||||
custom[:label] = options[:label] || I18n.t('datetime_picker.time.label')
|
||||
custom[:placeholder] = options[:placeholder] || I18n.t('datetime_picker.time.placeholder')
|
||||
picker(object_name, method, options.merge(custom))
|
||||
end
|
||||
|
||||
def separated_picker(object_name, method, options)
|
||||
custom = {}
|
||||
custom[:no_label] = true
|
||||
custom[:separated] = true
|
||||
date_picker(nil, nil, options.merge(custom)) + time_picker(nil, nil, options.merge(custom))
|
||||
end
|
||||
|
||||
|
||||
def single_picker(object_name, method, options)
|
||||
content_tag :div, :id => options[:id], :class => options[:class] do
|
||||
picker(object_name, method, options)
|
||||
end
|
||||
end
|
||||
|
||||
def double_picker(object_name, method, options)
|
||||
|
||||
end
|
||||
|
||||
def picker(object_name, method, options)
|
||||
content_tag :div, :class => "#{options[:picker_class]} input-append", :style => "#{(options[:picker_class].eql?('time_picker') && options[:value].blank? && options[:separated]) ? 'pointer-events:none' : nil}" do
|
||||
concat label_tag options[:label] unless options[:no_label]
|
||||
concat text_field object_name, method, :placeholder => options[:placeholder], :class => options[:input_class], 'data-format' => options[:format], :value => options[:value]
|
||||
concat (content_tag :span, :class => 'add-on clearDate' do
|
||||
content_tag :i, nil, :class => options[:icon_clear]
|
||||
end)
|
||||
concat (content_tag :span, :class => 'add-on iconbtn' do
|
||||
content_tag :i, nil, 'data-time-icon' => options[:icon_time], 'data-date-icon' => options[:icon_date]
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
def format_value(value, format)
|
||||
value.strftime(format.gsub('yyyy', '%Y').gsub('MM', '%m').gsub('dd', '%d').gsub('hh', '%H').gsub('mm', '%M'))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module Orbit::FormBuilder
|
||||
# ActionPack's metaprogramming would have done this for us, if FormHelper#labeled_input
|
||||
# had been defined at load. Instead we define it ourselves here.
|
||||
def datetime_picker(method, options = {})
|
||||
@template.datetime_picker(@object_name, method, objectify_options(options))
|
||||
end
|
||||
end
|
|
@ -2,7 +2,7 @@ class ConfirmUserMailer < ActionMailer::Base
|
|||
default from: "noreply@rulingcom.com"
|
||||
|
||||
def user_confirmation_email(user)
|
||||
email = user.email
|
||||
email = user.member_profile.email
|
||||
@confirmation_token = user.confirmation_token
|
||||
mail(:to => email, :subject => "User Confirmation instructions")
|
||||
end
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
class MemberProfile
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :first_name, type: String, localize: true
|
||||
field :last_name, type: String, localize: true
|
||||
field :gender
|
||||
field :sid
|
||||
field :office_tel
|
||||
field :birthday, type: DateTime
|
||||
field :address
|
||||
field :personal_website
|
||||
field :autobiography, type: String, localize: true
|
||||
field :email, type: String
|
||||
|
||||
VALID_EMAIL_FORMAT = /\A[^@\s]+@([^@.\s]+\.)+[^@.\s]+\z/
|
||||
validates :email, uniqueness: true, format: { with: VALID_EMAIL_FORMAT }
|
||||
|
||||
has_one :user
|
||||
has_and_belongs_to_many :roles
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
class MemberProfileField
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include ::AttributeFieldsHelper
|
||||
|
||||
field :key, type: String
|
||||
field :title, type: String, localize: true
|
||||
field :markup, default: "text_field"
|
||||
field :option_list, type: Hash,default: {}
|
||||
field :markup_options, type: Hash
|
||||
field :built_in, type: Boolean, default: false
|
||||
field :disabled, type: Boolean, default: false
|
||||
field :to_delete, type: Boolean,default: false
|
||||
|
||||
field :to_search, type: Boolean, default: false
|
||||
field :to_show,type: Boolean,default: true
|
||||
|
||||
field :typeA, type: Hash, default: {cross_lang: false}
|
||||
field :typeB, type: Hash, default: {}
|
||||
field :typeC, type: Hash, default: {calendar: "west_calendar", format: "format3"}
|
||||
field :typeD, type: Hash, default: {cross_lang: false}
|
||||
field :typeE, type: Hash, default: {}
|
||||
|
||||
embeds_many :member_profile_field_values
|
||||
|
||||
def markup_value
|
||||
get_data["option_list"]
|
||||
end
|
||||
|
||||
def add_more
|
||||
(get_data["add_more"] == "true" ? true : false) rescue false
|
||||
end
|
||||
|
||||
def locale
|
||||
get_data["cross_lang"] == "true" ? false : true
|
||||
end
|
||||
|
||||
|
||||
def option_list
|
||||
if self[:option_list].nil? || (self[:option_list].empty?)
|
||||
return {}
|
||||
else
|
||||
return self[:option_list]
|
||||
end
|
||||
end
|
||||
|
||||
def markup_options=(var)
|
||||
self[:markup_options] = (eval(var) rescue {})
|
||||
end
|
||||
|
||||
def markup_options
|
||||
if self[:markup_options].nil?
|
||||
return {}
|
||||
else
|
||||
Hash[self[:markup_options].map{|key,val|[key.to_sym,val]}] rescue {}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def role
|
||||
self.attribute.role
|
||||
end
|
||||
|
||||
def panel
|
||||
panel = LIST[:markups][self[:markup]]["panel"]
|
||||
end
|
||||
|
||||
def get_data
|
||||
self[panel]
|
||||
end
|
||||
|
||||
def typeA=(var)
|
||||
check_add_more_convert(var)
|
||||
check_cross_lang_convert(var,"typeA")
|
||||
self["typeA"] = var
|
||||
end
|
||||
|
||||
def typeD=(var)
|
||||
check_cross_lang_convert(var,"typeD")
|
||||
self["typeD"] = var
|
||||
end
|
||||
|
||||
def is_built_in?
|
||||
self.built_in
|
||||
end
|
||||
|
||||
def is_disabled?
|
||||
self.disabled
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def check_cross_lang_convert(var,field)
|
||||
if self[field]["cross_lang"] != var["cross_lang"]
|
||||
case var["cross_lang"]
|
||||
when "true" #from no-add_more to add_more
|
||||
cross_lang_convert(:to_cross_lang)
|
||||
else #from add_more to no-add_more
|
||||
cross_lang_convert(:to_no_cross_lang)
|
||||
end # of case
|
||||
end # of if
|
||||
end
|
||||
|
||||
def check_add_more_convert(var)
|
||||
if self["typeA"]["add_more"] != var["add_more"]
|
||||
case var["add_more"]
|
||||
when "true" #from no-add_more to add_more
|
||||
add_more_convert(:to_add_more)
|
||||
else #from add_more to no-add_more
|
||||
add_more_convert(:to_no_add_more)
|
||||
end # of case
|
||||
end # of if
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class MemberProfileFieldValue
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include AttributeValuesHelper
|
||||
|
||||
field :key
|
||||
field :address_key
|
||||
|
||||
embedded_in :member_profile_field
|
||||
end
|
|
@ -5,7 +5,6 @@ class User
|
|||
include ActiveModel::SecurePassword
|
||||
|
||||
field :user_name, type: String
|
||||
field :email, type: String
|
||||
field :password_digest, type: String
|
||||
field :confirmation_token, type: String
|
||||
field :reset_token, type: String
|
||||
|
@ -20,11 +19,11 @@ class User
|
|||
has_many :authorizations
|
||||
belongs_to :member_profile
|
||||
|
||||
VALID_EMAIL_FORMAT = /\A[^@\s]+@([^@.\s]+\.)+[^@.\s]+\z/
|
||||
|
||||
validates :user_name, presence: true, uniqueness: true
|
||||
validates :password, presence: true, :on => :create, length: {:in => 8..20}
|
||||
validates :email, presence: true, uniqueness: true, format: { with: VALID_EMAIL_FORMAT }
|
||||
|
||||
#Add getter and setter for email virtual field
|
||||
attr_accessor :email
|
||||
|
||||
def generate_confirmation_token
|
||||
self.confirmation_token = SecureRandom.hex(5)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
<% @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 %>
|
|
@ -0,0 +1,39 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= 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_info_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,19 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'admin/members/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div id="list-view">
|
||||
<table id="member-list" class="table main-list">
|
||||
<thead>
|
||||
<tr class="sort-header">
|
||||
<th class="span3"><a href="#"><%= t('key') %></a></th>
|
||||
<th class="span4"><a href="#"><%= t('title') %></a></th>
|
||||
<th><a href="#"><%= t('type') %></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => "attributes",:collection=> @attributes%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,38 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= 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 -%>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<!-- Avatar -->
|
||||
<div class="control-group">
|
||||
<%= f.label t("users.avatar"),:class=>"control-label muted" %>
|
||||
<label for="avatar" class="control-label muted"><%= t("users.avatar")%></label>
|
||||
<div class="controls">
|
||||
<!-- if this page editing please add class "fileupload-edit" -->
|
||||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @member.avatar.file %>" data-provides="fileupload">
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
<!-- First Name -->
|
||||
<div class="control-group">
|
||||
<%= f.label t("users.first_name"),{:class=>"control-label muted", :func=>"field_label"} %>
|
||||
<label for="first_name" class="control-label muted" function="field_label"><%= t("users.first_name")%></label>
|
||||
<div class="controls add-input">
|
||||
<div class="add-target">
|
||||
<div class="input-append">
|
||||
|
@ -63,7 +63,7 @@
|
|||
|
||||
<!-- Last Name -->
|
||||
<div class="control-group">
|
||||
<%= f.label t("users.last_name"),{:class=>"control-label muted", :func=>"field_label"} %>
|
||||
<label for="last_name" class="control-label muted" function="field_label"><%= t("users.last_name")%></label>
|
||||
<div class="controls add-input">
|
||||
<div class="add-target">
|
||||
<div class="input-append">
|
||||
|
@ -87,9 +87,20 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Email -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="account">
|
||||
<label for="email" class="control-label"><%= t("users.email")%></label>
|
||||
</label>
|
||||
<div class="controls add-input">
|
||||
<%= f.text_field :email, :class=>"input-medium", :id=>"account", :placeholder=>"#{t('users.email')}" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ID Number -->
|
||||
<div class="control-group">
|
||||
<%= f.label t("users.sid"),:class=>"control-label muted" %>
|
||||
<label for="sid" class="control-label muted"><%= t("users.sid")%></label>
|
||||
<div class="controls add-input">
|
||||
<%= f.text_field :sid %>
|
||||
<span class="help-block"><%= t("users.sid_note")%></span>
|
||||
|
@ -98,7 +109,7 @@
|
|||
|
||||
<!-- Office Tel Number -->
|
||||
<div class="control-group">
|
||||
<%= f.label t("users.office_tel"),:class=>"control-label muted" %>
|
||||
<label for="office_tel" class="control-label muted"><%= t("users.office_tel")%></label>
|
||||
<div class="controls add-input">
|
||||
<%= f.text_field :office_tel %>
|
||||
<span class="help-block"><%= t("users.office_tel_note")%></span>
|
||||
|
@ -107,7 +118,7 @@
|
|||
|
||||
<!-- Gender -->
|
||||
<div class="control-group">
|
||||
<%= f.label t("users.sex"),:class=>"control-label muted" %>
|
||||
<label for="sex" class="control-label muted"><%= t("users.sex")%></label>
|
||||
<div class="controls">
|
||||
<label class="radio inline">
|
||||
<%= f.radio_button :gender, "male" %><%= t('users.male')%>
|
||||
|
@ -121,5 +132,48 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Birthday -->
|
||||
<div class="control-group">
|
||||
<label for="birthday" class="control-label muted"><%= t("users.birthday")%></label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :birthday, :no_label => true %>
|
||||
</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 -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</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" : '' %>">
|
||||
<!-- Autobiography -->
|
||||
<div class="control-group">
|
||||
<label for="autobiography" class="control-label muted"><%= t("users.autobiography")%></label>
|
||||
<div class="controls add-input">
|
||||
<%= f.fields_for :autobiography_translations do |f| %>
|
||||
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@member.autobiography_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,10 +1,10 @@
|
|||
<% if member_for_listing.member_profile.present?%>
|
||||
<% if member_for_listing.present?%>
|
||||
<%
|
||||
if member_for_listing.member_profile.gender == 'male'
|
||||
if member_for_listing.gender == 'male'
|
||||
@member_gender = 'gender-man'
|
||||
elsif member_for_listing.member_profile.gender == 'female'
|
||||
elsif member_for_listing.gender == 'female'
|
||||
@member_gender = 'gender-woman'
|
||||
elsif member_for_listing.member_profile.gender.nil?
|
||||
elsif member_for_listing.gender.nil?
|
||||
@member_gender = 'gender-none'
|
||||
end
|
||||
%>
|
||||
|
@ -12,17 +12,17 @@
|
|||
<tr id="<%= dom_id member_for_listing %>">
|
||||
<td class="<%= @member_gender %>"></td>
|
||||
<td>
|
||||
<% member_for_listing.member_profile.roles.each do |rf| %>
|
||||
<% member_for_listing.roles.each do |rf| %>
|
||||
<% @roledata = Role.find(rf.id) %>
|
||||
<span class="label label-info"><%= @roledata.title %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to (member_for_listing.member_profile.name && member_for_listing.member_profile.name != member_for_listing.email ? member_for_listing.member_profile.name : member_for_listing.id),admin_member_path(member_for_listing.member_profile) %>
|
||||
<%= link_to (member_for_listing.name && member_for_listing.name != (member_for_listing.email if member_for_listing.user.present?) ? member_for_listing.name : member_for_listing.user.id),admin_member_path(member_for_listing) %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<%= content_tag(:li, link_to(t(:edit),edit_admin_member_path(member_for_listing.member_profile))) if current_user.is_admin? %>
|
||||
<%= content_tag(:li, link_to(t("users.setting_privilege"))) if current_user.is_admin? and current_user.id != member_for_listing.id %>
|
||||
<%= content_tag(:li, link_to(t(:edit),edit_admin_member_path(member_for_listing))) if current_user.is_admin? %>
|
||||
<%= content_tag(:li, link_to(t("users.setting_privilege"))) 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(: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? %>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<li id="<%= dom_id member_for_summary %>">
|
||||
<div class="member-avatar">
|
||||
<%
|
||||
if member_for_summary.gender == 'male'
|
||||
@member_sex = 'gender-man'
|
||||
elsif member_for_summary.gender == 'female'
|
||||
@member_sex = 'gender-woman'
|
||||
elsif member_for_summary.gender.nil?
|
||||
@member_sex = 'gender-none'
|
||||
end
|
||||
%>
|
||||
<p class="<%= @user_sex%>"></p>
|
||||
<div class="action">
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-edit'),edit_admin_member_path(member_for_summary),:class=>"edit" ) if current_user.is_admin?%>
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-key'),:class=>"key" ) if current_user.is_admin? and current_user.id != member_for_summary.id %>
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-trash'), admin_members_path(member_for_summary, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"trash", :remote => true) if current_user.is_admin? %>
|
||||
</div>
|
||||
<%= image_tag(member_for_summary.avatar) %>
|
||||
</div>
|
||||
<div class="member-info">
|
||||
<h4 class="member-name"><%= link_to (member_for_summary.name && member_for_summary.name != member_for_summary.email ? member_for_summary.name : member_for_summary.user_id),admin_members_path(member_for_summary)%></h4>
|
||||
<div class="member-mail muted"><%= member_for_summary.email%></div>
|
||||
<hr>
|
||||
<ul class="member-roles">
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<%
|
||||
if member_for_thumbnail.gender == 'male'
|
||||
@user_sex = 'gender-man'
|
||||
elsif member_for_thumbnail.gender == 'female'
|
||||
@user_sex = 'gender-woman'
|
||||
elsif member_for_thumbnail.gender.nil?
|
||||
@user_sex = 'gender-none'
|
||||
end
|
||||
%>
|
||||
<li id="<%= dom_id member_for_thumbnail %>">
|
||||
<div class="member-avatar <%= @user_sex %>">
|
||||
<div class="action">
|
||||
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-edit'),edit_admin_member_path(member_for_thumbnail),:class=>"edit" ) if current_user.is_admin?%>
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-key'),:class=>"key" ) if current_user.is_admin? and current_user.id != member_for_thumbnail.id %>
|
||||
<%= link_to(content_tag(:i, nil, :class => 'icon-trash'), admin_members_path(member_for_thumbnail, :at=>params[:at]), :confirm => t(:sure?), :method => :delete, :class=>"trash", :remote => true) if current_user.is_admin? %>
|
||||
|
||||
</div>
|
||||
<%= image_tag(member_for_thumbnail.avatar) %>
|
||||
</div>
|
||||
<h4 class="member-name text-center"><%= link_to (member_for_thumbnail.name && member_for_thumbnail.name != member_for_thumbnail.email ? member_for_thumbnail.name : member_for_thumbnail.user_id),admin_members_path(member_for_thumbnail)%></h4>
|
||||
</li>
|
|
@ -6,7 +6,7 @@
|
|||
<div id="sidebar-menu">
|
||||
<div class="scroller">
|
||||
<%= content_tag :ul, :class => "sidebar-nav" do -%>
|
||||
<%= content_tag :li, :class => active_for_controllers('members','roles') do -%>
|
||||
<%= content_tag :li, :class => active_for_controllers('members','roles','member_infos') do -%>
|
||||
<%= link_to( ( content_tag(:span, content_tag(:i, nil, :class => 'icons-user'))), admin_members_path) %>
|
||||
<% end -%>
|
||||
<%= content_tag :li, :class => active_for_controllers('plugins') do -%>
|
||||
|
@ -25,27 +25,27 @@
|
|||
<div class="sub-nav-block-list">
|
||||
<div class="sub-nav-block" data-icons="">
|
||||
<h4><%= t(:member_) %></h4>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles')) do -%>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles','member_infos')) do -%>
|
||||
<%= content_tag :li, link_to((content_tag(:span, t(:all_member))), admin_members_path), :class => active_for_action('members', 'index') %>
|
||||
<%= content_tag :li, link_to((content_tag(:span, t(:add_member))), new_admin_member_path), :class => active_for_action('members', 'new') if (current_user.is_admin? rescue nil) %>
|
||||
<%= content_tag :li, link_to((content_tag(:span, t(:member_role))),admin_roles_path ), :class => active_for_action('roles', 'index') if (current_user.is_admin? rescue nil) %>
|
||||
<%= content_tag :li, link_to((content_tag(:span, t(:member_info))), edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('members', 'index') if (is_admin? rescue nil) and Info.first %>
|
||||
<%= content_tag :li, link_to((content_tag(:span, t(:member_info))), admin_member_infos_path), :class => active_for_action('members', 'index') if (current_user.is_admin? rescue nil) %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="sub-nav-block" data-icons="">
|
||||
<h4><%= t(:academic_info) %></h4>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles')) do -%>
|
||||
<%= content_tag :li, link_to((content_tag(:span, t(:list_)))), :class => active_for_action('users_new_interface', 'index') %>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles','member_infos')) do -%>
|
||||
<%= content_tag :li, link_to((content_tag(:span, t(:list_)))), :class => active_for_action('members', 'index') %>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="sub-nav-block" data-icons="">
|
||||
<h4><%= t(:analysis) %></h4>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles')) do -%>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles','member_infos')) do -%>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="sub-nav-block" data-icons="">
|
||||
<h4><%= t(:groups) %></h4>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles')) do -%>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('members', 'roles','member_infos')) do -%>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<%= form_for @user, :html => { :class=>"form-horizontal main-forms", :id=>"user-forms"} do |f| %>
|
||||
|
||||
<div class="attributes">
|
||||
<div class="attributes-header clearfix">
|
||||
<h4><%=t(:sys_basic_id_form)%></h4>
|
||||
</div>
|
||||
<div class="attributes-body">
|
||||
|
||||
<!-- Account -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="account">
|
||||
<label for="user_name" class="control-label"><%= t("users.user_id")%></label>
|
||||
</label>
|
||||
<div class="controls add-input">
|
||||
<%= f.text_field :user_name, :class=>"input-medium", :id=>"account", :placeholder=>"#{t('users.user_id')}" %>
|
||||
<span class="help-block"><%= t("users.user_id_note")%></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Password -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="password">
|
||||
<label for="password" class="control-label"><%= t("users.new_password")%></label>
|
||||
</label>
|
||||
<div class="controls add-input">
|
||||
<%= f.password_field :password, :class=>"input-medium", :id=>"password" %>
|
||||
<span class="help-block"><%= t("users.new_password_note")%></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Confirm Password -->
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="confirm_password">
|
||||
<label for="password_confirmation" class="control-label"><%= t("users.new_password_confirmation")%></label>
|
||||
</label>
|
||||
<div class="controls add-input">
|
||||
<%= f.password_field :password_confirmation, :class=>"input-medium", :id=>"confirm_password" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -13,8 +13,9 @@
|
|||
<%= javascript_include_tag "lib/jquery-ui-1.10.3.custom.min.js" %>
|
||||
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload.js" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker.js" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/date.time.picker" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/member/textarea-lang-btn.js" %>
|
||||
<%= javascript_include_tag "lib/member/role-forms.js" %>
|
||||
<% end -%>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<fieldset>
|
||||
<div id="basic-area" class="input-area">
|
||||
|
||||
<%= render :partial => 'user_basic_passwd'%>
|
||||
<%= render :partial => 'member_basic', :locals => {:f => f}%>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'admin/members/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "js_and_css"%>
|
||||
|
||||
|
||||
<% content_for :right_nav do %>
|
||||
|
||||
<div class="searchClear pull-left" style="clear: left;">
|
||||
<form action="" method="get">
|
||||
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
|
||||
<input type="hidden" name="at" id="at" value="<%= params[:at] %>" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="view-switch pull-right" data-toggle="buttons-radio">
|
||||
|
||||
<form action="" method="get" class="btn-group">
|
||||
<button class="btn btn-small <%= "active" if params[:at].blank? %>"><i class="icon-list"></i> <%= t("show_mode.index")%></button>
|
||||
<button name="at" value="summary" class="btn btn-small <%= "active" if params[:at] == "summary" %>"><i class="icon-th-list"></i> <%= t("show_mode.summary")%></button>
|
||||
<button name="at" value="thumbnail" class="btn btn-small <%= "active" if params[:at] == "thumbnail" %>"><i class="icon-th"></i> <%= t("show_mode.thumbnail")%></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div id="list-view">
|
||||
<ul id="member-abstract" class="clearfix">
|
||||
<%= render :partial=>"member_for_summary",:collection=> @members%>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<%= render :partial=> "index_paginator" if @mq.blank? %>
|
|
@ -0,0 +1,3 @@
|
|||
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||
$("#summary_block_users").html("<%= j render :partial => 'member_for_summary', :collection => @members %>");
|
||||
$("#user_pagination").html("<%= j paginate @members, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
|
@ -0,0 +1,48 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'admin/members/side_bar' %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "js_and_css"%>
|
||||
|
||||
|
||||
<% content_for :right_nav do %>
|
||||
|
||||
<div class="searchClear pull-left" style="clear: left;">
|
||||
<form action="" method="get">
|
||||
<%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
|
||||
<input type="hidden" name="at" id="at" value="<%= params[:at] %>" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="view-switch pull-right" data-toggle="buttons-radio">
|
||||
|
||||
<form action="" method="get" class="btn-group">
|
||||
<button class="btn btn-small <%= "active" if params[:at].blank? %>"><i class="icon-list"></i> <%= t("show_mode.index")%></button>
|
||||
<button name="at" value="summary" class="btn btn-small <%= "active" if params[:at] == "summary" %>"><i class="icon-th-list"></i> <%= t("show_mode.summary")%></button>
|
||||
<button name="at" value="thumbnail" class="btn btn-small <%= "active" if params[:at] == "thumbnail" %>"><i class="icon-th"></i> <%= t("show_mode.thumbnail")%></button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div id="list-view">
|
||||
<ul id="member-card" class="clearfix">
|
||||
<%= render :partial=>"member_for_thumbnail",:collection=> @members%>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<%= render :partial=> "index_paginator" if @mq.blank? %>
|
|
@ -0,0 +1,3 @@
|
|||
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||
$("#thumbnail_block_users").html("<%= j render :partial => 'member_for_thumbnail', :collection => @members %>");
|
||||
$("#user_pagination").html("<%= j paginate @members, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
|
@ -0,0 +1,40 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= 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/fileupload.css" %>
|
||||
<%= stylesheet_link_tag "lib/togglebox.css" %>
|
||||
<% end -%>
|
||||
<% content_for :page_specific_javascript do -%>
|
||||
<%= javascript_include_tag "lib/jquery-ui-1.10.3.custom.min" %>
|
||||
<%= javascript_include_tag "lib/jquery.tmpl.min" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload.js" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker.js" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/member/textarea-lang-btn" %>
|
||||
<%= javascript_include_tag "lib/member/role-forms" %>
|
||||
<% end -%>
|
||||
|
||||
<%= form_for @member, :url => admin_members_path(@member), :html => { :multipart => true , :class=>"form-horizontal main-forms", :id=>"user-forms"} do |f| %>
|
||||
|
||||
<fieldset>
|
||||
<div id="basic-area" class="input-area">
|
||||
<%= render :partial => 'user_basic_passwd'%>
|
||||
<%= render :partial => 'member_basic', :locals => {:f => f}%>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= link_to t(:create_), "#", :class=>"btn btn-primary returnDecide", :onclick=>"$('#user-forms').submit()" %>
|
||||
<%= link_back('btn') %>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<% end -%>
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
<%#= encoding: utf-8 %>
|
||||
|
||||
<script id="template-attributes" type="text/x-tmpl">
|
||||
<div class="attributes">
|
||||
<div class="attributes-header clearfix">
|
||||
<input class="toggle-check" data-deploy="right" id="${_disabled[0]}" name="${_disabled[1]}" type="hidden" value="false">
|
||||
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> Delete</a>
|
||||
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reply</a>
|
||||
<input class="attribute_field_to_delete" id="${_to_delete[0]}" name="${_to_delete[1]}" type="hidden" value="false">
|
||||
<h4>Attributes <span>${attributesHeaderLength}</span></h4>
|
||||
</div>
|
||||
<div class="attributes-body">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for="${_key[0]}"><%= t(:key) %></label>
|
||||
<div class="controls">
|
||||
<input type="text" data-type="key" id="${_key[0]}" name="${_key[1]}" placeholder="<%= t(:key) %>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:name) %></label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<div class="tab-content">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
|
||||
<div class="tab-pane <%= active %> fade in" id="${_title_translations[0]+'_<%= locale%>'}">
|
||||
<input type="text" data-type="lang_<%= locale%>" name="${_title_translations[1]+'[<%= locale%>]'}" placeholder="<%= I18nVariable.from_locale(locale) %>">
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="btn-group" data-toggle="buttons-radio">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
|
||||
<a class="btn <%= active %>" href="${'#'+_title_translations[0]+'_<%= locale%>'}" data-toggle="tab"><%= I18nVariable.from_locale(locale) %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:to_search) %></label>
|
||||
<div class="controls">
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="search_true" id="${_to_search[0]+'_true'}" name="${_to_search[1]}" value="true"> <%= t(:yes_)%>
|
||||
</label>
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="search_false" id="${_to_search[0]+'_false'}" name="${_to_search[1]}" value="false" checked=""> <%= t(:no_)%>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:to_show) %></label>
|
||||
<div class="controls">
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="search_true" id="${_to_show[0]+'_true'}" name="${_to_show[1]}" value="true" checked=""> <%= t(:yes_)%>
|
||||
</label>
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="search_false" id="${_to_show[0]+'_false'}" name="${_to_show[1]}" value="false"> <%= t(:no_)%>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:type)%></label>
|
||||
<div class="controls">
|
||||
<select class="dataType" data-type="select" name="${_markup}">
|
||||
<%LIST[:markups].each do |key,val|%>
|
||||
<option value="<%= key %>" ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-type fade in typeA">
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:enabled_for)%></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" data-type="enable_monolingual" id="${_cross_lang[0]}" name="${_cross_lang[1]}" value="true">
|
||||
<%= t(:cross_lang) %>
|
||||
</label>
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true">
|
||||
<%= t(:add_more)%>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:placeholder) %></label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
|
||||
|
||||
<div class="tab-pane <%= active %> fade in" id="${_placeholder[0]+'_<%= locale %>'}">
|
||||
<input type="text" data-type="lang_<%= locale %>" placeholder="<%= I18nVariable.from_locale(locale) %>" name="${_placeholder[1]+'[<%= locale %>]'}">
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="btn-group" data-toggle="buttons-radio">
|
||||
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
|
||||
|
||||
<a class="btn <%= active %>" href="${'#'+_placeholder[0]+'_<%= locale %>'}" data-toggle="tab"><%= I18nVariable.from_locale(locale) %></a>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script id="template-type" type="text/x-tmpl">
|
||||
{{if templateType == 'typeA' || templateType == 'typeD' || templateType == 'typeG'}}
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:enabled_for)%></label>
|
||||
<div class="controls">
|
||||
{{if templateType == 'typeA' || templateType == 'typeD'}}
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" data-type="enable_monolingual" id="${_cross_lang[0]}" name="${_cross_lang[1]}" value="true">
|
||||
<%= t(:cross_lang) %>
|
||||
</label>
|
||||
{{/if}}
|
||||
{{if templateType == 'typeA' || templateType == 'typeG'}}
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true">
|
||||
<%= t(:add_more)%>
|
||||
</label>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if templateType == 'typeA' || templateType == 'typeB' || templateType == 'typeD'}}
|
||||
<div class="control-group">
|
||||
<label class="control-label muted">
|
||||
{{if templateType == 'typeB'}}
|
||||
<%= t(:initial) %>
|
||||
{{else}}
|
||||
<%= t(:placeholder) %>
|
||||
{{/if}}
|
||||
</label>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<div class="tab-content">
|
||||
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
|
||||
|
||||
<div class="tab-pane <%= active %> fade in" id=
|
||||
{{if templateType == 'typeB'}}
|
||||
"${_initial[0]+'_<%= locale %>'}"
|
||||
{{else}}
|
||||
"${_placeholder[0]+'_<%= locale %>'}"
|
||||
{{/if}}
|
||||
>
|
||||
<input type="text" data-type="lang_<%= locale %>" placeholder="<%= I18nVariable.from_locale(locale) %>" name=
|
||||
{{if templateType == 'typeB'}}
|
||||
"${_initial[1]+'[<%= locale %>]' }"
|
||||
{{else}}
|
||||
"${_placeholder[1]+'[<%= locale %>]'}"
|
||||
{{/if}}
|
||||
>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<div class="btn-group" data-toggle="buttons-radio">
|
||||
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
|
||||
|
||||
<a class="btn <%= active %>" href=
|
||||
{{if templateType == 'typeB'}}
|
||||
"${'#'+_initial[0]+'_<%= locale %>'}"
|
||||
{{else}}
|
||||
"${'#'+_placeholder[0]+'_<%= locale %>'}"
|
||||
{{/if}}
|
||||
data-toggle="tab"><%= I18nVariable.from_locale(locale) %></a>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF'}}
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:options)%></label>
|
||||
<div class="controls add-input">
|
||||
<div class="add-target single">
|
||||
<%= content_tag :div,:class=>"input-append" do%>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% last = (locale == @site_in_use_locales.last ? true : false) %>
|
||||
<input type="text" data-type="${_option_list[2]+'_<%= locale %>' }" id="${_option_list[0]+'_<%= locale %>'}" name="${_option_list[1]+'[<%= locale %>]'}" class="input-medium" placeholder="<%= I18nVariable.from_locale(locale) %>">
|
||||
<% if last %>
|
||||
<a href="#" class="btn remove-input"> <i class="icon-trash"></i> </a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<p class="add-btn">
|
||||
<a href="#" class="${templateType+' trigger btn btn-mini btn-primary'}"><i class="icons-plus"></i> Add</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if templateType == 'typeC'}}
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t("date.format")%></label>
|
||||
<div class="controls">
|
||||
<select data-type="date" id="${_format[0]}" name="${_format[1]}">
|
||||
<option value="format1">YYYY / MM / DD hh : mm</option>
|
||||
<option value="format2">YYYY / MM / DD</option>
|
||||
<option value="format3">YYYY / MM</option>
|
||||
<option value="format4">YYYY</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t("date.range")%></label>
|
||||
<div class="controls">
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="time_period_flase" id="${_is_range[0]+'_false'}" name="${_is_range[1]}" value="false" checked="checked"> <%= t(:yes_)%>
|
||||
</label>
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="time_period_true" id="${_is_range[0]+'_true'}" name="${_is_range[1]}" value="true"> <%= t(:no_)%>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t("date.calendar")%></label>
|
||||
<div class="controls">
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="calendar_ac" id="${_calendar[0]+'_west_calendar'}" name="${_calendar[1]}" value="west_calendar" checked="checked"> <%= t("date.west_calendar")%>
|
||||
</label>
|
||||
<label class="radio inline">
|
||||
<input type="radio" data-type="calendar_roc" id="${_calendar[0]+'_tw_calendar'}" name="${_calendar[1]}" value="tw_calendar"> <%= t("date.tw_calendar")%>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</script>
|
||||
|
||||
|
||||
<script id="template-input-append" type="text/x-tmpl">
|
||||
<%= content_tag :div,:class=>"input-append" do%>
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<% last = (locale == @site_in_use_locales.last ? true : false) %>
|
||||
<input type="text" data-type="${_option_list[2]+'_<%= locale %>' }" id="${_option_list[0]+'_<%= locale %>'}" name="${_option_list[1]+'[<%= locale %>]'}" class="input-medium" placeholder="<%= I18nVariable.from_locale(locale) %>">
|
||||
<% if last %>
|
||||
<a href="#" class="btn remove-input"> <i class="icon-trash"></i> </a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</script>
|
||||
|
||||
<script id="template-text" type="text/x-tmpl">
|
||||
<div class="input-append">
|
||||
<input type="text" id="${'text'+_text[0]}" name="${_text[1]+'[text]'}" class="input-medium" placeholder="Text">
|
||||
<a href="#" class="btn remove-input">
|
||||
<i class="icon-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Member#new</h1>
|
||||
<p>Find me in app/views/member/new.html.erb</p>
|
|
@ -21,14 +21,15 @@
|
|||
<span class="notify ok alert hide alert-success"><i class="icon-ok"></i>Available</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group clear">
|
||||
<label class="control-label" for="user_email"><%= t("user.email")%></label>
|
||||
<div class="controls">
|
||||
<%= f.email_field :email, :placeholder => t("users.email"), :id=>"user_email", :class=>"availibility" %>
|
||||
<span class="loader hide"><img src="/assets/availability-check-loader.gif" /></span>
|
||||
<span class="notify not-ok hide alert alert-danger"><i class="icon-remove"></i>Not Available</span>
|
||||
<span class="notify ok hide alert alert-success"><i class="icon-ok"></i>Available</span>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<%= email_field_tag :email, "", class: "availibility", id: "user_email", placeholder: t("users.email") %>
|
||||
<span class="loader hide"><img src="/assets/availability-check-loader.gif" /></span>
|
||||
<span class="notify not-ok hide alert alert-danger"><i class="icon-remove"></i>Not Available</span>
|
||||
<span class="notify ok hide alert alert-success"><i class="icon-ok"></i>Available</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group clear">
|
||||
|
@ -55,40 +56,4 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!--
|
||||
|
||||
<h1>Sign Up</h1>
|
||||
|
||||
<%= form_for @user do |f| %>
|
||||
<% if @user.errors.any? %>
|
||||
<div class="error_messages">
|
||||
<h2>Form is invalid</h2>
|
||||
<ul>
|
||||
<% for message in @user.errors.full_messages %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :user_name %>
|
||||
<%= f.text_field :user_name %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %>
|
||||
<%= f.text_field :email %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :password %>
|
||||
<%= f.password_field :password %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %>
|
||||
<%= f.password_field :password_confirmation %>
|
||||
</div>
|
||||
<div class="actions"><%= f.submit %></div>
|
||||
<% end %> -->
|
||||
</section>
|
|
@ -0,0 +1,2 @@
|
|||
data = File.open(File.join(Rails.root, 'config', 'list.yml')).read
|
||||
LIST = YAML::load(ERB.new(data).result(binding)).symbolize_keys
|
|
@ -0,0 +1,35 @@
|
|||
forbidden_item_names:
|
||||
- admin
|
||||
- panel
|
||||
- appfront
|
||||
|
||||
#NO_MULTI_TAG = ["select","date","radio_button","checkbox","date_durnation"]
|
||||
|
||||
markups:
|
||||
text_field:
|
||||
muti_lang_input_supprt: true
|
||||
ext_support: true
|
||||
panel: typeA
|
||||
select:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeB
|
||||
date:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeC
|
||||
text_area:
|
||||
muti_lang_input_supprt: true
|
||||
ext_support: false
|
||||
panel: typeD
|
||||
radio_button:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeE
|
||||
checkbox:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeE
|
||||
address:
|
||||
muti_lang_input_supprt: true
|
||||
ext_support: true
|
|
@ -319,7 +319,7 @@ en:
|
|||
me: Me
|
||||
member_: Member
|
||||
member_authorization: Authorizations
|
||||
member_info: Profile Form
|
||||
member_info: Member Attributes
|
||||
member_registration: Registration Approval
|
||||
member_role: Member Roles
|
||||
menu_enabled_for: Menu enabled for
|
||||
|
@ -647,6 +647,11 @@ en:
|
|||
user_id_error: Someone already use that user account
|
||||
user_basic_id_form: Account Info.
|
||||
user_basic_data: Personal Profile
|
||||
address: Address
|
||||
personal_website: Personal Website
|
||||
autobiography: Autobiography
|
||||
birthday: Birthday
|
||||
|
||||
version: Version
|
||||
vertical: Vertical
|
||||
view: View
|
||||
|
|
|
@ -630,6 +630,10 @@ zh_tw:
|
|||
user_id_error: 該使用者帳號已被使用
|
||||
user_basic_id_form: 帳號資料
|
||||
user_basic_data: 個人資料
|
||||
address: 聯絡地址
|
||||
personal_website: 個人網址
|
||||
autobiography: 自我介紹
|
||||
birthday: 生日
|
||||
version: 版本
|
||||
vertical: 垂直的
|
||||
view: 檢視
|
||||
|
|
|
@ -39,6 +39,9 @@ Orbit::Application.routes.draw do
|
|||
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||
|
||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||
|
||||
resources :member_profiles
|
||||
|
||||
resources :users do
|
||||
collection do
|
||||
get 'confirm_user'
|
||||
|
@ -67,6 +70,8 @@ Orbit::Application.routes.draw do
|
|||
get 'role_field'
|
||||
post 'toggle'
|
||||
end
|
||||
|
||||
resources :member_infos
|
||||
|
||||
resources :module_apps do
|
||||
resources :categories do
|
||||
|
@ -137,9 +142,7 @@ Orbit::Application.routes.draw do
|
|||
get 'update_orbit'
|
||||
get 'restart_server'
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
resources :designs do
|
||||
collection do
|
||||
get 'upload_package'
|
||||
|
@ -153,7 +156,6 @@ Orbit::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
get 'design_list' => 'designs#design_list'
|
||||
|
||||
get 'module_store' => 'module_store#index'
|
||||
end
|
||||
get ':page(/:page)(/:page)(/:page)', to: 'pages#show', constraints: KeywordConstraint.new
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class Admin::MemberInfosControllerTest < ActionController::TestCase
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MemberControllerTest < ActionController::TestCase
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
# 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
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -0,0 +1,11 @@
|
|||
# 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
|
||||
# model remove the '{}' from the fixture names and add the columns immediately
|
||||
# below each fixture, per the syntax in the comments below
|
||||
#
|
||||
one: {}
|
||||
# column: value
|
||||
#
|
||||
two: {}
|
||||
# column: value
|
|
@ -0,0 +1,9 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
key: MyString
|
||||
title: MyString
|
||||
|
||||
two:
|
||||
key: MyString
|
||||
title: MyString
|
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class Admin::MemberInfosHelperTest < ActionView::TestCase
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MemberHelperTest < ActionView::TestCase
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MemberInfoTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MemberProfileFieldTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MemberProfileFieldValueTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue