initial checkin of full application

This commit is contained in:
ioBridge
2011-03-27 16:56:15 -04:00
parent a36868bc86
commit 740a1b338c
127 changed files with 13777 additions and 0 deletions

View File

@ -0,0 +1,35 @@
<h2><%= t(:api_key_write) %></h2>
<%= button_to t(:api_key_write_new), channel_api_keys_path(@channel, :write => 1), :confirm => t(:confirm_new_api_key) %>
<br />
<%= @key %>
<br /><br />
<h2><%= t(:api_key_read) %></h2>
<%= button_to t(:api_key_read_new), channel_api_keys_path(@channel, :write => 0), %>
<br />
<% @read_keys.each do |read_key| %>
<table>
<tr>
<td><%= t(:api_key_key) %>:</td>
<td><%= read_key.api_key %></td>
</tr>
<tr>
<td class="VAT"><%= t(:note) %>:</td>
<td>
<%= form_for read_key, :as => :api_key, :url => { :controller => 'api_keys', :action => 'update' }, :html => {:method => 'put'} do |f| %>
<%= f.text_area :note, :cols => 30, :rows => 4 %>
</td>
</tr>
<tr>
<td><%= f.hidden_field :api_key, :value => read_key.api_key %></td>
<td>
<div class="FL"><%= f.submit t(:note_save) %></div>
<% end %>
<%= button_to t(:api_key_delete), :controller => 'api_keys', :action => 'destroy', :api_key => read_key.api_key %></td>
</tr>
</table>
<br /><br />
<% end %>

View File

@ -0,0 +1,112 @@
<h2><%= t(:channel_edit) %></h2>
<%= form_for @channel, :html => {:method => 'put'} do |d| %>
<%= error_messages_for 'channel', :header_message => t(:try_again), :message => t(:channel_error) %>
<input name='userlogin' class='userlogin' />
<table>
<tr>
<td><%= t(:channel_name) %></td>
<td><%= d.text_field :name %></td>
</tr>
<tr>
<td><%= t(:channel_description) %></td>
<td><%= d.text_field :description %></td>
</tr>
<tr>
<td><%= t(:api_key) %></td>
<td><%= @key %></td>
</tr>
<tr>
<td><%= t(:latitude) %></td>
<td><%= d.text_field :latitude %></td>
</tr>
<tr>
<td><%= t(:longitude) %></td>
<td><%= d.text_field :longitude %></td>
</tr>
<tr>
<td><%= t(:elevation) %></td>
<td><%= d.text_field :elevation %></td>
</tr>
<tr>
<td><%= t(:public) %></td>
<td><%= d.check_box :public_flag %></td>
</tr>
<tr>
<td><%= t(:field) %> 1</td>
<td><%= d.text_field :field1, :class => 'field' %></td>
</tr>
<tr>
<td><%= t(:field) %> 2</td>
<td><%= d.text_field :field2, :class => 'field' %></td>
</tr>
<tr>
<td><%= t(:field) %> 3</td>
<td><%= d.text_field :field3, :class => 'field' %></td>
</tr>
<tr>
<td><%= t(:field) %> 4</td>
<td><%= d.text_field :field4, :class => 'field' %></td>
</tr>
<tr>
<td><%= t(:field) %> 5</td>
<td><%= d.text_field :field5, :class => 'field' %></td>
</tr>
<tr>
<td><%= t(:field) %> 6</td>
<td><%= d.text_field :field6, :class => 'field' %></td>
</tr>
<tr>
<td><%= t(:field) %> 7</td>
<td><%= d.text_field :field7, :class => 'field' %></td>
</tr>
<tr>
<td><%= t(:field) %> 8</td>
<td><%= d.text_field :field8, :class => 'field' %></td>
</tr>
<tr>
<td></td>
<td><%= d.submit t(:channel_update) %>
</tr>
</table>
<% end %>
<br /><br />
<h2><%= t(:channel_delete_message) %></h2>
<%= button_to t(:channel_delete), channel_path(@channel.id), :method => 'delete', :confirm => t(:confirm_channel_delete) %>
<script type="text/javascript">
// remember default field label
var default_label = '<%= t(:channel_default_field) %>';
// when document is ready
$(function() {
// iterate through each field textbox
$('.field').each(function() {
// if a value is present, show the 'remove' checkbox
if ($(this).val()) {
$(this).after('<span class="small" id="span_' + $(this).attr('id') + '"><input type="checkbox" onclick="removeField(\'' + $(this).attr('id') + '\')" /><span class="up2">remove field</span></span>');
// else disable
} else {
$(this).after('<span class="small" id="span_' + $(this).attr('id') + '"><input type="checkbox" onclick="addField(\'' + $(this).attr('id') + '\')" /><span class="up2">add field</span></span>');
}
});
});
// adds a field
function addField(id) {
$('#span_'+id).remove()
$('#'+id).val(default_label + ' ' + id.substring(id.length-1));
$('#'+id).after('<span class="small" id="span_' + id + '"><input type="checkbox" onclick="removeField(\'' + id + '\')" /><span class="up2">remove field</span></span>');
$('#'+id).select();
}
// removes a field
function removeField(id) {
$('#span_'+id).remove();
$('#'+id).val('');
$('#'+id).after('<span class="small" id="span_' + id + '"><input type="checkbox" onclick="addField(\'' + id + '\')" /><span class="up2">add field</span></span>');
}
</script>

