diff --git a/app/assets/javascripts/app/controllers/_channel/form.coffee b/app/assets/javascripts/app/controllers/_channel/form.coffee index 23d8d5ec7..ae9cf2b62 100644 --- a/app/assets/javascripts/app/controllers/_channel/form.coffee +++ b/app/assets/javascripts/app/controllers/_channel/form.coffee @@ -47,6 +47,17 @@ class App.ChannelForm extends App.ControllerSubContent paramString += " #{key}: '#{quote(value)}'" @$('.js-modal-params').html(paramString) + # rebuild preview + if params.modal + @$('.js-formInline').addClass('hide') + @$('.js-formBtn').removeClass('hide') + @$('.js-formBtn').ZammadForm(params) + @$('.js-formBtn').text('Feedback') + else + @$('.js-formBtn').addClass('hide') + @$('.js-formInline').removeClass('hide') + @$('.js-formInline').ZammadForm(params) + toggleFormSetting: => value = @formSetting.prop('checked') App.Setting.set('form_ticket_create', value) diff --git a/app/assets/javascripts/app/views/channel/form.jst.eco b/app/assets/javascripts/app/views/channel/form.jst.eco index fe417ebcd..538339b01 100644 --- a/app/assets/javascripts/app/views/channel/form.jst.eco +++ b/app/assets/javascripts/app/views/channel/form.jst.eco @@ -93,7 +93,19 @@ -
<%- @T('You need to add the following Java Script code snipped to your web page') %>: + + +
<%- @T('You need to add the following Java Script code snipped to your web page') %>:
<button id="feedback-form">Feedback</button>
diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb
index e13ccb237..bf9fad963 100644
--- a/app/controllers/form_controller.rb
+++ b/app/controllers/form_controller.rb
@@ -87,28 +87,27 @@ class FormController < ApplicationController
)
end
+ # set current user
+ UserInfo.current_user_id = customer.id
+
ticket = Ticket.create(
group_id: 1,
customer_id: customer.id,
title: params[:title],
state_id: Ticket::State.find_by(name: 'new').id,
priority_id: Ticket::Priority.find_by(name: '2 normal').id,
- updated_by_id: customer.id,
- created_by_id: customer.id,
)
-
article = Ticket::Article.create(
ticket_id: ticket.id,
type_id: Ticket::Article::Type.find_by(name: 'web').id,
sender_id: Ticket::Article::Sender.find_by(name: 'Customer').id,
body: params[:body],
- from: email,
subject: params[:title],
internal: false,
- updated_by_id: customer.id,
- created_by_id: customer.id,
)
+ UserInfo.current_user_id = 1
+
result = {}
render json: result, status: :ok
end
diff --git a/public/assets/form/form.css b/public/assets/form/form.css
index daa01d175..28b8fd64f 100644
--- a/public/assets/form/form.css
+++ b/public/assets/form/form.css
@@ -26,7 +26,7 @@
text-align: center;
}
-.modal {
+.zammad-form-modal {
position: fixed;
left: 0;
top: 0;
@@ -36,7 +36,7 @@
z-index: 999;
}
-.modal:before {
+.zammad-form-modal:before {
content: "";
display: inline-block;
height: 100%;
@@ -44,7 +44,7 @@
margin-right: -0.25em;
}
-.modal-backdrop {
+.zammad-form-modal-backdrop {
position: absolute;
left: 0;
top: 0;
@@ -54,7 +54,7 @@
background-color: gray;
}
-.modal-body {
+.zammad-form-modal-body {
text-align: left;
background: white;
border-radius: 5px;
diff --git a/public/assets/form/form.js b/public/assets/form/form.js
index a943edfad..1dd517062 100644
--- a/public/assets/form/form.js
+++ b/public/assets/form/form.js
@@ -11,10 +11,10 @@