change from seminar woth no conflict

This commit is contained in:
chiu 2020-05-07 23:26:34 +08:00
parent b772845e4a
commit de83819ac3
134 changed files with 8103 additions and 0 deletions

14
Gemfile Normal file
View File

@ -0,0 +1,14 @@
source "https://rubygems.org"
# Declare your gem's dependencies in venue_management.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'debugger'

20
MIT-LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright 2015 YOURNAME
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3
README.rdoc Normal file
View File

@ -0,0 +1,3 @@
= venue_management
This project rocks and uses MIT-LICENSE.

32
Rakefile Normal file
View File

@ -0,0 +1,32 @@
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'VenueManagement'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
task default: :test

View File

@ -0,0 +1,78 @@
function checkTagsQuantity() {
var $tagLead = $('.tag-lead'),
$tagsGroups = $('.tags-groups');
$tagsGroups.each(function(i) {
var $children = $(this).children().length;
$tagLead.eq(i).children('.badge').text($children);
})
}
function checkedLength() {
var $tagsList = $('#tags-list'),
$defaultTags,
ids;
function reload_links() {
var _checked = 0;
ids = [];
$defaultTags = $('li.default input[type="checkbox"]');
$defaultTags.each(function(index, el) {
if($(el).prop('checked')) {
_checked ++;
ids.push($(el).val())
}
});
console.log(_checked,ids)
if(_checked > 0) {
$('#deselect').removeClass('hide');
$('#deselect').on('click', deselect);
$('#deleteItems').attr('rel', "<%= Rails.application.routes.url_helpers.delete_items_admin_venue_management_items_path %>" + "?ids=" + ids);
$('#deleteItems').removeClass('hide');
} else {
$('#deselect').addClass('hide');
$('#deleteItems').attr('rel', "");
$('#deleteItems').addClass('hide');
$('#deselect').off('click', deselect);
};
}
$tagsList.on('click', '.card', function(event) {
reload_links();
});
$('#selectAllTags').on('click', function() {
$('.filter-item:not(".mark") input[type="checkbox"]').prop('checked', true);
$('.filter-item:not(".mark") .card').addClass('active');
reload_links();
});
$('#deleteItems').on('click', function() {
$('#delete_venue_management_items .tags-groups').empty();
$('#delete_venue_management_items a.delete-tags').attr("href", $(this).attr("rel"));
if(ids.length) {
$('.filter-item').children('.card.active').each(function(i, e) {
console.log($(e))
$(e).parents('.filter-item').clone().appendTo('#delete_venue_management_items .tags-groups');
$('#delete_venue_management_items .tags-groups .filter-item').addClass('def');
});
}
$('#delete_venue_management_items').modal('show', cleanTagInputs());
function cleanTagInputs(){
var $tagsDelete = $('#delete_venue_management_items'),
$filterItem = $tagsDelete.find('.filter-item');
$filterItem.find('.card, .amount').remove();
$filterItem.find('a').removeAttr('class');
$filterItem.find('a').removeAttr('href');
}
});
function deselect() {
$('.tags input[type="checkbox"]').prop('checked', false);
$('.card').removeClass('active');
$('.bottomnav .toggable').not('.open-slide').addClass('hide');
$('#deleteItems').attr('rel', "");
}
}
$(function() {
checkedLength();
});

View File

@ -0,0 +1,494 @@
// Retrieve the initial data
function temporary() {
attributesArray.length = 0;
$('.attributes').each(function() {
var attributesData = {},
$selectType = $('.dataType').data().type;
// Capture "attributes-body" within the input[type = "text"] val
$(this).find('.attributes-body').find('input[type="text"]').each(function(i) {
var $type = $(this).data().type;
attributesData[$type] = $(this).val();
});
// Capture "attributes-body" within the input[type = "radio"] checked
$(this).find('.attributes-body').find('input[type="radio"]').each(function(i) {
var $type = $(this).data().type;
attributesData[$type] = $(this).prop("checked");
});
// Capture "attributes-body" within the dataType selected
$(this).find('.attributes-body').find('.dataType').children("option:selected").each(function () {
attributesData[$selectType] = {};
attributesData[$selectType].index = $(this).index();
attributesData[$selectType].name = $(this).attr('ref');
if($(this).attr('ref') == 'typeB' || $(this).attr('ref') == 'typeE' || $(this).attr('ref') == 'typeF') {
attributesData[$selectType].option = [];
}
});
// Capture "field-type" within the input[type = "text"] val
$(this).find('.field-type').find('input[type="text"]').each(function(i) {
var $type = $(this).data().type;
if(!$type.match('option_lang')) {
attributesData[$selectType][$type] = $(this).val();
}
});
$(this).find('.field-type .add-target').find('.input-append').each(function() {
var append = []
$(this).children('input[type="text"]').each(function() {
var val = $(this).val();
append.push(val);
});
attributesData[$selectType].option.push(append);
})
// Capture "field-type" within the input[type = "checkbox"] checked
$(this).find('.field-type').find('input[type="checkbox"]').each(function() {
var $type = $(this).data().type;
attributesData[$selectType][$type] = $(this).prop("checked");
});
// Capture "field-type" within the input[type = "radio"] checked
$(this).find('.field-type').find('input[type="radio"]').each(function() {
var $type = $(this).data().type;
attributesData[$selectType][$type] = $(this).prop("checked");
});
// Capture "field-type" within the dataType selected
$(this).find('.field-type').find('select').children("option:selected").each(function () {
attributesData[$selectType].dateFormat = $(this).index();
});
attributesArray.push(attributesData);
});
};
// Determine the Append input length
function inputAppendLength() {
$('.add-target').each(function(i) {
if($(this).children('.input-append:not(:hidden)').length == 1 || $(this).children('.input-append').length == 1) {
$(this).children('.input-append').each(function() {
if($(this).children('div').hasClass('tab-content')) {
var btnLength = $(this).children('.btn').length;
$(this).find('.btn').eq(btnLength-2).addClass('last');
$(this).find('.remove-input').addClass('hide');
} else {
var mediumLength = $(this).children('.input-medium').length;
$(this).children('.input-medium').eq(mediumLength-1).addClass('last');
$(this).children('.remove-input').addClass('hide');
}
});
} else {
$(this).children('.input-append').each(function() {
if($(this).children('div').hasClass('tab-content')) {
$(this).find('.btn').removeClass('last');
$(this).find('.remove-input').removeClass('hide');
} else {
$(this).children('.input-medium').removeClass('last');
$(this).children('.remove-input').removeClass('hide');
}
});
}
});
};
// Role Attribute Template Data
function setData(l, type, ol) {
var fields = $('#info').length ? "info[venue_management_submission_fields]" : $('#sub_venue_management_main').length ? "sub_venue_management_main[venue_management_submission_fields]" : "venue_management_main[venue_management_submission_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_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
};
return data;
}
// Get Default Address Form
function getAddressForm(trigger, element, decide) {
if(decide) {
addressVal.length = addressArray.length = 0;
var addressAllVal = [];
var inputNameArray = [];
trigger.closest('.input-append').find('.tab-pane').each(function() {
var adderssText = $(this).children('input[type="text"]').val(),
addersshidden = '',
addressData = {},
inputName = [];
$(this).children('input:not(:first)').each(function(j) {
var name = $(this).attr('name'),
val = $(this).val();
addersshidden += val;
addressData[name] = val;
inputName.push(name);
});
addressArray.push(addressData);
addressAllVal.push(adderssText);
inputNameArray.push(inputName);
if(adderssText != addersshidden) {
addressVal.push(false);
} else {
addressVal.push(true);
}
});
element.find('.tab-pane').each(function(i) {
$(this).find('textarea, input[type="text"]').each(function(j) {
$(this).attr('name',inputNameArray[i][j]);
});
if(addressVal[i]) {
$(this).find('textarea, input[type="text"]').each(function(j) {
$(this).val(addressArray[i][$(this).attr('name')]);
});
} else {
$(this).find('textarea').val(addressAllVal[i]);
$(this).find('input[type="text"]').each(function(j) {
$(this).val('');
});
}
});
};
element.off('show');
};
// Return Address Form
function returnAddressForm(element, decide) {
if(decide) {
addressArray.length = 0;
element.find('.tab-pane').each(function(i) {
var addressData = {};
$(this).find('textarea, input[type="text"]').each(function(j) {
var name = $(this).attr('name'),
val = $(this).val();
addressData[name] = val;
});
addressArray.push(addressData);
});
$.map(addressInputId, function(n, i) {
var v = '';
$('#'+n).find('input[type="hidden"]').each(function() {
$(this).val(addressArray[i][$(this).attr('name')]);
v += addressArray[i][$(this).attr('name')]
});
$('#'+n).find('input[type="text"]').each(function() {
$(this).val(v);
});
});
};
returnDecide = false;
};
$(function() {
appendIndex = null;
if($('#user-forms').length) {
addressVal = [];
addressArray = [];
addressInputId = [];
venue_management_mainType = null;
returnDecide = false;
$('.attributes').each(function() {
if($(this).find('.toggle-check').attr('value') == "true") {
$(this).addClass('disabled').children('.attributes-body').hide();
}
});
$('.returnDecide').on(clickEvent, function() {
returnDecide = true;
})
$('#address-field').on('hidden', function () {
$('.btn[data-toggle="modal"]').removeClass('active').blur();
$(this).find('.nav-tabs > li').removeClass('active').eq(0).addClass('active');
$(this).find('.tab-content > .tab-pane').removeClass('active in').eq(0).addClass('active in');
$(this).on('show', getAddressForm(null, $(this), false));
returnAddressForm($(this), returnDecide)
});
$('.control-group').delegate('.btn[data-toggle="modal"]', 'click', function() {
var $trigger = $(this);
addressInputId.length = 0;
$(this).closest('.input-append').find('.tab-pane').each(function() {
addressInputId.push($(this).attr('id'));
});
$('#address-field').on('show', getAddressForm($trigger, $('#address-field'), true));
});
$('#user-forms').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
if($(this).hasClass('togglebox')) {
var venue_management_main_staus = [];
if($(this).hasClass('disable')) {
$(this).find('.toggle-check')
.attr('value', 'false')
.closest('.attributes')
.removeClass('disabled')
.children('.attributes-body')
.fadeIn(300);
} else {
$(this).find('.toggle-check')
.attr('value', 'true')
.closest('.attributes')
.addClass('disabled')
.children('.attributes-body')
.fadeOut(300)
.find('.check')
.attr("checked",false)
.attr("value",venue_management_main_staus);
}
$(this).toggleClass('disable');
};
if($(this).hasClass('remove-input')) {
$(this).closest('.input-append').fadeOut(300, function() {
$(this).remove();
inputAppendLength();
});
};
if($(this).hasClass('trigger')) {
appendIndex = $(this).closest('.controls').find('.input-append').length;
nameNumber = $(this).closest('.controls').find('.input-append:eq(0)').find('input').eq(0).attr('name');
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
venue_management_mainType = $(this).data('venue_management_mains')
if($(this).hasClass('textInput')) {
$("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('textLengInput')) {
$("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('address')) {
$("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
}
inputAppendLength();
};
event.preventDefault();
});
inputAppendLength();
} else {
attributesArray = [];
attributesHeaderLength = null;
templateType = null;
attributeIndex = null;
if($('.add-target').length) {
inputAppendLength();
}
if(!$('.attributes').length) {
$('#attributes-area').addClass('clickHere');
} else {
temporary();
};
$('.add-attributes').on(clickEvent, function() {
if($('#attributes-area').hasClass('clickHere')) {
$('#attributes-area').removeClass('clickHere');
};
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length;
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox();
});
$('.attributes.default').each(function(i) {
$(this).children('.field-type').not('.default').hide();
$(this).find('input[type="text"]').on('keyup', function() {
$(this).trigger("checking");
});
$(this).find('input[type="radio"], input[type="checkbox"], select').change(function() {
$(this).trigger("checking");
});
$(this).delegate('input[type="text"], input[type="radio"], input[type="checkbox"], select', 'checking', function(e) {
var e = e.target.type,
$data = $(this).data().type;
switch(e) {
case 'text':
var val = $(this).val();
if(!$(this).closest('.field-type').length) {
$data = attributesArray[i][$data];
} else if(!$(this).closest('.add-target').length) {
$data = attributesArray[i].select[$data];
} else {
appendIndex = $(this).parent('.input-append').index()
optionIndex = $(this).index()
$data = attributesArray[i].select.option[appendIndex][optionIndex];
}
if(val != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'radio':
var checked = $(this).prop("checked");
$data = attributesArray[i][$data];
if(checked != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'checkbox':
var checked = $(this).prop("checked");
$data = attributesArray[i].select[$data];
if(checked != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'select-one':
var ref,
$data = attributesArray[i].select.name;
$(this).children("option:selected").each(function() {
ref = $(this).attr('ref');
});
if(ref != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
};
});
$(this).delegate('.reply', clickEvent, function() {
var $bodyText = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="text"]'),
$bodyRadio = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="radio"]'),
$bodySelected = $(this).parent('.attributes-header').siblings('.attributes-body').find('.dataType').children("option"),
$fieldTypeO = $(this).parent('.attributes-header').siblings('.field-type.default'),
$fieldTypeN = $(this).parent('.attributes-header').siblings('.field-type').not('.default');
$bodyText.each(function() {
var $type = $(this).data().type;
$(this).val(attributesArray[i][$type]);
});
$bodyRadio.each(function() {
var $type = $(this).data().type;
$(this).prop("checked", attributesArray[i][$type])
});
$fieldTypeO.find('input[type="text"]').each(function() {
var $type = $(this).data().type;
if(!$type.match('option_lang')) {
$(this).val(attributesArray[i].select[$type]);
}
});
$fieldTypeO.find('.add-target').find('.input-append').each(function(k) {
$(this).children('input[type="text"]').each(function(j) {
$(this).val(attributesArray[i].select.option[k][j]);
// var val = $(this).val();
// append.push(val);
});
})
$fieldTypeO.find('input[type="checkbox"], input[type="radio"]').each(function() {
var $type = $(this).data().type;
$(this).prop("checked", attributesArray[i].select[$type]);
});
$fieldTypeO.find('select').children("option").eq(attributesArray[i].select.dateFormat).prop('selected',true);
$bodySelected.eq(attributesArray[i].select.index).prop('selected',true);
$fieldTypeO.show();
$fieldTypeN.empty().hide();
$(this).addClass('hide')
return false
})
});
$('#attributes-area').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
if($(this).hasClass('togglebox')) {
if($(this).hasClass('disable')) {
$(this).find('.toggle-check')
.attr('value', 'false')
.closest('.attributes')
.removeClass('disabled')
.find('input, select')
.removeAttr('disabled')
.end('.attributes')
.find('.btn-group .btn')
.removeClass('disabled')
.end().find('.attribute_field_disabled').attr('value', 'false');
if($(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref')) {
$(this).closest('.attributes').find('.field-type').addClass('in').find('.control-group').delay(150).fadeIn(300);
}
} else {
$(this).find('.toggle-check')
.attr('value', 'true')
.closest('.attributes')
.addClass('disabled')
.find('.attributes-body input, .attributes-body select')
.attr({'disabled': 'disabled'})
.end('.attributes')
.find('.btn-group .btn')
.addClass('disabled')
.end().find('.attribute_field_disabled').attr('value', 'true')
.end().find('.field-type .control-group').fadeOut(300, function() {
$(this).parent('.field-type').removeClass('in');
});
}
$(this).toggleClass('disable');
};
if($(this).hasClass('delete')) {
$(this).closest('.attributes').fadeOut(300, function() {
$('.attributes:not(:hidden)').each(function(i) {
$(this).find('.attributes-header h4 span').text(i+1);
});
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
if(!$('.attributes:not(:hidden)').length) {
$('#attributes-area').addClass('clickHere');
};
}).find('.attribute_field_to_delete').attr('value', 'true');;
};
if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length;
appendIndex = $(this).closest('.controls').find('.input-append:last-child').children('input:first-child').attr('name');
// appendIndex = appendIndex.split("][");
// appendIndex = parseInt(appendIndex[appendIndex.length-2])+1;
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
console.log(appendIndex)
attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
$("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'));
inputAppendLength();
};
if($(this).hasClass('remove-input')) {
$(this).parent('.input-append').fadeOut(300, function() {
$(this).remove()
inputAppendLength();
});
}
event.preventDefault();
});
$('#attributes-area').delegate('.dataType', 'change', function() {
$(this).children("option:selected").each(function () {
var target = $(this).closest('.attributes').find('.field-type').not('.default');
attributeIndex = $(this).closest('.attributes').index();
appendIndex = 0
// $(this).closest('.attributes').find('.add-target').find('.input-append').length;
if($(this).closest('.attributes').hasClass('default')){
var i = $(this).closest('.attributes').index()
if($(this).attr('ref') == attributesArray[i].select.name) {
$(this).closest('.attributes').find('.field-type.default').show()
target.empty().hide();
} else {
$(this).closest('.attributes').find('.field-type.default').hide()
if($(this).attr('ref')) {
templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength();
}
} else {
target.removeAttr('class').addClass('field-type fade')
target.empty();
};
target.show();
}
} else {
if($(this).attr('ref')) {
templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength();
}
} else {
target.removeAttr('class').addClass('field-type fade')
target.empty();
};
}
});
});
}
});

View File

