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 770507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:30:40+00:00 2026-05-14T18:30:40+00:00

I have a repeated line which outputs something like: Call John Jones in -3

  • 0

I have a repeated line which outputs something like:
Call John Jones in -3 days (status)

I have a helper called show_status(contact,email) which will output whether that particular email had been sent to that particular contact.

If it is “sent,” then that entire line should show up as “strike out.”

Similarly, if the number of days is -3 (<0), the line should be formatted in red.

Here’s my hack, but there must be a cleaner way to put the logic into the controller?

I hard-code a value that wraps around the lines I want formatted, and assign the value based on a separate call to the same helper:

<% for call in @campaign.calls %>
        <% if !show_call_status(@contact,call).blank? %>
           <%= strike_start = '<s>'%>
           <%= strike_end = '</s>' %>
        <% end %>
        <p>
            <%= strike_start %>
            <%= link_to call.title, call_path(call) %> on 
        <%= (@contact.date_entered + call.days).to_s(:long) %> in <%= interval_email(@contact,call) %> 
        days 
        <%= make_call(@contact,call) %>
        <span class='status'><%= show_call_status(@contact,call) %></span>  
        <%= strike_end %>   
        </p>
<% end %>

I guess what I’d like to do is not have the if statement in the View. Not sure how to do this.

  • 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-05-14T18:30:41+00:00Added an answer on May 14, 2026 at 6:30 pm

    Basically, I would put a class on the p tag based on the status and have the CSS decide what needed to be done.

    So the view:

    <% for call in @campaign.calls %>
      <p class="<%= call_status_class(@contact, call) %>">
        <%= link_to call.title, call_path(call) %> on 
        <%= (@contact.date_entered + call.days).to_s(:long) %> in <%= interval_email(@contact,call) %> 
        days 
        <%= make_call(@contact,call) %>
        <span class='status'><%= show_call_status(@contact,call) %></span>  
      </p>
    <% end %>
    

    And another helper:

    def call_status_class(contact, call)
      # do what you have to do to figure out status
      if overdue
        return 'overdue'
      elsif called
        return 'called'
      else
        return 'standard'
      end
    end
    

    Then in CSS:

    .standard {
      ...
    }
    .overdue {
      color: red;
    }
    .called {
      text-decoration: line-through;
    }
    

    Pick and choose. I can’t really give you full fledged solution without seeing all the helper functions. Hope this helps.

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

Sidebar

Related Questions

I have a streaming input which has repeated values. I can use any data
I have a table with a lot of repeated data that I'd like to
I'd like to have my table's headers repeated for every printed page, but it
After repeated searching I have not found an elegant solution to this issue: how
I have a block of code that is repeated within a DB2 stored procedure.
I have the same block of code repeated with two different variables. This block
I have a MySQL table that holds many entries with repeated IDs (for various
I have a bunch of these little bits of HTML code repeated over and
I have a table of 3 columns: AuthorID (id can be repeated) JournalName (name
i have a multi dimension array with sub array having repeated values of '

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.