commit 67767ea55bfe25565934d9071ec82bc76e9a3cbc Author: spen Date: Mon Nov 10 10:24:07 2014 +0800 Active Event diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..de5d954 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..1ef5e67 --- /dev/null +++ b/Gemfile @@ -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' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..67b8e91 --- /dev/null +++ b/Gemfile.lock @@ -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 diff --git a/MIT-LICENSE b/MIT-LICENSE new file mode 100644 index 0000000..ea966ec --- /dev/null +++ b/MIT-LICENSE @@ -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. diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..2dad362 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,3 @@ += Active + +This project rocks and uses MIT-LICENSE. \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..fb724df --- /dev/null +++ b/Rakefile @@ -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 diff --git a/active.gemspec b/active.gemspec new file mode 100644 index 0000000..4a6e476 --- /dev/null +++ b/active.gemspec @@ -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 diff --git a/app/assets/javascripts/act.js.coffee b/app/assets/javascripts/act.js.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/act.js.coffee @@ -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/ diff --git a/app/assets/stylesheets/act.css.scss b/app/assets/stylesheets/act.css.scss new file mode 100644 index 0000000..9feebe4 --- /dev/null +++ b/app/assets/stylesheets/act.css.scss @@ -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/ diff --git a/app/controllers/actives_controller.rb b/app/controllers/actives_controller.rb new file mode 100644 index 0000000..31ccaa7 --- /dev/null +++ b/app/controllers/actives_controller.rb @@ -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.title + '').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 = ('' + t('act.sign_up') + '').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 = ('' + t('act.sign_up') + '').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 \ No newline at end of file diff --git a/app/controllers/admin/active_agreements_controller.rb b/app/controllers/admin/active_agreements_controller.rb new file mode 100644 index 0000000..31e16e5 --- /dev/null +++ b/app/controllers/admin/active_agreements_controller.rb @@ -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 diff --git a/app/controllers/admin/active_signups_controller.rb b/app/controllers/admin/active_signups_controller.rb new file mode 100644 index 0000000..5454890 --- /dev/null +++ b/app/controllers/admin/active_signups_controller.rb @@ -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 diff --git a/app/controllers/admin/actives_controller.rb b/app/controllers/admin/actives_controller.rb new file mode 100644 index 0000000..6f55f7e --- /dev/null +++ b/app/controllers/admin/actives_controller.rb @@ -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 diff --git a/app/helpers/admin/actives_helper.rb b/app/helpers/admin/actives_helper.rb new file mode 100644 index 0000000..58af52b --- /dev/null +++ b/app/helpers/admin/actives_helper.rb @@ -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 \ No newline at end of file diff --git a/app/models/act.rb b/app/models/act.rb new file mode 100644 index 0000000..22e254e --- /dev/null +++ b/app/models/act.rb @@ -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 diff --git a/app/models/act_agreement.rb b/app/models/act_agreement.rb new file mode 100644 index 0000000..bbd9ddf --- /dev/null +++ b/app/models/act_agreement.rb @@ -0,0 +1,7 @@ +class ActAgreement + include Mongoid::Document + include Mongoid::Timestamps + + field :content, localize: true + +end \ No newline at end of file diff --git a/app/models/act_file.rb b/app/models/act_file.rb new file mode 100644 index 0000000..f8b8e21 --- /dev/null +++ b/app/models/act_file.rb @@ -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 diff --git a/app/models/act_link.rb b/app/models/act_link.rb new file mode 100644 index 0000000..60248d8 --- /dev/null +++ b/app/models/act_link.rb @@ -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 \ No newline at end of file diff --git a/app/models/act_signup.rb b/app/models/act_signup.rb new file mode 100644 index 0000000..856faef --- /dev/null +++ b/app/models/act_signup.rb @@ -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 diff --git a/app/views/actives/index.html.erb b/app/views/actives/index.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/actives/index.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/app/views/actives/show.html.erb b/app/views/actives/show.html.erb new file mode 100644 index 0000000..b141299 --- /dev/null +++ b/app/views/actives/show.html.erb @@ -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| %> +
+ + +
+ +
+ <%= @act.title %> +
+
+ + +
+ +
+ <%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('act_signup.name'), :required => true %> +
+
+ + <% if @act.has_idno %> + + +
+ +
+ <%= f.text_field :idno, :class=>"input-medium form-control", :placeholder=> t('act_signup.idno'), :required => true %> +
+
+ + <% end %> + + +
+ +
+ <%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd" %> +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ <%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('act_signup.tel'), :required => true %> +
+
+ + +
+ +
+ <%= f.text_field :phone, :class=>"input-medium form-control", :placeholder=> t('act_signup.phone') %> +
+
+ + +
+ +
+ <%= f.text_field :phone, :class=>"input-medium form-control", :placeholder=> t('act_signup.fax') %> +
+
+ + +
+ +
+ <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> +
+
+ + +
+ +
+ <%= f.text_area :note, rows: 5, :class=>"input-medium form-control", :placeholder=> t('act.note') %> +
+
+ + +
+ +
+ <%= gotcha_error %> + <%= gotcha %> +
+
+ + + +
+
+ "> + + <%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %> + <%= f.button t('cancel'), type: 'reset', class: 'btn' %> +
+
+ +
+<% end %> + + + + +<% elsif @act.sign_up.blank? %> + +<%= t('act.sign_up_not_yet') %> + +<% else %> + +<%= t('act.sign_up_overdue') %> + +<% end %> diff --git a/app/views/actives/show_data.html.erb b/app/views/actives/show_data.html.erb new file mode 100644 index 0000000..6349988 --- /dev/null +++ b/app/views/actives/show_data.html.erb @@ -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"] +%> + + + + + + + + + + + + + + + + + <% if !@act.content.blank? %> + + + + + <% end %> + + + + + <% if !@act.place.blank? %> + + + + + <% end %> + <% if !@act.act_files.blank? %> + + + + + <% end %> + <% if !@act.act_links.blank? %> + + + + + <% end %> + <% if !@act.note.blank? %> + + + + + <% end %> + + + + + +
<%= t(:category) %><%= @act.category.title %>
<%= t('act.act_time_range') %><%= @act_time_range %>
<%= t('act.title') %><%= @act.title %>
<%= t('act.content') %><%= nl2br(@act.content) %>
<%= t('act.sign_up_time_range') %><%= @sign_up_time_range %>
<%= t('act.place') %><%= @act.place %>
<%= t(:file_) %> + <% @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 %> +
<%= t(:link) %> + <% @act.act_links.map do |link| %> + <%= link_to (link.title.blank? ? link.url : link.title), link.url, :target => '_blank' %> + <% end %> +
<%= t('act.note') %><%= @act.note %>
<%= t('act.sign_up') %><%= @sign_up %>
+ +
+ +<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %> diff --git a/app/views/actives/show_privacy.html.erb b/app/views/actives/show_privacy.html.erb new file mode 100644 index 0000000..cae02a7 --- /dev/null +++ b/app/views/actives/show_privacy.html.erb @@ -0,0 +1,28 @@ +<% # encoding: utf-8 %> + +<% + data = action_data + @active_agreement = data["active_agreement"] +%> + + + +