View File

@ -0,0 +1,9 @@
<%= form_for :channel do |d| %>
<input name='userlogin' class='userlogin' />
<%= d.submit t(:channel_create) %>
<% end %>
<br />
<% @channels.each do |d| %>
name: <%= link_to d.name, channel_path(d.id) %>
<br />
<% end %>

View File

@ -0,0 +1,81 @@
<% if current_user %>
<%= link_to t(:channel_edit), edit_channel_path(@channel.id) %>
<br />
<%= link_to t(:api_keys_manage), channel_api_keys_path(@channel) %>
<br />
<%= link_to "#{t(:channel_feed)} (json)", channel_feed_index_path(@channel, :key => @key, :format => :json) %>
<br />
<%= link_to "#{t(:channel_feed)} (xml)", channel_feed_index_path(@channel, :key => @key, :format => :xml) %>
<br />
<%= link_to "#{t(:channel_feed)} (csv)", channel_feed_index_path(@channel, :key => @key, :format => :csv) %>
<table>
<tr>
<td><%= t(:channel_name) %>:</td>
<td><%= @channel.name %></td>
</tr>
<tr>
<td><%= t(:api_key) %>:</td>
<td><%= @key %></td>
</tr>
<tr>
<td><%= t(:channel_description) %>:</td>
<td><%= @channel.description %></td>
</tr>
<tr>
<td><%= t(:created) %>:</td>
<td><%= l @channel.created_at, :format => :pretty %></td>
</tr>
<tr>
<td><%= t(:latitude) %>:</td>
<td><%= @channel.latitude %></td>
</tr>
<tr>
<td><%= t(:longitude) %>:</td>
<td><%= @channel.longitude %></td>
</tr>
<tr>
<td><%= t(:elevation) %>:</td>
<td><%= @channel.elevation %></td>
</tr>
<tr>
<td><%= t(:field) %> 1:</td>
<td><%= @channel.field1 %></td>
</tr>
<tr>
<td><%= t(:field) %> 2:</td>
<td><%= @channel.field2 %></td>
</tr>
<tr>
<td><%= t(:field) %> 3:</td>
<td><%= @channel.field3 %></td>
</tr>
<tr>
<td><%= t(:field) %> 4:</td>
<td><%= @channel.field4 %></td>
</tr>
<tr>
<td><%= t(:field) %> 5:</td>
<td><%= @channel.field5 %></td>
</tr>
<tr>
<td><%= t(:field) %> 6:</td>
<td><%= @channel.field6 %></td>
</tr>
<tr>
<td><%= t(:field) %> 7:</td>
<td><%= @channel.field7 %></td>
</tr>
<tr>
<td><%= t(:field) %> 8:</td>
<td><%= @channel.field8 %></td>
</tr>
</table>
<% else %>
<% if @channel.public_flag %>
<%= t(:channel_public) %>
<br />
<%= @channel.name %>
<% else %>
<%= t(:channel_not_public) %>
<% end %>
<% end %>

