concen 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 (67) hide show
  1. data/app/controllers/concen/application_controller.rb +25 -0
  2. data/app/controllers/concen/grid_files_controller.rb +75 -0
  3. data/app/controllers/concen/pages_controller.rb +95 -0
  4. data/app/controllers/concen/performances_controller.rb +35 -0
  5. data/app/controllers/concen/sessions_controller.rb +30 -0
  6. data/app/controllers/concen/statuses_controller.rb +63 -0
  7. data/app/controllers/concen/traffics_controller.rb +43 -0
  8. data/app/controllers/concen/users_controller.rb +118 -0
  9. data/app/controllers/concen/visits_controller.rb +38 -0
  10. data/app/helpers/concen/application_helper.rb +10 -0
  11. data/app/helpers/concen/pages_helper.rb +5 -0
  12. data/app/helpers/concen/visits_helper.rb +4 -0
  13. data/app/models/concen/grid_file.rb +67 -0
  14. data/app/models/concen/page.rb +342 -0
  15. data/app/models/concen/response.rb +45 -0
  16. data/app/models/concen/user.rb +88 -0
  17. data/app/models/concen/visit/page.rb +100 -0
  18. data/app/models/concen/visit/referral.rb +45 -0
  19. data/app/stylesheets/application.sass +445 -0
  20. data/app/stylesheets/config.rb +9 -0
  21. data/app/stylesheets/ie.sass +4 -0
  22. data/app/stylesheets/non_ios.sass +16 -0
  23. data/app/stylesheets/partials/_base.sass +92 -0
  24. data/app/stylesheets/partials/_fileuploader.sass +75 -0
  25. data/app/stylesheets/partials/_flot.sass +8 -0
  26. data/app/stylesheets/partials/_form.sass +74 -0
  27. data/app/stylesheets/partials/_mixins.sass +8 -0
  28. data/app/stylesheets/partials/_variables.sass +17 -0
  29. data/app/stylesheets/print.sass +4 -0
  30. data/app/views/concen/grid_files/_form.html.haml +15 -0
  31. data/app/views/concen/grid_files/edit.html.haml +9 -0
  32. data/app/views/concen/pages/_file_list.haml +7 -0
  33. data/app/views/concen/pages/_files.haml +24 -0
  34. data/app/views/concen/pages/_form.html.haml +18 -0
  35. data/app/views/concen/pages/_nested_list.html.haml +15 -0
  36. data/app/views/concen/pages/edit.html.haml +15 -0
  37. data/app/views/concen/pages/index.html.haml +9 -0
  38. data/app/views/concen/pages/new.html.haml +9 -0
  39. data/app/views/concen/performances/_runtimes.html.haml +5 -0
  40. data/app/views/concen/performances/show.html.haml +30 -0
  41. data/app/views/concen/sessions/new.html.haml +12 -0
  42. data/app/views/concen/statuses/_server.html.haml +19 -0
  43. data/app/views/concen/statuses/show.html.haml +18 -0
  44. data/app/views/concen/traffics/_pages.html.haml +5 -0
  45. data/app/views/concen/traffics/_referrals.html.haml +9 -0
  46. data/app/views/concen/traffics/show.html.haml +30 -0
  47. data/app/views/concen/users/_form.html.haml +29 -0
  48. data/app/views/concen/users/_password_reset.html.haml +0 -0
  49. data/app/views/concen/users/_settings.html.haml +15 -0
  50. data/app/views/concen/users/edit.html.haml +9 -0
  51. data/app/views/concen/users/index.html.haml +32 -0
  52. data/app/views/concen/users/new.html.haml +4 -0
  53. data/app/views/concen/users/new_invite.html.haml +15 -0
  54. data/app/views/concen/users/new_reset_password.html.haml +15 -0
  55. data/app/views/concen/visits/visit_recorder_js.erb +13 -0
  56. data/app/views/layouts/concen/_additional_header_links.haml +0 -0
  57. data/app/views/layouts/concen/_header.html.haml +18 -0
  58. data/app/views/layouts/concen/_iphone.html.haml +6 -0
  59. data/app/views/layouts/concen/application.html.haml +48 -0
  60. data/app/views/layouts/concen/maintenance.html.haml +0 -0
  61. data/config/routes.rb +64 -0
  62. data/lib/concen.rb +11 -0
  63. data/lib/concen/engine.rb +14 -0
  64. data/lib/concen/railties/page.rake +12 -0
  65. data/lib/concen/railties/setup.rake +23 -0
  66. data/lib/concen/version.rb +3 -0
  67. metadata +246 -0
