helpdesk 0.0.9 → 0.0.10

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: 62e85c661007c0b041b84eda3f4684badff4f8bf
4
- data.tar.gz: b4f734ee1cc0ae6b2f901dada3651c49772f762b
3
+ metadata.gz: 3de15e09a8fa89ce2f0ad4e71245b6bf51c29c5f
4
+ data.tar.gz: d4071186fc44ba53952a7c1875db4bc1c5a94081
5
5
  SHA512:
6
- metadata.gz: 9febdcbe515758f101a7605a8a017a0ba2b4738353bf9c773058217df5ad21d5ae052c3e52f3034b11c5f92119aec1a361e2361cb2874669c72cd3e028b95ba6
7
- data.tar.gz: 48f8b2a52ef4932301367efeec8ad0f18f18f7e44778577be3dd0bd37630bddeade3a78a2f8d6239bd413465bf83fa9e0875913fa6c6408b2e0e5f47238bb6a1
6
+ metadata.gz: 6165cf2a2673f78627a432b5fe12f1387c056ebbbae507e59d0507273e39e3cf024420dcd873d5930fc3fd998033e1c9b43f0f6e4f29bc1228333ccc6a241f4a
7
+ data.tar.gz: 5003f8c0923b7fe7433198cd3127bdb69738511e585d69bfe5b1ab80b9774a6228eed4d050bce67c42f6fd5b4a86c669ed3149f40167fd6a2e80970b52a3be79
@@ -1,6 +1,6 @@
1
1
  module Helpdesk
2
2
  module Admin
3
- class BaseController < ::ApplicationController
3
+ class BaseController < Helpdesk::ApplicationController
4
4
 
5
5
  helper Helpdesk::Engine.helpers
6
6
  # helper Helpdesk::ApplicationHelper
@@ -2,16 +2,18 @@ class Helpdesk::Admin::TicketsController < Helpdesk::Admin::BaseController
2
2
 
3
3
  def index
4
4
  if params[:tickets] == 'unassigned'
5
- @tickets = Helpdesk::Ticket.unassigned
5
+ @tickets = Helpdesk::Ticket.unassigned.scoped
6
6
  elsif params[:tickets] == 'closed'
7
- @tickets = Helpdesk::Ticket.closed
7
+ @tickets = Helpdesk::Ticket.closed.scoped
8
8
  elsif params[:tickets] == 'active'
9
- @tickets = Helpdesk::Ticket.active
9
+ @tickets = Helpdesk::Ticket.active.scoped
10
10
  elsif params[:tickets] == 'all'
11
- @tickets = Helpdesk::Ticket.all
11
+ @tickets = Helpdesk::Ticket.all.scoped
12
12
  else
13
- @tickets = my_tickets.active
13
+ @tickets = my_tickets.active.scoped
14
14
  end
15
+ @tickets = @tickets.page(params[:page])
16
+
15
17
  render 'list'
16
18
  end
17
19
 
@@ -1,9 +1,9 @@
1
1
  module Helpdesk
2
- class ApplicationController < ::ApplicationController
2
+ class ApplicationController < ApplicationController
3
3
  before_filter :ensure_user, :if => Proc.new { Helpdesk.require_user }
4
-
4
+
5
5
  helper Helpdesk::Engine.helpers
6
-
6
+
7
7
 
8
8
 
9
9
  layout 'helpdesk/user'
@@ -14,11 +14,15 @@ module Helpdesk
14
14
  end
15
15
  end
16
16
 
17
- def helpdesk_admin?
18
- helpdesk_user && (can? :manage, 'helpdesk')
17
+ def default_url_options(options={})
18
+ { :locale => I18n.locale}
19
19
  end
20
- helper_method :helpdesk_admin?
21
-
20
+
21
+ # def helpdesk_admin?
22
+ # helpdesk_user && (can? :manage, 'helpdesk')
23
+ # end
24
+ # helper_method :helpdesk_admin?
25
+
22
26
 
23
27
 
24
28
  end
