helpdesk 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1baf95cd67d35dfd2282f81c97c6f240f6a141df
4
- data.tar.gz: 380842fdb392db3608dec6fa0aaee3ff3eadd3c3
3
+ metadata.gz: c2bb016f583e835252086dd3e6af2944dd1faf46
4
+ data.tar.gz: 530b21639f6552c52b5ecb16311d9dd6b841608f
5
5
  SHA512:
6
- metadata.gz: 763a7c13219a8f4c06a3e99613ff620a890b00e3a48ca81d35b3be2a08584c0e1f70ddfb67fdafcafe299a3cb3337975bf2f1cb28aec0214f16adecdb74e8eef
7
- data.tar.gz: 60debde9ac2c8a7ecf9c88ae92e0ca0b2ffc40f5964701d9adc01ef6cff1deb1e522ea90cb99e0f00eaad436c13cb71959370d91308539c8cdb103ac9d6b41b0
6
+ metadata.gz: 570524960d897ebd88eca5cfa53df9773343348e3db4c78c71fe7fd1bb6c082e3581b2ab9165aec5bf6f472a88a6dcc302597f5de086f9c398823f76c7b1c560
7
+ data.tar.gz: 30edbf3d805a7a9480d0e0965ae09c3dfe5d0f69eca31d6a40a779649e00d6fb7eb88efd7cac27aed8f4aabc50949bbb59e739dab0729135bd044beb06a18f24
@@ -13,10 +13,10 @@ module Helpdesk
13
13
  def send_email
14
14
  if self.public?
15
15
  if ticket.requester == author
16
- Helpdesk::NotificationsMailer.comment_by_requester_notification(self).deliver
16
+ Helpdesk::NotificationsMailer.comment_by_requester_notification(self).deliver if ticket.requester
17
17
  Helpdesk::NotificationsMailer.comment_by_requester_confirmation(self).deliver if Helpdesk.send_confirmation_emails
18
18
  else
19
- Helpdesk::NotificationsMailer.comment_by_helpdesk_notification(self).deliver
19
+ Helpdesk::NotificationsMailer.comment_by_helpdesk_notification(self).deliver if ticket.requester
20
20
  Helpdesk::NotificationsMailer.comment_by_helpdesk_confirmation(self).deliver if Helpdesk.send_confirmation_emails
21
21
  end
22
22
  end
@@ -25,7 +25,7 @@ module Helpdesk
25
25
  belongs_to :requester, :class_name => Helpdesk.user_class.to_s
26
26
  belongs_to :assignee, :class_name => Helpdesk.user_class.to_s
27
27
  belongs_to :ticket_type, :class_name => Helpdesk::TicketType
28
- has_many :comments, :order => "created_at DESC"
28
+ has_many :comments, :order => "created_at DESC",:dependent => :destroy
29
29
 
30
30
 
31
31
 
@@ -7,17 +7,17 @@
7
7
  - @ticket.errors.full_messages.each do |msg|
8
8
  %li
9
9
  = msg
10
- = f.input :requester_id, :collection => User.all
11
- = f.input :subject
10
+ = f.input :requester_id, :collection => (Helpdesk.user_class).all,:label_method=>Helpdesk.display_user_uniq_info.to_sym
11
+ = f.input :subject
12
12
  = f.input :status, :collection => Helpdesk::Ticket::STATUS_OPTIONS, include_blank: false
13
- = f.input :assignee_id, :collection => User.where('helpdesk_admin = ?', true)
13
+ = f.input :assignee_id, :collection => User.where('helpdesk_admin = ?', true)
14
14
  = f.input :ticket_type_id, :collection => Helpdesk::TicketType.active,include_blank: false
15
15
  - if @ticket.new_record?
16
- = f.input :description
16
+ = f.input :description
17
17
  - else
18
18
  = simple_format @ticket.description
19
-
20
-
19
+
20
+
21
21
  %div.form-actions
22
22
  = f.button :submit, :class => 'btn-primary'
23
23
  = submit_tag 'Anuluj', :type => :reset, :class => "btn btn-danger"
@@ -2,30 +2,29 @@
2
2
  %tbody
3
3
  %tr{:class=>ticket.ticket_type.tr_class}
4
4
  %td{colspan:2}
5
- %h4
5
+ %h4
6
6
  ="##{ticket.subject}"
7
7
  %tr
8
- %td{style:'width:100px'}
8
+ %td{style:'width:100px'}
9
9
  = I18n::l(ticket.created_at, :format=>:short)
10
10
  - if ticket.requester
