Skip to content

Commit

Permalink
Missed some fils on that last commit. I've started building out the m…
Browse files Browse the repository at this point in the history
…onitoring setup, and some other cool features for Suite. [#17]
  • Loading branch information
Jonathan Hoyt authored and Jonathan Hoyt committed Dec 13, 2008
1 parent 0a681b2 commit 7c595f6
Show file tree
Hide file tree
Showing 24 changed files with 110 additions and 97 deletions.
2 changes: 1 addition & 1 deletion app/controllers/checklist_templates_controller.rb
@@ -1,6 +1,6 @@
class ChecklistTemplatesController < ApplicationController
before_filter :login_required
layout 'checklists'
layout 'settings'

def index
@checklists = ChecklistTemplate.find(:all)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/device_types_controller.rb
@@ -1,6 +1,6 @@
class DeviceTypesController < ApplicationController
before_filter :login_required
layout 'devices'
layout 'settings'

def index
@device_types = DeviceType.find(:all)
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/address_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/devices_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/email_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/inventory_items_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/passwords_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/phone_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/sessions_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/things_helper.rb

This file was deleted.

1 change: 1 addition & 0 deletions app/models/device.rb
Expand Up @@ -4,6 +4,7 @@ class Device < ActiveRecord::Base
has_and_belongs_to_many :tickets
has_many :checklists, :dependent => :destroy
has_many :things, :as => :attached, :dependent => :destroy
has_many :sentries

validates_uniqueness_of :service_tag
validates_presence_of :client_id, :device_type_id
Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Expand Up @@ -18,6 +18,7 @@ class User < ActiveRecord::Base
# Relationships
has_and_belongs_to_many :roles
has_one :client
has_many :schedules

has_attached_file :avatar,
:styles => { :avatar => "50x50#" }
Expand Down
9 changes: 8 additions & 1 deletion app/views/checklist_templates/edit.html.erb
Expand Up @@ -2,4 +2,11 @@
<h2 alt="edit">Editing <%= @checklist.name %> Checklist</h2>

<%= render :partial => 'form' %>
</div>
</div>

<script>
$(document).ready(function() {
// make sidebar item appear selected
$("#sidebar li a.checklist_template_configuration").parent().addClass("selected");
});
</script>
11 changes: 10 additions & 1 deletion app/views/checklist_templates/index.html.erb
Expand Up @@ -14,4 +14,13 @@
<% end %>
</tbody>
</table>
</div>
</div>

<script>
$(document).ready(function() {
// make sidebar item appear selected
$("#sidebar li a.checklist_template_configuration").parent().addClass("selected");
// add new device type button to footer
$("#footer div.col2").append("<a href='/checklist_templates/new'>New Checklist Template</a>");
});
</script>
9 changes: 8 additions & 1 deletion app/views/checklist_templates/new.html.erb
Expand Up @@ -2,4 +2,11 @@
<h2 alt="edit">New Checklist</h2>

<%= render :partial => 'form' %>
</div>
</div>

<script>
$(document).ready(function() {
// make sidebar item appear selected
$("#sidebar li a.checklist_template_configuration").parent().addClass("selected");
});
</script>
1 change: 1 addition & 0 deletions app/views/checklist_templates/show.html.erb
Expand Up @@ -66,5 +66,6 @@
$("a.add_device_type_association").bind("click", function(){
$("#device_types").parent().slideDown(1000);
});
$("#sidebar li a.checklist_template_configuration").parent().addClass("selected");
});
</script>
43 changes: 0 additions & 43 deletions app/views/layouts/checklists.html.erb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/layouts/clients.html.erb
Expand Up @@ -18,7 +18,7 @@
<li><a href="/clients">Clients</a></li>
<li><a href="/tickets">Tickets</a></li>
<li><a href="/devices">Devices</a></li>
<li><a href="/checklist_templates">Checklists</a></li>
<li><a href="/settings">Settings</a></li>
</ul>
<div class="flash"><%= flash_messages %></div>
</div>
Expand Down
6 changes: 1 addition & 5 deletions app/views/layouts/devices.html.erb
Expand Up @@ -17,7 +17,7 @@
<li><a href="/clients">Clients</a></li>
<li><a href="/tickets">Tickets</a></li>
<li><a href="/devices">Devices</a></li>
<li><a href="/checklist_templates">Checklists</a></li>
<li><a href="/settings">Settings</a></li>
</ul>
<div class="flash"><%= flash_messages %></div>
</div>
Expand All @@ -28,10 +28,6 @@
<ul id="devices" class="itu">
<li><a href="/devices" class="search">Search</a></li>
</ul>
<h2>Configuration</h2>
<ul id="configuration" class="itu">
<li><a href="/device_types" class="device_type_configuration">Device Types</a></li>
</ul>
</div>
<div id="center" class="container">
<%= yield %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/tickets.html.erb
Expand Up @@ -19,7 +19,7 @@
<li><a href="/clients">Clients</a></li>
<li><a href="/tickets">Tickets</a></li>
<li><a href="/devices">Devices</a></li>
<li><a href="/checklist_templates">Checklists</a></li>
<li><a href="/settings">Settings</a></li>
</ul>
</div>