@@ -1,5 +1,5 @@
1
1
  module Helpdesk
2
- class TicketsController < ApplicationController
2
+ class TicketsController < Helpdesk::ApplicationController
3
3
  # GET /tickets
4
4
  # GET /tickets.json
5
5
  def index
@@ -22,7 +22,7 @@ module Helpdesk
22
22
  # GET /tickets/1.json
23
23
  def show
24
24
  @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count
25
- @ticket = Ticket.find(params[:id])
25
+ @ticket = Helpdesk::Ticket.find(params[:id])
26
26
 
27
27
  respond_to do |format|
28
28
  format.html # show.html.erb
@@ -34,7 +34,7 @@ module Helpdesk
34
34
  # GET /tickets/new.json
35
35
  def new
36
36
  @tickets_count = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.count
37
- @ticket = Ticket.new
37
+ @ticket = Helpdesk::Ticket.new
38
38
  @ticket.status = Helpdesk::Ticket::STATUSES[0][0]
39
39
 
40
40
  respond_to do |format|
@@ -45,13 +45,13 @@ module Helpdesk
45
45
 
46
46
  # GET /tickets/1/edit
47
47
  def edit
48
- @ticket = Ticket.find(params[:id])
48
+ @ticket = Helpdesk::Ticket.find(params[:id])
49
49
  end
50
50
 
51
51
  # POST /tickets
52
52
  # POST /tickets.json
53
53
  def create
54
- @ticket = Ticket.new(params[:ticket])
54
+ @ticket = Helpdesk::Ticket.new(params[:ticket])
55
55
  @ticket.requester = helpdesk_user
56
56
  @ticket.status = Helpdesk::Ticket::STATUSES[0][0]
57
57
 
@@ -69,7 +69,7 @@ module Helpdesk
69
69
  # PUT /tickets/1
70
70
  # PUT /tickets/1.json
71
71
  def update
72
- @ticket = Ticket.find(params[:id])
72
+ @ticket = Helpdesk::Ticket.find(params[:id])
73
73
 
74
74
  respond_to do |format|
75
75
  if @ticket.update_attributes(params[:ticket])
@@ -62,7 +62,7 @@ module Helpdesk
62
62
 
63
63
  new_subject = "#{sprintf '%02d',time.year-2000}#{sprintf '%02d',time.month}#{sprintf '%02d',time.day}"
64
64
 
65
- day_num = Sugestion.where(created_at: Date.today.beginning_of_day..Date.today.end_of_day).count+1
65
+ day_num = Helpdesk::Ticket.where(created_at: Date.today.beginning_of_day..Date.today.end_of_day).count+1
66
66
  new_subject += "-#{sprintf '%04d',day_num}: "
67
67
  self.subject = new_subject + subject.to_s
68
68
  self.subject.strip!
@@ -8,7 +8,7 @@
8
8
 
9
9
  %table.table.table-hover
10
10
  %thead
11
- %tr
11
+ %tr
12
12
  %th= t('helpdesk.status')
13
13
  %th ID
14
14
  %th Issue Type
@@ -16,7 +16,7 @@
16
16
  %th Requester
17
17
  %th Requested
18
18
  %th Assignee
19
- %th
19
+ %th
20
20
 
21
21
  %tbody
22
22
  - @tickets.each do |ticket|
@@ -29,12 +29,14 @@
29
29
  %td
30
30
  - if ticket.requester
31
31
  = ticket.requester.send Helpdesk.display_user.to_sym
32
- %br
32
+ %br
33
33
  = ticket.requester.phone
34
- %br
34
+ %br
35
35
  = ticket.requester.email
36
36
  %td= I18n::l(ticket.created_at, :format=>:short)
37
37
  %td= ticket.assignee if ticket.assignee
38
38
  %td= link_to 'Show', admin_ticket_url(ticket)
39
39
  %br
40
40
 
41
+ = paginate @tickets
42
+
@@ -14,4 +14,5 @@
14
14
 
15
15
  - @tickets.each do |ticket|
