From 8d73f2d80f33bb88e45875d2c08e3f7d3f44c555 Mon Sep 17 00:00:00 2001
From: Jessica McKellar
Date: Thu, 27 Jun 2013 16:18:03 -0400
Subject: [PATCH] Load fake tutorial messages on tutorial start.
(imported from commit aa58f134d86662f090db52f9fdfd815e69f42235)
---
zephyr/static/js/tutorial.js | 119 +++++++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
diff --git a/zephyr/static/js/tutorial.js b/zephyr/static/js/tutorial.js
index eae7e226d6..7f6e5bcdb4 100644
--- a/zephyr/static/js/tutorial.js
+++ b/zephyr/static/js/tutorial.js
@@ -3,6 +3,117 @@ var tutorial = (function () {
var exports = {};
var is_running = false;
+// We'll temporarily set stream colors for the streams we use in the demo
+// tutorial messages.
+var real_stream_info;
+var tutorial_stream_info = {"design": {"color": "#76ce90"},
+ "social": {"color": "#fae589"},
+ "devel": {"color": "#a6c7e5"}};
+
+// Each message object contains the minimal information necessary for it to be
+// processed by our system for adding messages to your feed.
+var fake_messages = [
+ {
+ id: 1,
+ content: "We're working on some new screenshots for our landing page, and I'll show you what I have shortly.
",
+ is_stream: true,
+ sender_full_name: "Waseem Daher",
+ avatar_url: "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a",
+ display_recipient: "design",
+ stream: "design",
+ subject: "screenshots",
+ timestr: "12:11",
+ type: "stream"
+ },
+ {
+ id: 2,
+ content: "Hey, if I work on Windows, can you two make one for Mac and Linux?
",
+ is_stream: false,
+ sender_full_name: "Waseem Daher",
+ avatar_url: "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a",
+ display_reply_to: "Jeff Arnold, Waseem Daher",
+ reply_to: true,
+ timestr: "12:12",
+ type: "private"
+ },
+ {
+ id: 3,
+ content: "Sure, no problem 
",
+ is_stream: false,
+ sender_full_name: "Jessica McKellar",
+ avatar_url: "https://secure.gravatar.com/avatar/c89814a8ed5814421b617cf2242ff01a",
+ display_reply_to: "Jeff Arnold, Waseem Daher",
+ reply_to: true,
+ timestr: "12:12",
+ type: "private"
+ },
+ {
+ id: 4,
+ content: "Ok, here's my latest version
for the Windows app -- thoughts? I'm particularly wondering whether people think the screenshot should be from Windows 7 or some other version.
",
+ is_stream: true,
+ sender_full_name: "Waseem Daher",
+ avatar_url: "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a",
+ display_recipient: "design",
+ stream: "design",
+ subject: "screenshots",
+ timestr: "12:15",
+ type: "stream"
+ },
+ {
+ id: 5,
+ content: "Looks good to me!
",
+ is_stream: true,
+ sender_full_name: "Jeff Arnold",
+ avatar_url: "https://secure.gravatar.com/avatar/0e0080b53f71bb975c311a123acd8a48",
+ display_recipient: "design",
+ stream: "design",
+ subject: "screenshots",
+ timestr: "12:15",
+ type: "stream"
+ },
+ {
+ id: 6,
+ content: "@all Any interest in lunch? I'd go for:
" +
+"" +
+"
(Hi-fi) " +
+"
(Four Burgers) " +
+"
(Thelonious) " +
+"
",
+ is_stream: true,
+ sender_full_name: "Tim Abbott",
+ avatar_url: "https://secure.gravatar.com/avatar/364a79a57718ede3fadf6dd3623d2e0a",
+ display_recipient: "social",
+ stream: "social",
+ subject: "lunch",
+ timestr: "12:20",
+ type: "stream"
+ },
+ {
+ id: 7,
+ content: "I'd go to Hi-fi
",
+ is_stream: true,
+ sender_full_name: "Luke Faraone",
+ avatar_url: "https://secure.gravatar.com/avatar/948fcdfa93dd8986106032f1bad7f2c8",
+ display_recipient: "social",
+ stream: "social",
+ subject: "lunch",
+ timestr: "12:20",
+ type: "stream"
+ },
+ {
+ id: 8,
+ content: "Reminder: engineering meeting in 1 hour.
",
+ is_stream: true,
+ sender_full_name: "Jessica McKellar",
+ avatar_url: "https://secure.gravatar.com/avatar/c89814a8ed5814421b617cf2242ff01a",
+ display_recipient: "devel",
+ stream: "devel",
+ subject: "meeting",
+ timestr: "12:34",
+ type: "stream"
+ }
+];
+
function set_tutorial_status(status, callback) {
return $.ajax({
type: 'POST',
@@ -17,6 +128,14 @@ exports.is_running = function() {
};
exports.start = function () {
+ // If you somehow have messages, temporarily remove them from the visible
+ // feed.
+ current_msg_list.clear();
+ // Set temporarly colors for the streams used in the tutorial.
+ real_stream_info = subs.stream_info();
+ subs.stream_info(tutorial_stream_info);
+ // Add the fake messages to the feed and get started.
+ current_msg_list.add_and_rerender(fake_messages);
is_running = true;
set_tutorial_status("started");
};