Expand Down
49 changes: 25 additions & 24 deletions config/routes.rb
@@ -1,6 +1,6 @@
ActionController::Routing::Routes.draw do |map|

# Restful Authentication Rewrites
# Restful Authentication
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.login '/login', :controller => 'sessions', :action => 'new'
map.register '/register', :controller => 'users', :action => 'create'
Expand All @@ -9,54 +9,51 @@
map.forgot_password '/forgot_password', :controller => 'passwords', :action => 'new'
map.change_password '/change_password/:reset_code', :controller => 'passwords', :action => 'reset'
map.create_password '/create_password/:reset_code', :controller => 'passwords', :action => 'create_password'

# Restful Authentication Resources
map.resources :users
map.resources :passwords
map.resource :session

map.resources :attachments

map.client_list '/clients/list', :controller => 'clients', :action => 'list'

map.search_clients '/clients/search', :controller => 'clients', :action => 'search'
# Main Resources
map.resources :clients do |client|
client.resources :tickets
client.resources :devices
client.resources :users
end

map.search_tickets '/tickets/search', :controller => 'tickets', :action => 'search'
map.resources :ticket_entries
map.resources :tickets do |ticket|
ticket.resources :ticket_entries
ticket.resources :devices
ticket.resources :checklists
end

map.resources :device_types

map.resources :devices do |device|
device.resources :checklists
device.resources :tickets
device.resources :sentries
end


# Secondary Resources
map.resources :ticket_entries
map.resources :device_types
map.resources :sentries do |sentry|
sentry.resources :events
end
map.resources :settings
map.resources :things
map.resources :checklists
map.resources :checklist_templates
map.resources :goggles
map.resources :schedules

# Custom Routes
map.search_clients '/clients/search', :controller => 'clients', :action => 'search'
map.client_list '/clients/list', :controller => 'clients', :action => 'list'
map.search_tickets '/tickets/search', :controller => 'tickets', :action => 'search'
map.device_details '/tickets/:ticket_id/devices/:id/details', :controller => 'devices', :action => 'details'
map.add_to_ticket '/tickets/:ticket_id/devices/:id/add_to_ticket', :controller => 'devices', :action => 'add_to_ticket'
map.remove_device_from_ticket '/tickets/:ticket_id/devices/:id/remove_from_ticket', :controller => 'devices', :action => 'remove_from_ticket'

map.resources :checklists
map.remove_checklist_from_ticket '/tickets/:ticket_id/checklists/:id/remove_from_ticket', :controller => 'checklists', :action => 'remove_from_ticket'

map.resources :checklist_templates
map.add_association '/checklist_templates/:checklist_template_id/device_types/:id/add_association', :controller => 'checklist_templates', :action => "add_assocation"
map.remove_association '/checklist_templates/:checklist_template_id/device_types/:id/remove_association', :controller => 'checklist_templates', :action => "remove_assocation"

