コード例 #1
0
def index():
    channels = g.user["channels"]

    initial_messages = {}
    initial_users = {}
    for channel in channels:
        initial_messages[channel] = get_recent_messages(channel)
        initial_users[channel] = get_channel_users(channel)

    last_selected_channel = g.user["last_selected_channel"]
    username = g.user["email"].split("@")[0]

    right_sidebar_closed = request.cookies.get("rightSidebar") == "closed"
    left_sidebar_closed = request.cookies.get("leftSidebar") == "closed"

    mustache_templates = []
    for template in [
            "message_container", "message_partial", "alert", "user_status",
            "channel_button"
    ]:
        template_id = template.replace("_", "-") + "-template"
        template_content = read_template(template + ".mustache")
        mustache_templates.append((template_id, template_content))

    coffee_files = [
        "util", "message_hub", "chat", "chat_controls", "channel_controls",
        "datetime", "sound", "alert", "user_statuses"
    ]

    stylus_files = ["style", "pygments", "tipsy_styles"]

    return render_template(
        "index.htmljinja",
        initial_messages=initial_messages,
        initial_users=initial_users,
        authed=g.authed,
        full_name=g.user["name"],
        username=username,
        email=g.user["email"],
        avatar_url=g.user["gravatar"],
        channels=channels,
        last_selected_channel=last_selected_channel,
        right_sidebar_closed=right_sidebar_closed,
        left_sidebar_closed=left_sidebar_closed,
        time_window=current_app.config["COLLAPSED_MESSAGE_TIME_WINDOW"],
        mustache_templates=mustache_templates,
        title=current_app.config["APP_NAME"],
        debug=current_app.config["DEBUG"],
        coffee_files=coffee_files,
        stylus_files=stylus_files,
        asset_url=asset_url,
    )
コード例 #2
0
ファイル: frontend.py プロジェクト: cespare/prat
def index():
  channels = g.user["channels"]

  initial_messages = {}
  initial_users = {}
  for channel in channels:
    initial_messages[channel] = get_recent_messages(channel)
    initial_users[channel] = get_channel_users(channel)

  last_selected_channel = g.user["last_selected_channel"]
  username = g.user["email"].split("@")[0]

  right_sidebar_closed = request.cookies.get("rightSidebar") == "closed"
  left_sidebar_closed = request.cookies.get("leftSidebar") == "closed"

  mustache_templates = []
  for template in ["message_container", "message_partial", "alert", "user_status", "channel_button"]:
    template_id = template.replace("_", "-") + "-template"
    template_content = read_template(template + ".mustache")
    mustache_templates.append((template_id, template_content))

  coffee_files = ["util", "message_hub", "chat", "chat_controls", "channel_controls", "datetime", "sound",
      "alert", "user_statuses"]

  stylus_files = ["style", "pygments", "tipsy_styles"]

  return render_template("index.htmljinja",
                         initial_messages=initial_messages,
                         initial_users=initial_users,
                         username=username,
                         email=g.user["email"],
                         channels=channels,
                         last_selected_channel=last_selected_channel,
                         right_sidebar_closed=right_sidebar_closed,
                         left_sidebar_closed=left_sidebar_closed,
                         time_window=current_app.config["COLLAPSED_MESSAGE_TIME_WINDOW"],
                         mustache_templates=mustache_templates,
                         title=current_app.config["APP_NAME"],
                         debug=current_app.config["DEBUG"],
                         keep_alive_interval=current_app.config["WEBSOCKET_KEEP_ALIVE_INTERVAL"],
                         coffee_files=coffee_files,
                         stylus_files=stylus_files,
                         asset_url=asset_url,
                         vendor_js_files=vendor_js_files,
                         compiled_js=current_app.config["COMPILED_JS"],
                         compiled_css=current_app.config["COMPILED_CSS"],
                         compiled_vendor_js=current_app.config["COMPILED_VENDOR_JS"],
                        )
コード例 #3
0
ファイル: api.py プロジェクト: ytamura/prat
def messages():
    messages = {
        channel: get_recent_messages(channel)
        for channel in g.user["channels"]
    }
    return json.dumps(messages)
コード例 #4
0
ファイル: api.py プロジェクト: ytamura/prat
def channel_messages(channel):
    return json.dumps(get_recent_messages(channel))
コード例 #5
0
ファイル: api.py プロジェクト: tobert/oochat
def messages(channel):
  return json.dumps(get_recent_messages(channel))
コード例 #6
0
ファイル: api.py プロジェクト: bkad/prat
def messages():
    messages = {channel: get_recent_messages(channel) for channel in g.user["channels"]}
    return json.dumps(messages)