View File

@ -0,0 +1,126 @@
<% options = '&timescale=10' if options.blank? %>
<div>
<h3><%= title %></h3>
<table class="FL MR60">
<tr>
<td><%= t(:title) %>:</td>
<td><input type="text" class="chart_options<%= index %>" id="title<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:chart_xaxis) %>:</td>
<td><input type="text" class="chart_options<%= index %>" id="xaxis<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:chart_yaxis) %>:</td>
<td><input type="text" class="chart_options<%= index %>" id="yaxis<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:chart_color) %>:</td>
<td><input type="text" class="chart_options<%= index %>" id="color<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:chart_background_color) %>:</td>
<td><input type="text" class="chart_options<%= index %>" id="bgcolor<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:chart_type) %>:</td>
<td>
<select class="chart_options<%= index %>" id="type<%= index %>">
<option>line</option>
<option>bar</option>
<option>column</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="button" id="button<%= index %>" value="<%= t(:chart_update) %>" /></td>
</tr>
</table>
<table>
<tr>
<td><%= t(:days) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="days<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:timescale) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="timescale<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:average) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="average<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:median) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="median<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:sum) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="sum<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:chart_round) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="round<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:width) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="width<%= index %>" /></td>
</tr>
<tr>
<td><%= t(:height) %>:</td>
<td><input type="text" class="chart_options<%= index %> shortfield" id="height<%= index %>" /></td>
</tr>
</table>
<br class="CL" />
<iframe id="iframe<%= index %>" width="<%= width %>" height="<%= height %>" style="border: 1px solid #cccccc;" src="" default_src="<%= src %>"></iframe>
<br /><br />
<%= t(:chart_embed_code) %>:
<br />
<textarea id="embed<%= index %>" rows="5" cols="53">&lt;iframe width="<%= width %>" height="<%= height %>" style="border: 1px solid #cccccc;" src="<%= src %>">&lt;/iframe></textarea>
</div>
<br /><br /><br />
<script type="text/javascript">
$(document).ready(function() {
// set initial saved values
$.each(('<%= options.gsub(/'/, "%27") if options %>'.split('&amp;')), function(index, value) {
if (value.length > 0) {
$('#' + value.split('=')[0] + '<%= index %>').val(decodeURIComponent(value.split('=')[1]));
}
});
// draw initial chart with saved options
updateChart(<%= index %>, false);
});
// event to capture unfocus of textbox
$('.chart_options<%= index %>').blur(function() {
// if value exists, update the chart
if ($(this).val().length > 0) {
updateChart(<%= index %>, true);
}
});
// event to capture enter key in textboxes
$('.chart_options<%= index %>').keyup(function(e) {
// if enter key
if (e.keyCode == 13) {
// if value exists, update the chart
if ($(this).val().length > 0) {
updateChart(<%= index %>, true);
}
}
});
// event to capture update button click
$('#button<%= index %>').click(function() {
updateChart(<%= index %>, true);
});
</script>

View File

