ifd_tools 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +28 -0
  3. data/Rakefile +40 -0
  4. data/app/admin/emergency_messages.rb +33 -0
  5. data/app/admin/notifier_updates.rb +42 -0
  6. data/app/admin/software_updates.rb +42 -0
  7. data/app/admin/users.rb +48 -0
  8. data/app/assets/javascripts/ifd_tools/base.js +4 -0
  9. data/app/assets/javascripts/ifd_tools/fusion_charts.js +361 -0
  10. data/app/assets/stylesheets/ifd_tools/active_admin/_analytics.scss +32 -0
  11. data/app/assets/stylesheets/ifd_tools/active_admin/_cleanup.scss +15 -0
  12. data/app/assets/stylesheets/ifd_tools/active_admin/_footer.scss +87 -0
  13. data/app/assets/stylesheets/ifd_tools/active_admin/_square_admin_buttons.scss +27 -0
  14. data/app/assets/stylesheets/ifd_tools/base.scss +4 -0
  15. data/app/assets/swfs/FCF_Area2D.swf +0 -0
  16. data/app/assets/swfs/usa_map.swf +0 -0
  17. data/app/controllers/ifd_tools/application_controller.rb +4 -0
  18. data/app/helpers/ifd_tools/application_helper.rb +30 -0
  19. data/app/models/ifd_tools/emergency_message.rb +27 -0
  20. data/app/models/ifd_tools/notifier_update.rb +28 -0
  21. data/app/models/ifd_tools/software_update.rb +28 -0
  22. data/app/models/ifd_tools/tracking/application_event.rb +6 -0
  23. data/app/models/ifd_tools/tracking/event.rb +51 -0
  24. data/app/models/ifd_tools/tracking.rb +7 -0
  25. data/app/uploaders/software_uploader.rb +18 -0
  26. data/app/views/admin/customers/_trend.html.haml +7 -0
  27. data/app/views/admin/customers/_trend_info_sidebar.html.haml +11 -0
  28. data/app/views/admin/customers/demographic_data.builder +11 -0
  29. data/app/views/admin/customers/events_data.builder +6 -0
  30. data/app/views/admin/customers/filter_events.js.erb +6 -0
  31. data/app/views/admin/customers/trends.html.haml +11 -0
  32. data/app/views/admin/dashboard/_line_graph.html.haml +11 -0
  33. data/app/views/admin/dashboard/_usa_map.html.haml +2 -0
  34. data/app/views/admin/emergency_messages/_form.html.haml +6 -0
  35. data/app/views/admin/notifier_updates/_form.html.haml +9 -0
  36. data/app/views/admin/shared/_footer.html.haml +6 -0
  37. data/app/views/admin/software_updates/_form.html.haml +9 -0
  38. data/app/views/admin/users/_form.html.haml +9 -0
  39. data/app/views/api/emergency_messages.builder +12 -0
  40. data/app/views/api/notifier_updates.builder +15 -0
  41. data/app/views/api/software_updates.builder +15 -0
  42. data/app/views/api/track.builder +6 -0
  43. data/app/views/layouts/ifd_tools/application.html.erb +14 -0
  44. data/config/routes.rb +2 -0
  45. data/db/migrate/20121010183004_create_ifd_tools_emergency_messages.rb +11 -0
  46. data/db/migrate/20121011150939_create_ifd_tools_notifier_updates.rb +14 -0
  47. data/db/migrate/20121011151124_create_ifd_tools_software_updates.rb +14 -0
  48. data/db/migrate/20121011205911_devise_create_users.rb +57 -0
  49. data/db/migrate/20121012123505_create_customers.rb +52 -0
  50. data/db/migrate/20121012133303_create_ifd_tools_tracking_events.rb +14 -0
  51. data/lib/generators/ifd_tools/install/USAGE +5 -0
  52. data/lib/generators/ifd_tools/install/install_generator.rb +153 -0
  53. data/lib/generators/ifd_tools/install/templates/admin/customers.rb +108 -0
  54. data/lib/generators/ifd_tools/install/templates/admin/dashboard.rb +47 -0
  55. data/lib/generators/ifd_tools/install/templates/assets/active_admin.css.scss +7 -0
  56. data/lib/generators/ifd_tools/install/templates/assets/active_admin.js +2 -0
  57. data/lib/generators/ifd_tools/install/templates/assets/application.css.scss +46 -0
  58. data/lib/generators/ifd_tools/install/templates/assets/application.js +2 -0
  59. data/lib/generators/ifd_tools/install/templates/assets/ckeditor.js.coffee +13 -0
  60. data/lib/generators/ifd_tools/install/templates/capistrano/Capfile +5 -0
  61. data/lib/generators/ifd_tools/install/templates/capistrano/deploy/production.rb +2 -0
  62. data/lib/generators/ifd_tools/install/templates/capistrano/deploy/staging.rb +2 -0
  63. data/lib/generators/ifd_tools/install/templates/capistrano/deploy.rb +50 -0
  64. data/lib/generators/ifd_tools/install/templates/config/en.yml +17 -0
  65. data/lib/generators/ifd_tools/install/templates/config/ifd_tools.rb +4 -0
  66. data/lib/generators/ifd_tools/install/templates/config/schedule.rb.erb +28 -0
  67. data/lib/generators/ifd_tools/install/templates/controllers/api_controller.rb +8 -0
  68. data/lib/generators/ifd_tools/install/templates/controllers/application_controller.rb +19 -0
  69. data/lib/generators/ifd_tools/install/templates/controllers/customer_session_controller.rb +39 -0
  70. data/lib/generators/ifd_tools/install/templates/foreman/Procfile +2 -0
  71. data/lib/generators/ifd_tools/install/templates/layouts/application.html.haml +29 -0
  72. data/lib/generators/ifd_tools/install/templates/layouts/application_logged_out.html.haml +21 -0
  73. data/lib/generators/ifd_tools/install/templates/models/ability.rb +23 -0
  74. data/lib/generators/ifd_tools/install/templates/models/customer.rb +60 -0
  75. data/lib/generators/ifd_tools/install/templates/models/settings.rb +5 -0
  76. data/lib/generators/ifd_tools/install/templates/models/user.rb +31 -0
  77. data/lib/generators/ifd_tools/install/templates/settings/application.yml +16 -0
  78. data/lib/generators/ifd_tools/install/templates/views/customers/_form.html.haml +8 -0
  79. data/lib/ifd_tools/active_admin/base.rb +18 -0
  80. data/lib/ifd_tools/api_controller/emergency_messages.rb +9 -0
  81. data/lib/ifd_tools/api_controller/notifier_updates.rb +9 -0
  82. data/lib/ifd_tools/api_controller/software_updates.rb +9 -0
  83. data/lib/ifd_tools/api_controller/tracking.rb +44 -0
  84. data/lib/ifd_tools/api_controller_extensions.rb +18 -0
  85. data/lib/ifd_tools/configure.rb +27 -0
  86. data/lib/ifd_tools/date_time_additions.rb +11 -0
  87. data/lib/ifd_tools/engine.rb +17 -0
  88. data/lib/ifd_tools/states.rb +59 -0
  89. data/lib/ifd_tools/tracking/customer_tracking.rb +143 -0
  90. data/lib/ifd_tools/tracking/trackable.rb +28 -0
  91. data/lib/ifd_tools/validations/phone.rb +17 -0
  92. data/lib/ifd_tools/version.rb +3 -0
  93. data/lib/ifd_tools.rb +26 -0
  94. data/lib/tasks/ifd_tools_tasks.rake +2 -0
  95. data/test/dummy/README.rdoc +261 -0
  96. data/test/dummy/Rakefile +7 -0
  97. data/test/dummy/app/assets/javascripts/application.js +15 -0
  98. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  99. data/test/dummy/app/controllers/application_controller.rb +3 -0
  100. data/test/dummy/app/helpers/application_helper.rb +2 -0
  101. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  102. data/test/dummy/config/application.rb +59 -0
  103. data/test/dummy/config/boot.rb +10 -0
  104. data/test/dummy/config/database.yml +25 -0
  105. data/test/dummy/config/environment.rb +5 -0
  106. data/test/dummy/config/environments/development.rb +37 -0
  107. data/test/dummy/config/environments/production.rb +67 -0
  108. data/test/dummy/config/environments/test.rb +37 -0
  109. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  110. data/test/dummy/config/initializers/inflections.rb +15 -0
  111. data/test/dummy/config/initializers/mime_types.rb +5 -0
  112. data/test/dummy/config/initializers/secret_token.rb +7 -0
  113. data/test/dummy/config/initializers/session_store.rb +8 -0
  114. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  115. data/test/dummy/config/locales/en.yml +5 -0
  116. data/test/dummy/config/routes.rb +4 -0
  117. data/test/dummy/config.ru +4 -0
  118. data/test/dummy/db/development.sqlite3 +0 -0
  119. data/test/dummy/db/schema.rb +24 -0
  120. data/test/dummy/log/development.log +15 -0
  121. data/test/dummy/public/404.html +26 -0
  122. data/test/dummy/public/422.html +26 -0
  123. data/test/dummy/public/500.html +25 -0
  124. data/test/dummy/public/favicon.ico +0 -0
  125. data/test/dummy/script/rails +6 -0
  126. data/test/fixtures/ifd_tools/emergency_messages.yml +11 -0
  127. data/test/fixtures/ifd_tools/notifier_updates.yml +17 -0
  128. data/test/fixtures/ifd_tools/software_updates.yml +17 -0
  129. data/test/fixtures/ifd_tools/tracking/events.yml +17 -0
  130. data/test/ifd_tools_test.rb +7 -0
  131. data/test/integration/navigation_test.rb +10 -0
  132. data/test/test_helper.rb +15 -0
  133. data/test/unit/ifd_tools/emergency_message_test.rb +9 -0
  134. data/test/unit/ifd_tools/notifier_update_test.rb +9 -0
  135. data/test/unit/ifd_tools/software_update_test.rb +9 -0
  136. data/test/unit/ifd_tools/tracking/event_test.rb +9 -0
  137. metadata +464 -0
@@ -0,0 +1,87 @@
1
+ #site_footer {
2
+
3
+ &:last-child {
4
+ display: none;
5
+ }
6
+
7
+ left:0px;
8
+ background: #e7e7e7;
9
+ border-top: 1px solid darken($secondary-color, 5%);
10
+ @include gradient(darken($secondary-color, 5%), darken($secondary-color, 15%));
11
+ @include text-shadow(#000);
12
+ @include shadow(0, -1px, 20px, #666);
13
+ font-size: 1.1em;
14
+ line-height: 140%;
15
+ margin: 0;
16
+ color: #CDCDCD;
17
+ position:fixed;
18
+ padding:25px 0px 25px 1%;
19
+ width:100%;
20
+ bottom:0px;
21
+ z-index:10;
22
+ &:hover {
23
+ @include gradient(darken($secondary-color, 15%), darken($secondary-color, 25%));
24
+ }
25
+
26
+ a, a:link, a:visited, a:hover {
27
+ font-size: 1.1em;
28
+ color:#333132;
29
+ text-decoration: none;
30
+ @include text-shadow(#eee);
31
+ }
32
+
33
+ a:hover {
34
+ text-decoration: underline;
35
+ }
36
+
37
+ #footer_logo {
38
+ position:absolute;
39
+ right:50px;
40
+ bottom:15px;
41
+ }
42
+
43
+ }
44
+
45
+ #footerNav {
46
+
47
+ padding-bottom:15px;
48
+
49
+ form {
50
+ position:absolute;
51
+ right:30px;
52
+ font-weight:bold;
53
+
54
+ label {
55
+ font-size:11px;
56
+ margin-right:3px;
57
+ }
58
+
59
+ }
60
+
61
+ ul {
62
+ position:absolute;
63
+ left:30px;
64
+ margin:0px;
65
+ padding:0px;
66
+ }
67
+
68
+ li {
69
+ color: #79797a;
70
+ padding: 0px 5px;
71
+ position: relative;
72
+ text-decoration: none;
73
+ display:inline;
74
+ list-style:none;
75
+ font-size:10px;
76
+ }
77
+
78
+ }
79
+
80
+ #active_admin_content #main_content_wrapper {
81
+ padding-bottom:66px !important;
82
+ }
83
+
84
+ .footer {
85
+ height:80px;
86
+ clear:both;
87
+ }
@@ -0,0 +1,27 @@
1
+ body.active_admin {
2
+ #header ul#tabs > li {
3
+
4
+ &.has_nested:hover > a {
5
+ @include rounded-top(5px);
6
+ }
7
+
8
+ ul {
9
+ @include rounded-all(0,5px,5px,5px);
10
+ }
11
+
12
+ a {
13
+ @include border-radius(5px);
14
+ }
15
+ }
16
+
17
+ form {
18
+ &.filter_form a.clear_filters_btn, input[type=submit], fieldset.buttons li.cancel a {
19
+ @include border-radius(5px);
20
+ }
21
+ }
22
+
23
+ #title_bar .action_items .action_item > a {
24
+ @include border-radius(5px);
25
+ }
26
+
27
+ }
@@ -0,0 +1,4 @@
1
+ @import "active_admin/square_admin_buttons";
2
+ @import "active_admin/footer";
3
+ @import "active_admin/cleanup";
4
+ @import "active_admin/analytics";
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ module IfdTools
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,30 @@
1
+ module IfdTools
2
+ module ApplicationHelper
3
+
4
+ def phone_number(num)
5
+ number_to_phone num, area_code: true, delimiter: "."
6
+ end
7
+
8
+ def cleanse_for_flash(str)
9
+
10
+ s = str.gsub(%r{>\s+}, ">").gsub(%r{</p>}, "</p><br />")
11
+
12
+ replacements = []
13
+ replacements << { find: %w(&amp;trade; &trade;), replace: "&#8482;" }
14
+ replacements << { find: %w(&amp;copy; &copy;), replace: "&#169;" }
15
+ replacements << { find: %w(&amp;reg; &reg;), replace: "&#174;" }
16
+ replacements << { find: %w(&amp;rsquo; &rsquo;), replace: "'" }
17
+ replacements << { find: %w(&amp;rdquo; &rdquo;), replace: '"' }
18
+ replacements << { find: %w(&amp;bull; &bull;), replace: "&#149;" }
19
+ replacements << { find: %w(&amp;hellip; &hellip;), replace: "..." }
20
+ replacements << { find: %w(&amp;ndash; &ndash; &amp;mdash; &mdash;), replace: "-" }
21
+
22
+ replacements.map do |repl|
23
+ repl[:find].map { |find| s.gsub! find, repl[:replace] }
24
+ end
25
+
26
+ s
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ module IfdTools
2
+ class EmergencyMessage < ActiveRecord::Base
3
+
4
+ include ActionView::Helpers::TextHelper
5
+
6
+ attr_accessible :active, :body, :title
7
+
8
+ after_save :ensure_one_active_record
9
+
10
+ validates :title, :body, presence: true
11
+ validates :active, inclusion: { in: [true, false] }
12
+
13
+ scope :active, where(active: true)
14
+ scope :inactive, where(active: false)
15
+
16
+ def display_name
17
+ truncate title, length: 45
18
+ end
19
+
20
+ private
21
+
22
+ def ensure_one_active_record
23
+ self.class.where("id != ?", id).update_all(active: false) if active?
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ module IfdTools
2
+ class NotifierUpdate < ActiveRecord::Base
3
+
4
+ attr_accessible :current_release, :mac, :pc, :release_date, :release_notes, :release_version
5
+
6
+ mount_uploader :mac, SoftwareUploader
7
+ mount_uploader :pc, SoftwareUploader
8
+
9
+ validates :release_date, :release_version, :release_notes, :mac, :pc, presence: true
10
+ validates :current_release, inclusion: { in: [true,false] }
11
+
12
+ after_save :ensure_one_current_release
13
+
14
+ scope :current, where(current_release: true)
15
+ scope :previous, where(current_release: false)
16
+
17
+ def display_name
18
+ "Version: #{release_version}"
19
+ end
20
+
21
+ private
22
+
23
+ def ensure_one_current_release
24
+ self.class.where("id != ?", id).update_all(current_release: false) if current_release?
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ module IfdTools
2
+ class SoftwareUpdate < ActiveRecord::Base
3
+
4
+ attr_accessible :current_release, :mac, :pc, :release_date, :release_notes, :release_version
5
+
6
+ mount_uploader :mac, SoftwareUploader
7
+ mount_uploader :pc, SoftwareUploader
8
+
9
+ validates :release_date, :release_version, :release_notes, :mac, :pc, presence: true
10
+ validates :current_release, inclusion: { in: [true,false] }
11
+
12
+ after_save :ensure_one_current_release
13
+
14
+ scope :current, where(current_release: true)
15
+ scope :previous, where(current_release: false)
16
+
17
+ def display_name
18
+ "Version: #{release_version}"
19
+ end
20
+
21
+ private
22
+
23
+ def ensure_one_current_release
24
+ self.class.where("id != ?", id).update_all(current_release: false) if current_release?
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,6 @@
1
+ class IfdTools::Tracking::ApplicationEvent < IfdTools::Tracking::Event
2
+
3
+ def assign_trackable_item_by_id(id)
4
+ end
5
+
6
+ end
@@ -0,0 +1,51 @@
1
+ module IfdTools
2
+ class Tracking::Event < ActiveRecord::Base
3
+
4
+ set_table_name "ifd_tools_tracking_events"
5
+
6
+ belongs_to :customer
7
+ belongs_to :trackable, polymorphic: true
8
+
9
+ attr_accessible :ip_address, :platform, :timestamp, :type, :customer_id
10
+
11
+ validates :customer, presence: true
12
+
13
+ default_scope order(:timestamp)
14
+
15
+ def assign_trackable_item_by_id(id)
16
+ # self.trackable = AssociatedClass.find(id)
17
+ raise "Must implement 'assign_trackable_item_by_id' in each IfdTools::Tracking::Event subclass to set association"
18
+ end
19
+
20
+ after_initialize do
21
+ self.timestamp ||= Time.now if new_record?
22
+ end
23
+
24
+ # Class Methods
25
+ class << self
26
+
27
+ def event_types
28
+ Dir["#{Rails.root}/app/models/ifd_tools/tracking/*.rb"].each { |f| require f }
29
+ Dir[File.expand_path(File.join(File.dirname(__FILE__), "/*.rb"))].delete_if { |f| f.end_with? "/event.rb" }.each { |f| require f }
30
+ subclasses
31
+ end
32
+
33
+ def platform_for_request(request)
34
+ if request.headers["HTTP_USER_AGENT"] =~ /Macintosh|iPad|iPhone/
35
+ "mac"
36
+ else
37
+ "pc"
38
+ end
39
+ end
40
+
41
+ def top_content
42
+ content = self.where("type != ?", "IfdTools::Tracking::ApplicationEvent").group(:trackable_id).order("count(trackable_id) desc").limit(25).collect do |e|
43
+ e.trackable_type.constantize.find(e.trackable_id) rescue nil
44
+ end
45
+ content.compact.sort { |a,b| b.trackable_activity <=> a.trackable_activity }
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+ end
@@ -0,0 +1,7 @@
1
+ module IfdTools
2
+ module Tracking
3
+ def self.table_name_prefix
4
+ 'tracking_'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+ class SoftwareUploader < ::CarrierWave::Uploader::Base
3
+
4
+ # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
5
+ include ::Sprockets::Helpers::RailsHelper
6
+ include ::Sprockets::Helpers::IsolatedHelper
7
+
8
+ def store_dir
9
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
10
+ end
11
+
12
+ # Add a white list of extensions which are allowed to be uploaded.
13
+ # For images you might use something like this:
14
+ def extension_white_list
15
+ %w(exe dmg)
16
+ end
17
+
18
+ end
@@ -0,0 +1,7 @@
1
+ %tr
2
+ %td.date= trend.timestamp.humanize
3
+ %td.trackable
4
+ - if trend.is_a? IfdTools::Tracking::ApplicationEvent
5
+ Application Launch
6
+ - else
7
+ = link_to event.trackable_title, [:admin, event.trackable_resource]
@@ -0,0 +1,11 @@
1
+ .attributes_table.trends
2
+ %table
3
+ %tr
4
+ %th Registered
5
+ %td= @registration_date.humanize
6
+ %tr
7
+ %th Application Launches
8
+ %td= @application_launches
9
+ %tr
10
+ %th Explanation
11
+ %td User trends shows the 75 most recent actions taken by this customer, in descending order.
@@ -0,0 +1,11 @@
1
+ xml.instruct!
2
+ xml.root do
3
+ @activity.each do |activity|
4
+ xml.state do
5
+ xml.name activity.name.downcase
6
+ xml.activity activity.activity
7
+ xml.percent ( activity.activity.to_f / @total_activity ).round(2)
8
+ xml.users activity.users
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ xml.instruct!
2
+ xml.graph(caption: @caption, subcaption: @subcaption, bgAlpha: 0, canvasBorderColor: IfdTools::Configure.dashboard_graph_main_color, baseFontColor: IfdTools::Configure.dashboard_graph_main_color, hoverCapBgColor: "E7EFF6", formatNumberScale: "0", decimalPrecision: "0", showvalues: "0", numdivlines: "3", numVdivlines: "0", yAxisMaxValue: "5", rotateNames: "1", showAlternateHGridColor: "1", alternateHGridAlpha: "10", alternateHGridColor: IfdTools::Configure.dashboard_graph_color) do
3
+ @events.each do |date, value|
4
+ xml.set(name: date, value: value, color: @color)
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ $.ajax({
2
+ url: "<%= events_data_admin_customers_url(format: :xml) %>",
3
+ success: function(data) {
4
+ updateChartXML("FCF_Area2D", data);
5
+ }, dataType: 'text'
6
+ });
@@ -0,0 +1,11 @@
1
+ - if @trends.empty?
2
+ %h3 No Trending Data
3
+ - else
4
+ .panel
5
+ %h3 User Trends
6
+ .panel_contents
7
+ %table#user_trends
8
+ %tr
9
+ %th Timestamp
10
+ %th Action
11
+ = render partial: 'trend', collection: @trends
@@ -0,0 +1,11 @@
1
+ #line_graph
2
+ #FCF_Area2D
3
+ = swf_tag "FCF_Area2D", height: 350, width: 569, flashvars: { chartWidth: 569, chartHeight: 350, DOMid: "FCF_Area2D", dataURL: events_data_admin_customers_url(format: :xml) }, params: { wmode: :transparent, quality: :high }, attributes: { }
4
+
5
+ #line_graph_controls.sidebar_section
6
+ = form_for IfdTools::Tracking::Event.metasearch(params[:q]), url: filter_events_admin_customers_path(format: :js), remote: true, html: { method: :post, class: :filter_form }, builder: ::ActiveAdmin::Filters::FormBuilder, as: :q do |f|
7
+ - f.filter :type, as: :select, collection: IfdTools::Tracking::Event.event_types.collect(&:name), member_label: proc { |t| t.gsub("IfdTools::Tracking::", "").titleize }
8
+ - f.filter :platform, as: :select, collection: %w(mac pc), member_label: proc { |i| i == "pc" ? "PC" : "Mac" }
9
+ = f.filter :timestamp
10
+ .buttons
11
+ = f.submit("Filter")
@@ -0,0 +1,2 @@
1
+ #usa_map
2
+ = swf_tag "usa_map", height: 400, width: 550, flashvars: { xml: demographic_data_admin_customers_url(format: :xml) }, params: { wmode: :transparent, quality: :high }, attributes: { }
@@ -0,0 +1,6 @@
1
+ = semantic_form_for [:admin, @emergency_message] do |f|
2
+ = f.inputs "Emergency Message" do
3
+ = f.input :title
4
+ = f.input :active, as: :radio
5
+ = f.input :body, label: "Description", input_html: { class: :ckeditor }
6
+ = f.actions
@@ -0,0 +1,9 @@
1
+ = semantic_form_for [:admin, @notifier_update], html: { :class => "filter_form" } do |f|
2
+ = f.inputs "Notifier Update" do
3
+ = f.input :release_date, label: "Release Date", as: :string, input_html: { class: "datepicker" }, wrapper_html: { class: "filter_form_field filter_date_range" }
4
+ = f.input :release_version, label: "Release Version"
5
+ = f.input :current_release, label: "Current Release?", as: :radio
6
+ = f.input :mac, label: "Mac Updater Script"
7
+ = f.input :pc, label: "PC Updater Script"
8
+ = f.input :release_notes, label: "Release Notes", input_html: { class: :ckeditor }
9
+ = f.actions
@@ -0,0 +1,6 @@
1
+ #site_footer
2
+ #footerNav
3
+ %ul
4
+ %li= link_to "Dashboard", admin_dashboard_path
5
+ %li |
6
+ %li= link_to "Profile", profile_admin_users_path
@@ -0,0 +1,9 @@
1
+ = semantic_form_for [:admin, @software_update], html: { :class => "filter_form" } do |f|
2
+ = f.inputs "Software Update" do
3
+ = f.input :release_date, label: "Release Date", as: :string, input_html: { class: "datepicker" }, wrapper_html: { class: "filter_form_field filter_date_range" }
4
+ = f.input :release_version, label: "Release Version"
5
+ = f.input :current_release, label: "Current Release?", as: :radio
6
+ = f.input :mac, label: "Mac Updater Script"
7
+ = f.input :pc, label: "PC Updater Script"
8
+ = f.input :release_notes, label: "Release Notes", input_html: { class: :ckeditor }
9
+ = f.actions
@@ -0,0 +1,9 @@
1
+ = semantic_form_for [:admin, @user] do |f|
2
+ = f.inputs "User Information" do
3
+ = f.input :email
4
+ = f.input :first_name, label: "First Name"
5
+ = f.input :last_name, label: "Last Name"
6
+ = f.input :time_zone, :label => "Time Zone", :default => Rails.application.config.time_zone
7
+ - if current_user.super_admin?
8
+ = f.input :role, label: "User Role", as: :select, collection: User::Roles, member_label: :titleize
9
+ = f.actions
@@ -0,0 +1,12 @@
1
+ xml.instruct!
2
+ xml.content do
3
+ xml.messages do
4
+ if @emergency_message
5
+ xml.message do
6
+ xml.title @emergency_message.title
7
+ xml.body @emergency_message.body
8
+ xml.active @emergency_message.active
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ xml.instruct!
2
+ xml.update(xmlns: "http://ns.riaspace.com/air/framework/update/description/1.1") do
3
+ if @notifier_update
4
+ xml.dmg do |dmg|
5
+ dmg.version @notifier_update.release_version
6
+ dmg.url request.protocol + request.host_with_port + @notifier_update.mac.url
7
+ dmg.description { xml.cdata! @notifier_update.release_notes }
8
+ end
9
+ xml.exe do |exe|
10
+ exe.version @notifier_update.release_version
11
+ exe.url request.protocol + request.host_with_port + @notifier_update.pc.url
12
+ exe.description { xml.cdata! @notifier_update.release_notes }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ xml.instruct!
2
+ xml.update(xmlns: "http://ns.riaspace.com/air/framework/update/description/1.1") do
3
+ if @software_update
4
+ xml.dmg do |dmg|
5
+ dmg.version @software_update.release_version
6
+ dmg.url request.protocol + request.host_with_port + @software_update.mac.url
7
+ dmg.description { xml.cdata! @software_update.release_notes }
8
+ end
9
+ xml.exe do |exe|
10
+ exe.version @software_update.release_version
11
+ exe.url request.protocol + request.host_with_port + @software_update.pc.url
12
+ exe.description { xml.cdata! @software_update.release_notes }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ xml.instruct!
2
+ if @error.present?
3
+ xml.error { xml.cdata! @error }
4
+ else
5
+ xml.track
6
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>IfdTools</title>
5
+ <%= stylesheet_link_tag "ifd_tools/application", :media => "all" %>
6
+ <%= javascript_include_tag "ifd_tools/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ IfdTools::Engine.routes.draw do
2
+ end
@@ -0,0 +1,11 @@
1
+ class CreateIfdToolsEmergencyMessages < ActiveRecord::Migration
2
+ def change
3
+ create_table :ifd_tools_emergency_messages do |t|
4
+ t.string :title
5
+ t.text :body
6
+ t.boolean :active, default: false
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ class CreateIfdToolsNotifierUpdates < ActiveRecord::Migration
2
+ def change
3
+ create_table :ifd_tools_notifier_updates do |t|
4
+ t.date :release_date
5
+ t.string :release_version
6
+ t.string :mac
7
+ t.string :pc
8
+ t.boolean :current_release, default: false
9
+ t.text :release_notes
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class CreateIfdToolsSoftwareUpdates < ActiveRecord::Migration
2
+ def change
3
+ create_table :ifd_tools_software_updates do |t|
4
+ t.date :release_date
5
+ t.string :release_version
6
+ t.string :mac
7
+ t.string :pc
8
+ t.boolean :current_release, default: false
9
+ t.text :release_notes
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,57 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def migrate(direction)
3
+ super
4
+ User.create!(:email => 'matt@dmgx.com', :password => 'P@$$w0rd', :password_confirmation => 'P@$ww0rd', first_name: "Matt", last_name: "Brewer", role: :super_admin) if direction == :up
5
+ end
6
+
7
+ def change
8
+ create_table(:users) do |t|
9
+ ## Database authenticatable
10
+ t.string :email, :null => false, :default => ""
11
+ t.string :encrypted_password, :null => false, :default => ""
12
+
13
+ ## Recoverable
14
+ t.string :reset_password_token
15
+ t.datetime :reset_password_sent_at
16
+
17
+ ## Rememberable
18
+ t.datetime :remember_created_at
19
+
20
+ ## Trackable
21
+ t.integer :sign_in_count, :default => 0
22
+ t.datetime :current_sign_in_at
23
+ t.datetime :last_sign_in_at
24
+ t.string :current_sign_in_ip
25
+ t.string :last_sign_in_ip
26
+
27
+ ## Confirmable
28
+ t.string :confirmation_token
29
+ t.datetime :confirmed_at
30
+ t.datetime :confirmation_sent_at
31
+ t.string :unconfirmed_email # Only if using reconfirmable
32
+
33
+ ## Lockable
34
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
35
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
36
+ # t.datetime :locked_at
37
+
38
+ ## Token authenticatable
39
+ t.string :authentication_token
40
+
41
+ # Additional Fields
42
+ t.string :first_name
43
+ t.string :last_name
44
+ t.string :time_zone
45
+ t.string :role, default: :admin
46
+
47
+ t.timestamps
48
+ end
49
+
50
+ add_index :users, :email, :unique => true
51
+ add_index :users, :reset_password_token, :unique => true
52
+ add_index :users, :confirmation_token, :unique => true
53
+ # add_index :users, :unlock_token, :unique => true
54
+ add_index :users, :authentication_token, :unique => true
55
+ add_index :users, :role
56
+ end
57
+ end