watchtower 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +40 -0
  4. data/app/assets/javascripts/watchtower/application.js +15 -0
  5. data/app/assets/javascripts/watchtower/contacts.js +11 -0
  6. data/app/assets/javascripts/watchtower/jquery.jqmodal.js +69 -0
  7. data/app/assets/stylesheets/watchtower/application.css +13 -0
  8. data/app/assets/stylesheets/watchtower/bootstrap.css +610 -0
  9. data/app/assets/stylesheets/watchtower/contacts.css +156 -0
  10. data/app/controllers/watchtower/application_controller.rb +4 -0
  11. data/app/controllers/watchtower/contacts_controller.rb +101 -0
  12. data/app/controllers/watchtower/notes_controller.rb +15 -0
  13. data/app/controllers/watchtower/tags_controller.rb +11 -0
  14. data/app/helpers/watchtower/application_helper.rb +4 -0
  15. data/app/helpers/watchtower/contacts_helper.rb +4 -0
  16. data/app/models/watchtower/address.rb +17 -0
  17. data/app/models/watchtower/contact.rb +54 -0
  18. data/app/models/watchtower/custom_data.rb +4 -0
  19. data/app/models/watchtower/data.rb +15 -0
  20. data/app/models/watchtower/email.rb +4 -0
  21. data/app/models/watchtower/note.rb +13 -0
  22. data/app/models/watchtower/phone.rb +4 -0
  23. data/app/models/watchtower/tag.rb +14 -0
  24. data/app/models/watchtower/tagging.rb +9 -0
  25. data/app/views/layouts/watchtower/application.html.erb +27 -0
  26. data/app/views/watchtower/addresses/_address.html.erb +2 -0
  27. data/app/views/watchtower/contacts/_contact.html.erb +9 -0
  28. data/app/views/watchtower/contacts/_form.html.erb +33 -0
  29. data/app/views/watchtower/contacts/edit.html.erb +6 -0
  30. data/app/views/watchtower/contacts/index.html.erb +23 -0
  31. data/app/views/watchtower/contacts/new.html.erb +5 -0
  32. data/app/views/watchtower/contacts/show.html.erb +77 -0
  33. data/app/views/watchtower/emails/_email.html.erb +1 -0
  34. data/app/views/watchtower/notes/_note.html.erb +1 -0
  35. data/app/views/watchtower/phones/_phone.html.erb +1 -0
  36. data/app/views/watchtower/tags/_tag.html.erb +4 -0
  37. data/app/views/watchtower/tags/index.html.erb +12 -0
  38. data/app/views/watchtower/tags/show.html.erb +23 -0
  39. data/config/routes.rb +10 -0
  40. data/db/migrate/20120616233432_create_watchtower_contacts.rb +12 -0
  41. data/db/migrate/20120616235440_create_watchtower_data.rb +13 -0
  42. data/db/migrate/20120617010925_create_watchtower_addresses.rb +18 -0
  43. data/db/migrate/20120617055914_create_watchtower_notes.rb +13 -0
  44. data/db/migrate/20120617073423_create_watchtower_taggings.rb +12 -0
  45. data/db/migrate/20120617073438_create_watchtower_tags.rb +9 -0
  46. data/lib/tasks/watchtower_tasks.rake +4 -0
  47. data/lib/watchtower.rb +4 -0
  48. data/lib/watchtower/engine.rb +11 -0
  49. data/lib/watchtower/version.rb +3 -0
  50. metadata +164 -0
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Watchtower</title>
5
+ <%= stylesheet_link_tag "watchtower/application", :media => "all" %>
6
+ <%= javascript_include_tag "watchtower/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <div class="navbar navbar-fixed-top">
11
+ <div class="navbar-inner">
12
+ <a class="brand" href="<%= contacts_path %>">Watchtower Demo</a>
13
+ <div class="nav-collapse">
14
+ <ul class="nav">
15
+ <li class="active"><a href="<%= contacts_path %>">Home</a></li>
16
+ <li><a href="<%= contacts_path %>">Contacts</a></li>
17
+ <li><a href="<%= tags_path %>">Categories</a></li>
18
+ <!-- <li><a href="#about">About</a></li>
19
+ <li><a href="#contact">Contact</a></li> -->
20
+ </ul>
21
+ </div><!--/.nav-collapse -->
22
+ </div>
23
+ </div>
24
+ <%= yield %>
25
+
26
+ </body>
27
+ </html>
@@ -0,0 +1,2 @@
1
+ <h4><%= address.kind.try(:humanize) %> </h4>
2
+ <%= simple_format address.full_address %>
@@ -0,0 +1,9 @@
1
+ <tr>
2
+ <td><%= contact.first_name %></td>
3
+ <td><%= contact.last_name %></td>
4
+ <td><%= contact.primary_email %></td>
5
+ <td><%= contact.primary_phone %></td>
6
+ <td><%= link_to 'Show', contact %></td>
7
+ <td><%= link_to 'Edit', edit_contact_path(contact) %></td>
8
+ <td><%= link_to 'Destroy', contact, confirm: 'Are you sure?', method: :delete %></td>
9
+ </tr>
@@ -0,0 +1,33 @@
1
+ <%= form_for(@contact) do |f| %>
2
+ <% if @contact.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @contact.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :first_name %>
16
+ <%= f.text_field :first_name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :last_name %>
20
+ <%= f.text_field :last_name %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :primary_email %>
24
+ <%= f.text_field :primary_email %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :primary_phone %>
28
+ <%= f.text_field :primary_phone %>
29
+ </div>
30
+ <div class="actions">
31
+ <%= f.submit %>
32
+ </div>
33
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing contact</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @contact %> |
6
+ <%= link_to 'Back', contacts_path %>
@@ -0,0 +1,23 @@
1
+ <h1>Contacts</h1>
2
+
3
+ <table class="table table-bordered table-striped">
4
+ <thead>
5
+ <tr>
6
+ <th>First name</th>
7
+ <th>Last name</th>
8
+ <th>Primary email</th>
9
+ <th>Primary phone</th>
10
+ <th></th>
11
+ <th></th>
12
+ <th></th>
13
+ </tr>
14
+ </thead>
15
+
16
+ <tbody>
17
+ <%= render @contacts %>
18
+ </thead>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'New Contact', new_contact_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New contact</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', contacts_path %>
@@ -0,0 +1,77 @@
1
+ <% if notice %>
2
+ <p id="notice" class="alert alert-info"><%= notice %></p>
3
+ <% end %>
4
+
5
+ <h2><%= @contact.full_name %></h3>
6
+ <ul class="tags">
7
+ <% @contact.tags.each do |tag| %>
8
+ <li><span class="label"><%= tag.to_s %></span></li>
9
+ <% end %>
10
+ <li><%= link_to "add", "#", 'data-form' => 'tags' %></li>
11
+ </ul>
12
+ <dl>
13
+ <div>
14
+ <dt>email</dt>
15
+ <dd><%= @contact.primary_email %></dd>
16
+ </div>
17
+ <div>
18
+ <dt>phone</dt>
19
+ <dd><%= @contact.primary_phone %></dd>
20
+ </div>
21
+ <% @contact.custom_data.each do |field| %>
22
+ <div id="custom_data_<%= field.name.parameterize %>">
23
+ <dt><%= field.name %></dt>
24
+ <dd><%= field.content %></dd>
25
+ </div>
26
+ <% end %>
27
+ </dl>
28
+
29
+ <div class="dialog tags" id="tags">
30
+ <h2>Add a Tag</h2>
31
+ <p>
32
+ <%= form_tag tag_contact_path(@contact) do %>
33
+ <div class="field">
34
+ <%= text_field_tag :tag_name %>
35
+ </div>
36
+ <div class="field">
37
+ <%= submit_tag "Add Tag" %>
38
+ </div>
39
+ <% end %>
40
+ </p>
41
+ </div>
42
+
43
+ <div id="sidebar">
44
+ <h3>Email Addresses</h3>
45
+ <ul>
46
+ <li><%= render @contact.emails %></li>
47
+ </ul>
48
+
49
+ <h3>Phone Numbers</h3>
50
+ <ul>
51
+ <li><%= render @contact.phones %></li>
52
+ </ul>
53
+
54
+ <h3>Addresses</h3>
55
+ <ul>
56
+ <li><%= render @contact.addresses %></li>
57
+ </ul>
58
+ </div>
59
+
60
+ <div id="notes">
61
+ <h3> Notes </h3>
62
+ <ul class="notes">
63
+ <%= render @contact.notes %>
64
+ </ul>
65
+ </div>
66
+
67
+ <%= form_for [@contact, @contact.notes.new] do |f| %>
68
+ <div class="field">
69
+ <%= f.text_area :content %>
70
+ </div>
71
+ <div class="field">
72
+ <%= f.submit "Add Note" %>
73
+ </div>
74
+ <% end %>
75
+
76
+ <%= link_to 'Edit', edit_contact_path(@contact) %> |
77
+ <%= link_to 'Back', contacts_path %>
@@ -0,0 +1 @@
1
+ <%= link_to email.to_s, "mailto:#{email.to_s}" %> <%= "(primary)" if email.primary? %>
@@ -0,0 +1 @@
1
+ <li class="note"><%= note.to_s %></li>
@@ -0,0 +1 @@
1
+ <%= phone.to_s %> <%= "(primary)" if phone.primary? %>
@@ -0,0 +1,4 @@
1
+ <tr>
2
+ <td><%= link_to tag.name, tag %></td>
3
+ <td><%= tag.taggings.count %></td>
4
+ </tr>
@@ -0,0 +1,12 @@
1
+ <table class="table table-bordered table-striped">
2
+ <thead>
3
+ <tr>
4
+ <th>Name</th>
5
+ <th>Tag Count</th>
6
+ </tr>
7
+ </thead>
8
+
9
+ <tbody>
10
+ <%= render @tags %>
11
+ </tbody>
12
+ </table>
@@ -0,0 +1,23 @@
1
+ <h1><%= @tag.name %> </h1>
2
+
3
+ <table class="table table-bordered table-striped">
4
+ <thead>
5
+ <tr>
6
+ <th>First name</th>
7
+ <th>Last name</th>
8
+ <th>Primary email</th>
9
+ <th>Primary phone</th>
10
+ <th></th>
11
+ <th></th>
12
+ <th></th>
13
+ </tr>
14
+ </thead>
15
+
16
+ <tbody>
17
+ <%= render @tag.contacts %>
18
+ </thead>
19
+ </table>
20
+
21
+ <br />
22
+
23
+ <%= link_to 'Back', tags_path %>
@@ -0,0 +1,10 @@
1
+ Watchtower::Engine.routes.draw do
2
+ resources :contacts do
3
+ resources :notes
4
+ member do
5
+ post :tag
6
+ end
7
+ end
8
+
9
+ resources :tags
10
+ end
@@ -0,0 +1,12 @@
1
+ class CreateWatchtowerContacts < ActiveRecord::Migration
2
+ def change
3
+ create_table :watchtower_contacts do |t|
4
+ t.string :first_name
5
+ t.string :middle_name
6
+ t.string :last_name
7
+ t.string :gender
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ class CreateWatchtowerData < ActiveRecord::Migration
2
+ def change
3
+ create_table :watchtower_data do |t|
4
+ t.string :name
5
+ t.string :content
6
+ t.string :type
7
+ t.boolean :primary
8
+ t.references :contact
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ class CreateWatchtowerAddresses < ActiveRecord::Migration
2
+ def change
3
+ create_table :watchtower_addresses do |t|
4
+ t.string :address_1
5
+ t.string :address_2
6
+ t.string :address_3
7
+ t.string :city
8
+ t.string :state
9
+ t.string :country
10
+ t.string :postcode
11
+ t.string :name
12
+ t.string :kind
13
+ t.integer :contact_id
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ class CreateWatchtowerNotes < ActiveRecord::Migration
2
+ def change
3
+ create_table :watchtower_notes do |t|
4
+ t.text :content
5
+ t.references :user
6
+ t.references :contact
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :watchtower_notes, :user_id
11
+ add_index :watchtower_notes, :contact_id
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ class CreateWatchtowerTaggings < ActiveRecord::Migration
2
+ def change
3
+ create_table :watchtower_taggings do |t|
4
+ t.references :contact
5
+ t.references :tag
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :watchtower_taggings, :contact_id
10
+ add_index :watchtower_taggings, :tag_id
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class CreateWatchtowerTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :watchtower_tags do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :watchtower do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,4 @@
1
+ require "watchtower/engine"
2
+
3
+ module Watchtower
4
+ end
@@ -0,0 +1,11 @@
1
+ module Watchtower
2
+ mattr_accessor :user_class
3
+
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Watchtower
6
+
7
+ config.generators do |g|
8
+ g.test_framework :rspec
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Watchtower
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: watchtower
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jared Fraser
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.5
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.5
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec-rails
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: capybara
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Rails CRM Engine
79
+ email:
80
+ - dev@jsf.io
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - app/assets/javascripts/watchtower/application.js
86
+ - app/assets/javascripts/watchtower/contacts.js
87
+ - app/assets/javascripts/watchtower/jquery.jqmodal.js
88
+ - app/assets/stylesheets/watchtower/application.css
89
+ - app/assets/stylesheets/watchtower/bootstrap.css
90
+ - app/assets/stylesheets/watchtower/contacts.css
91
+ - app/controllers/watchtower/application_controller.rb
92
+ - app/controllers/watchtower/contacts_controller.rb
93
+ - app/controllers/watchtower/notes_controller.rb
94
+ - app/controllers/watchtower/tags_controller.rb
95
+ - app/helpers/watchtower/application_helper.rb
96
+ - app/helpers/watchtower/contacts_helper.rb
97
+ - app/models/watchtower/address.rb
98
+ - app/models/watchtower/contact.rb
99
+ - app/models/watchtower/custom_data.rb
100
+ - app/models/watchtower/data.rb
101
+ - app/models/watchtower/email.rb
102
+ - app/models/watchtower/note.rb
103
+ - app/models/watchtower/phone.rb
104
+ - app/models/watchtower/tag.rb
105
+ - app/models/watchtower/tagging.rb
106
+ - app/views/layouts/watchtower/application.html.erb
107
+ - app/views/watchtower/addresses/_address.html.erb
108
+ - app/views/watchtower/contacts/_contact.html.erb
109
+ - app/views/watchtower/contacts/_form.html.erb
110
+ - app/views/watchtower/contacts/edit.html.erb
111
+ - app/views/watchtower/contacts/index.html.erb
112
+ - app/views/watchtower/contacts/new.html.erb
113
+ - app/views/watchtower/contacts/show.html.erb
114
+ - app/views/watchtower/emails/_email.html.erb
115
+ - app/views/watchtower/notes/_note.html.erb
116
+ - app/views/watchtower/phones/_phone.html.erb
117
+ - app/views/watchtower/tags/_tag.html.erb
118
+ - app/views/watchtower/tags/index.html.erb
119
+ - app/views/watchtower/tags/show.html.erb
120
+ - config/routes.rb
121
+ - db/migrate/20120616233432_create_watchtower_contacts.rb
122
+ - db/migrate/20120616235440_create_watchtower_data.rb
123
+ - db/migrate/20120617010925_create_watchtower_addresses.rb
124
+ - db/migrate/20120617055914_create_watchtower_notes.rb
125
+ - db/migrate/20120617073423_create_watchtower_taggings.rb
126
+ - db/migrate/20120617073438_create_watchtower_tags.rb
127
+ - lib/tasks/watchtower_tasks.rake
128
+ - lib/watchtower/engine.rb
129
+ - lib/watchtower/version.rb
130
+ - lib/watchtower.rb
131
+ - MIT-LICENSE
132
+ - Rakefile
133
+ - README.rdoc
134
+ homepage: http://github.com/modsognir/watchtower
135
+ licenses: []
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ segments:
147
+ - 0
148
+ hash: 2711553261453973046
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ segments:
156
+ - 0
157
+ hash: 2711553261453973046
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 1.8.24
161
+ signing_key:
162
+ specification_version: 3
163
+ summary: Rails CRM Engine
164
+ test_files: []