Started inital migration to rails 3.2

This commit is contained in:
2013-01-19 01:14:55 -05:00
parent 64aff15deb
commit a9a4cd892f
98 changed files with 968 additions and 363 deletions

0
app/views/categories/_form.html.erb Normal file → Executable file
View File

0
app/views/categories/edit.html.erb Normal file → Executable file
View File

0
app/views/categories/index.html.erb Normal file → Executable file
View File

0
app/views/categories/new.html.erb Normal file → Executable file
View File

0
app/views/devise/confirmations/new.html.erb Normal file → Executable file
View File

View File

View File

0
app/views/devise/mailer/unlock_instructions.html.erb Normal file → Executable file
View File

0
app/views/devise/passwords/edit.html.erb Normal file → Executable file
View File

0
app/views/devise/passwords/new.html.erb Normal file → Executable file
View File

5
app/views/devise/registrations/edit.html.erb Normal file → Executable file
View File

@@ -6,6 +6,11 @@
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>
<% if current_user.admin? %>
<p><%= f.label :is_admin %><br />
<%= f.check_box :is_admin, {checked: resource.admin?} %></p>
<% end %>
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password %></p>

7
app/views/devise/registrations/new.html.erb Normal file → Executable file
View File

@@ -1,8 +1,7 @@
<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>
<h1>Welcome to Horses</h1>
<%= devise_error_messages! %>
</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| %>
@@ -26,4 +25,4 @@
<% end %>
</div>
<div class="clear"></div>
</div>
</div>

10
app/views/devise/sessions/new.html.erb Normal file → Executable file
View File

@@ -19,13 +19,7 @@
<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>
<h1>Welcome to Horses</h1>
</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| %>
@@ -35,4 +29,4 @@
<% end %>
</div>
<div class="clear"></div>
</div>
</div>

0
app/views/devise/shared/_links.erb Normal file → Executable file
View File

0
app/views/devise/unlocks/new.html.erb Normal file → Executable file
View File

0
app/views/forums/_form.html.erb Normal file → Executable file
View File

0
app/views/forums/edit.html.erb Normal file → Executable file
View File

0
app/views/forums/index.html.erb Normal file → Executable file
View File

0
app/views/forums/new.html.erb Normal file → Executable file
View File

0
app/views/forums/show.html.erb Normal file → Executable file
View File

17
app/views/layouts/application.html.erb Normal file → Executable file
View File

@@ -1,30 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
<title><%= content_for?(:title) ? yield(:title) : "Horses" %></title>
<%= stylesheet_link_tag "application", "forum-monster" %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
<%= yield(:head) %>
</head>
<body>
<a href="https://github.com/gitt/forum_monster"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png" alt="Fork me on GitHub"></a>
<div class="container">
<%= content_tag :div, "This is just a demo, the database is reset every 24 hours.", :class => "demo_notice" %>
</div>
<div id="header">
<div id="logo">
<%= image_tag "rails.png" %>
<h1>Forum Monster</h1>
A Ruby on Rails Forum Gem
<h1>Horses</h1>
A forum about Horses
<div class="clear"></div>
</div>
<div id="menu_wrapper">
<ul>
<li><%= link_to "Forum Index", root_path %></li>
<% if user_signed_in? %>
<li><%= link_to "User Control Panel", edit_user_registration_path %></li>
<% if current_user.admin? %>
<li><%= link_to "User Administration", users_path %></li>
<% end %>
<li><%= link_to "Logout", destroy_user_session_path, :method => :delete %></li>
<% else %>
<li><%= link_to "Login", new_user_session_path %></li>

0
app/views/posts/_form.html.erb Normal file → Executable file
View File

0
app/views/posts/edit.html.erb Normal file → Executable file
View File

0
app/views/posts/new.html.erb Normal file → Executable file
View File

0
app/views/topics/_form.html.erb Normal file → Executable file
View File

0
app/views/topics/edit.html.erb Normal file → Executable file
View File

0
app/views/topics/new.html.erb Normal file → Executable file
View File

4
app/views/topics/show.html.erb Normal file → Executable file
View File

@@ -19,7 +19,7 @@
<span class="info smaller">
<p><strong><%= "Administrator" if post.user.admin? %></strong></p>
Posts <%= post.user.posts.size %><br />
Registered <%=l post.user.created_at, :format => :joined %><br />
Registered <%=l post.user.created_at %><br />
</span>
</td>
<td class="post_header">
@@ -41,4 +41,4 @@
</table>
</div>
</div>
<div class="right controls"><p><%= link_to "Back to Forum", forum_path(@topic.forum) %></p></div>
<div class="right controls"><p><%= link_to "Back to Forum", forum_path(@topic.forum) %></p></div>

34
app/views/users/_form.html.erb Executable file
View File

@@ -0,0 +1,34 @@
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p><%= f.label :username %><br />
<%= f.text_field :username %></p>
<p><%= f.label :is_admin %>
<%= f.check_box :is_admin, {checked: @user.admin?} %></p>
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>
<% if action_name == "new" %>
<p><%= f.label :password, "New password" %><br />
<%= f.password_field :password %></p>
<p><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></p>
<% end %>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

View File

@@ -0,0 +1,23 @@
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p><%= f.label :password, "New password" %><br />
<%= f.password_field :password %></p>
<p><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></p>
<div class="actions">
<%= f.submit "Change password" %>
</div>
<% end %>

7
app/views/users/edit.html.erb Executable file
View File

@@ -0,0 +1,7 @@
<h2>Edit user</h2>
<%= render 'form' %>
<p></p>
<%= render 'passwords' %>
<%= link_to 'All users', users_path %>

36
app/views/users/index.html.erb Executable file
View File

@@ -0,0 +1,36 @@
<h1>All Users</h1>
<table id="users">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Login Count</th>
<th>Last Sign In</th>
<th>Admin</th>
<th>Created At</th>
<th>Last Edited</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<th><%= user.username %></th>
<th><%= user.email %></th>
<th><%= user.sign_in_count %></th>
<th><%if user.last_sign_in_at.blank? %>Never logged in<% else %><%= time_ago_in_words(user.last_sign_in_at.to_datetime)+' ago' %><% end %></th>
<th><%= user.admin? %></th>
<th><%= user.created_at.to_s(:datetime).downcase %></th>
<th><%= user.updated_at.to_s(:datetime).downcase %></th>
<th><%= link_to "Edit", edit_user_path(user) %></th>
<th><%= link_to "Delete", user, :method => :delete, :confirm => "Are you sure?" %></th>
</tr>
<% end %>
</tbody>
</table>
<p><%= link_to "New User", new_user_path %></p>

5
app/views/users/new.html.erb Executable file
View File

@@ -0,0 +1,5 @@
<h2>Sign up</h2>
<%= render 'form' %>
<%= link_to 'All users', users_path %>

2
app/views/users/show.html.erb Executable file
View File

@@ -0,0 +1,2 @@
<p><%= @user.username %></p>
<p><%= @user.email %></p>