16
16
  = render 'ticket', ticket: ticket, show_button:true
17
-
17
+
18
+ = paginate @tickets
@@ -8,26 +8,26 @@
8
8
  - @ticket.errors.full_messages.each do |msg|
9
9
  %li
10
10
  = msg
11
- / = f.input :subject
11
+ / = f.input :subject
12
12
  / = f.input :ticket_type_id, collection: Helpdesk::TicketType.active, include_blank: false
13
13
  %div.subject
14
14
  %input{:value=>@ticket.subject,:name=>"ticket[subject]",:type => "text",:placeholder => t('helpdesk.tickets.subject')}
15
15
  %select{:name=>"ticket[ticket_type_id]"}
16
- - SugestionType.all.each do |type|
16
+ - Helpdesk::TicketType.all.each do |type|
17
17
  %option{:value=>type.id, selected: type.id == @ticket.ticket_type_id}
18
- = type.get_name
19
-
18
+ = type.title
19
+
20
20
  - if @ticket.new_record?
21
21
  %div.content
22
22
  %textarea{:value=>@ticket.description,:name=>"ticket[description]",:type => "text",:placeholder => t('helpdesk.tickets.description')}
23
23
  - else
24
24
  = @ticket.description
25
-
25
+
26
26
  = f.simple_fields_for :comments do |tickets_form|
27
27
  - unless tickets_form.object.persisted?
28
- = tickets_form.input :comment
29
- = tickets_form.input :public, :hint => 'Requester can see this comment (public comment)'
30
- = tickets_form.input :author_id, :as => :hidden, :input_html => { :value => helpdesk_user.id }
28
+ = tickets_form.input :comment
29
+ = tickets_form.input :public, :hint => 'Requester can see this comment (public comment)'
30
+ = tickets_form.input :author_id, :as => :hidden, :input_html => { :value => helpdesk_user.id }
31
31
  %hr
32
32
  %div.textRight
33
33
  %a#feedbackCancel{:class=>"btn white"}
@@ -51,4 +51,4 @@
51
51
  %tr{:class=>ticket.ticket_type.tr_class}
52
52
  %td{colspan:2}
53
53
  - if show_button
54
- = link_to ticket.subject, ticket_url(ticket), class: 'btn btn-block'
54
+ = link_to ticket.subject, ticket_url(I18n.locale,ticket), class: 'btn btn-block'
@@ -0,0 +1,4 @@
1
+ Globalize.fallbacks = {
2
+ :en => [:en, :pl],
3
+ :pl => [:pl, :en],
4
+ }
@@ -1,7 +1,80 @@
1
1
  en:
2
2
 
3
3
  helpdesk:
4
- name: Helpdesk Foo
5
- new_ticket: New Ticket
6
- my_tickets: My Tickets
4
+ Show: Show
5
+ edit: Edit
6
+ Destroy: Delete
7
+ name: Helpdesk
8
+ new_ticket: New
9
+ tickets:
10
+ new: New Issue
11
+ my: My Issue
12
+ unassigned: Wnassigned
13
+ closed: Closed Issues
14
+ all: All issues
15
+ title: Issues
16
+ active: Active Issues
17
+ assignee_to: Assigned to
18
+ assign_me: I take it
19
+ not_assigned: Not assigned
20
+ is_now_assigned: "Issue % {subject} has been assigned to you"
21
+ visible_to_autor: Visible to the author - send an email
22
+ you_have_no_tickets: "No issues "
23
+ ticket_closed: Issues closed
24
+ subject: Subject of
25
+ Description: Content
26
+ ticket: Issue
27
+ comments:
28
+ title: Comments
29
+ note: Memo
30
+ send: Sent
31
+ received: Received
32
+ note: note
33
+ author: Re. author
34
+ helpdesk: Re. BOK
35
+ ticket_types:
36
+ title: Types of issues
37
+ new: A new type of issues
38
+ all: All kinds of issues
39
+ active: Active types of issues
40
+ inactive: Inactive types of issues
7
41
 
