update documentation

This commit is contained in:
Lee Lawlor
2014-02-28 13:57:58 -05:00
parent b8f2410d5f
commit 4b83bfc3cf
84 changed files with 2037 additions and 85 deletions

View File

@ -33,8 +33,15 @@ class ApplicationController < ActionController::Base
@ssl_api_domain ||= ssl_api_domain
@locale ||= get_locale
I18n.locale = @locale
# sets timezone for current user, all DateTime outputs will be automatically formatted
Time.zone = current_user.time_zone if current_user
# allows use of daily params
params[:timescale] = '1440' if params[:timescale] == 'daily'
params[:average] = '1440' if params[:average] == 'daily'
params[:median] = '1440' if params[:median] == 'daily'
params[:sum] = '1440' if params[:sum] == 'daily'
end
# get the locale, but don't fail if header value doesn't exist
@ -90,21 +97,12 @@ class ApplicationController < ActionController::Base
return output.join(', ')
end
def set_channels_menu
@menu = 'channels'
end
def set_apps_menu
@menu = 'apps'
end
def set_plugins_menu
@menu = 'plugins'
end
def set_devices_menu
@menu = 'devices'
end
# set menus
def set_support_menu; @menu = 'support'; end
def set_channels_menu; @menu = 'channels'; end
def set_apps_menu; @menu = 'apps'; end
def set_plugins_menu; @menu = 'plugins'; end
def set_devices_menu; @menu = 'devices'; end
def current_user_session
return @current_user_session if defined?(@current_user_session)

View File

@ -29,10 +29,19 @@ class ChannelsController < ApplicationController
# list public channels
def public
@domain = domain
# default blank response
@channels = Channel.where(:id => 0).paginate :page => params[:page]
# get channels by ids
if params[:channel_ids].present?
flash[:notice] = t(:selected_channels)
@channels = Channel.public_viewable.by_array(params[:channel_ids]).order('ranking desc, updated_at DESC').paginate :page => params[:page]
# get channels that match a user
elsif params[:username].present?
flash[:notice] = "#{t(:user).capitalize}: #{params[:username]}"
searched_user = User.find_by_login(params[:username])
@channels = searched_user.channels.public_viewable.active.order('ranking desc, updated_at DESC').paginate :page => params[:page] if searched_user.present?
# get channels that match a tag
elsif params[:tag].present?
flash[:notice] = "#{t(:tag).capitalize}: #{params[:tag]}"
@ -40,6 +49,7 @@ class ChannelsController < ApplicationController
# normal channel list
else
flash[:notice] = t(:featured_channels)
respond_with_error(:error_resource_not_found) and return if params[:page] == '0'
@channels = Channel.public_viewable.active.order('ranking desc, updated_at DESC').paginate :page => params[:page]
end
@ -311,8 +321,12 @@ class ChannelsController < ApplicationController
# if there is a talkback_key but no command
respond_with_blank and return if params[:talkback_key].present? && command.blank?
# normal route, respond with the entry id of the feed
render :text => status
# normal route, respond with the feed
respond_to do |format|
format.html { render :text => status }
format.json { render :json => feed.to_json }
format.xml { render :xml => feed.to_xml(Feed.public_options) }
end and return
end
# import view

View File

@ -1,6 +1,43 @@
class DocsController < ApplicationController
before_filter :set_support_menu
def index; ;end
def index; ; end
def errors; ; end
def tweetcontrol; ; end
def plugins; ; end
def importer; ; end
def charts; ; end
def users; ; end
def channels
# default values
@channel_api_key = 'XXXXXXXXXXXXXXXX'
# if user is signed in
if current_user && current_user.channels.any?
@channel_api_key = current_user.channels.order('updated_at desc').first.write_api_key
end
end
def thinghttp
# default values
@thinghttp_api_key = 'XXXXXXXXXXXXXXXX'
# if user is signed in
if current_user && current_user.thinghttps.any?
@thinghttp_api_key = current_user.thinghttps.order('updated_at desc').first.api_key
end
end
def thingtweet
# default values
@thingtweet_api_key = 'XXXXXXXXXXXXXXXX'
# if user is signed in
if current_user && current_user.twitter_accounts.any?
@thingtweet_api_key = current_user.twitter_accounts.order('updated_at desc').first.api_key
end
end
def talkback
# default values

View File

@ -194,13 +194,13 @@ class FeedController < ApplicationController
output = @feed.to_xml
elsif params[:format] == 'csv'
@csv_headers = Feed.select_options(@channel, params)
elsif (params[:format] == 'txt' or params[:format] == 'text')
elsif (params[:format] == 'txt' || params[:format] == 'text' || params[:format] == 'html')
output = add_prepend_append(@feed["field#{params[:field_id]}"])
else
output = @feed.to_json
end
# else set error code
# else set error code
else
if params[:format] == 'xml'
output = bad_feed_xml
@ -211,7 +211,7 @@ class FeedController < ApplicationController
# output data in proper format
respond_to do |format|
format.html { render :json => output }
format.html { render :text => output }
format.json { render :json => output, :callback => params[:callback] }
format.xml { render :xml => output }
format.csv