Added generic richtext form attribute. First use in ticket create screen.

This commit is contained in:
Martin Edenhofer 2014-10-02 18:10:52 +02:00
parent e845347956
commit fdbceaf39e
5 changed files with 64 additions and 2 deletions

View file

@ -704,6 +704,14 @@ class App.ControllerForm extends App.Controller
else if attribute.tag is 'radio'
item = $( App.view('generic/radio')( attribute: attribute ) )
# richtext
else if attribute.tag is 'richtext'
item = $( App.view('generic/richtext')( attribute: attribute ) )
item.ce(
mode: attribute.type
maxlength: attribute.maxlength
)
# textarea
else if attribute.tag is 'textarea'
fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )

View file

@ -272,7 +272,7 @@ class App.TicketCreate extends App.Controller
# show text module UI
@textModule = new App.WidgetTextModule(
el: @el.find('form').find('textarea')
el: @el.find('[data-name="body"]')
)
new Sidebar(
@ -391,7 +391,7 @@ class App.TicketCreate extends App.Controller
type: 'success',
msg: App.i18n.translateInline( 'Ticket %s created!', @number ),
link: "#ticket/zoom/#{@id}"
timeout: 12000,
timeout: 4000,
# close ticket create task
App.TaskManager.remove( ui.task_key )

View file

@ -0,0 +1 @@
<div contenteditable="true" id="<%= @attribute.id %>" data-name="<%= @attribute.name %>" class="form-control <%= @attribute.class %>"><%= @attribute.value %></div>

View file

@ -442,6 +442,10 @@ label {
margin-top: 0;
}
.form-group .controls {
position: relative;
}
.form-group .help-message {
cursor: help;
opacity: 0.2;
@ -473,6 +477,12 @@ textarea,
box-shadow: 0 0 0 3px hsl(201,62%,90%);
}
.form-control[contenteditable] {
height: auto;
min-height: 100px;
}
.tokenfield.focus {
box-shadow: none;
border-color: hsl(0,0%,90%);

View file

@ -0,0 +1,43 @@
class UpdateObjectManager4 < ActiveRecord::Migration
def up
ObjectManager::Attribute.add(
:object => 'TicketArticle',
:name => 'body',
:display => 'Text',
:data_type => 'richtext',
:data_option => {
:type => 'textonly',
:maxlength => 20000,
:upload => true,
:rows => 8,
:null => true,
},
:editable => false,
:active => true,
:screens => {
:create_top => {
'-all-' => {
:null => false,
},
},
:edit => {
:Agent => {
:null => true,
},
:Customer => {
:null => false,
},
},
},
:pending_migration => false,
:position => 600,
:created_by_id => 1,
:updated_by_id => 1,
)
end
def down
end
end