@ -0,0 +1,494 @@
// Retrieve the initial data
function temporary() {
attributesArray.length = 0;
$('.attributes').each(function() {
var attributesData = {},
$selectType = $('.dataType').data().type;
// Capture "attributes-body" within the input[type = "text"] val
$(this).find('.attributes-body').find('input[type="text"]').each(function(i) {
var $type = $(this).data().type;
attributesData[$type] = $(this).val();
});
// Capture "attributes-body" within the input[type = "radio"] checked
$(this).find('.attributes-body').find('input[type="radio"]').each(function(i) {
var $type = $(this).data().type;
attributesData[$type] = $(this).prop("checked");
});
// Capture "attributes-body" within the dataType selected
$(this).find('.attributes-body').find('.dataType').children("option:selected").each(function () {
attributesData[$selectType] = {};
attributesData[$selectType].index = $(this).index();
attributesData[$selectType].name = $(this).attr('ref');
if($(this).attr('ref') == 'typeB' || $(this).attr('ref') == 'typeE' || $(this).attr('ref') == 'typeF') {
attributesData[$selectType].option = [];
}
});
// Capture "field-type" within the input[type = "text"] val
$(this).find('.field-type').find('input[type="text"]').each(function(i) {
var $type = $(this).data().type;
if(!$type.match('option_lang')) {
attributesData[$selectType][$type] = $(this).val();
}
});
$(this).find('.field-type .add-target').find('.input-append').each(function() {
var append = []
$(this).children('input[type="text"]').each(function() {
var val = $(this).val();
append.push(val);
});
attributesData[$selectType].option.push(append);
})
// Capture "field-type" within the input[type = "checkbox"] checked
$(this).find('.field-type').find('input[type="checkbox"]').each(function() {
var $type = $(this).data().type;
attributesData[$selectType][$type] = $(this).prop("checked");
});
// Capture "field-type" within the input[type = "radio"] checked
$(this).find('.field-type').find('input[type="radio"]').each(function() {
var $type = $(this).data().type;
attributesData[$selectType][$type] = $(this).prop("checked");
});
// Capture "field-type" within the dataType selected
$(this).find('.field-type').find('select').children("option:selected").each(function () {
attributesData[$selectType].dateFormat = $(this).index();
});
attributesArray.push(attributesData);
});
};
// Determine the Append input length
function inputAppendLength() {
$('.add-target').each(function(i) {
if($(this).children('.input-append:not(:hidden)').length == 1 || $(this).children('.input-append').length == 1) {
$(this).children('.input-append').each(function() {
if($(this).children('div').hasClass('tab-content')) {
var btnLength = $(this).children('.btn').length;
$(this).find('.btn').eq(btnLength-2).addClass('last');
$(this).find('.remove-input').addClass('hide');
} else {
var mediumLength = $(this).children('.input-medium').length;
$(this).children('.input-medium').eq(mediumLength-1).addClass('last');
$(this).children('.remove-input').addClass('hide');
}
});
} else {
$(this).children('.input-append').each(function() {
if($(this).children('div').hasClass('tab-content')) {
$(this).find('.btn').removeClass('last');
$(this).find('.remove-input').removeClass('hide');
} else {
$(this).children('.input-medium').removeClass('last');
$(this).children('.remove-input').removeClass('hide');
}
});
}
});
};
// Role Attribute Template Data
function setData(l, type, ol) {
var fields = $('#info').length ? "info[venue_management_signup_fields]" : $('#sub_venue_management_main').length ? "sub_venue_management_main[venue_management_signup_fields]" : "venue_management_main[venue_management_signup_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_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
};
return data;
}
// Get Default Address Form
function getAddressForm(trigger, element, decide) {
if(decide) {
addressVal.length = addressArray.length = 0;
var addressAllVal = [];
var inputNameArray = [];
trigger.closest('.input-append').find('.tab-pane').each(function() {
var adderssText = $(this).children('input[type="text"]').val(),
addersshidden = '',
addressData = {},
inputName = [];
$(this).children('input:not(:first)').each(function(j) {
var name = $(this).attr('name'),
val = $(this).val();
addersshidden += val;
addressData[name] = val;
inputName.push(name);
});
addressArray.push(addressData);
addressAllVal.push(adderssText);
inputNameArray.push(inputName);
if(adderssText != addersshidden) {
addressVal.push(false);
} else {
addressVal.push(true);
}
});
element.find('.tab-pane').each(function(i) {
$(this).find('textarea, input[type="text"]').each(function(j) {
$(this).attr('name',inputNameArray[i][j]);
});
if(addressVal[i]) {
$(this).find('textarea, input[type="text"]').each(function(j) {
$(this).val(addressArray[i][$(this).attr('name')]);
});
} else {
$(this).find('textarea').val(addressAllVal[i]);
$(this).find('input[type="text"]').each(function(j) {
$(this).val('');
});
}
});
};
element.off('show');
};
// Return Address Form
function returnAddressForm(element, decide) {
if(decide) {
addressArray.length = 0;
element.find('.tab-pane').each(function(i) {
var addressData = {};
$(this).find('textarea, input[type="text"]').each(function(j) {
var name = $(this).attr('name'),
val = $(this).val();
addressData[name] = val;
});
addressArray.push(addressData);
});
$.map(addressInputId, function(n, i) {
var v = '';
$('#'+n).find('input[type="hidden"]').each(function() {
$(this).val(addressArray[i][$(this).attr('name')]);
v += addressArray[i][$(this).attr('name')]
});
$('#'+n).find('input[type="text"]').each(function() {
$(this).val(v);
});
});
};
returnDecide = false;
};
$(function() {
appendIndex = null;
if($('#user-forms').length) {
addressVal = [];
addressArray = [];
addressInputId = [];
venue_management_mainType = null;
returnDecide = false;
$('.attributes').each(function() {
if($(this).find('.toggle-check').attr('value') == "true") {
$(this).addClass('disabled').children('.attributes-body').hide();
}
});
$('.returnDecide').on(clickEvent, function() {
returnDecide = true;
})
$('#address-field').on('hidden', function () {
$('.btn[data-toggle="modal"]').removeClass('active').blur();
$(this).find('.nav-tabs > li').removeClass('active').eq(0).addClass('active');
$(this).find('.tab-content > .tab-pane').removeClass('active in').eq(0).addClass('active in');
$(this).on('show', getAddressForm(null, $(this), false));
returnAddressForm($(this), returnDecide)
});
$('.control-group').delegate('.btn[data-toggle="modal"]', 'click', function() {
var $trigger = $(this);
addressInputId.length = 0;
$(this).closest('.input-append').find('.tab-pane').each(function() {
addressInputId.push($(this).attr('id'));
});
$('#address-field').on('show', getAddressForm($trigger, $('#address-field'), true));
});
$('#user-forms').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
if($(this).hasClass('togglebox')) {
var venue_management_main_staus = [];
if($(this).hasClass('disable')) {
$(this).find('.toggle-check')
.attr('value', 'false')
.closest('.attributes')
.removeClass('disabled')
.children('.attributes-body')
.fadeIn(300);
} else {
$(this).find('.toggle-check')
.attr('value', 'true')
.closest('.attributes')
.addClass('disabled')
.children('.attributes-body')
.fadeOut(300)
.find('.check')
.attr("checked",false)
.attr("value",venue_management_main_staus);
}
$(this).toggleClass('disable');
};
if($(this).hasClass('remove-input')) {
$(this).closest('.input-append').fadeOut(300, function() {
$(this).remove();
inputAppendLength();
});
};
if($(this).hasClass('trigger')) {
appendIndex = $(this).closest('.controls').find('.input-append').length;
nameNumber = $(this).closest('.controls').find('.input-append:eq(0)').find('input').eq(0).attr('name');
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
venue_management_mainType = $(this).data('venue_management_mains')
if($(this).hasClass('textInput')) {
$("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('textLengInput')) {
$("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('address')) {
$("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
}
inputAppendLength();
};
event.preventDefault();
});
inputAppendLength();
} else {
attributesArray = [];
attributesHeaderLength = null;
templateType = null;
attributeIndex = null;
if($('.add-target').length) {
inputAppendLength();
}
if(!$('.attributes').length) {
$('#attributes-area').addClass('clickHere');
} else {
temporary();
};
$('.add-attributes').on(clickEvent, function() {
if($('#attributes-area').hasClass('clickHere')) {
$('#attributes-area').removeClass('clickHere');
};
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length;
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox();
});
$('.attributes.default').each(function(i) {
$(this).children('.field-type').not('.default').hide();
$(this).find('input[type="text"]').on('keyup', function() {
$(this).trigger("checking");
});
$(this).find('input[type="radio"], input[type="checkbox"], select').change(function() {
$(this).trigger("checking");
});
$(this).delegate('input[type="text"], input[type="radio"], input[type="checkbox"], select', 'checking', function(e) {
var e = e.target.type,
$data = $(this).data().type;
switch(e) {
case 'text':
var val = $(this).val();
if(!$(this).closest('.field-type').length) {
$data = attributesArray[i][$data];
} else if(!$(this).closest('.add-target').length) {
$data = attributesArray[i].select[$data];
} else {
appendIndex = $(this).parent('.input-append').index()
optionIndex = $(this).index()
$data = attributesArray[i].select.option[appendIndex][optionIndex];
}
if(val != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'radio':
var checked = $(this).prop("checked");
$data = attributesArray[i][$data];
if(checked != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'checkbox':
var checked = $(this).prop("checked");
$data = attributesArray[i].select[$data];
if(checked != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'select-one':
var ref,
$data = attributesArray[i].select.name;
$(this).children("option:selected").each(function() {
ref = $(this).attr('ref');
});
if(ref != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
};
});
$(this).delegate('.reply', clickEvent, function() {
var $bodyText = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="text"]'),
$bodyRadio = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="radio"]'),
$bodySelected = $(this).parent('.attributes-header').siblings('.attributes-body').find('.dataType').children("option"),
$fieldTypeO = $(this).parent('.attributes-header').siblings('.field-type.default'),
$fieldTypeN = $(this).parent('.attributes-header').siblings('.field-type').not('.default');
$bodyText.each(function() {
var $type = $(this).data().type;
$(this).val(attributesArray[i][$type]);
});
$bodyRadio.each(function() {
var $type = $(this).data().type;
$(this).prop("checked", attributesArray[i][$type])
});
$fieldTypeO.find('input[type="text"]').each(function() {
var $type = $(this).data().type;
if(!$type.match('option_lang')) {
$(this).val(attributesArray[i].select[$type]);
}
});
$fieldTypeO.find('.add-target').find('.input-append').each(function(k) {
$(this).children('input[type="text"]').each(function(j) {
$(this).val(attributesArray[i].select.option[k][j]);
// var val = $(this).val();
// append.push(val);
});
})
$fieldTypeO.find('input[type="checkbox"], input[type="radio"]').each(function() {
var $type = $(this).data().type;
$(this).prop("checked", attributesArray[i].select[$type]);
});
$fieldTypeO.find('select').children("option").eq(attributesArray[i].select.dateFormat).prop('selected',true);
$bodySelected.eq(attributesArray[i].select.index).prop('selected',true);
$fieldTypeO.show();
$fieldTypeN.empty().hide();
$(this).addClass('hide')
return false
})
});
$('#attributes-area').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
if($(this).hasClass('togglebox')) {
if($(this).hasClass('disable')) {
$(this).find('.toggle-check')
.attr('value', 'false')
.closest('.attributes')
.removeClass('disabled')
.find('input, select')
.removeAttr('disabled')
.end('.attributes')
.find('.btn-group .btn')
.removeClass('disabled')
.end().find('.attribute_field_disabled').attr('value', 'false');
if($(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref')) {
$(this).closest('.attributes').find('.field-type').addClass('in').find('.control-group').delay(150).fadeIn(300);
}
} else {
$(this).find('.toggle-check')
.attr('value', 'true')
.closest('.attributes')
.addClass('disabled')
.find('.attributes-body input, .attributes-body select')
.attr({'disabled': 'disabled'})
.end('.attributes')
.find('.btn-group .btn')
.addClass('disabled')
.end().find('.attribute_field_disabled').attr('value', 'true')
.end().find('.field-type .control-group').fadeOut(300, function() {
$(this).parent('.field-type').removeClass('in');
});
}
$(this).toggleClass('disable');
};
if($(this).hasClass('delete')) {
$(this).closest('.attributes').fadeOut(300, function() {
$('.attributes:not(:hidden)').each(function(i) {
$(this).find('.attributes-header h4 span').text(i+1);
});
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
if(!$('.attributes:not(:hidden)').length) {
$('#attributes-area').addClass('clickHere');
};
}).find('.attribute_field_to_delete').attr('value', 'true');;
};
if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length;
appendIndex = $(this).closest('.controls').find('.input-append:last-child').children('input:first-child').attr('name');
// appendIndex = appendIndex.split("][");
// appendIndex = parseInt(appendIndex[appendIndex.length-2])+1;
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
console.log(appendIndex)
attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
$("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'));
inputAppendLength();
};
if($(this).hasClass('remove-input')) {
$(this).parent('.input-append').fadeOut(300, function() {
$(this).remove()
inputAppendLength();
});
}
event.preventDefault();
});
$('#attributes-area').delegate('.dataType', 'change', function() {
$(this).children("option:selected").each(function () {
var target = $(this).closest('.attributes').find('.field-type').not('.default');
attributeIndex = $(this).closest('.attributes').index();
appendIndex = 0
// $(this).closest('.attributes').find('.add-target').find('.input-append').length;
if($(this).closest('.attributes').hasClass('default')){
var i = $(this).closest('.attributes').index()
if($(this).attr('ref') == attributesArray[i].select.name) {
$(this).closest('.attributes').find('.field-type.default').show()
target.empty().hide();
} else {
$(this).closest('.attributes').find('.field-type.default').hide()
if($(this).attr('ref')) {
templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength();
}
} else {
target.removeAttr('class').addClass('field-type fade')
target.empty();
};
target.show();
}
} else {
if($(this).attr('ref')) {
templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength();
}
} else {
target.removeAttr('class').addClass('field-type fade')
target.empty();
};
}
});
});
}
});

View File

@ -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/

View File

@ -0,0 +1,29 @@
$(function() {
$('a[data-toggle="tab"]').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
$.pageslide.closeCallback(function(pageslide, item) {
$('.filter-item').removeClass("active");
});
$.pageslide.loadComplete(function(pageslide, item) {
$('.filter-item').removeClass("active");
item.closest('li').addClass('active');
if(item.data('id') == 'new') {
resetForm();
pageslide.find('form:eq(0)').attr('action', window.location.pathname);
pageslide.find('form:eq(0)').attr('method', 'post');
}else {
setForm(item.data('form'));
pageslide.find('form:eq(0)').attr('action', window.location.pathname + '/' + item.data('id'));
pageslide.find('form:eq(0)').attr('method', 'put');
}
});
})

View File

@ -0,0 +1,18 @@
@media (max-width:767px){
.form-group{
justify-content:flex-start !important;
flex-wrap: wrap;
&>span{
padding-left: 0.7em;
&>br{
display:none;
}
}
&>.col-sm-10.controls{
width:100%;
textarea{
min-height: 8em;
}
}
}
}

View File

@ -0,0 +1,3 @@
/*
*= require lib/tags-groups
*/

View File

@ -0,0 +1,20 @@
class Admin::VenueManagementAgreementsController < OrbitAdminController
def initialize
super
@app_title = 'venue_management'
end
def index
@venue_management_agreement = VenueManagementAgreement.first || VenueManagementAgreement.create
@url = admin_venue_management_agreement_path(@venue_management_agreement)
end
def update
@venue_management_agreement = VenueManagementAgreement.first
@venue_management_agreement.update_attributes(params.require(:venue_management_agreement).permit!)
redirect_to admin_venue_management_agreements_path, notice: t('venue_management.save_success')
end
end

View File

@ -0,0 +1,70 @@
# encoding: utf-8
class Admin::VenueManagementItemContentsController < OrbitAdminController
before_action ->(module_app = @app_title) { set_variables module_app }
def initialize
super
@app_title = "venue_management"
end
def index
@venue_management_item_contents = VenueManagementItemContent.where(:venue_management_main_id => params[:venue_management_main_id]).page(params[:page]).per(10)
@venue_management = VenueManagementMain.find(params[:venue_management_main_id])
@venue_management_items = VenueManagementItem.where(:_id.nin=> VenueManagementItemContent.where(:venue_management_main_id => params[:venue_management_main_id]).collect{|t| t.venue_management_item_id} ).collect{|a| [a.title,a.id]}
end
def new
@contents = VenueManagementItemContent.where(:venue_management_main_id => params[:venue_management_main_id]).collect{|t| t.venue_management_item_id}
@venue_management_item_content = VenueManagementItemContent.new
@venue_management_items = VenueManagementItem.where(:_id.nin=> @contents).collect{|a| [a.title,a.id]}
end
def create
venue_management_item_content = VenueManagementItemContent.new(venue_management_item_content_params)
venue_management_item_content.create_user_id = current_user.id
venue_management_item_content.update_user_id = current_user.id
venue_management_item_content.save
redirect_to params['referer_url']+"?venue_management_main_id="+venue_management_item_content.venue_management_main_id
end
def edit
@venue_management_item_content = VenueManagementItemContent.find(params[:id])
@venue_management = VenueManagementMain.find(@venue_management_item_content.venue_management_main_id)
end
def update
@venue_management_item_content = VenueManagementItemContent.find(params[:id])
@venue_management_item_content.update_attributes(venue_management_item_content_params)
redirect_to "/admin/venue_management_item_contents?venue_management_main_id="+@venue_management_item_content.venue_management_main_id
end
def destroy
@venue_management_item_content = VenueManagementItemContent.find(params[:id])
@venue_management_item_content.destroy
redirect_to "/admin/venue_management_item_contents?venue_management_main_id="+@venue_management_item_content.venue_management_main_id
end
private
def venue_management_item_content_params
params.require(:venue_management_item_content).permit!
end
end

View File

@ -0,0 +1,52 @@
class Admin::VenueManagementItemsController < OrbitAdminController
def initialize
super
@app_title = 'venue_management'
end
def index
@venue_management_items = VenueManagementItem.all
@url = admin_venue_management_item_path(@venue_management_items)
end
def create
@venue_management_item = VenueManagementItem.new(venue_management_item_params)
@venue_management_item.save
redirect_to request.referer, :status => 303
end
def create_in_form
@venue_management_item = VenueManagementItem.new(venue_management_item_params)
@venue_management_item.savevenue_management_item
render :json => {:id=>@venue_management_item.id.to_s, :title=>@venue_management_item.title}.to_json ,:layout => false
end
def update
@venue_management_item = VenueManagementItem.find(params[:id])
@venue_management_item.update_attributes(venue_management_item_params)
redirect_to request.referer, :status => 303
end
def toggle
@venue_management_item = VenueManagementItem.find(params[:id])
@venue_management_item.save!
redirect_to request.referer, :status => 303
end
def delete_items
items = VenueManagementItem.find(params[:ids].split(',')) rescue nil
if items
items.each(&:destroy)
end
redirect_to request.referer, :status => 303
end
private
def venue_management_item_params
params.require(:venue_management_item).permit!
end
end

View File

@ -0,0 +1,53 @@
# encoding: utf-8
class Admin::VenueManagementSignupsController < OrbitAdminController
include Admin::VenueManagementsHelper
before_action ->(module_app = @app_title) { set_variables module_app }
def initialize
super
@app_title = "venue_management"
end
def edit
OrbitHelper.set_params(params,current_user)
params[:controller] = "admin/venue_managements"
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management = VenueManagementMain.find(@venue_management_signup.venue_management_main_id)
@form_index = 0
end
def update
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management_signup.update_attributes(venue_management_signup_params)
if !params[:venue_management_signup_values].nil?
params[:venue_management_signup_values].each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = VenueManagementSignupValue.put_field_values(@venue_management_signup, r.last, r.last[:id], field_value)
end
end
redirect_to "/admin/venue_managements/#{@venue_management_signup.venue_management_main_id}/venue_management_signup"
end
def destroy
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management_main_id = @venue_management_signup.venue_management_main_id
@venue_management_signup.destroy
redirect_to "/admin/venue_managements/#{@venue_management_main_id}/venue_management_signup"
end
private
def venue_management_signup_params
params.require(:venue_management_signup).permit!
end
end

View File

