fixed error messages upon user creation

This commit is contained in:
albert
2011-09-11 17:24:44 -04:00
parent 281cb75991
commit 4b998184a4
4 changed files with 9 additions and 16 deletions

View File

@@ -5,9 +5,9 @@ $(function() {
});
if (Danbooru.meta("errors")) {
$("#p1").hide();
$("#notice").hide();
// $("#p1").hide();
// $("#notice").hide();
} else {
$("#p2").hide();
// $("#p2").hide();
}
});

View File

@@ -28,6 +28,7 @@ class UsersController < ApplicationController
def create
@user = User.create(params[:user])
flash[:notice] = "There were errors" if @user.errors.any?
session[:user_id] = @user.id
set_current_user
respond_with(@user)

View File

@@ -1,7 +1,7 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "Listing", users_path %></li>
<li><%= link_to "Register", new_user_path %></li>
<li><%= link_to "Signup", new_user_path %></li>
<% if @user && !@user.new_record? %>
<li>|</li>
<li><%= link_to "Edit", edit_user_path(@user) %></li>

View File

@@ -1,6 +1,6 @@
<div id="c-users">
<div id="a-new">
<h1>Registration</h1>
<h1>Signup</h1>
<div id="p1">
<p><%= Danbooru.config.app_name %> is ad-sponsored and does not require an account to view. But in order to start uploading, editing, or creating content on this site, you will need to register. <em>Make sure you read and agree to the <%= link_to "terms of service", terms_of_service_path %> before registering. <strong>This site is open to web crawlers, therefore any name you choose will be public!</strong></em></p>
@@ -42,10 +42,6 @@
<div class="clearfix"></div>
</div>
<footer class="nav-links">
<%= link_to "Continue &raquo;".html_safe, new_user_path(:anchor => "p2") %>
</footer>
</div>
<div id="p2">
@@ -65,19 +61,15 @@
</ul>
<%= simple_form_for(@user) do |f| %>
<%= error_messages_for("user") %>
<%= f.input :name %>
<%= f.input :password %>
<%= f.input :password_confirmation %>
<%= f.input :email, :required => false %>
<%= f.button :submit %>
<% end %>
<footer class="nav-links">
<%= link_to "&laquo; Back".html_safe, new_user_path(:anchor => "p1") %>
</footer>
</div>
</div>
<%= render "secondary_links" %>
</div>
</div>