Active Event

This commit is contained in:
spen 2014-11-10 10:24:07 +08:00
commit 67767ea55b
88 changed files with 2688 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/db/*.sqlite3-journal
test/dummy/log/*.log
test/dummy/tmp/
test/dummy/.sass-cache

14
Gemfile Normal file
View File

@ -0,0 +1,14 @@
source "https://rubygems.org"
# Declare your gem's dependencies in active.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'

87
Gemfile.lock Normal file
View File

@ -0,0 +1,87 @@
PATH
remote: .
specs:
active (0.0.1)
rails (~> 4.1.6)
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.6)
actionpack (= 4.1.6)
actionview (= 4.1.6)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.6)
actionview (= 4.1.6)
activesupport (= 4.1.6)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.6)
activesupport (= 4.1.6)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.6)
activesupport (= 4.1.6)
builder (~> 3.1)
activerecord (4.1.6)
activemodel (= 4.1.6)
activesupport (= 4.1.6)
arel (~> 5.0.0)
activesupport (4.1.6)
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.1)
mime-types (>= 1.16, < 3)
mime-types (2.4.2)
minitest (5.4.2)
multi_json (1.10.1)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.1.6)
actionmailer (= 4.1.6)
actionpack (= 4.1.6)
actionview (= 4.1.6)
activemodel (= 4.1.6)
activerecord (= 4.1.6)
activesupport (= 4.1.6)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.6)
sprockets-rails (~> 2.0)
railties (4.1.6)
actionpack (= 4.1.6)
activesupport (= 4.1.6)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
sprockets (2.12.2)
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.9)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
PLATFORMS
ruby
DEPENDENCIES
active!
sqlite3

20
MIT-LICENSE Normal file
View File

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

3
README.rdoc Normal file
View File

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

32
Rakefile Normal file
View File

@ -0,0 +1,32 @@
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Active'
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

19
active.gemspec Normal file
View File

@ -0,0 +1,19 @@
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "active/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "active"
s.version = Active::VERSION
s.authors = ["RulingDigital"]
s.email = ["orbit@rulingcom.com"]
s.homepage = "http://www.rulingcom.com"
s.summary = "Actives for Orbit"
s.description = "Actives for Orbit"
s.license = "MIT"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
end

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the act controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -0,0 +1,137 @@
class ActivesController < ApplicationController
helper MemberHelper
def index
time_now = Time.now
actives = Act.filter_by_categories.desc(:sign_start_date).page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
acts = actives.collect do |a|
title = ('<a href="'+ OrbitHelper.url_to_show(a.to_param) + '?method=show_data" target="_blank">' + a.title + '</a>').html_safe
if !a.sign_up.blank? and a.sign_start_date <= time_now and ( a.sign_end_date >= time_now or a.sign_end_date.nil? )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(a.to_param) + '" target="_blank">' + t('act.sign_up') + '</a>').html_safe
elsif a.sign_up.blank?
sign_up = t('act.sign_up_not_open')
elsif a.sign_start_date > time_now
sign_up = t('act.sign_up_not_yet')
else
sign_up = t('act.sign_up_overdue')
end
{
"title" => title,
"category" => a.category.title,
"sign_start_date" => a.sign_start_date.strftime('%Y-%m-%d %H:%M'),
"sign_end_date" => (a.sign_end_date ? a.sign_end_date.strftime('%Y-%m-%d %H:%M') : t(:no_deadline)),
"act_start_date" => a.act_start_date.strftime('%Y-%m-%d %H:%M'),
"act_end_date" => (a.act_end_date ? a.act_end_date.strftime('%Y-%m-%d %H:%M') : t(:no_deadline)),
'sign_up_time_range' => Act.time_range(a.sign_start_date, a.sign_end_date),
'sign_up_time_range' => Act.time_range(a.sign_start_date, a.sign_end_date),
'act_time_range' => Act.time_range(a.act_start_date, a.act_end_date),
'sign_up' => sign_up
}
end
{
"acts" => acts,
"extras" => {
"widget-title"=>t('act.active'),
"th_title" => t('act.title'),
"th_act_time_range" => t('act.act_time_range'),
"th_sign_up_time_range" => t('act.sign_up_time_range'),
"th_category" => t(:category),
"th_sign_up" => t('act.sign_up')
},
"total_pages" => actives.total_pages
}
end
def show_privacy
params = OrbitHelper.params
act = Act.find_by(uid: params[:uid])
active_agreement = ActAgreement.first
{
'act' => act,
"active_agreement" => active_agreement
}
end
def show_data
time_now = Time.now
params = OrbitHelper.params
act = Act.find_by(uid: params[:uid])
if !act.sign_up.blank? and act.sign_start_date <= time_now and ( act.sign_end_date >= time_now or act.sign_end_date.nil? )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(act.to_param) + '" target="_blank">' + t('act.sign_up') + '</a>').html_safe
elsif act.sign_up.blank?
sign_up = t('act.sign_up_not_open')
elsif act.sign_start_date > time_now
sign_up = t('act.sign_up_not_yet')
else
sign_up = t('act.sign_up_overdue')
end
{
'act' => act,
'sign_up' => sign_up,
'time_now' => time_now,
'sign_up_time_range' => Act.time_range(act.sign_start_date, act.sign_end_date),
'act_time_range' => Act.time_range(act.act_start_date, act.act_end_date)
}
end
def show
params = OrbitHelper.params
module_app = ModuleApp.where(:key => "active").first
categories = module_app.categories
act = Act.find_by(uid: params[:uid])
act_signup = ActSignup.new
time_now = Time.now
{
"act" => act,
"act_signup" => act_signup,
"time_now" => time_now
}
end
def create
@act_signup = ActSignup.new(act_signup_params)
if gotcha_valid? && @act_signup.save
redirect_to "#{params[:referer_url]}/?method=signup_ok"
else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end
end
def signup_ok
end
def act_signup_params
params.require(:act_signup).permit!
end
end

View File

@ -0,0 +1,20 @@
class Admin::ActiveAgreementsController < OrbitAdminController
def initialize
super
@app_title = 'active'
end
def index
@active_agreement = ActAgreement.first || ActAgreement.create
@url = admin_active_agreement_path(@active_agreement)
end
def update
@active_agreement = ActAgreement.first
@active_agreement.update_attributes(params.require(:act_agreement).permit!)
redirect_to admin_active_agreements_path, notice: t('act.save_success')
end
end

View File

@ -0,0 +1,44 @@
# encoding: utf-8
class Admin::ActiveSignupsController < OrbitAdminController
include Admin::ActivesHelper
before_action ->(module_app = @app_title) { set_variables module_app }
def initialize
super
@app_title = "active"
end
def edit
params[:controller] = "admin/actives"
@act_signup = ActSignup.find(params[:id])
@act = Act.find(@act_signup.act_id)
end
def update
@act_signup = ActSignup.find(params[:id])
@act_signup.update_attributes(act_signup_params)
redirect_to "/admin/actives/#{@act_signup.act_id}/act_signup"
end
def destroy
@act_signup = ActSignup.find(params[:id])
@act_id = @act_signup.act_id
@act_signup.destroy
redirect_to "/admin/actives/#{@act_id}/act_signup"
end
private
def act_signup_params
params.require(:act_signup).permit!
end
end

View File

@ -0,0 +1,129 @@
# encoding: utf-8
class Admin::ActivesController < OrbitAdminController
include Admin::ActivesHelper
before_action ->(module_app = @app_title) { set_variables module_app }
before_action :set_act, only: [:edit, :destroy, :act_signup, :export]
def initialize
super
@app_title = "active"
end
def filter_fields(categories)
{
:category=>categories.map{|c| {:title=>(c.title.blank? ? " " : c.title), :id=>c.id}}
}
end
def index
@categories = @module_app.categories.enabled
@filter_fields = filter_fields(@categories)
@table_fields = [:category, 'act.title', 'act.sign_up_time_range', 'act.act_time_range', 'act.sign_up_count', 'act.export']
if !params[:sort].blank?
if params[:sort] == 'act_time_range'
sort = {:act_start_date.to_sym=>params[:order]}
elsif params[:sort] == 'sign_up_time_range'
sort = {:sign_start_date.to_sym=>params[:order]}
else
sort = {params[:sort].to_sym=>params[:order]}
end
else
sort = {:sign_start_date=>"desc"}
end
@acts = Act.order_by(sort).with_categories(filters("category"))
@acts = search_data(@acts,[:title]).page(params[:page]).per(10)
if request.xhr?
render :partial => "index"
end
end
def new
@tags = @module_app.tags
@act = Act.new
end
def create
if !act_params['act_links_attributes'].nil?
act_params['act_links_attributes'].each do |idx,link|
act_params['act_links_attributes'].delete(idx.to_s) if link['url'].blank?
end
end
act = Act.new(act_params)
act.create_user_id = current_user.id
act.update_user_id = current_user.id
act.save
redirect_to params['referer_url']
end
def edit
if can_edit_or_delete?(@act)
@categories = @module_app.categories.enabled
else
render_401
end
end
def update
uid = params[:id].split('-').last
act = Act.find_by(:uid=>uid)
if !act_params['act_links_attributes'].nil?
act_params['act_links_attributes'].each do |idx,link|
act_params['act_links_attributes'].delete(idx.to_s) if link['url'].blank?
end
end
act.update_attributes(act_params)
redirect_to params['referer_url']
end
def destroy
@act.destroy
redirect_to "/admin/actives"
end
def export
respond_to do |format|
format.xlsx {
response.headers['Content-Disposition'] = 'attachment; filename="export.xlsx"'
}
end
end
def act_signup
@act_signups = ActSignup.where(:act_id => @act.id).page(params[:page]).per(10)
end
def edit_act_signup
@act_signup = ActSignup.find(params[:id])
@act = Act.find(@act_signup.act_id)
end
def delete_act_signup
@act_signup = ActSignup.find(params[:id])
@act_id = @act_signup.act_id
@act_signup.destroy
redirect_to "/admin/actives/@act_id.to_s/act_signup"
end
private
def set_act
@act = Act.find(params[:id])
end
def act_params
params.require(:act).permit!
end
end

View File

@ -0,0 +1,31 @@
module Admin::ActivesHelper
def page_for_act(active=nil)
ann_page = nil
pages = Page.where(:module=>'active')
pages.each do |page|
if page.categories.count ==1
if page.categories.include?(active.category.id.to_s)
ann_page = page
end
end
break if !ann_page.nil?
end
if ann_page.nil?
pages.each do |page|
if page.categories.include?(active.category.id.to_s)
ann_page = page
end
break if !ann_page.nil?
end
end
ann_page = pages.first if ann_page.nil?
if !active.blank?
request.protocol+(request.host_with_port+ann_page.url+'/'+active.to_param).gsub('//','/') rescue "/"
else
request.protocol+(request.host_with_port+'/'+I18n.locale.to_s+ann_page.url+'/').gsub('//','/') rescue "/"
end
end
end

64
app/models/act.rb Normal file
View File

@ -0,0 +1,64 @@
class Act
include Mongoid::Document
include Mongoid::Timestamps
include OrbitModel::Impression
# encoding: utf-8
include OrbitCategory::Categorizable
include Slug
field :title, as: :slug_title, type: String, localize: true
field :content, localize: true
field :place, localize: true
field :create_user_id
field :update_user_id
field :act_start_date , :type => DateTime, :default => Time.now
field :act_end_date , :type => DateTime, :default => Time.now
field :sign_start_date , :type => DateTime, :default => Time.now
field :sign_end_date , :type => DateTime, :default => Time.now
field :sign_up, :type => Boolean, :default => true
field :has_idno, :type => Boolean, :default => false
field :note, localize: true
has_many :act_links, :autosave => true, :dependent => :destroy
has_many :act_files, :autosave => true, :dependent => :destroy
has_many :act_signups, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :act_files, :allow_destroy => true
accepts_nested_attributes_for :act_links, :allow_destroy => true
accepts_nested_attributes_for :act_signups, :allow_destroy => true
scope :can_display, ->{any_of({:sign_start_date.lt=>Time.now, :sign_end_date.gt=>Time.now},{:sign_start_date.lt=>Time.now, :sign_end_date=>nil}).order_by([:is_top, :desc])}
def update_user
User.find(update_user_id) rescue nil
end
def update_user=(user)
self.update_user_id = user.id
end
def expired?
(self.sign_end_date < Time.now) rescue false
end
def self.time_range(date1 = null, date2 = null)
if !date1.blank?
r = "#{date1.strftime('%Y-%m-%d %H:%M')}"
if date2
r += " - #{date2.strftime('%Y-%m-%d %H:%M')}"
else
r += " - #{I18n.t(:no_deadline)}"
end
r
end
end
end

View File

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

14
app/models/act_file.rb Normal file
View File

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

25
app/models/act_link.rb Normal file
View File

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

20
app/models/act_signup.rb Normal file
View File

@ -0,0 +1,20 @@
# encoding: utf-8
class ActSignup
include Mongoid::Document
include Mongoid::Timestamps
field :name
field :name_en
field :idno
field :sex
field :birthday , :type => Date
field :tel, type: String
field :phone, type: String
field :fax, type: String
field :email, type: String
field :note
belongs_to :act
end

View File

@ -0,0 +1 @@
<%= render_view %>

View File

@ -0,0 +1,173 @@
<% # encoding: utf-8 %>
<%
data = action_data
@act = data["act"]
@act_signup = data["act_signup"]
@time_now = data["time_now"]
%>
<% if !@act.sign_up.blank? and @act.sign_start_date < @time_now and ( @act.sign_end_date > @time_now or @act.sign_end_date.nil? ) %>
<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/module-area" %>
<% flash.each do |key, msg| %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
<% end %>
<%= form_for @act_signup, url: actives_path, html: {class: "content form-horizontal" , :id=>"new-act-signup"} do |f| %>
<fieldset>
<!-- Title -->
<div class="form-group">
<label for="title" class="col-sm-2 control-label"><%= t('act.title') %></label>
<div class="col-sm-10">
<%= @act.title %>
</div>
</div>
<!-- Name -->
<div class="form-group">
<label for="name" class="col-sm-2 control-label">*<%= t('act_signup.name') %></label>
<div class="col-sm-10">
<%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('act_signup.name'), :required => true %>
</div>
</div>
<% if @act.has_idno %>
<!-- IDNO -->
<div class="form-group">
<label for="name" class="col-sm-2 control-label">*<%= t('act_signup.idno') %></label>
<div class="col-sm-10">
<%= f.text_field :idno, :class=>"input-medium form-control", :placeholder=> t('act_signup.idno'), :required => true %>
</div>
</div>
<% end %>
<!-- Birthday -->
<div class="form-group">
<label for="birthday" class="col-sm-2 control-label"><%= t('act_signup.birthday') %></label>
<div class="col-sm-10">
<%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd" %>
</div>
</div>
<!-- Sex -->
<div class="form-group">
<label for="sex" class="col-sm-2 control-label"><%= t('act_signup.sex') %></label>
<div class="col-sm-10">
<label class="radio-inline">
<%= f.radio_button :sex, "male" %><%= t('users.male')%>
</label>
<label class="radio-inline">
<%= f.radio_button :sex, "female" %><%= t('users.female')%>
</label>
</div>
</div>
<!-- Tel -->
<div class="form-group">
<label for="tel" class="col-sm-2 control-label">*<%= t('act_signup.tel') %></label>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('act_signup.tel'), :required => true %>
</div>
</div>
<!-- Phone -->
<div class="form-group">
<label for="phone" class="col-sm-2 control-label"><%= t('act_signup.phone') %></label>
<div class="col-sm-10">
<%= f.text_field :phone, :class=>"input-medium form-control", :placeholder=> t('act_signup.phone') %>
</div>
</div>
<!-- Fax -->
<div class="form-group">
<label for="fax" class="col-sm-2 control-label"><%= t('act_signup.fax') %></label>
<div class="col-sm-10">
<%= f.text_field :phone, :class=>"input-medium form-control", :placeholder=> t('act_signup.fax') %>
</div>
</div>
<!-- Email -->
<div class="form-group">
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
</div>
</div>
<!-- Note -->
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('act.note') %></label>
<div class="col-sm-10">
<%= f.text_area :note, rows: 5, :class=>"input-medium form-control", :placeholder=> t('act.note') %>
</div>
</div>
<!-- 驗證碼 -->
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('act_signup.recaptcha') %></label>
<div class="col-sm-10">
<%= gotcha_error %>
<%= gotcha %>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<label>
<input id="agree" name="agree" value="1" type="checkbox" required="required">
<a href="<%= OrbitHelper.url_to_show(@act.to_param) %>?method=show_privacy" target="_blank"><%= t("act_signup.agree")%></a>
</label>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last %>">
<input type="hidden" name="act_signup[act_id]" value="<%= @act.id %>">
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
</div>
</div>
</fieldset>
<% end %>
<script type="text/javascript">
(function(){
var validated = false,
chks = false
$("form.content").submit(function(event) {
var form = $(this),
val_num = 0,
isChecked = $('#agree:checked').val()?true:false;
if(!isChecked){
return false;
}
});
})();
</script>
<% elsif @act.sign_up.blank? %>
<%= t('act.sign_up_not_yet') %>
<% else %>
<%= t('act.sign_up_overdue') %>
<% end %>

View File

@ -0,0 +1,77 @@
<% # encoding: utf-8 %>
<%
data = action_data
@act = data["act"]
@sign_up = data["sign_up"]
@sign_up_time_range = data["sign_up_time_range"]
@act_time_range = data["act_time_range"]
%>
<table class="table table-striped active-show-table">
<tbody >
<tr>
<th class="active-title-field"><%= t(:category) %></th>
<td class="active-title-value"><%= @act.category.title %></td>
</tr>
<tr>
<th class="active-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('act.act_time_range') %></th>
<td class="active-title-value"><%= @act_time_range %></td>
</tr>
<tr>
<th class="active-title-field"><%= t('act.title') %></th>
<td class="active-title-value"><%= @act.title %></td>
</tr>
<% if !@act.content.blank? %>
<tr>
<th class="active-title-field"><%= t('act.content') %></th>
<td class="active-title-value"><%= nl2br(@act.content) %></td>
</tr>
<% end %>
<tr>
<th class="active-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('act.sign_up_time_range') %></th>
<td class="active-title-value"><%= @sign_up_time_range %></td>
</tr>
<% if !@act.place.blank? %>
<tr>
<th class="active-title-field"><i class="icon-flag"></i><%= t('act.place') %></th>
<td class="active-title-value"><%= @act.place %></td>
</tr>
<% end %>
<% if !@act.act_files.blank? %>
<tr>
<th class="active-title-field"><i class="fa fa-fw fa-paperclip"></i><%= t(:file_) %></th>
<td class="active-title-value">
<% @act.act_files.map do |file| %>
<%= link_to (file.title.blank? ? File.basename(file.file.path) : file.title) , file.file.url, {:target => '_blank', :title => file.description} if file.file.file %>
<% end %>
</td>
</tr>
<% end %>
<% if !@act.act_links.blank? %>
<tr>
<th class="active-title-field"><i class="fa fa-fw fa-link"></i><%= t(:link) %></th>
<td class="active-title-value">
<% @act.act_links.map do |link| %>
<%= link_to (link.title.blank? ? link.url : link.title), link.url, :target => '_blank' %>
<% end %>
</td>
</tr>
<% end %>
<% if !@act.note.blank? %>
<tr>
<th class="active-title-field"><%= t('act.note') %></th>
<td class="active-title-value"><%= @act.note %></td>
</tr>
<% end %>
<tr>
<th class="active-title-field"><%= t('act.sign_up') %></th>
<td class="active-title-value"><%= @sign_up %></td>
</tr>
</tbody>
</table>
<br />
<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %>

View File

@ -0,0 +1,28 @@
<% # encoding: utf-8 %>
<%
data = action_data
@active_agreement = data["active_agreement"]
%>
<style type="text/css">
.highlight {
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 4px;
margin-bottom: 14px;
padding: 9px 14px;
}
</style>
<h3>個資及隱私權保護宣告</h3>
<div class="highlight active_privacy">
<%= @active_agreement.content.html_safe %>
</div>
<br />
<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %>

View File

@ -0,0 +1,5 @@
<%= t('act.sign_up_success') %>
<br />
<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %>

View File

@ -0,0 +1,63 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<h2><%= t('act.active') %></h2>
<%= form_for @active_agreement, url: @url, html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<div class="control-group input-content">
<label class="control-label muted"><%= t('act.active_agreements_content') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@active_agreement.content_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_actives_path, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -0,0 +1,127 @@
<%= form_for @act_signup, url: admin_active_signup_path(@act_signup), html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Language -->
<div class="tab-content">
<!-- Title -->
<div class="control-group">
<label class="control-label muted"><%= t('act.title') %></label>
<div class="controls">
<%= @act.title %>
</div>
</div>
<!-- Name -->
<div class="control-group">
<label class="control-label muted"><%= t('act_signup.name') %></label>
<div class="controls">
<%= f.text_field :name, :class => "input-block-level", placeholder: t('act_signup.name') %>
</div>
</div>
<% if @act.has_idno %>
<!-- IDNO -->
<div class="control-group">
<label class="control-label muted"><%= t('act_signup.idno') %></label>
<div class="controls">
<%= f.text_field :idno, :class => "input-block-level", :placeholder=> t('act_signup.idno'), :required => true %>
</div>
</div>
<% end %>
<!-- Birthday -->
<div class="control-group">
<label class="control-label muted"><%= t('act_signup.birthday') %></label>
<div class="controls">
<%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd" %>
</div>
</div>
<!-- Sex -->
<div class="control-group">
<label class="control-label muted"><%= t('act_signup.sex') %></label>
<div class="controls">
<label class="radio inline">
<%= f.radio_button :sex, "male" %><%= t('users.male')%>
</label>
<label class="radio inline">
<%= f.radio_button :sex, "female" %><%= t('users.female')%>
</label>
</div>
</div>
<!-- Tel -->
<div class="control-group">
<label class="control-label muted"><%= t('act_signup.tel') %></label>
<div class="controls">
<%= f.text_field :tel, :class=>"input-block-level", :placeholder=> t('act_signup.tel'), :required => true %>
</div>
</div>
<!-- Phone -->
<div class="control-group">
<label class="control-label muted"><%= t('act_signup.phone') %></label>
<div class="controls">
<%= f.text_field :phone, :class=>"input-block-level", :placeholder=> t('act_signup.phone') %>
</div>
</div>
<!-- Fax -->
<div class="control-group">
<label class="control-label muted"><%= t('act_signup.fax') %></label>
<div class="controls">
<%= f.text_field :phone, :class=>"input-block-level", :placeholder=> t('act_signup.fax') %>
</div>
</div>
<!-- Email -->
<div class="control-group">
<label class="control-label muted"><%= t(:email) %></label>
<div class="controls">
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> t(:email), :required => true %>
</div>
</div>
<!-- Note -->
<div class="control-group">
<label class="control-label muted"><%= t('act.note') %></label>
<div class="controls">
<%= f.text_area :note, rows: 5, :class=>"input-block-level", :placeholder=> t('act.note') %>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%#= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), "/admin/actives/#{@act.id}/act_signup", :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

@ -0,0 +1,270 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t(:category) %></label>
<div class="controls">
<%= select_category(f, @module_app) %>
</div>
</div>
<!-- Act Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('act.act_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :act_start_date, :no_label => true %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('act.act_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :act_end_date, :no_label => true %>
</div>
</div>
<!-- Sign up Date Time Picker -->
<div class="control-group">
<label class="control-label muted"><%= t('act.sign_start_date') %></label>
<div class="controls">
<%= f.datetime_picker :sign_start_date, :no_label => true %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('act.sign_end_date') %></label>
<div class="controls">
<%= f.datetime_picker :sign_end_date, :no_label => true %>
</div>
</div>
<!-- Sign up -->
<div class="control-group">
<label class="control-label muted"><%= t('act.is_sign_up') %></label>
<div class="controls">
<label class="radio inline"><%= f.radio_button :sign_up, "yes", checked: @act.sign_up == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :sign_up, "no", checked: @act.sign_up == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Idno -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_idno') %></label>
<div class="controls">
<label class="radio inline"><%= f.radio_button :has_idno, "yes", checked: @act.has_idno == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_idno, "no", checked: @act.has_idno == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- Title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t(:title) %></label>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@act.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Content -->
<div class="control-group input-content">
<label class="control-label muted"><%= t('act.content') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :content_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@act.content_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<!-- Place-->
<div class="control-group input-title">
<label class="control-label muted"><%= t('act.place') %></label>
<div class="controls">
<%= f.fields_for :place_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t('act.place'), value: (@act.place_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- Note -->
<div class="control-group input-subtitle">
<label class="control-label muted"><%= t('act.note') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :note_translations do |f| %>
<%= f.text_area locale, rows: 2, class: "input-block-level", value: (@act.note_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
<!-- Link -->
<div class="control-group">
<label class="control-label muted"><%= t(:link) %></label>
<div class="controls add-input">
<!-- Exist -->
<% if @act && !@act.act_links.blank? %>
<div class="exist">
<% @act.act_links.each_with_index do |act_link, i| %>
<%= f.fields_for :act_links, act_link do |f| %>
<%= render :partial => 'form_link', :object => act_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'act_link_field_count', @act.act_links.count %>
<a id="add_link" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
<!-- File -->
<div class="control-group">
<label class="control-label muted"><%= t(:file_) %></label>
<div class="controls">
<!-- Exist -->
<% if @act && !@act.act_files.blank? %>
<div class="exist">
<% @act.act_files.each_with_index do |act_file, i| %>
<%= f.fields_for :act_files, act_file do |f| %>
<%= render :partial => 'form_file', :object => act_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
<hr>
</div>
<% end %>
<!-- Add -->
<div class="add-target">
</div>
<p class="add-btn">
<%= hidden_field_tag 'act_file_field_count', @act.act_files.count %>
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
</p>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_actives_path, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<script>
$(function() {
$("#main-wrap").after("");
$(document).on('click', '#add_link', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_act_links", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :act_links) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
formTip();
});
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_act_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :act_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_link', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
$('#remind-check').on('change', function() {
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
})
});
</script>
<% end %>

View File

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

View File

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

View File

@ -0,0 +1,45 @@
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @table_fields.each do |f| %>
<% if f == 'act.sign_up_count' or f == 'act.export' %>
<th class='span2'><%= t(f)%></th>
<% else %>
<%= thead(f) %>
<% end %>
<% end %>
</tr>
</thead>
<tbody>
<% @acts.each do |act| %>
<tr>
<td><%= act.category.title %></td>
<td>
<a href="<%= page_for_act(act) %>?method=show_data" target="_blank"><%= act.title %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(act) %>
<li><a href="/admin/actives/<%=act.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/actives/<%=act.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td><%= Act.time_range(act.sign_start_date, act.sign_end_date) %></td>
<td><%= Act.time_range(act.act_start_date, act.act_end_date) %></td>
<td><a href="/admin/actives/<%=act.id.to_s%>/act_signup"><%= act.act_signups.count %></a></td>
<td><a href="/admin/actives/<%=act.id.to_s%>/export?format=xlsx" target="_blank"><%= t('act.export') %></a></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@acts), class: "pagination pagination-centered"
end
%>

View File

@ -0,0 +1,45 @@
<span id="index_table">
<script>
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>
<h4><%= @act.title %></h4>
<table class="table main-list">
<thead>
<tr class="sort-header">
<th class='span2'><%= t('act_signup.name')%></th>
<th class='span2'><%= t('act_signup.tel')%></th>
<th class='span2'><%= t(:email)%></th>
</tr>
</thead>
<tbody>
<% @act_signups.each do |act_signup| %>
<tr>
<td>
<%= act_signup.name %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(act_signup) %>
<li><a href="/admin/active_signups/<%=act_signup.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/active_signups/<%=act_signup.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>
<td><%= act_signup.tel %></td>
<td><%= act_signup.email %></td>
</tr>
<% end %>
</tbody>
</table>
<%=
content_tag :div, class: "bottomnav clearfix" do
content_tag :div, paginate(@act_signups), class: "pagination pagination-centered"
end
%>
</span>
<%= render 'layouts/delete_modal', delete_options: @delete_options %>

View File

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

View File

@ -0,0 +1,116 @@
<%= form_for @act_signup, url: admin_active_path(@act), html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
123
</div>
</div>
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
ccc
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_actives_path, :class=>"btn" %>
</div>
<% content_for :page_specific_javascript do %>
<script>
$(function() {
$("#main-wrap").after("");
$(document).on('click', '#add_link', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_act_links", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_link', f, :act_links) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.tab-content').children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
formTip();
});
$(document).on('click', '#add_file', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_act_files", "g");
var on = $('.language-nav li.active').index();
var le = $(this).parent('.add-btn').prev('.add-target').children('.start-line').length;
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parent().siblings('.add-target').append(("<%= escape_javascript(add_attribute 'form_file', f, :act_files) %>").replace(old_id, new_id));
$(this).parent('.add-btn').prev('.add-target').children('.start-line').eq(le).children('.input-append').find('.tab-content').each(function() {
$(this).children('.tab-pane').eq(on).addClass('in active').siblings().removeClass('in active');
});
formTip();
});
$(document).on('click', '.delete_link', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.delete_file', function(){
$(this).parents('.input-prepend').remove();
});
$(document).on('click', '.remove_existing_record', function(){
if(confirm("<%= I18n.t(:sure?)%>")){
$(this).children('.should_destroy').attr('value', 1);
$(this).parents('.start-line').hide();
}
});
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
$('#remind-check').on('change', function() {
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
})
});
</script>
<% end %>
</fieldset>
<% end %>

View File

@ -0,0 +1,48 @@
# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: @act.title) do |sheet|
row = [t('act_signup.name')]
row << t('act_signup.idno') if !@act.has_idno.blank?
row << t('act_signup.sex')
row << t('act_signup.birthday')
row << t('act_signup.tel')
row << t('act_signup.phone')
row << t('act_signup.fax')
row << t(:email)
row << t('act.note')
sheet.add_row row
@act.act_signups.each do |signup|
row2 = []
@birtbday = !signup[:birthday].blank? ? signup[:birthday].to_date.to_s : ' '
row2 << "#{signup[:name]} "
row2 << "#{signup[:idno]} " if !@act.has_idno.blank?
row2 << "#{signup[:sex]} "
row2 << "#{@birtbday} "
row2 << "#{signup[:tel]} "
row2 << "#{signup[:phone]} "
row2 << "#{signup[:fax]} "
row2 << "#{signup[:email]} "
row2 << "#{signup[:note]} "
sheet.add_row row2
end
end

View File

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

View File

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

18
bin/rails Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/active/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"

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

@ -0,0 +1,54 @@
en:
restful_actions:
act_signup: Register Data
module_name:
active: Active
recaptcha:
errors:
verification_failed: Verification Failed
act:
active: Active
title: Event Title
content: Content
place: Place
sign_up_time_range: Registration Period
act_time_range: Event Period
export: Export
sign_up_count: Sign up count
act_start_date: Act start date
act_end_date: Act end date
sign_start_date: Sign up start date
sign_end_date: Sign up end date
is_sign_up: Enable online registration
has_idno: ID number required
set_active_agreements: Policy Content Setting
active_agreements: Policy Content
active_agreements_content: Content of Privacy and Personal Information Protection Policy
save_success: Successfully saved
note: Note
sign_up: Register
sign_up_success: Successfully Register
sign_up_not_yet: Not Yet Started
sign_up_not_open: Not Open
sign_up_overdue: Overdue
default_widget:
title: Title
time_range: Date Range
frontend:
active: Active Frontend
act_signup:
name: Name
idno: ID
sex: Sex
birthday: Birthday
tel: TEL
phone: Mobile telephone
fax: Fax
agree: "Accept Privacy and Personal Information Protection Policy of the Site"

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

@ -0,0 +1,55 @@
zh_tw:
restful_actions:
act_signup: 報名資料
module_name:
active: 活動報名
recaptcha:
errors:
verification_failed: 驗證碼錯誤
act:
active: 活動報名
title: 活動標題
content: 活動說明
place: 活動地點
act_time_range: 活動期間
sign_up_time_range: 報名期間
export: 匯出
sign_up_count: 報名人數
act_start_date: 活動開始日期
act_end_date: 活動結束日期
sign_start_date: 報名開始日期
sign_end_date: 報名結束日期
is_sign_up: 是否線上報名
has_idno: 報名是否需填寫身分證字號
set_active_agreements: 設定個資宣告
active_agreements: 個資宣告
active_agreements_content: 個資同意書內容
save_success: 儲存成功
sign_up: 線上報名
sign_up_success: 報名成功
note: 備註
sign_up_not_yet: 報名時間未開始
sign_up_not_open: 未開放報名
sign_up_overdue: 報名時間已過
default_widget:
title: 活動標題
time_range: 活動期間
frontend:
active: 活動前台
act_signup:
name: 姓名
idno: 身分證字號
sex: 性別
birthday: 出生年月日
tel: 聯絡電話
phone: 行動電話
fax: 傳真
agree: 同意接受本站個資及隱私權保護宣告
recaptcha: 驗證碼

25
config/routes.rb Normal file
View File

@ -0,0 +1,25 @@
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 :actives do
member do
get 'export'
get 'act_signup'
end
end
resources :active_agreements
resources :active_signups
end
resources :actives do
collection do
get ':slug_title-:uid', to: 'actives#show'
end
end
end
end

4
lib/active.rb Normal file
View File

@ -0,0 +1,4 @@
require "active/engine"
module Active
end

47
lib/active/engine.rb Normal file
View File

@ -0,0 +1,47 @@
module Active
class Engine < ::Rails::Engine
initializer "active" do
OrbitApp.registration "Active", :type => "ModuleApp" do
module_label "act.active"
base_url File.expand_path File.dirname(__FILE__)
widget_methods ["widget","widget1"]
widget_settings [{"data_count"=>10}]
authorizable
categorizable
frontend_enabled
data_count 1..20
side_bar do
head_label_i18n 'act.active', icon_class: "icon-hand-up"
available_for "users"
active_for_controllers (['admin/actives'])
head_link_path "admin_actives_path"
context_link 'list_',
:link_path=>"admin_actives_path" ,
:priority=>1,
:active_for_action=>{'admin/actives'=>'index'},
:available_for => 'users'
context_link 'new_',
:link_path=>"new_admin_active_path" ,
:priority=>2,
:active_for_action=>{'admin/actives'=>'new'},
:available_for => 'sub_managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'active').id}",
:priority=>3,
:active_for_action=>{'admin/actives'=>'categories'},
:active_for_category => 'Active',
:available_for => 'managers'
context_link 'act.set_active_agreements',
:link_path=>"admin_active_agreements_path" ,
:priority=>3,
:active_for_action=>{'admin/actives'=>'active_agreements'},
:available_for => 'managers'
end
end
end
end
end

3
lib/active/version.rb Normal file
View File

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

View File

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

7
test/active_test.rb Normal file
View File

@ -0,0 +1,7 @@
require 'test_helper'
class ActiveTest < ActiveSupport::TestCase
test "truth" do
assert_kind_of Module, Active
end
end

View File

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

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

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

6
test/dummy/Rakefile Normal file
View File

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

View File

View File

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

View File

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

View File

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

View File

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

View File

View File

View File

View File

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

3
test/dummy/bin/bundle Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

4
test/dummy/bin/rails Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'

4
test/dummy/bin/rake Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

4
test/dummy/config.ru Normal file
View File

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

View File

@ -0,0 +1,23 @@
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(*Rails.groups)
require "active"
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

View File

@ -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__)

View 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

View File

@ -0,0 +1,5 @@
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,3 @@
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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: ec7f0bcb9810f1fdfed1f5eea87a2dcf3d88128b7a56f24d112a067d30e2a677a22bb03b71adc2802e7bd178fd4462674739997ee777ad45d26e57ab9aa0343a
test:
secret_key_base: 1cf56a583b7662e22e1ee61bbc8ee9aee4a1c2a75639704f7cd93a9df343ef42273e1b1b155b0043eb3b7359d4eba6c9946ee38ab5cd366ec9cdd039cc1759ee
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

View File

0
test/dummy/log/.keep Normal file
View File

View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<title>The page you were looking for doesn't exist (404)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<title>The change you wanted was rejected (422)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/422.html -->
<div class="dialog">
<div>
<h1>The change you wanted was rejected.</h1>
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body {
background-color: #EFEFEF;
color: #2E2F30;
text-align: center;
font-family: arial, sans-serif;
margin: 0;
}
div.dialog {
width: 95%;
max-width: 33em;
margin: 4em auto 0;
}
div.dialog > div {
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #BBB;
border-top: #B00100 solid 4px;
border-top-left-radius: 9px;
border-top-right-radius: 9px;
background-color: white;
padding: 7px 12% 0;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
h1 {
font-size: 100%;
color: #730E15;
line-height: 1.5em;
}
div.dialog > p {
margin: 0 0 1em;
padding: 1em;
background-color: #F7F7F7;
border: 1px solid #CCC;
border-right-color: #999;
border-left-color: #999;
border-bottom-color: #999;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-top-color: #DADADA;
color: #666;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
}
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<div>
<h1>We're sorry, but something went wrong.</h1>
</div>
<p>If you are the application owner check the logs for more information.</p>
</div>
</body>
</html>

View File

View File

@ -0,0 +1,4 @@
require 'test_helper'
class ActHelperTest < ActionView::TestCase
end

15
test/test_helper.rb Normal file
View File

@ -0,0 +1,15 @@
# Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers!
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
# Load fixtures from the engine
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
end