Skip to content

Commit

Permalink
finished update page
Browse files Browse the repository at this point in the history
  • Loading branch information
siyigu1 committed Apr 29, 2012
1 parent ad42ff4 commit 596c4e1
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 44 deletions.
13 changes: 8 additions & 5 deletions app/assets/stylesheets/scaffolds.css.scss
Expand Up @@ -128,6 +128,10 @@ div {
color: red;
}

#instruction {
color: green;
}

#address {
text-align: center;
font-size: 12px;
Expand All @@ -149,16 +153,15 @@ div {
}

#buttons {
background-color: #CAE6E9;
background-color: #CAE6E9;
margin-left: auto;
margin-right: auto;
width: 340px;
width: 450px;
}

.button_to {

margin: 20px 10px;
font-size: 50px;
text-align: center;
font-size:x-large;
}

.twitter-share-button {
Expand Down
34 changes: 28 additions & 6 deletions app/views/addresses/_quickshow.html.erb
@@ -1,27 +1,49 @@
<p id="notice"><%= notice %></p>
<script type="text/javascript">
$(document).ready(function(){
$( "input:submit", ".update_button" ).button();
});
</script>


<% if @address %>
<div style="text-align:center">
<%= link_to "Create/Edit Subscriptions", new_subscription_path(:address_id => @address.id) %>
</div>
<div style="text-align:center">Or</div>
<div class="update_button">
<%= button_to "Update This Address Now!", :controller => "users", :action => "run_update", :address_id => @address.id %>
</div>
<br>
<p>
<div>
<b>Line1:</b>
<%= @address.line1 %>
</div>
<div>
<% if @address.line2 %>
<b>Line2:</b>
<%= @address.line2 %>
<% end %>
</div>
<div>
<b>City:</b>
<%= @address.city %>
</div>
<div>
<b>State:</b>
<%= @address.state %>
</div>
<div>
<b>Zip:</b>
<%= @address.zip %>
<b>Category:</b>
<%= @address.category %>
</div>
</p>

<% @address.subscriptions.each do |sub| %>
<p>
<%= render "subscriptions/quickshow.html.erb", :@subscription => sub %>
</p>
<% end %>
<%= link_to "Create/Edit Subscriptions", new_subscription_path(:address_id => @address.id) %>
<% else %>
You haven't updated any addresses for this category yet. Update today!
<% end %>
8 changes: 8 additions & 0 deletions app/views/subscriptions/_amazon.html.erb
@@ -1,8 +1,16 @@
<div>
<b> Email: </b>
<%= @subscribable.email %>
</div>
<div>
<b> Full Name: </b>
<%= @subscribable.full_name %>
</div>
<div>
<b> Country: </b>
<%= @subscribable.country %>
</div>
<div>
<b> Phone Number: </b>
<%= @subscribable.phone_number %>
</div>
6 changes: 6 additions & 0 deletions app/views/subscriptions/_dmv.html.erb
@@ -1,6 +1,12 @@
<div>
<b> Lincense #: </b>
<%= @subscribable.driver_license %>
</div>
<div>
<b> SSN: </b>
<%= @subscribable.ssn %>
</div>
<div>
<b> County: </b>
<%= @subscribable.county %>
</div>
3 changes: 2 additions & 1 deletion app/views/subscriptions/_quickshow.html.erb
@@ -1,5 +1,6 @@
<br>
<% if @subscription.subscribable_id != nil %>
<b>Subscriber Type:</b>
<b>Subscriber:</b>
<%= @subscription.subscribable_type %>
<%= render "subscriptions/#{@subscription.subscribable_type.downcase}.html.erb", :@subscribable => @subscription.subscribable %>
<% end %>
57 changes: 36 additions & 21 deletions app/views/users/_addressDisplay.html.erb
@@ -1,25 +1,40 @@
<script>
$(function() {
$( "#tabs" ).tabs({ disable: true, collapsible: true }) });
$(function() {
$( "#tabs" ).accordion({ autoHeight: false});
});

</script>

<div id="tabs">
<ul>
<li><img style="float:left" src="/assets/home_icon.png"><a href="#tabs-1">Home</a></li>
<li><a href="#tabs-2">Office</a></li>
<li><a href="#tabs-3">School</a></li>
<li><a href="#tabs-4">Travel</a></li>
</ul>
<div id="tabs-1">
Tab 1 content
</div>
<div id="tabs-2">
Tab 2 content
</div>
<div id="tabs-3">
Tab 3 content
</div>
<div id="tabs-4">
Tab 4 content
</div>
</div>
<h3><a href="#home">Home</a></h3>
<div>
<p>
<%= render "addresses/quickshow.html.erb", :@address => home %>
</p>
</div>
<h3><a href="#office">Office</a></h3>
<div>
<p>
<%= render "addresses/quickshow.html.erb", :@address => office %>
</p>
</div>
<h3><a href="#school">School</a></h3>
<div>
<p>
<%= render "addresses/quickshow.html.erb", :@address => school %>
</p>
</div>
<h3><a href="#travel">Travel</a></h3>
<div>
<p>
<%= render "addresses/quickshow.html.erb", :@address => travel %>
</p>
</div>
<h3><a href="#travel">Other</a></h3>
<div>
<p>
<%= render "addresses/quickshow.html.erb", :@address => other %>
</p>
</div>

</div>
34 changes: 23 additions & 11 deletions app/views/users/show.html.erb
Expand Up @@ -2,23 +2,35 @@
Welcome to NomAddress <%= @user.first_name%>!

<p id="construction">The site is currently under construction, but you will be hearing from us soon!</p>
</div>

<%= link_to "ABOUT PAGE", "/about" %>

<div id="address">
<p id="instruction">Select the address you would like to update below!</p>

<% @user.addresses.each do |a| %>
<%= render "addresses/quickshow.html.erb", :@address => a %>
<% end %>
</div>
</div>
<div id="user_box">
<p id="notice" style="text-align:center"><%= notice %></p>
<div id="buttons">
<%= render "addressDisplay.html.erb" %>
<% home = nil %>
<% office = nil %>
<% school = nil %>
<% travel = nil %>
<% other = nil %>
<% @user.addresses.each do |a| %>
<% if a.category == "Home" %>
<% home = a %>
<% elsif a.category == "Office" %>
<% office = a %>
<% elsif a.category == "School" %>
<% school = a %>
<% elsif a.category == "Travel" %>
<% travel = a %>
<% else %>
<% other = a %>
<% end %>
<% end %>
<%= render :partial => "addressDisplay.html.erb", :locals => {:home => home, :office => office, :school => school, :travel => travel, :other => other} %>
</div>

<div style="float:right">
<%= button_to "Update", :controller => "users", :action => "run_update", :address_id => @user.addresses.first.id %>


<!-- Tweet Button -->
<a href="https://twitter.com/share" class="twitter-share-button" data-text="<%= @user.first_name%> has changed the address using NomAddress.com!" data-size="large" data-count="none" data-lang="en">Tweet</a>
Expand Down
1 change: 1 addition & 0 deletions db/schema.rb
Expand Up @@ -22,6 +22,7 @@
t.string "category"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "valid_until"
t.integer "user_id"
end

Expand Down

0 comments on commit 596c4e1

Please sign in to comment.