Added generic richtext form attribute. First use in ticket create screen.
This commit is contained in:
parent
e845347956
commit
fdbceaf39e
5 changed files with 64 additions and 2 deletions
|
@ -704,6 +704,14 @@ class App.ControllerForm extends App.Controller
|
||||||
else if attribute.tag is 'radio'
|
else if attribute.tag is 'radio'
|
||||||
item = $( App.view('generic/radio')( attribute: attribute ) )
|
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
|
# textarea
|
||||||
else if attribute.tag is 'textarea'
|
else if attribute.tag is 'textarea'
|
||||||
fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
|
fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
|
||||||
|
|
|
@ -272,7 +272,7 @@ class App.TicketCreate extends App.Controller
|
||||||
|
|
||||||
# show text module UI
|
# show text module UI
|
||||||
@textModule = new App.WidgetTextModule(
|
@textModule = new App.WidgetTextModule(
|
||||||
el: @el.find('form').find('textarea')
|
el: @el.find('[data-name="body"]')
|
||||||
)
|
)
|
||||||
|
|
||||||
new Sidebar(
|
new Sidebar(
|
||||||
|
@ -391,7 +391,7 @@ class App.TicketCreate extends App.Controller
|
||||||
type: 'success',
|
type: 'success',
|
||||||
msg: App.i18n.translateInline( 'Ticket %s created!', @number ),
|
msg: App.i18n.translateInline( 'Ticket %s created!', @number ),
|
||||||
link: "#ticket/zoom/#{@id}"
|
link: "#ticket/zoom/#{@id}"
|
||||||
timeout: 12000,
|
timeout: 4000,
|
||||||
|
|
||||||
# close ticket create task
|
# close ticket create task
|
||||||
App.TaskManager.remove( ui.task_key )
|
App.TaskManager.remove( ui.task_key )
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<div contenteditable="true" id="<%= @attribute.id %>" data-name="<%= @attribute.name %>" class="form-control <%= @attribute.class %>"><%= @attribute.value %></div>
|
|
@ -442,6 +442,10 @@ label {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-group .controls {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.form-group .help-message {
|
.form-group .help-message {
|
||||||
cursor: help;
|
cursor: help;
|
||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
|
@ -473,6 +477,12 @@ textarea,
|
||||||
box-shadow: 0 0 0 3px hsl(201,62%,90%);
|
box-shadow: 0 0 0 3px hsl(201,62%,90%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.form-control[contenteditable] {
|
||||||
|
height: auto;
|
||||||
|
min-height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
.tokenfield.focus {
|
.tokenfield.focus {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
border-color: hsl(0,0%,90%);
|
border-color: hsl(0,0%,90%);
|
||||||
|
|
43
db/migrate/20141002000001_update_object_manager4.rb
Normal file
43
db/migrate/20141002000001_update_object_manager4.rb
Normal 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
|
Loading…
Reference in a new issue