@ -0,0 +1,103 @@
<%= javascript_include_tag 'rest' %>
<h2>
<%= link_to t(:channels), channels_path %> &raquo;
<%= link_to channel_path(@channel.id) do %> <%= t(:channel) %> <%= @channel.id %><% end %> &raquo;
<%= t(:charts) %>
</h2>
<%= render :partial => 'config',
:locals => {
:title => t(:chart_example),
:src => "https://api.thingspeak.com/channels/3/charts/1",
:options => '&timescale=60&round=2',
:index => 0,
:width => @width,
:height => @height
}
%>
<h3><%= t(:chart_owned) %></h3>
<% @channel.attribute_names.each do |attr| %>
<% if attr.index('field') and @channel[attr] and !@channel[attr].empty? %>
<%= render :partial => 'config',
:locals => {
:title => "#{@channel.name} - #{@channel[attr]}",
:src => "#{@domain}channels/#{@channel_id}/charts/#{attr[-1]}",
:options => @channel["options#{attr[-1]}"],
:index => attr[-1],
:width => @width,
:height => @height
}
%>
<% end %>
<% end %>
<script type="text/javascript">
$(document).ready(function() {
// if chrome/safari error occurs, reload page
if ($('#title0').val() == '60' && $('#color0').val() == '10') {
window.location.reload();
}
});
// update the chart with all the textbox values
function updateChart(index, postUpdate) {
// default width and height
var width = <%= @width %>;
var height = <%= @height %>;
// get old src
var src = $('#iframe' + index).attr('default_src').split('?')[0];
// if not a line chart, a timeslice should be present or set timescale=30
if ($('#type' + index).val() != 'line') {
if ($('#timescale' + index).val().length == 0 && $('#average' + index).val().length == 0 && $('#median' + index).val().length == 0 && $('#sum' + index).val().length == 0) {
$('#timescale' + index).val(30);
}
}
// add inputs to array
var inputs = [];
$('.chart_options' + index).each(function() {
var v = $(this).val();
var id = $(this).attr('id');
if (v.length > 0) { inputs.push([id.substring(0, id.length-1), v]); }
});
// create querystring
var qs = '';
while (inputs.length > 0) {
var p = inputs.pop();
if (p[0] == 'width') { width = parseInt(p[1]); }
if (p[0] == 'height') { height = parseInt(p[1]); }
// don't add type=line to querystring, it's the default value
if (!(p[0] == 'type' && p[1] == 'line')) {
qs += '&' + p[0] + '=' + encodeURIComponent(p[1]);
}
}
// if querystring exists, add it to src
if (qs.length > 0) { src += '?' + qs.substring(1); }
// save chart options to database
if (postUpdate && index > 0) {
$.update(
'/channels/<%= @channel_id %>/charts/' + index,
{ options: qs }
);
}
// set embed code
$('#embed' + index).val('<iframe width="' + width + '" height="' + height + '" style="border: 1px solid #cccccc;" src="' + src + '"></iframe>');
// set new src
$('#iframe' + index).attr('src', src);
$('#iframe' + index).attr('width', width);
$('#iframe' + index).attr('height', height);
}
</script>

View File

@ -0,0 +1,117 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="https://api.thingspeak.com/javascripts/highcharts<%= '-android' if get_header_value('user_agent').upcase.index('ANDROID') %>.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// blank array for holding chart data
var chartData = [];
// variable for the date string
var d;
// variable for the data point
var p;
// variable for the local date in milliseconds
var localDate;
// users timezone offset
var myOffset = new Date().getTimezoneOffset();
// get the data with a webservice call
$.getJSON('<%= "#{@domain}channels/#{params[:channel_id]}/field/#{params[:id]}.json?callback=?&offset=0#{@qs}" %>', function(data) {
// if no access
if (data == '-1') {
$('#chart-container').append('<%= t(:chart_no_access) %>');
}
// iterate through each feed
$.each(data.feeds, function() {
p = this.field<%= params[:id] %>;
// if a numerical value exists add it
if (!isNaN(parseInt(p))) {
// get the date as a string
d = this.created_at;
// add the data using javascript's date object (year, month, day, hour, minute, second)
// months in javascript start at 0, so remember to subtract 1 when specifying the month
// offset in minutes is converted to milliseconds and subtracted so that chart's x-axis is correct
localDate = Date.UTC(d.substring(0,4), d.substring(5,7)-1, d.substring(8,10), d.substring(11,13), d.substring(14,16), d.substring(17,19)) - (myOffset * 60000);
chartData.push([localDate, parseFloat(p)]);
}
});
// specify the chart options
var chartOptions = {
chart: {
renderTo: 'chart-container',
defaultSeriesType: '<%= params[:type] ? "#{params[:type]}" : "line" %>',
backgroundColor: '<%= params[:bgcolor] || "#ffffff" %>'
},
title: {
text: ''
},
plotOptions: {
line: {
color: '<%= params[:color] || "#d62020" %>'
},
bar: {
color: '<%= params[:color] || "#d62020" %>'
},
column: {
color: '<%= params[:color] || "#d62020" %>'
},
series: {
marker: {
radius: 3
},
animation: false
}
},
tooltip: {
// reformat the tooltips so that local times are displayed
formatter: function() {
var d = new Date(this.x + (myOffset*60000));
return this.series.name + ':<b>' + this.y + '</b><br/>' + d.toDateString() + '<br/>' + d.toTimeString().replace(/\(.*\)/, "");
}
},
xAxis: {
type: 'datetime',
title: {
text: ''
}
},
yAxis: {
title: {
text: ''
}
},
legend: {
enabled: false
},
series: [{
name: data.channel.field<%= params[:id] %>
}]
};
// add the data to the chart
chartOptions.series[0].data = chartData;
// set chart labels here so that decoding occurs properly
chartOptions.title.text = <% if params[:title] %>decodeURIComponent('<%= u(params[:title]) %>')<% else %>data.channel.name<% end %>;
chartOptions.xAxis.title.text = <% if params[:xaxis] %>decodeURIComponent('<%= u(params[:xaxis]) %>')<% else %>'Date'<% end %>;
chartOptions.yAxis.title.text = <% if params[:yaxis] %>decodeURIComponent('<%= u(params[:yaxis]) %>')<% else %><%= "data.channel.field#{params[:id]}" %><% end %>;
// draw the chart
new Highcharts.Chart(chartOptions);
});
});
</script>
</head>
<body style='background-color: <%= params[:bgcolor] ? params[:bgcolor] : 'white' %>;'>
<div id="chart-container" style="width: <%= params[:width] ? params[:width].to_i - 25 : @width.to_i - 25 %>px; height: <%= params[:height] ? params[:height].to_i - 25 : @height.to_i - 25 %>px;"></div>
</body>
</html>

