Skip to content

Instantly share code, notes, and snippets.

@danielvlopes
Created November 8, 2017 00:47
Show Gist options
  • Save danielvlopes/d0de09006355d525cd02d147b61934f7 to your computer and use it in GitHub Desktop.
Save danielvlopes/d0de09006355d525cd02d147b61934f7 to your computer and use it in GitHub Desktop.
<!-- <section class="periodic-questions" style="display: none;">
<div class="questions-list">
<% @question_dates.each do |date| %>
<% if date.monday? %>
<article
data-role="tour-surveys-heartbeat"
class="pending-question sheet <%= 'active' unless current_organization.heartbeats_inactive? || current_organization.holidays.on(date).any? %>">
<div class="day_calendar medium">
<time class="title"><%= relative_future_date(date) %></time>
<time class="text"><%= date.strftime('%b') %></time>
<time class="number"><%= date.strftime('%e') %></time>
</div>
<h2>Heartbeat Question</h2>
<% if current_organization.heartbeats_inactive? %>
<div class="paused">
<h3>Heartbeat questions are&nbsp;paused.</h3>
<p>We won't ask any heartbeat questions until you turn them back&nbsp;on.</p>
<%= form_for current_organization do |f| %>
<%= f.hidden_field :heartbeats_active, value: true %>
<%= f.submit "Resume heartbeat questions", class: 'button' %>
<% end %>
</div>
<% elsif current_organization.holidays.on(date).any? %>
<% holiday = current_organization.holidays.on(date).first %>
<div class="paused">
<h3>Heartbeats are paused for <%= holiday %>.</h3>
<p>We&rsquo;ll resume asking heartbeat questions after the holiday.</p>
<%= link_to 'Ask a question anyway', holiday, method: :delete, class: 'button' %>
</div>
<% else %>
<h3><%= current_organization.heartbeat_question_text %></h3>
<%= form_for current_organization do |f| %>
<p class="pause">
<%= f.hidden_field :heartbeats_active, value: false %>
<%= f.submit "Pause heartbeat questions" %>
</p>
<% if Rails.env.demo? %>
<div class="alert alert-warning demo-alert">
<strong>Sample email:</strong>
<%= link_to "question", url_for_preview_email("periodic_questions_emails/heartbeat"), target: "_blank" %>
and <%= link_to "answers", url_for_preview_email("periodic_questions_emails/heartbeat_summary"), target: "_blank" %>
</div>
<% end %>
<% end %>
<% end %>
</article>
<% end %>
<% if date.wednesday? %>
<article
data-role="tour-surveys-company"
class="pending-question sheet <%= 'active' unless current_organization.company_surveys_inactive? || current_organization.company_surveys.pending.none? || current_organization.holidays.on(date).any? %>">
<div class="day_calendar medium">
<time class="title"><%= relative_future_date(date) %></time>
<time class="text"><%= date.strftime('%b') %></time>
<time class="number"><%= date.strftime('%e') %></time>
</div>
<h2>Company Question</h2>
<% if current_organization.company_surveys_inactive? %>
<div class="paused">
<h3>Company questions are&nbsp;paused.</h3>
<p>We won't ask any company questions until you turn them back&nbsp;on.</p>
<%= form_for current_organization do |f| %>
<%= f.hidden_field :company_surveys_active, value: true %>
<%= f.submit "Resume company questions", class: 'button' %>
<% end %>
</div>
<% elsif current_organization.company_surveys.pending.none? %>
<div class="paused">
<h3>You&rsquo;ve asked all your Company&nbsp;Questions.</h3>
<p>We&rsquo;ve paused company questions until you add a new question.</p>
<p><%= link_to "Add a new question...", company_surveys_path %></p>
</div>
<% elsif current_organization.holidays.on(date).any? %>
<% holiday = current_organization.holidays.on(date).first %>
<div class="paused">
<h3>Company questions are paused for <%= holiday %>.</h3>
<p>We&rsquo;ll resume asking company questions after the holiday.</p>
<%= link_to 'Ask a question anyway', holiday, method: :delete, class: 'button' %>
</div>
<% else %>
<%= render 'surveys/survey', survey: current_organization.company_surveys.pending.first %>
<%= form_for current_organization do |f| %>
<p class="pause">
<%= f.hidden_field :company_surveys_active, value: false %>
<%= f.submit "Pause company questions" %>
</p>
<% if Rails.env.demo? %>
<div class="alert alert-warning demo-alert">
<strong>Sample email:</strong>
<%= link_to "question", url_for_preview_email("periodic_questions_emails/company_survey"), target: "_blank" %>
and <%= link_to "answers", url_for_preview_email("periodic_questions_emails/company_survey_summary_for_super_managers"), target: "_blank" %>
</div>
<% end %>
<% end %>
<% end %>
</article>
<% end %>
<% if date.friday? %>
<article
data-role="tour-surveys-social"
class="pending-question sheet <%= 'active' unless current_organization.social_surveys_inactive? || current_organization.social_surveys.pending.none? || current_organization.holidays.on(date).any? %>">
<div class="day_calendar medium">
<time class="title"><%= relative_future_date(date) %></time>
<time class="text"><%= date.strftime('%b') %></time>
<time class="number"><%= date.strftime('%e') %></time>
</div>
<h2>Social Question</h2>
<% if current_organization.social_surveys_inactive? %>
<div class="paused">
<h3>Social questions are&nbsp;paused.</h3>
<p>We won't ask any social questions until you turn them back&nbsp;on.</p>
<%= form_for current_organization do |f| %>
<%= f.hidden_field :social_surveys_active, value: true %>
<%= f.submit "Resume social questions" %>
<% end %>
</div>
<% elsif current_organization.social_surveys.pending.none? %>
<div class="paused">
<h3>You&rsquo;ve asked all your Social&nbsp;Questions.</h3>
<p>We&rsquo;ve paused social questions until you add a new question.</p>
<p><%= link_to "Add a new question...", social_surveys_path %></p>
</div>
<% elsif current_organization.holidays.on(date).any? %>
<% holiday = current_organization.holidays.on(date).first %>
<div class="paused">
<h3>Social questions are paused for <%= holiday %>.</h3>
<p>We&rsquo;ll resume asking social questions after the holiday.</p>
<%= link_to 'Ask a question anyway', holiday, method: :delete, class: 'button' %>
</div>
<% else %>
<%= render 'surveys/survey', survey: current_organization.social_surveys.pending.first %>
<%= form_for current_organization do |f| %>
<p class="pause">
<%= f.hidden_field :social_surveys_active, value: false %>
<%= f.submit "Pause social questions" %>
</p>
<% if Rails.env.demo? %>
<div class="alert alert-warning demo-alert">
<strong>Sample email:</strong>
<%= link_to "question", url_for_preview_email("periodic_questions_emails/social_survey"), target: "_blank" %>
and <%= link_to "answers", url_for_preview_email("periodic_questions_emails/social_survey_summary"), target: "_blank" %>
</div>
<% end %>
<% end %>
<% end %>
</article>
<% end %>
<% end %>
</div>
<div class="questions-list pause">
<% @question_dates.each do |date| %>
<% if date.monday? %>
<% end %>
<% if date.wednesday? %>
<% end %>
<% if date.friday? %>
<% end %>
<% end %>
</div>
</section> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment