added activeadmin, javascript, css, list entry

This commit is contained in:
Tyrel Souza 2014-02-13 00:07:45 -05:00
parent 2e64e49264
commit 7df136799a
57 changed files with 1881 additions and 19 deletions

View File

@ -2,14 +2,20 @@ source "https://rubygems.org"
gem "rails", "3.2.12"
gem "sqlite3"
gem 'activeadmin'
gem "meta_search", '>= 1.1.0.pre'
group :assets do
gem "coffee-rails", "~> 3.2.1"
gem "gyoku", "~> 1.0"
gem "jquery-rails"
gem 'jquery-rails', "2.3.0"
gem "rails_config"
gem "sass-rails", "~> 3.2.3"
gem "savon", "~> 2.0"
gem "uglifier", ">= 1.0.3"
gem "gemsurance"
gem "select2-rails"
end

View File

@ -14,6 +14,18 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activeadmin (0.6.0)
arbre (>= 1.0.1)
bourbon (>= 1.0.0)
devise (>= 1.1.2)
fastercsv
formtastic (>= 2.0.0)
inherited_resources (>= 1.3.1)
jquery-rails (>= 1.0.0)
kaminari (>= 0.13.0)
meta_search (>= 0.9.2)
rails (>= 3.0.0)
sass (>= 3.1.0)
activemodel (3.2.12)
activesupport (= 3.2.12)
builder (~> 3.0.0)
@ -31,7 +43,14 @@ GEM
akami (1.2.0)
gyoku (>= 0.4.0)
nokogiri (>= 1.4.0)
arbre (1.0.1)
activesupport (>= 3.0.0)
arel (3.0.3)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
bourbon (3.1.8)
sass (>= 3.2.0)
thor
builder (3.0.4)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@ -40,34 +59,60 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.6.3)
devise (3.2.2)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
erubis (2.7.0)
execjs (2.0.2)
fastercsv (1.5.5)
formtastic (2.2.1)
actionpack (>= 3.0)
gemsurance (0.1.4)
bundler (~> 1.2)
git (~> 1.2)
git (1.2.6)
gyoku (1.1.1)
builder (>= 2.1.2)
has_scope (0.6.0.rc)
actionpack (>= 3.2, < 5)
activesupport (>= 3.2, < 5)
hike (1.2.3)
httpi (2.1.0)
rack
rubyntlm (~> 0.3.2)
i18n (0.6.9)
inherited_resources (1.4.1)
has_scope (~> 0.6.0.rc)
responders (~> 1.0.0.rc)
journey (1.0.4)
jquery-rails (3.0.4)
jquery-rails (2.3.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
kaminari (0.15.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_search (1.1.3)
actionpack (~> 3.1)
activerecord (~> 3.1)
activesupport (~> 3.1)
polyamorous (~> 0.5.0)
mime-types (1.25.1)
mini_portile (0.5.2)
multi_json (1.8.4)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
nori (2.3.0)
orm_adapter (0.5.0)
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
@ -96,6 +141,8 @@ GEM
rake (10.1.1)
rdoc (3.12.2)
json (~> 1.4)
responders (1.0.0)
railties (>= 3.2, < 5)
rubyntlm (0.3.4)
sass (3.2.13)
sass-rails (3.2.6)
@ -110,6 +157,8 @@ GEM
nokogiri (>= 1.4.0)
nori (~> 2.3.0)
wasabi (~> 3.2.2)
select2-rails (3.5.2)
thor (~> 0.14)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@ -117,6 +166,8 @@ GEM
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.8)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
@ -125,6 +176,8 @@ GEM
uglifier (2.4.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
warden (1.2.3)
rack (>= 1.0)
wasabi (3.2.3)
httpi (~> 2.0)
mime-types (< 2.0.0)
@ -134,13 +187,16 @@ PLATFORMS
ruby
DEPENDENCIES
activeadmin
coffee-rails (~> 3.2.1)
gemsurance
gyoku (~> 1.0)
jquery-rails
jquery-rails (= 2.3.0)
meta_search (>= 1.1.0.pre)
rails (= 3.2.12)
rails_config
sass-rails (~> 3.2.3)
savon (~> 2.0)
select2-rails
sqlite3
uglifier (>= 1.0.3)

2
TODO Normal file
View File

@ -0,0 +1,2 @@
TODO:
Get all localeze categories so I can add a "has_many:" in the ListEntry

20
app/admin/admin_user.rb Normal file
View File

@ -0,0 +1,20 @@
ActiveAdmin.register AdminUser do
index do
column :email
column :current_sign_in_at
column :last_sign_in_at
column :sign_in_count
default_actions
end
filter :email
form do |f|
f.inputs "Admin Details" do
f.input :email
f.input :password
f.input :password_confirmation
end
f.actions
end
end

33
app/admin/dashboard.rb Normal file
View File

@ -0,0 +1,33 @@
ActiveAdmin.register_page "Dashboard" do
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
content :title => proc{ I18n.t("active_admin.dashboard") } do
div :class => "blank_slate_container", :id => "dashboard_default_message" do
span :class => "blank_slate" do
span I18n.t("active_admin.dashboard_welcome.welcome")
small I18n.t("active_admin.dashboard_welcome.call_to_action")
end
end
# Here is an example of a simple dashboard with columns and panels.
#
# columns do
# column do
# panel "Recent Posts" do
# ul do
# Post.recent(5).map do |post|
# li link_to(post.title, admin_post_path(post))
# end
# end
# end
# end
# column do
# panel "Info" do
# para "Welcome to ActiveAdmin."
# end
# end
# end
end # content
end

View File

@ -0,0 +1,3 @@
ActiveAdmin.register ListEntry do
end

View File

@ -0,0 +1,3 @@
ActiveAdmin.register LocalezeCategory do
end

View File

@ -0,0 +1 @@
//= require active_admin/base

View File

@ -13,3 +13,4 @@
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require select2

View File

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

View File

@ -0,0 +1,29 @@
// SASS variable overrides must be declared before loading up Active Admin's styles.
//
// To view the variables that Active Admin provides, take a look at
// `app/assets/stylesheets/active_admin/mixins/_variables.css.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
// $sidebar-width: 242px;
// Active Admin's got SASS!
@import "active_admin/mixins";
@import "active_admin/base";
// Overriding any non-variable SASS must be done after the fact.
// For example, to change the default status-tag color:
//
// body.active_admin {
// .status_tag { background: #6090DB; }
// }
//
// Notice that Active Admin CSS rules are nested within a
// 'body.active_admin' selector to prevent conflicts with
// other pages in the app. It is best to wrap your changes in a
// namespace so they are properly recognized. You have options
// if you e.g. want different styles for different namespaces:
//
// .active_admin applies to any Active Admin namespace
// .admin_namespace applies to the admin namespace (eg: /admin)
// .other_namespace applies to a custom namespace named other (eg: /other)

View File

@ -10,4 +10,5 @@
*
*= require_self
*= require_tree .
*= require select2
*/

View File

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

View File

@ -0,0 +1,30 @@
class ListEntriesController < ApplicationController
layout "listpush"
def new
@listentry = ListEntry.new
end
def create
ListEntry.new(listentry_params)
end
private
def listentry_params
params.require(:user).permit(:Address,
:AltNumber,
:BusinessName,
:City,
:CreditCards,
:Department,
:Fax,
:HoursOfOperation,
:LogoImage,
:Phone,
:State,
:URL,
:UnstructuredTerms,
:Zip,
:eMail)
end
end

View File

@ -2,7 +2,6 @@ class LocalezeController < ApplicationController
def initialize
end
private
def authenticate
response = @client.call(:authenticate, message:

View File

@ -0,0 +1,54 @@
module ListEntryHelper
def hours_hash
{
'6:00 AM' => '0600',
'6:30 AM' => '0630',
'7:00 AM' => '0700',
'7:30 AM' => '0730',
'8:00 AM' => '0800',
'8:30 AM' => '0830',
'9:00 AM' => '0900',
'9:30 AM' => '0930',
'10:00 AM' => '1000',
'10:30 AM' => '1030',
'11:00 AM' => '1100',
'11:30 AM' => '1130',
'12:00 PM' => '1200',
'12:30 PM' => '1230',
'1:00 PM' => '1300',
'1:30 PM' => '1330',
'2:00 PM' => '1400',
'2:30 PM' => '1430',
'3:00 PM' => '1500',
'3:30 PM' => '1530',
'4:00 PM' => '1600',
'4:30 PM' => '1630',
'5:00 PM' => '1700',
'5:30 PM' => '1730',
'6:00 PM' => '1800',
'6:30 PM' => '1830',
'7:00 PM' => '1900',
'7:30 PM' => '1930',
'8:00 PM' => '2000',
'8:30 PM' => '2030',
'9:00 PM' => '2100',
'9:30 PM' => '2130',
'10:00 PM' => '2200',
'10:30 PM' => '2230',
'11:00 PM' => '2300',
'11:30 PM' => '2330',
'12:00 AM' => '0000',
'12:30 AM' => '0030',
'1:00 AM' => '0100',
'1:30 AM' => '0130',
'2:00 AM' => '0200',
'2:30 AM' => '0230',
'3:00 AM' => '0300',
'3:30 AM' => '0330',
'4:00 AM' => '0400',
'4:30 AM' => '0430',
'5:00 AM' => '0500',
'5:30 AM' => '0530',
}
end
end

10
app/models/admin_user.rb Normal file
View File

@ -0,0 +1,10 @@
class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
# attr_accessible :title, :body
end

View File

@ -1,3 +1,21 @@
class ListEntry < ActiveRecord::Base
attr_accessible :Address, :AltNumber, :BusinessName, :City, :CreditCards, :Department, :Fax, :HoursOfOperation, :LogoImage, :Phone, :State, :URL, :UnstructuredTerms, :Zip, :eMail
attr_accessible :form_hash,
:success,
:Address,
:AltNumber,
:BusinessName,
:City,
:CreditCards,
:Department,
:Fax,
:HoursOfOperation,
:LogoImage,
:Phone,
:State,
:URL,
:UnstructuredTerms,
:Zip,
:eMail
has_many: :localeze_category
end

View File

@ -1,9 +1,5 @@
require 'cgi'
# To run, this needs the following gems
# 'savon', '~> 2.0'
# 'rails_config'
# 'gyoku', '~> 1.0'#
#
class LocalezeClient
def initialize
@client = Savon.client(wsdl: Settings.localeze_wsdl, namespace: Settings.localeze_wsdl, pretty_print_xml: true)
@ -14,7 +10,7 @@ class LocalezeClient
value = record_to_xml(listing, true)
query = @client.call(:query, message: message(:add, value, :check))
result = get_deep_value(query)
check_success?(result['ErrorCode']) ? true : get_errors(result)
check_successful?(result['ErrorCode']) ? true : result['ErrorMessage']
end
# Create the supplied listing.
@ -22,7 +18,8 @@ class LocalezeClient
value = record_to_xml(listing, true)
query = @client.call(:query, message: message(:add, value, :create))
result = get_deep_value(query)
create_success?(result['ErrorCode']) ? true : get_errors(result) # TODO[1]
status = create_successful?(result)
handle_status(status)
end
# Cache the categories
@ -45,7 +42,7 @@ class LocalezeClient
if result.has_key?('ErrorMessage')
return result['ErrorMessage']
elsif result.has_key?('Validators')
return result['Validators']['Resolution'] # TODO[2]
return result['Validators']['Resolution']
end
end
@ -74,11 +71,34 @@ class LocalezeClient
Gyoku.xml(bmps, {:key_converter => :none})
end
# These two methods check that the error codes returned are Success codes.
def check_success? code
# Check that the error codes returned are Success codes.
def check_successful? code
Settings[:localeze_check_success].include? code
end
def create_success? code
Settings[:localeze_create_success].include? code
def create_successful? result
if Settings[:localeze_create_success].include? result['ErrorCode']
if result['ErrorMessage']
return {passes: false, message: result['ErrorMessage']}
elsif result['Validators'].is_a?(Array)
return [passes: true, message: result['Validators'].map{|v| v['Resolution']} * "\n"]
elsif result['Validators']
return [passes: true, message: result['Validators']['Resolution']]
end
else
return true
end
end
def handle_status(status)
if status.is_a?(Hash)
if status[:passes]
puts "Was submitted, but needs validation on site: #{status[:message]}"
else
puts "Was not submitted, Please fix: #{status[:message]}"
end
else
puts "Successful"
end
end
end

View File

@ -0,0 +1,3 @@
class LocalezeCategory < ActiveRecord::Base
attr_accessible :name
end

View File

@ -0,0 +1,12 @@
<h2>Resend confirmation instructions</h2>
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<div><%= f.submit "Resend confirmation instructions" %></div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -0,0 +1,5 @@
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %></p>

View File

@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

View File

@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %></p>

View File

@ -0,0 +1,16 @@
<h2>Change your password</h2>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<%= f.hidden_field :reset_password_token %>
<div><%= f.label :password, "New password" %><br />
<%= f.password_field :password, :autofocus => true %></div>
<div><%= f.label :password_confirmation, "Confirm new password" %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Change my password" %></div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -0,0 +1,12 @@
<h2>Forgot your password?</h2>
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<div><%= f.submit "Send me reset password instructions" %></div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -0,0 +1,29 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, :autocomplete => "off" %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password %></div>
<div><%= f.submit "Update" %></div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %></p>
<%= link_to "Back", :back %>

View File

@ -0,0 +1,18 @@
<h2>Sign up</h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.submit "Sign up" %></div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -0,0 +1,17 @@
<h2>Sign in</h2>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
<% if devise_mapping.rememberable? -%>
<div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
<% end -%>
<div><%= f.submit "Sign in" %></div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -0,0 +1,25 @@
<%- if controller_name != 'sessions' %>
<%= link_to "Sign in", new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>

View File

@ -0,0 +1,12 @@
<h2>Resend unlock instructions</h2>
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<div><%= f.submit "Resend unlock instructions" %></div>
<% end %>
<%= render "devise/shared/links" %>

View File

@ -0,0 +1 @@
hi

View File

@ -7,6 +7,8 @@
<%= csrf_meta_tags %>
</head>
<body>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Add a Listing</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/bootswatch/2.3.1/superhero/bootstrap.min.css" rel="stylesheet">
<%= stylesheet_link_tag "select2-bootstrap" %>
<%= stylesheet_link_tag "listings" %>
<%= javascript_include_tag "listings" %>
<%= javascript_include_tag "regex_validation" %>
<%= javascript_include_tag "jquery.maskedinput.min" %>
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<%= yield %>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
</body>
</html>

View File

@ -0,0 +1,120 @@
<div id="wrap">
<form id="form" class="form-horizontal" action="." method="POST">
<div class="container">
<div class="page-header">
<h1>Add A Listing</h1>
</div>
<h5 id="how">How does this work?</h5>
<ul class="nav nav-tabs menu">
<li class="active"><a href="#tab1" data-toggle="tab">General Information</a></li>
<li><a href="#tab2" data-toggle="tab">Business Hours</a></li>
</ul>
<div class="well how">
<p>This tool is intended to streamline the process of adding listings. Fill in the information below just once, and well send it along to Localeze.</p>
<p>After you submit a listing, all listing account management still needs to take place within Localeze. For example, if you need to modify, verify, or access a listing for any reason, you must log in to Localeze separately and manage listings from those locations.</p>
</div>
<div class="tab-content">
<%= form_for @listentry do |f| %>
<div class="tab-pane active" id="tab1">
<div class="well">
<%= f.label :Address %>
<%= f.text_field :Address %><br>
<%= f.label :AltNumber %>
<%= f.text_field :AltNumber %><br>
<%= f.label :BusinessName %>
<%= f.text_field :BusinessName %><br>
<%= f.label :City %>
<%= f.text_field :City %><br>
<%= f.label :CreditCards %>
<%= f.text_field :CreditCards %><br>
<%= f.label :Department %>
<%= f.text_field :Department %><br>
<%= f.label :Fax %>
<%= f.text_field :Fax %><br>
<%= f.label :LogoImage %>
<%= f.text_field :LogoImage %><br>
<%= f.label :Phone %>
<%= f.text_field :Phone %><br>
<%= f.label :State %>
<%= f.text_field :State %><br>
<%= f.label :URL %>
<%= f.text_field :URL %><br>
<%= f.label :UnstructuredTerms %>
<%= f.text_field :UnstructuredTerms %><br>
<%= f.label :Zip %>
<%= f.text_field :Zip %><br>
<%= f.label :eMail %>
<%= f.text_field :eMail %><br>
{{form.localeze_categories_tabdelimited}}
{{form.payment_types_commadelimited}}
</div>
</div>
<div class="tab-pane" id="tab2">
<div class="well">
<h6><a href='#' id='set_clear'>[Clear]</a></h6>
<%= select( "id_hours_sunday", "open", hours_hash) %>
<%= select( "id_hours_sunday", "close", hours_hash) %><br>
<%= select( "id_hours_monday", "open", hours_hash) %>
<%= select( "id_hours_monday", "close", hours_hash) %><br>
<%= select( "id_hours_tuesday", "open", hours_hash) %>
<%= select( "id_hours_tuesday", "close", hours_hash) %><br>
<%= select( "id_hours_wednesday", "open", hours_hash) %>
<%= select( "id_hours_wednesday", "close", hours_hash) %><br>
<%= select( "id_hours_thursday", "open", hours_hash) %>
<%= select( "id_hours_thursday", "close", hours_hash) %><br>
<%= select( "id_hours_friday", "open", hours_hash) %>
<%= select( "id_hours_friday", "close", hours_hash) %><br>
<%= select( "id_hours_satday", "open", hours_hash) %>
<%= select( "id_hours_satday", "close", hours_hash) %><br>
</div>
</div>
<% end %>
</div>
</div>
<div id="push"></div>
</div>
<div id="footer">
<div class="container">
<h4> When you're complete with all tabs... </h4>
<input type="submit" name="submit" value="Submit Listing" class="btn btn-primary">
</div>
</div>
</form>

View File

@ -15,6 +15,8 @@ Listpush::Application.configure do
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
@ -34,4 +36,6 @@ Listpush::Application.configure do
# Expands the lines which load the assets
config.assets.debug = true
end

View File

@ -0,0 +1,210 @@
ActiveAdmin.setup do |config|
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
#
config.site_title = "Listpush"
# Set the link url for the title. For example, to take
# users to your main site. Defaults to no link.
#
# config.site_title_link = "/"
# Set an optional image to be displayed for the header
# instead of a string (overrides :site_title)
#
# Note: Recommended image height is 21px to properly fit in the header
#
# config.site_title_image = "/images/logo.png"
# == Default Namespace
#
# Set the default namespace each administration resource
# will be added to.
#
# eg:
# config.default_namespace = :hello_world
#
# This will create resources in the HelloWorld module and
# will namespace routes to /hello_world/*
#
# To set no namespace by default, use:
# config.default_namespace = false
#
# Default:
# config.default_namespace = :admin
#
# You can customize the settings for each namespace by using
# a namespace block. For example, to change the site title
# within a namespace:
#
# config.namespace :admin do |admin|
# admin.site_title = "Custom Admin Title"
# end
#
# This will ONLY change the title for the admin section. Other
# namespaces will continue to use the main "site_title" configuration.
# == User Authentication
#
# Active Admin will automatically call an authentication
# method in a before filter of all controller actions to
# ensure that there is a currently logged in admin user.
#
# This setting changes the method which Active Admin calls
# within the controller.
config.authentication_method = :authenticate_admin_user!
# == Current User
#
# Active Admin will associate actions with the current
# user performing them.
#
# This setting changes the method which Active Admin calls
# to return the currently logged in user.
config.current_user_method = :current_admin_user
# == Logging Out
#
# Active Admin displays a logout link on each screen. These
# settings configure the location and method used for the link.
#
# This setting changes the path where the link points to. If it's
# a string, the strings is used as the path. If it's a Symbol, we
# will call the method to return the path.
#
# Default:
config.logout_link_path = :destroy_admin_user_session_path
# This setting changes the http method used when rendering the
# link. For example :get, :delete, :put, etc..
#
# Default:
# config.logout_link_method = :get
# == Root
#
# Set the action to call for the root path. You can set different
# roots for each namespace.
#
# Default:
# config.root_to = 'dashboard#index'
# == Admin Comments
#
# Admin comments allow you to add comments to any model for admin use.
# Admin comments are enabled by default.
#
# Default:
# config.allow_comments = true
#
# You can turn them on and off for any given namespace by using a
# namespace config block.
#
# Eg:
# config.namespace :without_comments do |without_comments|
# without_comments.allow_comments = false
# end
# == Batch Actions
#
# Enable and disable Batch Actions
#
config.batch_actions = true
# == Controller Filters
#
# You can add before, after and around filters to all of your
# Active Admin resources and pages from here.
#
# config.before_filter :do_something_awesome
# == Register Stylesheets & Javascripts
#
# We recommend using the built in Active Admin layout and loading
# up your own stylesheets / javascripts to customize the look
# and feel.
#
# To load a stylesheet:
# config.register_stylesheet 'my_stylesheet.css'
# You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
# config.register_stylesheet 'my_print_stylesheet.css', :media => :print
#
# To load a javascript file:
# config.register_javascript 'my_javascript.js'
# == CSV options
#
# Set the CSV builder separator (default is ",")
# config.csv_column_separator = ','
#
# Set the CSV builder options (default is {})
# config.csv_options = {}
# == Menu System
#
# You can add a navigation menu to be used in your application, or configure a provided menu
#
# To change the default utility navigation to show a link to your website & a logout btn
#
# config.namespace :admin do |admin|
# admin.build_menu :utility_navigation do |menu|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# admin.add_logout_button_to_menu menu
# end
# end
#
# If you wanted to add a static menu item to the default menu provided:
#
# config.namespace :admin do |admin|
# admin.build_menu :default do |menu|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# end
# end
# == Download Links
#
# You can disable download links on resource listing pages,
# or customize the formats shown per namespace/globally
#
# To disable/customize for the :admin namespace:
#
# config.namespace :admin do |admin|
#
# # Disable the links entirely
# admin.download_links = false
#
# # Only show XML & PDF options
# admin.download_links = [:xml, :pdf]
#
# end
# == Pagination
#
# Pagination is enabled by default for all resources.
# You can control the default per page count for all resources here.
#
# config.default_per_page = 30
# == Filters
#
# By default the index screen includes a “Filters” sidebar on the right
# hand side with a filter for each attribute of the registered model.
# You can enable or disable them for all resources here.
#
# config.filters = true
end

View File

@ -0,0 +1,254 @@
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
config.secret_key = '4c8af15c41868001c76bfd801e7c3c46b70e35c3caab31517ed4f7b6fd6d05ee9d75ffeeaf2593980b05b32cb17e3c13784fcce94c30f62a7bcef0bfc5af68d5'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [ :email ]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [ :email ]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [ :email ]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If http headers should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing :skip => :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments.
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
# config.pepper = '4dc6a755d41c2ac41708aa351a33bb44d247ee967f49f8c737193f8f4214511047b80423803659f20503d2983a5509fba8772893fee4519b08d06ca4993023a3'
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming his account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming his account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming his account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed new email is stored in
# unconfirmed email column, and copied to email column on successful confirmation.
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [ :email ]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# :secure => true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length. Default is 8..128.
config.password_length = 8..128
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
# config.email_regexp = /\A[^@]+@[^@]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# If true, expires auth token on session timeout.
# config.expire_auth_token_on_timeout = false
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [ :email ]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = false
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [ :email ]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 6.hours
# ==> Configuration for :encryptable
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
# REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using omniauth, Devise cannot automatically set Omniauth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end

View File

@ -0,0 +1,59 @@
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
en:
devise:
confirmations:
confirmed: "Your account was successfully confirmed."
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
failure:
already_authenticated: "You are already signed in."
inactive: "Your account is not activated yet."
invalid: "Invalid email or password."
locked: "Your account is locked."
last_attempt: "You have one more attempt before your account will be locked."
not_found_in_database: "Invalid email or password."
timeout: "Your session expired. Please sign in again to continue."
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your account before continuing."
mailer:
confirmation_instructions:
subject: "Confirmation instructions"
reset_password_instructions:
subject: "Reset password instructions"
unlock_instructions:
subject: "Unlock Instructions"
omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
passwords:
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
updated: "Your password was changed successfully. You are now signed in."
updated_not_active: "Your password was changed successfully."
registrations:
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
updated: "You updated your account successfully."
sessions:
signed_in: "Signed in successfully."
signed_out: "Signed out successfully."
unlocks:
send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
errors:
messages:
already_confirmed: "was already confirmed, please try signing in"
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
expired: "has expired, please request a new one"
not_found: "not found"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"

View File

@ -1,2 +1,8 @@
Listpush::Application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
resources :list_entries
root :to => "home#index"
end

View File

@ -0,0 +1,48 @@
class DeviseCreateAdminUsers < ActiveRecord::Migration
def migrate(direction)
super
# Create a default user
AdminUser.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up
end
def change
create_table(:admin_users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0, :null => false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end
add_index :admin_users, :email, :unique => true
add_index :admin_users, :reset_password_token, :unique => true
# add_index :admin_users, :confirmation_token, :unique => true
# add_index :admin_users, :unlock_token, :unique => true
end
end

View File

@ -0,0 +1,17 @@
class CreateAdminNotes < ActiveRecord::Migration
def self.up
create_table :admin_notes do |t|
t.string :resource_id, :null => false
t.string :resource_type, :null => false
t.references :admin_user, :polymorphic => true
t.text :body
t.timestamps
end
add_index :admin_notes, [:resource_type, :resource_id]
add_index :admin_notes, [:admin_user_type, :admin_user_id]
end
def self.down
drop_table :admin_notes
end
end

View File

@ -0,0 +1,26 @@
class MoveAdminNotesToComments < ActiveRecord::Migration
def self.up
remove_index :admin_notes, [:admin_user_type, :admin_user_id]
rename_table :admin_notes, :active_admin_comments
rename_column :active_admin_comments, :admin_user_type, :author_type
rename_column :active_admin_comments, :admin_user_id, :author_id
add_column :active_admin_comments, :namespace, :string
add_index :active_admin_comments, [:namespace]
add_index :active_admin_comments, [:author_type, :author_id]
# Update all the existing comments to the default namespace
say "Updating any existing comments to the #{ActiveAdmin.application.default_namespace} namespace."
comments_table_name = ActiveRecord::Migrator.proper_table_name("active_admin_comments")
execute "UPDATE #{comments_table_name} SET namespace='#{ActiveAdmin.application.default_namespace}'"
end
def self.down
remove_index :active_admin_comments, :column => [:author_type, :author_id]
remove_index :active_admin_comments, :column => [:namespace]
remove_column :active_admin_comments, :namespace
rename_column :active_admin_comments, :author_id, :admin_user_id
rename_column :active_admin_comments, :author_type, :admin_user_type
rename_table :active_admin_comments, :admin_notes
add_index :admin_notes, [:admin_user_type, :admin_user_id]
end
end

View File

@ -0,0 +1,9 @@
class CreateLocalezeCategories < ActiveRecord::Migration
def change
create_table :localeze_categories do |t|
t.string :name, :limit => 256
t.timestamps
end
end
end

View File

@ -11,7 +11,40 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140114064456) do
ActiveRecord::Schema.define(:version => 20140213043730) do
create_table "active_admin_comments", :force => true do |t|
t.string "resource_id", :null => false
t.string "resource_type", :null => false
t.integer "author_id"
t.string "author_type"
t.text "body"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "namespace"
end
add_index "active_admin_comments", ["author_type", "author_id"], :name => "index_active_admin_comments_on_author_type_and_author_id"
add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"
create_table "admin_users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0, :null => false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true
create_table "list_entries", :force => true do |t|
t.string "BusinessName", :limit => 100
@ -35,4 +68,10 @@ ActiveRecord::Schema.define(:version => 20140114064456) do
t.string "form_hash", :limit => 16
end
create_table "localeze_categories", :force => true do |t|
t.string "name", :limit => 256
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end

View File

@ -0,0 +1,7 @@
/*
Masked Input plugin for jQuery
Copyright (c) 2007-2013 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
Version: 1.3.1
*/
(function(e){function t(){var e=document.createElement("input"),t="onpaste";return e.setAttribute(t,""),"function"==typeof e[t]?"paste":"input"}var n,a=t()+".mask",r=navigator.userAgent,i=/iphone/i.test(r),o=/android/i.test(r);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,r){var c,l,s,u,f,h;return!t&&this.length>0?(c=e(this[0]),c.data(e.mask.dataName)()):(r=e.extend({placeholder:e.mask.placeholder,completed:null},r),l=e.mask.definitions,s=[],u=h=t.length,f=null,e.each(t.split(""),function(e,t){"?"==t?(h--,u=e):l[t]?(s.push(RegExp(l[t])),null===f&&(f=s.length-1)):s.push(null)}),this.trigger("unmask").each(function(){function c(e){for(;h>++e&&!s[e];);return e}function d(e){for(;--e>=0&&!s[e];);return e}function m(e,t){var n,a;if(!(0>e)){for(n=e,a=c(t);h>n;n++)if(s[n]){if(!(h>a&&s[n].test(R[a])))break;R[n]=R[a],R[a]=r.placeholder,a=c(a)}b(),x.caret(Math.max(f,e))}}function p(e){var t,n,a,i;for(t=e,n=r.placeholder;h>t;t++)if(s[t]){if(a=c(t),i=R[t],R[t]=n,!(h>a&&s[a].test(i)))break;n=i}}function g(e){var t,n,a,r=e.which;8===r||46===r||i&&127===r?(t=x.caret(),n=t.begin,a=t.end,0===a-n&&(n=46!==r?d(n):a=c(n-1),a=46===r?c(a):a),k(n,a),m(n,a-1),e.preventDefault()):27==r&&(x.val(S),x.caret(0,y()),e.preventDefault())}function v(t){var n,a,i,l=t.which,u=x.caret();t.ctrlKey||t.altKey||t.metaKey||32>l||l&&(0!==u.end-u.begin&&(k(u.begin,u.end),m(u.begin,u.end-1)),n=c(u.begin-1),h>n&&(a=String.fromCharCode(l),s[n].test(a)&&(p(n),R[n]=a,b(),i=c(n),o?setTimeout(e.proxy(e.fn.caret,x,i),0):x.caret(i),r.completed&&i>=h&&r.completed.call(x))),t.preventDefault())}function k(e,t){var n;for(n=e;t>n&&h>n;n++)s[n]&&(R[n]=r.placeholder)}function b(){x.val(R.join(""))}function y(e){var t,n,a=x.val(),i=-1;for(t=0,pos=0;h>t;t++)if(s[t]){for(R[t]=r.placeholder;pos++<a.length;)if(n=a.charAt(pos-1),s[t].test(n)){R[t]=n,i=t;break}if(pos>a.length)break}else R[t]===a.charAt(pos)&&t!==u&&(pos++,i=t);return e?b():u>i+1?(x.val(""),k(0,h)):(b(),x.val(x.val().substring(0,i+1))),u?t:f}var x=e(this),R=e.map(t.split(""),function(e){return"?"!=e?l[e]?r.placeholder:e:void 0}),S=x.val();x.data(e.mask.dataName,function(){return e.map(R,function(e,t){return s[t]&&e!=r.placeholder?e:null}).join("")}),x.attr("readonly")||x.one("unmask",function(){x.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){clearTimeout(n);var e;S=x.val(),e=y(),n=setTimeout(function(){b(),e==t.length?x.caret(0,e):x.caret(e)},10)}).bind("blur.mask",function(){y(),x.val()!=S&&x.change()}).bind("keydown.mask",g).bind("keypress.mask",v).bind(a,function(){setTimeout(function(){var e=y(!0);x.caret(e),r.completed&&e==x.val().length&&r.completed.call(x)},0)}),y()}))}})})(jQuery);

View File

@ -0,0 +1,110 @@
function limitText(limitField, limitNum) {
if (limitField.val().length > limitNum) {
limitField.val(limitField.val().substring(0, limitNum));
}
}
// var execption = /^[A-Za-z0-9!?\. -,'&():|"+@%]*(.*)/.exec(str)[1];
// var result = /^([A-Za-z0-9!?\. -,'&():|"+@%]*)(.*)/.exec(str);
$(function() {
// validations();
var elem = $("#chars");
$("#id_phone_number").mask("(999) 999-9999");
$("#id_alternate_phone").mask("(999) 999-9999");
$("#id_fax_number").mask("(999) 999-9999");
$("#set_all").click(all_days_same);
$("#set_MF").click(all_MF);
$("#set_clear").click(clear_times);
$.each(['sunday','monday','tuesday','wednesday','thursday','friday','saturday'], function(i, day) {
$("#id_hours_"+day+"_close").insertAfter("#id_hours_"+day+"_open");
});
$("#id_hours_sunday_close").after("&nbsp;&nbsp; <a href='#' id='set_all'>[Apply To All]</a>");
$("#id_hours_monday_close").after("&nbsp;&nbsp; <a href='#' id='set_MF'>[Set Monday-Friday]</a>");
$("#set_all").click(all_days_same);
$("#set_MF").click(all_MF);
$("#set_clear").click(clear_times);
$("#how").click(function(){$(".how").toggle();});
$("#id_localeze_categories").select2({ maximumSelectionSize: 3 });
$("#id_payment_types_commadelimited_0").click(clear_payment_types);
$("#id_payment_types_commadelimited_1").click(check_payment_types);
$("#id_payment_types_commadelimited_2").click(check_payment_types);
$("#id_payment_types_commadelimited_3").click(check_payment_types);
$("#id_payment_types_commadelimited_4").click(check_payment_types);
$("#id_payment_types_commadelimited_5").click(check_payment_types);
$("#id_payment_types_commadelimited_6").click(check_payment_types);
$("#id_payment_types_commadelimited_7").click(check_payment_types);
$("#id_payment_types_commadelimited_8").click(check_payment_types);
$("#id_payment_types_commadelimited_9").click(check_payment_types);
$("#id_open247").click(open247);
});
var open247 = function(){
if( $(this).is(":checked")){
$("select[id*=day_open]").prop('disabled', 'disabled');
$("select[id*=day_close]").prop('disabled', 'disabled');
$("#set_all").unbind("click");
$("#set_MF").unbind("click");
clear_times();
} else {
$("select[id*=day_open]").prop('disabled', '');
$("select[id*=day_close]").prop('disabled', '');
$("#set_all").click(all_days_same);
$("#set_MF").click(all_MF);
}
};
var clear_payment_types = function(){
var unchecked = true;
for (var i = 1; i <= 9; i++){
$("#id_payment_types_commadelimited_"+i).prop("checked","");
}
};
var check_payment_types = function(){
var unchecked = true;
for (var i = 1; i <= 9; i++){
if ($("#id_payment_types_commadelimited_"+i).is(":checked")){
$("#id_payment_types_commadelimited_0").prop("checked","");
unchecked = false;
}
}
if (unchecked){
$("#id_payment_types_commadelimited_0").prop("checked","checked");
}
};
var all_days_same = function(){
var open_time = $("#id_hours_sunday_open").val();
var close_time = $("#id_hours_sunday_close").val();
$("select[id*=day_open]").val(open_time);
$("select[id*=day_close]").val(close_time);
return false;
};
var all_MF = function(){
var open_time = $("#id_hours_monday_open").val();
var close_time = $("#id_hours_monday_close").val();
$("select[id*=day_open]:not(select[id*=sunday]):not(select[id*=saturday])").val(open_time);
$("select[id*=day_close]:not(select[id*=sunday]):not(select[id*=saturday])").val(close_time);
return false;
};
var clear_times = function(){
var open_time = "";
var close_time = "";
$("select[id*=day_open]").val(open_time);
$("select[id*=day_close]").val(close_time);
};