View File

@ -0,0 +1 @@
<%= "#{@callback}(" if @callback %><%= raw(@channel_output) %><% if @success %>,"feeds":<%= raw(@feed_output) %>}<% end %><%= ')' if @callback %>

View File

@ -0,0 +1,2 @@
<% if @success %><%= CSV.generate_line @csv_headers %><% @feed_output.each do |feed| %><% row = [] %><% @csv_headers.each do |attr| %><% row.push(feed.send(attr)) %><% end %><%= CSV.generate_line row %><% end %><% else %>-1<% end %>

View File

@ -0,0 +1 @@
<%= render :partial => 'index.json.erb' %>

View File

@ -0,0 +1 @@
<%= render :partial => 'feed/index.json.erb' %>

View File

@ -0,0 +1,2 @@
<%= raw(@channel_output) %><% if @success %>
<%= raw(@feed_output) %></channel><% end %>

View File

@ -0,0 +1,2 @@
<% if @success %><%= CSV.generate_line @csv_headers %><% row = [] %><% @csv_headers.each do |attr| %><% row.push(@feed.send(attr)) %><% end %><%= CSV.generate_line row %><% else %>-1<% end %>

View File

@ -0,0 +1,12 @@
<div id="options">
<% if current_user %>
<span class="action"> <%= link_to t(:signout), logout_path %></span>
<% else %>
<span class="action">
<%= link_to t(:signup), new_user_path %>
</span>
<span class="action"> <%= link_to t(:signin), login_path %></span>
<% end %>
</div>
<div id="logo"><%= link_to t(:application_name), root_path %></div>

View File

@ -0,0 +1,9 @@
<% if @menu_type != 'nomenu' %>
<div id="menu" class="round">
<div<%= " class='selected'" if @menu == 'home' %>><%= link_to t(:home), root_path %></div>
<% if current_user %>
<div<%= " class='selected'" if @menu == 'account' %>><%= link_to t(:myaccount), account_path %></div>
<div<%= " class='selected'" if @menu == 'channels' %>><%= link_to t(:channels), channels_path %></div>
<% end %>
</div>
<% end %>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title><%= @title.nil? ? (@menu.nil? ? t(:application_name) : @menu.capitalize + ' - ' + t(:application_name)) : @title + ' - ' + t(:application_name) %></title>
<%= stylesheet_link_tag :all %>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<%= csrf_meta_tag %>
</head>
<body>
<div id="wrapper">
<div id="header"><div class="fixedwidth"><%= render 'layouts/header' %></div></div>
<div id="menuwrap" class="fixedwidth"><%= render 'layouts/menu' %></div>
<div id="content" class="fixedwidth"><%= yield %></div>
</div>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
</head>
<body>
<p>
<%= t(:password_reset_message1) %>
<br />
<%= t(:password_reset_message2) %>
<br />
<%= t(:password_reset_message3) %>
<br /><br />
<a href="<%= @webpage %>"><%= @webpage %></a>
</p>
</body>
</html>

