updates from Production

This commit is contained in:
Lee Lawlor 2014-09-12 14:20:18 -04:00
parent d67697acff
commit 1d7e9cd221
11 changed files with 78 additions and 15 deletions

View File

@ -37,6 +37,7 @@ gem 'tzinfo'
gem 'tzinfo-data'
gem 'turbolinks'
gem 'geokit-rails'
gem 'clockwork'
# to use debugger
# gem 'ruby-debug'

View File

@ -90,6 +90,9 @@ GEM
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
chronic (0.10.2)
clockwork (0.7.7)
activesupport
tzinfo
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
@ -356,6 +359,7 @@ DEPENDENCIES
autotest-rails
capistrano (~> 2.15.4)
chronic
clockwork
coffee-rails (~> 4.0)
daemons
dalli

View File

@ -40,6 +40,7 @@ class User < ActiveRecord::Base
has_many :reacts, :dependent => :destroy
has_many :scheduled_thinghttps, :dependent => :destroy
has_many :talkbacks, :dependent => :destroy
has_many :timecontrols, :dependent => :destroy
has_many :plugins, :dependent => :destroy
has_many :devices, :dependent => :destroy
has_many :api_keys, :dependent => :destroy
@ -56,6 +57,11 @@ class User < ActiveRecord::Base
cattr_reader :per_page
@@per_page = 50
# true if the user has used the maximum number of available timecontrols
def max_timecontrols?
self.timecontrols.roots.count >= Timecontrol::MAX_PER_USER
end
# allow login by login name also
def self.find_first_by_auth_conditions(warden_conditions)
conditions = warden_conditions.dup

View File

@ -47,10 +47,10 @@
<% if current_admin_user.present? %>
<div class="apps">
<%= link_to scheduled_thinghttps_path do %>
<%= link_to timecontrols_path do %>
<%= image_tag 'scheduled_thinghttp.png', :size => '104x104' %>
<br>
<%= t(:scheduled_thinghttp) %>
<%= t(:timecontrol) %>
<% end %>
</div>
<% end %>

View File

@ -97,6 +97,7 @@ en:
confirm_react_delete: "Are you sure you want to delete this React?"
confirm_talkback_delete: "Are you sure you want to delete this TalkBack?"
confirm_thinghttp_delete: "Are you sure you want to delete this ThingHTTP?"
confirm_timecontrol_delete: "Are you sure you want to delete this TimeControl?"
confirm_tweetcontrol_delete: "Are you sure you want to delete this TweetControl?"
confirm_twitter_delete: "Are you sure you want to unlink this Twitter account?"
contact_us: "Contact Us"
@ -146,11 +147,13 @@ en:
forgot: "Forgot your password?"
forum: "Forum"
for_more_information: "More Information"
frequency: 'frequency'
generate_thingtweet_arduino_code: "Generate ThingTweet Arduino Code"
get_started: "Get Started Now"
height: "Height"
home_motto: "Billions and Billions."
home_tagline: "The open data platform for the Internet of Things."
hour: 'hour'
import: "Import"
latitude: "Latitude"
longitude: "Longitude"
@ -159,10 +162,13 @@ en:
message: 'message'
message_field: "Message Field"
metadata: 'metadata'
minute: 'minute'
myaccount: "My Account"
name: 'name'
new: "New"
note: "Note"
note_save: "Save Note"
one_time: 'one time'
password: "Password"
password_change: "Change Password"
password_confirmation: "Password Confirmation"
@ -263,6 +269,7 @@ en:
react_option_run_every_time: "Run action each time condition is met"
react_create_button: "Create React"
react_save_button: "Create React"
recurring: 'recurring'
remember_me: "Remember my User ID"
results: "Results"
save: "Save"
@ -357,8 +364,19 @@ en:
thingtweet: "ThingTweet"
thingtweet_arduino_select_message: "Select Twitter account to use for this code"
thingtweet_back: "Back to ThingTweet"
time_zone: "Time Zone"
timecontrol: "TimeControl"
timecontrols: "TimeControls"
timecontrol_date: 'date'
timecontrol_days: 'days'
timecontrol_delete: "Delete TimeControl"
timecontrol_delete_message: "Want to delete this TimeControl?"
timecontrol_error: "There were some problems creating your TimeControl:"
timecontrol_max_message: "You have reached the maximum number of TimeControls available per user. Please delete an existing TimeControl before adding a new one."
timecontrol_new: "New TimeControl"
timecontrol_run_at: 'run at'
timecontrol_time: 'time'
timescale: "Timescale"
time_zone: "Time Zone"
title: "Title"
tos: "Terms of Service"
tos_agree: "By signing up, you agree to the"
@ -450,6 +468,7 @@ en:
help_thinghttp_example: "This will send your HTTP GET request to Google Finance and parse the response for an element having an ID of ref_626307_c, which corresponds to the S&P 500 current price change for the day."
help_thinghttp_show: "You can now send your ThingHTTP request and view the response using the following URL:"
help_thingtweet: "ThingTweet acts as a proxy to Twitter so that your devices can update Twitter statuses without having to implement Open Authentication (OAuth)."
help_timecontrol_index: "Create a TimeControl to automatically execute ThingHTTP requests at predetermined times."
help_tweetcontrol: "Use TweetControl to listen to specific trigger words from Twitter, and then process a ThingHTTP request."
help_tweetcontrol_edit: "Select Anonymous TweetControl to allow anyone to trigger your TweetControl or fill in a specfic Twitter Account (don't include the '@' sign)."
help_tweetcontrol_hashtag: "To trigger a TweetControl, you need to send a Twitter Status Update with at least the hashtag #thingspeak and the trigger word, for example:"

