Skip to content

Instantly share code, notes, and snippets.

@Rosa-Fox
Created June 20, 2014 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rosa-Fox/f9afba2cf4bf6cc7a5b4 to your computer and use it in GitHub Desktop.
Save Rosa-Fox/f9afba2cf4bf6cc7a5b4 to your computer and use it in GitHub Desktop.
Even worse example
%nav.navbar.navbar-default
.container-fluid
.navbar-header
%span.navbar-brand
=link_to 'Users', admin_users_path
|
=link_to 'Invitations', admin_invitations_path
.collapse.navbar-collapse
.navbar-right
= link_to 'Log out', admin_session_path, method: 'delete', class: 'btn btn-sm btn-default navbar-btn'
.row
.col-md-1
.col-md-5
%h1.text-left Invitations
.row
.col-md-1
.col-md-5
= link_to 'New Invitation', new_admin_invitation_path
.row
.col-md-1
.col-md-9
%h3 Pending Invitations
.text-muted Sent invitations that have yet to expire or be redeemed
%table.table.table-striped
%thead
%tr
%th Email
%th Workshops
%th Sent at
%th Expired at
%tbody
- @invitation.each do |invitation|
- if Time.now < invitation.created_at + 2.weeks and invitation.redeemed_at == nil
%tr
%td
= invitation.email
%td
= invitation.workshop_ids.join(', ')
%td
= invitation.created_at
%td
= invitation.created_at + 2.weeks
.row
.col-md-1
.col-md-9
%h3 Expired Invitations
.text-muted Invitations that expired without being redeemed
%table.table.table-striped
%thead
%tr
%th Email
%th Workshops
%th Sent at
%th Expired at
%tbody
- @invitation.each do |invitation|
- if Time.now > invitation.created_at + 2.weeks and invitation.redeemed_at == nil
%tr
%td
= invitation.email
%td
= invitation.workshop_ids.join(', ')
%td
= invitation.created_at
%td
= invitation.created_at + 2.weeks
.row
.col-md-1
.col-md-9
%h3 Redeemed Invitations
.text-muted Invitations that were redeemed before they were expired
%table.table.table-striped
%thead
%tr
%th Email
%th Workshops
%th Sent at
%th Created at
%th Redeemed at
%tbody
- @invitation.each do |invitation|
- if invitation.redeemed_at != nil and invitation.redeemed_at < invitation.created_at + 2.weeks
%tr
%td
= link_to invitation.email, edit_admin_user_path(invitation.user_id)
%td
= invitation.workshop_ids.join(', ')
%td
= invitation.created_at
%td
= invitation.created_at + 2.weeks
%td
= invitation.redeemed_at
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment