Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8056233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:38:53+00:00 2026-06-05T08:38:53+00:00

I am using haml to code out the following code. I basically have a

  • 0

I am using haml to code out the following code. I basically have a bunch of nested if-else statements in my index.html.haml file. However I keep getting a syntax error for the code below.

- if current_user
  :javascript
    window.is_logined_in = true;
    window.currentUserJSON = #{@current_user_json};
    //Getting syntax error for the line below
    - if window.currentUserJSON.user.following_count == 293 && window.currentUserJSON.user.answer_count == 276
      window.complete_orientation = true;
    - else
      window.complete_orientation = false;
- else
  :javascript
    window.is_logined_in = false;

enter image description here

How can I modify my code to resolve this syntax error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:38:54+00:00Added an answer on June 5, 2026 at 8:38 am

    You can not use the - prefix inside the :javascript block like this.
    You are literally writing the code to javascript and that’s causing the error,
    but you should be able to do that without the prefixed -, as it is already javascript.

    - if current_user
      :javascript
        window.is_logined_in = true;
        window.currentUserJSON = #{@current_user_json};
        //Getting syntax error for the line below
        if (window.currentUserJSON.user.following_count == 293 
            && 
            window.currentUserJSON.user.answer_count == 276
        ) {
          window.complete_orientation = true;
        } else {
          window.complete_orientation = false;
        }
    - else
      :javascript
        window.is_logined_in = false;
    

    The javascript code itself is a bit verbose, but it should do the job.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build a simple nested html menu using HAML and am
I have created a tab-pane using HAML as shown in my code snippet below
First code: # matches/index.html.haml %ul.match_list - @matches.each do |match| %li =render match # matches/_match.html.haml
Using the (intentionally) strange multi-line format for HAML, I'd like to have the following
So I'm working on some HTML5 code using HAML and SASS. I currently have
I'm using HAML to generate some static html pages for a site, and I
I am using haml with my rails application and i have a question how
I'm using Haml (Haml/Sass 3.0.9 - Classy Cassidy) stand-alone to generate static HTML. I
In haml, how do I render the following incredibly basic HTML: <p>Results found for
I am using Rails 3.1 with assets pipeline. However I have a very weird

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.