11
- = ticket.requester.send Helpdesk.display_user.to_sym
11
+ = ticket.requester.send Helpdesk.display_user_uniq_info.to_sym
12
12
  %td{rowspan:2}
13
13
  = status_label Helpdesk::Ticket::STATUS_BY_KEY[ticket.status.to_sym], Helpdesk::Ticket::STATUS_CLASS_BY_KEY[ticket.status.to_sym]
14
14
  = ticket.ticket_type.title
15
-
16
- = simple_format ticket.description
15
+ = auto_link(simple_format(ticket.description), :html => { :target => "_blank" })
17
16
  %tr
18
17
  %td
19
18
  - if ticket.assignee
20
19
  = t('helpdesk.tickets.assignee_to')
21
- = ticket.assignee.send Helpdesk.display_user.to_sym
20
+ = ticket.assignee.send Helpdesk.display_user_uniq_info.to_sym
22
21
  - else
23
22
  = t('helpdesk.tickets.not_assigned')
24
23
  = link_to ico('star','white') + t('helpdesk.tickets.assign_me'), assign_admin_ticket_path(ticket),class: 'btn btn-mini btn-info'
25
24
  %tr
26
25
  %td
27
26
  %span.btn.disabled
28
- = ico('comment')
27
+ = ico('comment')
29
28
  = ticket.comments.size
30
29
  %td
31
30
  %ul.comments.unstyled
@@ -43,18 +42,17 @@
43
42
  %div.comment-header
44
43
  -if comment.author == ticket.requester
45
44
  = status_label ico('user','white')+ t('helpdesk.comments.author'),'label-info'
46
-
47
- = comment.author.send Helpdesk.display_user.to_sym
45
+ = comment.author.send Helpdesk.display_user_uniq_info.to_sym if comment.author
48
46
  %small
49
47
  = time_ago_in_words(comment.created_at)
50
48
  temu
51
49
  %div.comment-body
52
- = simple_format comment.comment
53
-
50
+ = auto_link(simple_format(comment.comment), :html => { :target => "_blank" })
51
+
54
52
  %tr{:class=>ticket.ticket_type.tr_class}
55
53
  %td{colspan:2}
56
54
  - if show_button
57
55
  = link_to 'Show', admin_ticket_url(ticket), class: 'btn btn-block'
58
56
  -elsif edit_button
59
57
  = link_to 'Edit', edit_admin_ticket_url(ticket), class: 'btn btn-primary'
60
-
58
+
@@ -22,7 +22,7 @@
22
22
  -if comment.author == @ticket.requester
23
23
  = status_label ico('user','white')+ t('helpdesk.comments.author'),'label-info'
24
24
 
25
- = comment.author.send Helpdesk.display_user.to_sym
25
+ = comment.author.send Helpdesk.display_user.to_sym if comment.author
26
26
  %small
27
27
  = time_ago_in_words(comment.created_at)
28
28
  temu
@@ -2,10 +2,10 @@
2
2
  %tbody
3
3
  %tr{:class=>ticket.ticket_type.tr_class}
4
4
  %td{colspan:2}
5
- %h4
5
+ %h4
6
6
  ="##{ticket.subject}"
7
7
  %tr
8
- %td{style:'width:100px'}
8
+ %td{style:'width:100px'}
9
9
  = I18n::l(ticket.created_at, :format=>:short)
10
10
  - if ticket.requester
11
11
  = ticket.requester.send Helpdesk.display_user.to_sym
@@ -13,7 +13,7 @@
13
13
  = status_label Helpdesk::Ticket::STATUS_BY_KEY[ticket.status.to_sym], Helpdesk::Ticket::STATUS_CLASS_BY_KEY[ticket.status.to_sym]
14
14
  = ticket.ticket_type.title
15
15
 
16
- = simple_format ticket.description
16
+ = auto_link(simple_format(ticket.description), :html => { :target => "_blank" })
17
17
  %tr
18
18
  %td
19
19
  - if ticket.assignee
@@ -22,7 +22,7 @@
22
22
  %tr
23
23
  %td
24
24
  %span.btn.disabled
25
- = ico('comment')
25
+ = ico('comment')
26
26
  = ticket.comments.pub.size
27
27
  %td
28
28
  %ul.comments.unstyled
@@ -40,14 +40,14 @@
40
40
  %div.comment-header
41
41
  -if comment.author != ticket.requester
42
42
  = status_label ico('user','white')+ t('helpdesk.comments.helpdesk'),'label-info'
43
-
43
+
44
44
  = comment.author.send Helpdesk.display_user.to_sym
45
45
  %small
46
46
  = time_ago_in_words(comment.created_at)
