fixed some bugs, added seed data, changed login to use username + styled login/register page
This commit is contained in:
@@ -16,6 +16,6 @@ class User < ActiveRecord::Base
|
||||
has_many :posts, :dependent => :destroy
|
||||
|
||||
def admin?
|
||||
true if self.username == 'codezombie'
|
||||
true if self.username == 'admin'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
<h2>Sign up</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :username %><br />
|
||||
<%= f.text_field :username %></p>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.label :password %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<p><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
|
||||
<p><%= f.submit "Sign up" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
<div class="module" style="padding:15px 25px 0px 25px;">
|
||||
<div style="float:left; width:50%; height:330px; padding-right:10px;">
|
||||
<h1>Welcome to Forum Monster</h1>
|
||||
<p>Forum Monster is a simple forum generator written in rails 3. The goal of Forum Monster, is to provide a simple, and easy to setup forum application without having to dictate how your site it setup.</p>
|
||||
<p style="font-size:1.2em;"><strong>The email field is required, but none of the data is saved for more than a day. Feel free to put in a fake address.</strong></p>
|
||||
</div>
|
||||
<div style="float:right; width:45%; padding-left:30px; border-left:1px solid #e2e2e2;">
|
||||
<%= form_for("user", :as => resource_name, :url => registration_path("user")) do |f| %>
|
||||
<p>
|
||||
Username: <br />
|
||||
<%= f.text_field :username, :style => "font-size:2.2em", :autocomplete => "off" %><br />
|
||||
</p>
|
||||
<p>
|
||||
Email Address: <br />
|
||||
<%= f.text_field :email, :style => "font-size:2.2em", :autocomplete => "off" %><br />
|
||||
</p>
|
||||
<p>
|
||||
Password:<br />
|
||||
<%= f.password_field :password, :style => "font-size:2.2em", :autocomplete => "off" %><br />
|
||||
</p>
|
||||
<p>
|
||||
Confirm Password:<br />
|
||||
<%= f.password_field :password_confirmation, :style => "font-size:2.2em", :autocomplete => "off" %><br />
|
||||
</p>
|
||||
<p><%= f.submit "Sign up" %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
@@ -1,17 +1,38 @@
|
||||
<h2>Sign in</h2>
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
$('#user_username, #user_password').click(function() {
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
$('#user_username, #user_password').blur(function() {
|
||||
if ( $(this).val() == '' ) {
|
||||
if ( $(this).is('#user_username') ) {
|
||||
$(this).val('username');
|
||||
}else{
|
||||
$(this).val('password');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.label :password %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
|
||||
<% end -%>
|
||||
|
||||
<p><%= f.submit "Sign in" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
<div class="module" style="padding:15px 25px 0px 25px;">
|
||||
<div style="float:left; width:50%; height:210px; padding-right:10px;">
|
||||
<h1>Welcome to Forum Monster</h1>
|
||||
<p>
|
||||
Forum Monster is a simple forum generator written in rails 3. The goal of Forum Monster, is to provide a simple, and easy to setup forum application without having to dictate how your site it setup.
|
||||
<p>You can login with the following information:</p>
|
||||
<p><strong>Admin Demo:</strong> admin/forum_admin</p>
|
||||
<p><strong>User Demo:</strong> user/forum_user</p>
|
||||
</p>
|
||||
</div>
|
||||
<div style="float:right; width:45%; height:195px; padding-left:30px; border-left:1px solid #e2e2e2;">
|
||||
<%= form_for("user", :url => user_session_path) do |f| %>
|
||||
<p><%= f.text_field :username , :value => "username", :style => "font-size:2.2em;" %></p>
|
||||
<p><%= f.password_field :password, :value => "password", :style => "font-size:2.2em" %></p>
|
||||
<%= f.submit 'Sign in' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
@@ -45,13 +45,12 @@
|
||||
<%= yield %>
|
||||
</div>
|
||||
|
||||
<% if %w(categories forums topics posts).include? controller_name %>
|
||||
<div id="info_box">
|
||||
<p>
|
||||
Total number of registered users: <strong><%= User.count %></strong><br />
|
||||
Newest registered user: <%= link_to User.last.username %>
|
||||
Newest registered user: <%= link_to User.last.username unless User.last.nil? %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user