Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#120328-Finish-Signup

  • Loading branch information...
commit e801b913dfa2e11b619ab7c17ca83c3329df6692 1 parent 5affbe4
Jiangfan Du authored
View
19 app/assets/stylesheets/custom.css.scss
@@ -1,5 +1,7 @@
@import "bootstrap";
+$greyMediumLight: #eaeaea;
+
@mixin box_sizing {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
@@ -29,7 +31,7 @@ aside{
margin-bottom:3px;
line-height:1;
}
- hi{
+ h1{
font-size:1.6em;
text-align:left;
letter-spacing:-1px;
@@ -104,7 +106,6 @@ p {
top:0;
height:100%;
width:100%;
- background-color: #dddddd;
}
/* header */
@@ -153,3 +154,17 @@ footer ul li{
float:left;
margin-left:10px;
}
+
+/* forms */
+#error_explanation {
+ clolr:#f00;
+ ul{
+ list-style:none;
+ margin:0 0 18px 0;
+ }
+}
+
+.field_with_errors {
+ @extend .control-group;
+ @extend .error;
+}
View
10 app/controllers/users_controller.rb
@@ -6,4 +6,14 @@ def new
def show
@user=User.find(params[:id])
end
+
+ def create
+ @user=User.new(params[:user])
+ if @user.save
+ flash[:success] = "Welcome to Silent December!"
+ redirect_to @user
+ else
+ render 'new'
+ end
+ end
end
View
2  app/views/dashboard/home.html.erb
@@ -4,5 +4,3 @@
<h2>This is a place you can always find joys:)</h2>
<%= link_to "Sign up now!", new_user_path, class:"btn btn-large btn-primary"%>
</div>
-
-<%= link_to image_tag("rails.png", alt:"Rails"), 'http://rubyonrails.org/' %>
View
3  app/views/layouts/application.html.erb
@@ -11,6 +11,9 @@
<%= render 'layouts/header' %>
<%= render 'layouts/background' %>
<div class="container">
+ <% flash.each do |key,value| %>
+ <div class="alert alert-<%= key %>"><%=value%></div>
+ <% end %>
<%= yield %>
<%= render 'layouts/footer' %>
</div>
View
12 app/views/users/_error_msg.html.erb
@@ -0,0 +1,12 @@
+<% if @user.errors.any? %>
+ <div id="error_explanation">
+ <div class="alert alert-error">
+ The form contains <%= pluralize(@user.errors.count, "error") %>.
+ </div>
+ <ul>
+ <% @user.errors.full_messages.each do |msg| %>
+ <li>* <%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+<% end %>
View
3  app/views/users/new.html.erb
@@ -1,6 +1,7 @@
<%= provide(:title, 'signup') %>
-<div class="center hero-unit">
+<div class="hero-unit">
<h1>Good Choice of Signing up!</h1>
+ <%= render 'users/error_msg' %>
<div class="row">
<div class="span6 offset3">
<%= form_for(@user) do |f| %>
View
4 app/views/users/show.html.erb
@@ -3,8 +3,8 @@
<aside class="span4">
<section>
<h1>
- <%= @user.name %>
- <%=@user.email %>
+ <%= @user.name %><br />
+ <%= @user.email %>
</h1>
</section>
</aside>
View
1  config/routes.rb
@@ -5,6 +5,7 @@
match 'about', to: 'dashboard#about'
match 'dashboard/help', to: 'dashboard#help'
+ match 'signup', to: 'users#new'
# The priority is based upon order of creation:
# first created -> highest priority.
Please sign in to comment.
Something went wrong with that request. Please try again.