個資及隱私權保護宣告

+ +
+ +<%= @active_agreement.content.html_safe %> + +
+ +
+ +<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %> \ No newline at end of file diff --git a/app/views/actives/signup_ok.html.erb b/app/views/actives/signup_ok.html.erb new file mode 100644 index 0000000..7467e83 --- /dev/null +++ b/app/views/actives/signup_ok.html.erb @@ -0,0 +1,5 @@ +<%= t('act.sign_up_success') %> + +
+ +<%= link_to t(:close), 'javascript:window.close();', :class => 'btn btn-primary' %> diff --git a/app/views/admin/active_agreements/index.html.erb b/app/views/admin/active_agreements/index.html.erb new file mode 100644 index 0000000..ae112bf --- /dev/null +++ b/app/views/admin/active_agreements/index.html.erb @@ -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 %> + +

<%= t('act.active') %>

+ +<%= form_for @active_agreement, url: @url, html: {class: "form-horizontal main-forms"} do |f| %> +
+ + +
+ + + + + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + +
+ +
+
+ <%= 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 %> +
+
+
+ +
+ + <% end %> + +
+ +
+ + +
+ <%= get_referer_url[:action] rescue "" %> + <%= f.submit t('submit'), class: 'btn btn-primary' %> + + <%= link_to t('cancel'), admin_actives_path, :class=>"btn" %> +
+ +
+ +<% end %> diff --git a/app/views/admin/active_signups/edit.html.erb b/app/views/admin/active_signups/edit.html.erb new file mode 100644 index 0000000..ae1aae3 --- /dev/null +++ b/app/views/admin/active_signups/edit.html.erb @@ -0,0 +1,127 @@ +<%= form_for @act_signup, url: admin_active_signup_path(@act_signup), html: {class: "form-horizontal main-forms"} do |f| %> +
+ +<% 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 %> + + +
+ + +
+ + + +
+ +
+ <%= @act.title %> +
+
+ + +
+ +
+ <%= f.text_field :name, :class => "input-block-level", placeholder: t('act_signup.name') %> +
+
+ + <% if @act.has_idno %> + + +
+ +
+ <%= f.text_field :idno, :class => "input-block-level", :placeholder=> t('act_signup.idno'), :required => true %> +
+
+ + <% end %> + + +
+ +
+ <%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd" %> +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ <%= f.text_field :tel, :class=>"input-block-level", :placeholder=> t('act_signup.tel'), :required => true %> +
+
+ + +
+ +
+ <%= f.text_field :phone, :class=>"input-block-level", :placeholder=> t('act_signup.phone') %> +
+
+ + +
+ +
+ <%= f.text_field :phone, :class=>"input-block-level", :placeholder=> t('act_signup.fax') %> +
+
+ + +
+ +
+ <%= f.email_field :email, :class=>"input-block-level", :placeholder=> t(:email), :required => true %> +
+
+ + +
+ +
+ <%= f.text_area :note, rows: 5, :class=>"input-block-level", :placeholder=> t('act.note') %> +
+
+ + +
+ +
+ + +
+ <%#= 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" %> +
+ + +
+<% end %> \ No newline at end of file diff --git a/app/views/admin/actives/_form.html.erb b/app/views/admin/actives/_form.html.erb new file mode 100644 index 0000000..9a2d3cb --- /dev/null +++ b/app/views/admin/actives/_form.html.erb @@ -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 %> + + +
+ + + + + + +
+ + +
+ + +
+ +
+ <%= select_category(f, @module_app) %> +
+
+ + +
+ +
+ <%= f.datetime_picker :act_start_date, :no_label => true %> +
+
+ +
+ +
+ <%= f.datetime_picker :act_end_date, :no_label => true %> +
+
+ + +
+ +
+ <%= f.datetime_picker :sign_start_date, :no_label => true %> +
+
+ +
+ +
+ <%= f.datetime_picker :sign_end_date, :no_label => true %> +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + + + + +
+ + <% @site_in_use_locales.each_with_index do |locale, i| %> + +
"> + + +
+ +
+ <%= 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 %> +
+
+ + +
+ +
+
+ <%= 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 %> +
+
+
+ + +
+ +
+ <%= 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 %> +
+
+ + +
+ +
+
+ <%= 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 %> +
+
+
+ + +
+ + <% end %> + + +
+ +
+ + + <% if @act && !@act.act_links.blank? %> +
+ <% @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 %> +
+
+ <% end %> + + +
+
+