42
+ dashboard: Dashboard
43
+
44
+ subscribers:
45
+ title: Subscribers
46
+ confirmed: Confirmed subskrybenci
47
+ unconfirmed: Unconfirmed
48
+ all: All Subscribers
49
+ new: Add Subscriber
50
+
51
+ faqs:
52
+ title: FAQ
53
+ active: Active Questions
54
+ inactive: Inactive questions
55
+ all: All the questions
56
+ new: New Question
57
+ by: by
58
+ faq:
59
+ active: active
60
+ inactive: inactive
61
+
62
+
63
+
64
+ activerecord:
65
+ models:
66
+ Helpdesk: helpdesk
67
+ helpdesk/ticket: Issue
68
+ helpdesk/comment: Comment
69
+ attributes:
70
+ helpdesk/comment:
71
+ comment: Additional description
72
+ public: Visible/Send Email
73
+ helpdesk/ticket:
74
+ requester_id: Requester
75
+ subject: Subject
76
+ Status: Status
77
+ assignee_id: Assigned
78
+ ticket_type_id: Type of notification
79
+ Description: Description
80
+ comments: More details
@@ -29,7 +29,7 @@ pl:
29
29
  note: Notatka
30
30
  send: Wysłane
31
31
  received: Odebrane
32
- note: notatka
32
+ note: notatka
33
33
  author: Odp. autora
34
34
  helpdesk: Odp. BOK
35
35
  ticket_types:
@@ -41,12 +41,12 @@ pl:
41
41
 
42
42
  dashboard: Dashboard
43
43
 
44
- subscribers:
45
- title: Subskrynenci
44
+ subscribers:
45
+ title: Subskrybenci
46
46
  confirmed: Potwierdzeni subskrynenci
47
47
  unconfirmed: Niepotwierdzeni
48
- all: Wszyscy subskrynenci
49
- new: Dodaj subskrynenta
48
+ all: Wszyscy subskrybenci
49
+ new: Dodaj subskrybenta
50
50
 
51
51
  faqs:
52
52
  title: FAQ
data/config/routes.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  Helpdesk::Engine.routes.draw do
2
-
2
+ # Rails.application.routes.draw do
3
3
  scope "(:locale)", :locale => /pl|en/ do
4
-
5
4
  # Admin only roots
6
5
  namespace :admin do
7
6
  resources :tickets do
@@ -14,6 +13,7 @@ Helpdesk::Engine.routes.draw do
14
13
  resources :subscribers
15
14
  root :to => "dashboard#index"
16
15
  end
16
+
17
17
  resources :faqs, :only => [ :index ]
18
18
  resources :tickets, :except => [ :edit, :destroy ]
19
19
  root :to => "tickets#index"
@@ -3,10 +3,29 @@ class CreateHelpdeskTicketTypes < ActiveRecord::Migration
3
3
  create_table :helpdesk_ticket_types do |t|
4
4
  t.integer :position
5
5
  t.boolean :active,:default=>1,:null=>false
6
-
6
+ t.string :tr_class
7
7
  t.timestamps
8
8
  end
9
9
  Helpdesk::TicketType.create_translation_table! :title => :string
10
+
11
+
12
+ tt = [["Sugestia","Sugestion","warning"],
13
+ ["Pochwała","Appreciation","success"],
14
+ ["Błąd","Complaint","error"],
15
+ ["Pytanie","Enquiry","info"],
16
+ ["Kontakt","Contact","contact"]]
17
+
18
+ tt.each do |item|
19
+ I18n.locale = :pl
20
+ type = Helpdesk::TicketType.new
21
+ type.title = item[0]
22
+ I18n.locale = :en
23
+ type.title = item[1]
24
+ type.tr_class = item[2]
25
+ type.active = true
26
+ type.save!
27
+ end
28
+
10
29
  end
11
30
 
12
31
  def down
@@ -19,6 +19,18 @@ module Helpdesk
19
19
  def show_readme
