helpdesk 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +28 -0
  4. data/app/assets/javascripts/helpdesk/admin/dashboard.js +2 -0
  5. data/app/assets/javascripts/helpdesk/admin/tickets.js +20 -0
  6. data/app/assets/javascripts/helpdesk/application.js +19 -0
  7. data/app/assets/javascripts/helpdesk/ckeditor.js +11 -0
  8. data/app/assets/javascripts/helpdesk/dashboard.js +2 -0
  9. data/app/assets/javascripts/helpdesk/faqs.js +2 -0
  10. data/app/assets/javascripts/helpdesk/subscribers.js +2 -0
  11. data/app/assets/stylesheets/helpdesk/admin/bootstrap_overrides.css +8 -0
  12. data/app/assets/stylesheets/helpdesk/admin/dashboard.css +4 -0
  13. data/app/assets/stylesheets/helpdesk/admin/tickets.css +44 -0
  14. data/app/assets/stylesheets/helpdesk/admin.css +8 -0
  15. data/app/assets/stylesheets/helpdesk/application.css +16 -0
  16. data/app/assets/stylesheets/helpdesk/dashboard.css +4 -0
  17. data/app/assets/stylesheets/helpdesk/faqs.css.scss +3 -0
  18. data/app/assets/stylesheets/helpdesk/imports.css.sass +0 -0
  19. data/app/assets/stylesheets/helpdesk/subscribers.css.scss +3 -0
  20. data/app/assets/stylesheets/helpdesk/tickets.css.sass +49 -0
  21. data/app/controllers/helpdesk/admin/base_controller.rb +32 -0
  22. data/app/controllers/helpdesk/admin/dashboard_controller.rb +6 -0
  23. data/app/controllers/helpdesk/admin/faqs_controller.rb +100 -0
  24. data/app/controllers/helpdesk/admin/subscribers_controller.rb +49 -0
  25. data/app/controllers/helpdesk/admin/ticket_types_controller.rb +52 -0
  26. data/app/controllers/helpdesk/admin/tickets_controller.rb +76 -0
  27. data/app/controllers/helpdesk/application_controller.rb +20 -0
  28. data/app/controllers/helpdesk/dashboard_controller.rb +26 -0
  29. data/app/controllers/helpdesk/faqs_controller.rb +7 -0
  30. data/app/controllers/helpdesk/subscribers_controller.rb +62 -0
  31. data/app/controllers/helpdesk/tickets_controller.rb +91 -0
  32. data/app/helpers/helpdesk/admin/dashboard_helper.rb +6 -0
  33. data/app/helpers/helpdesk/admin/tickets_helper.rb +13 -0
  34. data/app/helpers/helpdesk/dashboard_helper.rb +4 -0
  35. data/app/helpers/helpdesk/faqs_helper.rb +4 -0
  36. data/app/helpers/helpdesk/helpdesk_helper.rb +59 -0
  37. data/app/helpers/helpdesk/subscribers_helper.rb +4 -0
  38. data/app/helpers/helpdesk/tickets_helper.rb +7 -0
  39. data/app/mailers/helpdesk/notifications_mailer.rb +42 -0
  40. data/app/models/helpdesk/comment.rb +31 -0
  41. data/app/models/helpdesk/faq.rb +12 -0
  42. data/app/models/helpdesk/subscriber.rb +10 -0
  43. data/app/models/helpdesk/ticket.rb +85 -0
  44. data/app/models/helpdesk/ticket_type.rb +13 -0
  45. data/app/views/helpdesk/admin/dashboard/index.html.erb +2 -0
  46. data/app/views/helpdesk/admin/faqs/_form.html.haml +20 -0
  47. data/app/views/helpdesk/admin/faqs/_menu.html.haml +9 -0
  48. data/app/views/helpdesk/admin/faqs/edit.html.haml +11 -0
  49. data/app/views/helpdesk/admin/faqs/index.html.haml +59 -0
  50. data/app/views/helpdesk/admin/faqs/new.html.haml +7 -0
  51. data/app/views/helpdesk/admin/faqs/show.html.haml +19 -0
  52. data/app/views/helpdesk/admin/subscribers/_form.html.haml +12 -0
  53. data/app/views/helpdesk/admin/subscribers/_menu.html.haml +9 -0
  54. data/app/views/helpdesk/admin/subscribers/edit.html.haml +10 -0
  55. data/app/views/helpdesk/admin/subscribers/index.html.haml +31 -0
  56. data/app/views/helpdesk/admin/subscribers/new.html.haml +7 -0
  57. data/app/views/helpdesk/admin/ticket_types/_form.html.haml +20 -0
  58. data/app/views/helpdesk/admin/ticket_types/_menu.html.haml +11 -0
  59. data/app/views/helpdesk/admin/ticket_types/edit.html.haml +10 -0
  60. data/app/views/helpdesk/admin/ticket_types/index.html.haml +28 -0
  61. data/app/views/helpdesk/admin/ticket_types/new.html.haml +8 -0
  62. data/app/views/helpdesk/admin/ticket_types/show.html.haml +11 -0
  63. data/app/views/helpdesk/admin/tickets/_form.html.haml +23 -0
  64. data/app/views/helpdesk/admin/tickets/_menu.html.haml +17 -0
  65. data/app/views/helpdesk/admin/tickets/_ticket.html.haml +59 -0
  66. data/app/views/helpdesk/admin/tickets/edit.html.haml +30 -0
  67. data/app/views/helpdesk/admin/tickets/index.html.haml +42 -0
  68. data/app/views/helpdesk/admin/tickets/list.html.haml +18 -0
  69. data/app/views/helpdesk/admin/tickets/new.html.haml +4 -0
  70. data/app/views/helpdesk/admin/tickets/show.html.haml +36 -0
  71. data/app/views/helpdesk/dashboard/index.html.erb +3 -0
  72. data/app/views/helpdesk/faqs/index.html.haml +20 -0
  73. data/app/views/helpdesk/notifications_mailer/comment_by_helpdesk_confirmation.html.haml +15 -0
  74. data/app/views/helpdesk/notifications_mailer/comment_by_helpdesk_notification.html.haml +19 -0
  75. data/app/views/helpdesk/notifications_mailer/comment_by_requester_confirmation.html.haml +16 -0
  76. data/app/views/helpdesk/notifications_mailer/comment_by_requester_notification.html.haml +27 -0
  77. data/app/views/helpdesk/notifications_mailer/ticket_created_confirmation.html.haml +16 -0
  78. data/app/views/helpdesk/notifications_mailer/ticket_created_notification.html.haml +21 -0
  79. data/app/views/helpdesk/subscribers/_form.html.erb +37 -0
  80. data/app/views/helpdesk/subscribers/edit.html.erb +6 -0
  81. data/app/views/helpdesk/subscribers/index.html.erb +31 -0
  82. data/app/views/helpdesk/subscribers/new.html.erb +5 -0
  83. data/app/views/helpdesk/subscribers/show.html.erb +30 -0
  84. data/app/views/helpdesk/tickets/_form.html.haml +36 -0
  85. data/app/views/helpdesk/tickets/_menu.html.haml +10 -0
  86. data/app/views/helpdesk/tickets/_ticket.html.haml +54 -0
  87. data/app/views/helpdesk/tickets/index.html.haml +16 -0
  88. data/app/views/helpdesk/tickets/new.html.haml +4 -0
  89. data/app/views/helpdesk/tickets/show.html.haml +38 -0
  90. data/app/views/layouts/helpdesk/_topmenu.html.haml +28 -0
  91. data/app/views/layouts/helpdesk/_topuser.html.haml +32 -0
  92. data/app/views/layouts/helpdesk/admin.html.haml +35 -0
  93. data/app/views/layouts/helpdesk/user.html.haml +33 -0
  94. data/app/views/layouts/mailer_layout.html.haml +20 -0
  95. data/config/initializers/globalize.rb +4 -0
  96. data/config/initializers/simple_form.rb +117 -0
  97. data/config/locales/helpdesk.en.yml +111 -0
  98. data/config/locales/helpdesk.pl.yml +119 -0
  99. data/config/locales/helpdesk_routes.yml +6 -0
  100. data/config/locales/simple_form.en.yml +24 -0
  101. data/config/locales/simple_form.pl.yml +15 -0
  102. data/config/routes.rb +22 -0
  103. data/db/migrate/20120420104051_create_helpdesk_tickets.rb +14 -0
  104. data/db/migrate/20120423113938_create_helpdesk_comments.rb +12 -0
  105. data/db/migrate/20130521105605_create_helpdesk_ticket_types.rb +36 -0
  106. data/db/migrate/20130522085614_create_helpdesk_faqs.rb +17 -0
  107. data/db/migrate/20130522090420_create_helpdesk_subscribers.rb +13 -0
  108. data/lib/generators/helpdesk/install_generator.rb +35 -0
  109. data/lib/generators/helpdesk/templates/README +31 -0
  110. data/lib/generators/helpdesk/templates/helpdesk.rb +33 -0
  111. data/lib/helpdesk/engine.rb +29 -0
  112. data/lib/helpdesk/version.rb +3 -0
  113. data/lib/helpdesk.rb +39 -0
  114. data/lib/tasks/prepare_ci_env.rake +27 -0
  115. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  116. metadata +508 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5786302c9e0232c2c4b770927f76cfb79cae7cb2