+ <%= hidden_field_tag 'act_link_field_count', @act.act_links.count %> + <%= t(:add) %> +

+ +
+
+ + +
+ +
+ + + <% if @act && !@act.act_files.blank? %> +
+ <% @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 %> +
+
+ <% end %> + + +
+
+

+ <%= hidden_field_tag 'act_file_field_count', @act.act_files.count %> + <%= t(:add) %> +

+ +
+
+ +
+ +
+ + +
+ <%= get_referer_url[:action] rescue "" %> + <%= f.submit t('submit'), class: 'btn btn-primary' %> + + <%= link_to t('cancel'), admin_actives_path, :class=>"btn" %> +
+ +<% content_for :page_specific_javascript do %> + +<% end %> \ No newline at end of file diff --git a/app/views/admin/actives/_form_file.html.erb b/app/views/admin/actives/_form_file.html.erb new file mode 100644 index 0000000..8628623 --- /dev/null +++ b/app/views/admin/actives/_form_file.html.erb @@ -0,0 +1,55 @@ +<% if form_file.new_record? %> +
+<% else %> +
+ <% 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 %> +
+ + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= 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 %> + + <% end %> + + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= 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 %> + + <% end %> + + + <% if form_file.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %> +
+
\ No newline at end of file diff --git a/app/views/admin/actives/_form_link.html.erb b/app/views/admin/actives/_form_link.html.erb new file mode 100644 index 0000000..d4aa5fd --- /dev/null +++ b/app/views/admin/actives/_form_link.html.erb @@ -0,0 +1,26 @@ +
+ + <%= f.text_field :url, class: "input-large", placeholder: t(:url) %> + + + <% @site_in_use_locales.each_with_index do |locale, i| %> + <%= 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 %> + + <% end %> + + + <% if form_link.new_record? %> + + + + <% else %> + + <%= f.hidden_field :id %> + + <%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %> + + <% end %> +
\ No newline at end of file diff --git a/app/views/admin/actives/_index.html.erb b/app/views/admin/actives/_index.html.erb new file mode 100644 index 0000000..9078d6c --- /dev/null +++ b/app/views/admin/actives/_index.html.erb @@ -0,0 +1,45 @@ + + + + + + <% @table_fields.each do |f| %> + <% if f == 'act.sign_up_count' or f == 'act.export' %> + + <% else %> + <%= thead(f) %> + <% end %> + <% end %> + + + + <% @acts.each do |act| %> + + + + + + + + + <% end %> + +
<%= t(f)%>
<%= act.category.title %> + <%= act.title %> +
+ +
+
<%= Act.time_range(act.sign_start_date, act.sign_end_date) %><%= Act.time_range(act.act_start_date, act.act_end_date) %><%= act.act_signups.count %><%= t('act.export') %>
+ +<%= + content_tag :div, class: "bottomnav clearfix" do + content_tag :div, paginate(@acts), class: "pagination pagination-centered" + end +%> \ No newline at end of file diff --git a/app/views/admin/actives/act_signup.html.erb b/app/views/admin/actives/act_signup.html.erb new file mode 100644 index 0000000..0bbd041 --- /dev/null +++ b/app/views/admin/actives/act_signup.html.erb @@ -0,0 +1,45 @@ + + + + +

