nkuht donate
This commit is contained in:
commit
dcb507659d
|
@ -0,0 +1,14 @@
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
# Declare your gem's dependencies in nkuht_donate.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'
|
|
@ -0,0 +1,87 @@
|
||||||
|
PATH
|
||||||
|
remote: .
|
||||||
|
specs:
|
||||||
|
nkuht_donate (0.0.1)
|
||||||
|
rails (~> 4.1.7)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
actionmailer (4.1.7)
|
||||||
|
actionpack (= 4.1.7)
|
||||||
|
actionview (= 4.1.7)
|
||||||
|
mail (~> 2.5, >= 2.5.4)
|
||||||
|
actionpack (4.1.7)
|
||||||
|
actionview (= 4.1.7)
|
||||||
|
activesupport (= 4.1.7)
|
||||||
|
rack (~> 1.5.2)
|
||||||
|
rack-test (~> 0.6.2)
|
||||||
|
actionview (4.1.7)
|
||||||
|
activesupport (= 4.1.7)
|
||||||
|
builder (~> 3.1)
|
||||||
|
erubis (~> 2.7.0)
|
||||||
|
activemodel (4.1.7)
|
||||||
|
activesupport (= 4.1.7)
|
||||||
|
builder (~> 3.1)
|
||||||
|
activerecord (4.1.7)
|
||||||
|
activemodel (= 4.1.7)
|
||||||
|
activesupport (= 4.1.7)
|
||||||
|
arel (~> 5.0.0)
|
||||||
|
activesupport (4.1.7)
|
||||||
|
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.6.11)
|
||||||
|
json (1.8.1)
|
||||||
|
mail (2.6.3)
|
||||||
|
mime-types (>= 1.16, < 3)
|
||||||
|
mime-types (2.4.3)
|
||||||
|
minitest (5.4.3)
|
||||||
|
multi_json (1.10.1)
|
||||||
|
rack (1.5.2)
|
||||||
|
rack-test (0.6.2)
|
||||||
|
rack (>= 1.0)
|
||||||
|
rails (4.1.7)
|
||||||
|
actionmailer (= 4.1.7)
|
||||||
|
actionpack (= 4.1.7)
|
||||||
|
actionview (= 4.1.7)
|
||||||
|
activemodel (= 4.1.7)
|
||||||
|
activerecord (= 4.1.7)
|
||||||
|
activesupport (= 4.1.7)
|
||||||
|
bundler (>= 1.3.0, < 2.0)
|
||||||
|
railties (= 4.1.7)
|
||||||
|
sprockets-rails (~> 2.0)
|
||||||
|
railties (4.1.7)
|
||||||
|
actionpack (= 4.1.7)
|
||||||
|
activesupport (= 4.1.7)
|
||||||
|
rake (>= 0.8.7)
|
||||||
|
thor (>= 0.18.1, < 2.0)
|
||||||
|
rake (10.3.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.0)
|
||||||
|
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
|
||||||
|
nkuht_donate!
|
||||||
|
sqlite3
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright 2014 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.
|
|
@ -0,0 +1,3 @@
|
||||||
|
= NkuhtDonate
|
||||||
|
|
||||||
|
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,32 @@
|
||||||
|
begin
|
||||||
|
require 'bundler/setup'
|
||||||
|
rescue LoadError
|
||||||
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'rdoc/task'
|
||||||
|
|
||||||
|
RDoc::Task.new(:rdoc) do |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = 'NkuhtDonate'
|
||||||
|
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
|
|
@ -0,0 +1,78 @@
|
||||||
|
function checkTagsQuantity() {
|
||||||
|
var $tagLead = $('.tag-lead'),
|
||||||
|
$tagsGroups = $('.tags-groups');
|
||||||
|
|
||||||
|
$tagsGroups.each(function(i) {
|
||||||
|
var $children = $(this).children().length;
|
||||||
|
$tagLead.eq(i).children('.badge').text($children);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkedLength() {
|
||||||
|
var $tagsList = $('#tags-list'),
|
||||||
|
$defaultTags,
|
||||||
|
ids;
|
||||||
|
function reload_links() {
|
||||||
|
var _checked = 0;
|
||||||
|
ids = [];
|
||||||
|
$defaultTags = $('li.default input[type="checkbox"]');
|
||||||
|
$defaultTags.each(function(index, el) {
|
||||||
|
if($(el).prop('checked')) {
|
||||||
|
_checked ++;
|
||||||
|
ids.push($(el).val())
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(_checked,ids)
|
||||||
|
if(_checked > 0) {
|
||||||
|
$('#deselect').removeClass('hide');
|
||||||
|
$('#deselect').on('click', deselect);
|
||||||
|
$('#deleteUnits').attr('rel', "<%= Rails.application.routes.url_helpers.delete_departments_admin_nkuht_donate_departments_path %>" + "?ids=" + ids);
|
||||||
|
$('#deleteUnits').removeClass('hide');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#deselect').addClass('hide');
|
||||||
|
$('#deleteUnits').attr('rel', "");
|
||||||
|
$('#deleteUnits').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();
|
||||||
|
});
|
||||||
|
$('#deleteUnits').on('click', function() {
|
||||||
|
$('#delete_nkuht_donate_departments .tags-groups').empty();
|
||||||
|
$('#delete_nkuht_donate_departments 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_nkuht_donate_departments .tags-groups');
|
||||||
|
$('#delete_nkuht_donate_departments .tags-groups .filter-item').addClass('def');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#delete_nkuht_donate_departments').modal('show', cleanTagInputs());
|
||||||
|
function cleanTagInputs(){
|
||||||
|
var $tagsDelete = $('#delete_nkuht_donate_departments'),
|
||||||
|
$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');
|
||||||
|
$('#deleteUnits').attr('rel', "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
checkedLength();
|
||||||
|
});
|
|
@ -0,0 +1,78 @@
|
||||||
|
function checkTagsQuantity() {
|
||||||
|
var $tagLead = $('.tag-lead'),
|
||||||
|
$tagsGroups = $('.tags-groups');
|
||||||
|
|
||||||
|
$tagsGroups.each(function(i) {
|
||||||
|
var $children = $(this).children().length;
|
||||||
|
$tagLead.eq(i).children('.badge').text($children);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkedLength() {
|
||||||
|
var $tagsList = $('#tags-list'),
|
||||||
|
$defaultTags,
|
||||||
|
ids;
|
||||||
|
function reload_links() {
|
||||||
|
var _checked = 0;
|
||||||
|
ids = [];
|
||||||
|
$defaultTags = $('li.default input[type="checkbox"]');
|
||||||
|
$defaultTags.each(function(index, el) {
|
||||||
|
if($(el).prop('checked')) {
|
||||||
|
_checked ++;
|
||||||
|
ids.push($(el).val())
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(_checked,ids)
|
||||||
|
if(_checked > 0) {
|
||||||
|
$('#deselect').removeClass('hide');
|
||||||
|
$('#deselect').on('click', deselect);
|
||||||
|
$('#deleteUnits').attr('rel', "<%= Rails.application.routes.url_helpers.delete_units_admin_nkuht_donate_units_path %>" + "?ids=" + ids);
|
||||||
|
$('#deleteUnits').removeClass('hide');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#deselect').addClass('hide');
|
||||||
|
$('#deleteUnits').attr('rel', "");
|
||||||
|
$('#deleteUnits').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();
|
||||||
|
});
|
||||||
|
$('#deleteUnits').on('click', function() {
|
||||||
|
$('#delete_nkuht_donate_units .tags-groups').empty();
|
||||||
|
$('#delete_nkuht_donate_units 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_nkuht_donate_units .tags-groups');
|
||||||
|
$('#delete_nkuht_donate_units .tags-groups .filter-item').addClass('def');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#delete_nkuht_donate_units').modal('show', cleanTagInputs());
|
||||||
|
function cleanTagInputs(){
|
||||||
|
var $tagsDelete = $('#delete_nkuht_donate_units'),
|
||||||
|
$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');
|
||||||
|
$('#deleteUnits').attr('rel', "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
checkedLength();
|
||||||
|
});
|
|
@ -0,0 +1,78 @@
|
||||||
|
function checkTagsQuantity() {
|
||||||
|
var $tagLead = $('.tag-lead'),
|
||||||
|
$tagsGroups = $('.tags-groups');
|
||||||
|
|
||||||
|
$tagsGroups.each(function(i) {
|
||||||
|
var $children = $(this).children().length;
|
||||||
|
$tagLead.eq(i).children('.badge').text($children);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkedLength() {
|
||||||
|
var $tagsList = $('#tags-list'),
|
||||||
|
$defaultTags,
|
||||||
|
ids;
|
||||||
|
function reload_links() {
|
||||||
|
var _checked = 0;
|
||||||
|
ids = [];
|
||||||
|
$defaultTags = $('li.default input[type="checkbox"]');
|
||||||
|
$defaultTags.each(function(index, el) {
|
||||||
|
if($(el).prop('checked')) {
|
||||||
|
_checked ++;
|
||||||
|
ids.push($(el).val())
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(_checked,ids)
|
||||||
|
if(_checked > 0) {
|
||||||
|
$('#deselect').removeClass('hide');
|
||||||
|
$('#deselect').on('click', deselect);
|
||||||
|
$('#deleteUnits').attr('rel', "<%= Rails.application.routes.url_helpers.delete_uses_admin_nkuht_donate_uses_path %>" + "?ids=" + ids);
|
||||||
|
$('#deleteUnits').removeClass('hide');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#deselect').addClass('hide');
|
||||||
|
$('#deleteUnits').attr('rel', "");
|
||||||
|
$('#deleteUnits').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();
|
||||||
|
});
|
||||||
|
$('#deleteUnits').on('click', function() {
|
||||||
|
$('#delete_nkuht_donate_uses .tags-groups').empty();
|
||||||
|
$('#delete_nkuht_donate_uses 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_nkuht_donate_uses .tags-groups');
|
||||||
|
$('#delete_nkuht_donate_uses .tags-groups .filter-item').addClass('def');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#delete_nkuht_donate_uses').modal('show', cleanTagInputs());
|
||||||
|
function cleanTagInputs(){
|
||||||
|
var $tagsDelete = $('#delete_nkuht_donate_uses'),
|
||||||
|
$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');
|
||||||
|
$('#deleteUnits').attr('rel', "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
checkedLength();
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
@ -0,0 +1,29 @@
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('a[data-toggle="tab"]').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).tab('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$.pageslide.closeCallback(function(pageslide, item) {
|
||||||
|
$('.filter-item').removeClass("active");
|
||||||
|
});
|
||||||
|
|
||||||
|
$.pageslide.loadComplete(function(pageslide, item) {
|
||||||
|
|
||||||
|
$('.filter-item').removeClass("active");
|
||||||
|
|
||||||
|
item.closest('li').addClass('active');
|
||||||
|
|
||||||
|
if(item.data('id') == 'new') {
|
||||||
|
resetForm();
|
||||||
|
pageslide.find('form:eq(0)').attr('action', window.location.pathname);
|
||||||
|
pageslide.find('form:eq(0)').attr('method', 'post');
|
||||||
|
}else {
|
||||||
|
setForm(item.data('form'));
|
||||||
|
pageslide.find('form:eq(0)').attr('action', window.location.pathname + '/' + item.data('id'));
|
||||||
|
pageslide.find('form:eq(0)').attr('method', 'put');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Place all the styles related to the nkuht_donate controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,3 @@
|
||||||
|
/*
|
||||||
|
*= require lib/tags-groups
|
||||||
|
*/
|
|
@ -0,0 +1,51 @@
|
||||||
|
class Admin::NkuhtDonateDepartmentsController < OrbitAdminController
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@app_title = 'nkuht_donate'
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@nkuht_donate_departments = NkuhtDonateDepartment.all
|
||||||
|
@url = admin_nkuht_donate_department_path(@nkuht_donate_departments)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@nkuht_donate_department = NkuhtDonateDepartment.new(nkuht_donate_department_params)
|
||||||
|
@nkuht_donate_department.save
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_in_form
|
||||||
|
@nkuht_donate_department = NkuhtDonateDepartment.new(nkuht_donate_department_params)
|
||||||
|
@nkuht_donate_department.save
|
||||||
|
render :json => {:id=>@nkuht_donate_department.id.to_s, :title=>@nkuht_donate_department.title}.to_json ,:layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@nkuht_donate_department = NkuhtDonateDepartment.find(params[:id])
|
||||||
|
@nkuht_donate_department.update_attributes(nkuht_donate_department_params)
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def toggle
|
||||||
|
@nkuht_donate_department = NkuhtDonateDepartment.find(params[:id])
|
||||||
|
@nkuht_donate_department.save!
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_departments
|
||||||
|
departments = NkuhtDonateDepartment.find(params[:ids].split(',')) rescue nil
|
||||||
|
if departments
|
||||||
|
departments.each(&:destroy)
|
||||||
|
end
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def nkuht_donate_department_params
|
||||||
|
params.require(:nkuht_donate_department).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,52 @@
|
||||||
|
class Admin::NkuhtDonateUnitsController < OrbitAdminController
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@app_title = 'nkuht_donate'
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@nkuht_donate_units = NkuhtDonateUnit.all
|
||||||
|
@url = admin_nkuht_donate_unit_path(@nkuht_donate_units)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@nkuht_donate_unit = NkuhtDonateUnit.new(nkuht_donate_unit_params)
|
||||||
|
@nkuht_donate_unit.save
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_in_form
|
||||||
|
@nkuht_donate_unit = NkuhtDonateUnit.new(nkuht_donate_unit_params)
|
||||||
|
@nkuht_donate_unit.save
|
||||||
|
render :json => {:id=>@nkuht_donate_unit.id.to_s, :title=>@nkuht_donate_unit.title}.to_json ,:layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@nkuht_donate_unit = NkuhtDonateUnit.find(params[:id])
|
||||||
|
@nkuht_donate_unit.update_attributes(nkuht_donate_unit_params)
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def toggle
|
||||||
|
@nkuht_donate_unit = NkuhtDonateUnit.find(params[:id])
|
||||||
|
@nkuht_donate_unit.save!
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_units
|
||||||
|
units = NkuhtDonateUnit.find(params[:ids].split(',')) rescue nil
|
||||||
|
if units
|
||||||
|
units.each(&:destroy)
|
||||||
|
end
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def nkuht_donate_unit_params
|
||||||
|
params.require(:nkuht_donate_unit).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,52 @@
|
||||||
|
class Admin::NkuhtDonateUsesController < OrbitAdminController
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@app_title = 'nkuht_donate'
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@nkuht_donate_uses = NkuhtDonateUse.all
|
||||||
|
@url = admin_nkuht_donate_use_path(@nkuht_donate_uses)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@nkuht_donate_use = NkuhtDonateUse.new(nkuht_donate_use_params)
|
||||||
|
@nkuht_donate_use.save
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_in_form
|
||||||
|
@nkuht_donate_use = NkuhtDonateUse.new(nkuht_donate_use_params)
|
||||||
|
@nkuht_donate_use.save
|
||||||
|
render :json => {:id=>@nkuht_donate_use.id.to_s, :title=>@nkuht_donate_use.title}.to_json ,:layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@nkuht_donate_use = NkuhtDonateUse.find(params[:id])
|
||||||
|
@nkuht_donate_use.update_attributes(nkuht_donate_use_params)
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def toggle
|
||||||
|
@nkuht_donate_use = NkuhtDonateUse.find(params[:id])
|
||||||
|
@nkuht_donate_use.save!
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete_uses
|
||||||
|
uses = NkuhtDonateUse.find(params[:ids].split(',')) rescue nil
|
||||||
|
if uses
|
||||||
|
uses.each(&:destroy)
|
||||||
|
end
|
||||||
|
redirect_to request.referer, :status => 303
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def nkuht_donate_use_params
|
||||||
|
params.require(:nkuht_donate_use).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,120 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
class Admin::NkuhtDonatesController < OrbitAdminController
|
||||||
|
|
||||||
|
require 'axlsx'
|
||||||
|
|
||||||
|
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||||
|
before_action :set_nkuht_donate, only: [:edit, :update, :set_write_off, :destroy]
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
super
|
||||||
|
@app_title = "nkuht_donate"
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
@filter_fields = {}
|
||||||
|
@table_fields = ['nkuht_donate.donation_payment_number', 'nkuht_donate.donation_serial_date', 'nkuht_donate.name', 'nkuht_donate.donation_amount', 'nkuht_donate.donation_way', 'nkuht_donate.donate_public', 'nkuht_donate.donation_unit', 'nkuht_donate.donation_use', 'nkuht_donate.donation_payment_status', 'nkuht_donate.donation_write_off_status']
|
||||||
|
|
||||||
|
!params[:sort].blank? ? sort = {params[:sort].to_sym=>params[:order]} : sort = {:created_at=>"desc"}
|
||||||
|
|
||||||
|
@nkuht_donates = NkuhtDonateMain.all.order_by(sort)
|
||||||
|
|
||||||
|
@nkuht_donates = search_data(@nkuht_donates,[:name]).page(params[:page]).per(10)
|
||||||
|
|
||||||
|
if request.xhr?
|
||||||
|
render :partial => "index"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def export
|
||||||
|
|
||||||
|
@nkuht_donates = NkuhtDonateMain.all.order_by({:created_at=>"desc"})
|
||||||
|
respond_to do |format|
|
||||||
|
format.xlsx {
|
||||||
|
response.headers['Content-Disposition'] = 'attachment; filename="export.xlsx"'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
|
||||||
|
@nkuht_donate = NkuhtDonateMain.new
|
||||||
|
|
||||||
|
@nkuht_donate_units = NkuhtDonateUnit.all
|
||||||
|
@nkuht_donate_departments = NkuhtDonateDepartment.all
|
||||||
|
@nkuht_donate_uses = NkuhtDonateUse.all
|
||||||
|
|
||||||
|
@showother = "hide"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.new(nkuht_donate_params)
|
||||||
|
|
||||||
|
nkuht_donate.donation_serial_number = NkuhtDonateMain.get_serial_number
|
||||||
|
nkuht_donate.donation_payment_number = NkuhtDonateMain.get_payment_number
|
||||||
|
|
||||||
|
nkuht_donate.create_user_id = current_user.id
|
||||||
|
nkuht_donate.update_user_id = current_user.id
|
||||||
|
nkuht_donate.save
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
|
||||||
|
@nkuht_donate_units = NkuhtDonateUnit.all
|
||||||
|
@nkuht_donate_departments = NkuhtDonateDepartment.all
|
||||||
|
@nkuht_donate_uses = NkuhtDonateUse.all
|
||||||
|
|
||||||
|
if !@nkuht_donate.nkuht_donate_use_id.blank?
|
||||||
|
if @nkuht_donate.nkuht_donate_use.title == "其他" || @nkuht_donate.nkuht_donate_use.title == "Other"
|
||||||
|
@showother = ""
|
||||||
|
else
|
||||||
|
@showother = "hide"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@showother = "hide"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
|
||||||
|
@nkuht_donate.update_user_id = current_user.id
|
||||||
|
|
||||||
|
@nkuht_donate.update_attributes(nkuht_donate_params)
|
||||||
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_write_off
|
||||||
|
|
||||||
|
@nkuht_donate.donation_write_off_status = true
|
||||||
|
@nkuht_donate.save
|
||||||
|
|
||||||
|
redirect_to "/admin/nkuht_donates?page=#{params['page']}"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
|
||||||
|
@nkuht_donate.destroy
|
||||||
|
redirect_to "/admin/nkuht_donates"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_nkuht_donate
|
||||||
|
@nkuht_donate = NkuhtDonateMain.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def nkuht_donate_params
|
||||||
|
params.require(:nkuht_donate_main).permit!
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,214 @@
|
||||||
|
class NkuhtDonatesController < ApplicationController
|
||||||
|
|
||||||
|
include ApplicationHelper
|
||||||
|
|
||||||
|
include SimpleCaptcha::ControllerHelpers
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.new
|
||||||
|
|
||||||
|
nkuht_donate_units = NkuhtDonateUnit.all
|
||||||
|
nkuht_donate_departments = NkuhtDonateDepartment.all
|
||||||
|
nkuht_donate_uses = NkuhtDonateUse.all
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donate" => nkuht_donate,
|
||||||
|
"nkuht_donate_units" => nkuht_donate_units,
|
||||||
|
"nkuht_donate_departments" => nkuht_donate_departments,
|
||||||
|
"nkuht_donate_uses" => nkuht_donate_uses
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def donate_list
|
||||||
|
params = OrbitHelper.params
|
||||||
|
|
||||||
|
if !params[:mq].blank?
|
||||||
|
nkuht_donates = NkuhtDonateMain.where(:donate_public=>true).any_of({:name => /#{params[:mq]}/i}).order_by(:created_at=>"desc").page(params[:page_no]).per(20)
|
||||||
|
else
|
||||||
|
nkuht_donates = NkuhtDonateMain.where(:donate_public=>true).order_by(:created_at=>"desc").page(params[:page_no]).per(20)
|
||||||
|
end
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donates" => nkuht_donates,
|
||||||
|
"total_pages" => nkuht_donates.total_pages
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def receipt_notice
|
||||||
|
|
||||||
|
params = OrbitHelper.params
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.find(params[:no])
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donate" => nkuht_donate
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
|
||||||
|
@nkuht_donate = NkuhtDonateMain.new(nkuht_donate_params)
|
||||||
|
|
||||||
|
@nkuht_donate.donation_serial_number = NkuhtDonateMain.get_serial_number
|
||||||
|
@nkuht_donate.donation_payment_number = NkuhtDonateMain.get_payment_number
|
||||||
|
|
||||||
|
if @nkuht_donate.donation_amount < '1'
|
||||||
|
|
||||||
|
@notice = []
|
||||||
|
@notice << t('nkuht_donate.donation_amount_err')
|
||||||
|
redirect_to "#{params[:referer_url]}", :notice => @notice
|
||||||
|
|
||||||
|
elsif @nkuht_donate.donation_way == '2' and @nkuht_donate.donation_amount > '30000'
|
||||||
|
|
||||||
|
@notice = []
|
||||||
|
@notice << t('nkuht_donate.donation_amount_atm')
|
||||||
|
redirect_to "#{params[:referer_url]}", :notice => @notice
|
||||||
|
|
||||||
|
elsif @nkuht_donate.donation_way == '3' and @nkuht_donate.donation_amount > '20000'
|
||||||
|
|
||||||
|
@notice = []
|
||||||
|
@notice << t('nkuht_donate.donation_amount_market')
|
||||||
|
redirect_to "#{params[:referer_url]}", :notice => @notice
|
||||||
|
|
||||||
|
elsif simple_captcha_valid? && @nkuht_donate.save
|
||||||
|
|
||||||
|
# ways1: 信用卡
|
||||||
|
# ways2: atm轉帳
|
||||||
|
# ways3: 超商繳款
|
||||||
|
# ways4: 現金
|
||||||
|
# ways5: 支票
|
||||||
|
# ways6: 匯款
|
||||||
|
|
||||||
|
if @nkuht_donate.donation_way == '1'
|
||||||
|
redirect_to "#{params[:referer_url]}/?method=print_card_payment&no=#{@nkuht_donate.id}"
|
||||||
|
elsif @nkuht_donate.donation_way == '2'
|
||||||
|
redirect_to "#{params[:referer_url]}/?method=print_atm_payment&no=#{@nkuht_donate.id}"
|
||||||
|
elsif @nkuht_donate.donation_way == '3'
|
||||||
|
redirect_to "#{params[:referer_url]}/?method=print_market_payment&no=#{@nkuht_donate.id}&layout=false"
|
||||||
|
else
|
||||||
|
redirect_to "#{params[:referer_url]}/?method=print_msg&no=#{@nkuht_donate.id}"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
|
||||||
|
if !simple_captcha_valid?
|
||||||
|
@notice = [t('recaptcha.errors.verification_failed')]
|
||||||
|
else
|
||||||
|
|
||||||
|
@notice = []
|
||||||
|
@errors = @nkuht_donate.errors.messages.first
|
||||||
|
|
||||||
|
@notice << t('recaptcha.errors.verification_failed') if !gotcha_valid?
|
||||||
|
@notice << "#{t("nkuht_donate.donation_amount")}#{@errors[1][0]}" if !@errors.blank?
|
||||||
|
|
||||||
|
end
|
||||||
|
redirect_to "#{params[:referer_url]}", :notice => @notice
|
||||||
|
# redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def print_card_payment
|
||||||
|
|
||||||
|
params = OrbitHelper.params
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.find(params[:no])
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donate" => nkuht_donate
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def print_atm_payment
|
||||||
|
|
||||||
|
require 'digest/sha1'
|
||||||
|
require 'openssl'
|
||||||
|
require 'base64'
|
||||||
|
# require 'mcrypt'
|
||||||
|
|
||||||
|
params = OrbitHelper.params
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.find(params[:no])
|
||||||
|
|
||||||
|
sendseqno = nkuht_donate.donation_serial_time.to_datetime.strftime("%Y%m%d%H%M%S") + "%04d" % (nkuht_donate.donation_serial_number)
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donate" => nkuht_donate,
|
||||||
|
"xmldata" => Base64.encode64("<?xml version='1.0' encoding='Big5'?><CardPayRq><SendSeqNo>#{sendseqno}</SendSeqNo><MID>T00774955421</MID><FunCode></FunCode><UserData></UserData><ONO>#{nkuht_donate.donation_payment_number}</ONO><InAccountNo>#{nkuht_donate.donation_payment_number}</InAccountNo ><Amount>#{nkuht_donate.donation_amount}</Amount><MAC>#{nkuht_donate.get_atm_mac_number}</MAC><RsURL>http://donations.nkuht.edu.tw/donate_atm</RsURL></CardPayRq>")
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def print_market_payment
|
||||||
|
|
||||||
|
require 'barby'
|
||||||
|
require 'barby/barcode/code_39'
|
||||||
|
require 'barby/outputter/png_outputter'
|
||||||
|
|
||||||
|
params = OrbitHelper.params
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.find(params[:no])
|
||||||
|
|
||||||
|
barcodes = nkuht_donate.get_market_number
|
||||||
|
|
||||||
|
barcodes.each_with_index do |code,i|
|
||||||
|
barcode =Barby::Code39.new(code, true)
|
||||||
|
File.open("public/code39_#{i + 1}.png", 'w'){|f|
|
||||||
|
# f.write barcode.to_png(:margin => 3, :xdim => 2, :height => 50)
|
||||||
|
f.write barcode.to_png(:height => 40)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donate" => nkuht_donate,
|
||||||
|
"barcodes" => barcodes
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def print_msg
|
||||||
|
|
||||||
|
params = OrbitHelper.params
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.find(params[:no])
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donate" => nkuht_donate
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def payment_ok
|
||||||
|
end
|
||||||
|
|
||||||
|
def payment_no
|
||||||
|
|
||||||
|
params = OrbitHelper.params
|
||||||
|
|
||||||
|
nkuht_donate = NkuhtDonateMain.where(:_id => params['no']).first
|
||||||
|
|
||||||
|
msg = {
|
||||||
|
'V211' => '傳送序號重複,訊息丟棄',
|
||||||
|
'V212' => '此筆訂單之收款資料已存在且已成功付款',
|
||||||
|
'V213' => '此筆訂單之收款資料已存在,但交易仍在進行中',
|
||||||
|
'V214' => '此筆訂單之收款資料已存在,但主機交易中斷狀態不明',
|
||||||
|
'J001' => '主機交易逾時 Pending',
|
||||||
|
'0' => '收款交易成功',
|
||||||
|
'' => '收款交易失敗'}
|
||||||
|
|
||||||
|
{
|
||||||
|
"nkuht_donate" => nkuht_donate,
|
||||||
|
"msg" => msg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def nkuht_donate_params
|
||||||
|
params.require(:nkuht_donate_main).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
module NkuhtDonateHelper
|
||||||
|
def page_for_donate_payment(status=nil, id="")
|
||||||
|
|
||||||
|
pages = Page.where(:module=>'nkuht_donate')
|
||||||
|
ann_page = pages.first
|
||||||
|
|
||||||
|
if status == 'ok'
|
||||||
|
request.protocol+(request.host_with_port+'/'+I18n.locale.to_s+ann_page.url+'/?method=payment_ok').gsub('//','/') rescue "/"
|
||||||
|
else
|
||||||
|
request.protocol+(request.host_with_port+'/'+I18n.locale.to_s+ann_page.url+'/?method=payment_no&no='+id).gsub('//','/') rescue "/"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def page_for_donate_receipt_notice(donate=nil)
|
||||||
|
ann_page = nil
|
||||||
|
pages = Page.where(:module=>'nkuht_donate')
|
||||||
|
ann_page = pages.first
|
||||||
|
request.protocol+(request.host_with_port+'/'+I18n.locale.to_s+ann_page.url+'/?method=receipt_notice&no='+donate.to_param+"&layout=false").gsub('//','/') rescue "/"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
class NkuhtDonateDepartment
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :title, localize: true
|
||||||
|
|
||||||
|
belongs_to :nkuht_donate_main
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,193 @@
|
||||||
|
class NkuhtDonateMain
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
include OrbitModel::Impression
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
field :name
|
||||||
|
field :donors_service_unit
|
||||||
|
field :tel
|
||||||
|
field :email
|
||||||
|
field :donation_way, :default => 1
|
||||||
|
field :cheque_number
|
||||||
|
field :donation_amount
|
||||||
|
field :donation_use_other
|
||||||
|
|
||||||
|
field :is_alumni, :type => Boolean, :default => true
|
||||||
|
field :graduation_year
|
||||||
|
|
||||||
|
field :has_receipt, :type => Boolean, :default => true
|
||||||
|
field :receipt_title, :default => 1
|
||||||
|
field :receipt_title_other
|
||||||
|
|
||||||
|
field :receipt_number
|
||||||
|
field :receipt_address, :default => 1
|
||||||
|
field :receipt_address_other
|
||||||
|
field :donate_public, :type => Boolean, :default => true
|
||||||
|
|
||||||
|
field :note
|
||||||
|
|
||||||
|
field :create_user_id
|
||||||
|
field :update_user_id
|
||||||
|
|
||||||
|
field :donation_serial_date, :type => String, :default => Date.current #新增日
|
||||||
|
field :donation_serial_time, :type => String, :default => Time.current #新增日時分
|
||||||
|
field :donation_serial_number #流水號
|
||||||
|
field :donation_payment_number #銷帳編號 & 訂單編號
|
||||||
|
|
||||||
|
field :donation_payment_status, :type => Boolean, :default => false #付款狀態
|
||||||
|
field :donation_payment_status_msg #付款失敗訊息代碼
|
||||||
|
field :donation_write_off_status, :type => Boolean, :default => false #銷帳狀態
|
||||||
|
|
||||||
|
|
||||||
|
belongs_to :nkuht_donate_unit
|
||||||
|
belongs_to :nkuht_donate_department
|
||||||
|
belongs_to :nkuht_donate_use
|
||||||
|
|
||||||
|
validates_numericality_of :donation_amount, :only_integer => true
|
||||||
|
|
||||||
|
#10335+年月日(8)+流水號(1~999)
|
||||||
|
def self.get_payment_number
|
||||||
|
|
||||||
|
@number = '10335' + Date.current.strftime("%Y%m%d") + get_serial_number
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_serial_number
|
||||||
|
number = "%03d" % ( NkuhtDonateMain.where(:donation_serial_date=>Date.current).count + 1 )
|
||||||
|
# return number.rjust(3, '0')
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_atm_mac_number
|
||||||
|
#年月日時分秒+流水號4碼 == 傳送序號
|
||||||
|
#傳送序號+特店代碼+訂單編號+銷帳編號+金額
|
||||||
|
sendseqno = self.donation_serial_time.to_datetime.strftime("%Y%m%d%H%M%S") + "%04d" % (self.donation_serial_number)
|
||||||
|
|
||||||
|
message = Digest::SHA1.hexdigest("#{sendseqno}T00774955421#{self.donation_payment_number}#{self.donation_payment_number}#{self.donation_amount}")
|
||||||
|
key = 'S8G46IY64UHZZBSKGZFI6D7E'
|
||||||
|
iv = '00000000'
|
||||||
|
|
||||||
|
message = [message+iv].pack('H*')
|
||||||
|
|
||||||
|
|
||||||
|
# Encrypt plaintext using Triple DES
|
||||||
|
cipher = OpenSSL::Cipher::Cipher.new("des-ede3-cbc")
|
||||||
|
cipher.padding = 0
|
||||||
|
cipher.key = key
|
||||||
|
cipher.iv = iv
|
||||||
|
cipher.encrypt # Call this before setting key or iv
|
||||||
|
ciphertext = cipher.update(message)
|
||||||
|
# ciphertext << cipher.final
|
||||||
|
# Base64-encode the ciphertext
|
||||||
|
encodedCipherText = Base64.strict_encode64(ciphertext)
|
||||||
|
# encodedCipherText = Base64.strict_encode64(ciphertext)
|
||||||
|
|
||||||
|
return encodedCipherText
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_market_number
|
||||||
|
#’A’:1, ’B’:2, ’C’:3, ’D’:4, ’E’:5, ’F’:6, ’G’:7, ’H’:8, ’I’:9
|
||||||
|
|
||||||
|
# 第一段(9碼) 繳費期限yymmdd (6碼) + 代收項目6HC (3碼)
|
||||||
|
@date = self.donation_serial_date.to_date + 14 #到期日
|
||||||
|
@pdate = (@date.strftime("%Y").to_i - 1911 ).to_s[-2..-1] + @date.strftime("%m%d")
|
||||||
|
@ckno1 = @pdate + '683'
|
||||||
|
@no1 = @pdate + '6HC'
|
||||||
|
|
||||||
|
# 第二段(16碼) 交易序號由業者自行訂定(前5碼銀行編 貴校為10335,且16碼必須全為數字)
|
||||||
|
@no2 = self.donation_payment_number
|
||||||
|
|
||||||
|
# 第三段(15碼) 應繳日期 mmdd (4碼) + 檢碼(2碼) + 應繳金額(9碼)
|
||||||
|
|
||||||
|
@ckno3 = @pdate[-4..-1].to_s + ("%09d" % self.donation_amount)
|
||||||
|
@key1 = NkuhtDonateMain.get_market_number_key1(@ckno1, @no2, @ckno3)
|
||||||
|
@key2 = NkuhtDonateMain.get_market_number_key2(@ckno1, @no2, @ckno3)
|
||||||
|
|
||||||
|
@no3 = @pdate[-4..-1].to_s + @key1 + @key2 + ("%09d" % self.donation_amount)
|
||||||
|
|
||||||
|
return [@no1,@no2,@no3]
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_market_number_key1(code1,code2,code3)
|
||||||
|
|
||||||
|
@n1 = []
|
||||||
|
|
||||||
|
(0..8).each{|a| @n1 << code1[a].to_i if a % 2 == 0 }
|
||||||
|
|
||||||
|
@n2 = []
|
||||||
|
|
||||||
|
(0..15).each{|a| @n2 << code2[a].to_i if a % 2 == 0 }
|
||||||
|
|
||||||
|
@n3 = []
|
||||||
|
|
||||||
|
(0..12).each{|a| @n3 << code3[a].to_i if a % 2 == 0 }
|
||||||
|
|
||||||
|
@key1 = (( @n1.sum + @n2.sum + @n3.sum ) % 11).to_s
|
||||||
|
|
||||||
|
if @key1 == '0'
|
||||||
|
return 'A'
|
||||||
|
elsif @key1 == '10'
|
||||||
|
return 'B'
|
||||||
|
else
|
||||||
|
return @key1
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get_market_number_key2(code1,code2,code3)
|
||||||
|
|
||||||
|
@n1 = []
|
||||||
|
|
||||||
|
(0..8).each{|a| @n1 << code1[a].to_i if a % 2 != 0 }
|
||||||
|
|
||||||
|
@n2 = []
|
||||||
|
|
||||||
|
(0..15).each{|a| @n2 << code2[a].to_i if a % 2 != 0 }
|
||||||
|
|
||||||
|
@n3 = []
|
||||||
|
|
||||||
|
(0..12).each{|a| @n3 << code3[a].to_i if a % 2 != 0 }
|
||||||
|
|
||||||
|
@key2 = (( @n1.sum + @n2.sum + @n3.sum ) % 11).to_s
|
||||||
|
|
||||||
|
if @key2 == '0'
|
||||||
|
return 'X'
|
||||||
|
elsif @key2 == '10'
|
||||||
|
return 'Y'
|
||||||
|
else
|
||||||
|
return @key2
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# 轉大寫數字
|
||||||
|
def self.change_cash( cash )
|
||||||
|
|
||||||
|
cNum = ["零","壹","貳","叁","肆","伍","陸","柒","捌","玖","-","-","萬","仟","佰","拾","億","仟","佰","拾","萬","仟","佰","拾",""]
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
sNum = ""
|
||||||
|
sTemp = ""
|
||||||
|
result = ""
|
||||||
|
|
||||||
|
tmp = cash.to_i
|
||||||
|
return '零' if tmp == 0
|
||||||
|
raise '整數部分加二位小數長度不能大於15' if tmp.to_s.size > 15
|
||||||
|
sNum = tmp.to_s.rjust(15, ' ')
|
||||||
|
|
||||||
|
for i in 0..14
|
||||||
|
stemp = sNum.slice(i, 1)
|
||||||
|
if stemp == ' '
|
||||||
|
next
|
||||||
|
else
|
||||||
|
result += " " + cNum[stemp.to_i] + " " + cNum[i + 10]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
class NkuhtDonateUnit
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :title, localize: true
|
||||||
|
|
||||||
|
belongs_to :nkuht_donate_main
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
class NkuhtDonateUse
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :title, localize: true
|
||||||
|
|
||||||
|
belongs_to :nkuht_donate_main
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,16 @@
|
||||||
|
<div id="delete_nkuht_donate_departments" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3 id="myModalLabel"><%= t('nkuht_donate_department.del_department') %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body tags">
|
||||||
|
<span class="text-warning text-center"><%= t('tag.warning.delete') %></span>
|
||||||
|
<hr>
|
||||||
|
<ul class="tags-groups checkbox-card">
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
|
||||||
|
<%= link_to t(:delete_), nil, class: "delete-tags btn btn-danger", method: :post, remote: true %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<li class="filter-item default">
|
||||||
|
<p class="card pull-left">
|
||||||
|
<input type="checkbox" value="<%= department.id %>">
|
||||||
|
</p>
|
||||||
|
<%= link_to '#', class: "open-slide", data: {title: t('nkuht_donate_department.edit_department'), id: department.id.to_s, form: department.title_translations} do %>
|
||||||
|
<%= department.title_translations.values.join(" / ") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<% @site_in_use_locales.each do |locale| %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label"><%= "#{t(:name)} (#{t(locale)})" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input-large" id="<%=locale%>" name="nkuht_donate_department[title_translations][<%=locale%>]" placeholder="<%=t(:name)%>" type="text">
|
||||||
|
<span class="help-inline hide"><%= t('front_page.name_field_helper') %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<!-- footer -->
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<button id="selectAllTags" class="btn"><%= t(:select_all) %></button>
|
||||||
|
<button id="deselect" class="btn btn-inverse toggable hide"><%= t(:deselect_all) %></button>
|
||||||
|
<%= link_to t(:delete_), '#', id: "deleteUnits", class: "btn btn-danger toggable hide", rel: '' %>
|
||||||
|
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t('nkuht_donate_department.new_department'), id: 'new'} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- footer:end -->
|
||||||
|
|
||||||
|
<!-- tags -->
|
||||||
|
<div class="tags">
|
||||||
|
<div id="tags-list">
|
||||||
|
<p class="tag-lead lead muted"><%= t('nkuht_donate_department.set_department') %></p>
|
||||||
|
<% if !@nkuht_donate_departments.blank? %>
|
||||||
|
<ul class="tags-groups checkbox-card module-tags">
|
||||||
|
<%= render partial: "department", collection: @nkuht_donate_departments, locals: {in_module: true} %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- tags:end -->
|
||||||
|
|
||||||
|
<!-- delete -->
|
||||||
|
<%= render 'delete_modal' %>
|
||||||
|
<!-- delete:end -->
|
|
@ -0,0 +1,81 @@
|
||||||
|
<div id="nkuht_donate_departments_index">
|
||||||
|
<%= render 'index' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- pageslide -->
|
||||||
|
<div id="pageslide">
|
||||||
|
<div class="page-title clearfix">
|
||||||
|
<a class="pull-right" href="javascript:$.pageslide.close()">
|
||||||
|
<i class="icons-arrow-left-2"></i>
|
||||||
|
</a>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="view-page">
|
||||||
|
<div class="nano">
|
||||||
|
<div class="content">
|
||||||
|
<div id="add-tags">
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="set_new tab-pane fade active in">
|
||||||
|
<%= form_for :nkuht_donate_department, url: nil, remote: true do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
|
<div class="form-actions">
|
||||||
|
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||||
|
<%= f.submit t(:submit), class: 'btn btn-primary btn-small', id: "tag_submit" %>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "nkuht_donate_sets" %>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "check_nkuht_donate_set_departments.js" %>
|
||||||
|
<%= javascript_include_tag "nkuht_donate_sets.js" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var validate = function(dom){
|
||||||
|
var valid = true;
|
||||||
|
if($(dom).val()==""){
|
||||||
|
valid=false;
|
||||||
|
$(dom).parent().parent().addClass('error');
|
||||||
|
$(dom).next().removeClass('hide');
|
||||||
|
}else{
|
||||||
|
$(dom).parent().parent().removeClass('error');
|
||||||
|
$(dom).next().addClass('hide');
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$.each($('.set_new form input:text'),function(){
|
||||||
|
$(this).blur(function(){
|
||||||
|
validate($(this));
|
||||||
|
});
|
||||||
|
$(this).keyup(function(){
|
||||||
|
validate($(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#tag_submit").click(function(){
|
||||||
|
var valid = true;
|
||||||
|
$.each($(".set_new form input:text"),function(){
|
||||||
|
if(!validate($(this))) valid=false;
|
||||||
|
});
|
||||||
|
if(!valid) return false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<!-- pageslide:end -->
|
|
@ -0,0 +1,8 @@
|
||||||
|
$("#delete_nkuht_donate_departments").modal('hide');
|
||||||
|
$("#nkuht_donate_departments_index").html("<%= j render 'index' %>")
|
||||||
|
$.pageslide.close();
|
||||||
|
openSlide();
|
||||||
|
$('.card').cardCheck({
|
||||||
|
item: $('.card input[type="checkbox"]'),
|
||||||
|
});
|
||||||
|
checkedLength();
|
|
@ -0,0 +1,16 @@
|
||||||
|
<div id="delete_nkuht_donate_units" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3 id="myModalLabel"><%= t('nkuht_donate_unit.del_unit') %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body tags">
|
||||||
|
<span class="text-warning text-center"><%= t('tag.warning.delete') %></span>
|
||||||
|
<hr>
|
||||||
|
<ul class="tags-groups checkbox-card">
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
|
||||||
|
<%= link_to t(:delete_), nil, class: "delete-tags btn btn-danger", method: :post, remote: true %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<% @site_in_use_locales.each do |locale| %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label"><%= "#{t(:name)} (#{t(locale)})" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input-large" id="<%=locale%>" name="nkuht_donate_unit[title_translations][<%=locale%>]" placeholder="<%=t(:name)%>" type="text">
|
||||||
|
<span class="help-inline hide"><%= t('front_page.name_field_helper') %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<!-- footer -->
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<button id="selectAllTags" class="btn"><%= t(:select_all) %></button>
|
||||||
|
<button id="deselect" class="btn btn-inverse toggable hide"><%= t(:deselect_all) %></button>
|
||||||
|
<%= link_to t(:delete_), '#', id: "deleteUnits", class: "btn btn-danger toggable hide", rel: '' %>
|
||||||
|
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t('nkuht_donate_unit.new_unit'), id: 'new'} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- footer:end -->
|
||||||
|
|
||||||
|
<!-- tags -->
|
||||||
|
<div class="tags">
|
||||||
|
<div id="tags-list">
|
||||||
|
<p class="tag-lead lead muted"><%= t('nkuht_donate_unit.set_unit') %></p>
|
||||||
|
<% if !@nkuht_donate_units.blank? %>
|
||||||
|
<ul class="tags-groups checkbox-card module-tags">
|
||||||
|
<%= render partial: "unit", collection: @nkuht_donate_units, locals: {in_module: true} %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- tags:end -->
|
||||||
|
|
||||||
|
<!-- delete -->
|
||||||
|
<%= render 'delete_modal' %>
|
||||||
|
<!-- delete:end -->
|
|
@ -0,0 +1,8 @@
|
||||||
|
<li class="filter-item default">
|
||||||
|
<p class="card pull-left">
|
||||||
|
<input type="checkbox" value="<%= unit.id %>">
|
||||||
|
</p>
|
||||||
|
<%= link_to '#', class: "open-slide", data: {title: t('nkuht_donate_unit.edit_unit'), id: unit.id.to_s, form: unit.title_translations} do %>
|
||||||
|
<%= unit.title_translations.values.join(" / ") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<div id="nkuht_donate_units_index">
|
||||||
|
<%= render 'index' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- pageslide -->
|
||||||
|
<div id="pageslide">
|
||||||
|
<div class="page-title clearfix">
|
||||||
|
<a class="pull-right" href="javascript:$.pageslide.close()">
|
||||||
|
<i class="icons-arrow-left-2"></i>
|
||||||
|
</a>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="view-page">
|
||||||
|
<div class="nano">
|
||||||
|
<div class="content">
|
||||||
|
<div id="add-tags">
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="set_new tab-pane fade active in">
|
||||||
|
<%= form_for :nkuht_donate_unit, url: nil, remote: true do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
|
<div class="form-actions">
|
||||||
|
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||||
|
<%= f.submit t(:submit), class: 'btn btn-primary btn-small', id: "tag_submit" %>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "nkuht_donate_sets" %>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "check_nkuht_donate_set_units.js" %>
|
||||||
|
<%= javascript_include_tag "nkuht_donate_sets.js" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var validate = function(dom){
|
||||||
|
var valid = true;
|
||||||
|
if($(dom).val()==""){
|
||||||
|
valid=false;
|
||||||
|
$(dom).parent().parent().addClass('error');
|
||||||
|
$(dom).next().removeClass('hide');
|
||||||
|
}else{
|
||||||
|
$(dom).parent().parent().removeClass('error');
|
||||||
|
$(dom).next().addClass('hide');
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$.each($('.set_new form input:text'),function(){
|
||||||
|
$(this).blur(function(){
|
||||||
|
validate($(this));
|
||||||
|
});
|
||||||
|
$(this).keyup(function(){
|
||||||
|
validate($(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#tag_submit").click(function(){
|
||||||
|
var valid = true;
|
||||||
|
$.each($(".set_new form input:text"),function(){
|
||||||
|
if(!validate($(this))) valid=false;
|
||||||
|
});
|
||||||
|
if(!valid) return false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<!-- pageslide:end -->
|
|
@ -0,0 +1,8 @@
|
||||||
|
$("#delete_nkuht_donate_units").modal('hide');
|
||||||
|
$("#nkuht_donate_units_index").html("<%= j render 'index' %>")
|
||||||
|
$.pageslide.close();
|
||||||
|
openSlide();
|
||||||
|
$('.card').cardCheck({
|
||||||
|
item: $('.card input[type="checkbox"]'),
|
||||||
|
});
|
||||||
|
checkedLength();
|
|
@ -0,0 +1,16 @@
|
||||||
|
<div id="delete_nkuht_donate_uses" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h3 id="myModalLabel"><%= t('nkuht_donate_use.del_use') %></h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body tags">
|
||||||
|
<span class="text-warning text-center"><%= t('tag.warning.delete') %></span>
|
||||||
|
<hr>
|
||||||
|
<ul class="tags-groups checkbox-card">
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
|
||||||
|
<%= link_to t(:delete_), nil, class: "delete-tags btn btn-danger", method: :post, remote: true %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<%= f.fields_for :title_translations do |f| %>
|
||||||
|
<% @site_in_use_locales.each do |locale| %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label"><%= "#{t(:name)} (#{t(locale)})" %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input-large" id="<%=locale%>" name="nkuht_donate_use[title_translations][<%=locale%>]" placeholder="<%=t(:name)%>" type="text">
|
||||||
|
<span class="help-inline hide"><%= t('front_page.name_field_helper') %></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<!-- footer -->
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<button id="selectAllTags" class="btn"><%= t(:select_all) %></button>
|
||||||
|
<button id="deselect" class="btn btn-inverse toggable hide"><%= t(:deselect_all) %></button>
|
||||||
|
<%= link_to t(:delete_), '#', id: "deleteUnits", class: "btn btn-danger toggable hide", rel: '' %>
|
||||||
|
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t('nkuht_donate_use.new_use'), id: 'new'} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- footer:end -->
|
||||||
|
|
||||||
|
<!-- tags -->
|
||||||
|
<div class="tags">
|
||||||
|
<div id="tags-list">
|
||||||
|
<p class="tag-lead lead muted"><%= t('nkuht_donate_use.set_use') %></p>
|
||||||
|
<% if !@nkuht_donate_uses.blank? %>
|
||||||
|
<ul class="tags-groups checkbox-card module-tags">
|
||||||
|
<%= render partial: "use", collection: @nkuht_donate_uses, locals: {in_module: true} %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- tags:end -->
|
||||||
|
|
||||||
|
<!-- delete -->
|
||||||
|
<%= render 'delete_modal' %>
|
||||||
|
<!-- delete:end -->
|
|
@ -0,0 +1,8 @@
|
||||||
|
<li class="filter-item default">
|
||||||
|
<p class="card pull-left">
|
||||||
|
<input type="checkbox" value="<%= use.id %>">
|
||||||
|
</p>
|
||||||
|
<%= link_to '#', class: "open-slide", data: {title: t('nkuht_donate_use.edit_use'), id: use.id.to_s, form: use.title_translations} do %>
|
||||||
|
<%= use.title_translations.values.join(" / ") %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
|
@ -0,0 +1,81 @@
|
||||||
|
<div id="nkuht_donate_uses_index">
|
||||||
|
<%= render 'index' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- pageslide -->
|
||||||
|
<div id="pageslide">
|
||||||
|
<div class="page-title clearfix">
|
||||||
|
<a class="pull-right" href="javascript:$.pageslide.close()">
|
||||||
|
<i class="icons-arrow-left-2"></i>
|
||||||
|
</a>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="view-page">
|
||||||
|
<div class="nano">
|
||||||
|
<div class="content">
|
||||||
|
<div id="add-tags">
|
||||||
|
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
<div class="set_new tab-pane fade active in">
|
||||||
|
<%= form_for :nkuht_donate_use, url: nil, remote: true do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
|
<div class="form-actions">
|
||||||
|
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
|
||||||
|
<%= f.submit t(:submit), class: 'btn btn-primary btn-small', id: "tag_submit" %>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "nkuht_donate_sets" %>
|
||||||
|
<% end %>
|
||||||
|
<% content_for :page_specific_javascript do %>
|
||||||
|
<%= javascript_include_tag "check_nkuht_donate_set_uses.js" %>
|
||||||
|
<%= javascript_include_tag "nkuht_donate_sets.js" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var validate = function(dom){
|
||||||
|
var valid = true;
|
||||||
|
if($(dom).val()==""){
|
||||||
|
valid=false;
|
||||||
|
$(dom).parent().parent().addClass('error');
|
||||||
|
$(dom).next().removeClass('hide');
|
||||||
|
}else{
|
||||||
|
$(dom).parent().parent().removeClass('error');
|
||||||
|
$(dom).next().addClass('hide');
|
||||||
|
}
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function(){
|
||||||
|
$.each($('.set_new form input:text'),function(){
|
||||||
|
$(this).blur(function(){
|
||||||
|
validate($(this));
|
||||||
|
});
|
||||||
|
$(this).keyup(function(){
|
||||||
|
validate($(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#tag_submit").click(function(){
|
||||||
|
var valid = true;
|
||||||
|
$.each($(".set_new form input:text"),function(){
|
||||||
|
if(!validate($(this))) valid=false;
|
||||||
|
});
|
||||||
|
if(!valid) return false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<!-- pageslide:end -->
|
|
@ -0,0 +1,8 @@
|
||||||
|
$("#delete_nkuht_donate_uses").modal('hide');
|
||||||
|
$("#nkuht_donate_uses_index").html("<%= j render 'index' %>")
|
||||||
|
$.pageslide.close();
|
||||||
|
openSlide();
|
||||||
|
$('.card').cardCheck({
|
||||||
|
item: $('.card input[type="checkbox"]'),
|
||||||
|
});
|
||||||
|
checkedLength();
|
|
@ -0,0 +1,243 @@
|
||||||
|
<% 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 %>
|
||||||
|
|
||||||
|
<!-- Input Area -->
|
||||||
|
<div class="input-area">
|
||||||
|
|
||||||
|
<!-- Language -->
|
||||||
|
<div class="tab-content language-area">
|
||||||
|
|
||||||
|
<div class="control-group input-is_alumni">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.is_alumni') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :is_alumni, 'true', :onclick => "$('#donation_is_alumni').removeClass('hide');" %> <%= t('nkuht_donate.yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :is_alumni, 'false', :onclick => "$('#donation_is_alumni').addClass('hide');" %> <%= t('nkuht_donate.no_') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="donation_is_alumni" class="<%= @nkuht_donate.is_alumni.blank? ? 'hide' : '' %>">
|
||||||
|
|
||||||
|
<div class="control-group input-department">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.graduation_department') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= t('nkuht_donate.department') %> <%= f.select :nkuht_donate_department_id, @nkuht_donate_departments.collect{|t| [ t.title, t.id ]}, {prompt: 'Select'} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-graduation_year">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.graduation_year') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :graduation_year, :id=>'graduation_year', :placeholder=> t('nkuht_donate.graduation_year') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-name">
|
||||||
|
<label class="control-label muted">*<%= t('nkuht_donate.name') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :name, :class=>"input-block-level", :placeholder=> t('nkuht_donate.name'), :required => true %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donors_service_unit">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.donors_service_unit') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :donors_service_unit, :class=>"input-block-level", :id=>'donors_service_unit', :placeholder=> t('nkuht_donate.donors_service_unit') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-tel">
|
||||||
|
<label class="control-label muted">*<%= t('nkuht_donate.tel') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :tel, :class=>"input-block-level", :id=>'tel', :placeholder=> t('nkuht_donate.tel'), :required => true %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-email">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.email') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :email, :class=>"input-block-level", :id=>'email', :placeholder=> t('nkuht_donate.email') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donation_amount">
|
||||||
|
<label class="control-label muted">*<%= t('nkuht_donate.donation_amount') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
新台幣<%= f.text_field :donation_amount, :id=>'donation_amount', :placeholder=> t('nkuht_donate.donation_amount'), :required => true %> 元(請輸入數字)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donation_way">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.donation_way') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<% (1..6).each do |a| %>
|
||||||
|
<label class="radio inline">
|
||||||
|
<% if a == 5 %>
|
||||||
|
<%= f.radio_button :donation_way, a, :onclick => "$('#cheque_number').removeClass('hide');" %> <%= t("nkuht_donate_ways.ways#{a}") %>
|
||||||
|
<% else %>
|
||||||
|
<%= f.radio_button :donation_way, a, :onclick => "$('#cheque_number').addClass('hide');" %> <%= t("nkuht_donate_ways.ways#{a}") %>
|
||||||
|
<% end %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-cheque_number <%= @nkuht_donate.donation_way == '5' ? '' : 'hide'%>" id="cheque_number">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.cheque_number') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :cheque_number, :placeholder=> t('nkuht_donate.cheque_number') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donation_unit">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.donation_unit') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.select :nkuht_donate_unit_id, @nkuht_donate_units.collect{|t| [ t.title, t.id ]}, {prompt: 'Select'} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donation_use">
|
||||||
|
<label class="control-label muted">*<%= t('nkuht_donate.donation_use') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.select :nkuht_donate_use_id, @nkuht_donate_uses.collect{|t| [ t.title, t.id ]}, {}, {:onChange=>"showOther(this)"} %>
|
||||||
|
|
||||||
|
<span id="donation_use_other" class="<%= @showother %>">
|
||||||
|
<%= t('nkuht_donate.donation_use_other') %>
|
||||||
|
<%= f.text_field :donation_use_other, :id=>'donation_use_other' %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-has_receipt">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.has_receipt') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :has_receipt, 'true', :onclick => "$('#donation_has_receipt').removeClass('hide');" %> <%= t('nkuht_donate.yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :has_receipt, 'false', :onclick => "$('#donation_has_receipt').addClass('hide');" %> <%= t('nkuht_donate.no_') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="donation_has_receipt" class="<%= @nkuht_donate.has_receipt.blank? ? 'hide' : '' %>">
|
||||||
|
|
||||||
|
<div class="control-group input-receipt_title">
|
||||||
|
<label class="control-label muted">*<%= t('nkuht_donate.receipt_title') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<% (1..3).each do |a| %>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :receipt_title, a %> <%= t("nkuht_donate_receipt_title.title#{a}") %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
<%= f.text_field :receipt_title_other, :id=>'receipt_title_other' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-receipt_number">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.receipt_number') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :receipt_number, :id=>'receipt_number', :placeholder=> t('nkuht_donate.receipt_number') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-receipt_address">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.receipt_address') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<% (1..2).each do |a| %>
|
||||||
|
<label class="radio">
|
||||||
|
<%= f.radio_button :receipt_address, a %> <%= t("nkuht_donate_receipt_address.add#{a}") %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
<%= f.text_field :receipt_address_other, :class=>"input-block-level", :id=>'receipt_title_other' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donate_public">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.donate_public') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :donate_public, 'true' %> <%= t('nkuht_donate.donate_public_yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :donate_public, 'false' %> <%= t('nkuht_donate.donate_public_no_') %>
|
||||||
|
</label>
|
||||||
|
<label for="donate_public" class="radio inline">(將姓名及捐款金額公告於芳名錄)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-note">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.note') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_area :note, rows: 5, :class=>"input-block-level", :placeholder=> t('nkuht_donate.note') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donation_payment_status">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.donation_payment_status') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :donation_payment_status, 'true' %> <%= t('nkuht_donate.yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :donation_payment_status, 'false' %> <%= t('nkuht_donate.no_') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group input-donation_write_off_status">
|
||||||
|
<label class="control-label muted"><%= t('nkuht_donate.donation_write_off_status') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :donation_write_off_status, 'true' %> <%= t('nkuht_donate.yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio inline">
|
||||||
|
<%= f.radio_button :donation_write_off_status, 'false' %> <%= t('nkuht_donate.no_') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Form Actions -->
|
||||||
|
<div class="form-actions">
|
||||||
|
<%= get_referer_url[:action] rescue "" %>
|
||||||
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
|
<% if !params['page'].blank? %>
|
||||||
|
<input type="hidden" name="referer_url" value="<%= get_referer_url + "?page=" + params['page'] %>">
|
||||||
|
<% else %>
|
||||||
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
||||||
|
<% end %>
|
||||||
|
<%= link_to t('cancel'), admin_nkuht_donates_path, :class=>"btn" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script language="javascript">
|
||||||
|
function showOther() {
|
||||||
|
var text = $( "#nkuht_donate_main_nkuht_donate_use_id option:selected" ).text();
|
||||||
|
if ( text == "其他" || text == "Other" )
|
||||||
|
{
|
||||||
|
$('#donation_use_other').removeClass('hide');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#donation_use_other').addClass('hide');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,66 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
||||||
|
</script>
|
||||||
|
<% content_for :right_nav do %>
|
||||||
|
<div class="nav nav-pills filter-nav pull-right">
|
||||||
|
<p><a class="btn btn-primary" href="<%= export_admin_nkuht_donates_path %>?format=xlsx" role="button"><%= t('nkuht_donate.export_csv') %></a></p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @nkuht_donates.each do |nkuht_donate| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= nkuht_donate.donation_payment_number %></td>
|
||||||
|
<td><%= nkuht_donate.donation_serial_date %></td>
|
||||||
|
<td>
|
||||||
|
<%= nkuht_donate.name %>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<% if can_edit_or_delete?(nkuht_donate) %>
|
||||||
|
<li><a href="/admin/nkuht_donates/<%=nkuht_donate.id.to_s%>/edit?page=<%=params['page']%>"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="#" class="delete text-error" rel="/admin/nkuht_donates/<%=nkuht_donate.id.to_s%>"><%= t(:delete_) %></a></li>
|
||||||
|
<li>
|
||||||
|
<%= link_to t('nkuht_donate.donation_write_off_status'), set_write_off_admin_nkuht_donate_path(nkuht_donate,:page=>params['page']), data: { confirm: t('sure?') }, :controller => "set_write_off", :action => "test_send_email" if nkuht_donate.donation_write_off_status.blank? %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to t('nkuht_donate.receipt_notice'), page_for_donate_receipt_notice(nkuht_donate), :target => "_blank" if nkuht_donate.donation_way == '4' || nkuht_donate.donation_way == '5' %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><%= number_to_currency(nkuht_donate.donation_amount, unit: '', precision: 0) %></td>
|
||||||
|
<td><%= t("nkuht_donate_ways.ways#{nkuht_donate.donation_way}") if !nkuht_donate.donation_way.blank? %></td>
|
||||||
|
<td><%= nkuht_donate.donate_public.blank? ? t('nkuht_donate.donate_public_no_') : t('nkuht_donate.donate_public_yes_') %></td>
|
||||||
|
<td><%= nkuht_donate.nkuht_donate_unit.title if !nkuht_donate.nkuht_donate_unit.blank? %></td>
|
||||||
|
<td>
|
||||||
|
<%=
|
||||||
|
if !nkuht_donate.nkuht_donate_use.blank?
|
||||||
|
if nkuht_donate.nkuht_donate_use.title == '其他' || nkuht_donate.nkuht_donate_use.title == 'Other'
|
||||||
|
"#{nkuht_donate.nkuht_donate_use.title}(#{nkuht_donate.donation_use_other})"
|
||||||
|
else
|
||||||
|
nkuht_donate.nkuht_donate_use.title
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</td>
|
||||||
|
<td><%= nkuht_donate.donation_payment_status ? t('nkuht_donate.yes_') : t('nkuht_donate.no_') %></td>
|
||||||
|
<td><%= nkuht_donate.donation_write_off_status ? t('nkuht_donate.yes_') : t('nkuht_donate.no_') %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%=
|
||||||
|
content_tag :div, class: "bottomnav clearfix" do
|
||||||
|
content_tag :div, paginate(@nkuht_donates), class: "pagination pagination-centered"
|
||||||
|
end
|
||||||
|
%>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @nkuht_donate, url: admin_nkuht_donate_path(@nkuht_donate), html: {class: "form-horizontal main-forms"} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => 'form', locals: {f: f} %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,117 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
wb = xlsx_package.workbook
|
||||||
|
wb.add_worksheet(name: '捐贈芳名錄') do |sheet|
|
||||||
|
|
||||||
|
row = [
|
||||||
|
t('nkuht_donate.donate_public'),
|
||||||
|
t('nkuht_donate.donation_payment_number'),
|
||||||
|
t('nkuht_donate.donation_serial_date'),
|
||||||
|
t('nkuht_donate.is_alumni'),
|
||||||
|
t('nkuht_donate.graduation_department'),
|
||||||
|
t('nkuht_donate.graduation_year'), t('nkuht_donate.name'),
|
||||||
|
t('nkuht_donate.donors_service_unit'), t('nkuht_donate.tel'),
|
||||||
|
t('nkuht_donate.email'),
|
||||||
|
t('nkuht_donate.donation_amount'),
|
||||||
|
t('nkuht_donate.donation_way'),
|
||||||
|
t('nkuht_donate.cheque_number'),
|
||||||
|
t('nkuht_donate.donation_unit'),
|
||||||
|
t('nkuht_donate.donation_use'),
|
||||||
|
t('nkuht_donate.donation_use_other'),
|
||||||
|
t('nkuht_donate.has_receipt'),
|
||||||
|
t('nkuht_donate.receipt_title'),
|
||||||
|
t('nkuht_donate_receipt_title.title3'),
|
||||||
|
t('nkuht_donate.receipt_number'),
|
||||||
|
t('nkuht_donate.receipt_address'),
|
||||||
|
t('nkuht_donate_receipt_address.add2'),
|
||||||
|
t('nkuht_donate.donation_payment_status'),
|
||||||
|
t('nkuht_donate.donation_write_off_status'),
|
||||||
|
t('nkuht_donate.note')
|
||||||
|
]
|
||||||
|
|
||||||
|
sheet.add_row row
|
||||||
|
|
||||||
|
@nkuht_donates.each do |nkuht_donate|
|
||||||
|
row2 = []
|
||||||
|
|
||||||
|
@donate_public = nkuht_donate.donate_public.blank? ? "#{t('nkuht_donate.donate_public_no_')} " : "#{t('nkuht_donate.donate_public_yes_')} "
|
||||||
|
row2 << @donate_public
|
||||||
|
|
||||||
|
row2 << "#{nkuht_donate.donation_payment_number} "
|
||||||
|
|
||||||
|
row2 << "#{nkuht_donate.donation_serial_time} "
|
||||||
|
|
||||||
|
@is_alumni = nkuht_donate.is_alumni.blank? ? "#{t('nkuht_donate.no_')} " : "#{t('nkuht_donate.yes_')} "
|
||||||
|
row2 << @is_alumni
|
||||||
|
|
||||||
|
@nkuht_donate_department = !nkuht_donate.nkuht_donate_department.blank? ? nkuht_donate.nkuht_donate_department.title : ""
|
||||||
|
row2 << @nkuht_donate_department
|
||||||
|
|
||||||
|
@graduation_year = !nkuht_donate.nkuht_donate_department.blank? ? "#{nkuht_donate.graduation_year} " : ""
|
||||||
|
row2 << @graduation_year
|
||||||
|
|
||||||
|
row2 << "#{nkuht_donate.name} "
|
||||||
|
|
||||||
|
row2 << "#{nkuht_donate.donors_service_unit} "
|
||||||
|
|
||||||
|
row2 << "#{nkuht_donate.tel} "
|
||||||
|
|
||||||
|
row2 << "#{nkuht_donate.email} "
|
||||||
|
|
||||||
|
row2 << "#{number_to_currency(nkuht_donate.donation_amount, unit: '', precision: 0)} "
|
||||||
|
|
||||||
|
@donation_way = !nkuht_donate.donation_way.blank? ? t("nkuht_donate_ways.ways#{nkuht_donate.donation_way}") : ""
|
||||||
|
row2 << @donation_way
|
||||||
|
|
||||||
|
@cheque_number = nkuht_donate.donation_way == '5' ? "#{nkuht_donate.cheque_number} " : ""
|
||||||
|
row2 << @cheque_number
|
||||||
|
|
||||||
|
@nkuht_donate_unit = !nkuht_donate.nkuht_donate_unit.blank? ? nkuht_donate.nkuht_donate_unit.title : ""
|
||||||
|
row2 << @nkuht_donate_unit
|
||||||
|
|
||||||
|
@nkuht_donate_use = !nkuht_donate.nkuht_donate_use.blank? ? nkuht_donate.nkuht_donate_use.title : ""
|
||||||
|
row2 << @nkuht_donate_use
|
||||||
|
|
||||||
|
if !nkuht_donate.nkuht_donate_use.blank?
|
||||||
|
if @nkuht_donate_use == '其他' || @nkuht_donate_use == 'Other'
|
||||||
|
@donation_use_other = nkuht_donate.donation_use_other
|
||||||
|
else
|
||||||
|
@donation_use_other = ""
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@donation_use_other = ""
|
||||||
|
end
|
||||||
|
row2 << @donation_use_other
|
||||||
|
|
||||||
|
@has_receipt = !nkuht_donate.has_receipt.blank? ? "#{t('nkuht_donate.yes_')} " : "#{t('nkuht_donate.no_')} "
|
||||||
|
row2 << @has_receipt
|
||||||
|
|
||||||
|
@receipt_title = !nkuht_donate.has_receipt.blank? ? t("nkuht_donate_receipt_title.title#{nkuht_donate.receipt_title}") : ""
|
||||||
|
row2 << @receipt_title
|
||||||
|
|
||||||
|
@receipt_title_other = !nkuht_donate.has_receipt.blank? ? "#{nkuht_donate.receipt_title_other} " : ""
|
||||||
|
row2 << @receipt_title_other
|
||||||
|
|
||||||
|
@receipt_number = !nkuht_donate.has_receipt.blank? ? "#{nkuht_donate.receipt_number} " : ""
|
||||||
|
row2 << @receipt_number
|
||||||
|
|
||||||
|
@receipt_address = !nkuht_donate.has_receipt.blank? ? t("nkuht_donate_receipt_address.add#{nkuht_donate.receipt_address}") : ""
|
||||||
|
row2 << @receipt_address
|
||||||
|
|
||||||
|
@receipt_address_other = !nkuht_donate.has_receipt.blank? ? "#{nkuht_donate.receipt_address_other} " : ""
|
||||||
|
row2 << @receipt_address_other
|
||||||
|
|
||||||
|
@donation_payment_status = nkuht_donate.donation_payment_status ? t('nkuht_donate.yes_') : t('nkuht_donate.no_')
|
||||||
|
row2 << @donation_payment_status
|
||||||
|
|
||||||
|
@donation_write_off_status = nkuht_donate.donation_write_off_status ? t('nkuht_donate.yes_') : t('nkuht_donate.no_')
|
||||||
|
row2 << @donation_write_off_status
|
||||||
|
|
||||||
|
row2 << nkuht_donate.note
|
||||||
|
|
||||||
|
sheet.add_row row2
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<%= render_filter @filter_fields, "index_table" %>
|
||||||
|
<span id="index_table">
|
||||||
|
<%= render 'index'%>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= form_for @nkuht_donate, url: admin_nkuht_donates_path, html: {class: "form-horizontal main-forms"} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= render :partial => 'form', locals: {f: f} %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,51 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donates = data["nkuht_donates"]
|
||||||
|
@total_pages = data["total_pages"]
|
||||||
|
%>
|
||||||
|
|
||||||
|
<div class="searchClear pull-left" style="clear: left;">
|
||||||
|
<form action="" method="get">
|
||||||
|
|
||||||
|
捐款人姓名: <%= text_field_tag 'mq',( params[:mq] ? params[:mq] : '' ), {:id=>'filter-input', :class => "search-query input-medium", :placeholder => 'Search'} %>
|
||||||
|
<input type="hidden" name="method" value="donate_list">
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<h3 class="nkuht-donate-title">捐款芳名錄</h3>
|
||||||
|
<table class="nkuht-donate-table table table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>捐款日期</th>
|
||||||
|
<th>捐款人</th>
|
||||||
|
<th>捐款用途</th>
|
||||||
|
<th>捐款金額</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @nkuht_donates.each do |nkuht_donate| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= (nkuht_donate.donation_serial_date.to_date.strftime("%Y").to_i - 1911 ).to_s + nkuht_donate.donation_serial_date.to_date.strftime("/%m/%d") %></td>
|
||||||
|
<td><%=nkuht_donate.name%></td>
|
||||||
|
<td>
|
||||||
|
<%=
|
||||||
|
if !nkuht_donate.nkuht_donate_use.blank?
|
||||||
|
if nkuht_donate.nkuht_donate_use.title == '其他' or nkuht_donate.nkuht_donate_use.title == 'Other'
|
||||||
|
"#{nkuht_donate.nkuht_donate_use.title}(#{nkuht_donate.donation_use_other})"
|
||||||
|
else
|
||||||
|
nkuht_donate.nkuht_donate_use.title
|
||||||
|
end
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
%></td>
|
||||||
|
<td><%= number_to_currency(nkuht_donate.donation_amount, unit: '', precision: 0) %>元</td>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= create_pagination(@total_pages).html_safe if @total_pages > 1 %>
|
|
@ -0,0 +1,244 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donate = data["nkuht_donate"]
|
||||||
|
@nkuht_donate_units = data["nkuht_donate_units"]
|
||||||
|
@nkuht_donate_departments = data["nkuht_donate_departments"]
|
||||||
|
@nkuht_donate_uses = data["nkuht_donate_uses"]
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% flash.collect do |key, msg| %>
|
||||||
|
<% msg.each do |m|%>
|
||||||
|
<%=
|
||||||
|
content_tag :p do
|
||||||
|
content_tag :span, m, :class => [key, "alert alert-error in fade"]
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= form_for @nkuht_donate, url: nkuht_donates_path, html: {class: "content form-horizontal" , :id=>"new-nkuht-donate"} do |f| %>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="is_alumni" class="col-sm-2 control-label"><%= t('nkuht_donate.is_alumni') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<label class="radio-inline">
|
||||||
|
<%= f.radio_button :is_alumni, 'true', :onclick => "$('#donation_is_alumni').removeClass('hide');" %> <%= t('nkuht_donate.yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio-inline">
|
||||||
|
<%= f.radio_button :is_alumni, 'false', :onclick => "$('#donation_is_alumni').addClass('hide');" %> <%= t('nkuht_donate.no_') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="donation_is_alumni">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="graduation_department" class="col-sm-2 control-label"><%= t('nkuht_donate.graduation_department') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= t('nkuht_donate.department') %> <%= f.select :nkuht_donate_department_id, @nkuht_donate_departments.collect{|t| [ t.title, t.id ]}, {prompt: 'Select'} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="graduation_year" class="col-sm-2 control-label"><%= t('nkuht_donate.graduation_year') %></label>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<%= f.text_field :graduation_year, :id=>'graduation_year', :class=>"form-control", :placeholder=> t('nkuht_donate.graduation_year') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Name -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name" class="col-sm-2 control-label">*<%= t('nkuht_donate.name') %></label>
|
||||||
|
<div class="col-xs-5">
|
||||||
|
<%= f.text_field :name, :id=>'nkuht_donate_name', :class=>"form-control", :placeholder=> t('nkuht_donate.name'), :required => true %>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-5">
|
||||||
|
(<%= t('nkuht_donate.anonymous') %>) <input type="button" value="善心人士" class="btn btn-default" onclick="$('#nkuht_donate_name').val('善心人士');">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="donors_service_unit" class="col-sm-2 control-label"><%= t('nkuht_donate.donors_service_unit') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.text_field :donors_service_unit, :class=>"input-medium form-control", :id=>'donors_service_unit', :placeholder=> t('nkuht_donate.donors_service_unit') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="tel" class="col-sm-2 control-label">*<%= t('nkuht_donate.tel') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.text_field :tel, :class=>"input-medium form-control", :id=>'tel', :placeholder=> t('nkuht_donate.tel'), :required => true %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="email" class="col-sm-2 control-label"><%= t('nkuht_donate.email') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.text_field :email, :class=>"input-medium form-control", :id=>'email', :placeholder=> t('nkuht_donate.email') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="donation_amount" class="col-sm-2 control-label">*<%= t('nkuht_donate.donation_amount') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= t('nkuht_donate.nt') %><%= f.number_field :donation_amount, :id=>'donation_amount', :min=>"1", :max=>"", :placeholder=> t('nkuht_donate.donation_amount'), :required => true %> <%= t('nkuht_donate.dollars') %>(<%= t('nkuht_donate.amount_note') %>)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="donation_way" class="col-sm-2 control-label"><%= t('nkuht_donate.donation_way') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<% (1..3).each do |a| %>
|
||||||
|
<label class="radio-inline">
|
||||||
|
<% if a == 2 %>
|
||||||
|
<%= f.radio_button :donation_way, a, :onclick => "$(\"input[type='number']\").prop('max',30000)" %> <%= t("nkuht_donate_ways.ways#{a}") %>
|
||||||
|
<% elsif a == 3 %>
|
||||||
|
<%= f.radio_button :donation_way, a, :onclick => "$(\"input[type='number']\").prop('max',20000)" %> <%= t("nkuht_donate_ways.ways#{a}") %>
|
||||||
|
<% else %>
|
||||||
|
<%= f.radio_button :donation_way, a, :onclick => "$(\"input[type='number']\").prop('max','')" %> <%= t("nkuht_donate_ways.ways#{a}") %>
|
||||||
|
<% end %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
※<%= t('nkuht_donate.notice') %>:<br />
|
||||||
|
1. <%= t('nkuht_donate.notice1') %>(<a href="https://eatm.firstbank.com.tw/lio1000s8" target="_blank"><%= t('nkuht_donate.download_page') %></a>)<%= t('nkuht_donate.notice1_1') %><br />
|
||||||
|
2. <%= t('nkuht_donate.notice2') %><br />
|
||||||
|
3. <%= t('nkuht_donate.notice3') %><br />
|
||||||
|
4.其餘捐款方式請參閱<a href="http://donations.nkuht.edu.tw/zh_tw/academics" target="_blank">捐款方式</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="donation_unit" class="col-sm-2 control-label"><%= t('nkuht_donate.donation_unit') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.select :nkuht_donate_unit_id, @nkuht_donate_units.collect{|t| [ t.title, t.id ]}, {prompt: 'Select'} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="donation_use" class="col-sm-2 control-label">*<%= t('nkuht_donate.donation_use') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.select :nkuht_donate_use_id, @nkuht_donate_uses.collect{|t| [ t.title, t.id ]}, {}, {:onChange=>"showOther(this)"} %>
|
||||||
|
|
||||||
|
<span id="donation_use_other" class="hide">
|
||||||
|
<%= t('nkuht_donate.donation_use_other') %>
|
||||||
|
<%= f.text_field :donation_use_other, :id=>'donation_use_other' %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="has_receipt" class="col-sm-2 control-label"><%= t('nkuht_donate.has_receipt') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<label class="radio-inline">
|
||||||
|
<%= f.radio_button :has_receipt, 'true', :onclick => "$('#donation_has_receipt').removeClass('hide');" %> <%= t('nkuht_donate.yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio-inline">
|
||||||
|
<%= f.radio_button :has_receipt, 'false', :onclick => "$('#donation_has_receipt').addClass('hide');" %> <%= t('nkuht_donate.no_') %>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="donation_has_receipt">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="receipt_title" class="col-sm-2 control-label">*<%= t('nkuht_donate.receipt_title') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<% (1..3).each do |a| %>
|
||||||
|
<label class="radio-inline">
|
||||||
|
<%= f.radio_button :receipt_title, a %> <%= t("nkuht_donate_receipt_title.title#{a}") %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
<%= f.text_field :receipt_title_other, :id=>'receipt_title_other' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="receipt_number" class="col-sm-2 control-label"><%= t('nkuht_donate.receipt_number') %></label>
|
||||||
|
<div class="col-xs-4">
|
||||||
|
<%= f.text_field :receipt_number, :id=>'receipt_number', :class=>"form-control", :placeholder=> t('nkuht_donate.receipt_number') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="receipt_address" class="col-sm-2 control-label">*<%= t('nkuht_donate.receipt_address') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<% (1..2).each do |a| %>
|
||||||
|
<label class="radio">
|
||||||
|
<%= f.radio_button :receipt_address, a %> <%= t("nkuht_donate_receipt_address.add#{a}") %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
<%= f.text_field :receipt_address_other, :class=>"input-medium form-control", :id=>'receipt_address_other' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="donate_public" class="col-sm-2 control-label"><%= t('nkuht_donate.donate_public') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<label class="radio-inline">
|
||||||
|
<%= f.radio_button :donate_public, 'true' %> <%= t('nkuht_donate.donate_public_yes_') %>
|
||||||
|
</label>
|
||||||
|
<label class="radio-inline">
|
||||||
|
<%= f.radio_button :donate_public, 'false' %> <%= t('nkuht_donate.donate_public_no_') %>
|
||||||
|
</label>
|
||||||
|
<label for="donate_public" class="radio-inline">(<%= t('nkuht_donate.donator_show') %>)</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Note -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="note" class="col-sm-2 control-label"><%= t('nkuht_donate.note') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= f.text_area :note, rows: 5, :class=>"input-medium form-control", :placeholder=> t('nkuht_donate.note') %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="note" class="col-sm-2 control-label"><%= t('nkuht_donate.recaptcha') %></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<%= show_simple_captcha %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last %>">
|
||||||
|
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
|
||||||
|
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script language="javascript">
|
||||||
|
function showOther() {
|
||||||
|
var text = $( "#nkuht_donate_main_nkuht_donate_use_id option:selected" ).text();
|
||||||
|
if ( text == "其他" || text == "Other" )
|
||||||
|
{
|
||||||
|
$('#donation_use_other').removeClass('hide');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#donation_use_other').addClass('hide');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,19 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donate = action_data['nkuht_donate']
|
||||||
|
@msg = action_data['msg']
|
||||||
|
%>
|
||||||
|
|
||||||
|
付款失敗, 請重新填寫捐款
|
||||||
|
|
||||||
|
<%# if @nkuht_donate.donation_way == '1' %>
|
||||||
|
|
||||||
|
<%#= @nkuht_donate.donation_payment_status_msg %>
|
||||||
|
|
||||||
|
<%# elsif @nkuht_donate.donation_way == '2' %>
|
||||||
|
|
||||||
|
<%#= @msg["#{@nkuht_donate.donation_payment_status_msg}"] %>
|
||||||
|
|
||||||
|
<%# end %>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
%>
|
||||||
|
付款完成
|
|
@ -0,0 +1,21 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donate = data["nkuht_donate"]
|
||||||
|
@xmldata = data["xmldata"]
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% if @nkuht_donate.donation_way == '2' %>
|
||||||
|
|
||||||
|
<form method="post" action="https://eatm.firstbank.com.tw/acq/cardpay" id='my_form'>
|
||||||
|
<input type="hidden" name="CardPayRq" value="<%= @xmldata %>">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.getElementById("my_form").submit()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
no data
|
||||||
|
<% end %>
|
|
@ -0,0 +1,36 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donate = data["nkuht_donate"]
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% if @nkuht_donate.donation_way == '1' %>
|
||||||
|
|
||||||
|
<form method="post" action="https://www.focas.fisc.com.tw/FOCAS_WEBPOS/online/" id='xml_forms'>
|
||||||
|
|
||||||
|
<input type="hidden" name="MerchantID" value="007774955429001">
|
||||||
|
|
||||||
|
<input type="hidden" name="TerminalID" value="90010001">
|
||||||
|
|
||||||
|
<input type="hidden" name="merID" value="77495542">
|
||||||
|
|
||||||
|
<input type="hidden" name="MerchantName" value="">
|
||||||
|
|
||||||
|
<input type="hidden" name="purchAmt" value="<%= @nkuht_donate.donation_amount %>">
|
||||||
|
|
||||||
|
<input type="hidden" name="lidm" value="<%= @nkuht_donate.donation_payment_number%>">
|
||||||
|
|
||||||
|
<input type="hidden" name="AutoCap" value="1">
|
||||||
|
|
||||||
|
<input type="hidden" name="AuthResURL" value="http://donations.nkuht.edu.tw/donate_card">
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.getElementById("xml_forms").submit()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
no data
|
||||||
|
<% end %>
|
|
@ -0,0 +1,130 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donate = data["nkuht_donate"]
|
||||||
|
@barcodes = data["barcodes"]
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% if @nkuht_donate.donation_way == '3' %>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh_tw" class="orbit">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>捐贈繳款單</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@media print {
|
||||||
|
.NoPrint {display:none}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function printPage() {
|
||||||
|
if (window.print) {
|
||||||
|
agree = confirm('列印此頁!\n\n確定列印?');
|
||||||
|
if (agree) window.print();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<table width="700" height="250" cellpadding='2' cellspacing="2" rules="all" style="border:1px #000000" >
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" bgcolor="#8CB210">國立高雄餐旅大學 捐款單</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">感謝您捐款興學!</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="20" rowspan="6">第一聯客戶留存</td>
|
||||||
|
<td width="100">繳款編號</td>
|
||||||
|
<td width="130"><%= @nkuht_donate.donation_payment_number %></td>
|
||||||
|
<td width="250" align="center">超商代收收訖章</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>繳款項目</td>
|
||||||
|
<td>捐款</td>
|
||||||
|
<td rowspan="5" height="200"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>印單日期</td>
|
||||||
|
<td><%= @nkuht_donate.donation_serial_date.to_date %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>繳款期限</td>
|
||||||
|
<td><%= @nkuht_donate.donation_serial_date.to_date + 14 %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>應繳金額</td>
|
||||||
|
<td>NT$ <%= @nkuht_donate.donation_amount %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">*繳款完畢,請保留收據,作為日後對帳之依據。</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<hr style="border:2px dotted" size="3" width="695">
|
||||||
|
<table width="700" height="350" cellpadding='2' cellspacing="2" rules="all" style="border:1px #000000" >
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" bgcolor="#8CB210">國立高雄餐旅大學 捐款單</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">感謝您捐款興學!</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="20" rowspan="6">第二聯超商代收留存</td>
|
||||||
|
<td width="100">繳款編號</td>
|
||||||
|
<td width="120"><%= @nkuht_donate.donation_payment_number %></td>
|
||||||
|
<td width="260" align="center">超商代收專用條碼</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>繳款項目</td>
|
||||||
|
<td>捐款</td>
|
||||||
|
<td rowspan="5" align="center">
|
||||||
|
* <img src="<%="/code39_1.png"%>" > * <br />
|
||||||
|
<%= @barcodes[0] %> <br />
|
||||||
|
|
||||||
|
* <img src="<%="/code39_2.png"%>" > * <br />
|
||||||
|
<%= @barcodes[1] %> <br />
|
||||||
|
|
||||||
|
* <img src="<%="/code39_3.png"%>" > * <br />
|
||||||
|
<%= @barcodes[2] %> <br />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>印單日期</td>
|
||||||
|
<td><%= @nkuht_donate.donation_serial_date.to_date %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>繳款期限</td>
|
||||||
|
<td><%= @nkuht_donate.donation_serial_date.to_date + 14 %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>應繳金額</td>
|
||||||
|
<td>NT$ <%= @nkuht_donate.donation_amount %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">*繳款完畢,請保留收據,作為日後對帳之依據。<br />
|
||||||
|
*本繳款單建議以雷射印表機列印,若無法讀取條碼,煩請捐款者以其他方式另行繳款。</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p>超商代收說明: </p>
|
||||||
|
<ol>
|
||||||
|
<li>請列印繳款單後至四大超商(統一、全家、萊爾富、OK)進行繳款。 </li>
|
||||||
|
<li>每筆繳款單手續費10元(繳款單每筆繳款上限為2萬元)。 </li>
|
||||||
|
<li>依據系統列印之繳款單,繳款有效日期為14天,未於期限內繳款者,繳款單自動失效。 </li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<input name="print" type="button" id="printPage" value="列印" class="NoPrint" onClick="window.print()">
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
no data
|
||||||
|
<% end %>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donate = data["nkuht_donate"]
|
||||||
|
|
||||||
|
# 4: 現金
|
||||||
|
# 5: 支票
|
||||||
|
# 6: 匯款
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% if @nkuht_donate.donation_way == '4' %>
|
||||||
|
|
||||||
|
捐款成功!請本人或委託他人將現金送交總務處出納組,同時開立捐款收據。
|
||||||
|
|
||||||
|
<% elsif @nkuht_donate.donation_way == '5' %>
|
||||||
|
|
||||||
|
捐款成功!支票抬頭請開立「國立高雄餐旅大學」,加劃橫線,註明「禁止背書轉讓」,以掛號郵寄至高雄市小港區松和路一號 國立高雄餐旅大學秘書室 收。
|
||||||
|
|
||||||
|
<% elsif @nkuht_donate.donation_way == '6' %>
|
||||||
|
|
||||||
|
捐款成功!請匯入:「第一商業銀行小港分行」,戶名「國立高雄餐旅大學401專戶」,帳號「71430010289」。
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
no data
|
||||||
|
<% end %>
|
|
@ -0,0 +1,128 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<%
|
||||||
|
data = action_data
|
||||||
|
@nkuht_donate = data["nkuht_donate"]
|
||||||
|
%>
|
||||||
|
|
||||||
|
<% if @nkuht_donate.donation_way == '4' || @nkuht_donate.donation_way == '5' %>
|
||||||
|
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh_tw" class="orbit">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title>收款通知書</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@media print {
|
||||||
|
.NoPrint {display:none}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function printPage() {
|
||||||
|
if (window.print) {
|
||||||
|
agree = confirm('列印此頁!\n\n確定列印?');
|
||||||
|
if (agree) window.print();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div align="right"><b>繳件日期: 年 月 日 </b></div>
|
||||||
|
|
||||||
|
<table width="100%" border="1px" cellspacing="0" cellpadding="8">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" align="center"><b><h2>國立高雄餐旅大學收款通知書</h2></b></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="15%" align="center"><b>收款事由</b></td>
|
||||||
|
<td width="85%"><b>捐贈收入 </b><br /><br />
|
||||||
|
<b>用途:
|
||||||
|
<%=
|
||||||
|
|
||||||
|
if !@nkuht_donate.nkuht_donate_use.blank?
|
||||||
|
if @nkuht_donate.nkuht_donate_use.title == '其他' || @nkuht_donate.nkuht_donate_use.title == 'Other'
|
||||||
|
"#{@nkuht_donate.nkuht_donate_use.title}(#{@nkuht_donate.donation_use_other})"
|
||||||
|
else
|
||||||
|
@nkuht_donate.nkuht_donate_use.title
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
%>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><b>繳 款 人</b></td>
|
||||||
|
<%
|
||||||
|
if @nkuht_donate.receipt_title == '1'
|
||||||
|
@receipt_title = @nkuht_donate.name
|
||||||
|
elsif @nkuht_donate.receipt_title == '2'
|
||||||
|
@receipt_title = @nkuht_donate.donors_service_unit
|
||||||
|
else
|
||||||
|
@receipt_title = @nkuht_donate.receipt_title_other
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<td>
|
||||||
|
<b>名稱(即收據抬頭):<u> <%= @receipt_title %> </u> </b>
|
||||||
|
<br /><br />
|
||||||
|
<b>身份證字號(或統一編號):<u> <%= @nkuht_donate.receipt_number %> </u></b>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><b>收款金額</b></td>
|
||||||
|
<td>
|
||||||
|
<b>金額:<u> <%= @nkuht_donate.donation_amount %> </u>元整(阿拉伯數字)</b><br /><br />
|
||||||
|
<b>新台幣<%= NkuhtDonateMain.change_cash(@nkuht_donate.donation_amount) %>元整</b>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><b>收款日期</b></td>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><b>收款方式</b></td>
|
||||||
|
<td>
|
||||||
|
<b>
|
||||||
|
<%= t("nkuht_donate_ways.ways#{@nkuht_donate.donation_way}") if !@nkuht_donate.donation_way.blank? %>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><b>備 註</b></td>
|
||||||
|
<td>
|
||||||
|
<b>
|
||||||
|
如需郵寄收據請加註遞送住址。<br />
|
||||||
|
<br />
|
||||||
|
<% if @nkuht_donate.receipt_address == '2' %>
|
||||||
|
遞送住址: <%= @nkuht_donate.receipt_address_other %>
|
||||||
|
<% end %>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<p><b>此 致 </b></p>
|
||||||
|
<b> 總 務 處 出 納 組</b></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br /><b>經辦人: </b>
|
||||||
|
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<input name="print" type="button" id="printPage" value="列印" class="NoPrint" onClick="window.print()">
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
no data
|
||||||
|
<% end %>
|
|
@ -0,0 +1,33 @@
|
||||||
|
<style type="text/css">
|
||||||
|
.simple_captcha{border: 1px solid #ccc; padding: 5px !important;}
|
||||||
|
.simple_captcha,
|
||||||
|
.simple_captcha div{display: table;}
|
||||||
|
.simple_captcha .simple_captcha_field,
|
||||||
|
.simple_captcha .simple_captcha_image{
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
margin: 0px 0px 2px 0px !important;
|
||||||
|
padding: 0px !important;
|
||||||
|
}
|
||||||
|
.simple_captcha .simple_captcha_image img{
|
||||||
|
margin: 0px !important;
|
||||||
|
padding: 0px !important;
|
||||||
|
width: 110px !important;
|
||||||
|
}
|
||||||
|
.simple_captcha .simple_captcha_label{font-size: 12px;}
|
||||||
|
.simple_captcha .simple_captcha_field input{
|
||||||
|
width: 150px !important;
|
||||||
|
font-size: 16px;
|
||||||
|
border: none;
|
||||||
|
background-color: #efefef;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class='simple_captcha'>
|
||||||
|
<div class='simple_captcha_image'>
|
||||||
|
<%= simple_captcha_options[:image] %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='simple_captcha_field'>
|
||||||
|
<%= simple_captcha_options[:field] %>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
||||||
|
|
||||||
|
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
||||||
|
ENGINE_PATH = File.expand_path('../../lib/nkuht_donate/engine', __FILE__)
|
||||||
|
|
||||||
|
# Set up gems listed in the Gemfile.
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||||
|
|
||||||
|
# require 'rails/all'
|
||||||
|
# require 'rails/engine/commands'
|
||||||
|
require "action_controller/railtie"
|
||||||
|
require "action_mailer/railtie"
|
||||||
|
require "sprockets/railtie"
|
||||||
|
require "rails/test_unit/railtie"
|
||||||
|
require 'rails/engine/commands'
|
||||||
|
require "mongoid/railtie"
|
|
@ -0,0 +1,102 @@
|
||||||
|
en:
|
||||||
|
|
||||||
|
simple_captcha:
|
||||||
|
placeholder: ""
|
||||||
|
label: ""
|
||||||
|
|
||||||
|
module_name:
|
||||||
|
nkuht_donate: Donation
|
||||||
|
|
||||||
|
recaptcha:
|
||||||
|
errors:
|
||||||
|
verification_failed: Verification Code Error
|
||||||
|
|
||||||
|
nkuht_donate:
|
||||||
|
export_csv: 匯出CSV
|
||||||
|
recaptcha: Verification Code
|
||||||
|
yes_: Yes
|
||||||
|
no_: No
|
||||||
|
donate_public_yes_: Agree
|
||||||
|
donate_public_no_: Disagree
|
||||||
|
nkuht_donate: Donation
|
||||||
|
donation_serial_date: 捐贈日期
|
||||||
|
name: Donator Name
|
||||||
|
anonymous: Anonymous
|
||||||
|
donors_service_unit: Company Title
|
||||||
|
tel: Tel
|
||||||
|
email: Email
|
||||||
|
donation_amount: Donation Amount
|
||||||
|
nt: NT$
|
||||||
|
dollars: Dollars
|
||||||
|
amount_note: Please fill in with Arabic numerals
|
||||||
|
donation_way: Donation Method
|
||||||
|
cheque_number: Cheque Number
|
||||||
|
donation_unit: Designated department for the donation
|
||||||
|
donation_use: Designated usage fot the donation
|
||||||
|
donation_use_other: Other
|
||||||
|
is_alumni: Alumnus?
|
||||||
|
department: Department
|
||||||
|
graduation_department: Department
|
||||||
|
graduation_year: Graduation Year
|
||||||
|
has_receipt: 是否開立收據
|
||||||
|
receipt_title: Title of the receipt
|
||||||
|
receipt_number: ID number / Company ID number
|
||||||
|
receipt_address: Receipt
|
||||||
|
donate_public: Donator List Page
|
||||||
|
donator_show: to show my name and donation amount
|
||||||
|
donation_payment_number: 銷帳編號
|
||||||
|
donation_payment_status: 付款
|
||||||
|
donation_write_off_status: 銷帳
|
||||||
|
receipt_notice: 收款通知書
|
||||||
|
note: P.S.
|
||||||
|
notice: Notice
|
||||||
|
download_page: download page
|
||||||
|
notice1: Please make sure you have a ATM card and card reader before you delect donattion by ATM
|
||||||
|
notice1_1: ". If not, the system will redirect you to card reader driver download page and re-start the whole donation process after you download and install it."
|
||||||
|
notice2: "Donation amount for ATM method is limited to NT$30,000."
|
||||||
|
notice3: "Donation amount for paying at convenience stores is limited to NT$20,000."
|
||||||
|
set_nkuht_donate_units: 設定單位
|
||||||
|
set_nkuht_donate_departments: 設定系別
|
||||||
|
set_nkuht_donate_uses: 設定用途
|
||||||
|
donation_amount_err: Donation amount is greater than 0
|
||||||
|
donation_amount_atm: "Donation amount is limited to NT$30,000."
|
||||||
|
donation_amount_market: "Donation amount is limited to NT$20,000."
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
nkuht_donate: Donation Frontend
|
||||||
|
|
||||||
|
nkuht_donate_ways:
|
||||||
|
ways1: Credit Card
|
||||||
|
ways2: ATM
|
||||||
|
ways3: Pay at Convenient Stores within Taiwan
|
||||||
|
ways4: Cash
|
||||||
|
ways5: Cheque
|
||||||
|
ways6: Telegraphic transfer
|
||||||
|
|
||||||
|
nkuht_donate_receipt_title:
|
||||||
|
title1: Same as donator name
|
||||||
|
title2: Same as company title
|
||||||
|
title3: Other
|
||||||
|
|
||||||
|
nkuht_donate_receipt_address:
|
||||||
|
add1: Apply in person
|
||||||
|
add2: Mail to the Address
|
||||||
|
|
||||||
|
nkuht_donate_unit:
|
||||||
|
new_unit: 新增單位
|
||||||
|
edit_unit: 編輯單位
|
||||||
|
set_unit: 設定單位
|
||||||
|
del_unit: 刪除單位
|
||||||
|
|
||||||
|
nkuht_donate_department:
|
||||||
|
new_department: 新增系別
|
||||||
|
edit_department: 編輯系別
|
||||||
|
set_department: 設定系別
|
||||||
|
del_department: 刪除系別
|
||||||
|
|
||||||
|
nkuht_donate_use:
|
||||||
|
new_use: 新增用途
|
||||||
|
edit_use: 編輯用途
|
||||||
|
set_use: 設定用途
|
||||||
|
del_use: 刪除用途
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
zh_tw:
|
||||||
|
|
||||||
|
simple_captcha:
|
||||||
|
placeholder: ""
|
||||||
|
label: ""
|
||||||
|
|
||||||
|
restful_actions:
|
||||||
|
act_signup: 報名資料
|
||||||
|
|
||||||
|
module_name:
|
||||||
|
nkuht_donate: 捐贈
|
||||||
|
|
||||||
|
recaptcha:
|
||||||
|
errors:
|
||||||
|
verification_failed: 驗證碼錯誤
|
||||||
|
|
||||||
|
nkuht_donate:
|
||||||
|
export_csv: 匯出CSV
|
||||||
|
recaptcha: 驗證碼
|
||||||
|
yes_: 是
|
||||||
|
no_: 否
|
||||||
|
donate_public_yes_: 同意
|
||||||
|
donate_public_no_: 不同意
|
||||||
|
nkuht_donate: 捐贈
|
||||||
|
donation_serial_date: 捐贈日期
|
||||||
|
name: 捐贈者姓名
|
||||||
|
anonymous: 匿名者請填寫善心人士
|
||||||
|
donors_service_unit: 捐贈者服務單位
|
||||||
|
tel: 捐贈者聯絡電話
|
||||||
|
email: 捐贈者E-mail
|
||||||
|
donation_amount: 捐款金額
|
||||||
|
nt: 新台幣
|
||||||
|
dollars: 元
|
||||||
|
amount_note: 請填寫阿拉伯數字,勿填國字
|
||||||
|
donation_way: 捐款方式
|
||||||
|
cheque_number: 票號
|
||||||
|
donation_unit: 指定捐贈單位
|
||||||
|
donation_use: 指定捐贈用途
|
||||||
|
donation_use_other: 說明
|
||||||
|
is_alumni: 是否為系友
|
||||||
|
department: 系別
|
||||||
|
graduation_department: 畢業系所
|
||||||
|
graduation_year: 畢業年
|
||||||
|
has_receipt: 是否開立收據
|
||||||
|
receipt_title: 收據抬頭
|
||||||
|
receipt_number: 統一編號(或身分證號)
|
||||||
|
receipt_address: 寄送地址
|
||||||
|
donate_public: 芳名錄公告
|
||||||
|
donator_show: 將姓名及捐款金額公告於芳名錄
|
||||||
|
donation_payment_number: 銷帳編號
|
||||||
|
donation_payment_status: 付款
|
||||||
|
donation_write_off_status: 銷帳
|
||||||
|
receipt_notice: 收款通知書
|
||||||
|
note: 備註
|
||||||
|
download_page: 下載元件
|
||||||
|
notice: 注意事項
|
||||||
|
notice1: 如點選atm轉帳請先確認電腦是否有安裝讀卡機,若無安裝,網頁將連線至讀卡機元件安裝的頁面
|
||||||
|
notice1_1: 。安裝完成後,先前所完成的捐款流程均無效,請再重新一次捐款流程。
|
||||||
|
notice2: 如選擇atm轉帳,單筆捐款金額不得大於30000元。
|
||||||
|
notice3: 如選擇超商繳款,單筆捐款金額不得大於20000元。
|
||||||
|
set_nkuht_donate_units: 設定單位
|
||||||
|
set_nkuht_donate_departments: 設定系別
|
||||||
|
set_nkuht_donate_uses: 設定用途
|
||||||
|
donation_amount_err: 捐款金額要大於0
|
||||||
|
donation_amount_atm: 單筆捐款金額不得大於30000元
|
||||||
|
donation_amount_market: 單筆捐款金額不得大於20000元
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
nkuht_donate: 捐贈前台
|
||||||
|
|
||||||
|
nkuht_donate_ways:
|
||||||
|
ways1: 信用卡
|
||||||
|
ways2: atm轉帳
|
||||||
|
ways3: 超商繳款
|
||||||
|
ways4: 現金
|
||||||
|
ways5: 支票
|
||||||
|
ways6: 匯款
|
||||||
|
|
||||||
|
nkuht_donate_receipt_title:
|
||||||
|
title1: 同捐款者姓名
|
||||||
|
title2: 同捐款者服務單位
|
||||||
|
title3: 其他
|
||||||
|
|
||||||
|
nkuht_donate_receipt_address:
|
||||||
|
add1: 親自領取
|
||||||
|
add2: 住址
|
||||||
|
|
||||||
|
nkuht_donate_unit:
|
||||||
|
new_unit: 新增單位
|
||||||
|
edit_unit: 編輯單位
|
||||||
|
set_unit: 設定單位
|
||||||
|
del_unit: 刪除單位
|
||||||
|
|
||||||
|
nkuht_donate_department:
|
||||||
|
new_department: 新增系別
|
||||||
|
edit_department: 編輯系別
|
||||||
|
set_department: 設定系別
|
||||||
|
del_department: 刪除系別
|
||||||
|
|
||||||
|
nkuht_donate_use:
|
||||||
|
new_use: 新增用途
|
||||||
|
edit_use: 編輯用途
|
||||||
|
set_use: 設定用途
|
||||||
|
del_use: 刪除用途
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||||
|
|
||||||
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
|
namespace :admin do
|
||||||
|
resources :nkuht_donates do
|
||||||
|
collection do
|
||||||
|
get 'export'
|
||||||
|
end
|
||||||
|
member do
|
||||||
|
get 'set_write_off'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
resources :nkuht_donate_units do
|
||||||
|
collection do
|
||||||
|
post 'delete_units'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
resources :nkuht_donate_departments do
|
||||||
|
collection do
|
||||||
|
post 'delete_departments'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
resources :nkuht_donate_uses do
|
||||||
|
collection do
|
||||||
|
post 'delete_uses'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
resources :nkuht_donates
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
require "nkuht_donate/engine"
|
||||||
|
|
||||||
|
module NkuhtDonate
|
||||||
|
end
|
|
@ -0,0 +1,46 @@
|
||||||
|
module NkuhtDonate
|
||||||
|
class Engine < ::Rails::Engine
|
||||||
|
initializer "nkuht_donate" do
|
||||||
|
OrbitApp.registration "NkuhtDonate", :type => "ModuleApp" do
|
||||||
|
module_label "nkuht_donate.nkuht_donate"
|
||||||
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
authorizable
|
||||||
|
frontend_enabled
|
||||||
|
|
||||||
|
side_bar do
|
||||||
|
head_label_i18n 'nkuht_donate.nkuht_donate', icon_class: "icon-credit-card"
|
||||||
|
available_for "managers"
|
||||||
|
active_for_controllers (['admin/nkuht_donates'])
|
||||||
|
head_link_path "admin_nkuht_donates_path"
|
||||||
|
|
||||||
|
context_link 'list_',
|
||||||
|
:link_path=>"admin_nkuht_donates_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{'admin/nkuht_donates'=>'index'},
|
||||||
|
:available_for => 'managers'
|
||||||
|
context_link 'new_',
|
||||||
|
:link_path=>"new_admin_nkuht_donate_path" ,
|
||||||
|
:priority=>2,
|
||||||
|
:active_for_action=>{'admin/nkuht_donates'=>'new'},
|
||||||
|
:available_for => 'managers'
|
||||||
|
context_link 'nkuht_donate.set_nkuht_donate_departments',
|
||||||
|
:link_path=>"admin_nkuht_donate_departments_path" ,
|
||||||
|
:priority=>3,
|
||||||
|
:active_for_action=>{'admin/nkuht_donates'=>'nkuht_donate_departments'},
|
||||||
|
:available_for => 'managers'
|
||||||
|
context_link 'nkuht_donate.set_nkuht_donate_units',
|
||||||
|
:link_path=>"admin_nkuht_donate_units_path" ,
|
||||||
|
:priority=>3,
|
||||||
|
:active_for_action=>{'admin/nkuht_donates'=>'nkuht_donate_units'},
|
||||||
|
:available_for => 'managers'
|
||||||
|
context_link 'nkuht_donate.set_nkuht_donate_uses',
|
||||||
|
:link_path=>"admin_nkuht_donate_uses_path" ,
|
||||||
|
:priority=>3,
|
||||||
|
:active_for_action=>{'admin/nkuht_donates'=>'nkuht_donate_uses'},
|
||||||
|
:available_for => 'managers'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module NkuhtDonate
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# desc "Explaining what the task does"
|
||||||
|
# task :nkuht_donate do
|
||||||
|
# # Task goes here
|
||||||
|
# end
|
|
@ -0,0 +1,24 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "nkuht_donate/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "nkuht_donate"
|
||||||
|
s.version = NkuhtDonate::VERSION
|
||||||
|
s.authors = ["RulingDigital"]
|
||||||
|
s.email = ["orbit@rulingcom.com"]
|
||||||
|
s.homepage = "http://www.rulingcom.com"
|
||||||
|
s.summary = "NkuhtDonates for Orbit"
|
||||||
|
s.description = "NkuhtDonates for Orbit"
|
||||||
|
s.license = "MIT"
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
s.add_dependency "barby", "~> 0.6.2"
|
||||||
|
s.add_dependency "chunky_png"
|
||||||
|
s.add_dependency "barby-chunky_png"
|
||||||
|
s.add_dependency "pack"
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class NkuhtDonateControllerTest < ActionController::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
== README
|
||||||
|
|
||||||
|
This README would normally document whatever steps are necessary to get the
|
||||||
|
application up and running.
|
||||||
|
|
||||||
|
Things you may want to cover:
|
||||||
|
|
||||||
|
* Ruby version
|
||||||
|
|
||||||
|
* System dependencies
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
|
||||||
|
* Database creation
|
||||||
|
|
||||||
|
* Database initialization
|
||||||
|
|
||||||
|
* How to run the test suite
|
||||||
|
|
||||||
|
* Services (job queues, cache servers, search engines, etc.)
|
||||||
|
|
||||||
|
* Deployment instructions
|
||||||
|
|
||||||
|
* ...
|
||||||
|
|
||||||
|
|
||||||
|
Please feel free to use a different markup language if you do not plan to run
|
||||||
|
<tt>rake doc:app</tt>.
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
|
require File.expand_path('../config/application', __FILE__)
|
||||||
|
|
||||||
|
Rails.application.load_tasks
|
|
@ -0,0 +1,13 @@
|
||||||
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||||
|
// listed below.
|
||||||
|
//
|
||||||
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||||
|
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
||||||
|
//
|
||||||
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||||
|
// compiled file.
|
||||||
|
//
|
||||||
|
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
||||||
|
// about supported directives.
|
||||||
|
//
|
||||||
|
//= require_tree .
|
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
|
* listed below.
|
||||||
|
*
|
||||||
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||||
|
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
||||||
|
*
|
||||||
|
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||||
|
* compiled file so the styles you add here take precedence over styles defined in any styles
|
||||||
|
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||||
|
* file per style scope.
|
||||||
|
*
|
||||||
|
*= require_tree .
|
||||||
|
*= require_self
|
||||||
|
*/
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
# Prevent CSRF attacks by raising an exception.
|
||||||
|
# For APIs, you may want to use :null_session instead.
|
||||||
|
protect_from_forgery with: :exception
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dummy</title>
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
|
load Gem.bin_path('bundler', 'bundle')
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rails/commands'
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rake'
|
||||||
|
Rake.application.run
|
|
@ -0,0 +1,4 @@
|
||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
run Rails.application
|
|
@ -0,0 +1,23 @@
|
||||||
|
require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
|
require 'rails/all'
|
||||||
|
|
||||||
|
Bundler.require(*Rails.groups)
|
||||||
|
require "nkuht_donate"
|
||||||
|
|
||||||
|
module Dummy
|
||||||
|
class Application < Rails::Application
|
||||||
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
|
# Application configuration should go into files in config/initializers
|
||||||
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
||||||
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
|
# config.time_zone = 'Central Time (US & Canada)'
|
||||||
|
|
||||||
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||||
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
|
# config.i18n.default_locale = :de
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Set up gems listed in the Gemfile.
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
||||||
|
|
||||||
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||||
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@ -0,0 +1,25 @@
|
||||||
|
# SQLite version 3.x
|
||||||
|
# gem install sqlite3
|
||||||
|
#
|
||||||
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||||
|
# gem 'sqlite3'
|
||||||
|
#
|
||||||
|
default: &default
|
||||||
|
adapter: sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *default
|
||||||
|
database: db/development.sqlite3
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test:
|
||||||
|
<<: *default
|
||||||
|
database: db/test.sqlite3
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *default
|
||||||
|
database: db/production.sqlite3
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Load the Rails application.
|
||||||
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
|
# Initialize the Rails application.
|
||||||
|
Rails.application.initialize!
|
|
@ -0,0 +1,37 @@
|
||||||
|
Rails.application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# In the development environment your application's code is reloaded on
|
||||||
|
# every request. This slows down response time but is perfect for development
|
||||||
|
# since you don't have to restart the web server when you make code changes.
|
||||||
|
config.cache_classes = false
|
||||||
|
|
||||||
|
# Do not eager load code on boot.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Show full error reports and disable caching.
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Don't care if the mailer can't send.
|
||||||
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Print deprecation notices to the Rails logger.
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Raise an error on page load if there are pending migrations.
|
||||||
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
|
# This option may cause significant delays in view rendering with a large
|
||||||
|
# number of complex assets.
|
||||||
|
config.assets.debug = true
|
||||||
|
|
||||||
|
# Adds additional error checking when serving assets at runtime.
|
||||||
|
# Checks for improperly declared sprockets dependencies.
|
||||||
|
# Raises helpful error messages.
|
||||||
|
config.assets.raise_runtime_errors = true
|
||||||
|
|
||||||
|
# Raises error for missing translations
|
||||||
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
end
|
|
@ -0,0 +1,78 @@
|
||||||
|
Rails.application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# Code is not reloaded between requests.
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
|
# your application in memory, allowing both threaded web servers
|
||||||
|
# and those relying on copy on write to perform better.
|
||||||
|
# Rake tasks automatically ignore this option for performance.
|
||||||
|
config.eager_load = true
|
||||||
|
|
||||||
|
# Full error reports are disabled and caching is turned on.
|
||||||
|
config.consider_all_requests_local = false
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
|
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||||
|
# Add `rack-cache` to your Gemfile before enabling this.
|
||||||
|
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||||
|
# config.action_dispatch.rack_cache = true
|
||||||
|
|
||||||
|
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||||
|
config.serve_static_assets = false
|
||||||
|
|
||||||
|
# Compress JavaScripts and CSS.
|
||||||
|
config.assets.js_compressor = :uglifier
|
||||||
|
# config.assets.css_compressor = :sass
|
||||||
|
|
||||||
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
|
config.assets.compile = false
|
||||||
|
|
||||||
|
# Generate digests for assets URLs.
|
||||||
|
config.assets.digest = true
|
||||||
|
|
||||||
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
||||||
|
|
||||||
|
# Specifies the header that your server uses for sending files.
|
||||||
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||||
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||||
|
|
||||||
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
|
# config.force_ssl = true
|
||||||
|
|
||||||
|
# Set to :debug to see everything in the log.
|
||||||
|
config.log_level = :info
|
||||||
|
|
||||||
|
# Prepend all log lines with the following tags.
|
||||||
|
# config.log_tags = [ :subdomain, :uuid ]
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups.
|
||||||
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||||
|
|
||||||
|
# Use a different cache store in production.
|
||||||
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
|
# the I18n.default_locale when a translation cannot be found).
|
||||||
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
|
# Send deprecation notices to registered listeners.
|
||||||
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
|
# Disable automatic flushing of the log to improve performance.
|
||||||
|
# config.autoflush_log = false
|
||||||
|
|
||||||
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
|
# Do not dump schema after migrations.
|
||||||
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
end
|
|
@ -0,0 +1,39 @@
|
||||||
|
Rails.application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# The test environment is used exclusively to run your application's
|
||||||
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Do not eager load code on boot. This avoids loading your whole application
|
||||||
|
# just for the purpose of running a single test. If you are using a tool that
|
||||||
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Configure static asset server for tests with Cache-Control for performance.
|
||||||
|
config.serve_static_assets = true
|
||||||
|
config.static_cache_control = 'public, max-age=3600'
|
||||||
|
|
||||||
|
# Show full error reports and disable caching.
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Raise exceptions instead of rendering exception templates.
|
||||||
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
|
# Disable request forgery protection in test environment.
|
||||||
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
|
# The :test delivery method accumulates sent emails in the
|
||||||
|
# ActionMailer::Base.deliveries array.
|
||||||
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr.
|
||||||
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
# Raises error for missing translations
|
||||||
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
|
Rails.application.config.assets.version = '1.0'
|
||||||
|
|
||||||
|
# Precompile additional assets.
|
||||||
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
|
# Rails.application.config.assets.precompile += %w( search.js )
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||||
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||||
|
|
||||||
|
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||||
|
# Rails.backtrace_cleaner.remove_silencers!
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
Rails.application.config.filter_parameters += [:password]
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new inflection rules using the following format. Inflections
|
||||||
|
# are locale specific, and you may define rules for as many different
|
||||||
|
# locales as you wish. All of these examples are active by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
|
# inflect.irregular 'person', 'people'
|
||||||
|
# inflect.uncountable %w( fish sheep )
|
||||||
|
# end
|
||||||
|
|
||||||
|
# These inflection rules are supported but not enabled by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.acronym 'RESTful'
|
||||||
|
# end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new mime types for use in respond_to blocks:
|
||||||
|
# Mime::Type.register "text/richtext", :rtf
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Rails.application.config.session_store :cookie_store, key: '_dummy_session'
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# This file contains settings for ActionController::ParamsWrapper which
|
||||||
|
# is enabled by default.
|
||||||
|
|
||||||
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||||
|
end
|
||||||
|
|
||||||
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
|
# ActiveSupport.on_load(:active_record) do
|
||||||
|
# self.include_root_in_json = true
|
||||||
|
# end
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Files in the config/locales directory are used for internationalization
|
||||||
|
# and are automatically loaded by Rails. If you want to use locales other
|
||||||
|
# than English, add the necessary files in this directory.
|
||||||
|
#
|
||||||
|
# To use the locales, use `I18n.t`:
|
||||||
|
#
|
||||||
|
# I18n.t 'hello'
|
||||||
|
#
|
||||||
|
# In views, this is aliased to just `t`:
|
||||||
|
#
|
||||||
|
# <%= t('hello') %>
|
||||||
|
#
|
||||||
|
# To use a different locale, set it with `I18n.locale`:
|
||||||
|
#
|
||||||
|
# I18n.locale = :es
|
||||||
|
#
|
||||||
|
# This would use the information in config/locales/es.yml.
|
||||||
|
#
|
||||||
|
# To learn more, please read the Rails Internationalization guide
|
||||||
|
# available at http://guides.rubyonrails.org/i18n.html.
|
||||||
|
|
||||||
|
en:
|
||||||
|
hello: "Hello world"
|
|
@ -0,0 +1,56 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
||||||
|
# You can have the root of your site routed with "root"
|
||||||
|
# root 'welcome#index'
|
||||||
|
|
||||||
|
# Example of regular route:
|
||||||
|
# get 'products/:id' => 'catalog#view'
|
||||||
|
|
||||||
|
# Example of named route that can be invoked with purchase_url(id: product.id)
|
||||||
|
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
||||||
|
|
||||||
|
# Example resource route (maps HTTP verbs to controller actions automatically):
|
||||||
|
# resources :products
|
||||||
|
|
||||||
|
# Example resource route with options:
|
||||||
|
# resources :products do
|
||||||
|
# member do
|
||||||
|
# get 'short'
|
||||||
|
# post 'toggle'
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# collection do
|
||||||
|
# get 'sold'
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Example resource route with sub-resources:
|
||||||
|
# resources :products do
|
||||||
|
# resources :comments, :sales
|
||||||
|
# resource :seller
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Example resource route with more complex sub-resources:
|
||||||
|
# resources :products do
|
||||||
|
# resources :comments
|
||||||
|
# resources :sales do
|
||||||
|
# get 'recent', on: :collection
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
# Example resource route with concerns:
|
||||||
|
# concern :toggleable do
|
||||||
|
# post 'toggle'
|
||||||
|
# end
|
||||||
|
# resources :posts, concerns: :toggleable
|
||||||
|
# resources :photos, concerns: :toggleable
|
||||||
|
|
||||||
|
# Example resource route within a namespace:
|
||||||
|
# namespace :admin do
|
||||||
|
# # Directs /admin/products/* to Admin::ProductsController
|
||||||
|
# # (app/controllers/admin/products_controller.rb)
|
||||||
|
# resources :products
|
||||||
|
# end
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Your secret key is used for verifying the integrity of signed cookies.
|
||||||
|
# If you change this key, all old signed cookies will become invalid!
|
||||||
|
|
||||||
|
# Make sure the secret is at least 30 characters and all random,
|
||||||
|
# no regular words or you'll be exposed to dictionary attacks.
|
||||||
|
# You can use `rake secret` to generate a secure secret key.
|
||||||
|
|
||||||
|
# Make sure the secrets in this file are kept private
|
||||||
|
# if you're sharing your code publicly.
|
||||||
|
|
||||||
|
development:
|
||||||
|
secret_key_base: 59b108e68991041f31612ed88d72cb4b5db2e7a73330ce38322d1ab1868b0382e127ffd7d3a84da1384f439771209942bbb92e790fe57a6078b815deb628283a
|
||||||
|
|
||||||
|
test:
|
||||||
|
secret_key_base: dacc1a3ac4e979fa27382fce67db69360ea22f83b805e1c9578e6ff56f89bbed3ceea4c29275d7b9616127fdf11d47da4809a685ada1901a77ff46aee0350bca
|
||||||
|
|
||||||
|
# Do not keep production secrets in the repository,
|
||||||
|
# instead read values from the environment.
|
||||||
|
production:
|
||||||
|
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue