-
-
-
-
-
-
-
- <%= form_for :seminar_item, url: nil, remote: true do |f| %>
-
- <% end %>
-
-
- diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 1950993..0000000 --- a/Gemfile +++ /dev/null @@ -1,14 +0,0 @@ -source "https://rubygems.org" - -# Declare your gem's dependencies in seminar.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' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 305eb37..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,87 +0,0 @@ -PATH - remote: . - specs: - seminar (0.0.1) - rails (~> 4.1.9) - -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) - mail (~> 2.5, >= 2.5.4) - actionpack (4.1.9) - actionview (= 4.1.9) - activesupport (= 4.1.9) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.9) - activesupport (= 4.1.9) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.9) - activesupport (= 4.1.9) - builder (~> 3.1) - activerecord (4.1.9) - activemodel (= 4.1.9) - activesupport (= 4.1.9) - arel (~> 5.0.0) - activesupport (4.1.9) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - arel (5.0.1.20140414130214) - builder (3.2.2) - erubis (2.7.0) - hike (1.2.3) - i18n (0.7.0) - json (1.8.2) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.4.3) - minitest (5.5.1) - multi_json (1.10.1) - rack (1.5.2) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.1.9) - actionmailer (= 4.1.9) - actionpack (= 4.1.9) - actionview (= 4.1.9) - activemodel (= 4.1.9) - activerecord (= 4.1.9) - activesupport (= 4.1.9) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.9) - sprockets-rails (~> 2.0) - railties (4.1.9) - actionpack (= 4.1.9) - activesupport (= 4.1.9) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - sprockets (2.12.3) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.4) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.10) - thor (0.19.1) - thread_safe (0.3.4) - tilt (1.4.1) - tzinfo (1.2.2) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - seminar! - sqlite3 diff --git a/MIT-LICENSE b/MIT-LICENSE deleted file mode 100644 index 1e4beb8..0000000 --- a/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -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. diff --git a/README.rdoc b/README.rdoc deleted file mode 100644 index 53399c4..0000000 --- a/README.rdoc +++ /dev/null @@ -1,3 +0,0 @@ -= Seminar - -This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/Rakefile b/Rakefile deleted file mode 100644 index d4cf079..0000000 --- a/Rakefile +++ /dev/null @@ -1,32 +0,0 @@ -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 = 'Seminar' - 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 diff --git a/app/assets/javascripts/check_seminar_set_items.js.erb b/app/assets/javascripts/check_seminar_set_items.js.erb deleted file mode 100755 index bc793f5..0000000 --- a/app/assets/javascripts/check_seminar_set_items.js.erb +++ /dev/null @@ -1,78 +0,0 @@ -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_seminar_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_seminar_items .tags-groups').empty(); - $('#delete_seminar_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_seminar_items .tags-groups'); - $('#delete_seminar_items .tags-groups .filter-item').addClass('def'); - }); - } - - $('#delete_seminar_items').modal('show', cleanTagInputs()); - function cleanTagInputs(){ - var $tagsDelete = $('#delete_seminar_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(); -}); diff --git a/app/assets/javascripts/field-forms-submission.js b/app/assets/javascripts/field-forms-submission.js deleted file mode 100644 index c64b9fc..0000000 --- a/app/assets/javascripts/field-forms-submission.js +++ /dev/null @@ -1,494 +0,0 @@ -// 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[seminar_submission_fields]" : $('#sub_seminar_main').length ? "sub_seminar_main[seminar_submission_fields]" : "seminar_main[seminar_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 = []; - seminar_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 seminar_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",seminar_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]; - seminar_mainType = $(this).data('seminar_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(); - }; - } - }); - }); - } -}); \ No newline at end of file diff --git a/app/assets/javascripts/field-forms.js b/app/assets/javascripts/field-forms.js deleted file mode 100644 index 1c62186..0000000 --- a/app/assets/javascripts/field-forms.js +++ /dev/null @@ -1,494 +0,0 @@ -// 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[seminar_signup_fields]" : $('#sub_seminar_main').length ? "sub_seminar_main[seminar_signup_fields]" : "seminar_main[seminar_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 = []; - seminar_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 seminar_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",seminar_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]; - seminar_mainType = $(this).data('seminar_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(); - }; - } - }); - }); - } -}); \ No newline at end of file diff --git a/app/assets/javascripts/seminar.js.coffee b/app/assets/javascripts/seminar.js.coffee deleted file mode 100644 index 24f83d1..0000000 --- a/app/assets/javascripts/seminar.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# 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/ diff --git a/app/assets/javascripts/seminar_sets.js b/app/assets/javascripts/seminar_sets.js deleted file mode 100644 index 92be5b3..0000000 --- a/app/assets/javascripts/seminar_sets.js +++ /dev/null @@ -1,29 +0,0 @@ -$(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'); - } - - }); -}) \ No newline at end of file diff --git a/app/assets/stylesheets/seminar.css b/app/assets/stylesheets/seminar.css deleted file mode 100644 index cb2b874..0000000 --- a/app/assets/stylesheets/seminar.css +++ /dev/null @@ -1,18 +0,0 @@ -@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; - } - } - } -} \ No newline at end of file diff --git a/app/assets/stylesheets/seminar_sets.css b/app/assets/stylesheets/seminar_sets.css deleted file mode 100644 index 16aacf9..0000000 --- a/app/assets/stylesheets/seminar_sets.css +++ /dev/null @@ -1,3 +0,0 @@ -/* - *= require lib/tags-groups -*/ \ No newline at end of file diff --git a/app/controllers/admin/seminar_agreements_controller.rb b/app/controllers/admin/seminar_agreements_controller.rb deleted file mode 100644 index fdca660..0000000 --- a/app/controllers/admin/seminar_agreements_controller.rb +++ /dev/null @@ -1,20 +0,0 @@ -class Admin::SeminarAgreementsController < OrbitAdminController - - def initialize - super - @app_title = 'seminar' - end - - def index - @seminar_agreement = SeminarAgreement.first || SeminarAgreement.create - @url = admin_seminar_agreement_path(@seminar_agreement) - end - - def update - @seminar_agreement = SeminarAgreement.first - @seminar_agreement.update_attributes(params.require(:seminar_agreement).permit!) - - redirect_to admin_seminar_agreements_path, notice: t('seminar.save_success') - end - -end diff --git a/app/controllers/admin/seminar_item_contents_controller.rb b/app/controllers/admin/seminar_item_contents_controller.rb deleted file mode 100644 index a445fb4..0000000 --- a/app/controllers/admin/seminar_item_contents_controller.rb +++ /dev/null @@ -1,70 +0,0 @@ -# encoding: utf-8 -class Admin::SeminarItemContentsController < OrbitAdminController - - before_action ->(module_app = @app_title) { set_variables module_app } - - def initialize - super - @app_title = "seminar" - end - - def index - - @seminar_item_contents = SeminarItemContent.where(:seminar_main_id => params[:seminar_main_id]).page(params[:page]).per(10) - @seminar = SeminarMain.find(params[:seminar_main_id]) - - @seminar_items = SeminarItem.where(:_id.nin=> SeminarItemContent.where(:seminar_main_id => params[:seminar_main_id]).collect{|t| t.seminar_item_id} ).collect{|a| [a.title,a.id]} - end - - def new - - @contents = SeminarItemContent.where(:seminar_main_id => params[:seminar_main_id]).collect{|t| t.seminar_item_id} - @seminar_item_content = SeminarItemContent.new - - @seminar_items = SeminarItem.where(:_id.nin=> @contents).collect{|a| [a.title,a.id]} - - end - - def create - - seminar_item_content = SeminarItemContent.new(seminar_item_content_params) - - seminar_item_content.create_user_id = current_user.id - seminar_item_content.update_user_id = current_user.id - - seminar_item_content.save - - redirect_to params['referer_url']+"?seminar_main_id="+seminar_item_content.seminar_main_id - - end - - def edit - - @seminar_item_content = SeminarItemContent.find(params[:id]) - @seminar = SeminarMain.find(@seminar_item_content.seminar_main_id) - - end - - def update - - @seminar_item_content = SeminarItemContent.find(params[:id]) - @seminar_item_content.update_attributes(seminar_item_content_params) - - redirect_to "/admin/seminar_item_contents?seminar_main_id="+@seminar_item_content.seminar_main_id - - end - - def destroy - @seminar_item_content = SeminarItemContent.find(params[:id]) - - @seminar_item_content.destroy - - redirect_to "/admin/seminar_item_contents?seminar_main_id="+@seminar_item_content.seminar_main_id - end - - private - - def seminar_item_content_params - params.require(:seminar_item_content).permit! - end -end diff --git a/app/controllers/admin/seminar_items_controller.rb b/app/controllers/admin/seminar_items_controller.rb deleted file mode 100644 index d376fcf..0000000 --- a/app/controllers/admin/seminar_items_controller.rb +++ /dev/null @@ -1,52 +0,0 @@ -class Admin::SeminarItemsController < OrbitAdminController - - def initialize - super - @app_title = 'seminar' - end - - def index - @seminar_items = SeminarItem.all - @url = admin_seminar_item_path(@seminar_items) - end - - def create - @seminar_item = SeminarItem.new(seminar_item_params) - @seminar_item.save - redirect_to request.referer, :status => 303 - end - - def create_in_form - @seminar_item = SeminarItem.new(seminar_item_params) - @seminar_item.saveseminar_item - render :json => {:id=>@seminar_item.id.to_s, :title=>@seminar_item.title}.to_json ,:layout => false - end - - def update - @seminar_item = SeminarItem.find(params[:id]) - @seminar_item.update_attributes(seminar_item_params) - redirect_to request.referer, :status => 303 - end - - def toggle - @seminar_item = SeminarItem.find(params[:id]) - @seminar_item.save! - redirect_to request.referer, :status => 303 - end - - def delete_items - items = SeminarItem.find(params[:ids].split(',')) rescue nil - if items - items.each(&:destroy) - end - redirect_to request.referer, :status => 303 - end - - - private - - def seminar_item_params - params.require(:seminar_item).permit! - end - -end diff --git a/app/controllers/admin/seminar_signups_controller.rb b/app/controllers/admin/seminar_signups_controller.rb deleted file mode 100644 index 5f1e989..0000000 --- a/app/controllers/admin/seminar_signups_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -# encoding: utf-8 -class Admin::SeminarSignupsController < OrbitAdminController - include Admin::SeminarsHelper - before_action ->(module_app = @app_title) { set_variables module_app } - - def initialize - super - @app_title = "seminar" - end - - def edit - OrbitHelper.set_params(params,current_user) - params[:controller] = "admin/seminars" - - @seminar_signup = SeminarSignup.find(params[:id]) - @seminar = SeminarMain.find(@seminar_signup.seminar_main_id) - - @form_index = 0 - - end - - def update - - @seminar_signup = SeminarSignup.find(params[:id]) - @seminar_signup.update_attributes(seminar_signup_params) - - if !params[:seminar_signup_values].nil? - params[:seminar_signup_values].each_with_index do |r,i| - field_value = r.last[:id].present? - @custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:id], field_value) - end - end - - redirect_to "/admin/seminars/#{@seminar_signup.seminar_main_id}/seminar_signup" - - end - - def destroy - @seminar_signup = SeminarSignup.find(params[:id]) - - @seminar_main_id = @seminar_signup.seminar_main_id - - @seminar_signup.destroy - - redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup" - end - - private - - def seminar_signup_params - params.require(:seminar_signup).permit! - end -end diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb deleted file mode 100644 index ad7f4c9..0000000 --- a/app/controllers/admin/seminars_controller.rb +++ /dev/null @@ -1,340 +0,0 @@ -# encoding: utf-8 -class Admin::SeminarsController < OrbitAdminController - - require 'axlsx' - helper Admin::SeminarsFieldHelper - before_action ->(module_app = @app_title) { set_variables module_app } - before_action :set_seminar, only: [:edit, :set_write_off, :seminar_signup, :destroy] - - def initialize - super - @app_title = "seminar" - 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, 'seminar.title', 'seminar.event_during', 'seminar.signup_during', 'seminar.signup_count', 'seminar.export'] - - if !params[:sort].blank? - if params[:sort] == 'event_during' - sort = {:seminar_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 - - @seminars = SeminarMain.all.order_by(sort).with_categories(filters("category")) - - @seminars = search_data(@seminars,[:title]).page(params[:page]).per(10) - - if request.xhr? - render :partial => "index" - end - - end - - def export - - @seminar = SeminarMain.find(params[:id]) - @seminar_signups = SeminarSignup.where(:seminar_main_id => params[:id]) - filename = @seminar.title.parameterize.underscore + "_export.xlsx" - respond_to do |format| - format.xlsx { - response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"' - } - end - - end - - def new - @member = nil - @seminar = SeminarMain.new - create_set (false) - @signup_sets = @seminar.seminar_signup_field_sets - @submission_set = @seminar.seminar_submission_field_sets - @custom_set = @seminar.seminar_signup_field_customs - @seminar_items = SeminarItem.all - @review = @seminar.seminar_reviews.new() - end - - def create - - if !seminar_params['seminar_links_attributes'].nil? - seminar_params['seminar_links_attributes'].each do |idx,link| - seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank? - end - end - seminar_main_params = seminar_params - seminar_signup_set_params = seminar_main_params['seminar_signup_field_sets'] - seminar_submission_set_params = seminar_main_params['seminar_submission_field_sets'] - seminar_email_sets_params = seminar_main_params['seminar_email_sets'] - seminar_main_params.delete(:seminar_signup_field_sets) - seminar_main_params.delete(:seminar_submission_field_sets) - seminar_main_params.delete(:seminar_email_sets) - seminar = SeminarMain.new(seminar_main_params) - seminar.create_user_id = current_user.id - seminar.update_user_id = current_user.id - seminar.save - seminar_signup_set_params.each do |key,value| - seminar.seminar_signup_field_sets.create(value) - end - seminar_submission_set_params.each do |key,value| - seminar.seminar_submission_field_sets.create(value) - end - seminar_email_sets_params.each do |key,value| - seminar.seminar_email_sets.create(value) - end - redirect_to params['referer_url'] - - end - - def edit - @seminar_items = SeminarItem.all - @seminar = SeminarMain.where(id: params[:id]).first - @seminar.seminar_signup_field_sets.each do |signup_field_set| - if !(SeminarSignup.attribute_names.include? signup_field_set.field_name) && signup_field_set.field_name != 'recaptcha' - signup_field_set.delete - end - end - @seminar.seminar_submission_field_sets.each do |submission_field_set| - if !(SeminarSignupContribute.attribute_names.include? submission_field_set.field_name) - submission_field_set.delete - end - end - @seminar.seminar_signup_field_customs.each do |custom_set| - if !(@seminar.seminar_signup_fields.collect(&:id).include? custom_set.seminar_signup_field_id) - custom_set.delete - end - end - create_set (true) - @signup_sets = @seminar.seminar_signup_field_sets - @submission_set = @seminar.seminar_submission_field_sets - @custom_set = @seminar.seminar_signup_field_customs - if @seminar.seminar_reviews.first.nil? - @review = @seminar.seminar_reviews.new() - else - @review = @seminar.seminar_reviews.first - end - @member = MemberProfile.find(@review.reviewer_id) rescue nil - end - - def update - - - params[:seminar_main][:registration_status] = (params[:seminar_main][:registration_status] ? params[:seminar_main][:registration_status] : []) - - uid = params[:id].split('-').last - @seminar = SeminarMain.find_by(:uid=>uid) - - if params[:seminar_main][:seminar_signup_fields] - seminar_params[:seminar_signup_fields].each do |a| - @field_name = 'seminar_main' - field_status = a.last[:id].present? - @attribute_field = SeminarSignupField.add_seminar_signup_field(@seminar, a.last, a.last[:id], field_status) - @attribute = @seminar - end - flash.now[:notice] = "Updated Fields" - @seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true} - - redirect_to admin_seminars_path - elsif params[:seminar_main][:seminar_submission_fields] - params[:seminar_main][:seminar_submission_fields].each do |a| - @field_name = 'seminar_main' - field_status = a.last[:id].present? - @attribute_field = SeminarSubmissionField.add_seminar_signup_field(@seminar, a.last, a.last[:id], field_status) - @attribute = @seminar - end - flash.now[:notice] = "Updated Fields" - @seminar.seminar_submission_fields.each{|t| t.destroy if t["to_delete"] == true} - redirect_to admin_seminars_path - else - - if !seminar_params['seminar_links_attributes'].nil? - seminar_params['seminar_links_attributes'].each do |idx,link| - seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank? - end - end - - @seminar.update_user_id = current_user.id - if @seminar.update_attributes(seminar_params) - @seminar.seminar_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 - - @seminar.donation_write_off_status = true - @seminar.save - - redirect_to "/admin/seminars?page=#{params['page']}" - - end - - def destroy - - @seminar.destroy - redirect_to "/admin/seminars" - - end - - def seminar_signup_field - @field_name = 'seminar_main' - @attribute = SeminarMain.find(params[:id]) - @attribute_type = 'seminar' - @class = 'seminars' - end - - def seminar_submission_field - @field_name = 'seminar_main' - @attribute = SeminarMain.find(params[:id]) - @attribute_type = 'seminar' - @class = 'seminars' - end - - def seminar_signup - - if !params[:search].blank? - @seminar_signups = SeminarSignup.where(:seminar_main_id => @seminar.id, :name=>params[:search]).page(params[:page]).per(10) - else - @seminar_signups = SeminarSignup.where(:seminar_main_id => @seminar.id).page(params[:page]).per(10) - end - - end - - def edit_seminar_signup - @seminar_signup = SeminarSignup.find(params[:id]) - @seminar = SeminarMain.find(@seminar_signup.seminar_main_id) - end - - def delete_seminar_signup - - @seminar_signup = SeminarSignup.find(params[:id]) - - @seminar_id = @seminar_signup.seminar_main_id - - @seminar_signup.destroy - - redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup" - end - - private - - def set_seminar - @seminar = SeminarMain.find(params[:id]) - end - - def seminar_params - params.require(:seminar_main).permit! - end - def create_set (save_flag) - SeminarSignup.attribute_names.each do |attr_signup| - if !(['_id', 'created_at', 'updated_at','seminar_main_id'].include? attr_signup) - signup_set = @seminar.seminar_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("seminar_signup.#{attr_signup}") - end - I18n.locale = now_locale - if save_flag - @seminar.seminar_signup_field_sets.create(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1) - else - @seminar.seminar_signup_field_sets.new(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1) - end - end - end - end - signup_set = @seminar.seminar_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("seminar_signup.recaptcha") - end - I18n.locale = now_locale - if save_flag - @seminar.seminar_signup_field_sets.create(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true) - else - @seminar.seminar_signup_field_sets.new(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true) - end - end - SeminarSignupContribute.attribute_names.each do |attr_submission| - if !(['_id', 'created_at', 'updated_at','seminar_signup_id'].include? attr_submission) - signup_set = @seminar.seminar_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("seminar_signup.#{attr_submission}") - end - I18n.locale = now_locale - if save_flag - @seminar.seminar_submission_field_sets.create(field_name:attr_submission,name:name1,placeholder:name1) - else - @seminar.seminar_submission_field_sets.new(field_name:attr_submission,name:name1,placeholder:name1) - end - end - end - end - @seminar.seminar_signup_fields.all.map{|v| v}.each do |field| - set = @seminar.seminar_signup_field_customs.select{|v| v.seminar_signup_field_id==field.id} - if set.length == 0 - @seminar.seminar_signup_field_customs.create(seminar_signup_field_id:field.id) - end - end - @email_set = [] - ['signup','submission','add_file','edit_file'].each do |field_name| - email_set = @seminar.seminar_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("seminar.email_#{field_name}_success") - content[locale] = t("seminar.email_#{field_name}_content") - end - I18n.locale = now_locale - if save_flag - email_set = @seminar.seminar_email_sets.create(field_name:field_name,title:title,content:content) - else - email_set = @seminar.seminar_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 diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb deleted file mode 100644 index 968a28d..0000000 --- a/app/controllers/seminars_controller.rb +++ /dev/null @@ -1,401 +0,0 @@ -class SeminarsController < ApplicationController - - helper MemberHelper - include ActionView::Context #vary important (only add this can access @@session from view) - include Admin::SeminarsHelper - # include SimpleCaptcha::ControllerHelpers - def index - - time_now = Time.now - - seminars = SeminarMain.all.desc(:seminar_start_date).filter_by_categories - { - "seminars" => seminars, - 'time_now' => time_now, - "total_pages" => seminars.total_pages - } - - end - - def show_privacy - - params = OrbitHelper.params - - seminar = SeminarMain.where(uid: params[:uid]).first - - seminar_agreement = SeminarAgreement.first - - { - 'seminar' => seminar, - "seminar_agreement" => seminar_agreement - } - - end - - def show_data - - time_now = Time.now - - params = OrbitHelper.params - - seminar = SeminarMain.find_by(uid: params[:uid]) - - if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now ) - sign_up = ('' + t('seminar.signup') + '').html_safe - elsif seminar.registration_status.blank? - sign_up = t('seminar.sign_up_not_open') - elsif seminar.signup_start_date > time_now - sign_up = t('seminar.sign_up_not_yet') - else - sign_up = t('seminar.sign_up_overdue') - end - - if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now ) - if !@@session[:seminar_signup_id].blank? - if @@session[:seminar_main_id] == seminar.id - contribute_action = ('' + t('seminar_signup.uploads') + '').html_safe - else - contribute_action = ('' + t('seminar_signup.con_login') + '').html_safe - end - else - contribute_action = ('' + t('seminar_signup.con_login') + '').html_safe - end - end - - - - { - 'seminar' => seminar, - 'sign_up' => sign_up, - 'contribute_action' => contribute_action, - 'time_now' => time_now, - 'contribute_time_range' => SeminarMain.time_range(seminar.contribute_start_date, seminar.contribute_end_date), - 'sign_up_time_range' => SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date), - 'seminar_time_range' => SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) - } - - end - - def show - - params = OrbitHelper.params - - module_app = ModuleApp.where(:key => "seminar").first - - categories = module_app.categories - - seminar = SeminarMain.where(uid: params[:uid]).first - - seminar_signup = SeminarSignup.new - - time_now = Time.now - { - "seminar" => seminar, - "seminar_signup" => seminar_signup, - "time_now" => time_now - } - - end - - def check_email - - params = OrbitHelper.params - - if !params[:email].blank? - count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count - - result = count > 0 ? t('seminar.already_used') : t('seminar.available') - else - result = t('seminar.please_enter_email') - end - - { - "result" => result - } - - end - - def check_availability - - params = OrbitHelper.params - - response = {} - case params[:type] - when "seminar_signup_email" - - response["success"] = SeminarSignup.where(:email => params[:value], :seminar_main_id => params[:no]).count > 0 ? false : true - end - render :json => response.to_json - end - - def create - - @signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: params[:seminar_signup][:seminar_main_id] ).first - - @seminar_signup = SeminarSignup.new(seminar_signup_params) - @seminar = SeminarMain.where(id:params[:seminar_signup][:seminar_main_id]).first - if @seminar.seminar_signup_field_sets.count!=0 - flag = @seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled - else - flag = false - end - if gotcha_valid? || flag - if @signup.blank? && @seminar_signup.save - # if gotcha_valid? && @seminar_signup.save - - if !params[:seminar_signup_values].nil? - seminar_signup_values_params.each_with_index do |r,i| - field_value = r.last[:id].present? - @custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value) - end - end - if params['seminar_signup']['status']=='C' - status_param = '&status=' - send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id]) - else - status_param = '' - send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_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 = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) - flag = true - update_params.permit! - if !update_params['seminar_submission_values'].nil? - if update_params['seminar_submission_values']['0']['value'].class==String - value = update_params['seminar_submission_values']['0']['value'] - if !value.to_s.blank? - flag = false - end - else - update_params['seminar_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['seminar_submission_values']['0']['value']['en'] = ' ' - end - @con = SeminarSignupContribute.new(update_params) - if @con.save - signup = SeminarSignup.where(id:update_params['seminar_signup_id']).first - seminar_id = signup.seminar_main_id - @seminar = SeminarMain.where(id:seminar_id).first - send_mail('add_file',signup.email,seminar_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 = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id]) - update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) - flag = true - update_params.permit! - if update_params['seminar_submission_values']['0']['value'].class==String - value = update_params['seminar_submission_values']['0']['value'] - if !value.to_s.blank? - flag = false - end - else - update_params['seminar_submission_values']['0']['value'].each do |key,value| - if !value.to_s.blank? - flag = false - end - end - end - - if flag - update_params['seminar_submission_values']['0']['value']['en'] = ' ' - end - @con.update_attributes(update_params) - if @con.save - signup = SeminarSignup.where(id:update_params['seminar_signup_id']).first - seminar_id = signup.seminar_main_id - @seminar = SeminarMain.where(id:seminar_id).first - send_mail('edit_file',signup.email,seminar_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 = SeminarSignupContribute.find(params[:con_no]) - - # seminar_signup = SeminarSignup.find_by(_id: con.seminar_signup_id ) - # seminar = SeminarMain.find_by(_id: seminar_signup.seminar_main_id ) - - con.destroy - - redirect_to "#{params[:referer_url]}/?method=con_upload" - - end - - def add_file - - if !@@session[:seminar_main_id].blank? - - seminar = SeminarMain.find_by(id: @@session[:seminar_main_id]) - seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) - - else - - seminar = {} - seminar_signup = {} - - end - - con = SeminarSignupContribute.new - - { - 'con' => con, - 'seminar' => seminar, - 'seminar_signup' => seminar_signup - } - - end - - def edit_file - - params = OrbitHelper.params - if !@@session[:seminar_main_id].blank? - seminar = SeminarMain.find_by(id: @@session[:seminar_main_id]) - seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) - else - seminar = {} - seminar_signup = {} - end - con = SeminarSignupContribute.find(params[:con_no]) - { - 'con' => con, - 'seminar' => seminar, - 'seminar_signup' => seminar_signup - } - - end - - def con_upload - - time_now = Time.now - - if !@@session[:seminar_main_id].blank? - - seminar = SeminarMain.find_by(id: @@session[:seminar_main_id]) - - seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) - - else - - seminar = {} - seminar_signup = {} - - end - - { - 'time_now' => time_now, - 'seminar' => seminar, - 'seminar_signup' => seminar_signup - } - - end - - def con_logout - - # redirect_to page_for_seminar_url - - end - - def con_login - - time_now = Time.now - - params = OrbitHelper.params - - seminar = SeminarMain.find_by(uid: params[:uid]) - - { - 'seminar' => seminar, - 'time_now' => time_now - } - - end - - def con_login_proc - - seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id]) - - @seminar_signup = SeminarSignup.where(:status=>'C', :email=> params[:user_name], :password => params[:password], :seminar_main_id => params[:seminar_signup][:seminar_main_id]).first - - if !@seminar_signup.blank? - - session[:seminar_signup_id] = @seminar_signup.id - session[:seminar_main_id] = @seminar_signup.seminar_main_id - - redirect_to "#{params[:referer_url]}/?method=con_upload" - else - redirect_to "#{params[:referer_url]}/?method=con_login", :notice => '登入失敗' - end - - end - - def seminar_signup_params - params.require(:seminar_signup).permit! - end - - def seminar_signup_contribute_params - params.require(:seminar_signup_contribute).permit! - end - - def seminar_signup_values_params - params.require(:seminar_signup_values).permit! - end - def send_mail(field_name,email,seminar_id) - email_set = @seminar.seminar_email_sets.select{|v| v.field_name == field_name} - if email_set.length==0 - mail = Email.create(mail_to:[email], - module_app_key:"seminar", - template:"email/#{field_name}_email.html.erb", - mail_sentdate:Time.current, - mail_subject: t("seminar.email_#{field_name}_success"), - template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale}) - elsif !(email_set[0].disabled) - mail = Email.create(mail_to:[email], - module_app_key:"seminar", - template:"email/#{field_name}_email.html.erb", - mail_sentdate:Time.current, - mail_subject: email_set[0].title[I18n.locale], - template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale}) - end - begin - mail.deliver - rescue => e - puts ["email can't deliver",e] - end - end -end diff --git a/app/helpers/admin/seminars_field_helper.rb b/app/helpers/admin/seminars_field_helper.rb deleted file mode 100644 index f3d385c..0000000 --- a/app/helpers/admin/seminars_field_helper.rb +++ /dev/null @@ -1,530 +0,0 @@ -module Admin::SeminarsFieldHelper - - include ActionView::Helpers::FormTagHelper - include ActionView::Helpers::FormOptionsHelper - include ActionView::Helpers::DateHelper - include ActionView::Helpers::TagHelper - include ActionView::Helpers::RenderingHelper - include ActionView::Context - include OrbitBasis::RenderAnywhere - - include OrbitFormHelper - - def block_helper(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.seminar_signup_values.build(seminar_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 seminar_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 - -protected - - 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 - "seminar_signup_values" - end - - def get_basic_field_name - "seminar_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]})" - ""+ - label_tag(key,(!@require.blank? ? '*'+title : title),:class=>"col-sm-2 control-label muted",:style =>'display: contents;')+ - tag(:br)+"#{plc}" - 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("seminar_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 - "seminar_main[#{@key_field}][#{@key_index}][#{@field}]" - end - def self.get_field_name_base - "seminar_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 == 'seminar_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("seminar_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 \ No newline at end of file diff --git a/app/helpers/admin/seminars_helper.rb b/app/helpers/admin/seminars_helper.rb deleted file mode 100644 index 73825f4..0000000 --- a/app/helpers/admin/seminars_helper.rb +++ /dev/null @@ -1,33 +0,0 @@ -module Admin::SeminarsHelper - def page_for_seminar(seminar) - ann_page = nil - pages = Page.where(:module=>'seminar') - - pages.each do |page| - if page.categories.count ==1 - if page.categories.include?(seminar.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?(seminar.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+'/'+seminar.to_param).gsub('//','/') rescue "/" - end - - def page_for_seminar_url - page = Page.where(:module => 'seminar').first - return request.protocol+(request.host_with_port+"/#{I18n.locale}#{page.url}").gsub('//','/') rescue "/" - # return "/#{I18n.locale}#{page.url}/#{seminar.to_param}" - end -end \ No newline at end of file diff --git a/app/helpers/admin/seminars_values_helper.rb b/app/helpers/admin/seminars_values_helper.rb deleted file mode 100644 index 7743617..0000000 --- a/app/helpers/admin/seminars_values_helper.rb +++ /dev/null @@ -1,109 +0,0 @@ -module Admin::SeminarsValuesHelper - 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.seminar_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.seminar_signup_field["typeC"]["calendar"] == "west_calendar" - show_west_calender(from_to) - when self.seminar_signup_field["typeC"]["calendar"] == "tw_calendar" - show_minguo_calendar(from_to) - end #case self.seminar_signup_field["typeC"]["calendar"] - when :en - show_west_calender(from_to) - end - end -end \ No newline at end of file diff --git a/app/models/seminar_agreement.rb b/app/models/seminar_agreement.rb deleted file mode 100644 index f3a21ef..0000000 --- a/app/models/seminar_agreement.rb +++ /dev/null @@ -1,7 +0,0 @@ -class SeminarAgreement - include Mongoid::Document - include Mongoid::Timestamps - - field :content, localize: true - -end \ No newline at end of file diff --git a/app/models/seminar_email_set.rb b/app/models/seminar_email_set.rb deleted file mode 100644 index f22f0c7..0000000 --- a/app/models/seminar_email_set.rb +++ /dev/null @@ -1,10 +0,0 @@ -class SeminarEmailSet - include Mongoid::Document - include Mongoid::Timestamps - - field :field_name, type: String - field :title - field :content - field :disabled, type: Boolean, default: false - belongs_to :seminar_main -end diff --git a/app/models/seminar_file.rb b/app/models/seminar_file.rb deleted file mode 100644 index 143296b..0000000 --- a/app/models/seminar_file.rb +++ /dev/null @@ -1,14 +0,0 @@ -# encoding: utf-8 -class SeminarFile - - include Mongoid::Document - include Mongoid::Timestamps - - mount_uploader :file, AssetUploader - - field :description, localize: true - field :title, localize: true - - belongs_to :seminar_main - -end diff --git a/app/models/seminar_item.rb b/app/models/seminar_item.rb deleted file mode 100644 index cfd1192..0000000 --- a/app/models/seminar_item.rb +++ /dev/null @@ -1,12 +0,0 @@ -class SeminarItem - include Mongoid::Document - include Mongoid::Timestamps - - field :title, localize: true - - belongs_to :seminar_main - - has_many :seminar_item_contents, :autosave => true, :dependent => :destroy - accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true - -end \ No newline at end of file diff --git a/app/models/seminar_item_content.rb b/app/models/seminar_item_content.rb deleted file mode 100644 index 5eba95a..0000000 --- a/app/models/seminar_item_content.rb +++ /dev/null @@ -1,15 +0,0 @@ -# encoding: utf-8 -class SeminarItemContent - - include Mongoid::Document - include Mongoid::Timestamps - - field :content, localize: true - - field :create_user_id - field :update_user_id - - belongs_to :seminar_item - belongs_to :seminar_main - -end diff --git a/app/models/seminar_link.rb b/app/models/seminar_link.rb deleted file mode 100644 index 2009008..0000000 --- a/app/models/seminar_link.rb +++ /dev/null @@ -1,25 +0,0 @@ -# encoding: utf-8 -require 'uri' - -class SeminarLink - include Mongoid::Document - include Mongoid::Timestamps - - field :url - field :title, localize: true - - belongs_to :seminar_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 \ No newline at end of file diff --git a/app/models/seminar_main.rb b/app/models/seminar_main.rb deleted file mode 100644 index 51f7071..0000000 --- a/app/models/seminar_main.rb +++ /dev/null @@ -1,87 +0,0 @@ -class SeminarMain - 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 :act_place, localize: true - - field :seminar_start_date, :type => Date, :default => Time.now - field :seminar_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 :seminar_item - - has_many :seminar_links, :autosave => true, :dependent => :destroy - has_many :seminar_files, :autosave => true, :dependent => :destroy - has_many :seminar_item_contents, :autosave => true, :dependent => :destroy - has_many :seminar_signups, :autosave => true, :dependent => :destroy - has_many :seminar_submission_fields, :autosave => true, :dependent => :destroy - has_many :seminar_signup_fields, :autosave => true, :dependent => :destroy - has_many :seminar_reviews, :autosave => true, :dependent => :destroy - has_many :seminar_signup_field_sets, autosave: true, dependent: :destroy - has_many :seminar_submission_field_sets, autosave: true, dependent: :destroy - has_many :seminar_email_sets, autosave: true, dependent: :destroy - has_many :seminar_signup_field_customs, :autosave => true, :dependent => :destroy - accepts_nested_attributes_for :seminar_links, :allow_destroy => true - accepts_nested_attributes_for :seminar_files, :allow_destroy => true - accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true - accepts_nested_attributes_for :seminar_signups, :allow_destroy => true - accepts_nested_attributes_for :seminar_submission_fields, :allow_destroy => true - accepts_nested_attributes_for :seminar_signup_fields, :allow_destroy => true - accepts_nested_attributes_for :seminar_reviews, :allow_destroy => true - accepts_nested_attributes_for :seminar_signup_field_sets, :allow_destroy => true - accepts_nested_attributes_for :seminar_submission_field_sets, :allow_destroy => true - accepts_nested_attributes_for :seminar_email_sets, :allow_destroy => true - accepts_nested_attributes_for :seminar_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) - SeminarSignupValue.find_by(seminar_signup_field_id: attribute_field.id, seminar_signup_id: signup_id) - end - - def get_attribute_values(attribute_type=nil) - @attribute_values = attribute_type.seminar_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.seminar_signup_field_id == field_id} rescue nil - value ? value : nil - end - -end diff --git a/app/models/seminar_review.rb b/app/models/seminar_review.rb deleted file mode 100644 index 8ed7aee..0000000 --- a/app/models/seminar_review.rb +++ /dev/null @@ -1,12 +0,0 @@ -# encoding: utf-8 -require "orbit_form_helper" -class SeminarReview - - 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 :seminar_main -end diff --git a/app/models/seminar_signup.rb b/app/models/seminar_signup.rb deleted file mode 100644 index 9f40877..0000000 --- a/app/models/seminar_signup.rb +++ /dev/null @@ -1,27 +0,0 @@ -# encoding: utf-8 -class SeminarSignup - - 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 :seminar_main - - has_many :seminar_signup_values - has_many :seminar_signup_contributes - - accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true - accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true - - -end diff --git a/app/models/seminar_signup_contribute.rb b/app/models/seminar_signup_contribute.rb deleted file mode 100644 index b282142..0000000 --- a/app/models/seminar_signup_contribute.rb +++ /dev/null @@ -1,13 +0,0 @@ -class SeminarSignupContribute - - include Mongoid::Document - include Mongoid::Timestamps - - field :title - mount_uploader :file, AssetUploader - field :description - - belongs_to :seminar_signup - has_many :seminar_submission_values, autosave: true, dependent: :destroy - accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true -end \ No newline at end of file diff --git a/app/models/seminar_signup_field.rb b/app/models/seminar_signup_field.rb deleted file mode 100644 index ca6c3fb..0000000 --- a/app/models/seminar_signup_field.rb +++ /dev/null @@ -1,161 +0,0 @@ -class SeminarSignupField - include Mongoid::Document - include Mongoid::Timestamps - include Mongoid::Attributes::Dynamic - include ::AttributeFieldsHelper - include ::Admin::SeminarsFieldHelper - - 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 :seminar_main - has_many :seminar_signup_values, autosave: true, dependent: :destroy - accepts_nested_attributes_for :seminar_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.seminar.method(self[:key].pluralize.to_sym) && self.seminar.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.seminar.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_seminar_signup_field(seminar,seminar_param, seminar_signup_field_id=nil,field_status) - @field_name = 'seminar' - if field_status.eql?(true) - @seminar_signup_field_counter = seminar.seminar_signup_fields.count rescue nil - @seminar_signup_field = self.find(seminar_signup_field_id) rescue nil - old_key = @seminar_signup_field.key - @seminar_signup_field.update(seminar_param) - @seminar_signup_field.save - attribute_values = @seminar_signup_field.seminar_signup_values - if attribute_values.count > 0 - attribute_values.each do |av| - av.key = seminar_param["key"] - av.save - end - end - @seminar_signup_field[:af_count] = @seminar_signup_field_counter - else - @seminar_signup_field_counter = seminar.seminar_signup_fields.count rescue nil - @seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param) rescue nil - @seminar_signup_field.save - @seminar_signup_field[:af_count] = @seminar_signup_field_counter - end - return @seminar_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 \ No newline at end of file diff --git a/app/models/seminar_signup_field_custom.rb b/app/models/seminar_signup_field_custom.rb deleted file mode 100644 index ac322db..0000000 --- a/app/models/seminar_signup_field_custom.rb +++ /dev/null @@ -1,8 +0,0 @@ -class SeminarSignupFieldCustom - include Mongoid::Document - include Mongoid::Timestamps - - field :seminar_signup_field_id - field :hidden, type: Boolean, default: true - belongs_to :seminar_main -end diff --git a/app/models/seminar_signup_field_set.rb b/app/models/seminar_signup_field_set.rb deleted file mode 100644 index 0470192..0000000 --- a/app/models/seminar_signup_field_set.rb +++ /dev/null @@ -1,11 +0,0 @@ -class SeminarSignupFieldSet - 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 :seminar_main -end diff --git a/app/models/seminar_signup_value.rb b/app/models/seminar_signup_value.rb deleted file mode 100644 index f477f67..0000000 --- a/app/models/seminar_signup_value.rb +++ /dev/null @@ -1,215 +0,0 @@ -class SeminarSignupValue - include Mongoid::Document - include Mongoid::Timestamps - include Mongoid::Attributes::Dynamic - include ::AttributeValuesHelper - include ::Admin::SeminarsValuesHelper - - field :key, type: String - - belongs_to :seminar_signup_field - belongs_to :seminar_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.seminar_signup_field.markup - when 'text_field','text_area' - if self.seminar_signup_field.add_more and (self.seminar_signup_field.markup == "text_field") - index.nil? ? self["val"] : self["val"][index] - else - self.seminar_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.seminar_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.seminar_signup_field.markup.eql?("text_field") || self.seminar_signup_field.markup.eql?("text_area")) - field_value = self.value[I18n.locale] - elsif (self.seminar_signup_field.markup.eql?("select") || self.seminar_signup_field.markup.eql?("radio_button")) - field_value = self.seminar_signup_field.markup_value["#{self.value}"][I18n.locale] rescue nil - elsif self.seminar_signup_field.markup.eql?("address") - field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ') - elsif self.seminar_signup_field.markup.eql?("date") - case self.seminar_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.seminar_signup_field.markup.eql?("checkbox") - field_value = self.value.map {|v| self.seminar_signup_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil - end - - field_value = (field_value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "#{field_value}" : field_value - field_value = (field_value =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ? "#{field_value}" : field_value - - if !field_value.blank? - { - "key" => self.seminar_signup_field.key, - "title" => self.seminar_signup_field.title, - "value" => field_value, - "val" => field_value = self.value - } - else - { - "key" => self.seminar_signup_field.key, - "title" => self.seminar_signup_field.title, - "value" => "", - "val" => field_value = self.value - } - end - end - - def get_value_by_locale(locale,add_more_index=nil) - case self.seminar_signup_field.markup - when "text_field" - case self.seminar_signup_field.add_more - when true - if self.seminar_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.seminar_signup_field.locale ? self[locale.to_s] : self.value - end - - when "select" - markup_values = self.seminar_signup_field.self_defined_markup_options? ? self.seminar_signup_field.markup_value : self.seminar_signup_field.markup_value - markup_values[self.value][locale.to_s] rescue 'NoData' - - when "text_area" - self.seminar_signup_field.locale ? self[locale.to_s] : self.value - - when "date" - if self.seminar_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.seminar_signup_field.markup_value - markup_values[self.value][locale.to_s] - - when "checkbox" - markup_values = self.seminar_signup_field.markup_value - self.value.collect{|key| markup_values["#{key}"][I18n.locale]}.join(",") - when "date_durnation" - self.value - - else - self.seminar_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) - @seminar_signup_field_value = member.seminar_signup_values.find(field_value_id) rescue nil - if @seminar_signup_field_value!=nil - @seminar_signup_field_value.update(field_value_param) rescue nil - @seminar_signup_field_value.save rescue nil - end - else - @seminar_signup_field_value = member.seminar_signup_values.build(field_value_param) rescue nil - @seminar_signup_field_value.save - end - return @seminar_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.seminar_signup_field.markup - when "address" - self["val"] = self["temp_data"] - when 'text_field','text_area' - if self.seminar_signup_field.add_more - self["val"] = self["temp_data"] - else # if not add_more - if self.seminar_signup_field.can_muti_lang_input? - self[:temp_data].each do |key,val| - self[key] = val - end if(!self.seminar_signup_field.get_data[:cross_lang]) - else - self["val"] = self[:temp_data] - end - end # of self.seminar_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.seminar_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.seminar_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 diff --git a/app/models/seminar_submission_field.rb b/app/models/seminar_submission_field.rb deleted file mode 100644 index 07e8e5a..0000000 --- a/app/models/seminar_submission_field.rb +++ /dev/null @@ -1,186 +0,0 @@ -class SeminarSubmissionField - include Mongoid::Document - include Mongoid::Timestamps - include Mongoid::Attributes::Dynamic - include ::AttributeFieldsHelper - include ::Admin::SeminarsFieldHelper - - 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 :seminar_main - has_many :seminar_submission_values, autosave: true, dependent: :destroy - accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true - before_save :check_option_list - def get_basic_field_name_org - "seminar_submission_values" - end - - def get_basic_field_name - "seminar_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.seminar_submission_values.nil?) && con_field.seminar_submission_values!=[] - @attribute_value = con_field.seminar_submission_values.select{|v| v.seminar_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.seminar.method(self[:key].pluralize.to_sym) && self.seminar.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.seminar.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_seminar_signup_field(seminar,seminar_param, seminar_submission_field_id=nil,field_status) - @field_name = 'seminar' - if field_status.eql?(true) - @seminar_submission_field_counter = seminar.seminar_submission_fields.count rescue nil - @seminar_submission_field = self.find(seminar_submission_field_id) rescue nil - old_key = @seminar_submission_field.key - @seminar_submission_field.update(seminar_param) - @seminar_submission_field.save - attribute_values = @seminar_submission_field.seminar_submission_values - if attribute_values.count > 0 - attribute_values.each do |av| - av.key = seminar_param["key"] - av.save - end - end - @seminar_submission_field[:af_count] = @seminar_submission_field_counter - else - @seminar_submission_field_counter = seminar.seminar_submission_fields.count rescue nil - @seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param) rescue nil - @seminar_submission_field.save - @seminar_submission_field[:af_count] = @seminar_submission_field_counter - end - return @seminar_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 \ No newline at end of file diff --git a/app/models/seminar_submission_field_set.rb b/app/models/seminar_submission_field_set.rb deleted file mode 100644 index 0f5b0e5..0000000 --- a/app/models/seminar_submission_field_set.rb +++ /dev/null @@ -1,11 +0,0 @@ -class SeminarSubmissionFieldSet - 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 :seminar_main -end \ No newline at end of file diff --git a/app/models/seminar_submission_value.rb b/app/models/seminar_submission_value.rb deleted file mode 100644 index b04aea8..0000000 --- a/app/models/seminar_submission_value.rb +++ /dev/null @@ -1,212 +0,0 @@ -class SeminarSubmissionValue - include Mongoid::Document - include Mongoid::Timestamps - include Mongoid::Attributes::Dynamic - include ::AttributeValuesHelper - include ::Admin::SeminarsValuesHelper - - field :key, type: String - - belongs_to :seminar_submission_field - belongs_to :seminar_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.seminar_submission_field.markup - when 'text_field','text_area' - if self.seminar_submission_field.add_more and (self.seminar_submission_field.markup == "text_field") - index.nil? ? self["val"] : self["val"][index] - else - self.seminar_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.seminar_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.seminar_submission_field.markup.eql?("text_field") || self.seminar_submission_field.markup.eql?("text_area")) - field_value = self.value[I18n.locale] - elsif (self.seminar_submission_field.markup.eql?("select") || self.seminar_submission_field.markup.eql?("radio_button")) - field_value = self.seminar_submission_field.markup_value["#{self.value}"][I18n.locale] rescue nil - elsif self.seminar_submission_field.markup.eql?("address") - field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ') - elsif self.seminar_submission_field.markup.eql?("date") - case self.seminar_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.seminar_submission_field.markup.eql?("checkbox") - field_value = self.value.map {|v| self.seminar_submission_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil - end - - field_value = (field_value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "#{field_value}" : field_value - field_value = (field_value =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ? "#{field_value}" : field_value - - if !field_value.blank? - { - "key" => self.seminar_submission_field.key, - "title" => self.seminar_submission_field.title, - "value" => field_value, - "val" => field_value = self.value - } - else - { - "key" => self.seminar_submission_field.key, - "title" => self.seminar_submission_field.title, - "value" => "", - "val" => field_value = self.value - } - end - end - - def get_value_by_locale(locale,add_more_index=nil) - case self.seminar_submission_field.markup - when "text_field" - case self.seminar_submission_field.add_more - when true - if self.seminar_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.seminar_submission_field.locale ? self[locale.to_s] : self.value - end - - when "select" - markup_values = self.seminar_submission_field.self_defined_markup_options? ? self.seminar_submission_field.markup_value : self.seminar_submission_field.markup_value - markup_values[self.value][locale.to_s] rescue 'NoData' - - when "text_area" - self.seminar_submission_field.locale ? self[locale.to_s] : self.value - - when "date" - if self.seminar_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.seminar_submission_field.markup_value - markup_values[self.value][locale.to_s] - - when "checkbox" - markup_values = self.seminar_submission_field.markup_value - self.value.collect{|key| markup_values["#{key}"][I18n.locale]}.join(",") - when "date_durnation" - self.value - - else - self.seminar_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) - @seminar_submission_field_value = self.find(field_value_id) rescue nil - @seminar_submission_field_value.update(field_value_param) rescue nil - @seminar_submission_field_value.save rescue nil - else - @seminar_submission_field_value = member.seminar_submission_values.build(field_value_param) rescue nil - @seminar_submission_field_value.save - end - return @seminar_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.seminar_submission_field.markup - when "address" - self["val"] = self["temp_data"] - when 'text_field','text_area' - if self.seminar_submission_field.add_more - self["val"] = self["temp_data"] - else # if not add_more - if self.seminar_submission_field.can_muti_lang_input? - self[:temp_data].each do |key,val| - self[key] = val - end if(!self.seminar_submission_field.get_data[:cross_lang]) - else - self["val"] = self[:temp_data] - end - end # of self.seminar_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.seminar_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.seminar_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 diff --git a/app/views/admin/seminar_agreements/index.html.erb b/app/views/admin/seminar_agreements/index.html.erb deleted file mode 100644 index a2014a9..0000000 --- a/app/views/admin/seminar_agreements/index.html.erb +++ /dev/null @@ -1,63 +0,0 @@ -<% 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 %> - -
<%= t(:item)%> | -
---|
- <%= seminar_item_content.seminar_item.title %>
-
-
-
- |
-
- -
- <%= link_to '#', class: "open-slide", data: {title: t('seminar_item.edit_item'), id: item.id.to_s, form: item.title_translations} do %> - <%= item.title_translations.values.join(" / ") %> - <% end %> -<%= t('seminar.field_name') %> | -<%= t('seminar.name') %> | -<%= t('seminar.placeholder') %> | -<%= t('seminar.disable') %> | -<%= t('seminar.hidden') %> | - - - <% @signup_sets.each_with_index do |attr_signup,signup_index| %> -
---|---|---|---|---|
- <%= t("seminar_signup.#{attr_signup.field_name}") %> - | -- <%= show_set_field(attr_signup,'seminar_signup_field_sets',signup_index,'name') %> - | -- <%= show_set_field(attr_signup,'seminar_signup_field_sets',signup_index,'placeholder') %> - | -- - - <%= check_box_tag("seminar_main[seminar_signup_field_sets][#{signup_index}][disabled]", true ,attr_signup.disabled) %> - | -- <% if attr_signup.field_name != 'recaptcha' %> - - <%= check_box_tag("seminar_main[seminar_signup_field_sets][#{signup_index}][hidden]", true ,attr_signup.hidden) %> - <% end %> - | -
<%= t('seminar.field_name') %> | -<%= t('seminar.name') %> | -<%= t('seminar.placeholder') %> | -<%= t('seminar.disable') %> | -<%= t('seminar.hidden') %> | - - - <% @submission_set.each_with_index do |attr_signup,submission_index| %> -
---|---|---|---|---|
- <%= t("seminar_signup.#{attr_signup.field_name}") %> - | -- <%= show_set_field(attr_signup,'seminar_submission_field_sets',submission_index,'name') %> - | -- <%= show_set_field(attr_signup,'seminar_submission_field_sets',submission_index,'placeholder') %> - | -- - - <%= check_box_tag("seminar_main[seminar_submission_field_sets][#{submission_index}][disabled]", true ,attr_signup.disabled) %> - | -- - <%= check_box_tag("seminar_main[seminar_submission_field_sets][#{submission_index}][hidden]", true ,attr_signup.hidden) %> - | -
<%= t('seminar.field_name') %> | -<%= t('seminar.hidden') %> | - - - <% @custom_set.each_with_index do |attr_custom,custom_index| %> -
---|---|
- <%= SeminarSignupField.where(id:attr_custom.seminar_signup_field_id).first.title rescue '' %> - | -- - <%= check_box_tag("seminar_main[seminar_signup_field_customs][#{custom_index}][hidden]", true ,attr_custom.hidden) %> - | - -
- <%= t('seminar.disable') %> - | -- - <%= check_box_tag("seminar_main[seminar_email_sets][#{index1}][disabled]", true ,@email_set[index1].disabled) %> - | -
- <%= t('seminar.email_title') %> - | -- <%= show_set_field(@email_set[index1],'seminar_email_sets',index1,'title','text_field') %> - | -
- <%= t('seminar.email_content') %> - | -
-
- <%= show_set_field(@email_set[index1],'seminar_email_sets',index1,'content','text_area') %>
-
- |
-
- <%= hidden_field_tag 'seminar_link_field_count', @seminar.seminar_links.count %> - <%= t(:add) %> -
- -- <%= hidden_field_tag 'seminar_file_field_count', @seminar.seminar_files.count %> - <%= t(:add) %> -
- -<%= t(f)%> | - <% else %> - <%= thead(f) %> - <% end %> - <% end %> -|||||
---|---|---|---|---|---|
<%= seminar.category.title %> | -
- <%= seminar.title %>
-
-
-
- |
- <%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %> | -<%= SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date) %> | -<%= seminar.seminar_signups.count %> | -<%= t('seminar.export') %> | -
<%= t('seminar_item_content.name')%> | -
---|
- <%= seminar_item_content.content %>
-
-
-
- |
-
<%= field_set.name[I18n.locale] %> | - <% end %> - <% end %> - <% else %> -<%= t('seminar_signup.name')%> | -<%= t('seminar_signup.tel')%> | -<%= t('seminar.registration_status')%> | - <% end %> - <% if @seminar.seminar_signup_field_customs.count != 0 %> - <% @seminar.seminar_signup_field_customs.each do |field_set| %> - <% if !(field_set.hidden) %> -<%= SeminarSignupField.where(id:field_set.seminar_signup_field_id).first.title rescue '' %> | - <% end %> - <% end %> - <% end %> - <% if @seminar.seminar_submission_field_sets.count != 0 %> - <% show1 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden) - show2 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden) - show3 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden) - %> - <% else %> - <% show1 = true - show2 = true - show3 = true - %> - <% end %> - <% if show1 %> -<%= t('seminar_signup.title')%> | - <% end %> - <% if show2 %> -<%= t('seminar_signup.file')%> | - <% end %> - <% if show3 %> -<%= t('seminar_signup.description')%> | - <% end %> - <% @seminar.seminar_submission_fields.asc(:_id).each do |submission_field| %> -<%= submission_field.title %> | - <% end %> -
---|---|---|---|---|---|---|---|---|
- <% if field_set.field_name== 'name' %>
- <%= seminar_signup.name %>
-
-
- <% elsif field_set.field_name== 'status' %>
- <%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
- <% elsif field_set.field_name != 'recaptcha' %>
- <%= seminar_signup.send("#{field_set.field_name}") %>
- <% end %>
-
- |
- <% end %>
- <% end %>
- <% else %>
-
- <%= seminar_signup.name %>
-
-
-
- |
- <%= seminar_signup.tel %> | -<%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %> - | - <% end %> - <% if @seminar.seminar_signup_field_customs.count != 0 %> - <% @seminar.seminar_signup_field_customs.each do |field_set| %> - <% if !(field_set.hidden) %> -
- <% seminar_signup.seminar_signup_values.each do |seminar_signup_values| %>
- <% if seminar_signup_values.seminar_signup_field_id == field_set.seminar_signup_field_id %>
- <% if seminar_signup_values.value.class == String || seminar_signup_values.value.nil? %>
- <%= seminar_signup_values.get_value_by_locale(I18n.locale,seminar_signup_values) %>
- <% else %>
- <% seminar_signup_values.value.each do |key,v| %>
- <%= "#{I18n.t(key)}:#{seminar_signup_values.get_value_by_locale(key,seminar_signup_values)}" %>
- - <% end %> - <% end %> - <% end %> - <% end %> - |
- <% end %>
- <% end %>
- <% end %>
- <% count_set = 0 %>
- <% if @seminar.seminar_submission_field_sets.count != 0 %>
- <% show1 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
- show2 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
- show3 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
- %>
- <% @seminar.seminar_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 = @seminar.seminar_submission_fields.count
- %>
- - | - <% end %> -
- |
- <% end %>
- <% if show2 %>
-
- |
- <% end %>
- <% if show3 %>
-
- |
- <% end %>
- <%
- count_value = seminar_signup_contribute.seminar_submission_values.count
- count_field = @seminar.seminar_submission_fields.count
- %>
- <% if count_value == count_field %>
- <% seminar_signup_contribute.seminar_submission_values.asc(:seminar_submission_field_id).each do |value| %>
-
-
- <% 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)}" %>
- - <% end %> - <% end %> - - |
- <% end %>
- <% else %>
- <% for i in 1..(count_field-count_value) %>
- - | - <% end %> - <% end %> - -
<%= result %>
-<%= t('seminar.close_window') %> -<%= t('seminar_signup.file_name') %> | -<%= t('seminar_signup.file_note') %> | -<%= t('seminar_signup.files') %> | -<%= t(:action) %> | -
---|---|---|---|
<%= seminar_signup_contribute.title %> | -<%= seminar_signup_contribute.description.to_s.html_safe %> | -<%= link_to File.basename(seminar_signup_contribute.file.path), seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %> | -- <%= link_to t(:edit), OrbitHelper.url_to_show(@seminar.to_param) + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %> - - - | -
<%= t(:category) %> | -<%= t('seminar.title') %> | -<%= t('seminar_signup.time') %> | -<%= t('seminar_signup.place') %> | -<%= t('seminar.signup') %> | -
---|---|---|---|---|
<%= seminar.category.title %> | -<%= ('' + seminar.title + '').html_safe %> | -<%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %> | -<%= seminar.act_place %> | -
- <%= sign_up %> - - <%= - if !seminar.registration_status.blank? and seminar.registration_status.include?('C') and seminar.contribute_start_date <= @time_now and ( seminar.contribute_end_date.nil? or seminar.contribute_end_date+1 >= @time_now ) - if !session[:seminar_signup_id].blank? - if session[:seminar_main_id] == seminar.id - ('' + t('seminar_signup.uploads') + '').html_safe - else - ('' + t('seminar_signup.con_login') + '').html_safe - end - else - ('' + t('seminar_signup.con_login') + '').html_safe - end - end - %> - |
-
<%= t(:category) %> | -<%= @seminar.category.title %> | -
---|---|
<%= t('seminar.event_during') %> | -<%= @seminar_time_range %> | -
<%= t('seminar.title') %> | -<%= @seminar.title %> | -
<%= t('seminar.speaker') %> | -<%= @seminar.speaker %> | -
<%= t('seminar.content') %> | -<%= nl2br(@seminar.content) %> | -
<%= t('seminar.signup_during') %> | -<%= @sign_up_time_range %> | -
<%= t('seminar.contribute_during') %> | -<%= @contribute_time_range %> | -
<%= t('seminar.signup') %> | -<%= @sign_up %> <%= @contribute_action %> |
-
<%= t('seminar.act_place') %> | -<%= @seminar.act_place %> | -
<%= t(:file_) %> | -- <% @seminar.seminar_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 %> - | -
<%= t(:link) %> | -- <% @seminar.seminar_links.map do |link| %> - <%= link_to (link.title.blank? ? link.url : link.title), link.url, :target => '_blank' %> - <% end %> - | -
<%= item_content.seminar_item.title %> | -<%= item_content.content.html_safe %> | -
You may have mistyped the address or the page may have moved.
-If you are the application owner check the logs for more information.
-Maybe you tried to change something you didn't have access to.
-If you are the application owner check the logs for more information.
-If you are the application owner check the logs for more information.
-