View File

@ -0,0 +1,5 @@
<%= t(:password_reset_message1) %>
<%= t(:password_reset_message2) %>
<%= t(:password_reset_message3) %>
<a href="<%= @webpage %>"><%= @webpage %></a>

View File

@ -0,0 +1,7 @@
<% if current_user %>
<%= t(:homepage_logged_in) %>
<% else %>
<%= t(:homepage) %>
<% end %>

View File

@ -0,0 +1 @@
<%= t(:tos) %>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

View File

@ -0,0 +1,13 @@
<div class="FL"><%= render :partial => 'users/login' %></div>
<div class="DT PL30">
<% if @failed %>
<h2 class="rubyred"><%= t(:signin_failure) %></h2>
<%= t(:signin_try_again) %>
<% else %>
<div class="large">
<%= t(:signin_please) %>
</div>
<br />
<%= @mail_message %>
<% end %>
</div>

View File

@ -0,0 +1,38 @@
<%= form_for (@user_session = UserSession.new), :url => user_session_path, :html => { :id => 'loginform' } do |f| %>
<input name='userlogin' class='userlogin' />
<%= f.hidden_field :remember_me, :value => false %>
<table id="login" class="round">
<tr>
<td colspan="2" class="text_center">
<%= t(:secure_signin) %>
</td>
</tr>
<tr>
<td class="login_info"><%= t(:userid) %></td>
<td><%= f.text_field :login, :size => 15, :value => cookies['user_id'] %></td>
</tr>
<tr>
<td class="login_info"><%= t(:password) %></td>
<td><%= f.password_field :password, :size => 15 %></td>
</tr>
<tr>
<td class="login_info"><%= f.check_box :remember_id, :checked => true %></td>
<td class="small"><%= t(:remember_me) %></td>
</tr>
<tr>
<td></td>
<td><%= link_to t(:forgot), forgot_password_path, :id => 'forgot_password' %></td>
</tr>
<tr>
<td></td>
<td><%= f.submit t(:signin) %></td>
</tr>
</table>
<% end %>
<script type="text/javascript">
var login = document.getElementById('user_session_login');
if (login.value.length == 0)
login.focus();
else
document.getElementById('user_session_password').focus();
</script>

View File

@ -0,0 +1,61 @@
<h2><%= t(:account_edit) %></h2>
<br />
<%= form_for @user, :url => account_path do |f| %>
<%= error_messages_for 'user', :header_message => t(:try_again), :message => t(:account_error_edit) %>
<input name='userlogin' class='userlogin' />
<table class="bigtable">
<tr>
<td class="left">
<div class="vcenter"><%= f.label :login, t(:userid) %></div>
</td>
<td class="right">
<%= f.text_field :login %>
</td>
</tr>
<tr>
<td class="left">
<div class="vcenter"><%= f.label t(:email) %></div>
</td>
<td class="right">
<%= f.text_field :email %>
</td>
</tr>
<tr>
<td><%= t(:time_zone) %></td>
<td><%= time_zone_select 'user', 'time_zone', nil, :default => 'Eastern Time (US & Canada)' %></td>
</tr>
<tr>
<td class="left">
<div class="vcenter"><%= f.label :password, raw(t(:password_change_raw)) %></div>
</td>
<td class="right">
<%= f.password_field :password %>
</td>
<tr>
<td class="left">
<%= f.label :password_confirmation, raw(t(:password_confirmation_raw)) %>
</td>
<td class="right">
<%= f.password_field :password_confirmation %>
</td>
</tr>
</table>
<br /><br />
<h3><%= t(:account_changes) %></h3>
<table class="bigtable">
<tr>
<td class="left">
<%= raw(t(:password_current_raw)) %>
</td>
<td class="right">
<input name="password_current" type="password" />
<br />
<%= t(:account_security) %>
</td>
</tr>
<tr>
<td class="left"></td>
<td class="right"><%= f.submit t(:account_edit_submit) %></td>
</tr>
</table>
<% end %>