47
47
  temu
48
48
  %div.comment-body
49
- = simple_format comment.comment
50
-
49
+ = auto_link(simple_format(comment.comment), :html => { :target => "_blank" })
50
+
51
51
  %tr{:class=>ticket.ticket_type.tr_class}
52
52
  %td{colspan:2}
53
53
  - if show_button
@@ -2,16 +2,20 @@
2
2
 
3
3
  = render 'ticket', :ticket=>@ticket, show_button:false
4
4
 
5
- %table.table
6
- %tbody
7
- %tr{:class=>@ticket.ticket_type.tr_class}
8
- %td{style:'width:100px'}
9
5
 
10
- %td
11
-
12
- - unless @ticket.open?
6
+ - unless @ticket.open?
7
+ %table.table
8
+ %tbody
9
+ %tr{:class=>@ticket.ticket_type.tr_class}
10
+ %td{style:'width:100px'}
11
+ %td
13
12
  = t('helpdesk.tickets.ticket_closed')
14
- -else
13
+ - if @ticket.open? || helpdesk_user == @ticket.requester
14
+ %table.table
15
+ %tbody
16
+ %tr{:class=>@ticket.ticket_type.tr_class}
17
+ %td{style:'width:100px'}
18
+ %td
15
19
  = simple_form_for(@ticket, :html => {:class => 'form-vertical' }) do |f|
16
20
  - if @ticket.errors.any?
17
21
  %div.error_explanation
@@ -28,7 +32,7 @@
28
32
  / , :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'mini'},:language => I18n.locale}
29
33
 
30
34
  = tickets_form.input :public, :input_html => {:value=>1},:as=>:hidden
31
- = tickets_form.input :author_id, :as => :hidden, :input_html => { :value => helpdesk_user.id }
35
+ = tickets_form.input :author_id, :as => :hidden, :input_html => { :value => helpdesk_user.id }
32
36
  %div
33
37
  = f.button :submit, :class => 'btn-primary'
34
- = submit_tag 'Anuluj', :type => :reset, :class => "btn btn-danger"
38
+ = submit_tag 'Anuluj', :type => :reset, :class => "btn btn-danger"
@@ -17,7 +17,12 @@ You need to do some manual setup to get Helpdesk working:
17
17
 
18
18
  4. Add a helpdesk_user method to your applications application_controller.rb
19
19
  that exposes your current_user
20
-
20
+
21
+ Example, for devise gem:
22
+ def helpdesk_user
23
+ current_user
24
+ end
25
+
21
26
  5.
22
27
 
23
28
  ===============================================================================
@@ -1,15 +1,21 @@
1
1
  require 'helpdesk'
2
2
 
3
3
  ::Helpdesk.setup do |config|
4
- # Class that represents the user
4
+ # Class that represents the user
5
5
  config.user_class = "User"
6
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 = "name"
12
+
7
13
  # Require User to be present in order to access Helpdesk
8
14
  config.require_user = true
9
-
15
+
10
16
  # Base application sign in route name
11
- config.sign_in_url = 'sign_in_url'
12
-
17
+ config.sign_in_url = 'sign_in_url'
18
+
13
19
  # Ticket issue types
14
20
  config.issue_types = ['bug', 'change request', 'new feature']
15
21
 
@@ -10,8 +10,10 @@ module Helpdesk
10
10
 
11
11
  mattr_accessor :display_user
12
12
 
13
+ mattr_accessor :display_user_uniq_info
14
+
13
15
  mattr_accessor :issue_types
14
-
16
+
15
17
  mattr_accessor :mail_server
16
18
 
17
19
  mattr_accessor :email
@@ -23,9 +25,9 @@ module Helpdesk
23
25
 
24
26
  mattr_accessor :site_address
25
27
 
26
- mattr_accessor :helpdesk_name
28
+ mattr_accessor :helpdesk_name
27
29
  @@helpdesk_name = "Helpdesk"
28
-
30
+
29
31
  def self.setup
30
32
  yield self
31
33
  end
@@ -2,6 +2,11 @@ require 'rails'
2
2
  require 'simple_form'
3
3
  require 'state_machine'
4
4
  require 'bootstrap-sass'
5
+ require 'rails_autolink'
6
+ require 'simple_form'
7
+ require 'globalize3'
8
+ require 'batch_translations'
9
+ require 'ckeditor'
5
10
 
6
11
  module Helpdesk
7
12
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module Helpdesk
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helpdesk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Beynon Wacław Łuczak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-13 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rails_autolink
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: bootstrap-sass
141
155
  requirement: !ruby/object:Gem::Requirement