View File

@ -17,9 +17,9 @@ Thingspeak::Application.routes.draw do
# for api: login and get token
match 'users/api_login', :to => 'users#api_login', :via => [:get, :post]
# devise for authentication
# devise for authentication (but don't use devise if $skip_devise == true, necessary for clockworkd to run)
# override devise controllers and use custom sessions_controller and registrations_controller
devise_for :users, :controllers => {:sessions => 'sessions', :registrations => 'registrations'}
devise_for :users, :controllers => {:sessions => 'sessions', :registrations => 'registrations'} if $skip_devise != true
resource :pages do
collection do
@ -172,6 +172,7 @@ Thingspeak::Application.routes.draw do
end
resources :tweetcontrol
resources :reacts
resources :timecontrols
resources :scheduled_thinghttps
end

View File

@ -11,13 +11,13 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140804223739) do
ActiveRecord::Schema.define(version: 20140903095213) do
create_table "active_admin_comments", force: true do |t|
t.string "namespace"
t.text "body"
t.string "resource_id", limit: 50, null: false
t.string "resource_type", limit: 50, null: false
t.string "resource_id", null: false
t.string "resource_type", null: false
t.integer "author_id"
t.string "author_type"
t.datetime "created_at"
@ -166,6 +166,15 @@ ActiveRecord::Schema.define(version: 20140804223739) do
add_index "devices", ["mac_address"], name: "index_devices_on_mac_address", using: :btree
add_index "devices", ["user_id"], name: "index_devices_on_user_id", using: :btree
create_table "events", force: true do |t|
t.integer "timecontrol_id"
t.datetime "run_at"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "events", ["run_at"], name: "index_events_on_run_at", using: :btree
create_table "failedlogins", force: true do |t|
t.string "login"
t.string "password"
@ -329,6 +338,29 @@ ActiveRecord::Schema.define(version: 20140804223739) do
add_index "thinghttps", ["api_key"], name: "index_thinghttps_on_api_key", using: :btree
add_index "thinghttps", ["user_id"], name: "index_thinghttps_on_user_id", using: :btree
create_table "timecontrols", force: true do |t|
t.integer "user_id"
t.integer "schedulable_id"
t.string "schedulable_type", limit: 50
t.string "frequency", limit: 20
t.integer "day", limit: 1
t.integer "hour", limit: 1
t.integer "minute", limit: 1
t.integer "parent_id"
t.datetime "last_event_at"
t.text "last_response"
t.datetime "created_at"
t.datetime "updated_at"
t.string "name"
t.datetime "run_at"
end
add_index "timecontrols", ["frequency", "minute", "hour", "day"], name: "index_timecontrols_on_frequency_and_minute_and_hour_and_day", using: :btree
add_index "timecontrols", ["parent_id"], name: "index_timecontrols_on_parent_id", using: :btree
add_index "timecontrols", ["run_at"], name: "index_timecontrols_on_run_at", using: :btree
add_index "timecontrols", ["schedulable_id", "schedulable_type"], name: "index_timecontrols_on_schedulable_id_and_schedulable_type", using: :btree
add_index "timecontrols", ["user_id"], name: "index_timecontrols_on_user_id", using: :btree
create_table "tweetcontrols", force: true do |t|
t.string "screen_name"
t.string "trigger"

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long