# Home Page
map.root :controller => 'tickets', :action => 'index'

map.remove_checklist_from_ticket '/tickets/:ticket_id/checklists/:id/remove_from_ticket', :controller => 'checklists', :action => 'remove_from_ticket'

# iPhone routes
map.namespace :iphone do |iphone|
iphone.resources :clients do |client|
Expand All @@ -72,6 +69,10 @@
iphone.root :controller => 'clients', :action => 'home'
end

# Home Page
map.root :controller => 'tickets', :action => 'index'

# Last but not least
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

Expand Down
6 changes: 6 additions & 0 deletions config/settings.yml.example
Expand Up @@ -2,6 +2,9 @@ development: &non_production_settings
site_url: http://localhost:3000
site_name: Suite
admin_email: youremail@domain.com
# we use https://www.grc.com/passwords.htm to generate some unique strings
event_api_username: ln4A9DvHOs2qZXTLOg8hPx5jV5cClb9Emra129Fi0Q2cqcMvIysiL0XCSKcu5S6
event_api_password: MPQ1CBykdvLmcjRs9el0DKbKMEkdGJPT2OD4Dn1jtXNZMSoHy8f8ViMt6auJhu3

test:
<<: *non_production_settings
Expand All @@ -10,3 +13,6 @@ production:
site_url: http://suite.yourdomain.com
site_name: Suite
admin_email: youremail@domain.com
# we use https://www.grc.com/passwords.htm to generate some unique strings
event_api_username: ln4A9DvHOs2qZXTLOg8hPx5jV5cClb9Emra129Fi0Q2cqcMvIysiL0XCSKcu5S6
event_api_password: MPQ1CBykdvLmcjRs9el0DKbKMEkdGJPT2OD4Dn1jtXNZMSoHy8f8ViMt6auJhu3
46 changes: 45 additions & 1 deletion db/schema.rb
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20081211230915) do
ActiveRecord::Schema.define(:version => 20081212174923) do

create_table "addresses", :force => true do |t|
t.string "context", :default => "Work", :null => false
Expand Down Expand Up @@ -119,6 +119,25 @@
t.datetime "updated_at"
end

create_table "events", :force => true do |t|
t.string "recordable_type"
t.integer "recordable_id"
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "goggles", :force => true do |t|
t.string "name"
t.string "script"
t.text "note"
end

create_table "notification_queues", :force => true do |t|
t.text "message"
t.integer "schedule_id"
end

create_table "passwords", :force => true do |t|
t.integer "user_id"
t.string "reset_code"
Expand Down Expand Up @@ -158,6 +177,31 @@
t.integer "user_id"
end

create_table "schedules", :force => true do |t|
t.string "name"
t.boolean "active"
t.integer "user_id"
t.string "start_time"
t.string "end_time"
t.integer "backup_id"
end

create_table "sentries", :force => true do |t|
t.boolean "state"
t.text "message"
t.integer "device_id"
t.string "goggle_parameters"
t.datetime "last_surveyed_at"
t.integer "survey_interval"
t.integer "notifications_to_send"
t.integer "maximum_notify_frequency"
t.integer "notifications_sent"
t.integer "schedule_id"
t.integer "goggle_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "sessions", :force => true do |t|
t.string "session_id", :default => "", :null => false
t.text "data"
Expand Down
1 change: 0 additions & 1 deletion public/stylesheets/devices.css
Expand Up @@ -2,7 +2,6 @@

/* Sidebar */
div.sidebar-list ul#devices li a.search {background:url("/images/icons/find.png") no-repeat;}
div.sidebar-list ul#configuration li a.device_type_configuration {background:url("/images/icons/script_edit.png") no-repeat 0px 1px;}

/* Search box */
#applesearch .sbox input {width:300px;}

0 comments on commit 7c595f6

Please sign in to comment.