More fixes for live data

This commit is contained in:
Falkvinge
2017-05-10 09:53:59 +02:00
parent 3fbd723bb1
commit c4b8756a69
8 changed files with 42 additions and 13 deletions
+1
View File
@@ -70,6 +70,7 @@ namespace Swarmops.Frontend.Socket
json ["MessageType"] = json["messageType"] = "AnnualProfitLossCents";
json["ProfitLossCents"] = FrontendLoop.GetOrganizationProfitLossCents(this._authority.Organization).ToString();
json["OrganizationId"] = this._authority.Organization.Identity;
json["Instant"] = 1; // instant update, no odometer rolling for init
this.Send(json.ToString());
}
+9
View File
@@ -537,6 +537,15 @@ namespace Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Annual Profit/Loss To Date ({0}).
/// </summary>
internal static string Financial_ProfitToDate {
get {
return ResourceManager.GetString("Financial_ProfitToDate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Receipt Image {0} of {1}.
/// </summary>
+4
View File
@@ -905,4 +905,8 @@
<data name="Swarm_TypePartialName" xml:space="preserve">
<value>Type a partial name...</value>
</data>
<data name="Financial_ProfitToDate" xml:space="preserve">
<value>Annual Profit/Loss To Date ({0})</value>
<comment>{0} is the currency code</comment>
</data>
</root>
+9 -11
View File
@@ -1,34 +1,32 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Frontend.Default" CodeFile="Default.aspx.cs" %>
<%@ Import Namespace="Swarmops.Logic.Support" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<% if (Swarmops.Logic.Support.PilotInstallationIds.IsPilot(PilotInstallationIds.DevelopmentSandbox))
{ %>
<div class="box" style="background-image: url(/Images/Other/member-background-istockphoto.jpg); background-size: 700px"><div class="content">
<div class="odometer-wrapper">
<div class="elementFloatFar odometer odometer-integer nocents" id="odoGlobalParticipation">12342500</div><div class="odometer-label">Current Participants (Testing new code)</div>
<div class="elementFloatFar odometer odometer-integer nocents" id="odoGlobalParticipation">12342500</div><div class="odometer-label">Current Participants</div>
</div>
<div class="odometer-wrapper">
<div class="elementFloatFar odometer odometer-integer nocents" id="odoActiveParticipation">125498</div><div class="odometer-label">Active Participants Last 30 Days (Testing new code)</div>
<div class="elementFloatFar odometer odometer-integer nocents" id="odoActiveParticipation">125498</div><div class="odometer-label">Active Participants Last 30 Days</div>
</div>
<hr/>
<div class="odometer-wrapper"><div class="elementFloatFar odometer odometer-integer nocents" id="odoLocalParticipation">498.001</div><div class="odometer-label">Current Participants Sollentuna</div>
<div class="odometer-wrapper"><div class="elementFloatFar odometer odometer-integer nocents" id="odoLocalParticipation">498.001</div><div class="odometer-label">Current Participants in Your City</div>
</div>
</div></div>
<div class="box" style="background-image: url(/Images/Other/coins-background-istockphoto.jpg); background-size: 700px">
<div class="content">
<div class="odometer-wrapper">
<div class="elementFloatFar odometer odometer-currency" id="odoProfitLossToDate">0.001</div><div class="odometer-label">Annual Profit To Date (Testing new code)</div>
</div>
</div>
</div>
<% } %>
<div class="box"><div class="content">
<h2><asp:Label ID="LabelHeaderLocal" runat="server" /></h2>
+10 -1
View File
@@ -72,7 +72,8 @@
window.odometerOptions = {
auto: false, // Don't automatically initialize everything with class 'odometer'
theme: 'car' // Specify the theme (if you have more than one theme css file on the page)
theme: 'car', // Specify the theme (if you have more than one theme css file on the page)
duration: 1500 // time to update
};
$(document).ready(function () {
@@ -223,6 +224,14 @@
<div class="mainbar">
<!--<div id="page-icon-encaps"><asp:Image ID="IconPage" runat="server" ImageUrl="~/Images/PageIcons/iconshock-steering-wheel-40px.png" /></div><h1><asp:Label ID="LabelPageTitle" Text="Dashboard" runat="server" /></h1>-->
<div class="box" style="background-image: url(/Images/Other/coins-background-istockphoto.jpg); background-size: 700px">
<div class="content">
<div class="odometer-wrapper">
<div class="elementFloatFar odometer odometer-currency" id="odoProfitLossToDate">0.001</div><div class="odometer-label"><asp:Label runat="server" ID="MasterLabelDashboardProfitLoss">Profit To Date XYZ</asp:Label></div>
</div>
</div>
</div>
<% if (!(this.Page as PageV5Base).IsDashboard)
{ %>
<div class="box">
+3
View File
@@ -259,6 +259,9 @@ namespace Swarmops.Frontend
this.MasterLabelBitIdRegisterHeader.Text = Resources.Global.Master_BitIdRegister_Header;
this.MasterLabelDashboardProfitLoss.Text = String.Format(Resources.Global.Financial_ProfitToDate,
CurrentOrganization.Currency.DisplayCode);
}
protected string _cacheVersionMark; // this is just a cache buster for style sheets on new versions
+2 -1
View File
@@ -596,7 +596,7 @@ namespace Swarmops.Frontend {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Base.ModalDialog ModalMasterEnableBitId;
/// <summary>
/// MasterLabelBitIdRegisterHeader control.
/// </summary>
@@ -605,5 +605,6 @@ namespace Swarmops.Frontend {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label MasterLabelBitIdRegisterHeader;
protected global::System.Web.UI.WebControls.Label MasterLabelDashboardProfitLoss;
}
}
+4
View File
@@ -108,7 +108,11 @@ function _masterInitializeSocket(authenticationTicket) {
else if (message.MessageType == "AnnualProfitLossCents") {
if (odoProfitLossToDate != undefined) // if there's a P&L odometer on the current page
{
if (message.Instant == 1) {
window.odometerOptions.duration = 1;
}
odoProfitLossToDate.innerHTML = (message.ProfitLossCents / 100.0) + 0.001; // update it; +0.001 needed for %.2f
window.odometerOptions = 1500;
}
}
else if (message.MessageType == "SandboxUpdate") {