View File

@ -0,0 +1,11 @@
<h2><%= t(:password_forgot) %></h2>
<%= t(:password_forgot_message) %>
<br /><br />
<%= form_for @user, :url => { :controller => 'mailer', :action => 'resetpassword' } do |f| %>
<input name='userlogin' class='userlogin' />
<%= f.text_field :login %>
<%= f.submit t(:submit) %>
<% end %>
<script type="text/javascript">
document.getElementById('user_login').focus();
</script>

View File

@ -0,0 +1,65 @@
<h2><%= t(:signup_header) %></h2>
<br />
<%= form_for @user, :url => account_path do |f| %>
<%= error_messages_for 'user', :header_message => t(:try_again), :message => t(:account_error) %>
<input name='userlogin' class='userlogin' />
<table class="bigtable">
<tr>
<td class="left">
<div class="vcenter"><%= f.label :login, t(:userid) %></div>
</td>
<td class="right">
<%= f.text_field :login %>
</td>
</tr>
<tr>
<td class="left">
<div class="vcenter"><%= f.label t(:email) %></div>
</td>
<td class="right">
<%= f.text_field :email %>
</td>
</tr>
<tr>
<td><%= t(:time_zone) %></td>
<td><%= time_zone_select 'user', 'time_zone', nil, :default => 'Eastern Time (US & Canada)' %></td>
</tr>
<tr>
<td class="left">
<div class="vcenter"><%= f.label t(:password) %></div>
</td>
<td class="right">
<%= f.password_field :password %>
</td>
<tr>
<td class="left">
<%= f.label :password_confirmation, raw(t(:password_confirmation_raw)) %>
</td>
<td class="right">
<%= f.password_field :password_confirmation %>
</td>
</tr>
<tr>
<td class="left">
Invite Code
</td>
<td class="right">
<input name="invite" type="text" />
</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">
<%= t(:tos_agree) %> <%= link_to t(:tos), { :controller => 'pages', :action => 'terms' }, :target => '_blank' %>.
</td>
</tr>
<tr>
<td class="left"></td>
<td class="right"><%= f.submit t(:create_account) %></td>
</tr>
</table>
<% end %>
<script type="text/javascript">
document.getElementById('user_login').focus();
</script>

View File

@ -0,0 +1,34 @@
<% if @valid_link %>
<h2><%= t(:password_new) %></h2>
<%= form_for @user, :url => { :controller => 'users', :action => 'change_password', :id => @user.id } do |f| %>
<%= error_messages_for 'user', :header_message => t(:try_again), :message => t(:password_new_error) %>
<input name='userlogin' class='userlogin' />
<table class="bigtable">
<tr>
<td class="left">
<div class="vcenter"><%= f.label :password %></div>
</td>
<td class="right">
<%= f.password_field :password %>
<br />
<%= t(:password_new_choose) %>
</td>
<tr>
<td class="left">
<%= f.label :password_confirmation, raw(t(:password_confirmation_raw)) %>
</td>
<td class="right">
<%= f.password_field :password_confirmation %>
<br />
<%= t(:password_new_confirmation) %>
</td>
</tr>
<tr>
<td class="left"></td>
<td class="right"><%= f.submit t(:submit) %></td>
</tr>
</table>
<% end %>
<% else %>
<%= t(:password_link_expired) %>
<% end %>

View File

@ -0,0 +1,19 @@
<h2><%= t(:account_info) %></h2>
<table class="bigtable styletable">
<tr>
<td class="left"><%= t(:userid) %></td>
<td><%= @user.login %></td>
</tr>
<tr>
<td class="left"><%= t(:email) %></td>
<td><%= @user.email %></td>
</tr>
<tr>
<td class="left"><%= t(:time_zone) %></td>
<td><%= @user.time_zone %></td>
</tr>
</table>
<br /><br />
<div class="details">
<%= link_to t(:account_edit), edit_account_path %>
</div>