20
20
  readme "README" if behavior == :invoke
21
21
  end
22
+
23
+
24
+
25
+ def add_engine_to_route
26
+ route "mount Helpdesk::Engine, :at => '/helpdesk'"
27
+ end
28
+
29
+ def run_rake
30
+ rake "helpdesk:install:migrations"
31
+ rake "db:migrate"
32
+ end
33
+
22
34
  end
23
35
  end
24
36
  end
@@ -5,24 +5,19 @@ You need to do some manual setup to get Helpdesk working:
5
5
  1. Review settings in new config/initializers/helpdesk.rb and update where
6
6
  neccessary.
7
7
 
8
- 2. Mount the engine into your application by editing your config/routes.rb
9
-
10
- mount Helpdesk::Engine, :at => "support"
11
-
12
- 3. Install and run the migrations
13
-
14
- rake helpdesk:install:migrations
15
-
16
- rake db:migrate
17
-
18
- 4. Add a helpdesk_user method to your applications application_controller.rb
8
+ 2. Add a helpdesk_user & helpdesk_admin method to your applications application_controller.rb
19
9
  that exposes your current_user
20
10
 
21
11
  Example, for devise gem:
22
- def helpdesk_user
23
- current_user
24
- end
12
+ helper_method :helpdesk_user
13
+ def helpdesk_user
14
+ current_user
15
+ end
16
+
17
+ def helpdesk_admin?
18
+ current_user.admin?
19
+ end
25
20
 
26
- 5.
21
+ 3. Notnihg to do! Yey!
27
22
 
28
23
  ===============================================================================
@@ -1,3 +1,3 @@
1
1
  module Helpdesk
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
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.9
4
+ version: 0.0.10
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-10-18 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
@@ -168,16 +168,16 @@ dependencies:
168
168
  name: bootstrap-sass
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: 2.3.2.2
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: 2.3.2.2
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rails
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -276,6 +276,20 @@ dependencies:
276
276
  - - '>='
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0'
279
+ - !ruby/object:Gem::Dependency
280
+ name: kaminari
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - '>='
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ type: :runtime
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - '>='
291
+ - !ruby/object:Gem::Version
292
+ version: '0'
279
293
  description: 'Helpesk includes: tickets, ticket_types, faq, subscribers'
280
294
  email:
281
295
  - john@beynon.org.uk, waclaw@luczak.it
@@ -374,6 +388,7 @@ files:
374
388
  - app/views/layouts/helpdesk/_topuser.html.haml
375
389
  - app/views/layouts/helpdesk/admin.html.haml
376
390
  - app/views/layouts/helpdesk/user.html.haml
391
+ - config/initializers/globalize.rb
377
392
  - config/initializers/simple_form.rb
378
393
  - config/locales/helpdesk.en.yml
379
394
  - config/locales/helpdesk.pl.yml
@@ -384,7 +399,6 @@ files:
384
399
  - db/migrate/20120420104051_create_helpdesk_tickets.rb
385
400
  - db/migrate/20120423113938_create_helpdesk_comments.rb
386
401
  - db/migrate/20130521105605_create_helpdesk_ticket_types.rb
387
- - db/migrate/20130521132216_add_tr_class_to_ticket_type.rb
388
402
  - db/migrate/20130522085614_create_helpdesk_faqs.rb
389
403
  - db/migrate/20130522090420_create_helpdesk_subscribers.rb
390
404
  - lib/generators/helpdesk/install_generator.rb
@@ -417,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
431
  version: '0'
418
432
  requirements: []
419
433
  rubyforge_project:
420
- rubygems_version: 2.0.6
434
+ rubygems_version: 2.1.11
421
435
  signing_key:
422
436
  specification_version: 4
423
437
  summary: Rails mountable engine providing basic helpdesk functionality for your applications
@@ -1,5 +0,0 @@
1
- class AddTrClassToTicketType < ActiveRecord::Migration
2
- def change
3
- add_column :helpdesk_ticket_types, :tr_class, :string
4
- end
5
- end