helpdesk 0.0.36 → 0.0.37

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: 9ae496a032fc53e4efb6d7aa861bc4c40de473e3
4
- data.tar.gz: fdc2118d1b3a2ad1f0384cf791ec4155e0b657da
3
+ metadata.gz: 569873a1a07e6ecc3b329bf3cdd8760f813cd076
4
+ data.tar.gz: 1ca1b0144912eff172811a5647e46bfcea34bb47
5
5
  SHA512:
6
- metadata.gz: 2a00ca4623e96c152204c79cf84560d18b73615e12af9418d3e0ad774a01d0b1e398169cd0171391b975d3c288983a8913fc9c5ffa33e0159ae577ef940a259f
7
- data.tar.gz: 445dc3add217faf1a245b859770acd1a1de80c6284e7468b68d47777075ea4cd2ee3f5fa63ee3c70a9830b9b01f7a78e31053834ae29bca5d4a0f4b287dc6420
6
+ metadata.gz: d3be697519d1aa4429baa018a88c8093d32eedcea8b8a3f845e5b338e3f16f1c42e8840eb6ff097d75b4d9e4a9443001b8c1cfccb07933273d7aaf280448a5ab
7
+ data.tar.gz: 5f08eea31b519eda2f85437038b56cecc8a44845b0d9f38cf52f9605f27ec442afe187c2371ef9a37f1f4f26ddb26ba66c613e413687bf45477dc06b69a1bbf7
@@ -1,7 +1,7 @@
1
1
  $(document).ready(function(){
2
2
  $('body').scrollspy({
3
3
  target: '.bs-docs-sidebar',
4
- offset: 40
4
+ offset: 80
5
5
  });
6
6
 
7
7
  $(".bs-docs-sidebar").affix({
@@ -0,0 +1,56 @@
1
+ $cTextLight: #a0a0a0
2
+ @CHARSET "UTF-8"
3
+ @mixin transition($var...)
4
+ -webkit-transition: $var
5
+ transition: $var
6
+
7
+ ul.faqs_list_main
8
+ > li
9
+ position: relative
10
+
11
+ ul.faqs_list
12
+ > li
13
+ // display: block
14
+ margin: 10px 0px
15
+ padding: 2px
16
+ // width: 90%
17
+ min-width: 100px
18
+ border: 1px solid $cTextLight
19
+ border-radius: 2px
20
+ background-color: #ffffff
21
+ // background-color: $colorBluePastelLight
22
+ line-height: 30px
23
+ vertical-align: middle
24
+ box-shadow: 0px 1px 2px 0px rgba(0,0,0,0.2)
25
+ @include transition(opacity 0.2s ease-in-out)
26
+
27
+ >span.title
28
+
29
+
30
+ >span.buttons
31
+ position: absolute
32
+ right: 40px
33
+
34
+
35
+ ul, ol
36
+ margin: 10px auto 10px 10px
37
+ list-style: disc
38
+
39
+ li
40
+
41
+ &:hover
42
+ >span
43
+
44
+ > a.icon
45
+ opacity: 1
46
+
47
+
48
+
49
+
50
+ >span
51
+ a.icon
52
+ position: relative
53
+ opacity: 0
54
+ overflow: hidden
55
+ vertical-align: middle
56
+ @include transition(opacity 0.2s ease-in-out)
@@ -22,14 +22,13 @@ class Helpdesk::Admin::FaqsController < Helpdesk::Admin::BaseController
22
22
  def index
23
23
  if params[:faqs] == 'active'
24
24
  @faqs = Helpdesk::Faq.roots.active
25
+ render action: 'index'
25
26
  elsif params[:faqs] == 'inactive'
26
- @faqs = Helpdesk::Faq.roots.inactive
27
+ @faqs = Helpdesk::Faq.inactive
28
+ render action: 'inactive'
27
29
  else
28
30
  @faqs = Helpdesk::Faq.roots
29
- end
30
- respond_to do |format|
31
- format.html # index.html.erb
32
- format.json { render json: @faqs }
31
+ render action: 'index'
33
32
  end
34
33
  end
35
34
 
@@ -1,42 +1,30 @@
1
1
  module Helpdesk
2
2
  class SubscribersController < Helpdesk::ApplicationController
3
3
 
4
-
5
4
  def index
6
5
  @subscriber = Subscriber.new
7
6
  @subscriber.lang = locale
8
-
9
- respond_to do |format|
10
- format.html # new.html.erb
11
- format.json { render json: @subscriber }
12
- end
13
7
  end
14
8
 
15
9
  def create
16
10
  @subscriber = Subscriber.new(subscriber_params)
17
-
18
- respond_to do |format|
19
- if @subscriber.save
20
- format.html { redirect_to @subscriber, notice: 'Subscriber was successfully created.' }
21
- format.json { render json: @subscriber, status: :created, location: @subscriber }
22
- else
23
- format.html { render action: "new" }
24
- format.json { render json: @subscriber.errors, status: :unprocessable_entity }
25
- end
11
+ if @subscriber.save
12
+ redirect_to root_path, notice: 'Subscriber was successfully created.'
13
+ else
14
+ render action: "index"
26
15
  end
27
16
  end
28
17
 
18
+ def activation
19
+ @subscriber = Subscriber.where(hashcode:params[:hashcode],confirmed:false).first
20
+ @subscriber.update_attributes(hashcode:nil,confirmed:true) if @subscriber
21
+ redirect_to root_path,notice: 'Subscriber was successfully activated.'
22
+ end
29
23
 
30
- # DELETE /subscribers/1
31
- # DELETE /subscribers/1.json
32
24
  def destroy
33
- @subscriber = Subscriber.find(params[:id])
34
- @subscriber.destroy
35
-
36
- respond_to do |format|
37
- format.html { redirect_to subscribers_url }
38
- format.json { head :no_content }
39
- end
25
+ @subscriber = Subscriber.where(hashcode:params[:hashcode],confirmed:true).first
26
+ @subscriber.destroy if @subscriber
27
+ redirect_to root_path,notice: 'Subscriber was successfully deleted.'
40
28
  end
41
29
 
42
30
  private
@@ -39,4 +39,10 @@ class Helpdesk::NotificationsMailer < ActionMailer::Base
39
39
  :to => Helpdesk.email)
40
40
  end
41
41
 
42
+ def send_activate_subscription(subscriber)
43
+ @subscriber = subscriber
44
+ mail(:subject=>"#{t('helpdesk.name')}: Please Confirm Subscription",
45
+ :to => @subscriber.email)
46
+ end
47
+
42
48
  end
@@ -4,6 +4,22 @@ module Helpdesk
4
4
  scope :unconfirmed, ->{ where('confirmed = ? ',false)}
5
5
 
6
6
  validates_presence_of :email
7
+ validates_uniqueness_of :email
8
+
9
+ before_create :generate_token
10
+ after_create :send_activate_subscription
11
+
12
+ def generate_token
13
+ self.hashcode = loop do
14
+ random_token = SecureRandom.urlsafe_base64(nil, false)
15
+ break random_token unless Helpdesk::Subscriber.where(hashcode: random_token).exists?
16
+ end
17
+ end
18
+
19
+ def send_activate_subscription
20
+ Helpdesk::NotificationsMailer.send_activate_subscription(self).deliver
21
+ end
22
+
7
23
 
8
24
  end
9
25
  end
@@ -1,11 +1,13 @@
1
1
  - faqs.each do |faq|
2
2
  %li
3
- = faq.title
4
- %div
5
- = link_to t('helpdesk.show'), faqs_path(anchor:faq.to_param), class: 'btn btn-info btn-xs', target: :faq_preview
6
- = link_to t('helpdesk.edit'), edit_admin_faq_path(faq),class: 'btn btn-primary btn-xs'
7
- = link_to t('helpdesk.add'), new_admin_faq_path(faq:{parent_id:faq.id}),class: 'btn btn-success btn-xs'
8
- = link_to t('helpdesk.destroy'), admin_faq_path(faq), method: :delete, data: { confirm: 'Are you sure?' },class: 'btn btn-danger btn-xs'
3
+ %span.title
4
+ = faq.title
5
+ %span.buttons
6
+ = link_to t('helpdesk.show'), faqs_path(anchor:faq.to_param), class: 'icon btn btn-info btn-xs', target: :faq_preview
7
+ = link_to t('helpdesk.edit'), edit_admin_faq_path(faq),class: 'icon btn btn-primary btn-xs'
8
+ = link_to t('helpdesk.add'), new_admin_faq_path(faq:{parent_id:faq.id}),class: 'icon btn btn-success btn-xs'
9
+ = link_to t('helpdesk.destroy'), admin_faq_path(faq), method: :delete, data: { confirm: 'Are you sure?' },class: 'icon btn btn-danger btn-xs'
10
+
9
11
  - if faq.children.present?
10
- %ol
11
- = render partial:'/helpdesk/admin/faqs/faq', locals:{ faqs:faq.children }
12
+ %ul.faqs_list
13
+ = render partial:'/helpdesk/admin/faqs/faq', locals:{ faqs:faq.children.active }
@@ -0,0 +1,27 @@
1
+ = render 'menu'
2
+
3
+ - content_for :title do
4
+ -if params[:faqs] && params[:faqs] == 'active'
5
+ = t('helpdesk.faqs.active')
6
+ -elsif params[:faqs] && params[:faqs] == 'inactive'
7
+ = t('helpdesk.faqs.inactive')
8
+ -else
9
+ = t('helpdesk.faqs.all')
10
+
11
+ %ul.faqs_list.faqs_list_main
12
+ - @faqs.each do |faq|
13
+ %li
14
+ %span.title
15
+ = faq.title
16
+ %span.buttons
17
+ = link_to t('helpdesk.show'), faqs_path(anchor:faq.to_param), class: 'icon btn btn-info btn-xs', target: :faq_preview
18
+ = link_to t('helpdesk.edit'), edit_admin_faq_path(faq),class: 'icon btn btn-primary btn-xs'
19
+ = link_to t('helpdesk.add'), new_admin_faq_path(faq:{parent_id:faq.id}),class: 'icon btn btn-success btn-xs'
20
+ = link_to t('helpdesk.destroy'), admin_faq_path(faq), method: :delete, data: { confirm: 'Are you sure?' },class: 'icon btn btn-danger btn-xs'
21
+
22
+ - if faq.children.present?
23
+ %ul.faqs_list
24
+ = render partial:'/helpdesk/admin/faqs/faq', locals:{ faqs:faq.children }
25
+
26
+
27
+
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
 
15
- %ol
15
+ %ul.faqs_list.faqs_list_main
16
16
  = render partial:'/helpdesk/admin/faqs/faq', locals:{ faqs:@faqs }
17
17
 
18
18
 
@@ -9,14 +9,15 @@
9
9
  = menu_li @faq.title, sorting_admin_faq_url(@faq)
10
10
 
11
11
 
12
- %ul.unstyled#faqs
12
+ %ul.faqs_list#faqs
13
13
  - @faqs.each do |faq|
14
- %li.row{id:"faqs_#{faq.id}",style:'padding:5px 0px;'}
15
- %div.handle.span2{style:'cursor:move'}
14
+ %li{id:"faqs_#{faq.id}",style:'padding:5px 0px;'}
15
+ %span.handle.span2{style:'cursor:move'}
16
16
  %span
17
17
  = ico('move')
18
- %span
19
- = faq.title
18
+ %span.title
19
+ = faq.title
20
+ %span.buttons
20
21
  - if faq.children.present?
21
22
  = link_to t('helpdesk.sort_this_childs'), sorting_admin_faq_url(faq), class: 'btn btn-info btn-xs'
22
23
 
@@ -5,4 +5,4 @@
5
5
  = raw faq.text
6
6
  - if faq.children.present?
7
7
  %ul
8
- = render partial:'/helpdesk/faqs/faq', locals:{ faqs:faq.children,link_type:link_type}
8
+ = render partial:'/helpdesk/faqs/faq', locals:{ faqs:faq.children.active,link_type:link_type}
@@ -0,0 +1,9 @@
1
+ - content_for :title do
2
+ Please Confirm Subscription
3
+ %p
4
+ = link_to 'Yes, subscribe me to this list.',subscribers_activation_url(locale:I18n.locale,hashcode: @subscriber.hashcode)
5
+ %p
6
+ If you received this email by mistake, simply delete it. You won't be subscribed if you don't click the confirmation link above.
7
+
8
+ %p
9
+ = "For questions about this list, please contact: #{Helpdesk.email}"
@@ -0,0 +1,18 @@
1
+ = simple_form_for @subscriber do |f|
2
+ .form-inputs
3
+ - if @subscriber.errors.any?
4
+ #error_explanation
5
+ %ul
6
+ - @subscriber.errors.full_messages.each do |msg|
7
+ %li= msg
8
+ = f.input :name
9
+ = f.input :email
10
+ = f.input :lang, collections: I18n.available_locales
11
+
12
+
13
+
14
+ .form-actions
15
+ = f.submit 'Save', class:'btn btn-primary'
16
+ = link_to 'Back', admin_faqs_path,class: 'btn btn-default'
17
+
18
+
@@ -2,4 +2,3 @@
2
2
 
3
3
  <%= render 'form' %>
4
4
 
5
- <%= link_to 'Back', subscribers_path %>
@@ -7,6 +7,7 @@ pl:
7
7
  destroy: Usuń
8
8
  name: Helpdesk
9
9
  new_ticket: Nowe zgłoszenie
10
+ add: Dodaj
10
11
  tickets:
11
12
  new: Nowe zgłoszenie
12
13
  my: Moje zgłoszenia
data/config/routes.rb CHANGED
@@ -17,6 +17,7 @@ Helpdesk::Engine.routes.draw do
17
17
  root :to => 'tickets#index'
18
18
  end
19
19
 
20
+ get 'subscribers/a/:hashcode'=>'subscribers#activation',as:'subscribers_activation'
20
21
  resources :subscribers, :only => [:index, :create, :destroy]
21
22
  resources :faqs, :only => [ :index, :show ] do
22
23
  get :search, on: :collection
@@ -1,3 +1,3 @@
1
1
  module Helpdesk
2
- VERSION = "0.0.36"
2
+ VERSION = "0.0.37"
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.36
4
+ version: 0.0.37
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: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
@@ -392,6 +392,7 @@ files:
392
392
  - app/assets/javascripts/helpdesk/subscribers.js
393
393
  - app/assets/stylesheets/helpdesk/admin.css.scss
394
394
  - app/assets/stylesheets/helpdesk/admin/bootstrap_overrides.css
395
+ - app/assets/stylesheets/helpdesk/admin/faqs.css.sass
395
396
  - app/assets/stylesheets/helpdesk/admin/tickets.css
396
397
  - app/assets/stylesheets/helpdesk/application.css
397
398
  - app/assets/stylesheets/helpdesk/custom.css
@@ -427,6 +428,7 @@ files:
427
428
  - app/views/helpdesk/admin/faqs/_form.html.haml
428
429
  - app/views/helpdesk/admin/faqs/_menu.html.haml
429
430
  - app/views/helpdesk/admin/faqs/edit.html.haml
431
+ - app/views/helpdesk/admin/faqs/inactive.html.haml
430
432
  - app/views/helpdesk/admin/faqs/index.html.haml
431
433
  - app/views/helpdesk/admin/faqs/new.html.haml
432
434
  - app/views/helpdesk/admin/faqs/show.html.haml
@@ -460,9 +462,10 @@ files:
460
462
  - app/views/helpdesk/notifications_mailer/comment_by_helpdesk_notification.html.haml
461
463
  - app/views/helpdesk/notifications_mailer/comment_by_requester_confirmation.html.haml
462
464
  - app/views/helpdesk/notifications_mailer/comment_by_requester_notification.html.haml
465
+ - app/views/helpdesk/notifications_mailer/send_activate_subscription.html.haml
463
466
  - app/views/helpdesk/notifications_mailer/ticket_created_confirmation.html.haml
464
467
  - app/views/helpdesk/notifications_mailer/ticket_created_notification.html.haml
465
- - app/views/helpdesk/subscribers/_form.html.erb
468
+ - app/views/helpdesk/subscribers/_form.html.haml
466
469
  - app/views/helpdesk/subscribers/edit.html.erb
467
470
  - app/views/helpdesk/subscribers/index.html.erb
468
471
  - app/views/helpdesk/subscribers/show.html.erb
@@ -1,37 +0,0 @@
1
- <%= form_for(@subscriber) do |f| %>
2
- <% if @subscriber.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(@subscriber.errors.count, "error") %> prohibited this subscriber from being saved:</h2>
5
-
6
- <ul>
7
- <% @subscriber.errors.full_messages.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="field">
15
- <%= f.label :name %><br />
16
- <%= f.text_field :name %>
17
- </div>
18
- <div class="field">
19
- <%= f.label :email %><br />
20
- <%= f.text_field :email %>
21
- </div>
22
- <div class="field">
23
- <%= f.label :lang %><br />
24
- <%= f.text_field :lang %>
25
- </div>
26
- <div class="field">
27
- <%= f.label :hashcode %><br />
28
- <%= f.text_field :hashcode %>
29
- </div>
30
- <div class="field">
31
- <%= f.label :confirmed %><br />
32
- <%= f.text_field :confirmed %>
33
- </div>
34
- <div class="actions">
35
- <%= f.submit %>
36
- </div>
37
- <% end %>