View File

@ -0,0 +1,80 @@
$ ->
elem = $("#chars")
$("#id_phone_number").mask "(999) 999-9999"
$("#id_alternate_phone").mask "(999) 999-9999"
$("#id_fax_number").mask "(999) 999-9999"
$("#set_all").click all_days_same
$("#set_MF").click all_MF
$("#set_clear").click clear_times
$.each [
"sunday"
"monday"
"tuesday"
"wednesday"
"thursday"
"friday"
"saturday"
], (i, day) ->
$("#id_hours_" + day + "_close").insertAfter "#id_hours_" + day + "_open"
$("#id_hours_sunday_close").after "&nbsp;&nbsp; <a href='#' id='set_all'>[Apply To All]</a>"
$("#id_hours_monday_close").after "&nbsp;&nbsp; <a href='#' id='set_MF'>[Set Monday-Friday]</a>"
$("#set_all").click all_days_same
$("#set_MF").click all_MF
$("#set_clear").click clear_times
$("#how").click ->
$(".how").toggle()
$("#id_localeze_categories").select2 maximumSelectionSize: 3
$("#id_payment_types_commadelimited_0").click clear_payment_types
$("#id_payment_types_commadelimited_1").click check_payment_types
$("#id_payment_types_commadelimited_2").click check_payment_types
$("#id_payment_types_commadelimited_3").click check_payment_types
$("#id_payment_types_commadelimited_4").click check_payment_types
$("#id_payment_types_commadelimited_5").click check_payment_types
$("#id_payment_types_commadelimited_6").click check_payment_types
$("#id_payment_types_commadelimited_7").click check_payment_types
$("#id_payment_types_commadelimited_8").click check_payment_types
$("#id_payment_types_commadelimited_9").click check_payment_types
$("#id_open247").click open247
clear_payment_types = ->
unchecked = true
i = 1
while i <= 9
$("#id_payment_types_commadelimited_" + i).prop "checked", ""
i++
check_payment_types = ->
unchecked = true
i = 1
while i <= 9
if $("#id_payment_types_commadelimited_" + i).is(":checked")
$("#id_payment_types_commadelimited_0").prop "checked", ""
unchecked = false
i++
$("#id_payment_types_commadelimited_0").prop "checked", "checked" if unchecked
all_days_same = ->
open_time = $("#id_hours_sunday_open").val()
close_time = $("#id_hours_sunday_close").val()
$("select[id*=day_open]").val open_time
$("select[id*=day_close]").val close_time
false
all_MF = ->
open_time = $("#id_hours_monday_open").val()
close_time = $("#id_hours_monday_close").val()
$("select[id*=day_open]:not(select[id*=sunday]):not(select[id*=saturday])").val open_time
$("select[id*=day_close]:not(select[id*=sunday]):not(select[id*=saturday])").val close_time
false
clear_times = ->
open_time = ""
close_time = ""
$("select[id*=day_open]").val open_time
$("select[id*=day_close]").val close_time

