common_engine 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +24 -0
- data/Rakefile +6 -0
- data/app/assets/config/manifest.js +3 -0
- data/app/assets/javascripts/application.js +16 -0
- data/app/assets/javascripts/cable.js +13 -0
- data/app/assets/javascripts/init_fullcalendar.js +40 -0
- data/app/assets/stylesheets/application.css +15 -0
- data/app/channels/application_cable/channel.rb +4 -0
- data/app/channels/application_cable/connection.rb +4 -0
- data/app/controllers/application_base_controller.rb +61 -0
- data/app/controllers/concerns/fullcalendar_utility.rb +47 -0
- data/app/controllers/concerns/zoom_utility.rb +110 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/jobs/application_job.rb +2 -0
- data/app/mailers/application_mailer.rb +4 -0
- data/app/models/application_base_record.rb +48 -0
- data/app/models/common_engine/admin.rb +13 -0
- data/app/models/common_engine/admin_login_history.rb +5 -0
- data/app/models/common_engine/chapter.rb +25 -0
- data/app/models/common_engine/commodity.rb +6 -0
- data/app/models/common_engine/course.rb +8 -0
- data/app/models/common_engine/event.rb +5 -0
- data/app/models/common_engine/favorite.rb +8 -0
- data/app/models/common_engine/group.rb +9 -0
- data/app/models/common_engine/idle.rb +35 -0
- data/app/models/common_engine/idle_login_history.rb +7 -0
- data/app/models/common_engine/notice.rb +8 -0
- data/app/models/common_engine/schedule.rb +32 -0
- data/app/models/common_engine/settlement_history.rb +8 -0
- data/app/models/common_engine/user.rb +15 -0
- data/app/models/common_engine/user_login_history.rb +7 -0
- data/app/models/concerns/image_uploader.rb +49 -0
- data/app/models/concerns/login_module.rb +14 -0
- data/app/views/_prepare_fullcalendar.slim +20 -0
- data/app/views/errors/error_404.html.slim +1 -0
- data/app/views/errors/error_500.html.slim +1 -0
- data/app/views/layouts/application_base.html.erb +29 -0
- data/config/application.rb +19 -0
- data/config/boot.rb +4 -0
- data/config/cable.yml +10 -0
- data/config/credentials.yml.enc +1 -0
- data/config/database.yml +93 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +61 -0
- data/config/environments/production.rb +94 -0
- data/config/environments/test.rb +46 -0
- data/config/initializers/application_controller_renderer.rb +10 -0
- data/config/initializers/assets.rb +14 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/content_security_policy.rb +25 -0
- data/config/initializers/cookies_serializer.rb +5 -0
- data/config/initializers/filter_parameter_logging.rb +4 -0
- data/config/initializers/inflections.rb +16 -0
- data/config/initializers/mime_types.rb +4 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/en.yml +251 -0
- data/config/locales/ja.yml +255 -0
- data/config/locales/vi.yml +249 -0
- data/config/puma.rb +34 -0
- data/config/routes.rb +3 -0
- data/config/spring.rb +6 -0
- data/config/storage.yml +34 -0
- data/db/schema.rb +18 -0
- data/db/seeds.rb +7 -0
- data/lib/common_engine.rb +9 -0
- data/lib/common_engine/engine.rb +5 -0
- data/lib/common_engine/version.rb +3 -0
- metadata +125 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative '../concerns/image_uploader.rb'
|
2
|
+
|
3
|
+
module CommonEngine
|
4
|
+
class Chapter < ApplicationRecord
|
5
|
+
self.table_name = 'mst_chapters'
|
6
|
+
default_scope -> {where(valid_flg: false)}
|
7
|
+
|
8
|
+
belongs_to :course, class_name: 'CommonEngine::Course', primary_key: 'id', foreign_key: 'course_id'
|
9
|
+
has_many :schedules, class_name: 'CommonEngine::Schedule', foreign_key: 'chapter_id'
|
10
|
+
|
11
|
+
scope :search_with_idle_id, -> idle_id {
|
12
|
+
schedules = CommonEngine::Schedule.arel_table
|
13
|
+
join_condition = arel_table.join(schedules, Arel::Nodes::OuterJoin).on(
|
14
|
+
Arel::Nodes::And.new([arel_table[:id].eq(schedules[:chapter_id]),
|
15
|
+
schedules[:idle_id].eq(idle_id)])).join_sources
|
16
|
+
joins(join_condition)
|
17
|
+
}
|
18
|
+
|
19
|
+
mount_uploader :file_name, CommonEngine::ImageUploader
|
20
|
+
|
21
|
+
def get_unescaped_file_name
|
22
|
+
URI.unescape(self.file_name.to_s.gsub(/.*\//, ''))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module CommonEngine
|
2
|
+
class Favorite < ApplicationRecord
|
3
|
+
default_scope -> {where(valid_flg: false)}
|
4
|
+
|
5
|
+
belongs_to :idle, class_name: 'CommonEngine::Idle', primary_key: 'id', foreign_key: 'idle_id'
|
6
|
+
belongs_to :user, class_name: 'CommonEngine::User', primary_key: 'id', foreign_key: 'user_id'
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative '../concerns/login_module.rb'
|
2
|
+
require_relative '../concerns/image_uploader.rb'
|
3
|
+
|
4
|
+
module CommonEngine
|
5
|
+
class Idle < ApplicationRecord
|
6
|
+
include CommonEngine::LoginModule
|
7
|
+
|
8
|
+
default_scope -> {where(valid_flg: false)}
|
9
|
+
|
10
|
+
has_secure_password validations: true
|
11
|
+
validates :login_id, presence: true, uniqueness: true
|
12
|
+
|
13
|
+
has_one :favorite
|
14
|
+
has_many :idle_login_history
|
15
|
+
|
16
|
+
belongs_to :group, class_name: 'CommonEngine::Group', primary_key: 'id', foreign_key: 'group_id', optional: true
|
17
|
+
|
18
|
+
scope :search_with_favorited_user_id, -> user_id {
|
19
|
+
favorites = CommonEngine::Favorite.arel_table
|
20
|
+
join_condition = arel_table
|
21
|
+
.join(favorites, Arel::Nodes::OuterJoin).on(
|
22
|
+
Arel::Nodes::And.new([
|
23
|
+
arel_table[:id].eq(favorites[:idle_id]),
|
24
|
+
favorites[:user_id].eq(user_id),
|
25
|
+
favorites[:valid_flg].eq(false)])).join_sources
|
26
|
+
joins(join_condition).select('favorites.*, idles.*')
|
27
|
+
}
|
28
|
+
|
29
|
+
enum gender: {female: 0, male: 1, other: 9}
|
30
|
+
enum blood_type: {a: 0, b: 1, o: 2, ab: 3}
|
31
|
+
enum employee_type: {permanent_staff: 0, temporary_staff: 1}
|
32
|
+
|
33
|
+
mount_uploader :icon, CommonEngine::ImageUploader
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module CommonEngine
|
2
|
+
class Notice < ApplicationRecord
|
3
|
+
default_scope -> {where(valid_flg: false)}
|
4
|
+
|
5
|
+
belongs_to :idle, class_name: 'CommonEngine::Idle', primary_key: 'id', foreign_key: 'idle_id', optional: true
|
6
|
+
belongs_to :user, class_name: 'CommonEngine::User', primary_key: 'id', foreign_key: 'user_id', optional: true
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module CommonEngine
|
2
|
+
class Schedule < ApplicationRecord
|
3
|
+
default_scope -> {where(valid_flg: false)}
|
4
|
+
scope :search_with_idle_id_is_null, -> {arel_table[:idle_id].eq(nil)}
|
5
|
+
|
6
|
+
belongs_to :idle, class_name: 'CommonEngine::Idle', primary_key: 'id', foreign_key: 'idle_id', optional: true
|
7
|
+
belongs_to :user, class_name: 'CommonEngine::User', primary_key: 'id', foreign_key: 'user_id', optional: true
|
8
|
+
belongs_to :chapter, class_name: 'CommonEngine::Chapter', primary_key: 'id', foreign_key: 'chapter_id', optional: true
|
9
|
+
belongs_to :event, class_name: 'CommonEngine::Event', primary_key: 'id', foreign_key: 'event_id', optional: true
|
10
|
+
|
11
|
+
enum category: {participate_event: 0, lesson: 1, personal_reasons: 2, self_study: 3}
|
12
|
+
|
13
|
+
attribute :category_text, :string
|
14
|
+
attribute :title, :string
|
15
|
+
|
16
|
+
def set_category_text
|
17
|
+
self.category_text = I18n.t('activerecord.schedules.categories.' + self.category.to_s)
|
18
|
+
return self
|
19
|
+
end
|
20
|
+
def set_title
|
21
|
+
self.set_category_text
|
22
|
+
if self.chapter.present? && self.chapter.course.present?
|
23
|
+
self.title = self.category_text + "\n" + self.chapter.course.name + "\n" + self.chapter.name
|
24
|
+
elsif self.event.present?
|
25
|
+
self.title = self.category_text + "\n" + self.event.name
|
26
|
+
else
|
27
|
+
self.title = self.category_text
|
28
|
+
end
|
29
|
+
return self
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module CommonEngine
|
2
|
+
class SettlementHistory < ApplicationRecord
|
3
|
+
default_scope -> {where(valid_flg: false)}
|
4
|
+
|
5
|
+
belongs_to :user, class_name: 'CommonEngine::User', primary_key: 'id', foreign_key: 'user_id'
|
6
|
+
belongs_to :commodity, class_name: 'CommonEngine::Commodity', primary_key: 'id', foreign_key: 'commodity_id'
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../concerns/login_module.rb'
|
2
|
+
require_relative '../concerns/image_uploader.rb'
|
3
|
+
|
4
|
+
module CommonEngine
|
5
|
+
class User < ApplicationRecord
|
6
|
+
include CommonEngine::LoginModule
|
7
|
+
|
8
|
+
default_scope -> {where(valid_flg: false)}
|
9
|
+
|
10
|
+
has_many :user_login_history
|
11
|
+
has_many :favorites
|
12
|
+
|
13
|
+
mount_uploader :icon, CommonEngine::ImageUploader
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module CommonEngine
|
2
|
+
class ImageUploader < CarrierWave::Uploader::Base
|
3
|
+
# Include RMagick or MiniMagick support:
|
4
|
+
# include CarrierWave::RMagick
|
5
|
+
# include CarrierWave::MiniMagick
|
6
|
+
|
7
|
+
# Choose what kind of storage to use for this uploader:
|
8
|
+
storage :file
|
9
|
+
# storage :fog
|
10
|
+
|
11
|
+
# Override the directory where uploaded files will be stored.
|
12
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
13
|
+
def store_dir
|
14
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
15
|
+
end
|
16
|
+
|
17
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
18
|
+
# def default_url(*args)
|
19
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
20
|
+
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
21
|
+
#
|
22
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
23
|
+
# end
|
24
|
+
|
25
|
+
# Process files as they are uploaded:
|
26
|
+
# process scale: [200, 300]
|
27
|
+
#
|
28
|
+
# def scale(width, height)
|
29
|
+
# # do something
|
30
|
+
# end
|
31
|
+
|
32
|
+
# Create different versions of your uploaded files:
|
33
|
+
# version :thumb do
|
34
|
+
# process resize_to_fit: [50, 50]
|
35
|
+
# end
|
36
|
+
|
37
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
38
|
+
# For images you might use something like this:
|
39
|
+
# def extension_whitelist
|
40
|
+
# %w(jpg jpeg gif png)
|
41
|
+
# end
|
42
|
+
|
43
|
+
# Override the filename of the uploaded files:
|
44
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
45
|
+
# def filename
|
46
|
+
# "something.jpg" if original_filename
|
47
|
+
# end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#calendar
|
2
|
+
|
3
|
+
javascript:
|
4
|
+
window.weekdayNames = #{@weekday_names};
|
5
|
+
window.weekdayShortNames = #{@weekday_short_names};
|
6
|
+
window.emptyEventTitle = '#{@empty_event_title}';
|
7
|
+
window.titleFormatMonth = '#{@title_format_month}';
|
8
|
+
window.titleFormatWeek = '#{@title_format_week}';
|
9
|
+
window.titleFormatDay = '#{@title_format_day}';
|
10
|
+
window.monthText = '#{@month_text}';
|
11
|
+
window.weekText = '#{@week_text}';
|
12
|
+
window.dayText = '#{@day_text}';
|
13
|
+
window.todayText = '#{@today_text}';
|
14
|
+
window.dateFormatString = '#{t('format.fullcalendar.title.time')}';
|
15
|
+
window.pulldownDefaultMessage = '#{t('sentence.pulldown_default')}';
|
16
|
+
window.reserve_success = '#{t('sentence.reserve_success')}';
|
17
|
+
window.cancel_success = '#{t('sentence.cancel_success')}';
|
18
|
+
window.error_massage = '#{t('sentence.error_massage')}';
|
19
|
+
|
20
|
+
= javascript_include_tag 'init_fullcalendar'
|
@@ -0,0 +1 @@
|
|
1
|
+
p.text-center = t('sentence.error_404')
|
@@ -0,0 +1 @@
|
|
1
|
+
p.text-center = t('sentence.error_500')
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>User</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
9
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<nav id="head-box" class="navbar navbar-inverse">
|
14
|
+
<%= link_to root_path do %>
|
15
|
+
<%= image_tag('/img/logo.png', size: '196x36', id: 'logo', class: 'pull-left') %>
|
16
|
+
<% end %>
|
17
|
+
<div id="head-inner-box">
|
18
|
+
<div class="container-fluid">
|
19
|
+
<div id="select-language-box" class="head-box">
|
20
|
+
</div><!-- #select-language-box -->
|
21
|
+
</div><!-- #container-fluid -->
|
22
|
+
</div><!-- #head-inner-box -->
|
23
|
+
</nav>
|
24
|
+
|
25
|
+
<div class="container-fluid">
|
26
|
+
<%= yield %>
|
27
|
+
</div>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(*Rails.groups)
|
8
|
+
|
9
|
+
module CommonEngine
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Initialize configuration defaults for originally generated Rails version.
|
12
|
+
config.load_defaults 5.2
|
13
|
+
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration can go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded after loading
|
17
|
+
# the framework and any gems in your application.
|
18
|
+
end
|
19
|
+
end
|
data/config/boot.rb
ADDED
data/config/cable.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
oz+g6J/ELneq9kp/lOrWp6yatprklBKf4ltYlSs8PIKVtarJw1qJexf6VZFWcPK1jL+5md/deV+nTQiSShDEp4rAp17D1X8gbifE7O+UbXAY6uwVmhl7ztWuUwxxNJhMoh44Uf7flyVw5jIjogGRzNGrBCmBqQEy5/14PLpAWUNkKYVnJzAByB+G1rqqPdnWhDNrYcfikjtS7DwHpIyXu+JqRUhKh7lqtSzBTnN2/HjDbZ7ZTN9jB8XD1YW4KoQ4Brc4XnLx4S1VzzSf/CpPEm6hGOYHs079jhGqFFLO1ifu7BjU9ED9wM7pfOun81/SwveawNzddT754XhbgfTF6wdjfpxUZTvyU0x67swNwcpMYTlJYQfPIVmYAcg08hPvFEgqox2YnbQi9mrjpFWXBuEeM+3mSHwMOBY+--Df8gcxLw+i6dU6Dk--2eWRbF2I7EaMKF8R1uQMSQ==
|
data/config/database.yml
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# PostgreSQL. Versions 9.1 and up are supported.
|
2
|
+
#
|
3
|
+
# Install the pg driver:
|
4
|
+
# gem install pg
|
5
|
+
# On OS X with Homebrew:
|
6
|
+
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
|
7
|
+
# On OS X with MacPorts:
|
8
|
+
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
|
9
|
+
# On Windows:
|
10
|
+
# gem install pg
|
11
|
+
# Choose the win32 build.
|
12
|
+
# Install PostgreSQL and put its /bin directory on your path.
|
13
|
+
#
|
14
|
+
# Configure Using Gemfile
|
15
|
+
# gem 'pg'
|
16
|
+
#
|
17
|
+
default: &default
|
18
|
+
adapter: postgresql
|
19
|
+
encoding: unicode
|
20
|
+
# For details on connection pooling, see Rails configuration guide
|
21
|
+
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
22
|
+
# pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
23
|
+
pool: 5
|
24
|
+
username: quocquan
|
25
|
+
password:
|
26
|
+
port: 5432
|
27
|
+
|
28
|
+
development:
|
29
|
+
<<: *default
|
30
|
+
database: development
|
31
|
+
host: localhost
|
32
|
+
|
33
|
+
# The specified database role being used to connect to postgres.
|
34
|
+
# To create additional roles in postgres see `$ createuser --help`.
|
35
|
+
# When left blank, postgres will use the default role. This is
|
36
|
+
# the same name as the operating system user that initialized the database.
|
37
|
+
#username: administrator
|
38
|
+
|
39
|
+
# The password associated with the postgres role (username).
|
40
|
+
#password:
|
41
|
+
|
42
|
+
# Connect on a TCP socket. Omitted by default since the client uses a
|
43
|
+
# domain socket that doesn't need configuration. Windows does not have
|
44
|
+
# domain sockets, so uncomment these lines.
|
45
|
+
#host: localhost
|
46
|
+
|
47
|
+
# The TCP port the server listens on. Defaults to 5432.
|
48
|
+
# If your server runs on a different port number, change accordingly.
|
49
|
+
#port: 5432
|
50
|
+
|
51
|
+
# Schema search path. The server defaults to $user,public
|
52
|
+
#schema_search_path: myapp,sharedapp,public
|
53
|
+
|
54
|
+
# Minimum log levels, in increasing order:
|
55
|
+
# debug5, debug4, debug3, debug2, debug1,
|
56
|
+
# log, notice, warning, error, fatal, and panic
|
57
|
+
# Defaults to warning.
|
58
|
+
#min_messages: notice
|
59
|
+
|
60
|
+
# Warning: The database defined as "test" will be erased and
|
61
|
+
# re-generated from your development database when you run "rake".
|
62
|
+
# Do not set this db to the same as development or production.
|
63
|
+
# test:
|
64
|
+
# <<: *default
|
65
|
+
# password: password
|
66
|
+
# host: afterschooldb.cwvxmtmtplqi.ap-northeast-1.rds.amazonaws.com
|
67
|
+
# database: afterschool
|
68
|
+
|
69
|
+
# As with config/secrets.yml, you never want to store sensitive information,
|
70
|
+
# like your database password, in your source code. If your source code is
|
71
|
+
# ever seen by anyone, they now have access to your database.
|
72
|
+
#
|
73
|
+
# Instead, provide the password as a unix environment variable when you boot
|
74
|
+
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
75
|
+
# for a full rundown on how to provide these environment variables in a
|
76
|
+
# production deployment.
|
77
|
+
#
|
78
|
+
# On Heroku and other platform providers, you may have a full connection URL
|
79
|
+
# available as an environment variable. For example:
|
80
|
+
#
|
81
|
+
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
82
|
+
#
|
83
|
+
# You can use this database configuration with:
|
84
|
+
#
|
85
|
+
# production:
|
86
|
+
# url: <%= ENV['DATABASE_URL'] %>
|
87
|
+
#
|
88
|
+
# production:
|
89
|
+
# <<: *default
|
90
|
+
# database: afterschool
|
91
|
+
# username: postgres
|
92
|
+
# password: Ab3NzUCZN7PoBwe
|
93
|
+
# host: afterschool-production.cwvxmtmtplqi.ap-northeast-1.rds.amazonaws.com
|