Active Event
This commit is contained in:
commit
67767ea55b
88 files changed
+2688
No files matched your search
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -0,0 +1,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/
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,7 @@
|
||||
class ActAgreement
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :content, localize: true
|
||||
|
||||
end
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
<%= render_view %>
|
||||
@@ -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 %>
|
||||
@@ -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' %>
|
||||
@@ -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' %>
|
||||
@@ -0,0 +1,5 @@
|
||||
<%= t('act.sign_up_success') %>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %>
|
||||
@@ -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 %>
|
||||
@@ -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 %>
|
||||
@@ -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 %>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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
|
||||
%>
|
||||
@@ -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 %>
|
||||
@@ -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 %>
|
||||
@@ -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 %>
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<%= render_filter @filter_fields, "index_table" %>
|
||||
<span id="index_table">
|
||||
<%= render 'index'%>
|
||||
</span>
|
||||
|
||||
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
||||
@@ -0,0 +1,5 @@
|
||||
<%= form_for @act, url: admin_actives_path, html: {class: "form-horizontal main-forms"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render :partial => 'form', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
Reference in new issue
Block a user