View File

@ -0,0 +1,136 @@
// var reg_business_name = /[^A-Za-z0-9!?. \-,'&():\|\"+@%]+/g;
// var reg_zip = /[^0-9]+/g;
// var reg_addr = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ .\-'`,#\/]+/g;
// var reg_city = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ .\-'`]+/g;
// var reg_name = /[^A-Za-z1-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ .\-'`,]+/g;
// var reg_desc = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ!?. \-,'\/&():|\"+@%$£]+/g;
// var reg_comma = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ!?. \-,\/&#']+/g;
// var reg_tollfree = /^(\+?1)?(8(00|55|66|77|88)[2-9]\d{6})/;
// var validate_via_regex = function(str, regex){
// var matches = str.match(regex);
// if (matches === null){
// return true;
// } else {
// return matches;
// }
// };
// var validations = function(){
// $("input.remove_title").attr("title", "");
// $("#form").validate({
// rules: {
// business_name: "reg_business_name",
// address_line_1: "reg_addr",
// address_line_2: "reg_addr",
// city: "reg_city",
// business_description: "reg_desc",
// primary_contact_name: "reg_name",
// postal_code: "reg_zip",
// business_email_address: "email",
// business_website: "url",
// social_media_link: "url",
// products_commadelimited: "reg_comma",
// keyword_specialties_commadelimited: "reg_comma",
// areas_served_commadelimited: "reg_comma",
// professional_associations_commadelimited: "reg_comma",
// services_commadelimited: "reg_comma",
// logo_url: "url",
// photo_url_1: "url",
// phone_number: "tollfree"
// }
// });
// $("#id_business_name").rules("add", {maxlength: 60 });
// $("#id_address_line_1").rules("add", {maxlength: 30 });
// $("#id_address_line_2").rules("add", {maxlength: 20 });
// $("#id_city").rules("add", {maxlength: 20 });
// $("#id_primary_contact_name").rules("add", {maxlength: 75 });
// $("#id_business_email_address").rules("add", {maxlength: 200 });
// $("#id_business_website").rules("add", {maxlength: 50 });
// $("#id_social_media_link").rules("add", {maxlength: 200 });
// $("#id_business_description").rules("add", {maxlength: 200 });
// $("#id_products_commadelimited").rules("add", {maxlength: 200 });
// $("#id_keyword_specialties_commadelimited").rules("add", {maxlength: 200 });
// $("#id_areas_served_commadelimited").rules("add", {maxlength: 100 });
// $("#id_professional_associations_commadelimited").rules("add", {maxlength: 200 });
// $("#id_services_commadelimited").rules("add", {maxlength: 200 });
// $("#id_logo_url").rules("add", {maxlength: 136 /* Strip off http:// */ });
// $("#id_photo_url_1").rules("add", {maxlength: 200 });
// $.validator.addMethod("reg_addr", function(value, element) {
// var results = validate_via_regex(value, reg_addr);
// if (results !== true){
// $(element).prop("title","Please provide a properly formatted Address. Invalid characters: " + results.join(""));
// return false;
// }
// return results;
// });
// $.validator.addMethod("tollfree", function(value, element) {
// var results = validate_via_regex(value.replace(/\D/g,''), reg_tollfree);
// console.log("go");
// if (results !== true){
// $(element).prop("title","Toll-free numbers aren't accepted as the primary phone number");
// return false;
// }
// return results;
// });
// $.validator.addMethod("reg_business_name", function(value, element) {
// var results = validate_via_regex(value, reg_business_name);
// if (results !== true){
// $(element).prop("title","Please provide a properly formatted Business Name. Invalid characters: " + results.join(""));
// return false;
// }
// return results;
// });
// $.validator.addMethod("reg_city", function(value, element) {
// var results = validate_via_regex(value, reg_city);
// if (results !== true){
// $(element).prop("title","Please provide a properly formatted City name. Invalid characters: " + results.join(""));
// return false;
// }
// return results;
// });
// $.validator.addMethod("reg_comma", function(value, element) {
// var results = validate_via_regex(value, reg_comma);
// if (results !== true){
// $(element).prop("title","Please provide a properly formatted entry. Invalid characters: " + results.join(""));
// return false;
// }
// return results;
// });
// $.validator.addMethod("reg_desc", function(value, element) {
// var results = validate_via_regex(value, reg_desc);
// if (results !== true){
// $(element).prop("title","Please provide a properly formatted Description. Invalid characters: " + results.join(""));
// return false;
// }
// return results;
// });
// $.validator.addMethod("reg_name", function(value, element) {
// var results = validate_via_regex(value, reg_name);
// if (results !== true){
// $(element).prop("title","Please provide a properly formatted Contact Name. Invalid characters: " + results.join(""));
// return false;
// }
// return results;
// });
// $.validator.addMethod("reg_zip", function(value, element) {
// var results = validate_via_regex(value, reg_zip);
// if (results !== true){
// $(element).prop("title","Please provide a properly formatted ZIP code. Invalid characters: " + results.join(""));
// return false;
// }
// return results;
// });
// };