4
+ data.tar.gz: acb47b5946c3c45bba8775e89775fd05c780b0f8
5
+ SHA512:
6
+ metadata.gz: b6f9ed3e548a2c5f8268a3dc5e69585c5f1bd0cbb6a2ca7e259bb32e943299e4f192669db22deb6c17900a336eb26e28f07312ba75b531cc58eca64476cac68a
7
+ data.tar.gz: 551e4aba11cf1fcce476e0e4feec24392ee4c3ac8b48d4f1083af1f4e5a5bbe68fdd305348cc336396562e7f6311f514a58dc50d9d531626fc7ed5c001906e9c
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 John Beynon
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Helpdesk'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+ Bundler::GemHelper.install_tasks
28
+
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,20 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
3
+
4
+ $(document).ready(function(){
5
+ $('a[href*="#"]').click(function(){
6
+ $($(this).attr("href")).effect("highlight", {}, 1500);
7
+ });
8
+ });
9
+
10
+ (function() {
11
+ $(function() {
12
+ return $('.chosen-select').chosen({
13
+ allow_single_deselect: true,
14
+ placeholder_text: 'Wybierz',
15
+ no_results_text: 'Nie znaleziono pasujących',
16
+ width: '220px'
17
+ });
18
+ });
19
+
20
+ }).call(this)
@@ -0,0 +1,19 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require bootstrap
16
+ //= require ckeditor/init
17
+ //= require jquery.ui.all
18
+ //= require chosen-jquery
19
+ //= require_tree .
@@ -0,0 +1,11 @@
1
+ CKEDITOR.config.toolbar_mini =
2
+ [
3
+ ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
4
+ ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
5
+ ['NumberedList','BulletedList','-','Outdent','Indent'],
6
+ ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
7
+ ['Link','Unlink'],
8
+ ['Image','Table','HorizontalRule'],
9
+ ['Styles','Format','Font','FontSize'],
10
+ ['TextColor','BGColor']
11
+ ];
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,8 @@
1
+ body {
2
+ padding-top: 30px; /* 60px to make the container go all the way to the bottom of the topbar */
3
+ }
4
+
5
+ /*.container, .navbar-fixed-top .container, .navbar-fixed-bottom .container {
6
+ width: 1170px;
7
+ }*/
8
+
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,44 @@
1
+ .comment{
2
+ min-height: 50px;
3
+ }
4
+ .comment-left{
5
+ display:block;
6
+ width:100px;
7
+ height:50px;
8
+ float:left;
9
+ }
10
+
11
+ .comment-textarea{
12
+ height: 100px;
13
+ width: 482px;
14
+ }
15
+
16
+ .comment-body{
17
+ margin-left: 100px;
18
+ }
19
+
20
+ :target {
21
+ background-color: #ffa;
22
+ -webkit-transition: background-color 1s linear;
23
+ -moz-transition: background-color 1s linear;
24
+ -o-transition: background-color 1s linear;
25
+ transition: background-color 1s linear;
26
+ }
27
+
28
+ a.anchor{
29
+ opacity: 0;
30
+ -moz-transition: opacity .25s linear, visibility .1s linear .5s;
31
+ -webkit-transition: opacity .25s linear, visibility .1s linear .5s;
32
+ -o-transition: opacity .25s linear, visibility .1s linear .5s;
33
+ transition: opacity .25s linear, visibility .1s linear .5s;
34
+ visibility: hidden;
35
+ }
36
+ .comment:hover a.anchor
37
+ {
38
+ opacity: 1;
39
+ -moz-transition: opacity .25s linear, visibility linear .5s;
40
+ -webkit-transition: opacity .25s linear, visibility linear .5s;
41
+ -o-transition: opacity .25s linear, visibility linear .5s;
42
+ transition: opacity .25s linear, visibility linear .5s;
43
+ visibility: visible;
44
+ }
@@ -0,0 +1,8 @@
1
+ /*
2
+ *= require_self
3
+ *= require helpdesk/imports
4
+ *= require helpdesk/admin/bootstrap_overrides
5
+ *= require helpdesk/admin/tickets
6
+ *= require bootstrap
7
+ *= require chosen
8
+ */
@@ -0,0 +1,16 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ *= require helpdesk/imports
14
+ *= require helpdesk/admin/bootstrap_overrides
15
+ *= require helpdesk/admin/tickets
16
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Faqs controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
File without changes
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Subscribers controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,49 @@
1
+
2
+ body
3
+
4
+ form.feedback
5
+
6
+ > fieldset
7
+ margin: 0px auto
8
+ padding: 0px
9
+ width: 500px
10
+ text-align: center
11
+
12
+
13
+ > div
14
+ clear: both
15
+ display: block
16
+
17
+ div.subject input[type=text]
18
+ float: left
19
+ width: 350px
20
+
21
+
22
+
23
+ div.subject
24
+ select
25
+ float: right
26
+ margin: 0px
27
+ padding: 8px 3px
28
+ height: 34px
29
+ width: 110px
30
+ vertical-align: top
31
+ font-size: 13px
32
+
33
+
34
+ div.content textarea
35
+
36
+ > div.content
37
+ padding-top: 20px
38
+
39
+ textarea
40
+ height: 100px
41
+ width: 482px
42
+
43
+ > div.agreement
44
+ input[type=checkbox]
45
+ vertical-align: middle
46
+
47
+ > div.form-actions
48
+ .button
49
+ margin-left: 12px
@@ -0,0 +1,32 @@
1
+ module Helpdesk
2
+ module Admin
3
+ class BaseController < Helpdesk::ApplicationController
4
+
5
+ helper Helpdesk::Engine.helpers
6
+ # helper Helpdesk::ApplicationHelper
7
+ before_filter :authenticate_helpdesk_admin
8
+ before_filter :my_tickets
9
+
10
+ layout 'helpdesk/admin'
11
+
12
+ private
13
+ #methods helpdesk_user & helpdesk_admin? - must by defined in file app/application_controller
14
+
15
+ def authenticate_helpdesk_admin
16
+ unless helpdesk_admin?
17
+ redirect_to main_app.root_url, notice:'You have no power here!'
18
+ end
19
+ end
20
+
21
+ def my_tickets
22
+ @my_tickets = Ticket
23
+ .includes(:comments=>[:author])
24
+ .includes(:requester)
25
+ .includes(:assignee)
26
+ .includes(:ticket_type)
27
+ .where('assignee_id = ?', helpdesk_user.id)
28
+ .active
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,6 @@
1
+ class Helpdesk::Admin::DashboardController < Helpdesk::Admin::BaseController
2
+
3
+ def index
4
+ #@tickets = Ticket.all
5
+ end
6
+ end
@@ -0,0 +1,100 @@
1
+ class Helpdesk::Admin::FaqsController < Helpdesk::Admin::BaseController
2
+
3
+ def sort
4
+ params[:faqs].each_with_index do |id, index|
5
+ Helpdesk::Faq.update_all(['position=?', index+1], ['id=?', id])
6
+ end
7
+ render :nothing => true
8
+ end
9
+ # GET /faqs
10
+ # GET /faqs.json
11
+ def index
12
+ if params[:faqs] == 'active'
13
+ @faqs = Helpdesk::Faq.active
14
+ elsif params[:faqs] == 'inactive'
15
+ @faqs = Helpdesk::Faq.inactive
16
+ else
17
+ @faqs = Helpdesk::Faq.all
18
+ end
19
+ respond_to do |format|
20
+ format.html # index.html.erb
21
+ format.json { render json: @faqs }
22
+ end
23
+ end
24
+
25
+ # GET /faqs/1
26
+ # GET /faqs/1.json
27
+ def show
28
+ @faq = Helpdesk::Faq.find(params[:id])
29
+
30
+ respond_to do |format|
31
+ format.html # show.html.erb
32
+ format.json { render json: @faq }
33
+ end
34
+ end
35
+
36
+ # GET /faqs/new
37
+ # GET /faqs/new.json
38
+ def new
39
+ @faq = Helpdesk::Faq.new
40
+
41
+ respond_to do |format|
42
+ format.html # new.html.erb
43
+ format.json { render json: @faq }
44
+ end
45
+ end
46
+
47
+ # GET /faqs/1/edit
48
+ def edit
49
+ @faq = Helpdesk::Faq.find(params[:id])
50
+ end
51
+
52
+ # POST /faqs
53
+ # POST /faqs.json
54
+ def create
55
+ @faq = Helpdesk::Faq.new(faq_params)
56
+
57
+ respond_to do |format|
58
+ if @faq.save
59
+ format.html { redirect_to admin_faqs_url, notice: 'Faq was successfully created.' }
60
+ format.json { render json: @faq, status: :created, location: @faq }
61
+ else
62
+ format.html { render action: "new" }
63
+ format.json { render json: @faq.errors, status: :unprocessable_entity }
64
+ end
65
+ end
66
+ end
67
+
68
+ # PUT /faqs/1
69
+ # PUT /faqs/1.json
70
+ def update
71
+ @faq = Helpdesk::Faq.find(params[:id])
72
+
73
+ respond_to do |format|
74
+ if @faq.update_attributes(faq_params)
75
+ format.html { redirect_to admin_faqs_url, notice: 'Faq was successfully updated.' }
76
+ format.json { head :no_content }
77
+ else
78
+ format.html { render action: "edit" }
79
+ format.json { render json: @faq.errors, status: :unprocessable_entity }
80
+ end
81
+ end
82
+ end
83
+
84
+ # DELETE /faqs/1
85
+ # DELETE /faqs/1.json
86
+ def destroy
87
+ @faq = Helpdesk::Faq.find(params[:id])
88
+ @faq.destroy
89
+
90
+ respond_to do |format|
91
+ format.html { redirect_to admin_faqs_url }
92
+ format.json { head :no_content }
93
+ end
94
+ end
95
+
96
+ private
97
+ def faq_params
98
+ params.require(:faq).permit(:active, :position, :title, :text, translations_attributes:[:id,:locale,:title,:text])
99
+ end
100
+ end
@@ -0,0 +1,49 @@
1
+ class Helpdesk::Admin::SubscribersController < Helpdesk::Admin::BaseController
2
+
3
+ def index
4
+ @subscribers = Helpdesk::Subscriber.page(params[:page])
5
+ end
6
+
7
+ def new
8
+ @subscriber = Helpdesk::Subscriber.new()
9
+ end
10
+
11
+ def create
12
+ @subscriber = Helpdesk::Subscriber.new(subscriber_params)
13
+ if @subscriber.save
14
+ redirect_to admin_subscribers_path, notice: t('subscribers.created')
15
+ else
16
+ render action: "index"
17
+ end
18
+ end
19
+
20
+ def edit
21
+ @subscriber = Helpdesk::Subscriber.find(params[:id])
22
+ end
23
+
24
+ # PUT /subscribers/1
25
+ # PUT /subscribers/1.json
26
+ def update
27
+ @subscriber = Helpdesk::Subscriber.find(params[:id])
28
+
29
+ if @subscriber.update_attributes(subscriber_params)
30
+ redirect_to admin_subscribers_path, notice: 'Subscriber was successfully updated.'
31
+ else
32
+ render action: "edit"
33
+ end
34
+ end
35
+
36
+ # DELETE /subscribers/1
37
+ # DELETE /subscribers/1.json
38
+ def destroy
39
+ @subscriber = Helpdesk::Subscriber.find_by_hashcode(params[:hashcode])
40
+ @subscriber.destroy
41
+ redirect_to root_path
42
+ end
43
+
44
+ private
45
+
46
+ def subscriber_params
47
+ params.require(:subscriber).permit(:confirmed, :email, :hashcode, :lang, :name)
48
+ end
49
+ end
@@ -0,0 +1,52 @@
1
+ class Helpdesk::Admin::TicketTypesController < Helpdesk::Admin::BaseController
2
+
3
+ def index
4
+ @ticket_types = Helpdesk::TicketType.all
5
+ end
6
+
7
+ def show
8
+ @ticket_type = Helpdesk::TicketType.find(params[:id])
9
+ end
10
+
11
+ def new
12
+ @ticket_type = Helpdesk::TicketType.new
13
+ end
14
+
15
+ def edit
16
+ @ticket_type = Helpdesk::TicketType.find(params[:id])
17
+ end
18
+
19
+ def create
20
+ @ticket_type = Helpdesk::TicketType.new(ticket_type_params)
21
+ if @ticket_type.save
22
+ redirect_to admin_ticket_types_url, notice: 'Ticket type was successfully created.'
23
+ else
24
+ render action: "new"
25
+ end
26
+ end
27
+
28
+ def update
29
+ @ticket_type = Helpdesk::TicketType.find(params[:id])
30
+ if @ticket_type.update_attributes(ticket_type_params)
31
+ redirect_to admin_ticket_types_url, notice: 'Ticket type was successfully updated.'
32
+ else
33
+ render action: "edit"
34
+ end
35
+ end
36
+
37
+ def destroy
38
+ @ticket_type = Helpdesk::TicketType.find(params[:id])
39
+ @ticket_type.destroy
40
+
41
+ respond_to do |format|
42
+ format.html { redirect_to admin_ticket_types_url }
43
+ format.json { head :no_content }
44
+ end
45
+ end
46
+
47
+ private
48
+
49
+ def ticket_type_params
50
+ params.require(:ticket_type).permit(:active,:position,:title,:tr_class. translations_attributes:[:title])
51
+ end
52
+ end
@@ -0,0 +1,76 @@
1
+ class Helpdesk::Admin::TicketsController < Helpdesk::Admin::BaseController
2
+
3
+ def index
4
+ if params[:tickets] == 'unassigned'
5
+ @tickets = Helpdesk::Ticket.unassigned.scoped
6
+ elsif params[:tickets] == 'closed'
7
+ @tickets = Helpdesk::Ticket.closed.scoped
8
+ elsif params[:tickets] == 'active'
9
+ @tickets = Helpdesk::Ticket.active.scoped
10
+ elsif params[:tickets] == 'all'
11
+ @tickets = Helpdesk::Ticket.scoped
12
+ else
13
+ @tickets = my_tickets.active
14
+ end
15
+ @tickets = @tickets.includes(:requester)
16
+ .includes(:assignee)
17
+ .includes(:ticket_type)
18
+ .page(params[:page])
19
+
20
+ render 'list'
21
+ end
22
+
23
+ def assign
24
+ @ticket = Helpdesk::Ticket.find(params[:id])
25
+ if @ticket.update_column(:assignee_id, helpdesk_user)
26
+ redirect_to admin_ticket_path,
27
+ notice: t('helpdesk.tickets.is_now_assigned',subject: @ticket.subject)
28
+ else
29
+ redirect_to admin_ticket_path
30
+ end
31
+ end
32
+
33
+ def new
34
+ @ticket = Helpdesk::Ticket.new
35
+ @ticket.status = Helpdesk::Ticket::STATUSES[0][0]
36
+ end
37
+
38
+ def edit
39
+ @ticket = Helpdesk::Ticket.find(params[:id])
40
+
41
+ end
42
+
43
+ def show
44
+ @ticket = Helpdesk::Ticket.find(params[:id])
45
+
46
+ end
47
+
48
+ def create
49
+ @ticket = Helpdesk::Ticket.new(ticket_params)
50
+ if @ticket.save
51
+ redirect_to admin_ticket_path(@ticket)
52
+ else
53
+ render action: "new"
54
+ end
55
+ end
56
+
57
+ def update
58
+ @ticket = Helpdesk::Ticket.find(params[:id])
59
+ if @ticket.update_attributes(ticket_params)
60
+ unless @ticket.assignee
61
+ @ticket.update_column(:assignee_id, helpdesk_user)
62
+ end
63
+ redirect_to admin_ticket_path
64
+ else
65
+ render action: "new"
66
+ end
67
+ end
68
+
69
+
70
+ private
71
+
72
+ def ticket_params
73
+ params.require(:ticket).permit(:status, :assignee_id,:ticket_type_id, :subject, :description,comments_attributes:[:author_id, :comment, :public])
74
+ end
75
+
76
+ end
@@ -0,0 +1,20 @@
1
+ module Helpdesk
2
+ class ApplicationController < ::ApplicationController
3
+ before_filter :ensure_user, :if => Proc.new { Helpdesk.require_user }
4
+
5
+ helper Helpdesk::Engine.helpers
6
+
7
+ layout 'helpdesk/user'
8
+
9
+ def ensure_user
10
+ unless helpdesk_user
11
+ redirect_to main_app.send(Helpdesk.sign_in_url)
12
+ end
13
+ end
14
+
15
+ def default_url_options(options={})
16
+ { :locale => I18n.locale}
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ module Helpdesk
2
+ class DashboardController < Helpdesk::ApplicationController
3
+
4
+
5
+ before_filter :my_tickets
6
+
7
+ def index
8
+ end
9
+
10
+
11
+ def show
12
+ end
13
+
14
+
15
+ def my_tickets
16
+ @my_tickets = Helpdesk::Ticket
17
+ .includes(:comments=>[:author])
18
+ .includes(:requester)
19
+ .includes(:assignee)
20
+ .includes(:ticket_type)
21
+ .where('requester_id = ?', helpdesk_user.id)
22
+ end
23
+
24
+
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ module Helpdesk
2
+ class FaqsController < Helpdesk::ApplicationController
3
+ def index
4
+ @faqs = Helpdesk::Faq.active
5
+ end
6
+ end
7
+ end