Replacement for textarea and expanding.
This commit is contained in:
parent
7238f2ba5f
commit
cb893c1b5b
5 changed files with 32 additions and 44 deletions
|
@ -41,16 +41,11 @@ class App.WidgetOrganization extends App.Controller
|
||||||
organizationData: organizationData
|
organizationData: organizationData
|
||||||
)
|
)
|
||||||
|
|
||||||
a = =>
|
@$('div [contenteditable]').ce(
|
||||||
visible = @el.find('textarea').is(":visible")
|
mode: 'textonly'
|
||||||
if visible && !@el.find('textarea').expanding('active')
|
multiline: true
|
||||||
@el.find('textarea').expanding()
|
maxlength: 250
|
||||||
@el.find('textarea').on('focus', (e) =>
|
|
||||||
visible = @el.find('textarea').is(":visible")
|
|
||||||
if visible && !@el.find('textarea').expanding('active')
|
|
||||||
@el.find('textarea').expanding()
|
|
||||||
)
|
)
|
||||||
@delay( a, 40 )
|
|
||||||
|
|
||||||
# enable user popups
|
# enable user popups
|
||||||
@userPopups()
|
@userPopups()
|
||||||
|
@ -64,7 +59,7 @@ class App.WidgetOrganization extends App.Controller
|
||||||
###
|
###
|
||||||
|
|
||||||
update: (e) =>
|
update: (e) =>
|
||||||
note = $(e.target).val()
|
note = $(e.target).ceg({ mode: 'textonly' })
|
||||||
organization = App.Organization.find( @organization_id )
|
organization = App.Organization.find( @organization_id )
|
||||||
if organization.note isnt note
|
if organization.note isnt note
|
||||||
organization.updateAttributes( note: note )
|
organization.updateAttributes( note: note )
|
||||||
|
|
|
@ -73,16 +73,11 @@ class App.WidgetUser extends App.Controller
|
||||||
userData: userData
|
userData: userData
|
||||||
)
|
)
|
||||||
|
|
||||||
a = =>
|
@$('div[contenteditable]').ce(
|
||||||
visible = @el.find('textarea').is(":visible")
|
mode: 'textonly'
|
||||||
if visible && !@el.find('textarea').expanding('active')
|
multiline: true
|
||||||
@el.find('textarea').expanding()
|
maxlength: 250
|
||||||
@el.find('textarea').on('focus', (e) =>
|
|
||||||
visible = @el.find('textarea').is(":visible")
|
|
||||||
if visible && !@el.find('textarea').expanding('active')
|
|
||||||
@el.find('textarea').expanding()
|
|
||||||
)
|
)
|
||||||
@delay( a, 40 )
|
|
||||||
|
|
||||||
@userTicketPopups(
|
@userTicketPopups(
|
||||||
selector: '.user-tickets'
|
selector: '.user-tickets'
|
||||||
|
@ -90,17 +85,8 @@ class App.WidgetUser extends App.Controller
|
||||||
position: 'right'
|
position: 'right'
|
||||||
)
|
)
|
||||||
|
|
||||||
###
|
|
||||||
if user.organization_id
|
|
||||||
@el.append('<div class="org-info"></div>')
|
|
||||||
new App.WidgetOrganization(
|
|
||||||
organization_id: user.organization_id
|
|
||||||
el: @el.find('.org-info')
|
|
||||||
)
|
|
||||||
###
|
|
||||||
|
|
||||||
update: (e) =>
|
update: (e) =>
|
||||||
note = $(e.target).val()
|
note = $(e.target).ceg({ mode: 'textonly' })
|
||||||
user = App.User.find( @user_id )
|
user = App.User.find( @user_id )
|
||||||
if user.note isnt note
|
if user.note isnt note
|
||||||
user.updateAttributes( note: note )
|
user.updateAttributes( note: note )
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="customer-info" title="<%- @Ti( row.display ) %>"><%- @L( @P( @organization[row.name] ) ) %></div>
|
<div class="customer-info" title="<%- @Ti( row.display ) %>"><%- @L( @P( @organization[row.name] ) ) %></div>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<div class="customer-info" title="<%- @Ti( row.display ) %>">
|
<div class="customer-info" title="<%- @Ti( row.display ) %>">
|
||||||
<textarea class="customer-info" rows="3" name="<%= row.name %>" data-type="update-org" placeholder="<%- @T( row.display ) %>"><%= @organization[row.name] %></textarea>
|
<div contenteditable="true" class="textbox" data-name="<%= row.name %>" data-type="update-org" data-placeholder="<%- @T('Add a Note') %>"><%= @organization[row.name] %></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<div class="userInfo-label"><%- @Ti( row.display ) %></div>
|
<div class="userInfo-label"><%- @Ti( row.display ) %></div>
|
||||||
<div class="userInfo-value">
|
<div class="userInfo-value">
|
||||||
<textarea rows="1" name="<%= row.name %>" data-type="update" placeholder="<%- @T('Add a Note') %>"><%= @user[row.name] %></textarea>
|
<div contenteditable="true" class="textbox" data-name="<%= row.name %>" data-type="update" data-placeholder="<%- @T('Add a Note') %>"><%= @user[row.name] %></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1363,17 +1363,6 @@ footer {
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-edit {
|
|
||||||
padding: 4px;
|
|
||||||
}
|
|
||||||
.inline-edit:hover {
|
|
||||||
padding: 3px;
|
|
||||||
border: 1px dotted #F92;
|
|
||||||
-webkit-border-radius: 3px;
|
|
||||||
-moz-border-radius: 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.translation {
|
.translation {
|
||||||
border: 1px dotted #F92;
|
border: 1px dotted #F92;
|
||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
|
@ -3440,6 +3429,24 @@ footer {
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.textbox[contenteditable] {
|
||||||
|
white-space: pre;
|
||||||
|
padding: 1px;
|
||||||
|
outline-style: none;
|
||||||
|
}
|
||||||
|
.textbox[contenteditable]:hover, .textbox[contenteditable]:focus {
|
||||||
|
padding: 0;
|
||||||
|
border: 1px dotted hsl(145,51%,45%);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.textbox[contenteditable].invalid {
|
||||||
|
padding: 0;
|
||||||
|
border: 1px dotted #F92;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
.textbox > .placeholder {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
|
|
Loading…
Reference in a new issue