Exemplo n.º 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,
    )
Exemplo n.º 2
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,
                         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"],
                        )
Exemplo n.º 3
0
Arquivo: api.py Projeto: ytamura/prat
def messages():
    messages = {
        channel: get_recent_messages(channel)
        for channel in g.user["channels"]
    }
    return json.dumps(messages)
Exemplo n.º 4
0
Arquivo: api.py Projeto: ytamura/prat
def channel_messages(channel):
    return json.dumps(get_recent_messages(channel))
Exemplo n.º 5
0
Arquivo: api.py Projeto: tobert/oochat
def messages(channel):
  return json.dumps(get_recent_messages(channel))
Exemplo n.º 6
0
Arquivo: api.py Projeto: bkad/prat
def messages():
    messages = {channel: get_recent_messages(channel) for channel in g.user["channels"]}
    return json.dumps(messages)