user and recipient and tests

This commit is contained in:
Jared Cosulich 2017-02-25 11:00:27 -05:00
parent d70e30ec93
commit df2ea95ceb
50 changed files with 1412 additions and 37 deletions

View file

@ -0,0 +1,38 @@
%header.row
.title.col.s9.m11.l8
.hide-on-small-only
%h5= link_to('Thoughtful<br/>Recommendations.com'.html_safe, root_path)
.hide-on-med-and-up
%h6= link_to('Thoughtful<br/>Recommendations.com'.html_safe, root_path)
.navigation.col.hide-on-med-and-down.l4.right-align
- if current_user
- unless @limited_header
- if current_user.profile.blank?
= link_to 'Create Profile', new_profile_path, class: 'btn btn-small grey waves-effect waves-light '
- else
= link_to 'My Profile', direct_profile_path(current_user.profile), class: 'btn btn-small grey waves-effect waves-light '
= link_to 'My Bucketlist', bucketlist_path, class: 'btn btn-small grey waves-effect waves-light '
= link_to 'Sign Out', destroy_user_session_path, rel: "nofollow", method: :delete, class: 'btn btn-small grey waves-effect waves-light '
- else
= link_to 'Login', new_user_session_path, class: 'btn btn-small grey waves-effect waves-light '
= link_to 'Contribute / Sign Up', contribute_profile_recommendation_path, class: 'btn btn-small grey waves-effect waves-light '
.col.s3.m1.hide-on-large-only.right-align
= link_to '<i class="mdi-navigation-menu medium black-text"></i>'.html_safe, '#', data: {activates: 'mobile-nav'}, class: 'button-collapse'
#mobile-nav.side-nav
%ul
- if current_user
- unless @limited_header
- if current_user.profile.present?
%li= link_to 'My Profile', direct_profile_path(current_user.profile)
%li= link_to 'My Bucketlist', bucketlist_path
%li= link_to 'Add Something', new_profile_recommendation_path
- else
%li= link_to 'Create Profile', new_profile_path
%li= link_to 'Sign Out', destroy_user_session_path, rel: "nofollow", method: :delete
- else
%li= link_to 'Login', new_user_session_path
%li= link_to 'Contribute / Sign Up', contribute_profile_recommendation_path

View file

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Edcontext</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<%= yield %>
</body>
</html>

View file

@ -0,0 +1,12 @@
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Edcontext
= csrf_meta_tags
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
%body
%p.notice= notice
%p.alert= alert
= yield

View file

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>

View file

@ -0,0 +1,8 @@
!!!
%html
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
:css
/* Email styles need to be inline */
%body
= yield

View file

@ -0,0 +1,67 @@
<%= form_for(recipient) do |f| %>
<% if recipient.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(recipient.errors.count, "error") %> prohibited this recipient from being saved:</h2>
<ul>
<% recipient.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :phone %>
<%= f.text_field :phone %>
</div>
<div class="field">
<%= f.label :birth_date %>
<%= f.date_select :birth_date %>
</div>
<div class="field">
<%= f.label :gender %>
<%= f.text_field :gender %>
</div>
<div class="field">
<%= f.label :race %>
<%= f.text_field :race %>
</div>
<div class="field">
<%= f.label :ethnicity %>
<%= f.text_field :ethnicity %>
</div>
<div class="field">
<%= f.label :home_language_id %>
<%= f.number_field :home_language_id %>
</div>
<div class="field">
<%= f.label :income %>
<%= f.text_field :income %>
</div>
<div class="field">
<%= f.label :opted_out %>
<%= f.check_box :opted_out %>
</div>
<div class="field">
<%= f.label :school_id %>
<%= f.number_field :school_id %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

View file

@ -0,0 +1,6 @@
<h1>Editing Recipient</h1>
<%= render 'form', recipient: @recipient %>
<%= link_to 'Show', @recipient %> |
<%= link_to 'Back', recipients_path %>

View file

@ -0,0 +1,45 @@
<p id="notice"><%= notice %></p>
<h1>Recipients</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Phone</th>
<th>Birth date</th>
<th>Gender</th>
<th>Race</th>
<th>Ethnicity</th>
<th>Home language</th>
<th>Income</th>
<th>Opted out</th>
<th>School</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @recipients.each do |recipient| %>
<tr>
<td><%= recipient.name %></td>
<td><%= recipient.phone %></td>
<td><%= recipient.birth_date %></td>
<td><%= recipient.gender %></td>
<td><%= recipient.race %></td>
<td><%= recipient.ethnicity %></td>
<td><%= recipient.home_language_id %></td>
<td><%= recipient.income %></td>
<td><%= recipient.opted_out %></td>
<td><%= recipient.school_id %></td>
<td><%= link_to 'Show', recipient %></td>
<td><%= link_to 'Edit', edit_recipient_path(recipient) %></td>
<td><%= link_to 'Destroy', recipient, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Recipient', new_recipient_path %>

View file

@ -0,0 +1,4 @@
json.array!(@recipients) do |recipient|
json.extract! recipient, :id, :name, :phone, :birth_date, :gender, :race, :ethnicity, :home_language_id, :income, :opted_out, :school_id
json.url recipient_url(recipient, format: :json)
end

View file

@ -0,0 +1,5 @@
<h1>New Recipient</h1>
<%= render 'form', recipient: @recipient %>
<%= link_to 'Back', recipients_path %>

View file

@ -0,0 +1,54 @@
<p id="notice"><%= notice %></p>
<p>
<strong>Name:</strong>
<%= @recipient.name %>
</p>
<p>
<strong>Phone:</strong>
<%= @recipient.phone %>
</p>
<p>
<strong>Birth date:</strong>
<%= @recipient.birth_date %>
</p>
<p>
<strong>Gender:</strong>
<%= @recipient.gender %>
</p>
<p>
<strong>Race:</strong>
<%= @recipient.race %>
</p>
<p>
<strong>Ethnicity:</strong>
<%= @recipient.ethnicity %>
</p>
<p>
<strong>Home language:</strong>
<%= @recipient.home_language_id %>
</p>
<p>
<strong>Income:</strong>
<%= @recipient.income %>
</p>
<p>
<strong>Opted out:</strong>
<%= @recipient.opted_out %>
</p>
<p>
<strong>School:</strong>
<%= @recipient.school_id %>
</p>
<%= link_to 'Edit', edit_recipient_path(@recipient) %> |
<%= link_to 'Back', recipients_path %>

View file

@ -0,0 +1 @@
json.extract! @recipient, :id, :name, :phone, :birth_date, :gender, :race, :ethnicity, :home_language_id, :income, :opted_out, :school_id, :created_at, :updated_at

View file

@ -0,0 +1 @@
WELCOME