@@ -0,0 +1,9 @@
1
+ - content_for :head_javascripts do
2
+ = javascript_include_tag "/concen/javascripts/ace/ace.js"
3
+ = javascript_include_tag "/concen/javascripts/fileuploader.js"
4
+ = javascript_include_tag "/concen/javascripts/page.js"
5
+
6
+ #content
7
+ %h1 New Page
8
+ .clearfix
9
+ = render "form"
@@ -0,0 +1,5 @@
1
+ %ul
2
+ - for stat in @runtimes_stats
3
+ %li
4
+ %p= stat.first
5
+ %p.right= stat.last
@@ -0,0 +1,30 @@
1
+ - content_for :head_javascripts do
2
+ /[if lte IE 8]
3
+ = javascript_include_tag "/concen/javascripts/excanvas.js"
4
+ = javascript_include_tag "/concen/javascripts/jquery.flot.js"
5
+ = javascript_include_tag "/concen/javascripts/jquery.flot.stack.js"
6
+ = javascript_include_tag "/concen/javascripts/jquery.flot.resize.js"
7
+ = javascript_include_tag "/concen/javascripts/performance.js"
8
+
9
+ #content
10
+ .panels
11
+ .panel.wide
12
+ .border
13
+ %h3 Responses in Past Hour
14
+ .graph
15
+ #recent-responses{:style => "width: 100%; height: 200px;"}
16
+
17
+ .panels
18
+ .panel.total-runtime
19
+ .border
20
+ %h3 Average Total Runtime
21
+ %ul
22
+ .panel.view-runtime
23
+ .border
24
+ %h3 Average View Runtime
25
+ %ul
26
+ .panel.mongodb-runtime.edge
27
+ .border
28
+ %h3 Average MongoDB Runtime
29
+ %ul
30
+ .clear
@@ -0,0 +1,12 @@
1
+ #content
2
+ %h1 Sign In
3
+ = form_tag concen_sessions_path do
4
+ .field
5
+ = label_tag :username
6
+ = text_field_tag :username, params[:username]
7
+ .field
8
+ = label_tag :password
9
+ = password_field_tag :password, params[:password]
10
+ .actions
11
+ = submit_tag "Sign In"
12
+ = link_to "Reset Password", new_reset_password_concen_users_path
@@ -0,0 +1,19 @@
1
+ %ul
2
+ %li
3
+ %p Uptime
4
+ %p.right= @server_stats[:uptime] if @server_stats
5
+ %li
6
+ %p Processor
7
+ %p.right= "#{@server_stats[:processor][:user]}% user, #{@server_stats[:processor][:sys]}% sys, #{@server_stats[:processor][:idle]}% idle" if @server_stats[:processor].present?
8
+ %li
9
+ %p Memory
10
+ %p.right= "#{@server_stats[:memory][:used]} MB used, #{@server_stats[:memory][:free]} MB free" if @server_stats[:memory].present?
11
+ %li
12
+ %p MongoDB Data Size
13
+ %p.right= number_to_human_size(@mongodb_stats["dataSize"])
14
+ %li
15
+ %p MongoDB Index Size
16
+ %p.right= number_to_human_size(@mongodb_stats["indexSize"])
17
+ %li
18
+ %p MongoDB GridFS Size
19
+ %p.right= number_to_human_size(@mongodb_grid_fs_stats)
@@ -0,0 +1,18 @@
1
+ - content_for :head_javascripts do
2
+ = javascript_include_tag "/concen/javascripts/status.js"
3
+
4
+ #content
5
+ .panels
6
+ .panel.pages
7
+ .border
8
+ %h3 Pages
9
+ %p.big-number
10
+ .panel.users
11
+ .border
12
+ %h3 Users
13
+ %p.big-number
14
+ .panel.server.edge
15
+ .border
16
+ %h3 Server
17
+ %ul
18
+ .clear
@@ -0,0 +1,5 @@
1
+ %ul
2
+ - for stat in @pages_stats
3
+ %li
4
+ %p= link_to stat.first, stat.first
5
+ %p.right= stat.last
@@ -0,0 +1,9 @@
1
+ %ul
2
+ - if @referrals_stats.count == 0
3
+ %li
4
+ %p No Referrals
5
+ - else
6
+ - for stat in @referrals_stats
7
+ %li
8
+ %p= stat.first
9
+ %p.right= stat.last
@@ -0,0 +1,30 @@
1
+ - content_for :head_javascripts do
2
+ /[if lte IE 8]
3
+ = javascript_include_tag "/concen/javascripts/excanvas.js"
4
+ = javascript_include_tag "/concen/javascripts/jquery.flot.js"
5
+ = javascript_include_tag "/concen/javascripts/jquery.flot.stack.js"
6
+ = javascript_include_tag "/concen/javascripts/jquery.flot.resize.js"
7
+ = javascript_include_tag "/concen/javascripts/traffic.js"
8
+
9
+ #content
10
+ .panels
11
+ .panel.wide
12
+ .border
13
+ %h3 Visits in Past 24 Hours
14
+ .graph
15
+ #recent-visits{:style => "width: 100%; height: 200px;"}
16
+
17
+ .panels
18
+ .panel.visits-1-hour
19
+ .border
20
+ %h3 Visits in Past Hour
21
+ %p.big-number
22
+ .panel.pages
23
+ .border
24
+ %h3 Pages
25
+ %ul
26
+ .panel.referrals.edge
27
+ .border
28
+ %h3 Referrals
29
+ %ul
30
+ .clear
@@ -0,0 +1,29 @@
1
+ = form_for @user do |f|
2
+ - if @user.errors.any?
3
+ #errorExplanation
4
+ %h3= "#{pluralize(@user.errors.count, "error")} prohibited this parent from being saved:"
5
+ %ul
6
+ - @user.errors.full_messages.each do |msg|
7
+ %li= msg
8
+ - if @user.invitation_token
9
+ = f.hidden_field :invitation_token
10
+ .field
11
+ = f.label :full_name
12
+ = f.text_field :full_name
13
+ .field
14
+ = f.label :username
15
+ = f.text_field :username
16
+ .field
17
+ = f.label :email
18
+ = f.text_field :email
19
+ .field
20
+ = f.label :password
21
+ = f.password_field :password
22
+ .field
23
+ = f.label :password_confirmation
24
+ = f.password_field :password_confirmation
25
+ .actions
26
+ = f.submit "Save"
27
+ - if @user.persisted?
28
+ = link_to "Delete", concen_page_path(@user), :method => :delete
29
+ = link_to "Cancel", concen_pages_path
@@ -0,0 +1,15 @@
1
+ = form_for @user do |f|
2
+ - if @user.errors.any?
3
+ #errorExplanation
4
+ %h3= "#{pluralize(@user.errors.count, "error")} prohibited this parent from being saved:"
5
+ %ul
6
+ - @user.errors.full_messages.each do |msg|
7
+ %li= msg
8
+ .field
9
+ = f.label :current_password, "Current Password"
10
+ = f.password_field :current_password
11
+ .field
12
+ = f.label :password, "New Password"
13
+ = f.password_field :password
14
+ .actions
15
+ = f.submit "Update"
@@ -0,0 +1,9 @@
1
+ #content
2
+ %h1 Edit User Settings
3
+ .clearfix
4
+ - if params.try(:[], :invitation_token) || params.try(:[], :concen_user).try(:[], :invitation_token)
5
+ = render "form"
6
+ - elsif params.try(:[], :password_reset_token) || params.try(:[], :concen_user).try(:[], :password_reset_token)
7
+ = render "password_reset"
8
+ - else
9
+ = render "settings"
@@ -0,0 +1,32 @@
1
+ - content_for :head_javascripts do
2
+ = javascript_include_tag "/concen/javascripts/user.js"
3
+
4
+ #content
5
+ %h1
6
+ = one_line do
7
+ %span Users
8
+ = link_to "Invite New User", new_invite_concen_users_path, :class => "link-button"
9
+ .border
10
+ %table.users
11
+ %thead
12
+ %tr
13
+ %th Username
14
+ %th Full Name
15
+ %th Email
16
+ %th Sign Up On
17
+ %th Pages
18
+ %th Full Control
19
+ - if current_concen_user.full_control
20
+ %th Actions
21
+ %tbody
22
+ - for user in @users
23
+ %tr
24
+ %td= user.username
25
+ %td= user.full_name
26
+ %td= user.email
27
+ %td= user.created_at.strftime("%d %B %Y")
28
+ %td= Concen::Page.where(:authors.in => [user.username, user.full_name, user.email]).count
29
+ %td= check_box_tag "full_control", 1, user.full_control, "data-path" => toggle_attribute_concen_user_path(user), :disabled => user == current_concen_user || !current_concen_user.full_control
30
+ - if current_concen_user.full_control
31
+ %td
32
+ = link_to "Delete", concen_user_path(user), :method => :delete, :confirm => "Are you sure?"
@@ -0,0 +1,4 @@
1
+ #content
2
+ %h1 New User
3
+ .clearfix
4
+ = render "form"
@@ -0,0 +1,15 @@
1
+ #content
2
+ %h1 Send Invitation
3
+ .clearfix
4
+ = form_for @user, :url => invite_concen_users_path do |f|
5
+ - if @user.errors.any?
6
+ #errorExplanation
7
+ %h3= "#{pluralize(@user.errors.count, "error")} prohibited this parent from being saved:"
8
+ %ul
9
+ - @user.errors.full_messages.each do |msg|
10
+ %li= msg
11
+ .field
12
+ = f.label :email
13
+ = f.text_field :email
14
+ .actions
15
+ = f.submit "Invite"
@@ -0,0 +1,15 @@
1
+ #content
2
+ %h1 Reset Password
3
+ .clearfix
4
+ = form_for @user, :url => reset_password_concen_users_path do |f|
5
+ - if @user.errors.any?
6
+ #errorExplanation
7
+ %h3= "#{pluralize(@user.errors.count, "error")} prohibited this parent from being saved:"
8
+ %ul
9
+ - @user.errors.full_messages.each do |msg|
10
+ %li= msg
11
+ .field
12
+ = f.label :email
13
+ = f.text_field :email
14
+ .actions
15
+ = f.submit "Send"
@@ -0,0 +1,13 @@
1
+ VisitRecorder = {};
2
+ VisitRecorder.record = function(data) {
3
+ var date = new Date();
4
+ data.u = document.location.href;
5
+ // data.w = screen.width
6
+ // data.h = screen.height
7
+ data.t = document.title
8
+ data.n = date.getTime();
9
+ if(document.referrer && document.referrer != "") {
10
+ data.r = document.referrer;
11
+ }
12
+ $("body").append("<img class='visit-recorder' src='<%= record_visit_path %>?" + jQuery.param(data) + "' style='display:none;' />");
13
+ };
@@ -0,0 +1,18 @@
1
+ %header
2
+ %h1
3
+ %a{:href => "/"}
4
+ %span.engine-name Concen
5
+ %span.application-name= Concen.application_name
6
+ %nav
7
+ %ul
8
+ - if current_concen_user
9
+ %li= link_to "Status", concen_status_path
10
+ %li= link_to "Traffic", concen_traffic_path
11
+ %li= link_to "Performance", concen_performance_path
12
+ %li= link_to "Pages", concen_pages_path
13
+ %li= link_to "Users", concen_users_path
14
+ = render "layouts/concen/additional_header_links"
15
+ %li= link_to "Settings", edit_concen_user_path(current_concen_user)
16
+ %li= link_to "Sign Out", concen_signout_path
17
+ - else
18
+ %li= link_to "Sign In", concen_signin_path
@@ -0,0 +1,6 @@
1
+ / %meta(name="viewport" content="width=580")
2
+ / %style(type="text/css" media="screen")
3
+ / :plain
4
+ / body {
5
+ / min-width: 580px;
6
+ / }
@@ -0,0 +1,48 @@
1
+ !!! 5
2
+ %html.no-js{:lang => "en"}
3
+ %head
4
+ %meta{:charset => "utf-8"}
5
+ %title= "#{@page_title + ' - ' if @page_title}Concen - #{Concen.application_name}"
6
+ %meta{:name => "description", :content => "Web application to control and monitor a website."}
7
+ %meta{:name => "author", :content => "Steve Randy Tantra"}
8
+ %meta{:name => "copyright", :content => "Copyright © 2011 by Steve Randy Tantra"}
9
+ %meta{:name => "DC.title", :content => "#{@page_title + ' - ' if @page_title}Control Center - #{Concen.application_name}"}
10
+ %meta{:name => "DC.subject", :content => "Control, Monitor, Center, Web Application"}
11
+ %meta{:name => "DC.creator", :content => "Steve Randy Tantra"}
12
+ %meta{:name => "viewport", :content => "width = 1024"}
13
+ %meta{"http-equiv" => "X-UA-Compatible", :content => "IE=edge"}
14
+ = csrf_meta_tag
15
+ = stylesheet_link_tag "/concen/stylesheets/application.css"
16
+ = stylesheet_link_tag "/concen/stylesheets/jquery.ui.resizable.css"
17
+ - if content_for?(:head_stylesheets)
18
+ = yield :head_stylesheets
19
+ /[if lt IE 8]
20
+ = stylesheet_link_tag "/concen/stylesheets/ie.css"
21
+ %script{:type => "text/javascript", :src => "http://use.typekit.com/#{Concen.typekit_id}.js"}
22
+ %script{:type => "text/javascript"} try{Typekit.load();}catch(e){}
23
+ - if Rails.env == "production"
24
+ = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js"
25
+ = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/jquery/1.6.2/jquery.min.js"
26
+ - else
27
+ = javascript_include_tag "/concen/javascripts/modernizr.js", "/concen/javascripts/jquery.js"
28
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.core.js"
29
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.widget.js"
30
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.mouse.js"
31
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.position.js"
32
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.sortable.js"
33
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.resizable.js"
34
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.draggable.js"
35
+ = javascript_include_tag "/concen/javascripts/jquery-ui/jquery.ui.droppable.js"
36
+ = javascript_include_tag "/concen/javascripts/jquery.ui.nestedSortable.js"
37
+ = javascript_include_tag "/concen/javascripts/jquery_ujs.js"
38
+ - if content_for?(:head_javascripts)
39
+ = yield :head_javascripts
40
+ - if content_for?(:head)
41
+ = yield :head
42
+ %body.concen
43
+ = render "layouts/concen/header"
44
+ = yield
45
+ %footer.clearfix
46
+ %p
47
+ %span Created by
48
+ = link_to "Steve Randy Tantra", "http://steverandytantra.com/"
@@ -0,0 +1,64 @@
1
+ require "rack/gridfs"
2
+
3
+ # Use Rails.application.routes.prepend on Rails 3.1.
4
+ Rails.application.routes.draw do
5
+ match "/visits/record.gif" => "concen/visits#record", :as => "record_visit"
6
+ match "/visits/js" => "concen/visits#visit_recorder_js", :as => "visit_recorder_js"
7
+ mount Rack::GridFS::Endpoint.new(:db => Mongoid.database, :lookup => :path, :expires => 315360000), :at => "gridfs"
8
+
9
+ scope :constraints => {:subdomain => "concen"}, :module => "concen", :as => "concen" do
10
+ get "signout" => "sessions#destroy", :as => "signout"
11
+ get "signin" => "sessions#new", :as => "signin"
12
+ get "signup" => "users#new", :as => "signup"
13
+
14
+ resources :users do
15
+ collection do
16
+ get :new_invite
17
+ post :invite
18
+ get :new_reset_password
19
+ post :reset_password
20
+ end
21
+ member do
22
+ put :toggle_attribute
23
+ end
24
+ end
25
+
26
+ resources :sessions
27
+
28
+ resource :status do
29
+ member do
30
+ get :server
31
+ get :counts
32
+ end
33
+ end
34
+
35
+ resource :traffic do
36
+ member do
37
+ get :visits_counts
38
+ get :pages
39
+ get :referrals
40
+ end
41
+ end
42
+
43
+ resource :performance do
44
+ member do
45
+ get :responses
46
+ get :runtimes
47
+ end
48
+ end
49
+
50
+ resources :pages do
51
+ collection do
52
+ put :sort
53
+ end
54
+
55
+ resources :grid_files do
56
+ collection do
57
+ post :upload
58
+ end
59
+ end
60
+ end
61
+
62
+ root :to => "statuses#show"
63
+ end
64
+ end