@ -0,0 +1,346 @@
# encoding: utf-8
class Admin::VenueManagementsController < OrbitAdminController
require 'axlsx'
helper Admin::VenueManagementsFieldHelper
before_action ->(module_app = @app_title) { set_variables module_app }
before_action :set_venue_management, only: [:edit, :set_write_off, :venue_management_signup, :destroy]
def initialize
super
@app_title = "venue_management"
end
def filter_fields(categories)
{
:category=>categories.map{|c| {:title=>(c.title.blank? ? " " : c.title), :id=>c.id}}
}
end
def index
@categories = @module_app.categories.enabled
@filter_fields = filter_fields(@categories)
@table_fields = [:category, 'venue_management.title', 'venue_management.event_during', 'venue_management.signup_during', 'venue_management.signup_count', 'venue_management.inviting_hostory', 'venue_management.memorabilia','venue_management.export']
if !params[:sort].blank?
if params[:sort] == 'event_during'
sort = {:venue_management_start_date.to_sym=>params[:order]}
elsif params[:sort] == 'signup_during'
sort = {:signup_start_date.to_sym=>params[:order]}
else
sort = {params[:sort].to_sym=>params[:order]}
end
else
sort = {:signup_start_date=>"desc"}
end
@venue_managements = VenueManagementMain.all.order_by(sort).with_categories(filters("category"))
@venue_managements = search_data(@venue_managements,[:title]).page(params[:page]).per(10)
if request.xhr?
render :partial => "index"
end
end
def export
@venue_management = VenueManagementMain.find(params[:id])
@venue_management_signups = VenueManagementSignup.where(:venue_management_main_id => params[:id])
filename = @venue_management.title.parameterize.underscore + "_export.xlsx"
respond_to do |format|
format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"'
}
end
end
def new
@member = nil
@managers = nil
@contractors = nil
@coordinators = nil
@venue_management = VenueManagementMain.new
create_set (false)
@signup_sets = @venue_management.venue_management_signup_field_sets
@submission_set = @venue_management.venue_management_submission_field_sets
@custom_set = @venue_management.venue_management_signup_field_customs
@venue_management_items = VenueManagementItem.all
@review = @venue_management.venue_management_reviews.new()
end
def create
if !venue_management_params['venue_management_links_attributes'].nil?
venue_management_params['venue_management_links_attributes'].each do |idx,link|
venue_management_params['venue_management_links_attributes'].delete(idx.to_s) if link['url'].blank?
end
end
venue_management_main_params = venue_management_params
venue_management_signup_set_params = venue_management_main_params['venue_management_signup_field_sets']
venue_management_submission_set_params = venue_management_main_params['venue_management_submission_field_sets']
venue_management_email_sets_params = venue_management_main_params['venue_management_email_sets']
venue_management_main_params.delete(:venue_management_signup_field_sets)
venue_management_main_params.delete(:venue_management_submission_field_sets)
venue_management_main_params.delete(:venue_management_email_sets)
venue_management = VenueManagementMain.new(venue_management_main_params)
venue_management.create_user_id = current_user.id
venue_management.update_user_id = current_user.id
venue_management.save
#venue_management_signup_set_params.each do |key,value|
# venue_management.venue_management_signup_field_sets.create(value)
#end
#venue_management_submission_set_params.each do |key,value|
# venue_management.venue_management_submission_field_sets.create(value)
#end
venue_management_email_sets_params.each do |key,value|
venue_management.venue_management_email_sets.create(value)
end
redirect_to params['referer_url']
end
def edit
@venue_management_items = VenueManagementItem.all
@venue_management = VenueManagementMain.where(id: params[:id]).first
@venue_management.venue_management_signup_field_sets.each do |signup_field_set|
if !(VenueManagementSignup.attribute_names.include? signup_field_set.field_name) && signup_field_set.field_name != 'recaptcha'
signup_field_set.delete
end
end
@venue_management.venue_management_submission_field_sets.each do |submission_field_set|
if !(VenueManagementSignupContribute.attribute_names.include? submission_field_set.field_name)
submission_field_set.delete
end
end
@venue_management.venue_management_signup_field_customs.each do |custom_set|
if !(@venue_management.venue_management_signup_fields.collect(&:id).include? custom_set.venue_management_signup_field_id)
custom_set.delete
end
end
create_set (true)
@signup_sets = @venue_management.venue_management_signup_field_sets
@submission_set = @venue_management.venue_management_submission_field_sets
@custom_set = @venue_management.venue_management_signup_field_customs
if @venue_management.venue_management_reviews.first.nil?
@review = @venue_management.venue_management_reviews.new()
else
@review = @venue_management.venue_management_reviews.first
end
@member = MemberProfile.find(@review.reviewer_id) rescue nil
@managers = MemberProfile.find(@venue_management.manager_ids) rescue nil
@contractors = MemberProfile.find(@venue_management.contractor_ids) rescue nil
@coordinators = MemberProfile.find(@venue_management.coordinator_ids) rescue nil
end
def update
params[:venue_management_main][:registration_status] = (params[:venue_management_main][:registration_status] ? params[:venue_management_main][:registration_status] : [])
uid = params[:id].split('-').last
@venue_management = VenueManagementMain.find_by(:uid=>uid)
if params[:venue_management_main][:venue_management_signup_fields]
venue_management_params[:venue_management_signup_fields].each do |a|
@field_name = 'venue_management_main'
field_status = a.last[:id].present?
@attribute_field = VenueManagementSignupField.add_venue_management_signup_field(@venue_management, a.last, a.last[:id], field_status)
@attribute = @venue_management
end
flash.now[:notice] = "Updated Fields"
@venue_management.venue_management_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_venue_managements_path
elsif params[:venue_management_main][:venue_management_submission_fields]
params[:venue_management_main][:venue_management_submission_fields].each do |a|
@field_name = 'venue_management_main'
field_status = a.last[:id].present?
@attribute_field = VenueManagementSubmissionField.add_venue_management_signup_field(@venue_management, a.last, a.last[:id], field_status)
@attribute = @venue_management
end
flash.now[:notice] = "Updated Fields"
@venue_management.venue_management_submission_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_venue_managements_path
else
if !venue_management_params['venue_management_links_attributes'].nil?
venue_management_params['venue_management_links_attributes'].each do |idx,link|
venue_management_params['venue_management_links_attributes'].delete(idx.to_s) if link['url'].blank?
end
end
@venue_management.update_user_id = current_user.id
if @venue_management.update_attributes(venue_management_params)
@venue_management.venue_management_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to params['referer_url']
else
flash.now[:error] = t('update.error.category')
render action: :edit
end
end
end
def set_write_off
@venue_management.donation_write_off_status = true
@venue_management.save
redirect_to "/admin/venue_managements?page=#{params['page']}"
end
def destroy
@venue_management.destroy
redirect_to "/admin/venue_managements"
end
def venue_management_signup_field
@field_name = 'venue_management_main'
@attribute = VenueManagementMain.find(params[:id])
@attribute_type = 'venue_management'
@class = 'venue_managements'
end
def venue_management_submission_field
@field_name = 'venue_management_main'
@attribute = VenueManagementMain.find(params[:id])
@attribute_type = 'venue_management'
@class = 'venue_managements'
end
def venue_management_signup
if !params[:search].blank?
@venue_management_signups = VenueManagementSignup.where(:venue_management_main_id => @venue_management.id, :name=>params[:search]).page(params[:page]).per(10)
else
@venue_management_signups = VenueManagementSignup.where(:venue_management_main_id => @venue_management.id).page(params[:page]).per(10)
end
end
def edit_venue_management_signup
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management = VenueManagementMain.find(@venue_management_signup.venue_management_main_id)
end
def delete_venue_management_signup
@venue_management_signup = VenueManagementSignup.find(params[:id])
@venue_management_id = @venue_management_signup.venue_management_main_id
@venue_management_signup.destroy
redirect_to "/admin/venue_managements/@venue_management_id.to_s/venue_management_signup"
end
private
def set_venue_management
@venue_management = VenueManagementMain.find(params[:id])
end
def venue_management_params
params.require(:venue_management_main).permit!
end
def create_set (save_flag)
VenueManagementSignup.attribute_names.each do |attr_signup|
if !(['_id', 'created_at', 'updated_at','venue_management_main_id'].include? attr_signup)
signup_set = @venue_management.venue_management_signup_field_sets.select{|v| v.field_name==attr_signup }
if signup_set.length==0
if ['status','name','tel','phone','email','password'].include? attr_signup
disabled = false
else
disabled = true
end
if ['status','name','tel'].include? attr_signup
hidden = false
else
hidden = true
end
name1 = Hash.new
now_locale = I18n.locale
I18n.available_locales.each do |locale|
I18n.locale = locale
name1[locale] = t("venue_management_signup.#{attr_signup}")
end
I18n.locale = now_locale
if save_flag
@venue_management.venue_management_signup_field_sets.create(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
else
@venue_management.venue_management_signup_field_sets.new(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
end
end
end
end
signup_set = @venue_management.venue_management_signup_field_sets.select{|v| v.field_name== 'recaptcha' }
if signup_set.length==0
name1 = Hash.new
now_locale = I18n.locale
I18n.available_locales.each do |locale|
I18n.locale = locale
name1[locale] = t("venue_management_signup.recaptcha")
end
I18n.locale = now_locale
if save_flag
@venue_management.venue_management_signup_field_sets.create(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true)
else
@venue_management.venue_management_signup_field_sets.new(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true)
end
end
VenueManagementSignupContribute.attribute_names.each do |attr_submission|
if !(['_id', 'created_at', 'updated_at','venue_management_signup_id'].include? attr_submission)
signup_set = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name==attr_submission }
if signup_set.length==0
name1 = Hash.new
now_locale = I18n.locale
I18n.available_locales.each do |locale|
I18n.locale = locale
name1[locale] = t("venue_management_signup.#{attr_submission}")
end
I18n.locale = now_locale
if save_flag
@venue_management.venue_management_submission_field_sets.create(field_name:attr_submission,name:name1,placeholder:name1)
else
@venue_management.venue_management_submission_field_sets.new(field_name:attr_submission,name:name1,placeholder:name1)
end
end
end
end
@venue_management.venue_management_signup_fields.all.map{|v| v}.each do |field|
set = @venue_management.venue_management_signup_field_customs.select{|v| v.venue_management_signup_field_id==field.id}
if set.length == 0
@venue_management.venue_management_signup_field_customs.create(venue_management_signup_field_id:field.id)
end
end
@email_set = []
['signup','submission','add_file','edit_file'].each do |field_name|
email_set = @venue_management.venue_management_email_sets.select{|v| v.field_name==field_name}
if email_set.length==0
title = Hash.new
content = Hash.new
now_locale = I18n.locale
I18n.available_locales.each do |locale|
I18n.locale = locale
title[locale] = t("venue_management.email_#{field_name}_success")
content[locale] = t("venue_management.email_#{field_name}_content")
end
I18n.locale = now_locale
if save_flag
email_set = @venue_management.venue_management_email_sets.create(field_name:field_name,title:title,content:content)
else
email_set = @venue_management.venue_management_email_sets.new(field_name:field_name,title:title,content:content)
end
else
email_set = email_set[0]
end
@email_set << email_set
end
end
end

View File

@ -0,0 +1,401 @@
class VenueManagementsController < ApplicationController
helper MemberHelper
include ActionView::Context #vary important (only add this can access @@session from view)
include Admin::VenueManagementsHelper
# include SimpleCaptcha::ControllerHelpers
def index
time_now = Time.now
venue_managements = VenueManagementMain.all.desc(:venue_management_start_date).filter_by_categories
{
"venue_managements" => venue_managements,
'time_now' => time_now,
"total_pages" => venue_managements.total_pages
}
end
def show_privacy
params = OrbitHelper.params
venue_management = VenueManagementMain.where(uid: params[:uid]).first
venue_management_agreement = VenueManagementAgreement.first
{
'venue_management' => venue_management,
"venue_management_agreement" => venue_management_agreement
}
end
def show_data
time_now = Time.now
params = OrbitHelper.params
venue_management = VenueManagementMain.find_by(uid: params[:uid])
if !venue_management.registration_status.blank? && venue_management.signup_start_date <= time_now && ( venue_management.signup_end_date.nil? || venue_management.signup_end_date+1 >= time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '" target="_blank">' + t('venue_management.signup') + '</a>').html_safe
elsif venue_management.registration_status.blank?
sign_up = t('venue_management.sign_up_not_open')
elsif venue_management.signup_start_date > time_now
sign_up = t('venue_management.sign_up_not_yet')
else
sign_up = t('venue_management.sign_up_overdue')
end
if !venue_management.registration_status.blank? && venue_management.registration_status.include?('C') && venue_management.contribute_start_date <= time_now && ( venue_management.contribute_end_date.nil? || venue_management.contribute_end_date+1 >= time_now )
if !@@session[:venue_management_signup_id].blank?
if @@session[:venue_management_main_id] == venue_management.id
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_upload">' + t('venue_management_signup.uploads') + '</a>').html_safe
else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_login">' + t('venue_management_signup.con_login') + '</a>').html_safe
end
else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_login">' + t('venue_management_signup.con_login') + '</a>').html_safe
end
end
{
'venue_management' => venue_management,
'sign_up' => sign_up,
'contribute_action' => contribute_action,
'time_now' => time_now,
'contribute_time_range' => VenueManagementMain.time_range(venue_management.contribute_start_date, venue_management.contribute_end_date),
'sign_up_time_range' => VenueManagementMain.time_range(venue_management.signup_start_date, venue_management.signup_end_date),
'venue_management_time_range' => VenueManagementMain.time_range(venue_management.venue_management_start_date, venue_management.venue_management_end_date)
}
end
def show
params = OrbitHelper.params
module_app = ModuleApp.where(:key => "venue_management").first
categories = module_app.categories
venue_management = VenueManagementMain.where(uid: params[:uid]).first
venue_management_signup = VenueManagementSignup.new
time_now = Time.now
{
"venue_management" => venue_management,
"venue_management_signup" => venue_management_signup,
"time_now" => time_now
}
end
def check_email
params = OrbitHelper.params
if !params[:email].blank?
count = VenueManagementSignup.where(:email => params[:email], :venue_management_main_id => params[:no]).count
result = count > 0 ? t('venue_management.already_used') : t('venue_management.available')
else
result = t('venue_management.please_enter_email')
end
{
"result" => result
}
end
def check_availability
params = OrbitHelper.params
response = {}
case params[:type]
when "venue_management_signup_email"
response["success"] = VenueManagementSignup.where(:email => params[:value], :venue_management_main_id => params[:no]).count > 0 ? false : true
end
render :json => response.to_json
end
def create
@signup = VenueManagementSignup.where(email: params[:venue_management_signup][:email], venue_management_main_id: params[:venue_management_signup][:venue_management_main_id] ).first
@venue_management_signup = VenueManagementSignup.new(venue_management_signup_params)
@venue_management = VenueManagementMain.where(id:params[:venue_management_signup][:venue_management_main_id]).first
if @venue_management.venue_management_signup_field_sets.count!=0
flag = @venue_management.venue_management_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled
else
flag = false
end
if gotcha_valid? || flag
if @signup.blank? && @venue_management_signup.save
# if gotcha_valid? && @venue_management_signup.save
if !params[:venue_management_signup_values].nil?
venue_management_signup_values_params.each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = VenueManagementSignupValue.put_field_values(@venue_management_signup, r.last, r.last[:venue_management_signup_field_id], field_value)
end
end
if params['venue_management_signup']['status']=='C'
status_param = '&status='
send_mail('submission',params[:venue_management_signup][:email],params[:venue_management_signup][:venue_management_main_id])
else
status_param = ''
send_mail('signup',params[:venue_management_signup][:email],params[:venue_management_signup][:venue_management_main_id])
end
redirect_to "#{params[:referer_url]}/?method=signup_ok#{status_param}"
else
if !@signup.blank?
redirect_to "#{params[:referer_url]}", :notice => 'mail已存在'
else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end
end
else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end
end
def signup_ok
end
def add_file_proc
update_params = venue_management_signup_contribute_params.merge('venue_management_submission_values'=>params['venue_management_submission_values'])
flag = true
update_params.permit!
if !update_params['venue_management_submission_values'].nil?
if update_params['venue_management_submission_values']['0']['value'].class==String
value = update_params['venue_management_submission_values']['0']['value']
if !value.to_s.blank?
flag = false
end
else
update_params['venue_management_submission_values']['0']['value'].each do |key,value|
if !value.to_s.blank?
flag = false
end
end
end
else
flag = false
end
if flag
update_params['venue_management_submission_values']['0']['value']['en'] = ' '
end
@con = VenueManagementSignupContribute.new(update_params)
if @con.save
signup = VenueManagementSignup.where(id:update_params['venue_management_signup_id']).first
venue_management_id = signup.venue_management_main_id
@venue_management = VenueManagementMain.where(id:venue_management_id).first
send_mail('add_file',signup.email,venue_management_id)
redirect_to "#{params[:referer_url]}/?method=con_upload"
else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end
end
def update
@con = VenueManagementSignupContribute.find(params[:venue_management_signup_contribute][:id])
update_params = venue_management_signup_contribute_params.merge('venue_management_submission_values'=>params['venue_management_submission_values'])
flag = true
update_params.permit!
if update_params['venue_management_submission_values']['0']['value'].class==String
value = update_params['venue_management_submission_values']['0']['value']
if !value.to_s.blank?
flag = false
end
else
update_params['venue_management_submission_values']['0']['value'].each do |key,value|
if !value.to_s.blank?
flag = false
end
end
end
if flag
update_params['venue_management_submission_values']['0']['value']['en'] = ' '
end
@con.update_attributes(update_params)
if @con.save
signup = VenueManagementSignup.where(id:update_params['venue_management_signup_id']).first
venue_management_id = signup.venue_management_main_id
@venue_management = VenueManagementMain.where(id:venue_management_id).first
send_mail('edit_file',signup.email,venue_management_id)
redirect_to "#{params[:referer_url]}/?method=con_upload"
else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end
end
def del_file
con = VenueManagementSignupContribute.find(params[:con_no])
# venue_management_signup = VenueManagementSignup.find_by(_id: con.venue_management_signup_id )
# venue_management = VenueManagementMain.find_by(_id: venue_management_signup.venue_management_main_id )
con.destroy
redirect_to "#{params[:referer_url]}/?method=con_upload"
end
def add_file
if !@@session[:venue_management_main_id].blank?
venue_management = VenueManagementMain.find_by(id: @@session[:venue_management_main_id])
venue_management_signup = VenueManagementSignup.find_by(_id: @@session[:venue_management_signup_id], venue_management_main_id: @@session[:venue_management_main_id] )
else
venue_management = {}
venue_management_signup = {}
end
con = VenueManagementSignupContribute.new
{
'con' => con,
'venue_management' => venue_management,
'venue_management_signup' => venue_management_signup
}
end
def edit_file
params = OrbitHelper.params
if !@@session[:venue_management_main_id].blank?
venue_management = VenueManagementMain.find_by(id: @@session[:venue_management_main_id])
venue_management_signup = VenueManagementSignup.find_by(_id: @@session[:venue_management_signup_id], venue_management_main_id: @@session[:venue_management_main_id] )
else
venue_management = {}
venue_management_signup = {}
end
con = VenueManagementSignupContribute.find(params[:con_no])
{
'con' => con,
'venue_management' => venue_management,
'venue_management_signup' => venue_management_signup
}
end
def con_upload
time_now = Time.now
if !@@session[:venue_management_main_id].blank?
venue_management = VenueManagementMain.find_by(id: @@session[:venue_management_main_id])
venue_management_signup = VenueManagementSignup.find_by(_id: @@session[:venue_management_signup_id], venue_management_main_id: @@session[:venue_management_main_id] )
else
venue_management = {}
venue_management_signup = {}
end
{
'time_now' => time_now,
'venue_management' => venue_management,
'venue_management_signup' => venue_management_signup
}
end
def con_logout
# redirect_to page_for_venue_management_url
end
def con_login
time_now = Time.now
params = OrbitHelper.params
venue_management = VenueManagementMain.find_by(uid: params[:uid])
{
'venue_management' => venue_management,
'time_now' => time_now
}
end
def con_login_proc
venue_management = VenueManagementMain.find_by(id: params[:venue_management_signup][:venue_management_main_id])
@venue_management_signup = VenueManagementSignup.where(:status=>'C', :email=> params[:user_name], :password => params[:password], :venue_management_main_id => params[:venue_management_signup][:venue_management_main_id]).first
if !@venue_management_signup.blank?
session[:venue_management_signup_id] = @venue_management_signup.id
session[:venue_management_main_id] = @venue_management_signup.venue_management_main_id
redirect_to "#{params[:referer_url]}/?method=con_upload"
else
redirect_to "#{params[:referer_url]}/?method=con_login", :notice => '登入失敗'
end
end
def venue_management_signup_params
params.require(:venue_management_signup).permit!
end
def venue_management_signup_contribute_params
params.require(:venue_management_signup_contribute).permit!
end
def venue_management_signup_values_params
params.require(:venue_management_signup_values).permit!
end
def send_mail(field_name,email,venue_management_id)
email_set = @venue_management.venue_management_email_sets.select{|v| v.field_name == field_name}
if email_set.length==0
mail = Email.create(mail_to:[email],
module_app_key:"venue_management",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: t("venue_management.email_#{field_name}_success"),
template_data:{'venue_management_id'=>venue_management_id,'locale'=>I18n.locale})
elsif !(email_set[0].disabled)
mail = Email.create(mail_to:[email],
module_app_key:"venue_management",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: email_set[0].title[I18n.locale],
template_data:{'venue_management_id'=>venue_management_id,'locale'=>I18n.locale})
end
begin
mail.deliver
rescue => e
puts ["email can't deliver",e]
end
end
end

View File

@ -0,0 +1,530 @@
module Admin::VenueManagementsFieldHelper
module VenueMethod
extend self
extend ActionView::Helpers::FormTagHelper
extend ActionView::Helpers::FormOptionsHelper
extend ActionView::Helpers::DateHelper
extend ActionView::Helpers::TagHelper
extend ActionView::Helpers::RenderingHelper
extend ActionView::Context
extend OrbitBasis::RenderAnywhere
extend ActionView::Helpers::UrlHelper
extend OrbitFormHelper
extend Ckeditor::Helpers::FormHelper
def block_helper(member,index,disable = false,attribute_type=nil,signup=nil, to_require=true)
unless self.disabled
@index = index
@require = to_require
@markup_options = markup_options.merge(:disabled=>disable, :required => to_require)
@member = member
@attribute_value = @member.get_value_from_field_id(id,signup)
@attribute_type = attribute_type
@new_attribute = @attribute_value.nil?
@attribute_value = @attribute_value || signup.venue_management_signup_values.build(venue_management_signup_field_id: id)
@prefiled_value = @attribute_value.value rescue nil
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_key[key] rescue {}
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][county]",add_ext["county"],:class=>"county_#{key}")
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][street_address]",add_ext["street_address"],:class=>"street_address_#{key}")
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][city]",add_ext["city"],:class=>"city_#{key}")
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][zip]",add_ext["zip"],:class=>"zip_#{key}")
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][country]",add_ext["country"],:class=>"country_#{key}")
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][indicator]",add_ext["indicator"],:class=>"indicator_#{key}")
end
end
def render_checkbox
@prefiled_value ||=[]
control_group_wrapper do
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), { :id=>"#{get_basic_field_name_org}_#{self.id}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
end.join.html_safe 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 venue_management_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.typeE[:option_list].collect do |key,value|
label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {:required=>@require})+value[I18n.locale.to_s],@markup_options.merge(:class=>"radio inline"))
end.join.html_safe
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.typeB["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|
if !@prefiled_value.nil?
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value
else
value = nil
end
key = can_muti_lang_input? ? "#{key}" : I18n.locale
place_holder= typeD["placeholder"][key] rescue ''
name1 = can_muti_lang_input? ? (get_field_name_base + "[#{key}]") : get_field_name_base
text_area_tag(name1, value,@markup_options.merge(:placeholder=>place_holder,:class=>'ckeditor input-medium form-control'))
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}" : I18n.locale
place_holder= typeA["placeholder"][key_field] rescue ''
name1 = can_muti_lang_input? ? ([get_field_name_base,add_more_blank,"[#{key_field}]"].join) : ([get_field_name_base,add_more_blank].join)
text_field_tag(name1, value,@markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control'))
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
def valid_locales
site = Site.first
[I18n.locale]+(site.valid_locales-[I18n.locale])
end
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|
if !@prefiled_value.nil?
value = @prefiled_value[key] rescue nil
else
value = nil
end
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
div_class_ary = ["tab-pane" ,"fade"]
if @show_set_field && @markup=='text_area'
div_id = "ckeditor_#{get_pairing_tab_class({})}_#{key}"
puts 'ckeditor_'
else
div_id = "#{get_pairing_tab_class({})}_#{key}"
end
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 ? " 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}"
if @show_set_field && @markup=='text_area'
link_entry_ary = ["#ckeditor_#{get_pairing_tab_class({})}","_#{key}"]
else
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
end
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
link_entry = link_entry_ary.join
link_to(I18n.t(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale ? "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 ? " 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(I18n.t(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale ? "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
end
end
def controls_wrapper(*add_more_params,&block)
result = Array.new
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
if self.markup == "address"
result
else
result[0]
end
end # of def controls_wrapper(&block)
def control_group_wrapper(&block)
div_class = can_muti_lang_input? ? "col-sm-10 controls" : "col-sm-10 controls"
# 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 = content_tag(:div, multipleInputs + add_more_unt, :class=>'add-input')
result = form_label + content_tag(:div,temp,:class=>div_class)
# result = label + multipleInputs + add_more_unt
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
else
result = form_label + content_tag(:div,controls_wrapper(&block),:class=>div_class)
end
when "address"
# address = content_tag :div,:class=>"multipleInput editMore" do
address = content_tag :div,:class=>"col-sm-10" do
form_label + content_tag(:div, controls_wrapper(&block), :class=>'add-input')
end # of div multipleInput editMore
result = address
else
result = form_label + content_tag(:div,controls_wrapper(&block),:class=>div_class)
end
result = 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+"[#{get_basic_field_name}_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_org
"venue_management_signup_values"
end
def get_basic_field_name
"venue_management_signup_field"
end
def get_basic_field_name_base
"#{get_basic_field_name_org}[#{@index}]"
end
def get_field_name_base
get_basic_field_name_base + "[value]"
end
def form_label
if self.markup == "text_area"
plc = typeD["placeholder"][I18n.locale].to_s.blank? ? '' : "(#{typeD["placeholder"][I18n.locale]})"
"<span style='margin-right: 0.5em;'>"+
label_tag(key,(!@require.blank? ? '*'+title : title),:class=>"col-sm-2 control-label muted",:style =>'display: contents;')+
tag(:br)+"#{plc}</span>"
else
label_tag(key,(!@require.blank? ? '*'+title : title),:class=>"col-sm-2 control-label muted")
end
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
def show_set_field(field_sets,key_field,key_index,field,markup='text_field')
@show_set_field = true
def self.can_muti_lang_input?
true
end
def self.can_add_more
false
end
@markup = markup
def self.markup
@markup
end
def self.add_more
false
end
@new_attribute = false
@key_index = key_index
def self.key
@key_index
end
def self.form_label
''
end
def self.end_block
hidden_field_tag("venue_management_main[#{@key_field}][#{@key_index}]"+"[id]",
@attribute_value.id,:for=>"field_#{@key_index}")
end
@key_field = key_field
@field = field
def self.get_basic_field_name_base
"venue_management_main[#{@key_field}][#{@key_index}][#{@field}]"
end
def self.get_field_name_base
"venue_management_main[#{@key_field}][#{@key_index}][#{@field}]"
end
@attribute_value = field_sets
@prefiled_value = field_sets[field]
a = control_group_wrapper do |key,value|
add_more_blank = ""
if markup=='text_field'
if key_field == 'venue_management_email_sets'
inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value,:class=>'input-medium form-control')
else
inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value)
end
else
inside = cktext_area("venue_management_main[#{@key_field}][#{@key_index}][#{@field}]","#{key}",value:value)
end
inside
end
@key_field = nil
@key_index = nil
@field = nil
@show_set_field = nil
return a.html_safe
end
end
end

View File

@ -0,0 +1,33 @@
module Admin::VenueManagementsHelper
def page_for_venue_management(venue_management)
ann_page = nil
pages = Page.where(:module=>'venue_management')
pages.each do |page|
if page.categories.count ==1
if page.categories.include?(venue_management.category.id.to_s)
ann_page = page
end
end
break if !ann_page.nil?
end
if ann_page.nil?
pages.each do |page|
if page.categories.include?(venue_management.category.id.to_s)
ann_page = page
end
break if !ann_page.nil?
end
end
ann_page = pages.first if ann_page.nil?
request.protocol+(request.host_with_port+ann_page.url+'/'+venue_management.to_param).gsub('//','/') rescue "/"
end
def page_for_venue_management_url
page = Page.where(:module => 'venue_management').first
return request.protocol+(request.host_with_port+"/#{I18n.locale}#{page.url}").gsub('//','/') rescue "/"
# return "/#{I18n.locale}#{page.url}/#{venue_management.to_param}"
end
end

View File

@ -0,0 +1,109 @@
module Admin::VenueManagementsValuesHelper
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.member_profile_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.venue_management_signup_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.venue_management_signup_field["typeC"]["calendar"] == "west_calendar"
show_west_calender(from_to)
when self.venue_management_signup_field["typeC"]["calendar"] == "tw_calendar"
show_minguo_calendar(from_to)
end #case self.venue_management_signup_field["typeC"]["calendar"]
when :en
show_west_calender(from_to)
end
end
end

View File

@ -0,0 +1,7 @@
class VenueManagementAgreement
include Mongoid::Document
include Mongoid::Timestamps
field :content, localize: true
end

View File

@ -0,0 +1,10 @@
class VenueManagementEmailSet
include Mongoid::Document
include Mongoid::Timestamps
field :field_name, type: String
field :title
field :content
field :disabled, type: Boolean, default: false
belongs_to :venue_management_main
end

View File

@ -0,0 +1,14 @@
# encoding: utf-8
class VenueManagementFile
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, AssetUploader
field :description, localize: true
field :title, localize: true
belongs_to :venue_management_main
end

View File

@ -0,0 +1,12 @@
class VenueManagementItem
include Mongoid::Document
include Mongoid::Timestamps
field :title, localize: true
belongs_to :venue_management_main
has_many :venue_management_item_contents, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :venue_management_item_contents, :allow_destroy => true
end

View File

@ -0,0 +1,15 @@
# encoding: utf-8
class VenueManagementItemContent
include Mongoid::Document
include Mongoid::Timestamps
field :content, localize: true
field :create_user_id
field :update_user_id
belongs_to :venue_management_item
belongs_to :venue_management_main
end

View File

@ -0,0 +1,25 @@
# encoding: utf-8
require 'uri'
class VenueManagementLink
include Mongoid::Document
include Mongoid::Timestamps
field :url
field :title, localize: true
belongs_to :venue_management_main
before_validation :add_http
validates :url, :presence => true, :format => /\A(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?\Z/i
protected
def add_http
unless self.url[/^http:\/\//] || self.url[/^https:\/\//]
self.url = 'http://' + self.url
end
end
end

View File

@ -0,0 +1,92 @@
class VenueManagementMain
include Mongoid::Document
include Mongoid::Timestamps
include OrbitModel::Impression
# encoding: utf-8
include OrbitCategory::Categorizable
include Slug
field :title, as: :slug_title, type: String, localize: true
field :speaker, localize: true
field :content, localize: true
field :land_number, localize: true
field :area, localize: true
field :land_zoning, localize: true
field :act_place, localize: true
field :manager_ids, type: Array,default: []
field :contractor_ids, type: Array,default: []
field :coordinator_ids, type: Array,default: []
field :venue_management_start_date, :type => Date, :default => Time.now
field :venue_management_end_date, :type => Date, :default => Time.now
field :signup_start_date, :type => Date, :default => Time.now
field :signup_end_date, :type => Date, :default => Time.now
field :contribute_start_date, :type => Date
field :contribute_end_date, :type => Date
field :contribute_file_count, type: String
field :registration_status , :type => Array #C: 投稿者 G:一般
field :create_user_id
field :update_user_id
belongs_to :venue_management_item
has_many :venue_management_links, :autosave => true, :dependent => :destroy
has_many :venue_management_files, :autosave => true, :dependent => :destroy
has_many :venue_management_item_contents, :autosave => true, :dependent => :destroy
has_many :venue_management_signups, :autosave => true, :dependent => :destroy
has_many :venue_management_submission_fields, :autosave => true, :dependent => :destroy
has_many :venue_management_signup_fields, :autosave => true, :dependent => :destroy
has_many :venue_management_reviews, :autosave => true, :dependent => :destroy
has_many :venue_management_signup_field_sets, autosave: true, dependent: :destroy
has_many :venue_management_submission_field_sets, autosave: true, dependent: :destroy
has_many :venue_management_email_sets, autosave: true, dependent: :destroy
has_many :venue_management_signup_field_customs, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :venue_management_links, :allow_destroy => true
accepts_nested_attributes_for :venue_management_files, :allow_destroy => true
accepts_nested_attributes_for :venue_management_item_contents, :allow_destroy => true
accepts_nested_attributes_for :venue_management_signups, :allow_destroy => true
accepts_nested_attributes_for :venue_management_submission_fields, :allow_destroy => true
accepts_nested_attributes_for :venue_management_signup_fields, :allow_destroy => true
accepts_nested_attributes_for :venue_management_reviews, :allow_destroy => true
accepts_nested_attributes_for :venue_management_signup_field_sets, :allow_destroy => true
accepts_nested_attributes_for :venue_management_submission_field_sets, :allow_destroy => true
accepts_nested_attributes_for :venue_management_email_sets, :allow_destroy => true
accepts_nested_attributes_for :venue_management_signup_field_customs, :allow_destroy => true
def self.time_range(date1 = null, date2 = null)
if !date1.blank?
r = "#{date1.strftime('%Y-%m-%d')}"
if date2
r += " - #{date2.strftime('%Y-%m-%d')}"
else
r += " - #{I18n.t(:no_deadline)}"
end
r
end
end
def get_attribute_value(attribute_field, signup_id)
VenueManagementSignupValue.find_by(venue_management_signup_field_id: attribute_field.id, venue_management_signup_id: signup_id)
end
def get_attribute_values(attribute_type=nil)
@attribute_values = attribute_type.venue_management_signup_values rescue nil
end
def get_value_from_field_id(field_id,attribute_type=nil)
values = get_attribute_values(attribute_type)
value = values.detect {|value| value.venue_management_signup_field_id == field_id} rescue nil
value ? value : nil
end
end

View File

@ -0,0 +1,12 @@
# encoding: utf-8
require "orbit_form_helper"
class VenueManagementReview
include Mongoid::Document
include Mongoid::Timestamps
field :review_start_date, :type => Date, :default => Time.now
field :review_end_date, :type => Date, :default => Time.now
field :reviewer_id
belongs_to :venue_management_main
end

View File

@ -0,0 +1,27 @@
# encoding: utf-8
class VenueManagementSignup
include Mongoid::Document
include Mongoid::Timestamps
field :status
field :name # become Last Name for TICC
field :tel, type: String # become First Name for TICC
field :unit, localize: true
field :phone, type: String
field :fax, type: String
field :email, type: String
field :address, localize: true
field :password
field :note, localize: true
belongs_to :venue_management_main
has_many :venue_management_signup_values
has_many :venue_management_signup_contributes
accepts_nested_attributes_for :venue_management_signup_values, allow_destroy: true
accepts_nested_attributes_for :venue_management_signup_contributes, allow_destroy: true
end

View File

@ -0,0 +1,13 @@
class VenueManagementSignupContribute
include Mongoid::Document
include Mongoid::Timestamps
field :title
mount_uploader :file, AssetUploader
field :description
belongs_to :venue_management_signup
has_many :venue_management_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :venue_management_submission_values, :allow_destroy => true
end

View File

@ -0,0 +1,161 @@
class VenueManagementSignupField
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include ::AttributeFieldsHelper
include ::Admin::VenueManagementsFieldHelper::VenueMethod
field :key, type: String
field :af_count
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_require,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: {}
belongs_to :venue_management_main
has_many :venue_management_signup_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :venue_management_signup_values, :allow_destroy => true
before_save :check_option_list
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 self_defined_markup_options?
(self.venue_management.method(self[:key].pluralize.to_sym) && self.venue_management.method(self[:key].pluralize+"_for_"+markup)) rescue false
end
def option_list
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.venue_management.method(self[:key].pluralize+"_for_"+markup)
return (method.call rescue {})
elsif 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 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
def self.add_venue_management_signup_field(venue_management,venue_management_param, venue_management_signup_field_id=nil,field_status)
@field_name = 'venue_management'
if field_status.eql?(true)
@venue_management_signup_field_counter = venue_management.venue_management_signup_fields.count rescue nil
@venue_management_signup_field = self.find(venue_management_signup_field_id) rescue nil
old_key = @venue_management_signup_field.key
@venue_management_signup_field.update(venue_management_param)
@venue_management_signup_field.save
attribute_values = @venue_management_signup_field.venue_management_signup_values
if attribute_values.count > 0
attribute_values.each do |av|
av.key = venue_management_param["key"]
av.save
end
end
@venue_management_signup_field[:af_count] = @venue_management_signup_field_counter
else
@venue_management_signup_field_counter = venue_management.venue_management_signup_fields.count rescue nil
@venue_management_signup_field = venue_management.venue_management_signup_fields.build(venue_management_param) rescue nil
@venue_management_signup_field.save
@venue_management_signup_field[:af_count] = @venue_management_signup_field_counter
end
return @venue_management_signup_field
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
def cross_lang_convert(opt)
end
def check_option_list
self[:option_list] = self[panel]["option_list"] rescue nil
end
def add_more_convert(opt)
end
end

View File

@ -0,0 +1,8 @@
class VenueManagementSignupFieldCustom
include Mongoid::Document
include Mongoid::Timestamps
field :venue_management_signup_field_id
field :hidden, type: Boolean, default: true
belongs_to :venue_management_main
end

View File

@ -0,0 +1,11 @@
class VenueManagementSignupFieldSet
include Mongoid::Document
include Mongoid::Timestamps
field :field_name, type: String
field :placeholder
field :name
field :disabled, type: Boolean, default: false
field :hidden, type: Boolean, default: false
belongs_to :venue_management_main
end

View File

@ -0,0 +1,215 @@
class VenueManagementSignupValue
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include ::AttributeValuesHelper
include ::Admin::VenueManagementsValuesHelper
field :key, type: String
belongs_to :venue_management_signup_field
belongs_to :venue_management_signup
before_save :check_key
before_save :data_proc
def add_more_counter
index_max = self["val"].count rescue 0
index_max == 0 ? 1 : index_max
end
def value(index = nil)
site = Site.first
result = case self.venue_management_signup_field.markup
when 'text_field','text_area'
if self.venue_management_signup_field.add_more and (self.venue_management_signup_field.markup == "text_field")
index.nil? ? self["val"] : self["val"][index]
else
self.venue_management_signup_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[site.valid_locales.collect{|lang| [lang,self[lang.to_sym]]}]
end
when 'select','radio_button','address'
self["val"]
when 'date'
if !self["val"].blank? and !self["val"]['(1i)'].blank?
"#{self["val"]['(1i)']}/#{self["val"]['(2i)']}/#{self["val"]['(3i)']}"
else
self["val"]
end
when 'checkbox'
self["val"]
end #end of case self.venue_management_signup_field.markup
end
def value=(value)
#save everything to temp_data waiting for futher process
self[:temp_data] = value
end
def get_field_value
if (self.venue_management_signup_field.markup.eql?("text_field") || self.venue_management_signup_field.markup.eql?("text_area"))
field_value = self.value[I18n.locale]
elsif (self.venue_management_signup_field.markup.eql?("select") || self.venue_management_signup_field.markup.eql?("radio_button"))
field_value = self.venue_management_signup_field.markup_value["#{self.value}"][I18n.locale] rescue nil
elsif self.venue_management_signup_field.markup.eql?("address")
field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ')
elsif self.venue_management_signup_field.markup.eql?("date")
case self.venue_management_signup_field.typeC['format']
when 'format1'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format2'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format3'
field_value = self.value.to_date.strftime("%Y/%m")
when 'format4'
field_value = self.value.to_date.strftime("%Y")
end
elsif self.venue_management_signup_field.markup.eql?("checkbox")
field_value = self.value.map {|v| self.venue_management_signup_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil
end
field_value = (field_value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "<a href='#{field_value}' target='blank'>#{field_value}</a>" : field_value
field_value = (field_value =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ? "<a href='mailto:#{field_value}'>#{field_value}</a>" : field_value
if !field_value.blank?
{
"key" => self.venue_management_signup_field.key,
"title" => self.venue_management_signup_field.title,
"value" => field_value,
"val" => field_value = self.value
}
else
{
"key" => self.venue_management_signup_field.key,
"title" => self.venue_management_signup_field.title,
"value" => "",
"val" => field_value = self.value
}
end
end
def get_value_by_locale(locale,add_more_index=nil)
case self.venue_management_signup_field.markup
when "text_field"
case self.venue_management_signup_field.add_more
when true
if self.venue_management_signup_field.locale
add_more_index.nil? ? self.value.collect{|t| t[locale.to_s]}.join(",") : self.value(add_more_index)[locale]
else
add_more_index.nil? ? self.value.join(",") : self.value(add_more_index)
end
when false
self.venue_management_signup_field.locale ? self[locale.to_s] : self.value
end
when "select"
markup_values = self.venue_management_signup_field.self_defined_markup_options? ? self.venue_management_signup_field.markup_value : self.venue_management_signup_field.markup_value
markup_values[self.value][locale.to_s] rescue 'NoData'
when "text_area"
self.venue_management_signup_field.locale ? self[locale.to_s] : self.value
when "date"
if self.venue_management_signup_field.date_is_range?
get_date_by_format(:from) + ' ~ ' + get_date_by_format(:to)
# self.value["from"] + ' ~ ' + self.value["to"]
else
get_date_by_format
# self.value
end
when "address"
self.value[locale.to_s]
when "radio_button"
markup_values = self.venue_management_signup_field.markup_value
markup_values[self.value][locale.to_s]
when "checkbox"
markup_values = self.venue_management_signup_field.markup_value
self.value.collect{|key| markup_values["#{key}"][I18n.locale]}.join(",")
when "date_durnation"
self.value
else
self.venue_management_signup_field.locale ? self[locale.to_s] : self.value
end
end
def get_date(item = nil)
case item
when :from
# data = self[:val]["from"]
data = self.value["from"]
when :to
# data = self[:val]["to"]
data = self.value["to"]
when nil
# data = self[:val]
data = self.value
end
# Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil
end
def self.put_field_values(member, field_value_param, field_value_id=nil,field_value_status)
if field_value_status.eql?(true)
@venue_management_signup_field_value = member.venue_management_signup_values.find(field_value_id) rescue nil
if @venue_management_signup_field_value!=nil
@venue_management_signup_field_value.update(field_value_param) rescue nil
@venue_management_signup_field_value.save rescue nil
end
else
@venue_management_signup_field_value = member.venue_management_signup_values.build(field_value_param) rescue nil
@venue_management_signup_field_value.save
end
return @venue_management_signup_field_value
end
protected
def unset_all_lang_values
VALID_LOCALES.each{|t| self.unset t}
end
def data_proc
unless self[:temp_data].nil?
case self.venue_management_signup_field.markup
when "address"
self["val"] = self["temp_data"]
when 'text_field','text_area'
if self.venue_management_signup_field.add_more
self["val"] = self["temp_data"]
else # if not add_more
if self.venue_management_signup_field.can_muti_lang_input?
self[:temp_data].each do |key,val|
self[key] = val
end if(!self.venue_management_signup_field.get_data[:cross_lang])
else
self["val"] = self[:temp_data]
end
end # of self.venue_management_signup_field.add_more
when 'select','date','radio_button'
self["val"] = self[:temp_data]
when 'checkbox'
self["val"] = self[:temp_data].keys
end #end of case self.venue_management_signup_field.markup
end # of self[:temp_data].nil?
self.unset('temp_data')
self.unset('temp')
end #of data_proc
def check_key
self.key = self.venue_management_signup_field.key
end
def method_missing(*field)
if field.size < 1
self[field[0]]
else
self[(field[0].to_s.delete "=")] = field[1]
end
end
end

View File

@ -0,0 +1,186 @@
class VenueManagementSubmissionField
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include ::AttributeFieldsHelper
include ::Admin::VenueManagementsFieldHelper::VenueMethod
field :key, type: String
field :af_count
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_require,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: {}
belongs_to :venue_management_main
has_many :venue_management_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :venue_management_submission_values, :allow_destroy => true
before_save :check_option_list
def get_basic_field_name_org
"venue_management_submission_values"
end
def get_basic_field_name
"venue_management_submission_field"
end
def block_helper(member,index,disable = false,attribute_type=nil,con_field=nil, to_require=true,rf)
unless self.disabled
@index = index
@require = to_require
@markup_options = markup_options.merge(:disabled=>disable, :required => to_require)
@member = member
if !(con_field.venue_management_submission_values.nil?) && con_field.venue_management_submission_values!=[]
@attribute_value = con_field.venue_management_submission_values.select{|v| v.venue_management_submission_field_id.to_s==rf.id.to_s}[0]
else
@attribute_value = nil
end
@attribute_type = attribute_type
@new_attribute = @attribute_value.nil?
@prefiled_value = @attribute_value.value rescue nil
html = (instance_eval("render_#{markup}") rescue "")
return html
end
end
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 self_defined_markup_options?
(self.venue_management.method(self[:key].pluralize.to_sym) && self.venue_management.method(self[:key].pluralize+"_for_"+markup)) rescue false
end
def option_list
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.venue_management.method(self[:key].pluralize+"_for_"+markup)
return (method.call rescue {})
elsif 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 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
def self.add_venue_management_signup_field(venue_management,venue_management_param, venue_management_submission_field_id=nil,field_status)
@field_name = 'venue_management'
if field_status.eql?(true)
@venue_management_submission_field_counter = venue_management.venue_management_submission_fields.count rescue nil
@venue_management_submission_field = self.find(venue_management_submission_field_id) rescue nil
old_key = @venue_management_submission_field.key
@venue_management_submission_field.update(venue_management_param)
@venue_management_submission_field.save
attribute_values = @venue_management_submission_field.venue_management_submission_values
if attribute_values.count > 0
attribute_values.each do |av|
av.key = venue_management_param["key"]
av.save
end
end
@venue_management_submission_field[:af_count] = @venue_management_submission_field_counter
else
@venue_management_submission_field_counter = venue_management.venue_management_submission_fields.count rescue nil
@venue_management_submission_field = venue_management.venue_management_submission_fields.build(venue_management_param) rescue nil
@venue_management_submission_field.save
@venue_management_submission_field[:af_count] = @venue_management_submission_field_counter
end
return @venue_management_submission_field
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
def cross_lang_convert(opt)
end
def check_option_list
self[:option_list] = self[panel]["option_list"] rescue nil
end
def add_more_convert(opt)
end
end

View File

@ -0,0 +1,11 @@
class VenueManagementSubmissionFieldSet
include Mongoid::Document
include Mongoid::Timestamps
field :field_name, type: String
field :placeholder
field :name
field :disabled, type: Boolean, default: false
field :hidden, type: Boolean, default: false
belongs_to :venue_management_main
end

View File

@ -0,0 +1,212 @@
class VenueManagementSubmissionValue
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include ::AttributeValuesHelper
include ::Admin::VenueManagementsValuesHelper
field :key, type: String
belongs_to :venue_management_submission_field
belongs_to :venue_management_signup_contribute
before_save :check_key
before_save :data_proc
def add_more_counter
index_max = self["val"].count rescue 0
index_max == 0 ? 1 : index_max
end
def value(index = nil)
site = Site.first
result = case self.venue_management_submission_field.markup
when 'text_field','text_area'
if self.venue_management_submission_field.add_more and (self.venue_management_submission_field.markup == "text_field")
index.nil? ? self["val"] : self["val"][index]
else
self.venue_management_submission_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[site.valid_locales.collect{|lang| [lang,self[lang.to_sym]]}]
end
when 'select','radio_button','address'
self["val"]
when 'date'
if !self["val"].blank? and !self["val"]['(1i)'].blank?
"#{self["val"]['(1i)']}/#{self["val"]['(2i)']}/#{self["val"]['(3i)']}"
else
self["val"]
end
when 'checkbox'
self["val"]
end #end of case self.venue_management_submission_field.markup
end
def value=(value)
#save everything to temp_data waiting for futher process
self[:temp_data] = value
end
def get_field_value
if (self.venue_management_submission_field.markup.eql?("text_field") || self.venue_management_submission_field.markup.eql?("text_area"))
field_value = self.value[I18n.locale]
elsif (self.venue_management_submission_field.markup.eql?("select") || self.venue_management_submission_field.markup.eql?("radio_button"))
field_value = self.venue_management_submission_field.markup_value["#{self.value}"][I18n.locale] rescue nil
elsif self.venue_management_submission_field.markup.eql?("address")
field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ')
elsif self.venue_management_submission_field.markup.eql?("date")
case self.venue_management_submission_field.typeC['format']
when 'format1'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format2'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format3'
field_value = self.value.to_date.strftime("%Y/%m")
when 'format4'
field_value = self.value.to_date.strftime("%Y")
end
elsif self.venue_management_submission_field.markup.eql?("checkbox")
field_value = self.value.map {|v| self.venue_management_submission_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil
end
field_value = (field_value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "<a href='#{field_value}' target='blank'>#{field_value}</a>" : field_value
field_value = (field_value =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ? "<a href='mailto:#{field_value}'>#{field_value}</a>" : field_value
if !field_value.blank?
{
"key" => self.venue_management_submission_field.key,
"title" => self.venue_management_submission_field.title,
"value" => field_value,
"val" => field_value = self.value
}
else
{
"key" => self.venue_management_submission_field.key,
"title" => self.venue_management_submission_field.title,
"value" => "",
"val" => field_value = self.value
}
end
end
def get_value_by_locale(locale,add_more_index=nil)
case self.venue_management_submission_field.markup
when "text_field"
case self.venue_management_submission_field.add_more
when true
if self.venue_management_submission_field.locale
add_more_index.nil? ? self.value.collect{|t| t[locale.to_s]}.join(",") : self.value(add_more_index)[locale]
else
add_more_index.nil? ? self.value.join(",") : self.value(add_more_index)
end
when false
self.venue_management_submission_field.locale ? self[locale.to_s] : self.value
end
when "select"
markup_values = self.venue_management_submission_field.self_defined_markup_options? ? self.venue_management_submission_field.markup_value : self.venue_management_submission_field.markup_value
markup_values[self.value][locale.to_s] rescue 'NoData'
when "text_area"
self.venue_management_submission_field.locale ? self[locale.to_s] : self.value
when "date"
if self.venue_management_submission_field.date_is_range?
get_date_by_format(:from) + ' ~ ' + get_date_by_format(:to)
# self.value["from"] + ' ~ ' + self.value["to"]
else
get_date_by_format
# self.value
end
when "address"
self.value[locale.to_s]
when "radio_button"
markup_values = self.venue_management_submission_field.markup_value
markup_values[self.value][locale.to_s]
when "checkbox"
markup_values = self.venue_management_submission_field.markup_value
self.value.collect{|key| markup_values["#{key}"][I18n.locale]}.join(",")
when "date_durnation"
self.value
else
self.venue_management_submission_field.locale ? self[locale.to_s] : self.value
end
end
def get_date(item = nil)
case item
when :from
# data = self[:val]["from"]
data = self.value["from"]
when :to
# data = self[:val]["to"]
data = self.value["to"]
when nil
# data = self[:val]
data = self.value
end
# Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil
end
def self.put_field_values(member, field_value_param, field_value_id=nil,field_value_status)
if field_value_status.eql?(true)
@venue_management_submission_field_value = self.find(field_value_id) rescue nil
@venue_management_submission_field_value.update(field_value_param) rescue nil
@venue_management_submission_field_value.save rescue nil
else
@venue_management_submission_field_value = member.venue_management_submission_values.build(field_value_param) rescue nil
@venue_management_submission_field_value.save
end
return @venue_management_submission_field_value
end
protected
def unset_all_lang_values
VALID_LOCALES.each{|t| self.unset t}
end
def data_proc
unless self[:temp_data].nil?
case self.venue_management_submission_field.markup
when "address"
self["val"] = self["temp_data"]
when 'text_field','text_area'
if self.venue_management_submission_field.add_more
self["val"] = self["temp_data"]
else # if not add_more
if self.venue_management_submission_field.can_muti_lang_input?
self[:temp_data].each do |key,val|
self[key] = val
end if(!self.venue_management_submission_field.get_data[:cross_lang])
else
self["val"] = self[:temp_data]
end
end # of self.venue_management_submission_field.add_more
when 'select','date','radio_button'
self["val"] = self[:temp_data]
when 'checkbox'
self["val"] = self[:temp_data].keys
end #end of case self.venue_management_submission_field.markup
end # of self[:temp_data].nil?
self.unset('temp_data')
self.unset('temp')
end #of data_proc
def check_key
self.key = self.venue_management_submission_field.key
end
def method_missing(*field)
if field.size < 1
self[field[0]]
else
self[(field[0].to_s.delete "=")] = field[1]
end
end
end

View File

@ -0,0 +1,63 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<h2><%= t('venue_management.venue_management') %></h2>
<%= form_for @venue_management_agreement, url: @url, html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- 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>
<!-- Language -->
<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" : '' %>">
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management.venue_management_agreements_content') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_agreement.content_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_venue_managements_path, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -0,0 +1,91 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Item -->
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.set_venue_management_items') %></label>
<div class="controls">
<% if !@venue_management_item_content.venue_management_item_id.blank? %>
<%= @venue_management_item_content.venue_management_item.title %>
<% else %>
<%= select_tag "venue_management_item_content[venue_management_item_id]", options_for_select(@venue_management_items) %>
<% end %>
</div>
</div>
</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>
<!-- Language -->
<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" : '' %>">
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management_item_content.content') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management_item_content.content_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.hidden_field :venue_management_main_id, :value => (!params[:venue_management_main_id].blank? ? params[:venue_management_main_id] : @venue_management_item_content.venue_management_main_id) %>
<%= get_referer_url[:venue_managemention] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_venue_managements_path, :class=>"btn" %>
</div>

View File

@ -0,0 +1,5 @@
<%= form_for @venue_management_item_content, url: admin_venue_management_item_content_path(@venue_management_item_content), html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<%= render :partial => 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,43 @@
<span id="index_table">
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<h4><%= @venue_management.title %></h4>
<table class="table main-list">
<thead>
<tr class="sort-header">
<th class='span2'><%= t(:item)%></th>
</tr>
</thead>
<tbody>
<% @venue_management_item_contents.each do |venue_management_item_content| %>
<tr>
<td>
<%= venue_management_item_content.venue_management_item.title %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(venue_management_item_content) %>
<li><a href="/admin/venue_management_item_contents/<%=venue_management_item_content.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/venue_management_item_contents/<%=venue_management_item_content.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), new_admin_venue_management_item_content_path(:venue_management_main_id=>params[:venue_management_main_id]), :class => 'btn btn-primary' if @venue_management_items.count > 0 %>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@venue_management_item_contents), class: "pagination pagination-centered"
end
%>
</span>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>

View File

@ -0,0 +1,5 @@
<%= form_for @venue_management_item_content, url: admin_venue_management_item_contents_path, html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<%= render :partial => 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,16 @@
<div id="delete_venue_management_items" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel"><%= t('venue_management_item.del_item') %></h3>
</div>
<div class="modal-body tags">
<span class="text-warning text-center"><%= t('tag.warning.delete') %></span>
<hr>
<ul class="tags-groups checkbox-card">
</ul>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<%= link_to t(:delete_), nil, class: "delete-tags btn btn-danger", method: :post, remote: true %>
</div>
</div>

View File

@ -0,0 +1,11 @@
<%= f.fields_for :title_translations do |f| %>
<% @site_in_use_locales.each do |locale| %>
<div class="control-group">
<label class="control-label"><%= "#{t(:name)} (#{t(locale)})" %></label>
<div class="controls">
<input class="input-large" id="<%=locale%>" name="venue_management_item[title_translations][<%=locale%>]" placeholder="<%=t(:name)%>" type="text">
<span class="help-inline hide"><%= t('front_page.name_field_helper') %></span>
</div>
</div>
<% end %>
<% end %>

View File

@ -0,0 +1,27 @@
<!-- footer -->
<div class="bottomnav clearfix">
<div class="action pull-right">
<button id="selectAllTags" class="btn"><%= t(:select_all) %></button>
<button id="deselect" class="btn btn-inverse toggable hide"><%= t(:deselect_all) %></button>
<%= link_to t(:delete_), '#', id: "deleteItems", class: "btn btn-danger toggable hide", rel: '' %>
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t('venue_management_item.new_item'), id: 'new'} %>
</div>
</div>
<!-- footer:end -->
<!-- tags -->
<div class="tags">
<div id="tags-list">
<p class="tag-lead lead muted"><%= t('venue_management_item.set_item') %></p>
<% if !@venue_management_items.blank? %>
<ul class="tags-groups checkbox-card module-tags">
<%= render partial: "item", collection: @venue_management_items, locals: {in_module: true} %>
</ul>
<% end %>
</div>
</div>
<!-- tags:end -->
<!-- delete -->
<%= render 'delete_modal' %>
<!-- delete:end -->

View File

@ -0,0 +1,8 @@
<li class="filter-item default">
<p class="card pull-left">
<input type="checkbox" value="<%= item.id %>">
</p>
<%= link_to '#', class: "open-slide", data: {title: t('venue_management_item.edit_item'), id: item.id.to_s, form: item.title_translations} do %>
<%= item.title_translations.values.join(" / ") %>
<% end %>
</li>

View File

@ -0,0 +1,81 @@
<div id="venue_management_items_index">
<%= render 'index' %>
</div>
<!-- pageslide -->
<div id="pageslide">
<div class="page-title clearfix">
<a class="pull-right" href="javascript:$.pageslide.close()">
<i class="icons-arrow-left-2"></i>
</a>
<span></span>
</div>
<div class="view-page">
<div class="nano">
<div class="content">
<div id="add-tags">
<div class="tab-content">
<div class="set_new tab-pane fade active in">
<%= form_for :venue_management_item, url: nil, remote: true do |f| %>
<fieldset>
<%= render :partial => "form", :locals => { :f => f } %>
<div class="form-actions">
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<%= f.submit t(:submit), class: 'btn btn-primary btn-small', id: "tag_submit" %>
</div>
</fieldset>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "venue_management_sets" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "check_venue_management_set_items.js" %>
<%= javascript_include_tag "venue_management_sets.js" %>
<% end %>
<script type="text/javascript">
var validate = function(dom){
var valid = true;
if($(dom).val()==""){
valid=false;
$(dom).parent().parent().addClass('error');
$(dom).next().removeClass('hide');
}else{
$(dom).parent().parent().removeClass('error');
$(dom).next().addClass('hide');
}
return valid;
}
$(function(){
$.each($('.set_new form input:text'),function(){
$(this).blur(function(){
validate($(this));
});
$(this).keyup(function(){
validate($(this));
});
});
});
$("#tag_submit").click(function(){
var valid = true;
$.each($(".set_new form input:text"),function(){
if(!validate($(this))) valid=false;
});
if(!valid) return false;
});
</script>
<!-- pageslide:end -->

View File

@ -0,0 +1,8 @@
$("#delete_venue_management_items").modal('hide');
$("#venue_management_items_index").html("<%= j render 'index' %>")
$.pageslide.close();
openSlide();
$('.card').cardCheck({
item: $('.card input[type="checkbox"]'),
});
checkedLength();

View File

@ -0,0 +1,204 @@
<%= form_for @venue_management_signup, url: admin_venue_management_signup_path(@venue_management_signup), html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Language -->
<div class="tab-content">
<!-- Title -->
<div class="control-group">
<label for="title" class="control-label muted"><%= t('venue_management.title') %></label>
<div class="controls">
<%= @venue_management.title %>
</div>
</div>
<% if @venue_management.venue_management_signup_field_sets.count != 0 %>
<% @venue_management.venue_management_signup_field_sets.each do |signup_field| %>
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
<div class="control-group<%= (@venue_management.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="control-label muted">
<%= signup_field['name'][I18n.locale] %>
</label>
<% if signup_field.field_name == 'status' %>
<div class="controls">
<% if @venue_management.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => (@venue_management_signup.status=='G'), :onclick => "$('#registration_status').addClass('hide');" %> <%= t('venue_management.registration_status_G') %>
</label>
<% end %>
<% if @venue_management.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@venue_management_signup.status=='C') %> <%= t('venue_management.registration_status_C') %>
</label>
<% end %>
</div>
<% elsif signup_field.field_name == 'unit' %>
<div class="controls">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>">
<%= f.fields_for "unit_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-block-level", :value => (@venue_management_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#unit_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'address' %>
<div class="controls">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>">
<%= f.fields_for "address_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-block-level", :value => (@venue_management_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#address_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'email' %>
<div class="controls">
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
</div>
<% elsif signup_field.field_name == 'note' %>
<div class="controls">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
<%= f.fields_for "note_translations".to_sym do |f| %>
<%= f.text_area locale, rows: 5, :class=>"input-block-level", :value => (@venue_management_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% else %>
<div class="controls">
<%= f.text_field signup_field['field_name'], :class=>"input-block-level", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
</div>
<% end %>
</div>
<% end %>
<% end %>
<% else %>
<div class="control-group">
<label for="status" class="control-label muted"><%= t('venue_management.registration_status') %></label>
<div class="controls">
<% if @venue_management.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('venue_management.registration_status_G') %>
</label>
<% end %>
<% if @venue_management.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@venue_management.registration_status.count == 1 and @venue_management.registration_status.include?('C') ? true : false) %> <%= t('venue_management.registration_status_C') %>
</label>
<% end %>
</div>
</div>
<div>
<div class="col-sm-12"> *(required) </div>
</div>
<!-- Name to Last Name -->
<div class="control-group">
<label for="name" class="control-label muted">*<%= t('venue_management_signup.name') %></label>
<div class="controls">
<%= f.text_field :name, :class=>"input-block-level", :id=>'name', :placeholder=> t('venue_management_signup.name'), :required => true %>
</div>
</div>
<!-- Tel to First Name -->
<div class="control-group">
<label for="tel" class="control-label muted">*<%= t('venue_management_signup.tel') %></label>
<div class="controls">
<%= f.text_field :tel, :class=>"input-block-level", :placeholder=> t('venue_management_signup.tel'), :required => true %>
</div>
</div>
<!-- Email -->
<div class="control-group">
<label for="email" class="control-label muted">*<%= t(:email) %></label>
<div class="controls">
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= OrbitHelper.url_to_show(@venue_management.to_param) %>?method=check_email&no=<%=@venue_management.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
</div>
</div>
<div class="control-group <%= @venue_management.registration_status[0] == 'C' ? '' : 'hide' %>" id="registration_status">
<label for="password" class="control-label muted">*<%= t('venue_management_signup.password') %></label>
<div class="controls">
<%= f.text_field :password, :class=>"input-block-level", :placeholder=> t('venue_management_signup.password') %>
<%= t('venue_management_signup.password_message') %>
</div>
</div>
<% end %>
<% @form_index = 0 %>
<% @venue_management.venue_management_signup_fields.asc(:_id).each do |rf| %>
<div class="control-group">
<%= rf.block_helper(@venue_management,@form_index,false,"venue_management_signup",@venue_management_signup, rf.to_require) %>
</div>
<% @form_index = @form_index +1 %>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%#= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), "/admin/venue_managements/#{@venue_management.id}/venue_management_signup", :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -0,0 +1,132 @@
<div class="attributes default <%= attribute_field.disabled ? 'disabled' : ''%>">
<%
attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter
%>
<div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute_field.disabled ? 'disabled' : ''%>">
<%= hidden_field "#{@field_name}[venue_management_signup_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %>
<label><b></b></label>
</div>
</div>
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t(:delete_)%></a>
<%= hidden_field "#{@field_name}[venue_management_signup_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%>
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reset</a>
<h4>Field <span><%= @af_counter + 1 %></span></h4>
</div>
<div class="attributes-body">
<div class="control-group">
<label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label>
<div class="controls">
<%= text_field "#{@field_name}[venue_management_signup_fields][#{@af_counter}]","key",:value=>attribute_field.key, :data=>{:type=>"key"} %>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[venue_management_signup_fields][#{@af_counter}][title_translations]"}%>
<div class="control-group">
<label class="control-label muted" for=""><%= t('venue_management.to_require') %></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_signup_fields][#{@af_counter}]", "to_require", "true",:checked => (attribute_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_signup_fields][#{@af_counter}]", "to_require", "false",:checked => (attribute_field.to_require == false ? true : false), :data=>{:type=>"search_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=<%= "#{@field_name}[venue_management_signup_fields][#{@af_counter}][markup]"%>>
<%LIST[:markups].each do |key,val|%>
<% if key != 'address' %>
<option value="<%= key %>" <%= attribute_field.markup == key ? 'selected="selected"' : '' %> ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
<% end %>
<% end %>
</select>
</div>
</div>
</div>
<div class="field-type fade"></div>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeA")}" do%>
<div class="control-group">
<label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %>
<%= t(:cross_lang) %>
</label>
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %>
<%= t(:add_more)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeA][placeholder]"}%>
<% end if show_type_panel(attribute_field,"typeA") != 'typeA hide' %>
<%= 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=>"#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeB][initial]"}%>
<% if attribute_field.self_defined_markup_options?%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[venue_management_signup_fields][#{@af_counter}][attribute][venue_management][statuses]"} %>
<%else #normal list%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%>
<% end if show_type_panel(attribute_field,"typeB") != 'typeB hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeC")}" do %>
<div class="control-group">
<label class="control-label"><%= t("date.format")%></label>
<div class="controls">
<%= select "#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_field["typeC"]["format"] %>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t("date.range")%></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t("date.calendar")%></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label>
</div>
</div>
<% end if show_type_panel(attribute_field,"typeC") != 'typeC hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeD")}" do%>
<div class="control-group">
<label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %>
<%= t(:cross_lang)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %>
<% 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%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[venue_management_signup_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
<% end if show_type_panel(attribute_field,"typeE") != 'typeE hide' %>
<%= hidden_field "#{@field_name}[venue_management_signup_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
</div>

View File

@ -0,0 +1,132 @@
<div class="attributes default <%= attribute_submission_field.disabled ? 'disabled' : ''%>">
<%
attribute_submission_field.af_count ? @af_counter = attribute_submission_field_counter + attribute_submission_field.af_count : @af_counter = attribute_submission_field_counter
%>
<div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute_submission_field.disabled ? 'disabled' : ''%>">
<%= hidden_field "#{@field_name}[venue_management_submission_fields][#{@af_counter}]","disabled",:value=>attribute_submission_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %>
<label><b></b></label>
</div>
</div>
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t(:delete_)%></a>
<%= hidden_field "#{@field_name}[venue_management_submission_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_submission_field_to_delete"%>
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reset</a>
<h4>Field <span><%= @af_counter + 1 %></span></h4>
</div>
<div class="attributes-body">
<div class="control-group">
<label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label>
<div class="controls">
<%= text_field "#{@field_name}[venue_management_submission_fields][#{@af_counter}]","key",:value=>attribute_submission_field.key, :data=>{:type=>"key"} %>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[venue_management_submission_fields][#{@af_counter}][title_translations]"}%>
<div class="control-group">
<label class="control-label muted" for=""><%= t('venue_management.to_require') %></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_submission_fields][#{@af_counter}]", "to_require", "true",:checked => (attribute_submission_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_submission_fields][#{@af_counter}]", "to_require", "false",:checked => (attribute_submission_field.to_require == false ? true : false), :data=>{:type=>"search_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=<%= "#{@field_name}[venue_management_submission_fields][#{@af_counter}][markup]"%>>
<%LIST[:markups].each do |key,val|%>
<% if key != 'address' %>
<option value="<%= key %>" <%= attribute_submission_field.markup == key ? 'selected="selected"' : '' %> ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
<% end %>
<% end %>
</select>
</div>
</div>
</div>
<div class="field-type fade"></div>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeA")}" do%>
<div class="control-group">
<label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeA][cross_lang]","true",attribute_submission_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %>
<%= t(:cross_lang) %>
</label>
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeA][add_more]","true",attribute_submission_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %>
<%= t(:add_more)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeA][placeholder]"}%>
<% end if show_type_panel(attribute_submission_field,"typeA") != 'typeA hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeB")}" do %>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_submission_field["typeB"]["initial"],:field_name=>"#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeB][initial]"}%>
<% if attribute_submission_field.self_defined_markup_options?%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[venue_management_submission_fields][#{@af_counter}][attribute][venue_management][statuses]"} %>
<%else #normal list%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%>
<% end if show_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeC")}" do %>
<div class="control-group">
<label class="control-label"><%= t("date.format")%></label>
<div class="controls">
<%= select "#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_submission_field["typeC"]["format"] %>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t("date.range")%></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_submission_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_submission_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t("date.calendar")%></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label>
</div>
</div>
<% end if show_type_panel(attribute_submission_field,"typeC") != 'typeC hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeD")}" do%>
<div class="control-group">
<label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeD][cross_lang]","true",attribute_submission_field["typeD"]["cross_lang"]) %>
<%= t(:cross_lang)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_submission_field["typeD"]["placeholder"]} %>
<% end if show_type_panel(attribute_submission_field,"typeD") != 'typeD hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[venue_management_submission_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
<% end if show_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
<%= hidden_field "#{@field_name}[venue_management_submission_fields][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
</div>

View File

@ -0,0 +1,556 @@
<%
venue_method = Admin::VenueManagementsFieldHelper::VenueMethod
%>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<style type="text/css">
.col-sm-10.controls{
margin-left:0px;
}
.input-append input{
width: 150px;
}
</style>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
<li><a href="#signup" data-toggle="tab"><%= t('venue_management.signup') %></a></li>
<!--
<li><a href="#review" data-toggle="tab"><%# t('venue_management.review') %></a></li>
-->
<!--
<li><a href="#signup_set" data-toggle="tab"><%# t('venue_management.signup_set') %></a></li>
<li><a href="#submission_set" data-toggle="tab"><%# t('venue_management.submission_set') %></a></li>
-->
<li><a href="#custom_set" data-toggle="tab"><%= t('venue_management.custom_set') %></a></li>
<li><a href="#auto_send_email_set" data-toggle="tab"><%= t('venue_management.auto_send_email_set') %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t(:category) %></label>
<div class="controls">
<%= select_category(f, @module_app) %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.manager') %></label>
<div class="controls">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'venue_management_main[manager_ids][]', email_members:Array(@managers), index:'1',select_name:'managers'} %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.contractor') %></label>
<div class="controls">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'venue_management_main[contractor_ids][]', email_members:Array(@contractors), index:'2',select_name:'contractors'} %>
</div>
</div>
<!-- VenueManagement Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.venue_management_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :venue_management_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.venue_management_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :venue_management_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
</div>
<!-- Sign up Module -->
<div class="tab-pane fade in " id="signup">
<!-- host -->
<!--
<div class="control-group">
<label class="control-label muted"><%# t("venue_management.registration_status") %></label>
<div class="controls">
<%# ['G','C'].each do |t| %>
<label class="checkbox inline">
<input type="checkbox" name="venue_management_main[registration_status][]" value="<%#=t%>" <%#=(!@venue_management.registration_status.blank? and @venue_management.registration_status.include?(t)) ? "checked" : "" %> ><%# t("venue_management.registration_status_#{t}") %>
</label>
<%# end %>
</div>
</div>
-->
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.coordinator') %></label>
<div class="controls">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'venue_management_main[coordinator_ids][]', email_members:Array(@coordinators), index:'3',select_name:'coordinators'} %>
</div>
</div>
<!-- Sign up Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.signup_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :signup_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.signup_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :signup_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
<!-- Contribute Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.contribute_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :contribute_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.contribute_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :contribute_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.contribute_file_count') %></label>
<div class="controls">
<%= f.text_field :contribute_file_count %>
(<%= t('venue_management.blank_no_limit') %>)
</div>
</div>
</div>
<!-- Review Module -->
<!--
<div class="tab-pane fade in " id="review">
<%# f.fields_for :venue_management_reviews,@review do |venue_management_reviews_form| %>
<div class="control-group big-group">
<label class="control-label muted"><%= t("venue_management.reviewer") %></label>
<div class="controls">
<%# if !@member.nil? %>
<%# render partial: 'admin/member_selects/email_selection_box', locals: {field: 'venue_management_main[venue_management_reviews_attributes][0][reviewer_id][]', email_members:@member} %>
<%# else %>
<%# render partial: 'admin/member_selects/email_selection_box', locals: {field: 'venue_management_main[venue_management_reviews_attributes][0][reviewer_id][]', email_members:[]} %>
<%# end %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.review_start_date') %></label>
<div class="controls">
<%# venue_management_reviews_form.datetime_picker :review_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('venue_management.review_end_date') %></label>
<div class="controls">
<%# venue_management_reviews_form.datetime_picker :review_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @venue_management.new_record? %>
</div>
</div>
<%# end %>
</div>
-->
<!-- Signup Set Module -->
<!--
<div class="tab-pane fade in " id="signup_set" style="padding: 1.2em;">
<table>
<thead>
<th><%#= t('venue_management.field_name') %></th>
<th><%#= t('venue_management.name') %></th>
<th><%#= t('venue_management.placeholder') %></th>
<th><%#= t('venue_management.disable') %></th>
<th><%#= t('venue_management.hidden') %></th>
</thead>
<tbody>
<%# @signup_sets.each_with_index do |attr_signup,signup_index| %>
<tr>
<td>
<%#= t("venue_management_signup.#{attr_signup.field_name}") %>
</td>
<td>
<%#= venue_method.show_set_field(attr_signup,'venue_management_signup_field_sets',signup_index,'name') %>
</td>
<td>
<%#= venue_method.show_set_field(attr_signup,'venue_management_signup_field_sets',signup_index,'placeholder') %>
</td>
<td>
<input type="hidden" class="field_name" name='<%#= "venue_management_main[venue_management_signup_field_sets][#{signup_index}][field_name]" %>' value="<%# attr_signup.field_name %>">
<input type="hidden" class="field_set" name='<%#= "venue_management_main[venue_management_signup_field_sets][#{signup_index}][disabled]" %>' value="false">
<%#= check_box_tag("venue_management_main[venue_management_signup_field_sets][#{signup_index}][disabled]", true ,attr_signup.disabled) %>
</td>
<td>
<%# if attr_signup.field_name != 'recaptcha' %>
<input type="hidden" class="field_set" name='<%#= "venue_management_main[venue_management_signup_field_sets][#{signup_index}][hidden]" %>' value="false">
<%#= check_box_tag("venue_management_main[venue_management_signup_field_sets][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
<%# end %>
</td>
</tr>
<%# end %>
</tbody>
</table>
</div>
-->
<!-- Submission Set Module -->
<!--
<div class="tab-pane fade in " id="submission_set" style="padding: 1.2em;">
<table>
<thead>
<th><%#= t('venue_management.field_name') %></th>
<th><%#= t('venue_management.name') %></th>
<th><%#= t('venue_management.placeholder') %></th>
<th><%#= t('venue_management.disable') %></th>
<th><%#= t('venue_management.hidden') %></th>
</thead>
<tbody>
<%# @submission_set.each_with_index do |attr_signup,submission_index| %>
<tr>
<td>
<%#= t("venue_management_signup.#{attr_signup.field_name}") %>
</td>
<td>
<%#= venue_method.show_set_field(attr_signup,'venue_management_submission_field_sets',submission_index,'name') %>
</td>
<td>
<%#= venue_method.show_set_field(attr_signup,'venue_management_submission_field_sets',submission_index,'placeholder') %>
</td>
<td>
<input type="hidden" class="field_name" name='<%#= "venue_management_main[venue_management_submission_field_sets][#{submission_index}][field_name]" %>' value="<%#= attr_signup.field_name %>">
<input type="hidden" class="field_set" name='<%#= "venue_management_main[venue_management_submission_field_sets][#{submission_index}][disabled]" %>' value="false">
<%#= check_box_tag("venue_management_main[venue_management_submission_field_sets][#{submission_index}][disabled]", true ,attr_signup.disabled) %>
</td>
<td>
<input type="hidden" class="field_set" name='<%#= "venue_management_main[venue_management_submission_field_sets][#{submission_index}][hidden]" %>' value="false">
<%#= check_box_tag("venue_management_main[venue_management_submission_field_sets][#{submission_index}][hidden]", true ,attr_signup.hidden) %>
</td>
</tr>
<%# end %>
</tbody>
</table>
</div>
-->
<!-- Custom Set Module -->
<div class="tab-pane fade in " id="custom_set" style="padding: 1.2em;">
<table>
<thead>
<th style="padding-right: 2em;"><%= t('venue_management.field_name') %></th>
<th><%= t('venue_management.hidden') %></th>
</thead>
<tbody>
<% @custom_set.each_with_index do |attr_custom,custom_index| %>
<tr>
<td>
<%= VenueManagementSignupField.where(id:attr_custom.venue_management_signup_field_id).first.title rescue '' %>
</td>
<td>
<input type="hidden" class="field_set" name='<%= "venue_management_main[venue_management_signup_field_customs][#{custom_index}][hidden]" %>' value="false">
<%= check_box_tag("venue_management_main[venue_management_signup_field_customs][#{custom_index}][hidden]", true ,attr_custom.hidden) %>
</td>
<input for="field_0" id="venue_management_main_venue_management_signup_field_customs_<%= custom_index.to_s %>_id" name="venue_management_main[venue_management_signup_field_customs][<%= custom_index.to_s %>][id]" type="hidden" value="<%= attr_custom.id.to_s %>">
</tr>
<% end %>
</tbody>
</table>
</div>
<!-- Email Set Module -->
<div class="tab-pane fade in " id="auto_send_email_set" style="padding: 1.2em;">
<ul class="nav nav-pills module-nav">
<li class="active">
<a href="#email_set0" data-toggle="tab">
<%= t('venue_management.email_signup') %>
</a>
</li>
<li class="">
<a href="#email_set1" data-toggle="tab">
<%= t('venue_management.email_submission') %>
</a>
</li>
<li class="">
<a href="#email_set2" data-toggle="tab">
<%= t('venue_management.email_add_file') %>
</a>
</li>
<li class="">
<a href="#email_set3" data-toggle="tab">
<%= t('venue_management.email_edit_file') %>
</a>
</li>
</ul>
<div class="tab-content">
<% (0..3).each do |index1| %>
<% active_email_set = index1==0 ? ' active' : '' %>
<div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;">
<table style="width:100%;">
<tbody>
<tr>
<td>
<%= t('venue_management.disable') %>
</td>
<td>
<input type="hidden" class="field_set" name='<%= "venue_management_main[venue_management_email_sets][#{index1}][disabled]" %>' value="false">
<%= check_box_tag("venue_management_main[venue_management_email_sets][#{index1}][disabled]", true ,@email_set[index1].disabled) %>
</td>
</tr>
<tr>
<td>
<%= t('venue_management.email_title') %>
</td>
<td>
<%= venue_method.show_set_field(@email_set[index1],'venue_management_email_sets',index1,'title','text_field') %>
</td>
</tr>
<tr>
<td>
<%= t('venue_management.email_content') %>
</td>
<td>
<div class="form-group">
<%= venue_method.show_set_field(@email_set[index1],'venue_management_email_sets',index1,'content','text_area') %>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<% end %>
</div>
</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>
<!-- Language -->
<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" : '' %>">
<!-- Title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t('venue_management.title') %></label>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@venue_management.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Speaker -->
<div class="control-group input-title">
<label class="control-label muted"><%= t('venue_management.speaker') %></label>
<div class="controls">
<%= f.fields_for :speaker_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t('venue_management.speaker'), value: (@venue_management.speaker_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management.land_number') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :land_number_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", :value => (@venue_management.land_number_translations[locale] rescue nil),placeholder: t('venue_management.land_number') %>
<% end %>
</div>
</div>
</div>
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management.area') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :area_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", :value => (@venue_management.area_translations[locale] rescue nil),placeholder: t('venue_management.area') %>
<% end %>
</div>
</div>
</div>
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management.land_zoning') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :land_zoning_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", :value => (@venue_management.land_zoning_translations[locale] rescue nil),placeholder: t('venue_management.land_zoning') %>
<% end %>
</div>
</div>
</div>
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t('venue_management.content') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@venue_management.content_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<!-- Place-->
<div class="control-group input-title">
<label class="control-label muted"><%= t('venue_management.act_place') %></label>
<div class="controls">
<%= f.fields_for :act_place_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t('venue_management.act_place'), value: (@venue_management.act_place_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
<!-- Link -->
<div class="control-group">
<label class="control-label muted"><%= t(:link) %></label>
<div class="controls add-input">
<!-- Exist -->
<% if @venue_management && !@venue_management.venue_management_links.blank? %>
<div class="exist">
<% @venue_management.venue_management_links.each_with_index do |venue_management_link, i| %>
<%= f.fields_for :venue_management_links, venue_management_link do |f| %>
<%= render :partial => 'form_link', :object => venue_management_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'venue_management_link_field_count', @venue_management.venue_management_links.count %>
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @venue_management && !@venue_management.venue_management_files.blank? %>
<div class="exist">
<% @venue_management.venue_management_files.each_with_index do |venue_management_file, i| %>
<%= f.fields_for :venue_management_files, venue_management_file do |f| %>
<%= render :partial => 'form_file', :object => venue_management_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'venue_management_file_field_count', @venue_management.venue_management_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:venue_managemention] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_venue_managements_path, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<script>
$(function() {
$("#main-wrap").after("");
$(document).on('click', '#add_link', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_venue_management_links", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :venue_management_links) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
formTip();
});
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_venue_management_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :venue_management_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_link', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
});
</script>
<% end %>

View File

@ -0,0 +1,55 @@
<% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %>
<div class="fileupload fileupload-exists start-line" data-provides="fileupload">
<% if form_file.file.blank? %>
<%= t(:no_file) %>
<% else %>
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
<% end %>
<% end %>
<div class="input-prepend input-append">
<label>
<span class="add-on btn btn-file" title='<%= t(:file_) %>'>
<i class="icons-paperclip"></i>
<%= f.file_field :file %>
</span>
<div class="uneditable-input input-medium">
<i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
</div>
</label>
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
<span class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:alternative), :value => (form_file.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
<span class="add-on icons-pencil" title='<%= t(:description) %>'></span>
<span class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :description_translations do |f| %>
<%= f.text_field locale, :class => "input-medium", placeholder: t(:description), :value => (form_file.description_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
</span>
<% if form_file.new_record? %>
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>
</div>

View File

@ -0,0 +1,26 @@
<div class="input-prepend input-append start-line">
<span class="add-on icons-link" title="<%= t(:url) %>"></span>
<%= f.text_field :url, class: "input-large", placeholder: t(:url) %>
<span class="add-on icons-pencil" title="<%= t(:url_alt) %>"></span>
<span class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<span class="tab-pane fade <%= ( i == 0 ) ? "in active" : '' %> <%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :class => "input-large", placeholder: t(:url_alt), :value => (form_link.title_translations[locale] rescue nil) %>
<% end %>
</span>
<% end %>
</span>
<% if form_link.new_record? %>
<span class="delete_link add-on btn" title="<%= t(:delete_) %>">
<a class="icon-trash"></a>
</span>
<% else %>
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
<%= f.hidden_field :id %>
<a class="icon-remove"></a>
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
</span>
<% end %>
</div>

View File

@ -0,0 +1,50 @@
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<% if f == 'venue_management.title' %>
<th class='span4'><%= t(f)%></th>
<% else %>
<%= thead(f) %>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<% @venue_managements.each do |venue_management| %>
<tr>
<td><%= venue_management.category.title %></td>
<td>
<a href="<%= page_for_venue_management(venue_management) %>?method=show_data" target="_blank"><%= venue_management.title %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(venue_management) %>
<li><a href="/admin/venue_managements/<%=venue_management.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="<%= admin_venue_management_item_contents_path(:venue_management_main_id=>venue_management.id.to_s) %>"><%= t('venue_management.set_venue_management_item_content') %></a></li>
<li><a href="/admin/venue_managements/<%=venue_management.id.to_s%>/venue_management_signup_field"><%= t('venue_management.set_venue_management_signup_field') %></a></li>
<li><a href="/admin/venue_managements/<%=venue_management.id.to_s%>/venue_management_submission_field"><%= t('venue_management.set_venue_management_submission_field') %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/venue_managements/<%=venue_management.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td><%= VenueManagementMain.time_range(venue_management.venue_management_start_date, venue_management.venue_management_end_date) %></td>
<td><%= VenueManagementMain.time_range(venue_management.signup_start_date, venue_management.signup_end_date) %></td>
<td><a href="/admin/venue_managements/<%=venue_management.id.to_s%>/venue_management_signup"><%= venue_management.venue_management_signups.count %></a></td>
<td><a href="#">0</a></td>
<td><a href="#">0</a></td>
<td><a href="/admin/venue_managements/<%=venue_management.id.to_s%>/export?format=xlsx" target="_blank"><%= t('venue_management.export') %></a></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@venue_managements), class: "pagination pagination-centered"
end
%>

View File

@ -0,0 +1,268 @@
<%#= 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>Field <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="<%= t(locale).to_s %>">
</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"><%= t(locale).to_s %></a>
<% end %>
</div>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for=""><%= t('venue_management.to_require') %></label>
<div class="controls">
<label class="radio inline">
<input type="radio" data-type="search_true" id="${_to_require[0]+'_true'}" name="${_to_require[1]}" value="true" checked=""> <%= t(:yes_)%>
</label>
<label class="radio inline">
<input type="radio" data-type="search_false" id="${_to_require[0]+'_false'}" name="${_to_require[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|%>
<% if key != 'address' %>
<option value="<%= key %>" ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
<% end %>
<% 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="<%= t(locale).to_s %>" 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"><%= t(locale).to_s %></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="<%= t(locale).to_s %>" 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"><%= t(locale).to_s %></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="<%= t(locale).to_s %>">
<% 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="<%= t(locale).to_s %>">
<% 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>

View File

@ -0,0 +1,5 @@
<%= form_for @venue_management, url: admin_venue_management_path(@venue_management), html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<%= render :partial => 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,66 @@
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: (@venue_management.title.to_s[0..27]+'...')) do |sheet|
row = [t('venue_management_signup.signup_time')]
row << t('venue_management_signup.name')
row << t('venue_management_signup.unit')
row << t('venue_management_signup.tel')
row << t('venue_management_signup.phone')
row << t('venue_management_signup.fax')
row << t('venue_management_signup.address')
row << t(:email)
row << t('venue_management_signup.note')
@venue_management.venue_management_signup_fields.asc(:_id).each do |rf|
if rf.can_muti_lang_input?
@site_in_use_locales.each do |l|
row << rf.title + " (#{t(l.to_s)})"
end
else
row << rf.title
end
end
sheet.add_row row
@venue_management.venue_management_signups.each do |signup|
row2 = []
row2 << "#{signup.created_at} "
row2 << "#{signup[:name]} "
row2 << "#{signup.unit} "
row2 << "#{signup[:tel]} "
row2 << "#{signup[:phone]} "
row2 << "#{signup[:fax]} "
row2 << "#{signup.address} "
row2 << "#{signup[:email]} "
row2 << "#{signup.note} "
@venue_management.venue_management_signup_fields.asc(:_id).each do |rf|
if rf.can_muti_lang_input?
@site_in_use_locales.each do |l|
row2 << nl2br(show_attribute_value(@venue_management.get_attribute_value(rf,signup.id).get_value_by_locale(l))) rescue ' '
end
else
row2 << nl2br(show_attribute_value(@venue_management.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale))) rescue ' '
end
end
sheet.add_row row2
end
end

View File

@ -0,0 +1,6 @@
<%= render_filter @filter_fields, "index_table" %>
<span id="index_table">
<%= render 'index'%>
</span>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>

View File

@ -0,0 +1,5 @@
<%= form_for @venue_management, url: admin_venue_managements_path, html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<%= render :partial => 'form', locals: {f: f} %>
</fieldset>
<% end %>

View File

@ -0,0 +1,44 @@
<span id="index_table">
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<h4><%= @venue_management.title %></h4>
<table class="table main-list">
<thead>
<tr class="sort-header">
<th class='span2'><%= t('venue_management_item_content.name')%></th>
</tr>
</thead>
<tbody>
<% @venue_management_item_contents.each do |venue_management_item_content| %>
<tr>
<td>
<%= venue_management_item_content.content %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(act_signup) %>
<li><a href="/admin/venue_management_item_contents/<%=venue_management_item_content.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/venue_management_item_contents/<%=venue_management_item_content.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'),
'/admin/venue_management_item_contents/'+@member.to_param+'/journal_papers/new', :class => 'btn btn-primary' %>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@venue_management_item_contents), class: "pagination pagination-centered"
end
%>
</span>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>

View File

@ -0,0 +1,215 @@
<span id="index_table">
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<form id="module-search-form">
<div class="sc-field">
<input id="filter-input" class="search-query input-medium" type="text" name="search" value="<%= params[:search] %>" placeholder="搜尋">
</div>
</form>
<h4><%= @venue_management.title %></h4>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% if @venue_management.venue_management_signup_field_sets.count != 0 %>
<% @venue_management.venue_management_signup_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<th class='span2'><%= field_set.name[I18n.locale] %></th>
<% end %>
<% end %>
<% else %>
<th class='span2'><%= t('venue_management_signup.name')%></th>
<th class='span2'><%= t('venue_management_signup.tel')%></th>
<th class='span2'><%= t('venue_management.registration_status')%></th>
<% end %>
<% if @venue_management.venue_management_signup_field_customs.count != 0 %>
<% @venue_management.venue_management_signup_field_customs.each do |field_set| %>
<% if !(field_set.hidden) %>
<th class='span2'><%= VenueManagementSignupField.where(id:field_set.venue_management_signup_field_id).first.title rescue '' %></th>
<% end %>
<% end %>
<% end %>
<% if @venue_management.venue_management_submission_field_sets.count != 0 %>
<% show1 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
show2 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
show3 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
%>
<% else %>
<% show1 = true
show2 = true
show3 = true
%>
<% end %>
<% if show1 %>
<th class='span2'><%= t('venue_management_signup.title')%></th>
<% end %>
<% if show2 %>
<th class='span2'><%= t('venue_management_signup.file')%></th>
<% end %>
<% if show3 %>
<th class='span2'><%= t('venue_management_signup.description')%></th>
<% end %>
<% @venue_management.venue_management_submission_fields.asc(:_id).each do |submission_field| %>
<th class='span2'><%= submission_field.title %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @venue_management_signups.each do |venue_management_signup| %>
<% len = venue_management_signup.venue_management_signup_contributes.count %>
<tr>
<% if @venue_management.venue_management_signup_field_sets.count != 0 %>
<% @venue_management.venue_management_signup_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<td rowspan="<%= len==0? 1 : len %>">
<% if field_set.field_name== 'name' %>
<%= venue_management_signup.name %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(venue_management_signup) %>
<li><a href="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
<% elsif field_set.field_name== 'status' %>
<%= t("venue_management.registration_status_#{venue_management_signup.status}") if !venue_management_signup.status.blank? %>
<% elsif field_set.field_name != 'recaptcha' %>
<%= venue_management_signup.send("#{field_set.field_name}") %>
<% end %>
</td>
<% end %>
<% end %>
<% else %>
<td rowspan="<%= len==0? 1 : len %>">
<%= venue_management_signup.name %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(venue_management_signup) %>
<li><a href="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/venue_management_signups/<%=venue_management_signup.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td rowspan="<%= len==0? 1 : len %>"><%= venue_management_signup.tel %></td>
<td rowspan="<%= len==0? 1 : len %>"><%= t("venue_management.registration_status_#{venue_management_signup.status}") if !venue_management_signup.status.blank? %>
</td>
<% end %>
<% if @venue_management.venue_management_signup_field_customs.count != 0 %>
<% @venue_management.venue_management_signup_field_customs.each do |field_set| %>
<% if !(field_set.hidden) %>
<td rowspan="<%= len==0? 1 : len %>">
<% venue_management_signup.venue_management_signup_values.each do |venue_management_signup_values| %>
<% if venue_management_signup_values.venue_management_signup_field_id == field_set.venue_management_signup_field_id %>
<% if venue_management_signup_values.value.class == String || venue_management_signup_values.value.nil? %>
<%= venue_management_signup_values.get_value_by_locale(I18n.locale,venue_management_signup_values) %>
<% else %>
<% venue_management_signup_values.value.each do |key,v| %>
<%= "#{I18n.t(key)}:#{venue_management_signup_values.get_value_by_locale(key,venue_management_signup_values)}" %>
<br>
<% end %>
<% end %>
<% end %>
<% end %>
</td>
<% end %>
<% end %>
<% end %>
<% count_set = 0 %>
<% if @venue_management.venue_management_submission_field_sets.count != 0 %>
<% show1 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
show2 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
show3 = !(@venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
%>
<% @venue_management.venue_management_submission_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<% count_set+=1 %>
<% end %>
<% end %>
<% else %>
<% show1 = true
show2 = true
show3 = true
%>
<% count_set = 2 %>
<% end %>
<% if len==0 %>
<%
count_field = @venue_management.venue_management_submission_fields.count
%>
<ul>
<% for i in 1..count_field+count_set %>
<td rowspan="1">
</td>
<% end %>
</ul>
</tr>
<% end %>
<ul>
<% venue_management_signup.venue_management_signup_contributes.collect do |venue_management_signup_contribute| %>
<% if show1 %>
<td>
<li><%= venue_management_signup_contribute.title.to_s %></li>
</td>
<% end %>
<% if show2 %>
<td>
<li>
<%= link_to (venue_management_signup_contribute.title.blank? ? File.basename(venue_management_signup_contribute.file.path) : venue_management_signup_contribute.title) , venue_management_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(venue_management_signup_contribute.description).text} if venue_management_signup_contribute.file.file %>
</li>
</td>
<% end %>
<% if show3 %>
<td>
<li><%= venue_management_signup_contribute.description.to_s.html_safe %></li>
</td>
<% end %>
<%
count_value = venue_management_signup_contribute.venue_management_submission_values.count
count_field = @venue_management.venue_management_submission_fields.count
%>
<% if count_value == count_field %>
<% venue_management_signup_contribute.venue_management_submission_values.asc(:venue_management_submission_field_id).each do |value| %>
<td>
<span style="display: list-item;">
<% if value.value.class == String || value.value.nil? %>
<%= value.get_value_by_locale(I18n.locale,value) %>
<% else %>
<% value.value.each do |key,v| %>
<%= "#{I18n.t(key)}:#{value.get_value_by_locale(key,value)}" %>
<br>
<% end %>
<% end %>
</span>
</td>
<% end %>
<% else %>
<% for i in 1..(count_field-count_value) %>
<td>
</td>
<% end %>
<% end %>
</tr>
<tr>
<% end %>
</ul>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@venue_management_signups), class: "pagination pagination-centered"
end
%>
</span>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>

View File

@ -0,0 +1,37 @@
<% 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 "field-forms.js" %>
<% end -%>
<%= form_for @attribute,:url => admin_venue_management_path(@attribute) , :html => { :class=> "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %>
<%= flash.now[:notice]%>
<% end %>
<h3><%= @attribute.title %></h3>
<fieldset>
<div id="attributes-area" class="input-area">
<%= render partial: "attribute_field",collection: @attribute.venue_management_signup_fields.asc(:_id)%>
</div>
<div class="form-actions">
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
<%= hidden_field_tag 'id', params[:id] if !params[: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 'support_member_form_js' %>
<% end -%>

View File

@ -0,0 +1,36 @@
<% 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 "field-forms-submission.js" %>
<% end -%>
<%= form_for @attribute,:url => admin_venue_management_path(@attribute) , :html => { :class=> "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %>
<%= flash.now[:notice]%>
<% end %>
<h3><%= @attribute.title %></h3>
<fieldset>
<div id="attributes-area" class="input-area">
<%= render partial: "attribute_submission_field",collection: @attribute.venue_management_submission_fields.asc(:_id)%>
</div>
<div class="form-actions">
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
<%= hidden_field_tag 'id', params[:id] if !params[: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 'support_member_form_js' %>
<% end -%>

View File

@ -0,0 +1,8 @@
<% email_set = VenueManagementMain.where(id:@data['venue_management_id']).first.venue_management_email_sets.select{|v| v.field_name == 'add_file'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('venue_management.email_add_file_content') %>
<% end %>

View File

@ -0,0 +1,8 @@
<% email_set = VenueManagementMain.where(id:@data['venue_management_id']).first.venue_management_email_sets.select{|v| v.field_name == 'edit_file'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('venue_management.email_edit_file_content') %>
<% end %>

View File

@ -0,0 +1,8 @@
<% email_set = VenueManagementMain.where(id:@data['venue_management_id']).first.venue_management_email_sets.select{|v| v.field_name == 'signup'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('venue_management.email_signup_content') %>
<% end %>

View File

@ -0,0 +1,8 @@
<% email_set = VenueManagementMain.where(id:@data['venue_management_id']).first.venue_management_email_sets.select{|v| v.field_name == 'submission'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('venue_management.email_submission_content') %>
<% end %>

View File

@ -0,0 +1,33 @@
<style type="text/css">
.simple_captcha{border: 1px solid #ccc; padding: 5px !important;}
.simple_captcha,
.simple_captcha div{display: table;}
.simple_captcha .simple_captcha_field,
.simple_captcha .simple_captcha_image{
border: 1px solid #ccc;
margin: 0px 0px 2px 0px !important;
padding: 0px !important;
}
.simple_captcha .simple_captcha_image img{
margin: 0px !important;
padding: 0px !important;
width: 110px !important;
}
.simple_captcha .simple_captcha_label{font-size: 12px;}
.simple_captcha .simple_captcha_field input{
width: 150px !important;
font-size: 16px;
border: none;
background-color: #efefef;
}
</style>
<div class='simple_captcha'>
<div class='simple_captcha_image'>
<%= simple_captcha_options[:image] %>
</div>
<div class='simple_captcha_field'>
<%= simple_captcha_options[:field] %>
</div>
</div>

View File

@ -0,0 +1,110 @@
<% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= stylesheet_link_tag "venue_management" %>
<%= javascript_include_tag 'basic.js' %>
<% @@session = session %>
<%= yield %>
<%
data = action_data
@con = data["con"]
@venue_management = data["venue_management"]
@venue_management_signup = data["venue_management_signup"]
@form_index = 0
%>
<% if !session[:venue_management_signup_id].blank? %>
<% if ( @venue_management.contribute_file_count.blank? or @venue_management_signup.venue_management_signup_contributes.count < @venue_management.contribute_file_count.to_i ) %>
<%= form_for @con, url: add_file_proc_venue_managements_path, html: {class: "content form-horizontal" , :id=>"new-venue_management-signup-contribute"} do |f| %>
<fieldset>
<% if @venue_management.venue_management_submission_field_sets.count != 0
data1 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='title'}[0]
data2 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='description'}[0]
data3 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='file'}[0]
show1 = !(data1.disabled)
show2 = !(data2.disabled)
show3 = !(data3.disabled)
name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale]
plc1 = data1['placeholder'][I18n.locale]
plc2 = data2['placeholder'][I18n.locale]==t('venue_management_signup.description') ? '' : data2['placeholder'][I18n.locale]
plc3 = data3['placeholder'][I18n.locale]==t('venue_management_signup.file') ? '' : data3['placeholder'][I18n.locale]
else
show1 = true
show2 = true
show3 = true
name1 = t('venue_management_signup.title')
name2 = t('venue_management_signup.description')
name3 = t('venue_management_signup.file')
plc1 = t('venue_management_signup.title')
plc2 = ''
plc3 = ''
end
%>
<% if show1 %>
<div class="form-group">
<label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
<div class="col-sm-10">
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
</div>
</div>
<% end %>
<% if show2 %>
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
<%= name2 %>
</label>
<br>
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
</span>
<div class="col-sm-10">
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
</div>
</div>
<% end %>
<% if show3 %>
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
*<%= name3 %>
</label>
<br>
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
</span>
<div class="col-sm-10">
<%= f.file_field :file, :required => true %>
</div>
</div>
<% end %>
<% @venue_management.venue_management_submission_fields.asc(:_id).each do |rf| %>
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
<%= rf.block_helper(@venue_management,@form_index,false,"venue_management_signup_contribute",@con, rf.to_require,rf) %>
</div>
<% @form_index = @form_index +1 %>
<% end %>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="venue_management_signup_contribute[venue_management_signup_id]" value="<%= session[:venue_management_signup_id] %>">
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
</div>
</div>
</fieldset>
<% end %>
<% else %>
上傳檔案數已滿
<% end %>
<% else %>
請先登入
<br />
<a href="<%= page_for_venue_management_url %>">回列表頁</a>
<% end %>

View File

@ -0,0 +1,4 @@
<% # encoding: utf-8 %>
<%
data = action_data
%>

View File

@ -0,0 +1,10 @@
<% # encoding: utf-8 %>
<%
data = action_data
result = data["result"]
%>
<center>
<p><%= result %> </p>
<a onClick="window.close()"><%= t('venue_management.close_window') %></a>
</center>

View File

@ -0,0 +1,53 @@
<% # encoding: utf-8 %>
<%
data = action_data
@venue_management = data["venue_management"]
@time_now = data["time_now"]
%>
<% if @venue_management.contribute_start_date <= @time_now and (@venue_management.contribute_end_date.nil? or @venue_management.contribute_end_date+1 >= @time_now ) %>
<section id="main-wrap">
<div class="sign-in have-other-sign-in">
<% flash.each do |key, msg| %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
<% end %>
<div class="form">
<h2><%= @venue_management.title %></h2>
<h3 class="login-logo"><%= t('venue_management_signup.con_login') %></h3>
<div>
<input name="utf8" type="hidden" value="" />
<input name="authenticity_token" type="hidden" value="" />
</div>
<div class="form-block">
<div class="form-list clearfix">
<%= form_tag con_login_proc_venue_managements_path, :class => 'content' do %>
<div class="control-group clear">
<label for="user_email">
<i class="icon-user"></i>
</label>
<%= text_field_tag :user_name, params[:user_name], :placeholder => t("users.user_id"), :id=>"user_email" %>
</div>
<div class="control-group clear">
<label for="user_password">
<i class="icon-lock"></i>
</label>
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
</div>
<br/>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="venue_management_signup[venue_management_main_id]" value="<%= @venue_management.id %>">
<button class="btn btn-primary" name="button" type="submit"><%= t(:login) %></button>
<% end %>
</div>
</div>
<br/>
</div>
</div>
</section>
<% else %>
已截止
<% end %>

View File

@ -0,0 +1,13 @@
<% # encoding: utf-8 %>
<%
# data = action_data
session[:venue_management_signup_id] = nil
session[:venue_management_main_id] = nil
%>
<%= t('venue_management_signup.logouting') %>
<script>document.location.href="<%= page_for_venue_management_url %>";</script>

View File

@ -0,0 +1,72 @@
<% # encoding: utf-8 %>
<% @@session = session %>
<%= yield %>
<%
data = action_data
@venue_management = data["venue_management"]
@venue_management_signup = data["venue_management_signup"]
@time_now = data["time_now"]
%>
<% if @venue_management.contribute_start_date <= @time_now and ( @venue_management.contribute_end_date.nil? or @venue_management.contribute_end_date+1 >= @time_now ) %>
<% if !session[:venue_management_signup_id].blank? %>
<a href="<%= OrbitHelper.url_to_show(@venue_management.to_param) %>?method=con_logout&con_no=<%= @venue_management.id %>" class='btn btn-primary'><%= t('venue_management_signup.logout') %></a>
<table class="table table-hover table-striped venue_management-index">
<caption>
<h3><%= @venue_management.title %></h3>
</caption>
<thead>
<tr>
<th class="col-md-2"><%= t('venue_management_signup.file_name') %></th>
<th class="col-md-2"><%= t('venue_management_signup.file_note') %></th>
<th class="col-md-2"><%= t('venue_management_signup.files') %></th>
<th class="col-md-2"><%= t(:action) %></th>
</tr>
</thead>
<tbody>
<%
@venue_management_signup.venue_management_signup_contributes.each do |venue_management_signup_contribute|
%>
<tr>
<td><%= venue_management_signup_contribute.title %></td>
<td><%= venue_management_signup_contribute.description.to_s.html_safe %></td>
<td><%= link_to File.basename(venue_management_signup_contribute.file.path), venue_management_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(venue_management_signup_contribute.description).text} if venue_management_signup_contribute.file.file %></td>
<td>
<%= link_to t(:edit), OrbitHelper.url_to_show(@venue_management.to_param) + '?method=edit_file&con_no=' + venue_management_signup_contribute.id, :class => 'btn btn-primary' %>
<form method="post" action="<%= del_file_venue_managements_path %>">
<%= submit_tag t(:delete_), class: "btn btn-primary" %>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="con_no" value="<%= venue_management_signup_contribute.id %>">
</form>
</td>
</tr>
<% end %>
</tbody>
</table>
<% if ( @venue_management.contribute_file_count.blank? or @venue_management_signup.venue_management_signup_contributes.count < @venue_management.contribute_file_count.to_i ) %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), OrbitHelper.url_to_show(@venue_management.to_param) + '?method=add_file', :class => 'btn btn-primary' %>
<% end %>
<br />
<br />
<!-- 檔案上限: <%#= @venue_management.contribute_file_count.blank? ? '無' : @venue_management.contribute_file_count %> -->
<% else %>
請先登入
<br />
<a href="<%= page_for_venue_management_url %>">回列表頁</a>
<% end %>
<% else %>
已截止
<% end %>

View File

@ -0,0 +1,99 @@
<% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= stylesheet_link_tag "venue_management" %>
<%= javascript_include_tag 'basic.js' %>
<% @@session = session %>
<%= yield %>
<%
data = action_data
@con = data["con"]
@venue_management = data["venue_management"]
@venue_management_signup = data["venue_management_signup"]
@form_index = 0
%>
<% if !session[:venue_management_signup_id].blank? %>
<%= form_for @con, url: edit_file_proc_venue_managements_path, html: {class: "content form-horizontal" , :id=>"new-venue_management-signup-contribute"} do |f| %>
<fieldset>
<% if @venue_management.venue_management_submission_field_sets.count != 0
data1 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='title'}[0]
data2 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='description'}[0]
data3 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='file'}[0]
show1 = !(data1.disabled)
show2 = !(data2.disabled)
show3 = !(data3.disabled)
name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale]
plc1 = data1['placeholder'][I18n.locale]
plc2 = data2['placeholder'][I18n.locale]==t('venue_management_signup.description') ? '' : data2['placeholder'][I18n.locale]
plc3 = data3['placeholder'][I18n.locale]==t('venue_management_signup.file') ? '' : data3['placeholder'][I18n.locale]
else
show1 = true
show2 = true
show3 = true
name1 = t('venue_management_signup.title')
name2 = t('venue_management_signup.description')
name3 = t('venue_management_signup.file')
plc1 = t('venue_management_signup.title')
plc2 = ''
plc3 = ''
end
%>
<% if show1 %>
<div class="form-group">
<label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
<div class="col-sm-10">
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
</div>
</div>
<% end %>
<% if show2 %>
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
<%= name2 %>
</label>
<br>
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
</span>
<div class="col-sm-10">
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
</div>
</div>
<% end %>
<% if show3 %>
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
*<%= name3 %>
</label>
<br>
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
</span>
<div class="col-sm-10">
<%= f.file_field :file %>
</div>
</div>
<% end %>
<% @venue_management.venue_management_submission_fields.asc(:_id).each do |rf| %>
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
<%= rf.block_helper(@venue_management,@form_index,false,"venue_management_signup_contribute",@con, rf.to_require,rf) %>
</div>
<% @form_index = @form_index +1 %>
<% end %>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="venue_management_signup_contribute[id]" value="<%= @con[:_id] %>">
<input type="hidden" name="venue_management_signup_contribute[venue_management_signup_id]" value="<%= session[:venue_management_signup_id] %>">
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
</div>
</div>
</fieldset>
<% end %>
<% else %>
請登入
<% end %>

View File

@ -0,0 +1,63 @@
<% # encoding: utf-8 %>
<%
data = action_data
@venue_managements = data["venue_managements"]
@total_pages = data["total_pages"]
@time_now = data["time_now"]
%>
<table class="table table-hover table-striped venue_management-index">
<caption>
<h3><%= t('venue_management.venue_management') %></h3>
</caption>
<thead>
<tr>
<th class="col-md-2"><%= t(:category) %></th>
<th class="col-md-3"><%= t('venue_management.title') %></th>
<th class="col-md-2"><%= t('venue_management_signup.time') %></th>
<th class="col-md-2"><%= t('venue_management_signup.place') %></th>
<th class="col-md-2"><%= t('venue_management.signup') %></th>
</tr>
</thead>
<tbody>
<%
@venue_managements.each do |venue_management|
if !venue_management.registration_status.blank? and venue_management.signup_start_date <= @time_now and ( venue_management.signup_end_date.nil? or venue_management.signup_end_date+1 >= @time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '" target="_blank">' + t('venue_management.signup') + '</a>').html_safe
elsif venue_management.registration_status.blank?
sign_up = t('venue_management.sign_up_not_open')
elsif venue_management.signup_start_date > @time_now
sign_up = t('venue_management.sign_up_not_yet')
else
sign_up = t('venue_management.sign_up_overdue')
end
%>
<tr>
<td><%= venue_management.category.title %></td>
<td><%= ('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=show_data" target="_blank">' + venue_management.title + '</a>').html_safe %></td>
<td><%= VenueManagementMain.time_range(venue_management.venue_management_start_date, venue_management.venue_management_end_date) %></td>
<td><%= venue_management.act_place %></td>
<td>
<%= sign_up %> <br />
<%=
if !venue_management.registration_status.blank? and venue_management.registration_status.include?('C') and venue_management.contribute_start_date <= @time_now and ( venue_management.contribute_end_date.nil? or venue_management.contribute_end_date+1 >= @time_now )
if !session[:venue_management_signup_id].blank?
if session[:venue_management_main_id] == venue_management.id
('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_upload">' + t('venue_management_signup.uploads') + '</a>').html_safe
else
('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_login">' + t('venue_management_signup.con_login') + '</a>').html_safe
end
else
('<a href="'+ OrbitHelper.url_to_show(venue_management.to_param) + '?method=con_login">' + t('venue_management_signup.con_login') + '</a>').html_safe
end
end
%>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= create_pagination(@total_pages).html_safe if @total_pages > 1 %>

View File

@ -0,0 +1,335 @@
<%
data = action_data
@venue_management = data["venue_management"]
@venue_management_signup = data["venue_management_signup"]
@time_now = data["time_now"]
@form_index = 0
%>
<% begin %>
<% if !@venue_management.registration_status.blank? and @venue_management.signup_start_date < @time_now and ( @venue_management.signup_end_date.nil? or @venue_management.signup_end_date+1 > @time_now ) %>
<%#= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<% flash.each do |key, msg| %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
<% end %>
<%= form_for @venue_management_signup, url: venue_managements_path, html: {class: "content form-horizontal" , :id=>"new-venue_management-signup"} do |f| %>
<fieldset>
<!-- Title -->
<div class="form-group">
<label for="title" class="col-sm-2 control-label"><%= t('venue_management.title') %></label>
<div class="col-sm-10">
<%= @venue_management.title %>
</div>
</div>
<% if @venue_management.venue_management_signup_field_sets.count != 0 %>
<% @venue_management.venue_management_signup_field_sets.each do |signup_field| %>
<% if signup_field.field_name == 'name' %>
<div>
<div class="col-sm-12" style="text-align: center;"> *(<%= t('venue_management.required') %>) </div>
</div>
<% end %>
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
<div class="form-group<%= (@venue_management.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
<% if !(['status','address','note'].include? signup_field.field_name) %>
*
<% end %>
<%= signup_field['name'][I18n.locale] %>
</label>
<% if signup_field.field_name == 'status' %>
<div class="col-sm-10">
<% if @venue_management.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('venue_management.registration_status_G') %>
</label>
<% end %>
<% if @venue_management.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@venue_management.registration_status.count == 1 and @venue_management.registration_status.include?('C') ? true : false) %> <%= t('venue_management.registration_status_C') %>
</label>
<% end %>
</div>
<% elsif signup_field.field_name == 'unit' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>">
<%= f.fields_for "unit_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@venue_management_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#unit_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'address' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>">
<%= f.fields_for "address_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@venue_management_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#address_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> <a href="#" onclick="window.open(' <%= OrbitHelper.url_to_show(@venue_management.to_param) %>?method=check_email&no=<%=@venue_management.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
</div>
<% elsif signup_field.field_name == 'note' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
<%= f.fields_for "note_translations".to_sym do |f| %>
<%= f.text_area locale, rows: 5, :class=>"input-medium form-control", :value => (@venue_management_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% else %>
<div class="col-sm-10">
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
</div>
<% end %>
</div>
<% end %>
<% end %>
<% else %>
<div class="form-group">
<label for="status" class="col-sm-2 control-label"><%= t('venue_management.registration_status') %></label>
<div class="col-sm-10">
<% if @venue_management.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('venue_management.registration_status_G') %>
</label>
<% end %>
<% if @venue_management.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@venue_management.registration_status.count == 1 and @venue_management.registration_status.include?('C') ? true : false) %> <%= t('venue_management.registration_status_C') %>
</label>
<% end %>
</div>
</div>
<div>
<div class="col-sm-12" style="text-align: center;"> *(<%= t('venue_management.required') %>) </div>
</div>
<!-- Name to Last Name -->
<div class="form-group">
<label for="name" class="col-sm-2 control-label">*<%= t('venue_management_signup.name') %></label>
<div class="col-sm-10">
<%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('venue_management_signup.name'), :required => true %>
</div>
</div>
<!-- Tel to First Name -->
<div class="form-group">
<label for="tel" class="col-sm-2 control-label">*<%= t('venue_management_signup.tel') %></label>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('venue_management_signup.tel'), :required => true %>
</div>
</div>
<!-- Email -->
<div class="form-group">
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= OrbitHelper.url_to_show(@venue_management.to_param) %>?method=check_email&no=<%=@venue_management.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
</div>
</div>
<div class="form-group <%= @venue_management.registration_status[0] == 'C' ? '' : 'hide' %>" id="registration_status">
<label for="password" class="col-sm-2 control-label">*<%= t('venue_management_signup.password') %></label>
<div class="col-sm-10">
<%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('venue_management_signup.password') %>
<%= t('venue_management_signup.password_message') %>
</div>
</div>
<% end %>
<% @venue_management.venue_management_signup_fields.asc(:_id).each do |rf| %>
<div class="form-group">
<%= rf.block_helper(@venue_management,@form_index,false,"venue_management_signup",@venue_management_signup, rf.to_require) %>
</div>
<% @form_index = @form_index +1 %>
<% end %>
<!-- 驗證碼 -->
<% if @venue_management.venue_management_signup_field_sets.count != 0 %>
<% if !(@venue_management.venue_management_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('venue_management_signup.recaptcha') %></label>
<div class="col-sm-10">
<%= gotcha_error %>
<%= gotcha %>
</div>
</div>
<% end %>
<% end %>
<!-- <div class="form-group">
<label for="note" class="col-sm-2 control-label"><%#= t('nkuht_donate.recaptcha') %></label>
<div class="col-sm-10">
<%#= show_simple_captcha %>
</div>
</div> -->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<label>
<input id="agree" name="agree" value="1" type="checkbox" required="required">
<a href="<%= OrbitHelper.url_to_show(@venue_management.to_param) %>?method=show_privacy" target="_blank"><%= t("venue_management_signup.agree")%></a>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last %>">
<input type="hidden" name="venue_management_signup[venue_management_main_id]" value="<%= @venue_management.id %>">
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
</div>
</div>
</fieldset>
<% end %>
<script type="text/javascript">
(function(){
var validated = false,
chks = false,
pwd = $('#venue_management_signup_password')
$("form.content").submit(function(event) {
if ($('#venue_management_signup_status_c:checked').val() == 'C'){
if (pwd.val() == ''){
pwd.attr('required', true);
pwd.focus();
alert( '<%= t('venue_management_signup.password') %>' + ' is required');
return false;
}
}
<%
@venue_management.venue_management_signup_fields.asc(:_id).each do |rf|
if rf.markup == 'checkbox'
%>
var checkedCount = $("input[type=checkbox][id^=venue_management_signup_values_<%= rf.id %>]:checked").length;
if (checkedCount == 0){
alert( '<%= rf.title %>' + ' is required');
return false;
}
<%
end
end
%>
var form = $(this),
isChecked = $('#agree:checked').val()?true:false;
if(!isChecked){
return false;
}
});
$(".availibility").blur(function(){
var type = $(this).attr("id"),
loader = $(this).parent().find('.loader'),
elem = $(this),
value = $(this).val() || null;
var checkAvailability = function(){
$.ajax({
url : "<%= "#{OrbitHelper.url_to_show(@venue_management.to_param)}?method=check_availability&no=#{@venue_management.id}" %>",
data : {"type" : type, "value" : value},
dataType : "json",
type : "get",
success : function(data){
if( data.success == true ){
alert("1tttt");
}else{
alert("1ssss2");
}
}
})
}
if( value ){
if(type == "venue_management_signup_email"){
checkAvailability();
}
}
})
})();
</script>
<% elsif @venue_management.registration_status.blank? %>
<%= t('venue_management.sign_up_not_open') %>
<% elsif @venue_management.signup_start_date > @time_now %>
<%= t('venue_management.sign_up_not_yet') %>
<% else %>
<%= t('venue_management.sign_up_overdue') %>
<% end %>
<% rescue Exception => e %>
<%= e.inspect %>
<%= e.backtrace %>
<%end %>

View File

@ -0,0 +1,92 @@
<% # encoding: utf-8 %>
<% @@session = session %>
<%= yield %>
<%
data = action_data
@venue_management = data["venue_management"]
@sign_up = data["sign_up"]
@sign_up_time_range = data["sign_up_time_range"]
@venue_management_time_range = data["venue_management_time_range"]
@contribute_time_range = data["contribute_time_range"]
@contribute_action = data["contribute_action"]
%>
<table class="table table-striped venue_managementive-show-table">
<tbody >
<tr>
<th class="venue_managementive-title-field"><%= t(:category) %></th>
<td class="venue_managementive-title-value"><%= @venue_management.category.title %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('venue_management.event_during') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_time_range %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.title') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.title %></td>
</tr>
<% if !@venue_management.speaker.blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.speaker') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.speaker %></td>
</tr>
<% end %>
<% if !@venue_management.content.blank? %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.content') %></th>
<td class="venue_managementive-title-value"><%= nl2br(@venue_management.content) %></td>
</tr>
<% end %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('venue_management.signup_during') %></th>
<td class="venue_managementive-title-value"><%= @sign_up_time_range %></td>
</tr>
<% if !@contribute_time_range.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('venue_management.contribute_during') %></th>
<td class="venue_managementive-title-value"><%= @contribute_time_range %></td>
</tr>
<% end %>
<tr>
<th class="venue_managementive-title-field"><%= t('venue_management.signup') %></th>
<td class="venue_managementive-title-value"><%= @sign_up %><br /><%= @contribute_action %></td>
</tr>
<% if !@venue_management.act_place.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="icon-flag"></i><%= t('venue_management.act_place') %></th>
<td class="venue_managementive-title-value"><%= @venue_management.act_place %></td>
</tr>
<% end %>
<% if !@venue_management.venue_management_files.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-fw fa-paperclip"></i><%= t(:file_) %></th>
<td class="venue_managementive-title-value">
<% @venue_management.venue_management_files.map do |file| %>
<%= link_to (file.title.blank? ? File.basename(file.file.path) : file.title) , file.file.url, {:target => '_blank', :title => file.description} if file.file.file %>
<% end %>
</td>
</tr>
<% end %>
<% if !@venue_management.venue_management_links.blank? %>
<tr>
<th class="venue_managementive-title-field"><i class="fa fa-fw fa-link"></i><%= t(:link) %></th>
<td class="venue_managementive-title-value">
<% @venue_management.venue_management_links.map do |link| %>
<%= link_to (link.title.blank? ? link.url : link.title), link.url, :target => '_blank' %>
<% end %>
</td>
</tr>
<% end %>
<% @venue_management.venue_management_item_contents.asc(:_id).each do |item_content| %>
<tr>
<th class="venue_managementive-title-field"><%= item_content.venue_management_item.title %></th>
<td class="venue_managementive-title-value"><%= item_content.content.html_safe %></td>
</tr>
<% end %>
</tbody>
</table>
<br />
<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %>

View File

@ -0,0 +1,28 @@
<% # encoding: utf-8 %>
<%
data = action_data
@venue_management_agreement = data["venue_management_agreement"]
%>
<style type="text/css">
.highlight {
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 4px;
margin-bottom: 14px;
padding: 9px 14px;
}
</style>
<h3><%= t('venue_management_signup.privacy_statement') %></h3>
<div class="highlight venue_management_privacy">
<%= @venue_management_agreement.content.html_safe %>
</div>
<br />
<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %>

View File

@ -0,0 +1,12 @@
<% # encoding: utf-8 %>
<%
data = action_data
%>
<%= t('venue_management_signup.success_message') %>
<% if !params['status'].nil? %>
<br>
<a href="<%= OrbitHelper.url_to_show(params[:slug]) %>?method=con_login">
<%= t('venue_management.click_to_contribute') %>
</a>
<% end %>

18
bin/rails Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/venue_management/engine', __FILE__)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
# require 'rails/all'
# require 'rails/engine/commands'
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
require 'rails/engine/commands'
require "mongoid/railtie"

139
config/locales/en.yml Normal file
View File

@ -0,0 +1,139 @@
en:
simple_captcha:
placeholder: ""
label: ""
restful_actions:
act_signup: Sign Up Info #報名資料
venue_management_submission_field: VenueManagement Submission Field
venue_management_signup_field: VenueManagement Signup Field
venue_management_signup: Signup Analyze
module_name:
venue_management: Outsourced Venue Management #場地管理系統
recaptcha:
errors:
verification_failed: Verification Failed #驗證碼錯誤
venue_management:
manager: Manager
contractor: Contractor
land_number: Land number
area: Area
land_zoning: Land zoning
coordinator: Coordinator
email_signup_success: Contract end date reminder
email_submission_success: Inviting end date reminder
email_add_file_success: Add file success
email_edit_file_success: Edit file success
email_signup_content: Contract end date reminder
email_submission_content: Inviting end date reminder
email_add_file_content: Add file success
email_edit_file_content: Edit file success
email_title: Title
email_content: Content
email_signup: Contract end date reminder
email_submission: Inviting end date reminder
email_edit_file: Edit file
email_add_file: Add file
auto_send_email_set: Auto send email setting
click_to_contribute: Click here to contribute
required: Required
already_used: Already Used
please_enter_email: Please enter email
available: Available
close_window: Close window
custom_set: Custom Set
field_name: Field Name
placeholder: Placeholder
name: Show Name
disable: Disable
hidden: Hidden(admin)
submission_set: Submission Set
signup_set: Signup Set
reviewer: Reviewer #審查委員
review_end_date: Review End Date #審查結束日期
review_start_date: Review Start Date #審查開始日期
review: Reveiw #審稿
blank_no_limit: Allow Blank Value #空白無限制
export_csv: Export CSV #匯出CSV
recaptcha: Recaptcha #驗證碼
yes_: Yes #是
no_: No #否
venue_management: VenueManagement #場地管理系統
title: Venue title
speaker: Address
content: Content #內容說明
act_place: Announced land values
registration_status: Attendee Role #報名身分
registration_status_C: Contributor #投稿者
registration_status_G: Attendee #Normal sign up #一般報名
venue_management_start_date: Current contract start date
venue_management_end_date: Current contract end date
signup_start_date: Start Date
signup_end_date: End Date
contribute_start_date: Contribute Start Date #投稿開始時間
contribute_end_date: Contirbute End Date #投稿結束時間
event_during: Current contract period #活動期間
contribute_during: Contribute During #投稿期間
signup_during: Inviting contractor period #報名期間
signup_count: Contract history #報名人數
inviting_hostory: Inviting history
memorabilia: Memorabilia
signup: Inviting Contractor
export: Export #匯出
set_venue_management_items: Items #項目
set_venue_management_submission_field: Set Submission Field
set_venue_management_signup_field: Set Sign Up Field #圈選設定
set_venue_management_item_content: Set Item Content #項目設定
set_venue_management_agreements: Personal Data Usage Agreements #個資宣告設定
venue_management_agreements_content: Content of Personal Data Usage Agreements #個資宣告內容
to_require: Should Be Filled? #是否必填
sign_up_not_yet: Does Not Yet Allow Sign Up #報名時間未開始
sign_up_not_open: Does Not Open Sign Up #未開放報名
sign_up_overdue: Sign Up Overdue #報名時間已過
contribute_file_count: Count of Contribute Files #投稿檔案數
frontend:
venue_management: Semianr #場地管理系統前台
venue_management_item:
new_item: New Item #新增項目
edit_item: Edit Item #編輯項目
set_item: Set Item #設定項目
del_item: Delete Item #刪除項目
venue_management_item_content:
content: Content #內容
venue_management_signup:
status: Attendee Role
title: File Name
description: Summary
file: Files
signup_time: Sign Up Time #報名時間
name: Name
unit: Unit #單位
tel: Tel
phone: Mobile telephone
fax: Fax
address: Address #地址
email: Email #e-mail信箱
password: Password #密碼
password_message: '( This password is for uploading file when contributing. )'
note: Note #註解
time: 'Start / End Time' #(開始/結束)時間
place: Place #地點
agree: "Accept Privacy and Personal Information Protection Policy of the Site"
privacy_statement: 'Privacy and Personal Information Protection Policy of the Site'
recaptcha: Verification code
signup_field: Sign Up Field #圈選項目
uploads: Uploads #上傳檔案
con_login: Contributor Login #投稿者登入
file_name: File Name #稿件名稱
file_note: Summary #摘要
files: Files #檔案
logout: Log Out #登出
logouting: Logging Out #登出中
success_message: 'Registration successful, thank you.'

139
config/locales/zh_tw.yml Normal file
View File

@ -0,0 +1,139 @@
zh_tw:
simple_captcha:
placeholder: ""
label: ""
restful_actions:
act_signup: 報名資料
venue_management_submission_field: 上傳介面欄位
venue_management_signup_field: 報名欄位
venue_management_signup: 報名統計
module_name:
venue_management: 場地管理系統
recaptcha:
errors:
verification_failed: 驗證碼錯誤
venue_management:
manager: 管理人
contractor: 廠商
land_number: 地號
area: 面積
land_zoning: 土地使用分區
coordinator: 承辦人
email_signup_success: 履約期限
email_submission_success: 招商期限
email_add_file_success: 新增上傳成功
email_edit_file_success: 編輯上傳成功
email_signup_content: 履約期限
email_submission_content: 招商期限
email_add_file_content: 新增上傳成功
email_edit_file_content: 編輯上傳成功
email_title: 主旨
email_content: 內文
email_signup: 履約期限
email_submission: 招商期限
email_edit_file: 編輯上傳
email_add_file: 新增上傳
auto_send_email_set: 自動發信設定
click_to_contribute: 按此登入投稿
required: 必填
already_used: 已存在
please_enter_email: 請輸入Email
available: 可使用
close_window: 關閉視窗
custom_set: 客製化欄位設定
field_name: 欄位名稱
placeholder: 提示文字
name: 顯示名稱
disable: 關閉
hidden: 隱藏(後台)
submission_set: 投稿欄位設定
signup_set: 報名欄位設定
reviewer: 審查委員
review_end_date: 審查結束日期
review_start_date: 審查開始日期
review: 審稿
blank_no_limit: 空白無限制
export_csv: 匯出CSV
recaptcha: 驗證碼
yes_:
no_:
venue_management: 場地管理系統
title: 場地名稱
speaker: 地址
content: 內容說明
act_place: 公告地價
registration_status: 報名身分
registration_status_C: 投稿者
registration_status_G: 一般報名
venue_management_start_date: 合約開始時間
venue_management_end_date: 合約結束時間
signup_start_date: 招商開始日期
signup_end_date: 招商結束日期
contribute_start_date: 投稿開始時間
contribute_end_date: 投稿結束時間
event_during: 合約期間
contribute_during: 投稿期間
signup_during: 招商期間
signup_count: 履約紀錄
inviting_hostory: 招商公告
memorabilia: 大事記
signup: 招商
export: 匯出
set_venue_management_items: 項目
set_venue_management_submission_field: 上傳介面欄位設定
set_venue_management_signup_field: 圈選設定
set_venue_management_item_content: 項目設定
set_venue_management_agreements: 個資宣告設定
venue_management_agreements_content: 個資宣告內容
to_require: 是否必填
sign_up_not_yet: 報名時間未開始
sign_up_not_open: 未開放報名
sign_up_overdue: 報名時間已過
contribute_file_count: 投稿檔案數
frontend:
venue_management: 場地管理系統前台
venue_management_item:
new_item: 新增項目
edit_item: 編輯項目
set_item: 設定項目
del_item: 刪除項目
venue_management_item_content:
content: 內容
venue_management_signup:
status: 報名身分
title: 稿件名稱
description: 摘要
file: 檔案
signup_time: 報名時間
name: 姓名
unit: 單位
tel: 聯絡電話
phone: 行動電話
fax: 傳真
address: 地址
email: e-mail信箱
password: 密碼
password_message: '( 此密碼為下次投稿上傳檔案時必須輸入的密碼。 )'
note: 註解
time: (開始/結束)時間
place: 地點
agree: 同意接受本站個資及隱私權保護宣告
privacy_statement: '個資及隱私權保護宣告'
recaptcha: 驗證碼
signup_field: 圈選項目
uploads: 上傳檔案
con_login: 投稿者登入
file_name: 稿件名稱
file_note: 摘要
files: 檔案
logout: 登出
logouting: 登出中
success_message: '您的報名已成功,感謝您的參與。'

40
config/routes.rb Normal file
View File

@ -0,0 +1,40 @@
Rails.application.routes.draw do
locales = Site.first.in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do
resources :venue_managements do
member do
get 'export'
get 'set_write_off'
get 'venue_management_signup'
get 'venue_management_item_content'
get 'venue_management_signup_field'
get 'venue_management_submission_field'
end
end
resources :venue_management_items do
collection do
post 'delete_items'
end
end
resources :venue_management_agreements
resources :venue_management_signups
resources :venue_management_item_contents
end
resources :venue_managements do
collection do
get ':slug_title-:uid', to: 'venue_managements#show'
post 'con_login_proc', to: 'venue_managements#con_login_proc'
post 'con_logout_proc', to: 'venue_managements#con_logout_proc'
post 'add_file_proc', to: 'venue_managements#add_file_proc'
post 'edit_file_proc', to: 'venue_managements#edit_file_proc'
post 'del_file', to: 'venue_managements#del_file'
end
end
end
end

View File

@ -0,0 +1,4 @@
# desc "Explaining what the task does"
# task :venue_management do
# # Task goes here
# end

4
lib/venue_management.rb Normal file
View File

@ -0,0 +1,4 @@
require "venue_management/engine"
module VenueManagement
end

View File

@ -0,0 +1,50 @@
module VenueManagement
class Engine < ::Rails::Engine
initializer "venue_management" do
OrbitApp.registration "VenueManagement", :type => "ModuleApp" do
module_label "venue_management.venue_management"
base_url File.expand_path File.dirname(__FILE__)
authorizable
categorizable
frontend_enabled
data_count 1..20
side_bar do
head_label_i18n 'venue_management.venue_management', icon_class: "icon-globe"
available_for "managers"
active_for_controllers (['admin/venue_managements'])
head_link_path "admin_venue_managements_path"
context_link 'list_',
:link_path=>"admin_venue_managements_path" ,
:priority=>1,
:active_for_action=>{'admin/venue_managements'=>'index'},
:available_for => 'managers'
context_link 'new_',
:link_path=>"new_admin_venue_management_path" ,
:priority=>2,
:active_for_action=>{'admin/venue_managements'=>'new'},
:available_for => 'managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'venue_management').id}",
:priority=>3,
:active_for_action=>{'admin/venue_managements'=>'categories'},
:active_for_category => 'VenueManagement',
:available_for => 'managers'
context_link 'venue_management.set_venue_management_items',
:link_path=>"admin_venue_management_items_path" ,
:priority=>3,
:active_for_action=>{'admin/venue_managements'=>'venue_management_items'},
:available_for => 'managers'
context_link 'venue_management.set_venue_management_agreements',
:link_path=>"admin_venue_management_agreements_path" ,
:priority=>3,
:active_for_action=>{'admin/venue_managements'=>'venue_management_agreements'},
:available_for => 'managers'
end
end
end
end
end

View File

@ -0,0 +1,3 @@
module VenueManagement
VERSION = "0.0.1"
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class VenueManagementControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

28
test/dummy/README.rdoc Normal file
View File

@ -0,0 +1,28 @@
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.

6
test/dummy/Rakefile Normal file
View File

@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks

View File

View File

@ -0,0 +1,13 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require_tree .

View File

@ -0,0 +1,15 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/

View File

@ -0,0 +1,5 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end

View File

@ -0,0 +1,2 @@
module ApplicationHelper
end

View File

View File

Some files were not shown because too many files have changed in this diff Show More