View File

@ -0,0 +1,90 @@
html, body {
height: 100%;
}
.required label:before {
content: "* ";
color: #f00;
}
.control-group.required .controls label {
font-weight: normal;
}
.control-group.required .controls label:before {
content: none;
}
input[type="text"] {
width: 300px ! important;
height:1.8em;
}
.controls select {
width: 300px;
height:1.8em;
}
select[id*="hours"] {
width:100px;
}
label[for*="close"] {
display:none;
}
.help-block {
font-size: 11px;
}
.required label { font-weight: bold;}
.required > input { background-color: whiteSmoke; }
#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
/* Negative indent footer by it's height */
margin: 0 auto -90px;
}
#push, #footer {
height: 90px;
}
#footer {
/*padding-top: 20px;*/
background-color: #f5f5f5;
text-align:center;
}
#how { cursor: hand; cursor: pointer; float:right; }
#how:hover{
color:#fff;
}
.how {display:none;}
.page-header { margin-bottom:0px;}
.checkmark {
font-size:72pt;
color:#00dd00;
}
.xmark{
font-size:72pt;
color:dd0000;
}
.menu {
margin:0;
padding:0;
}
label.error {
padding-top:4px;
color: #c76e6d;
}
div.staging-container {
bottom:0px;
position: fixed;
width: 100%;
z-index: 52;
}
div.staging-container div {
background: rgba(0,124,204,0.95);
text-align: center;
font-weight: bold;
width: 100%;
margin: auto;
padding: 6px 0 5px 0;
}

