radesk 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/radesk/radesk.js.coffee +4 -0
  3. data/app/assets/stylesheets/radesk/radesk.css.scss +41 -19
  4. data/app/controllers/radesk/admin/activities_controller.rb +11 -0
  5. data/app/controllers/radesk/admin/admin_controller.rb +9 -0
  6. data/app/controllers/radesk/admin/categories_controller.rb +2 -3
  7. data/app/controllers/radesk/admin/users_controller.rb +18 -0
  8. data/app/controllers/radesk/answers_controller.rb +9 -11
  9. data/app/controllers/radesk/application_controller.rb +5 -1
  10. data/app/controllers/radesk/tickets_controller.rb +23 -13
  11. data/app/controllers/radesk/uploads_controller.rb +18 -0
  12. data/app/helpers/radesk/activities_helper.rb +11 -0
  13. data/app/helpers/radesk/application_helper.rb +9 -0
  14. data/app/mailers/radesk/user_mailer.rb +5 -4
  15. data/app/models/radesk/activity.rb +6 -0
  16. data/app/models/radesk/answer.rb +7 -3
  17. data/app/models/radesk/concerns/access.rb +9 -0
  18. data/app/models/radesk/ticket.rb +8 -5
  19. data/app/models/radesk/upload.rb +9 -0
  20. data/app/views/layouts/radesk/application.html.haml +6 -5
  21. data/app/views/radesk/admin/activities/_answer.html.haml +1 -0
  22. data/app/views/radesk/admin/activities/_ticket.html.haml +1 -0
  23. data/app/views/radesk/admin/activities/index.html.haml +16 -0
  24. data/app/views/radesk/admin/categories/_form.html.haml +3 -1
  25. data/app/views/radesk/admin/categories/edit.html.haml +1 -2
  26. data/app/views/radesk/admin/categories/index.html.haml +11 -9
  27. data/app/views/radesk/admin/categories/new.html.haml +1 -2
  28. data/app/views/radesk/admin/users/show.html.haml +3 -0
  29. data/app/views/radesk/answers/_form.html.haml +24 -0
  30. data/app/views/radesk/answers/_list.html.haml +29 -13
  31. data/app/views/radesk/answers/_upload_fields.html.haml +2 -0
  32. data/app/views/radesk/answers/edit.html.haml +1 -6
  33. data/app/views/radesk/tickets/_form.html.haml +5 -4
  34. data/app/views/radesk/tickets/_list.html.haml +23 -0
  35. data/app/views/radesk/tickets/index.html.haml +13 -24
  36. data/app/views/radesk/tickets/new.html.haml +1 -2
  37. data/app/views/radesk/tickets/show.html.haml +4 -35
  38. data/app/views/radesk/uploads/destroy.js.erb +1 -0
  39. data/config/locales/en.yml +51 -0
  40. data/config/locales/zh-CN.yml +37 -0
  41. data/config/routes.rb +9 -0
  42. data/db/migrate/20150112111134_remove_message_from_radesk_tickets.rb +5 -0
  43. data/db/migrate/20150112182604_create_radesk_uploads.rb +11 -0
  44. data/db/migrate/20150114194722_create_radesk_activities.rb +11 -0
  45. data/lib/generators/radesk/dummy/templates/Rakefile +6 -0
  46. data/lib/generators/radesk/dummy/templates/app/assets/javascripts/application.js +13 -0
  47. data/lib/generators/radesk/dummy/templates/app/assets/stylesheets/application.css +15 -0
  48. data/lib/generators/radesk/dummy/templates/app/controllers/application_controller.rb +5 -0
  49. data/lib/generators/radesk/dummy/templates/app/helpers/application_helper.rb +2 -0
  50. data/lib/generators/radesk/dummy/templates/app/models/user.rb +10 -0
  51. data/lib/generators/radesk/dummy/templates/app/views/layouts/application.html.erb +14 -0
  52. data/lib/generators/radesk/dummy/templates/bin/bundle +3 -0
  53. data/lib/generators/radesk/dummy/templates/bin/rails +4 -0
  54. data/lib/generators/radesk/dummy/templates/bin/rake +4 -0
  55. data/lib/generators/radesk/dummy/templates/bin/setup +29 -0
  56. data/lib/generators/radesk/dummy/templates/config.ru +4 -0
  57. data/lib/generators/radesk/dummy/templates/config/application.rb +31 -0
  58. data/lib/generators/radesk/dummy/templates/config/boot.rb +5 -0
  59. data/lib/generators/radesk/dummy/templates/config/database.yml +25 -0
  60. data/lib/generators/radesk/dummy/templates/config/environment.rb +5 -0
  61. data/lib/generators/radesk/dummy/templates/config/environments/development.rb +44 -0
  62. data/lib/generators/radesk/dummy/templates/config/environments/production.rb +79 -0
  63. data/lib/generators/radesk/dummy/templates/config/environments/test.rb +42 -0
  64. data/lib/generators/radesk/dummy/templates/config/initializers/assets.rb +11 -0
  65. data/lib/generators/radesk/dummy/templates/config/initializers/backtrace_silencers.rb +7 -0
  66. data/lib/generators/radesk/dummy/templates/config/initializers/cookies_serializer.rb +3 -0
  67. data/lib/generators/radesk/dummy/templates/config/initializers/devise.rb +259 -0
  68. data/lib/generators/radesk/dummy/templates/config/initializers/filter_parameter_logging.rb +4 -0
  69. data/lib/generators/radesk/dummy/templates/config/initializers/inflections.rb +16 -0
  70. data/lib/generators/radesk/dummy/templates/config/initializers/mime_types.rb +4 -0
  71. data/lib/generators/radesk/dummy/templates/config/initializers/session_store.rb +3 -0
  72. data/lib/generators/radesk/dummy/templates/config/initializers/wrap_parameters.rb +14 -0
  73. data/lib/generators/radesk/dummy/templates/config/locales/devise.en.yml +60 -0
  74. data/lib/generators/radesk/dummy/templates/config/locales/en.yml +23 -0
  75. data/lib/generators/radesk/dummy/templates/config/routes.rb +3 -0
  76. data/lib/generators/radesk/dummy/templates/config/secrets.yml +22 -0
  77. data/lib/generators/radesk/dummy/templates/db/migrate/20150108203658_devise_create_users.rb +42 -0
  78. data/lib/generators/radesk/dummy/templates/public/404.html +67 -0
  79. data/lib/generators/radesk/dummy/templates/public/422.html +67 -0
  80. data/lib/generators/radesk/dummy/templates/public/500.html +66 -0
  81. data/lib/generators/radesk/dummy/templates/public/favicon.ico +0 -0
  82. data/lib/generators/radesk/dummy_generator.rb +13 -0
  83. data/lib/generators/radesk/install/templates/initializer.rb +2 -0
  84. data/lib/radesk.rb +8 -0
  85. data/lib/radesk/version.rb +1 -1
  86. metadata +176 -46
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,60 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password has been changed successfully. You are now signed in."
34
+ updated_not_active: "Your password has been changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
42
+ updated: "Your account has been updated successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ already_signed_out: "Signed out successfully."
47
+ unlocks:
48
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
+ errors:
52
+ messages:
53
+ already_confirmed: "was already confirmed, please try signing in"
54
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55
+ expired: "has expired, please request a new one"
56
+ not_found: "not found"
57
+ not_locked: "was not locked"
58
+ not_saved:
59
+ one: "1 error prohibited this %{resource} from being saved:"
60
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ devise_for :users
3
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 8ad4f175241eaf5b585634d0723020929f245062c8923adbbbced612d39d6177ba16c6ef65569e51d247fab318855c51e160ac223071a498d28a00c2a5355d8a
15
+
16
+ test:
17
+ secret_key_base: 35bca9114b30a5e8d4ae001b6efe8450955195cb650cbbfd69ffbe2aa3b5df160c587f22aa76e8e56fb14f46c6cfa1f4c18bb3fff8c23e6b5d5e2c2b21e184e5
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,42 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, null: false, default: ""
6
+ t.string :encrypted_password, null: false, default: ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, default: 0, null: false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+
34
+ t.timestamps
35
+ end
36
+
37
+ add_index :users, :email, unique: true
38
+ add_index :users, :reset_password_token, unique: true
39
+ # add_index :users, :confirmation_token, unique: true
40
+ # add_index :users, :unlock_token, unique: true
41
+ end
42
+ end
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
@@ -0,0 +1,13 @@
1
+ require 'rails/generators/base'
2
+ require 'fileutils'
3
+
4
+ module Radesk
5
+ module Generators
6
+ class DummyGenerator < Rails::Generators::Base
7
+ def copy_dummy
8
+ FileUtils.rm_rf('spec/dummy')
9
+ FileUtils.cp_r File.join(File.dirname(__FILE__), "dummy/templates/."), 'spec/dummy'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,4 +2,6 @@ Radesk.setup do |config|
2
2
  # config.user_class_name = 'User'
3
3
  # config.current_user_method_name = 'current_user'
4
4
  # config.email_from = 'noreply@example.com'
5
+ # config.home_path = '/'
6
+ # config.sign_in_path = '/users/sign_in'
5
7
  end
@@ -3,6 +3,8 @@ require "haml"
3
3
  require "font-awesome-rails"
4
4
  require "kaminari"
5
5
  require "jquery-rails"
6
+ require "paperclip"
7
+ require "coffee-rails"
6
8
 
7
9
  module Radesk
8
10
  mattr_accessor :user_class_name
@@ -14,6 +16,12 @@ module Radesk
14
16
  mattr_accessor :email_from
15
17
  @@email_from = "noreply@example.com"
16
18
 
19
+ mattr_accessor :home_path
20
+ @@home_path = "/"
21
+
22
+ mattr_accessor :sign_in_path
23
+ @@sign_in_path = "/users/sign_in"
24
+
17
25
  def self.setup
18
26
  yield self
19
27
  end