helpdesk 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +28 -0
- data/app/assets/javascripts/helpdesk/admin/dashboard.js +2 -0
- data/app/assets/javascripts/helpdesk/admin/tickets.js +20 -0
- data/app/assets/javascripts/helpdesk/application.js +19 -0
- data/app/assets/javascripts/helpdesk/ckeditor.js +11 -0
- data/app/assets/javascripts/helpdesk/dashboard.js +2 -0
- data/app/assets/javascripts/helpdesk/faqs.js +2 -0
- data/app/assets/javascripts/helpdesk/subscribers.js +2 -0
- data/app/assets/stylesheets/helpdesk/admin/bootstrap_overrides.css +8 -0
- data/app/assets/stylesheets/helpdesk/admin/dashboard.css +4 -0
- data/app/assets/stylesheets/helpdesk/admin/tickets.css +44 -0
- data/app/assets/stylesheets/helpdesk/admin.css +8 -0
- data/app/assets/stylesheets/helpdesk/application.css +16 -0
- data/app/assets/stylesheets/helpdesk/dashboard.css +4 -0
- data/app/assets/stylesheets/helpdesk/faqs.css.scss +3 -0
- data/app/assets/stylesheets/helpdesk/imports.css.sass +0 -0
- data/app/assets/stylesheets/helpdesk/subscribers.css.scss +3 -0
- data/app/assets/stylesheets/helpdesk/tickets.css.sass +49 -0
- data/app/controllers/helpdesk/admin/base_controller.rb +32 -0
- data/app/controllers/helpdesk/admin/dashboard_controller.rb +6 -0
- data/app/controllers/helpdesk/admin/faqs_controller.rb +100 -0
- data/app/controllers/helpdesk/admin/subscribers_controller.rb +49 -0
- data/app/controllers/helpdesk/admin/ticket_types_controller.rb +52 -0
- data/app/controllers/helpdesk/admin/tickets_controller.rb +76 -0
- data/app/controllers/helpdesk/application_controller.rb +20 -0
- data/app/controllers/helpdesk/dashboard_controller.rb +26 -0
- data/app/controllers/helpdesk/faqs_controller.rb +7 -0
- data/app/controllers/helpdesk/subscribers_controller.rb +62 -0
- data/app/controllers/helpdesk/tickets_controller.rb +91 -0
- data/app/helpers/helpdesk/admin/dashboard_helper.rb +6 -0
- data/app/helpers/helpdesk/admin/tickets_helper.rb +13 -0
- data/app/helpers/helpdesk/dashboard_helper.rb +4 -0
- data/app/helpers/helpdesk/faqs_helper.rb +4 -0
- data/app/helpers/helpdesk/helpdesk_helper.rb +59 -0
- data/app/helpers/helpdesk/subscribers_helper.rb +4 -0
- data/app/helpers/helpdesk/tickets_helper.rb +7 -0
- data/app/mailers/helpdesk/notifications_mailer.rb +42 -0
- data/app/models/helpdesk/comment.rb +31 -0
- data/app/models/helpdesk/faq.rb +12 -0
- data/app/models/helpdesk/subscriber.rb +10 -0
- data/app/models/helpdesk/ticket.rb +85 -0
- data/app/models/helpdesk/ticket_type.rb +13 -0
- data/app/views/helpdesk/admin/dashboard/index.html.erb +2 -0
- data/app/views/helpdesk/admin/faqs/_form.html.haml +20 -0
- data/app/views/helpdesk/admin/faqs/_menu.html.haml +9 -0
- data/app/views/helpdesk/admin/faqs/edit.html.haml +11 -0
- data/app/views/helpdesk/admin/faqs/index.html.haml +59 -0
- data/app/views/helpdesk/admin/faqs/new.html.haml +7 -0
- data/app/views/helpdesk/admin/faqs/show.html.haml +19 -0
- data/app/views/helpdesk/admin/subscribers/_form.html.haml +12 -0
- data/app/views/helpdesk/admin/subscribers/_menu.html.haml +9 -0
- data/app/views/helpdesk/admin/subscribers/edit.html.haml +10 -0
- data/app/views/helpdesk/admin/subscribers/index.html.haml +31 -0
- data/app/views/helpdesk/admin/subscribers/new.html.haml +7 -0
- data/app/views/helpdesk/admin/ticket_types/_form.html.haml +20 -0
- data/app/views/helpdesk/admin/ticket_types/_menu.html.haml +11 -0
- data/app/views/helpdesk/admin/ticket_types/edit.html.haml +10 -0
- data/app/views/helpdesk/admin/ticket_types/index.html.haml +28 -0
- data/app/views/helpdesk/admin/ticket_types/new.html.haml +8 -0
- data/app/views/helpdesk/admin/ticket_types/show.html.haml +11 -0
- data/app/views/helpdesk/admin/tickets/_form.html.haml +23 -0
- data/app/views/helpdesk/admin/tickets/_menu.html.haml +17 -0
- data/app/views/helpdesk/admin/tickets/_ticket.html.haml +59 -0
- data/app/views/helpdesk/admin/tickets/edit.html.haml +30 -0
- data/app/views/helpdesk/admin/tickets/index.html.haml +42 -0
- data/app/views/helpdesk/admin/tickets/list.html.haml +18 -0
- data/app/views/helpdesk/admin/tickets/new.html.haml +4 -0
- data/app/views/helpdesk/admin/tickets/show.html.haml +36 -0
- data/app/views/helpdesk/dashboard/index.html.erb +3 -0
- data/app/views/helpdesk/faqs/index.html.haml +20 -0
- data/app/views/helpdesk/notifications_mailer/comment_by_helpdesk_confirmation.html.haml +15 -0
- data/app/views/helpdesk/notifications_mailer/comment_by_helpdesk_notification.html.haml +19 -0
- data/app/views/helpdesk/notifications_mailer/comment_by_requester_confirmation.html.haml +16 -0
- data/app/views/helpdesk/notifications_mailer/comment_by_requester_notification.html.haml +27 -0
- data/app/views/helpdesk/notifications_mailer/ticket_created_confirmation.html.haml +16 -0
- data/app/views/helpdesk/notifications_mailer/ticket_created_notification.html.haml +21 -0
- data/app/views/helpdesk/subscribers/_form.html.erb +37 -0
- data/app/views/helpdesk/subscribers/edit.html.erb +6 -0
- data/app/views/helpdesk/subscribers/index.html.erb +31 -0
- data/app/views/helpdesk/subscribers/new.html.erb +5 -0
- data/app/views/helpdesk/subscribers/show.html.erb +30 -0
- data/app/views/helpdesk/tickets/_form.html.haml +36 -0
- data/app/views/helpdesk/tickets/_menu.html.haml +10 -0
- data/app/views/helpdesk/tickets/_ticket.html.haml +54 -0
- data/app/views/helpdesk/tickets/index.html.haml +16 -0
- data/app/views/helpdesk/tickets/new.html.haml +4 -0
- data/app/views/helpdesk/tickets/show.html.haml +38 -0
- data/app/views/layouts/helpdesk/_topmenu.html.haml +28 -0
- data/app/views/layouts/helpdesk/_topuser.html.haml +32 -0
- data/app/views/layouts/helpdesk/admin.html.haml +35 -0
- data/app/views/layouts/helpdesk/user.html.haml +33 -0
- data/app/views/layouts/mailer_layout.html.haml +20 -0
- data/config/initializers/globalize.rb +4 -0
- data/config/initializers/simple_form.rb +117 -0
- data/config/locales/helpdesk.en.yml +111 -0
- data/config/locales/helpdesk.pl.yml +119 -0
- data/config/locales/helpdesk_routes.yml +6 -0
- data/config/locales/simple_form.en.yml +24 -0
- data/config/locales/simple_form.pl.yml +15 -0
- data/config/routes.rb +22 -0
- data/db/migrate/20120420104051_create_helpdesk_tickets.rb +14 -0
- data/db/migrate/20120423113938_create_helpdesk_comments.rb +12 -0
- data/db/migrate/20130521105605_create_helpdesk_ticket_types.rb +36 -0
- data/db/migrate/20130522085614_create_helpdesk_faqs.rb +17 -0
- data/db/migrate/20130522090420_create_helpdesk_subscribers.rb +13 -0
- data/lib/generators/helpdesk/install_generator.rb +35 -0
- data/lib/generators/helpdesk/templates/README +31 -0
- data/lib/generators/helpdesk/templates/helpdesk.rb +33 -0
- data/lib/helpdesk/engine.rb +29 -0
- data/lib/helpdesk/version.rb +3 -0
- data/lib/helpdesk.rb +39 -0
- data/lib/tasks/prepare_ci_env.rake +27 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- metadata +508 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Helpdesk::Engine.routes.draw do
|
2
|
+
# Rails.application.routes.draw do
|
3
|
+
scope "(:locale)", :locale => /pl|en/ do
|
4
|
+
# Admin only roots
|
5
|
+
namespace :admin do
|
6
|
+
resources :tickets do
|
7
|
+
get :assign, on: :member
|
8
|
+
end
|
9
|
+
resources :ticket_types
|
10
|
+
resources :faqs do
|
11
|
+
post :sort, on: :collection
|
12
|
+
end
|
13
|
+
resources :subscribers
|
14
|
+
root :to => "tickets#index"
|
15
|
+
end
|
16
|
+
|
17
|
+
resources :faqs, :only => [ :index ]
|
18
|
+
resources :tickets, :except => [ :edit, :destroy ]
|
19
|
+
root :to => "faqs#index"
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateHelpdeskTickets < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :helpdesk_tickets do |t|
|
4
|
+
t.string :subject
|
5
|
+
t.text :description
|
6
|
+
t.integer :requester_id
|
7
|
+
t.integer :assignee_id
|
8
|
+
t.string :status
|
9
|
+
t.integer :ticket_type_id
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class CreateHelpdeskTicketTypes < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :helpdesk_ticket_types do |t|
|
4
|
+
t.integer :position
|
5
|
+
t.boolean :active,:default=>1,:null=>false
|
6
|
+
t.string :tr_class
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
Helpdesk::TicketType.create_translation_table! :title => :string
|
11
|
+
|
12
|
+
|
13
|
+
tt = [["Sugestia","Sugestion","warning"],
|
14
|
+
["Pochwała","Appreciation","success"],
|
15
|
+
["Błąd","Complaint","error"],
|
16
|
+
["Pytanie","Enquiry","info"],
|
17
|
+
["Kontakt","Contact","contact"]]
|
18
|
+
|
19
|
+
tt.each do |item|
|
20
|
+
I18n.locale = :pl
|
21
|
+
type = Helpdesk::TicketType.new
|
22
|
+
type.title = item[0]
|
23
|
+
I18n.locale = :en
|
24
|
+
type.title = item[1]
|
25
|
+
type.tr_class = item[2]
|
26
|
+
type.active = true
|
27
|
+
type.save!
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def down
|
33
|
+
drop_table :helpdesk_ticket_types
|
34
|
+
Helpdesk::TicketType.drop_translation_table!
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateHelpdeskFaqs < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
create_table :helpdesk_faqs do |t|
|
4
|
+
t.integer :position
|
5
|
+
t.boolean :active,:default=>0,:null=>false
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
Helpdesk::Faq.create_translation_table! :title => :string, :text => :text
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
drop_table :helpdesk_faqs
|
14
|
+
Helpdesk::Faq.drop_translation_table!
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateHelpdeskSubscribers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :helpdesk_subscribers do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :email
|
6
|
+
t.string :lang
|
7
|
+
t.string :hashcode
|
8
|
+
t.boolean :confirmed,:default=>0,:null=>false
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
3
|
+
module Helpdesk
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
desc "Creates a Helpdesk initializer and copy locale files to your application."
|
9
|
+
|
10
|
+
def copy_initializer
|
11
|
+
template "helpdesk.rb", "config/initializers/helpdesk.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_locale
|
15
|
+
copy_file "../../../../config/locales/helpdesk.en.yml", "config/locales/helpdesk.en.yml"
|
16
|
+
copy_file "../../../../config/locales/helpdesk.pl.yml", "config/locales/helpdesk.pl.yml"
|
17
|
+
end
|
18
|
+
|
19
|
+
def run_rake
|
20
|
+
rake "helpdesk:install:migrations"
|
21
|
+
rake "db:migrate"
|
22
|
+
end
|
23
|
+
|
24
|
+
def add_engine_to_route
|
25
|
+
route "mount Helpdesk::Engine, :at => '/helpdesk'"
|
26
|
+
end
|
27
|
+
|
28
|
+
def show_readme
|
29
|
+
readme "README" if behavior == :invoke
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
You need to do some manual setup to get Helpdesk working:
|
4
|
+
|
5
|
+
1. Review settings in new config/initializers/helpdesk.rb and update where
|
6
|
+
neccessary.
|
7
|
+
|
8
|
+
2. Add 3 methods to your applications application_controller.rb
|
9
|
+
* helpdesk_user - to exposes your current_user
|
10
|
+
* helpdesk_admin? - to check privileges
|
11
|
+
* helpdesk_admins_collection - to list all admin
|
12
|
+
|
13
|
+
Example, for app with devise&rolify gems:
|
14
|
+
application_controller.rb:
|
15
|
+
|
16
|
+
helper_method :helpdesk_user,:helpdesk_admin?,:helpdesk_admin_collection
|
17
|
+
def helpdesk_user
|
18
|
+
current_user
|
19
|
+
end
|
20
|
+
|
21
|
+
def helpdesk_admin?
|
22
|
+
current_user.has_role? :admin
|
23
|
+
end
|
24
|
+
|
25
|
+
def helpdesk_admin_collection
|
26
|
+
(Helpdesk.user_class).with_role(:admin)
|
27
|
+
end
|
28
|
+
|
29
|
+
3. Restart app
|
30
|
+
|
31
|
+
===============================================================================
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'helpdesk'
|
2
|
+
|
3
|
+
::Helpdesk.setup do |config|
|
4
|
+
# Class that represents the user/admin
|
5
|
+
config.user_class = "User"
|
6
|
+
|
7
|
+
# Method usign to display information about user for users
|
8
|
+
config.display_user = "name"
|
9
|
+
|
10
|
+
# Method usign to display information about user for admins (name+id?)
|
11
|
+
config.display_user_uniq_info = "email"
|
12
|
+
|
13
|
+
# Require User to be present in order to access Helpdesk
|
14
|
+
config.require_user = true
|
15
|
+
|
16
|
+
# Base application sign in route name
|
17
|
+
config.sign_in_url = 'new_user_session_path'
|
18
|
+
|
19
|
+
# Helpdesk email for notification
|
20
|
+
config.email = 'helpdesk@example.com'
|
21
|
+
|
22
|
+
# Send confirmation emails
|
23
|
+
config.send_confirmation_emails = true
|
24
|
+
|
25
|
+
# Site name in email footer
|
26
|
+
config.site_name = "Example Helpdesk Team"
|
27
|
+
|
28
|
+
# Site address in email footer
|
29
|
+
config.site_address = "www.example.com"
|
30
|
+
|
31
|
+
# Helpdesk title
|
32
|
+
config.helpdesk_name = "Example Helpdesk"
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'simple_form'
|
3
|
+
require 'state_machine'
|
4
|
+
require 'bootstrap-sass'
|
5
|
+
require 'rails_autolink'
|
6
|
+
require 'simple_form'
|
7
|
+
require 'globalize'
|
8
|
+
require 'batch_translations'
|
9
|
+
require 'ckeditor'
|
10
|
+
require 'chosen-rails'
|
11
|
+
require 'kaminari'
|
12
|
+
require 'jquery-ui-rails'
|
13
|
+
|
14
|
+
module Helpdesk
|
15
|
+
class Engine < ::Rails::Engine
|
16
|
+
isolate_namespace Helpdesk
|
17
|
+
|
18
|
+
initializer "Helpdesk precompile hook" do |app|
|
19
|
+
app.config.assets.precompile += ['helpdesk/admin.css','helpdesk/application.css','helpdesk/application.js']
|
20
|
+
end
|
21
|
+
|
22
|
+
config.to_prepare do
|
23
|
+
if Helpdesk.user_class
|
24
|
+
Helpdesk.user_class.has_many :helpdesk_tickets, :class_name => "Helpdesk::Ticket", :foreign_key => "requester_id"
|
25
|
+
#Helpdesk.user_class.has_many :helpdesk_tickets, :class_name => "Helpdesk::Ticket", :foreign_key => "assignee_id"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/helpdesk.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "helpdesk/engine"
|
2
|
+
|
3
|
+
module Helpdesk
|
4
|
+
mattr_accessor :require_user
|
5
|
+
@@require_user = false
|
6
|
+
|
7
|
+
mattr_accessor :sign_in_url
|
8
|
+
|
9
|
+
mattr_accessor :user_class
|
10
|
+
|
11
|
+
mattr_accessor :display_user
|
12
|
+
|
13
|
+
mattr_accessor :display_user_uniq_info
|
14
|
+
|
15
|
+
mattr_accessor :mail_server
|
16
|
+
|
17
|
+
mattr_accessor :email
|
18
|
+
|
19
|
+
mattr_accessor :send_confirmation_emails
|
20
|
+
@@send_confirmation_emails = false
|
21
|
+
|
22
|
+
mattr_accessor :site_name
|
23
|
+
|
24
|
+
mattr_accessor :site_address
|
25
|
+
|
26
|
+
mattr_accessor :helpdesk_name
|
27
|
+
@@helpdesk_name = "Helpdesk"
|
28
|
+
|
29
|
+
def self.setup
|
30
|
+
yield self
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.user_class
|
34
|
+
if @@user_class.is_a?(String)
|
35
|
+
@@user_class.constantize
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
namespace :helpdesk do
|
2
|
+
desc "Prepare Continuous Integration environment"
|
3
|
+
task :prepare_ci_env do
|
4
|
+
ENV['SKIP_HELPDESK_INITIALIZER'] = 'true'
|
5
|
+
adapter = ENV["CI_DB_ADAPTER"] || "sqlite3"
|
6
|
+
database = ENV["CI_DB_DATABASE"] || ("sqlite3" == adapter ? "db/development.sqlite3" : "ci_helpdesk")
|
7
|
+
|
8
|
+
configuration = {
|
9
|
+
"test" => {
|
10
|
+
"adapter" => adapter,
|
11
|
+
"database" => database,
|
12
|
+
"username" => ENV["CI_DB_USERNAME"],
|
13
|
+
"password" => ENV["CI_DB_PASSWORD"],
|
14
|
+
"host" => ENV["CI_DB_HOST"] || "localhost",
|
15
|
+
"encoding" => ENV["CI_DB_ENCODING"] || "utf8",
|
16
|
+
"pool" => (ENV["CI_DB_POOL"] || 5).to_int,
|
17
|
+
"timeout" => (ENV["CI_DB_TIMEOUT"] || 5000).to_int
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
filename = Rails.root.join("config/database.yml")
|
22
|
+
|
23
|
+
File.open(filename, "w") do |f|
|
24
|
+
f.write(configuration.to_yaml)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="form-inputs">
|
5
|
+
<%- attributes.each do |attribute| -%>
|
6
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
+
<%- end -%>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-actions">
|
11
|
+
<%%= f.button :submit %>
|
12
|
+
</div>
|
13
|
+
<%% end %>
|