11
test/fixtures/admin_users.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

7
test/fixtures/localeze_categories.yml vendored Normal file
View File

@ -0,0 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
name: MyString
two:
name: MyString

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,115 @@
/**
* Select2 Bootstrap CSS 1.0
* Compatible with select2 3.3.2 and bootstrap 2.3.1
* MIT License
*/
.select2-container {
vertical-align: middle;
}
.select2-container.input-mini {
width: 60px;
}
.select2-container.input-small {
width: 90px;
}
.select2-container.input-medium {
width: 150px;
}
.select2-container.input-large {
width: 210px;
}
.select2-container.input-xlarge {
width: 270px;
}
.select2-container.input-xxlarge {
width: 530px;
}
.select2-container.input-default {
width: 220px;
}
.select2-container[class*="span"] {
float: none;
margin-left: 0;
}
.select2-container .select2-choice,
.select2-container-multi .select2-choices {
height: 28px;
line-height: 29px;
border: 1px solid #cccccc;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background: none;
background-color: white;
filter: none;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.select2-container .select2-choice div, .select2-container .select2-choice .select2-arrow,
.select2-container.select2-container-disabled .select2-choice div,
.select2-container.select2-container-disabled .select2-choice .select2-arrow {
border-left: none;
background: none;
filter: none;
}
.control-group.error [class^="select2-choice"] {
border-color: #b94a48;
}
.select2-container-multi .select2-choices .select2-search-field {
height: 28px;
line-height: 27px;
}
.select2-drop.select2-drop-active,
.select2-container-active .select2-choice,
.select2-container-multi.select2-container-active .select2-choices {
border-color: rgba(82, 168, 236, 0.8);
border-color: #ccc\0;
outline: none;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
}
[class^="input-"] .select2-container {
font-size: 14px;
}
.input-prepend [class^="select2-choice"] {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.input-append [class^="select2-choice"] {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.select2-dropdown-open [class^="select2-choice"] {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.select2-dropdown-open.select2-drop-above [class^="select2-choice"] {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
[class^="input-"] .select2-offscreen {
position: absolute;
}
/**
* This stops the quick flash when a native selectbox is shown and
* then replaced by a select2 input when javascript kicks in. This can be
* removed if javascript is not present
*/
select.select2 {
height: 28px;
visibility: hidden;
}