<%= @act.title %>

+ + + + + + + + + + + <% @act_signups.each do |act_signup| %> + + + + + + <% end %> + +
<%= t('act_signup.name')%><%= t('act_signup.tel')%><%= t(:email)%>
+ <%= act_signup.name %> +
+ +
+
<%= act_signup.tel %><%= act_signup.email %>
+ +<%= + content_tag :div, class: "bottomnav clearfix" do + content_tag :div, paginate(@act_signups), class: "pagination pagination-centered" + end +%> +
+ +<%= render 'layouts/delete_modal', delete_options: @delete_options %> diff --git a/app/views/admin/actives/edit.html.erb b/app/views/admin/actives/edit.html.erb new file mode 100644 index 0000000..775d83c --- /dev/null +++ b/app/views/admin/actives/edit.html.erb @@ -0,0 +1,5 @@ +<%= form_for @act, url: admin_active_path(@act), html: {class: "form-horizontal main-forms"} do |f| %> +
+ <%= render :partial => 'form', locals: {f: f} %> +
+<% end %> \ No newline at end of file diff --git a/app/views/admin/actives/edit_act_signup.html.erb b/app/views/admin/actives/edit_act_signup.html.erb new file mode 100644 index 0000000..e477dee --- /dev/null +++ b/app/views/admin/actives/edit_act_signup.html.erb @@ -0,0 +1,116 @@ +<%= form_for @act_signup, url: admin_active_path(@act), html: {class: "form-horizontal main-forms"} do |f| %> +
+ +<% 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 %> + + +
+ + + + + + +
+ + +
+123 + +
+ +
+ + + + + + +
+ccc + + +
+ +
+ + +
+ <%= get_referer_url[:action] rescue "" %> + <%= f.submit t('submit'), class: 'btn btn-primary' %> + + <%= link_to t('cancel'), admin_actives_path, :class=>"btn" %> +
+ +<% content_for :page_specific_javascript do %> + +<% end %> + + + +
+<% end %> \ No newline at end of file diff --git a/app/views/admin/actives/export.xlsx.axlsx b/app/views/admin/actives/export.xlsx.axlsx new file mode 100644 index 0000000..f73c99a --- /dev/null +++ b/app/views/admin/actives/export.xlsx.axlsx @@ -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 + diff --git a/app/views/admin/actives/index.html.erb b/app/views/admin/actives/index.html.erb new file mode 100644 index 0000000..4513c37 --- /dev/null +++ b/app/views/admin/actives/index.html.erb @@ -0,0 +1,6 @@ +<%= render_filter @filter_fields, "index_table" %> + + <%= render 'index'%> + + +<%= render 'layouts/delete_modal', delete_options: @delete_options %> diff --git a/app/views/admin/actives/new.html.erb b/app/views/admin/actives/new.html.erb new file mode 100644 index 0000000..bf8a451 --- /dev/null +++ b/app/views/admin/actives/new.html.erb @@ -0,0 +1,5 @@ +<%= form_for @act, url: admin_actives_path, html: {class: "form-horizontal main-forms"} do |f| %> +
+ <%= render :partial => 'form', locals: {f: f} %> +
+<% end %> \ No newline at end of file diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..656cf54 --- /dev/null +++ b/bin/rails @@ -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" diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..a1c3854 --- /dev/null +++ b/config/locales/en.yml @@ -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" \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml new file mode 100644 index 0000000..3943d86 --- /dev/null +++ b/config/locales/zh_tw.yml @@ -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: 驗證碼 \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..967b03f --- /dev/null +++ b/config/routes.rb @@ -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 diff --git a/lib/active.rb b/lib/active.rb new file mode 100644 index 0000000..c61b186 --- /dev/null +++ b/lib/active.rb @@ -0,0 +1,4 @@ +require "active/engine" + +module Active +end diff --git a/lib/active/engine.rb b/lib/active/engine.rb new file mode 100644 index 0000000..1ccc603 --- /dev/null +++ b/lib/active/engine.rb @@ -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 \ No newline at end of file diff --git a/lib/active/version.rb b/lib/active/version.rb new file mode 100644 index 0000000..8b986dc --- /dev/null +++ b/lib/active/version.rb @@ -0,0 +1,3 @@ +module Active + VERSION = "0.0.1" +end diff --git a/lib/tasks/active_tasks.rake b/lib/tasks/active_tasks.rake new file mode 100644 index 0000000..a4ef721 --- /dev/null +++ b/lib/tasks/active_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :active do +# # Task goes here +# end diff --git a/test/active_test.rb b/test/active_test.rb new file mode 100644 index 0000000..50b9c6c --- /dev/null +++ b/test/active_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ActiveTest < ActiveSupport::TestCase + test "truth" do + assert_kind_of Module, Active + end +end diff --git a/test/controllers/act_controller_test.rb b/test/controllers/act_controller_test.rb new file mode 100644 index 0000000..44a07c0 --- /dev/null +++ b/test/controllers/act_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ActControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/dummy/README.rdoc b/test/dummy/README.rdoc new file mode 100644 index 0000000..dd4e97e --- /dev/null +++ b/test/dummy/README.rdoc @@ -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 +rake doc:app. diff --git a/test/dummy/Rakefile b/test/dummy/Rakefile new file mode 100644 index 0000000..ba6b733 --- /dev/null +++ b/test/dummy/Rakefile @@ -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 diff --git a/test/dummy/app/assets/images/.keep b/test/dummy/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/assets/javascripts/application.js b/test/dummy/app/assets/javascripts/application.js new file mode 100644 index 0000000..5bc2e1c --- /dev/null +++ b/test/dummy/app/assets/javascripts/application.js @@ -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 . diff --git a/test/dummy/app/assets/stylesheets/application.css b/test/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000..a443db3 --- /dev/null +++ b/test/dummy/app/assets/stylesheets/application.css @@ -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 + */ diff --git a/test/dummy/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..d83690e --- /dev/null +++ b/test/dummy/app/controllers/application_controller.rb @@ -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 diff --git a/test/dummy/app/controllers/concerns/.keep b/test/dummy/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/helpers/application_helper.rb b/test/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/test/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/test/dummy/app/mailers/.keep b/test/dummy/app/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/models/.keep b/test/dummy/app/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/models/concerns/.keep b/test/dummy/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/app/views/layouts/application.html.erb b/test/dummy/app/views/layouts/application.html.erb new file mode 100644 index 0000000..593a778 --- /dev/null +++ b/test/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,14 @@ + + + + Dummy + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> + <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> + <%= csrf_meta_tags %> + + + +<%= yield %> + + + diff --git a/test/dummy/bin/bundle b/test/dummy/bin/bundle new file mode 100755 index 0000000..66e9889 --- /dev/null +++ b/test/dummy/bin/bundle @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') diff --git a/test/dummy/bin/rails b/test/dummy/bin/rails new file mode 100755 index 0000000..728cd85 --- /dev/null +++ b/test/dummy/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path('../../config/application', __FILE__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/test/dummy/bin/rake b/test/dummy/bin/rake new file mode 100755 index 0000000..1724048 --- /dev/null +++ b/test/dummy/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative '../config/boot' +require 'rake' +Rake.application.run diff --git a/test/dummy/config.ru b/test/dummy/config.ru new file mode 100644 index 0000000..5bc2a61 --- /dev/null +++ b/test/dummy/config.ru @@ -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 diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb new file mode 100644 index 0000000..fd077f4 --- /dev/null +++ b/test/dummy/config/application.rb @@ -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 + diff --git a/test/dummy/config/boot.rb b/test/dummy/config/boot.rb new file mode 100644 index 0000000..6266cfc --- /dev/null +++ b/test/dummy/config/boot.rb @@ -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__) diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml new file mode 100644 index 0000000..1c1a37c --- /dev/null +++ b/test/dummy/config/database.yml @@ -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 diff --git a/test/dummy/config/environment.rb b/test/dummy/config/environment.rb new file mode 100644 index 0000000..ee8d90d --- /dev/null +++ b/test/dummy/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require File.expand_path('../application', __FILE__) + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/test/dummy/config/environments/development.rb b/test/dummy/config/environments/development.rb new file mode 100644 index 0000000..ddf0e90 --- /dev/null +++ b/test/dummy/config/environments/development.rb @@ -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 diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb new file mode 100644 index 0000000..b93a877 --- /dev/null +++ b/test/dummy/config/environments/production.rb @@ -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 diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb new file mode 100644 index 0000000..053f5b6 --- /dev/null +++ b/test/dummy/config/environments/test.rb @@ -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 diff --git a/test/dummy/config/initializers/assets.rb b/test/dummy/config/initializers/assets.rb new file mode 100644 index 0000000..d2f4ec3 --- /dev/null +++ b/test/dummy/config/initializers/assets.rb @@ -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 ) diff --git a/test/dummy/config/initializers/backtrace_silencers.rb b/test/dummy/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/test/dummy/config/initializers/backtrace_silencers.rb @@ -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! diff --git a/test/dummy/config/initializers/cookies_serializer.rb b/test/dummy/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7a06a89 --- /dev/null +++ b/test/dummy/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json \ No newline at end of file diff --git a/test/dummy/config/initializers/filter_parameter_logging.rb b/test/dummy/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/test/dummy/config/initializers/filter_parameter_logging.rb @@ -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] diff --git a/test/dummy/config/initializers/inflections.rb b/test/dummy/config/initializers/inflections.rb new file mode 100644 index 0000000..ac033bf --- /dev/null +++ b/test/dummy/config/initializers/inflections.rb @@ -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 diff --git a/test/dummy/config/initializers/mime_types.rb b/test/dummy/config/initializers/mime_types.rb new file mode 100644 index 0000000..dc18996 --- /dev/null +++ b/test/dummy/config/initializers/mime_types.rb @@ -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 diff --git a/test/dummy/config/initializers/session_store.rb b/test/dummy/config/initializers/session_store.rb new file mode 100644 index 0000000..e766b67 --- /dev/null +++ b/test/dummy/config/initializers/session_store.rb @@ -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' diff --git a/test/dummy/config/initializers/wrap_parameters.rb b/test/dummy/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/test/dummy/config/initializers/wrap_parameters.rb @@ -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 diff --git a/test/dummy/config/locales/en.yml b/test/dummy/config/locales/en.yml new file mode 100644 index 0000000..0653957 --- /dev/null +++ b/test/dummy/config/locales/en.yml @@ -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" diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb new file mode 100644 index 0000000..3f66539 --- /dev/null +++ b/test/dummy/config/routes.rb @@ -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 diff --git a/test/dummy/config/secrets.yml b/test/dummy/config/secrets.yml new file mode 100644 index 0000000..b7a2076 --- /dev/null +++ b/test/dummy/config/secrets.yml @@ -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"] %> diff --git a/test/dummy/lib/assets/.keep b/test/dummy/lib/assets/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/log/.keep b/test/dummy/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/dummy/public/404.html b/test/dummy/public/404.html new file mode 100644 index 0000000..b612547 --- /dev/null +++ b/test/dummy/public/404.html @@ -0,0 +1,67 @@ + + + + The page you were looking for doesn't exist (404) + + + + + + +
+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/test/dummy/public/422.html b/test/dummy/public/422.html new file mode 100644 index 0000000..a21f82b --- /dev/null +++ b/test/dummy/public/422.html @@ -0,0 +1,67 @@ + + + + The change you wanted was rejected (422) + + + + + + +
+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/test/dummy/public/500.html b/test/dummy/public/500.html new file mode 100644 index 0000000..061abc5 --- /dev/null +++ b/test/dummy/public/500.html @@ -0,0 +1,66 @@ + + + + We're sorry, but something went wrong (500) + + + + + + +
+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

+
+ + diff --git a/test/dummy/public/favicon.ico b/test/dummy/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/test/helpers/act_helper_test.rb b/test/helpers/act_helper_test.rb new file mode 100644 index 0000000..d05f47a --- /dev/null +++ b/test/helpers/act_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ActHelperTest < ActionView::TestCase +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..1e26a31 --- /dev/null +++ b/test/test_helper.rb @@ -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