first commit for hps
This commit is contained in:
commit
34582be02b
|
@ -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
|
|
@ -0,0 +1,15 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
# Declare your gem's dependencies in member_counselor.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 a debugger
|
||||||
|
# gem 'byebug', group: [:development, :test]
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright 2017 Harry Bomrah
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,3 @@
|
||||||
|
= MemberCounselor
|
||||||
|
|
||||||
|
This project rocks and uses MIT-LICENSE.
|
|
@ -0,0 +1,37 @@
|
||||||
|
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 = 'MemberCounselor'
|
||||||
|
rdoc.options << '--line-numbers'
|
||||||
|
rdoc.rdoc_files.include('README.rdoc')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
|
end
|
||||||
|
|
||||||
|
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
||||||
|
load 'rails/tasks/engine.rake'
|
||||||
|
|
||||||
|
|
||||||
|
load 'rails/tasks/statistics.rake'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bundler::GemHelper.install_tasks
|
||||||
|
|
||||||
|
require 'rake/testtask'
|
||||||
|
|
||||||
|
Rake::TestTask.new(:test) do |t|
|
||||||
|
t.libs << 'lib'
|
||||||
|
t.libs << 'test'
|
||||||
|
t.pattern = 'test/**/*_test.rb'
|
||||||
|
t.verbose = false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
task default: :test
|
|
@ -0,0 +1,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 any plugin's vendor/assets/javascripts directory 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/rails/sprockets#sprockets-directives) for details
|
||||||
|
// about supported directives.
|
||||||
|
//
|
||||||
|
//= require_tree .
|
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
|
* listed below.
|
||||||
|
*
|
||||||
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||||
|
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||||
|
*
|
||||||
|
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||||
|
* compiled file so the styles you add here take precedence over styles defined in any styles
|
||||||
|
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||||
|
* file per style scope.
|
||||||
|
*
|
||||||
|
*= require_tree .
|
||||||
|
*= require_self
|
||||||
|
*/
|
|
@ -0,0 +1,68 @@
|
||||||
|
class Admin::MemberCounselorsController < OrbitAdminController
|
||||||
|
|
||||||
|
def uploads
|
||||||
|
@files = HpsFile.all.desc(:created_at).page(params[:page]).per(10)
|
||||||
|
@table_fields = ["member_counselor.file_date","member_counselor.file_title", "member_counselor.downloaded_times", "member_counselor.account", "member_counselor.user_type", "actions"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@counselors = HpsMember.all.desc(:created_at).page(params[:page]).per(10)
|
||||||
|
@table_fields = ["member_counselor.account","member_counselor.name", "member_counselor.user_type"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@counselor = HpsMember.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@counselor = HpsMember.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@counselor = HpsMember.new(counselor_params)
|
||||||
|
if @counselor.save
|
||||||
|
redirect_to admin_member_counselors_path
|
||||||
|
else
|
||||||
|
render :action => "new"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
counselor = HpsMember.find(params[:id])
|
||||||
|
counselor.destroy
|
||||||
|
redirect_to admin_member_counselors_path(:page => params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@counselor = HpsMember.find(params[:id])
|
||||||
|
if @counselor.update_attributes(counselor_params)
|
||||||
|
redirect_to admin_member_counselors_path(:page => params[:page])
|
||||||
|
else
|
||||||
|
render :action => "edit"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_info
|
||||||
|
@objects = []
|
||||||
|
case params[:get_info]
|
||||||
|
when "counties"
|
||||||
|
@objects = HpsCity.find(params[:id]).hps_counties.asc(:old_id)
|
||||||
|
when "schools"
|
||||||
|
@objects = HpsCounty.find(params[:id]).hps_schools.asc(:old_id)
|
||||||
|
end
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy_upload
|
||||||
|
hpsupload = HpsFile.find(params[:id])
|
||||||
|
hpsupload.destroy
|
||||||
|
redirect_to uploads_admin_member_counselors_path
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def counselor_params
|
||||||
|
params.require(:hps_member).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
class CUserController < ApplicationController
|
||||||
|
before_filter :set_key_for_this
|
||||||
|
layout "special"
|
||||||
|
helper_method :current_counselor_user
|
||||||
|
|
||||||
|
def is_user_authorized?
|
||||||
|
redirect_to member_login_path if current_counselor_user.nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_cuser_session(user=nil)
|
||||||
|
if !user.nil? and current_counselor_user.nil?
|
||||||
|
session[:current_counselor_user_id] = user.id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy_cpanel_session
|
||||||
|
session.delete(:current_counselor_user_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_counselor_user
|
||||||
|
@current_counselor_user = HpsMember.find(session[:current_counselor_user_id]) rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_key_for_this
|
||||||
|
@key = Site.first.template
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,71 @@
|
||||||
|
class MemberCounselorsController < CUserController
|
||||||
|
|
||||||
|
before_filter :is_user_authorized?, :only => ["show"]
|
||||||
|
|
||||||
|
def index
|
||||||
|
if !current_counselor_user.nil?
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def logoutuser
|
||||||
|
destroy_cpanel_session
|
||||||
|
redirect_to member_login_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def loginuser
|
||||||
|
user = HpsMember.where(:account => params[:username]).first rescue nil
|
||||||
|
if user.nil?
|
||||||
|
redirect_to member_login_path(:error=>"invld")
|
||||||
|
else
|
||||||
|
if user.enabled
|
||||||
|
if user.authenticate(params[:password])
|
||||||
|
create_cuser_session(user)
|
||||||
|
redirect_to member_dash_path(user.account)
|
||||||
|
else
|
||||||
|
redirect_to member_login_path(:error=>"invld")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
redirect_to member_login_path(:error=>"dsbld")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def fileupload
|
||||||
|
@hpsfile = HpsFile.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def editfileupload
|
||||||
|
@hpsfile = HpsFile.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def file_upload
|
||||||
|
hpsfile = HpsFile.new(hps_file_params)
|
||||||
|
hpsfile.hps_member = current_counselor_user
|
||||||
|
hpsfile.save
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_file_upload
|
||||||
|
hpsfile = HpsFile.find(params[:id])
|
||||||
|
hpsfile.update_attributes(hps_file_params)
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def deletefileupload
|
||||||
|
hpsfile = HpsFile.find(params[:id])
|
||||||
|
hpsfile.destroy
|
||||||
|
redirect_to member_dash_path(current_counselor_user.account)
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@files = current_counselor_user.hps_files
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def hps_file_params
|
||||||
|
params.require(:hps_file).permit!
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
module MemberCounselor
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,10 @@
|
||||||
|
class HpsCity
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :old_id
|
||||||
|
field :name
|
||||||
|
|
||||||
|
has_many :hps_counties, :dependent => :destroy
|
||||||
|
has_many :hps_schools
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
class HpsCounty
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :old_id
|
||||||
|
field :name
|
||||||
|
field :zip_code
|
||||||
|
|
||||||
|
belongs_to :hps_city
|
||||||
|
has_many :hps_schools, :dependent => :destroy
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
class HpsFile
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
mount_uploader :file, AssetUploader
|
||||||
|
|
||||||
|
field :title
|
||||||
|
field :download_count, type: Integer, :default => 0
|
||||||
|
field :year, type: Integer
|
||||||
|
|
||||||
|
belongs_to :hps_member
|
||||||
|
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,50 @@
|
||||||
|
class HpsMember
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
include ActiveModel::SecurePassword
|
||||||
|
|
||||||
|
# commmon values
|
||||||
|
|
||||||
|
field :account
|
||||||
|
field :password_digest, type: String
|
||||||
|
field :name
|
||||||
|
field :title
|
||||||
|
field :telephone
|
||||||
|
field :mobile
|
||||||
|
field :hps_city_id
|
||||||
|
field :hps_county_id
|
||||||
|
field :address
|
||||||
|
field :email
|
||||||
|
field :score, type: Integer, :default => 0
|
||||||
|
field :enabled, :type => Boolean, :default => true
|
||||||
|
field :user_type, type: Integer
|
||||||
|
|
||||||
|
|
||||||
|
# school type
|
||||||
|
field :hps_school_id
|
||||||
|
|
||||||
|
# counselor type
|
||||||
|
field :affilated_committees, type: Array, :default => []
|
||||||
|
field :organization
|
||||||
|
field :responsible_counties, type: Array, :default => []
|
||||||
|
field :year, type: Array, :default => []
|
||||||
|
|
||||||
|
|
||||||
|
has_secure_password
|
||||||
|
|
||||||
|
validates :account, uniqueness: true
|
||||||
|
validates :password, :on => [:create], length: {:in => 8..20}
|
||||||
|
|
||||||
|
has_many :hps_files, :dependent => :destroy
|
||||||
|
|
||||||
|
def get_user_type
|
||||||
|
case self.user_type
|
||||||
|
when 0
|
||||||
|
I18n.t("member_counselor.type1")
|
||||||
|
when 1
|
||||||
|
I18n.t("member_counselor.type2")
|
||||||
|
when 2
|
||||||
|
I18n.t("member_counselor.type3")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,15 @@
|
||||||
|
class HpsSchool
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :old_id
|
||||||
|
field :name
|
||||||
|
field :address
|
||||||
|
field :telephone
|
||||||
|
field :land
|
||||||
|
field :url
|
||||||
|
field :type
|
||||||
|
|
||||||
|
belongs_to :hps_city
|
||||||
|
belongs_to :hps_county
|
||||||
|
end
|
|
@ -0,0 +1,256 @@
|
||||||
|
<% content_for :page_specific_css do %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
|
<%= stylesheet_link_tag "lib/main-list" %>
|
||||||
|
<% end %>
|
||||||
|
<%= f.error_messages %>
|
||||||
|
<fieldset>
|
||||||
|
<!-- 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">
|
||||||
|
|
||||||
|
<!-- Account name -->
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :account ,t("member_counselor.account"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :account %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :password ,t("member_counselor.password"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.password_field :password %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :password_confirmation ,t("member_counselor.confirm_password"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.password_field :password_confirmation %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :name ,t("member_counselor.name"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :name %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :title ,t("member_counselor.title"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :title %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :telephone ,t("member_counselor.telephone"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :telephone %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :mobile ,t("member_counselor.mobile"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :mobile %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :email ,t("member_counselor.email"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :email %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% types = [t("member_counselor.type1"),t("member_counselor.type2"),t("member_counselor.type3")] %>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :user_type ,t("member_counselor.user_type"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<% types.each_with_index do |type, idx| %>
|
||||||
|
<label for="user_type_<%= idx %>" style="display: inline-block; margin-right: 10px;">
|
||||||
|
<input id="user_type_<%= idx %>" <%= @counselor.user_type == idx ? "checked=checked" : "" %> type="radio" name="hps_member[user_type]" value="<%= idx %>" class="type_selectable" />
|
||||||
|
<%= type %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :hps_city_id ,t("member_counselor.city"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.select :hps_city_id, options_for_select(HpsCity.all.asc(:old_id).collect{|city| [city.name, city.id]}, @counselor.hps_city_id), {:prompt => "Select City"}, {:class => "selectable"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :hps_county_id ,t("member_counselor.county"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%
|
||||||
|
opts = []
|
||||||
|
if !@counselor.new_record?
|
||||||
|
opts = HpsCity.find(@counselor.hps_city_id).hps_counties.asc(:old_id).collect{|sc| [sc.name, sc.id]}
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%= f.select :hps_county_id, options_for_select(opts,@counselor.hps_county_id), {}, {:class => "selectable"} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div for="user_type_0" class="type-area" style="<%= @counselor.user_type == 0 ? "" : "display: none;" %>">
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :hps_school_id ,t("member_counselor.school"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%
|
||||||
|
opts = []
|
||||||
|
if @counselor.user_type == 0
|
||||||
|
opts = HpsCounty.find(@counselor.hps_county_id).hps_schools.asc(:old_id).collect{|sc| [sc.name, sc.id]}
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%= f.select :hps_school_id, options_for_select(opts, @counselor.hps_school_id), {} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :address ,t("member_counselor.address"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_area :address %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div for="user_type_2" class="type-area" style="<%= @counselor.user_type == 2 ? "" : "display: none;" %>">
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :affilated_committees ,t("member_counselor.affilated_committee"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<label for="affilated_committees_1">
|
||||||
|
<input id="affilated_committees_1" <%= @counselor.affilated_committees.include?("中央輔導委員") ? "checked=checked" : "" %> type="checkbox" name="hps_member[affilated_committees][]" value="中央輔導委員" />
|
||||||
|
中央輔導委員
|
||||||
|
</label>
|
||||||
|
<label for="affilated_committees_2">
|
||||||
|
<input id="affilated_committees_2" <%= @counselor.affilated_committees.include?("縣市輔導委員") ? "checked=checked" : "" %> type="checkbox" name="hps_member[affilated_committees][]" value="縣市輔導委員" />
|
||||||
|
縣市輔導委員
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :organization ,t("member_counselor.organization"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.text_field :organization %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :responsible_counties ,t("member_counselor.responsible_county"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<% HpsCity.all.asc(:old_id).each_with_index do |city, idx| %>
|
||||||
|
<label for="responsible_counties_<%= idx %>" style="display: inline-block; margin-right: 10px;">
|
||||||
|
<input id="responsible_counties_<%= idx %>" <%= @counselor.responsible_counties.include?(city.id.to_s) ? "checked=checked" : "" %> type="checkbox" name="hps_member[responsible_counties][]" value="<%= city.id.to_s %>" />
|
||||||
|
<%= city.name %>
|
||||||
|
</label>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :year ,t("member_counselor.year"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<select name="hps_member[year][]" multiple="multiple">
|
||||||
|
<% yearnow = Time.now.strftime("%Y").to_i
|
||||||
|
total = yearnow - 1911 %>
|
||||||
|
<% (0..total).each do |i| %>
|
||||||
|
<option value="<%= (yearnow - i) %>"><%= (yearnow - i) %></option>
|
||||||
|
<% end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<% if !@counselor.year.blank? %>
|
||||||
|
<%= @counselor.year.join(", ") %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<%= f.label :enabled ,t("member_counselor.enabled"), :class=>"control-label muted" %>
|
||||||
|
<div class="controls">
|
||||||
|
<%= f.check_box :enabled %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Form Actions -->
|
||||||
|
<div class="form-actions">
|
||||||
|
<% if params[:page].present? %>
|
||||||
|
<input type="hidden" name="page" value="<%= params[:page] %>">
|
||||||
|
<% end %>
|
||||||
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
|
<a href="" onclick="window.history.back();return false;" class="btn">Back</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("select.selectable").on("change",function(){
|
||||||
|
var data,
|
||||||
|
id = $(this).attr("id"),
|
||||||
|
val = $(this).val();
|
||||||
|
switch(id){
|
||||||
|
case "hps_member_hps_city_id":
|
||||||
|
data = {"id" : val, "get_info" : "counties"}
|
||||||
|
break;
|
||||||
|
case "hps_member_hps_county_id":
|
||||||
|
data = {"id" : val, "get_info" : "schools"}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url : "/admin/member_counselors/get_info",
|
||||||
|
data : data,
|
||||||
|
type : "get",
|
||||||
|
dataType : "html"
|
||||||
|
}).done(function(html){
|
||||||
|
switch(id){
|
||||||
|
case "hps_member_hps_city_id":
|
||||||
|
$("#hps_member_hps_county_id").html(html);
|
||||||
|
$("#hps_member_hps_school_id").html("");
|
||||||
|
$("#hps_member_address").val("");
|
||||||
|
break;
|
||||||
|
case "hps_member_hps_county_id":
|
||||||
|
$("#hps_member_hps_school_id").html(html);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$("#hps_member_hps_school_id").on("change",function(){
|
||||||
|
if($(this).val() != ""){
|
||||||
|
var opt = $(this).find("option:selected");
|
||||||
|
$("#hps_member_address").val(opt.data("address"));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$("input.type_selectable").on("click",function(){
|
||||||
|
var id = $("input.type_selectable:checked").attr("id");
|
||||||
|
$(".type-area").hide();
|
||||||
|
$("div[for=" + id + "]").show();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @counselor, :url => {:action => "update"}, :html => {:class => 'form-horizontal main-forms'} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<% case params[:get_info] %>
|
||||||
|
<% when "counties" %>
|
||||||
|
<option>Select County</option>
|
||||||
|
<% when "schools" %>
|
||||||
|
<option>Select School</option>
|
||||||
|
<% end %>
|
||||||
|
<%#= options_for_select(@objects.collect{|obj|[obj.name, obj.id]}) %>
|
||||||
|
<% @objects.each do |obj| %>
|
||||||
|
<option value="<%= obj.id.to_s %>" <%= params[:get_info] == "schools" ? "data-address=#{obj.address}" : "" %>><%= obj.name %></option>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,41 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @counselors.each do |counselor| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="#"><%= counselor.account %></a>
|
||||||
|
<div class="quick-edit">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<% if can_edit_or_delete?(counselor) %>
|
||||||
|
<li><a href="<%= edit_admin_member_counselor_path(counselor, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="<%= admin_member_counselor_path(counselor, :page => params[:page]) %>" data-method="delete" data-confirm="Are you sure?" class="delete text-error"><%= t(:delete_) %></a></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= counselor.name rescue "" %>
|
||||||
|
<% if (!counselor.enabled) %>
|
||||||
|
<span class='label'><%= t(:disabled) %></span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= counselor.get_user_type %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%=
|
||||||
|
content_tag :div, class: "bottomnav clearfix" do
|
||||||
|
content_tag :div, paginate(@counselors), class: "pagination pagination-centered"
|
||||||
|
end
|
||||||
|
%>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @counselor, :url => {:action => "create"}, :html => {:class => 'form-horizontal main-forms'} do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,39 @@
|
||||||
|
<table class="table main-list">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-header">
|
||||||
|
<% @table_fields.each do |f| %>
|
||||||
|
<%= thead(f) %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @files.each do |file| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= file.created_at.strftime("%Y/%m/%d") %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="<%= file.file.url %>" target="_blank"><%= file.title %></a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= file.download_count %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= file.hps_member.account %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= file.hps_member.get_user_type %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="<%= destroy_upload_admin_member_counselor_path(file) %>" data-method="delete" data-confirm="Are you sure?" class="text-error">Delete</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<%=
|
||||||
|
content_tag :div, class: "bottomnav clearfix" do
|
||||||
|
content_tag :div, paginate(@files), class: "pagination pagination-centered"
|
||||||
|
end
|
||||||
|
%>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="<%= I18n.locale.to_s %>" class="orbit">
|
||||||
|
<head>
|
||||||
|
<%= render_partial("head") %>
|
||||||
|
</head>
|
||||||
|
<body class="internal-page">
|
||||||
|
<%= render_orbit_bar %>
|
||||||
|
<%= render_header %>
|
||||||
|
<section class="layout-slide no-print single-child-datapp" data-pp="300"></section>
|
||||||
|
<div class="layout-content">
|
||||||
|
<div class="layout-content-inner container">
|
||||||
|
<div class="breadcrumb-wrap" data-pp="500"></div>
|
||||||
|
<div class="sitemenu-wrap" data-pp="400"></div>
|
||||||
|
<div class="row">
|
||||||
|
<section class="layout-content-box left-column col-sm-9">
|
||||||
|
<div class="extra" data-pp="600"></div>
|
||||||
|
<main id="main-content" class="main-content" data-content="true">
|
||||||
|
<%= yield %>
|
||||||
|
</main>
|
||||||
|
<%= render_every_page_sharer %>
|
||||||
|
<div class="extra" data-pp="700"></div>
|
||||||
|
</section>
|
||||||
|
<aside class="layout-content-box aside right-column col-sm-3" data-pp="13"></aside>
|
||||||
|
</div>
|
||||||
|
<div class="extra" data-pp="800"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<%= render_footer %>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
|
<script type="text/javascript" src="/assets/jquery_ujs.js"></script>
|
||||||
|
<table width="100%" border="1">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="100px" >Date</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th width="200px">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% if !@files.blank? %>
|
||||||
|
<% @files.each_with_index do |file,idx| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= file.created_at.strftime("%y/%m/%d") %></td>
|
||||||
|
<td><%= file.title %></td>
|
||||||
|
<td>
|
||||||
|
<a href="<%= file.file.url %>" target="_blank">Download</a>
|
||||||
|
<a href="<%= edit_upload_cuser_file_path(file) %>">Edit</a>
|
||||||
|
<a style="color: red;" href="<%= delete_upload_cuser_file_path(file) %>" data-method="delete" data-confirm="Are you sure?">Delete</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">No files uploaded.</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br />
|
||||||
|
<a href="<%= upload_cuser_file_path %>" class="btn btn-primary">Upload File</a>
|
|
@ -0,0 +1,62 @@
|
||||||
|
<table width="100%" border="1">
|
||||||
|
<tr>
|
||||||
|
<th>學年度</th>
|
||||||
|
<td>
|
||||||
|
<%
|
||||||
|
yearnow = Time.now.strftime("%Y").to_i - 1
|
||||||
|
total = yearnow - 1911
|
||||||
|
min = total - 10
|
||||||
|
%>
|
||||||
|
<%= f.select :year, (0..10).collect{|i|[(total - i),(total - i)]} %>
|
||||||
|
<% if current_counselor_user.user_type == 0 %>
|
||||||
|
<span style="color: red;">此為學年度非年度,例如103年上半年為102學年度,103年下半年為103學年度,請注意填選</span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>檔案來源</th>
|
||||||
|
<td>
|
||||||
|
<%= f.file_field :file %>
|
||||||
|
<span>
|
||||||
|
<% if !@hpsfile.file.url.nil? %>
|
||||||
|
<br />
|
||||||
|
<a href="<%= @hpsfile.file.url %>" target="_blank"><%= File.basename(@hpsfile.file.url) %></a>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>計畫書名稱</th>
|
||||||
|
<td>
|
||||||
|
<% if @hpsfile.new_record? %>
|
||||||
|
<% case current_counselor_user.user_type %>
|
||||||
|
<% when 0 %>
|
||||||
|
|
||||||
|
<div id="year-span">中正區 國立臺北商業技術學院 <span>105</span>推動計劃書</div>
|
||||||
|
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="中正區 國立臺北商業技術學院 105推動計劃書">
|
||||||
|
<% when 1 %>
|
||||||
|
<div id="year-span"><span>105</span>健康促進縣市推動計劃書</div>
|
||||||
|
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="105健康促進縣市推動計劃書">
|
||||||
|
<% when 2 %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% year = @hpsfile.title.scan(/\d/).join() %>
|
||||||
|
<div id="year-span"><%= @hpsfile.title.gsub(year, "<span>#{year}</span>").html_safe %></div>
|
||||||
|
<input type="hidden" id="hps_file_title" name="hps_file[title]" value="<%= @hpsfile.title %>">
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
<td><%= f.submit "Submit", :class => "btn btn-primary" %><a href="<%= member_dash_path(current_counselor_user.account) %>" class="btn btn-default">Back</a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#hps_file_year").on("change",function(){
|
||||||
|
var val = $(this).val();
|
||||||
|
$("#year-span span").text(val);
|
||||||
|
$("#hps_file_title").val($("#year-span").text());
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @hpsfile, :url => "/cuser/member/#{@hpsfile.id.to_s}/update_file_upload" do |f| %>
|
||||||
|
<%= render :partial => "form", :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for @hpsfile, :url => "/cuser/member/file_upload" do |f| %>
|
||||||
|
<%= render :partial => "form", :locals => {:f => f} %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<%#= csrf_meta_tag %>
|
||||||
|
<% if params[:error] == "invld" %>
|
||||||
|
<div>Invalid username or password.</div>
|
||||||
|
<% end %>
|
||||||
|
<% if params[:error] == "dsbld" %>
|
||||||
|
<div>Your account is disabled.</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<form action="/cuser/member_counselor/login" method="post">
|
||||||
|
<div>
|
||||||
|
<label for="username">Account</label>
|
||||||
|
<input type="text" name="username" id="username" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="password">Password</label>
|
||||||
|
<input type="password" name="password" id="password" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
|
||||||
|
<input type="submit" value="Submit" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<a href="<%= member_logout_path %>">Logout</a>
|
||||||
|
<% case current_counselor_user.user_type %>
|
||||||
|
<% when 0,1 %>
|
||||||
|
<%= render :partial => "body" %>
|
||||||
|
<% when 2 %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/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/member_counselor/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'
|
|
@ -0,0 +1,28 @@
|
||||||
|
en:
|
||||||
|
member_counselor:
|
||||||
|
member_counselor: HPS Members
|
||||||
|
new_user: Create User
|
||||||
|
all_members: All Members
|
||||||
|
account: User Account
|
||||||
|
password: Password
|
||||||
|
confirm_password: Confirm Password
|
||||||
|
affilated_committee: Affilated Committee
|
||||||
|
name: Name
|
||||||
|
organization: Organization
|
||||||
|
title: Title
|
||||||
|
county: County
|
||||||
|
address: Address
|
||||||
|
email: Email
|
||||||
|
telephone: Telphone
|
||||||
|
mobile: Mobile
|
||||||
|
school: School
|
||||||
|
responsible_county: Responsible County
|
||||||
|
enabled: User enabled
|
||||||
|
type1: School
|
||||||
|
type2: Government
|
||||||
|
type3: Counselor
|
||||||
|
user_type: User Type
|
||||||
|
city: City
|
||||||
|
year: Year
|
||||||
|
file_date: Date
|
||||||
|
downloaded_times: Download Count
|
|
@ -0,0 +1,32 @@
|
||||||
|
zh_tw:
|
||||||
|
member_counselor:
|
||||||
|
member_counselor: HPS Members
|
||||||
|
new_user: Create User
|
||||||
|
all_members: All Members
|
||||||
|
account: 帳號
|
||||||
|
password: 密碼
|
||||||
|
confirm_password: 確認密碼
|
||||||
|
affilated_committee: 所屬委員
|
||||||
|
name: 姓名
|
||||||
|
organization: 服務機關
|
||||||
|
title: 職稱
|
||||||
|
county: 縣市
|
||||||
|
address: 地址
|
||||||
|
email: 電子信箱
|
||||||
|
telephone: 聯絡電話
|
||||||
|
mobile: 手機
|
||||||
|
responsible_county: 輔導縣市
|
||||||
|
enabled: 狀態
|
||||||
|
type1: 學校單位
|
||||||
|
type2: 縣市政府
|
||||||
|
type3: 輔導委員
|
||||||
|
user_type: User Type
|
||||||
|
school: 學校
|
||||||
|
city: 縣市
|
||||||
|
year: 年度
|
||||||
|
file_date: Date
|
||||||
|
downloaded_times: Download Count
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
||||||
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
|
namespace :admin do
|
||||||
|
resources :member_counselors do
|
||||||
|
collection do
|
||||||
|
get "uploads"
|
||||||
|
get "get_info"
|
||||||
|
end
|
||||||
|
member do
|
||||||
|
delete "destroy_upload"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
scope "cuser" do
|
||||||
|
get "/member_login", to: "member_counselors#index", as: "member_login"
|
||||||
|
get "/member/fileupload", to: "member_counselors#fileupload", as: "upload_cuser_file"
|
||||||
|
get "/member/:id/editfileupload", to: "member_counselors#editfileupload", as: "edit_upload_cuser_file"
|
||||||
|
delete "/member/:id/deletefileupload", to: "member_counselors#deletefileupload", as: "delete_upload_cuser_file"
|
||||||
|
post "/member/file_upload", to: "member_counselors#file_upload"
|
||||||
|
patch "/member/:id/update_file_upload", to: "member_counselors#update_file_upload"
|
||||||
|
get "/member/:account", to: "member_counselors#show", as: "member_dash"
|
||||||
|
post "/member_counselor/login", to: "member_counselors#loginuser"
|
||||||
|
get "/member_counselor/logout", to: "member_counselors#logoutuser", as: "member_logout"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
require "member_counselor/engine"
|
||||||
|
|
||||||
|
module MemberCounselor
|
||||||
|
end
|
|
@ -0,0 +1,51 @@
|
||||||
|
module MemberCounselor
|
||||||
|
class Engine < ::Rails::Engine
|
||||||
|
isolate_namespace MemberCounselor
|
||||||
|
end
|
||||||
|
end
|
||||||
|
module MemberCounselor
|
||||||
|
class Engine < ::Rails::Engine
|
||||||
|
initializer "member_counselor" do
|
||||||
|
OrbitApp.registration "MemberCounselor", :type => "ModuleApp" do
|
||||||
|
module_label "member_counselor.member_counselor"
|
||||||
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
|
taggable "CounselorFile"
|
||||||
|
frontend_enabled
|
||||||
|
data_count 1..30
|
||||||
|
set_keyword_contstraints ["/cuser/"]
|
||||||
|
side_bar do
|
||||||
|
head_label_i18n 'member_counselor.member_counselor', icon_class: "icons-upload"
|
||||||
|
available_for "admin"
|
||||||
|
active_for_controllers (['admin/member_counselors'])
|
||||||
|
head_link_path "uploads_admin_member_counselors_path"
|
||||||
|
|
||||||
|
context_link 'all',
|
||||||
|
:link_path=>"uploads_admin_member_counselors_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{'admin/member_counselors'=>"uploads"},
|
||||||
|
:available_for => 'admin'
|
||||||
|
|
||||||
|
context_link 'member_counselor.all_members',
|
||||||
|
:link_path=>"admin_member_counselors_path" ,
|
||||||
|
:priority=>1,
|
||||||
|
:active_for_action=>{'admin/member_counselors'=>"index"},
|
||||||
|
:available_for => 'admin'
|
||||||
|
|
||||||
|
context_link 'member_counselor.new_user',
|
||||||
|
:link_path=>"new_admin_member_counselor_path" ,
|
||||||
|
:priority=>2,
|
||||||
|
:active_for_action=>{'admin/member_counselors'=>"new"},
|
||||||
|
:available_for => 'admin'
|
||||||
|
|
||||||
|
context_link 'tags',
|
||||||
|
:link_path=>"admin_module_app_tags_path" ,
|
||||||
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'member_counselor').id}",
|
||||||
|
:priority=>5,
|
||||||
|
:active_for_action=>{'admin/member_counselors'=>'tags'},
|
||||||
|
:active_for_tag => 'member_counselors',
|
||||||
|
:available_for => 'admin'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module MemberCounselor
|
||||||
|
VERSION = "0.0.1"
|
||||||
|
end
|
|
@ -0,0 +1,52 @@
|
||||||
|
namespace :hps_task do
|
||||||
|
task :import => :environment do
|
||||||
|
file = File.join(Rails.root, "public", "hps", "cities.json")
|
||||||
|
data = File.read(file)
|
||||||
|
cities = JSON.parse(data)
|
||||||
|
cities.each do |city|
|
||||||
|
hpscity = HpsCity.where(:old_id => city["old_id"]).first rescue nil
|
||||||
|
if hpscity.nil?
|
||||||
|
hpscity = HpsCity.new
|
||||||
|
end
|
||||||
|
hpscity.old_id = city["old_id"]
|
||||||
|
hpscity.name = city["name"]
|
||||||
|
hpscity.save
|
||||||
|
end
|
||||||
|
file = File.join(Rails.root, "public", "hps", "counties.json")
|
||||||
|
data = File.read(file)
|
||||||
|
counties = JSON.parse(data)
|
||||||
|
counties.each do |county|
|
||||||
|
hpscounty = HpsCounty.where(:old_id => county["old_id"]).first rescue nil
|
||||||
|
if hpscounty.nil?
|
||||||
|
hpscounty = HpsCounty.new
|
||||||
|
end
|
||||||
|
hpscounty.old_id = county["old_id"]
|
||||||
|
hpscounty.name = county["name"]
|
||||||
|
hpscounty.zip_code = county["zip_code"]
|
||||||
|
city = HpsCity.where(:old_id => county["cityID"]).first
|
||||||
|
hpscounty.hps_city = city
|
||||||
|
hpscounty.save
|
||||||
|
end
|
||||||
|
file = File.join(Rails.root, "public", "hps", "schools.json")
|
||||||
|
data = File.read(file)
|
||||||
|
schools = JSON.parse(data)
|
||||||
|
schools.each do |school|
|
||||||
|
hpsschool = HpsSchool.where(:old_id => school["old_id"]).first rescue nil
|
||||||
|
if hpsschool.nil?
|
||||||
|
hpsschool = HpsSchool.new
|
||||||
|
end
|
||||||
|
hpsschool.old_id = school["old_id"]
|
||||||
|
hpsschool.name = school["name"]
|
||||||
|
hpsschool.address = school["address"]
|
||||||
|
hpsschool.telephone = school["telephone"]
|
||||||
|
hpsschool.land = school["land"]
|
||||||
|
hpsschool.url = school["url"]
|
||||||
|
hpsschool.type = school["type"]
|
||||||
|
city = HpsCity.where(:old_id => school["City"]).first
|
||||||
|
county = HpsCounty.where(:old_id => school["CityZip"]).first
|
||||||
|
hpsschool.hps_city = city
|
||||||
|
hpsschool.hps_county = county
|
||||||
|
hpsschool.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# desc "Explaining what the task does"
|
||||||
|
# task :member_counselor do
|
||||||
|
# # Task goes here
|
||||||
|
# end
|
|
@ -0,0 +1,20 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "member_counselor/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "member_counselor"
|
||||||
|
s.version = MemberCounselor::VERSION
|
||||||
|
s.authors = ["Harry Bomrah"]
|
||||||
|
s.email = ["harry@rulingcom.com"]
|
||||||
|
s.homepage = "http://www.rulingcom.com"
|
||||||
|
s.summary = "External User upload file module"
|
||||||
|
s.description = "External User upload file module"
|
||||||
|
s.license = "MIT"
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,28 @@
|
||||||
|
== README
|
||||||
|
|
||||||
|
This README would normally document whatever steps are necessary to get the
|
||||||
|
application up and running.
|
||||||
|
|
||||||
|
Things you may want to cover:
|
||||||
|
|
||||||
|
* Ruby version
|
||||||
|
|
||||||
|
* System dependencies
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
|
||||||
|
* Database creation
|
||||||
|
|
||||||
|
* Database initialization
|
||||||
|
|
||||||
|
* How to run the test suite
|
||||||
|
|
||||||
|
* Services (job queues, cache servers, search engines, etc.)
|
||||||
|
|
||||||
|
* Deployment instructions
|
||||||
|
|
||||||
|
* ...
|
||||||
|
|
||||||
|
|
||||||
|
Please feel free to use a different markup language if you do not plan to run
|
||||||
|
<tt>rake doc:app</tt>.
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
|
require File.expand_path('../config/application', __FILE__)
|
||||||
|
|
||||||
|
Rails.application.load_tasks
|
|
@ -0,0 +1,13 @@
|
||||||
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||||
|
// listed below.
|
||||||
|
//
|
||||||
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||||
|
// or any plugin's vendor/assets/javascripts directory 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/rails/sprockets#sprockets-directives) for details
|
||||||
|
// about supported directives.
|
||||||
|
//
|
||||||
|
//= require_tree .
|
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
|
* listed below.
|
||||||
|
*
|
||||||
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||||
|
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||||
|
*
|
||||||
|
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||||
|
* compiled file so the styles you add here take precedence over styles defined in any styles
|
||||||
|
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
||||||
|
* file per style scope.
|
||||||
|
*
|
||||||
|
*= require_tree .
|
||||||
|
*= require_self
|
||||||
|
*/
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
# Prevent CSRF attacks by raising an exception.
|
||||||
|
# For APIs, you may want to use :null_session instead.
|
||||||
|
protect_from_forgery with: :exception
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dummy</title>
|
||||||
|
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
||||||
|
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
|
load Gem.bin_path('bundler', 'bundle')
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rails/commands'
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rake'
|
||||||
|
Rake.application.run
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require 'pathname'
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||||
|
|
||||||
|
Dir.chdir APP_ROOT do
|
||||||
|
# This script is a starting point to setup your application.
|
||||||
|
# Add necessary setup steps to this file:
|
||||||
|
|
||||||
|
puts "== Installing dependencies =="
|
||||||
|
system "gem install bundler --conservative"
|
||||||
|
system "bundle check || bundle install"
|
||||||
|
|
||||||
|
# puts "\n== Copying sample files =="
|
||||||
|
# unless File.exist?("config/database.yml")
|
||||||
|
# system "cp config/database.yml.sample config/database.yml"
|
||||||
|
# end
|
||||||
|
|
||||||
|
puts "\n== Preparing database =="
|
||||||
|
system "bin/rake db:setup"
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system "rm -f log/*"
|
||||||
|
system "rm -rf tmp/cache"
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system "touch tmp/restart.txt"
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
run Rails.application
|
|
@ -0,0 +1,26 @@
|
||||||
|
require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
|
require 'rails/all'
|
||||||
|
|
||||||
|
Bundler.require(*Rails.groups)
|
||||||
|
require "member_counselor"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
||||||
|
config.active_record.raise_in_transactional_callbacks = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Set up gems listed in the Gemfile.
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
||||||
|
|
||||||
|
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
||||||
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@ -0,0 +1,25 @@
|
||||||
|
# SQLite version 3.x
|
||||||
|
# gem install sqlite3
|
||||||
|
#
|
||||||
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||||
|
# gem 'sqlite3'
|
||||||
|
#
|
||||||
|
default: &default
|
||||||
|
adapter: sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
||||||
|
|
||||||
|
development:
|
||||||
|
<<: *default
|
||||||
|
database: db/development.sqlite3
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test:
|
||||||
|
<<: *default
|
||||||
|
database: db/test.sqlite3
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *default
|
||||||
|
database: db/production.sqlite3
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Load the Rails application.
|
||||||
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
|
# Initialize the Rails application.
|
||||||
|
Rails.application.initialize!
|
|
@ -0,0 +1,41 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||||
|
# yet still be able to expire them through the digest params.
|
||||||
|
config.assets.digest = true
|
||||||
|
|
||||||
|
# Adds additional error checking when serving assets at runtime.
|
||||||
|
# Checks for improperly declared sprockets dependencies.
|
||||||
|
# Raises helpful error messages.
|
||||||
|
config.assets.raise_runtime_errors = true
|
||||||
|
|
||||||
|
# Raises error for missing translations
|
||||||
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
end
|
|
@ -0,0 +1,79 @@
|
||||||
|
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 serving static files from the `/public` folder by default since
|
||||||
|
# Apache or NGINX already handles this.
|
||||||
|
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
||||||
|
# yet still be able to expire them through the digest params.
|
||||||
|
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
|
||||||
|
|
||||||
|
# Use the lowest log level to ensure availability of diagnostic information
|
||||||
|
# when problems arise.
|
||||||
|
config.log_level = :debug
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
|
# Do not dump schema after migrations.
|
||||||
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
end
|
|
@ -0,0 +1,42 @@
|
||||||
|
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 file server for tests with Cache-Control for performance.
|
||||||
|
config.serve_static_files = 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
|
||||||
|
|
||||||
|
# Randomize the order test cases are executed.
|
||||||
|
config.active_support.test_order = :random
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr.
|
||||||
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
# Raises error for missing translations
|
||||||
|
# config.action_view.raise_on_missing_translations = true
|
||||||
|
end
|
|
@ -0,0 +1,11 @@
|
||||||
|
# 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'
|
||||||
|
|
||||||
|
# Add additional assets to the asset load path
|
||||||
|
# Rails.application.config.assets.paths << Emoji.images_path
|
||||||
|
|
||||||
|
# Precompile additional assets.
|
||||||
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
|
# Rails.application.config.assets.precompile += %w( search.js )
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||||
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||||
|
|
||||||
|
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||||
|
# Rails.backtrace_cleaner.remove_silencers!
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
Rails.application.config.filter_parameters += [:password]
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new inflection rules using the following format. Inflections
|
||||||
|
# are locale specific, and you may define rules for as many different
|
||||||
|
# locales as you wish. All of these examples are active by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
|
# inflect.irregular 'person', 'people'
|
||||||
|
# inflect.uncountable %w( fish sheep )
|
||||||
|
# end
|
||||||
|
|
||||||
|
# These inflection rules are supported but not enabled by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.acronym 'RESTful'
|
||||||
|
# end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new mime types for use in respond_to blocks:
|
||||||
|
# Mime::Type.register "text/richtext", :rtf
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Rails.application.config.session_store :cookie_store, key: '_dummy_session'
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Preserve the timezone of the receiver when calling to `to_time`.
|
||||||
|
# Ruby 2.4 will change the behavior of `to_time` to preserve the timezone
|
||||||
|
# when converting to an instance of `Time` instead of the previous behavior
|
||||||
|
# of converting to the local system timezone.
|
||||||
|
#
|
||||||
|
# Rails 5.0 introduced this config option so that apps made with earlier
|
||||||
|
# versions of Rails are not affected when upgrading.
|
||||||
|
ActiveSupport.to_time_preserves_timezone = true
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# This file contains settings for ActionController::ParamsWrapper which
|
||||||
|
# is enabled by default.
|
||||||
|
|
||||||
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||||
|
end
|
||||||
|
|
||||||
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
|
# ActiveSupport.on_load(:active_record) do
|
||||||
|
# self.include_root_in_json = true
|
||||||
|
# end
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Files in the config/locales directory are used for internationalization
|
||||||
|
# and are automatically loaded by Rails. If you want to use locales other
|
||||||
|
# than English, add the necessary files in this directory.
|
||||||
|
#
|
||||||
|
# To use the locales, use `I18n.t`:
|
||||||
|
#
|
||||||
|
# I18n.t 'hello'
|
||||||
|
#
|
||||||
|
# In views, this is aliased to just `t`:
|
||||||
|
#
|
||||||
|
# <%= t('hello') %>
|
||||||
|
#
|
||||||
|
# To use a different locale, set it with `I18n.locale`:
|
||||||
|
#
|
||||||
|
# I18n.locale = :es
|
||||||
|
#
|
||||||
|
# This would use the information in config/locales/es.yml.
|
||||||
|
#
|
||||||
|
# To learn more, please read the Rails Internationalization guide
|
||||||
|
# available at http://guides.rubyonrails.org/i18n.html.
|
||||||
|
|
||||||
|
en:
|
||||||
|
hello: "Hello world"
|
|
@ -0,0 +1,4 @@
|
||||||
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
mount MemberCounselor::Engine => "/member_counselor"
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Your secret key is used for verifying the integrity of signed cookies.
|
||||||
|
# If you change this key, all old signed cookies will become invalid!
|
||||||
|
|
||||||
|
# Make sure the secret is at least 30 characters and all random,
|
||||||
|
# no regular words or you'll be exposed to dictionary attacks.
|
||||||
|
# You can use `rake secret` to generate a secure secret key.
|
||||||
|
|
||||||
|
# Make sure the secrets in this file are kept private
|
||||||
|
# if you're sharing your code publicly.
|
||||||
|
|
||||||
|
development:
|
||||||
|
secret_key_base: aa73ab4664880656f256c432eda7041096d69c9f05c97e810e2a9bd5eaf01bbd50f001a5f077c2a8762a337b349e0eef3cdb7f8ee02397f7f548f73f1673b1fe
|
||||||
|
|
||||||
|
test:
|
||||||
|
secret_key_base: 3e01cab9cdce1eb94d263a0df41f82ff2532919541c41e6eea32ae577fa15fae713d13f043bf842fc60344683eecaec882bf7f6c972f5430d364dfefefa23b17
|
||||||
|
|
||||||
|
# Do not keep production secrets in the repository,
|
||||||
|
# instead read values from the environment.
|
||||||
|
production:
|
||||||
|
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The page you were looking for doesn't exist (404)</title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 95%;
|
||||||
|
max-width: 33em;
|
||||||
|
margin: 4em auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > div {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 12% 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > p {
|
||||||
|
margin: 0 0 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/404.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<div>
|
||||||
|
<h1>The page you were looking for doesn't exist.</h1>
|
||||||
|
<p>You may have mistyped the address or the page may have moved.</p>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The change you wanted was rejected (422)</title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 95%;
|
||||||
|
max-width: 33em;
|
||||||
|
margin: 4em auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > div {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 12% 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > p {
|
||||||
|
margin: 0 0 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/422.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<div>
|
||||||
|
<h1>The change you wanted was rejected.</h1>
|
||||||
|
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,66 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>We're sorry, but something went wrong (500)</title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 95%;
|
||||||
|
max-width: 33em;
|
||||||
|
margin: 4em auto 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > div {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 12% 0;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog > p {
|
||||||
|
margin: 0 0 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/500.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<div>
|
||||||
|
<h1>We're sorry, but something went wrong.</h1>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,8 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class NavigationTest < ActionDispatch::IntegrationTest
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class MemberCounselorTest < ActiveSupport::TestCase
|
||||||
|
test "truth" do
|
||||||
|
assert_kind_of Module, MemberCounselor
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Configure Rails Environment
|
||||||
|
ENV["RAILS_ENV"] = "test"
|
||||||
|
|
||||||
|
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
||||||
|
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
||||||
|
ActiveRecord::Migrator.migrations_paths << File.expand_path('../../db/migrate', __FILE__)
|
||||||
|
require "rails/test_help"
|
||||||
|
|
||||||
|
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
||||||
|
# to be shown.
|
||||||
|
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
||||||
|
|
||||||
|
# Load support files
|
||||||
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
||||||
|
|
||||||
|
# Load fixtures from the engine
|
||||||
|
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
||||||
|
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
||||||
|
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
||||||
|
ActiveSupport::TestCase.fixtures :all
|
||||||
|
end
|
Loading…
Reference in New Issue