Initial Commit

This commit is contained in:
Jason Katz
2011-06-14 18:08:28 -07:00
commit 5a34ac406c
172 changed files with 18457 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
end

View File

@@ -0,0 +1,90 @@
class AssetsController < ApplicationController
before_filter :authenticate_user!
INDEX_SORT = SortIndex::Config.new(
{'updated_at' => 'updated_at'},
{'tag' => 'tag', 'name' => 'name', 'make' => 'make', 'model' => 'model', 'serial' => 'serial', 'category' => 'category',
'warranty' => 'warranty', 'location' => 'location', 'assigned' => 'assigned', 'status' => 'status', 'updated' => 'updated'}
)
# GET /assets
# GET /assets.xml
def index
@sortable = SortIndex::Sortable.new(params, INDEX_SORT)
@assets = Asset.find(:all, :order => (params[:sort_by] || "TRIM(LOWER(tag))") + " " + (params[:sort_direction] || "asc"))
# @assets.sort! {|x,y| x.tag.to_i <=> y.tag.to_i }
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @assets }
end
end
# GET /assets/1
# GET /assets/1.xml
def show
@asset = Asset.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @asset }
end
end
# GET /assets/new
# GET /assets/new.xml
def new
@asset = Asset.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @asset }
end
end
# GET /assets/1/edit
def edit
@asset = Asset.find(params[:id])
end
# POST /assets
# POST /assets.xml
def create
@asset = Asset.new(params[:asset])
respond_to do |format|
if @asset.save
format.html { redirect_to(@asset, :notice => 'Asset was successfully created.') }
format.xml { render :xml => @asset, :status => :created, :location => @asset }
else
format.html { render :action => "new" }
format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }
end
end
end
# PUT /assets/1
# PUT /assets/1.xml
def update
@asset = Asset.find(params[:id])
respond_to do |format|
if @asset.update_attributes(params[:asset])
format.html { redirect_to(@asset, :notice => 'Asset was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /assets/1
# DELETE /assets/1.xml
def destroy
@asset = Asset.find(params[:id])
@asset.destroy
respond_to do |format|
format.html { redirect_to(assets_url) }
format.xml { head :ok }
end
end
end

View File

@@ -0,0 +1,8 @@
class CommentsController < ApplicationController
def create
@asset = Asset.find(params[:asset_id])
params[:comment][:commenter] = current_user.name
@comment = @asset.comments.create!(params[:comment])
redirect_to @asset
end
end

View File

@@ -0,0 +1,93 @@
class SoftwaresController < ApplicationController
before_filter :authenticate_user!
INDEX_SORT = SortIndex::Config.new(
{'updated_at' => 'updated_at'},
{'company' => 'company', 'version' => 'version', 'key' => 'key', 'platform' => 'platform', 'media_location' => 'media_location', 'asset_id' => 'asset_id', 'installed' => 'installed', 'installed_by' => 'installed_by', 'modified' => 'modified', 'modified_by' => 'modified_by', 'note' => 'note'}
)
# GET /softwares
# GET /softwares.xml
def index
@sortable = SortIndex::Sortable.new(params, INDEX_SORT)
@softwares = Software.find(:all, :order => (params[:sort_by] || "TRIM(LOWER(company))") + " " + (params[:sort_direction] || "asc"))
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @softwares }
end
end
# GET /softwares/1
# GET /softwares/1.xml
def show
@software = Software.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @software }
end
end
# GET /softwares/new
# GET /softwares/new.xml
def new
@assets = Asset.all
@software = Software.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @software }
end
end
# GET /softwares/1/edit
def edit
@assets = Asset.all()
@software = Software.find(params[:id])
end
# POST /softwares
# POST /softwares.xml
def create
@software = Software.new(params[:software])
@software.modified_by = current_user.name
logger.debug @software
respond_to do |format|
if @software.save
format.html { redirect_to(@software, :notice => 'Software was successfully created.') }
format.xml { render :xml => @software, :status => :created, :location => @software }
else
format.html { render :action => "new" }
format.xml { render :xml => @software.errors, :status => :unprocessable_entity }
end
end
end
# PUT /softwares/1
# PUT /softwares/1.xml
def update
@software = Software.find(params[:id])
@software.modified_by = current_user.name
respond_to do |format|
if @software.update_attributes(params[:software])
format.html { redirect_to(@software, :notice => 'Software was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @software.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /softwares/1
# DELETE /softwares/1.xml
def destroy
@software = Software.find(params[:id])
@software.destroy
respond_to do |format|
format.html { redirect_to(softwares_url) }
format.xml { head :ok }
end
end
end

View File

@@ -0,0 +1,3 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end

2
app/helpers/assets_helper.rb Executable file
View File

@@ -0,0 +1,2 @@
module AssetsHelper
end

2
app/helpers/comments_helper.rb Executable file
View File

@@ -0,0 +1,2 @@
module CommentsHelper
end

View File

@@ -0,0 +1,2 @@
module SoftwaresHelper
end

9
app/models/asset.rb Executable file
View File

@@ -0,0 +1,9 @@
class Asset < ActiveRecord::Base
validates_presence_of :tag, :category
has_many :comments
has_many :softwares
def tag_with_name
"#{tag} - #{name}"
end
end

4
app/models/comment.rb Executable file
View File

@@ -0,0 +1,4 @@
class Comment < ActiveRecord::Base
validates_presence_of :commenter, :body
belongs_to :asset
end

4
app/models/software.rb Executable file
View File

@@ -0,0 +1,4 @@
class Software < ActiveRecord::Base
validates_presence_of :version, :platform
belongs_to :asset
end

9
app/models/user.rb Executable file
View File

@@ -0,0 +1,9 @@
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :http_authenticatable, :token_authenticatable, :confirmable, :recoverable, :lockable,
# :registerable, :timeoutable, :activatable, :registerable
devise :database_authenticatable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :name, :email, :password, :password_confirmation
end

View File

@@ -0,0 +1,32 @@
<h1>Asset</h1>
<table>
<tr>
<th class="tableshow">Tag</th>
<th class="tableshow">Network Name</th>
<th class="tableshow">Make</th>
<th class="tableshow">Model</th>
<th class="tableshow">Serial</th>
<th class="tableshow">Category</th>
<th class="tableshow">Warranty Expires</th>
<th class="tableshow">Location</th>
<th class="tableshow">Assigned To</th>
<th class="tableshow">Status</th>
<th class="tableshow">Updated</th>
</tr>
<tr>
<td class="tableshow"><%=h asset.tag %></td>
<td class="tableshow"><%=h asset.name %></td>
<td class="tableshow"><%=h asset.make %></td>
<td class="tableshow"><%=h asset.model %></td>
<td class="tableshow"><%=h asset.serial %></td>
<td class="tableshow"><%=h asset.category %></td>
<td class="tableshow"><%=h asset.warranty %></td>
<td class="tableshow"><%=h asset.location %></td>
<td class="tableshow"><%=h asset.assigned %></td>
<td class="tableshow"><%=h asset.status %></td>
<td class="tableshow"><%=h asset.updated %></td>
</tr>
</table>

57
app/views/assets/edit.html.erb Executable file
View File

@@ -0,0 +1,57 @@
<h1>Editing asset</h1>
<% form_for(@asset) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :tag %><br />
<%= f.text_field :tag %>
</p>
<p>
<%= f.label :name, "Network Name" %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :make %><br />
<%= f.text_field :make %>
</p>
<p>
<%= f.label :model %><br />
<%= f.text_field :model %>
</p>
<p>
<%= f.label :serial %><br />
<%= f.text_field :serial %>
</p>
<p>
<%= f.label :category %><br />
<%= f.text_field :category %>
</p>
<p>
<%= f.label :warranty, "Warranty Expires" %><br />
<%= f.date_select :warranty %>
</p>
<p>
<%= f.label :location %><br />
<%= f.text_field :location %>
</p>
<p>
<%= f.label :assigned, "Assigned To" %><br />
<%= f.text_field :assigned %>
</p>
<p>
<%= f.label :status %><br />
<%= f.text_field :status %>
</p>
<p>
<%= f.label :updated %><br />
<%= f.date_select :updated %>
</p>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Show', @asset %> |
<%= link_to 'Back', assets_path %>

51
app/views/assets/index.html.erb Executable file
View File

@@ -0,0 +1,51 @@
<ul>
<li>
<a href="/assets/">Assets</a>
</li>
<li>
<a href="/softwares/">Softwares</a>
</li>
<li>
<a href="/users/logout/">Logout</a>
</li>
</ul>
<br />
<%= link_to 'New asset', new_asset_path %>
<h1>Listing assets</h1>
<table class="assettable">
<tr>
<%= @sortable.header_link('tag', 'Tag') %>
<%= @sortable.header_link('name', 'Network Name') %>
<%= @sortable.header_link('make', 'Make') %>
<%= @sortable.header_link('make', 'Model') %>
<%= @sortable.header_link('serial', 'Serial') %>
<%= @sortable.header_link('category', 'Category') %>
<%= @sortable.header_link('warranty', 'Warranty Expires') %>
<%= @sortable.header_link('location', 'Location') %>
<%= @sortable.header_link('assigned', 'Assigned') %>
<%= @sortable.header_link('status', 'Status') %>
<%= @sortable.header_link('updated', 'Updated') %>
</tr>
<% for asset in @assets %>
<tr class="<%= cycle('oddrow', 'evenrow') %>">
<td class="smallcolumntag"><%= asset.tag %></td>
<td class="smallcolumn"><%= asset.name %></td>
<td class="smallcolumn"><%= asset.make %></td>
<td class="smallcolumn"><%= asset.model %></td>
<td class="smallcolumn"><%= asset.serial %></td>
<td class="smallcolumn"><%= asset.category %></td>
<td class="smallcolumn"><%= asset.warranty %></td>
<td class="smallcolumn"><%= asset.location %></td>
<td class="smallcolumn"><%= asset.assigned %></td>
<td class="smallcolumn"><%= asset.status %></td>
<td class="smallcolumn"><%= asset.updated %></td>
<td class="sed"><%= link_to 'Show ', asset %></td>
<td class="sed"><%= link_to 'Edit ', edit_asset_path(asset) %></td>
<td class="sed"><%= link_to 'Destroy', asset, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>

55
app/views/assets/new.html.erb Executable file
View File

@@ -0,0 +1,55 @@
<h1>New asset</h1>
<% form_for(@asset) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :tag %><br />
<%= f.text_field :tag %>
</p>
<p>
<%= f.label :name, "Network Name" %><br />
<%= f.text_field :name %>
</p>
<p>
<%= f.label :make %><br />
<%= f.text_field :make %>
</p>
<p>
<%= f.label :model %><br />
<%= f.text_field :model %>
</p>
<p>
<%= f.label :serial %><br />
<%= f.text_field :serial %>
</p>
<p>
<%= f.label :category %><br />
<%= f.text_field :category %>
</p>
<p>
<%= f.label :warranty, "Warranty Expires" %><br />
<%= f.date_select :warranty %>
</p>
<p>
<%= f.label :location %><br />
<%= f.text_field :location %>
</p>
<p>
<%= f.label :assigned, "Assigned To" %><br />
<%= f.text_field :assigned %>
</p>
<p>
<%= f.label :status %><br />
<%= f.text_field :status %>
</p>
<p>
<%= f.label :updated %><br />
<%= f.date_select :updated %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
<%= link_to 'Back', assets_path %>

40
app/views/assets/show.html.erb Executable file
View File

@@ -0,0 +1,40 @@
<%= render :partial => @asset %>
<p>
<%= link_to 'Edit', edit_asset_path(@asset) %> |
<%= link_to 'Destroy', @asset, :method => :delete, :confirm => "Are you sure?" %> <br/>
<strong><%= link_to 'See All Assets', assets_path %></strong>
</p>
<h2>Softwares</h2>
<div id="softwares"></div>
<table>
<tr>
<th>Company</th>
<th>Version</th>
<th>Product Key</th>
<th>Platform</th>
<th>Media Location</th>
<th>Installed</th>
<th>Installed By</th>
<th>Modified By</th>
<th>Note</th>
</tr>
<%= render :partial => @asset.softwares %>
</table>
<%= link_to 'New Software', new_software_path %>
<h2>Comments</h2>
<div id="comments">
<%= render :partial => @asset.comments.reverse %>
<% form_for [@asset, Comment.new] do |f| %>
<p>
<%= f.label :body, "New Comment" %><br />
<%= f.text_area :body, :class => "comment_body" %>
</p>
<p><%= f.submit "Add Comment" %></p>
<% end %>
</div>

View File

@@ -0,0 +1,8 @@
<% div_for comment do %>
<h3>Posted <%= comment.created_at.to_s(:long) %> by <%= comment.commenter %></h3>
<p>
<%= h(comment.body) %>
</p>
<% end %>

View File

@@ -0,0 +1,24 @@
<h1>Editing comment</h1>
<% form_for(@comment) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :post_id %><br />
<%= f.text_field :post_id %>
</p>
<p>
<%= f.label :commenter %><br />
<%= f.text_field :commenter %>
</p>
<p>
<%= f.label :body %><br />
<%= f.text_area :body %>
</p>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Show', @comment %> |
<%= link_to 'Back', comments_path %>

View File

@@ -0,0 +1,24 @@
<h1>Listing comments</h1>
<table>
<tr>
<th>Post</th>
<th>Commenter</th>
<th>Body</th>
</tr>
<% @comments.each do |comment| %>
<tr>
<td><%=h comment.post_id %></td>
<td><%=h comment.commenter %></td>
<td><%=h comment.body %></td>
<td><%= link_to 'Show', comment %></td>
<td><%= link_to 'Edit', edit_comment_path(comment) %></td>
<td><%= link_to 'Destroy', comment, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New comment', new_comment_path %>

19
app/views/comments/new.html.erb Executable file
View File

@@ -0,0 +1,19 @@
<h1>New comment</h1>
<% form_for(@comment) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :post_id %><br />
<%= f.text_field :post_id %>
</p>
<p>
<%= f.label :body %><br />
<%= f.text_area :body %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
<%= link_to 'Back', comments_path %>

View File

@@ -0,0 +1,18 @@
<p>
<b>Post:</b>
<%=h @comment.post_id %>
</p>
<p>
<b>Commenter:</b>
<%=h @comment.commenter %>
</p>
<p>
<b>Body:</b>
<%=h @comment.body %>
</p>
<%= link_to 'Edit', edit_comment_path(@comment) %> |
<%= link_to 'Back', comments_path %>

View File

@@ -0,0 +1,12 @@
<h2>Resend confirmation instructions</h2>
<% form_for resource_name, resource, :url => confirmation_path(resource_name) do |f| %>
<%= f.error_messages %>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>
<p><%= f.submit "Resend confirmation instructions" %></p>
<% end %>
<%= render :partial => "shared/devise_links" %>

View File

@@ -0,0 +1,5 @@
<p>Welcome <%= @resource.email %>!</p>
<p>You can confirm your account through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>

View File

@@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

View File

@@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Assets: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= stylesheet_link_tag 'assets' %>
</head>
<body>
<p style="color: green"><%= notice %></p>
<%= yield %>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Comments: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
</head>
<body>
<p style="color: green"><%= notice %></p>
<%= yield %>
</body>
</html>

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Softwares: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= stylesheet_link_tag 'assets' %>
</head>
<body>
<p style="color: green"><%= notice %></p>
<%= yield %>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<h2>Change your password</h2>
<% form_for resource_name, resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :reset_password_token %>
<p><%= f.label :password %></p>
<p><%= f.password_field :password %></p>
<p><%= f.label :password_confirmation %></p>
<p><%= f.password_field :password_confirmation %></p>
<p><%= f.submit "Change my password" %></p>
<% end %>
<%= render :partial => "shared/devise_links" %>

View File

@@ -0,0 +1,12 @@
<h2>Forgot your password?</h2>
<% form_for resource_name, resource, :url => password_path(resource_name) do |f| %>
<%= f.error_messages %>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>
<p><%= f.submit "Send me reset password instructions" %></p>
<% end %>
<%= render :partial => "shared/devise_links" %>

View File

@@ -0,0 +1,25 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<% form_for resource_name, resource, :url => registration_path(resource_name), :html => { :method => :put } do |f| -%>
<%= f.error_messages %>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i></p>
<p><%= f.password_field :password %></p>
<p><%= f.label :password_confirmation %></p>
<p><%= f.password_field :password_confirmation %></p>
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i></p>
<p><%= f.password_field :current_password %></p>
<p><%= f.submit "Update" %></p>
<% end -%>
<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%= render :partial => "shared/devise_links" %>

View File

@@ -0,0 +1,17 @@
<h2>Sign up</h2>
<% form_for resource_name, resource, :url => registration_path(resource_name) do |f| -%>
<%= f.error_messages %>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>
<p><%= f.label :password %></p>
<p><%= f.password_field :password %></p>
<p><%= f.label :password_confirmation %></p>
<p><%= f.password_field :password_confirmation %></p>
<p><%= f.submit "Sign up" %></p>
<% end -%>
<%= render :partial => "shared/devise_links" %>

17
app/views/sessions/new.html.erb Executable file
View File

@@ -0,0 +1,17 @@
<h2>Sign in</h2>
<% form_for resource_name, resource, :url => session_path(resource_name) do |f| -%>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>
<p><%= f.label :password %></p>
<p><%= 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 => "shared/devise_links" %>

View File

@@ -0,0 +1,19 @@
<%- if controller_name != 'sessions' %>
<%= link_to t('devise.sessions.link'), new_session_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to t('devise.registrations.link'), new_registration_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
<%= link_to t('devise.passwords.link'), new_password_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to t('devise.confirmations.link'), new_confirmation_path(resource_name) %><br />
<% end -%>
<%- if devise_mapping.lockable? && controller_name != 'unlocks' %>
<%= link_to t('devise.unlocks.link'), new_unlock_path(resource_name) %><br />
<% end -%>

View File

@@ -0,0 +1,14 @@
<tr>
<td><%= h(software.company) %></td>
<td><%= h(software.version) %></td>
<td><%= h(software.key) %></td>
<td><%= h(software.platform) %></td>
<td><%= h(software.media_location) %></td>
<td><%= h(software.installed) %></td>
<td><%= h(software.installed_by) %></td>
<td><%= h(software.modified_by) %></td>
<td><%= h(software.note) %></td>
<td><%= link_to 'Show', software %></td>
<td><%= link_to 'Edit', edit_software_path(@software) %></td>
</tr>

View File

@@ -0,0 +1,48 @@
<h1>Editing software</h1>
<% form_for(@software) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :company %><br />
<%= f.text_field :company %>
</p>
<p>
<%= f.label :version %><br />
<%= f.text_field :version %>
</p>
<p>
<%= f.label :key %><br />
<%= f.text_field :key %>
</p>
<p>
<%= f.label :platform %><br />
<%= f.text_field :platform %>
</p>
<p>
<%= f.label :asset_id %><br />
<%= select(:software, :asset_id, options_from_collection_for_select(Asset.find (:all, :order => "tag").sort {|x,y| x.tag.to_i <=> y.tag.to_i }, :id, :tag_with_name ) ) %>
</p>
<p>
<%= f.label :media_location %><br />
<%= f.text_field :media_location %>
</p>
<p>
<%= f.label :installed %><br />
<%= f.date_select :installed %>
</p>
<p>
<%= f.label :installed_by %><br />
<%= f.text_field :installed_by %>
</p>
<p>
<%= f.label :note %><br />
<%= f.text_field :note %>
</p>
<p>
<%= f.submit 'Update' %>
</p>
<% end %>
<%= link_to 'Show', @software %> |
<%= link_to 'Back', softwares_path %>

View File

@@ -0,0 +1,49 @@
<ul>
<li>
<a href="/assets/">Assets</a>
</li>
<li>
<a href="/softwares/">Softwares</a>
</li>
<li>
<a href="/users/logout/">Logout</a>
</li>
</ul>
<br />
<%= link_to 'New software', new_software_path %>
<h1>Listing softwares</h1>
<table class="assettable">
<tr>
<%= @sortable.header_link('company', 'Company') %>
<%= @sortable.header_link('version', 'Version') %>
<%= @sortable.header_link('key', 'Product Key') %>
<%= @sortable.header_link('platform', 'Platform') %>
<%= @sortable.header_link('media_location', 'Media Locaion') %>
<%= @sortable.header_link('asset_id', 'Asset') %>
<%= @sortable.header_link('installed', 'Installed') %>
<%= @sortable.header_link('installed_by', 'Installed By') %>
<%= @sortable.header_link('modified_by', 'Modified by') %>
<%= @sortable.header_link('note', 'Note') %>
</tr>
<% for software in @softwares %>
<tr class="<%= cycle('oddrow', 'evenrow') %>">
<td class="smallcolumntag"><%= software.company %></td>
<td class="smallcolumn"><%= software.version %></td>
<td class="importantcolumn"><%= software.key %></td>
<td class="smallercolumn"><%= software.platform %></td>
<td class="smallcolumn"><%= software.media_location %></td>
<td class="smallcolumn"><%= software.asset.tag_with_name if !software.asset.blank?%></td>
<td class="smallercolumn"><%= software.installed %></td>
<td class="smallcolumn"><%= software.installed_by %></td>
<td class="smallcolumn"><%= software.modified_by %></td>
<td class="mediumcolumn"><%= software.note %></td>
<td class="sed"><%= link_to 'Show', software %></td>
<td class="sed"><%= link_to 'Edit', edit_software_path(software) %></td>
<td class="sed"><%= link_to 'Destroy', software, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>

View File

@@ -0,0 +1,47 @@
<h1>New software</h1>
<% form_for(@software) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :company %><br />
<%= f.text_field :company %>
</p>
<p>
<%= f.label :version %><br />
<%= f.text_field :version %>
</p>
<p>
<%= f.label :key %><br />
<%= f.text_field :key %>
</p>
<p>
<%= f.label :platform %><br />
<%= f.text_field :platform %>
</p>
<p>
<%= f.label :asset_id %><br />
<%= select(:software, :asset_id, options_from_collection_for_select(Asset.find (:all, :order => "tag").sort {|x,y| x.tag.to_i <=> y.tag.to_i }, :id, :tag_with_name ) ) %>
</p>
<p>
<%= f.label :media_location %><br />
<%= f.text_field :media_location %>
</p>
<p>
<%= f.label :installed %><br />
<%= f.date_select :installed %>
</p>
<p>
<%= f.label :installed_by %><br />
<%= f.text_field :installed_by %>
</p>
<p>
<%= f.label :note %><br />
<%= f.text_field :note %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
<%= link_to 'Back', softwares_path %>

View File

@@ -0,0 +1,55 @@
<p>
<b>Company:</b>
<%= @software.company %>
</p>
<p>
<b>Version:</b>
<%= @software.version %>
</p>
<p>
<b>Product Key:</b>
<%= @software.key %>
</p>
<p>
<b>Platform:</b>
<%= @software.platform %>
</p>
<p>
<b>Asset:</b>
<%= @software.asset.tag_with_name if !@software.asset.blank? %>
</p>
<p>
<b>Media Location:</b>
<%= @software.media_location %>
</p>
<p>
<b>Installed:</b>
<%= @software.installed %>
</p>
<p>
<b>Installed by:</b>
<%= @software.installed_by %>
</p>
<p>
<p>
<b>Modified by:</b>
<%= @software.modified_by %>
</p>
<p>
<b>Note:</b>
<%= @software.note %>
</p>
<%= link_to 'Edit', edit_software_path(@software) %> |
<%= link_to 'Back', softwares_path %>

12
app/views/unlocks/new.html.erb Executable file
View File

@@ -0,0 +1,12 @@
<h2>Resend unlock instructions</h2>
<% form_for resource_name, resource, :url => unlock_path(resource_name) do |f| %>
<%= f.error_messages %>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>
<p><%= f.submit "Resend unlock instructions" %></p>
<% end %>
<%= render :partial => "shared/devise_links" %>