Add richtext feature to popovers.
This commit is contained in:
parent
24b80de0ea
commit
8247cdbf51
4 changed files with 74 additions and 44 deletions
|
@ -263,35 +263,33 @@ class App.Controller extends Spine.Controller
|
|||
placement: position
|
||||
title: ->
|
||||
user_id = $(@).data('id')
|
||||
user = App.User.fullLocal( user_id )
|
||||
user = App.User.fullLocal( user_id )
|
||||
HTMLEscape( user.displayName() )
|
||||
content: ->
|
||||
user_id = $(@).data('id')
|
||||
user = App.User.fullLocal( user_id )
|
||||
user = App.User.fullLocal( user_id )
|
||||
|
||||
# get display data
|
||||
data = []
|
||||
for item2 in App.User.configure_attributes
|
||||
item = _.clone( item2 )
|
||||
userData = []
|
||||
for attributeName, attributeConfig of App.User.attributesGet('view')
|
||||
|
||||
# check if value for _id exists
|
||||
itemNameValue = item.name
|
||||
itemNameValueNew = itemNameValue.substr( 0, itemNameValue.length - 3 )
|
||||
if itemNameValueNew of user
|
||||
item.name = itemNameValueNew
|
||||
name = attributeName
|
||||
nameNew = name.substr( 0, name.length - 3 )
|
||||
if nameNew of user
|
||||
name = nameNew
|
||||
|
||||
# add to show if value exists
|
||||
if user[item.name]
|
||||
if user[name] && attributeConfig.shown
|
||||
|
||||
# do not show firstname and lastname / already show via diplayName()
|
||||
if item.name isnt 'firstname' && item.name isnt 'lastname' && item.name isnt 'organization'
|
||||
if item.info #&& ( @user[item.name] || item.name isnt 'note' )
|
||||
data.push item
|
||||
if name isnt 'firstname' && name isnt 'lastname' && name isnt 'organization'
|
||||
userData.push attributeConfig
|
||||
|
||||
# insert data
|
||||
App.view('popover/user')(
|
||||
user: user,
|
||||
data: data,
|
||||
user: user
|
||||
userData: userData
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -312,14 +310,33 @@ class App.Controller extends Spine.Controller
|
|||
placement: position
|
||||
title: ->
|
||||
organization_id = $(@).data('id')
|
||||
organization = App.Organization.fullLocal( organization_id )
|
||||
organization = App.Organization.fullLocal( organization_id )
|
||||
HTMLEscape( organization.name )
|
||||
content: ->
|
||||
organization_id = $(@).data('id')
|
||||
organization = App.Organization.fullLocal( organization_id )
|
||||
organization = App.Organization.fullLocal( organization_id )
|
||||
|
||||
# get display data
|
||||
organizationData = []
|
||||
for attributeName, attributeConfig of App.Organization.attributesGet('view')
|
||||
|
||||
# check if value for _id exists
|
||||
name = attributeName
|
||||
nameNew = name.substr( 0, name.length - 3 )
|
||||
if nameNew of organization
|
||||
name = nameNew
|
||||
|
||||
# add to show if value exists
|
||||
if organization[name] && attributeConfig.shown
|
||||
|
||||
# do not show firstname and lastname / already show via diplayName()
|
||||
if name isnt 'name'
|
||||
organizationData.push attributeConfig
|
||||
|
||||
# insert data
|
||||
App.view('popover/organization')(
|
||||
organization: organization,
|
||||
organization: organization,
|
||||
organizationData: organizationData,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -202,6 +202,11 @@ class Table extends App.ControllerContent
|
|||
attribute.data =
|
||||
id: refObject.id
|
||||
value
|
||||
callbackOrganizationPopover = (value, object, attribute, attributes, refObject) =>
|
||||
attribute.class = 'organization-popover'
|
||||
attribute.data =
|
||||
id: refObject.id
|
||||
value
|
||||
callbackCheckbox = (id, checked, e) =>
|
||||
if @el.find('table').find('input[name="bulk"]:checked').length == 0
|
||||
@el.find('.bulkAction').addClass('hide')
|
||||
|
@ -243,6 +248,8 @@ class Table extends App.ControllerContent
|
|||
[ callbackIcon ]
|
||||
customer_id:
|
||||
[ callbackUserPopover ]
|
||||
organization_id:
|
||||
[ callbackOrganizationPopover ]
|
||||
owner_id:
|
||||
[ callbackUserPopover ]
|
||||
title:
|
||||
|
@ -259,6 +266,9 @@ class Table extends App.ControllerContent
|
|||
# start user popups
|
||||
@userPopups()
|
||||
|
||||
# start organization popups
|
||||
@organizationPopups()
|
||||
|
||||
# show frontend times
|
||||
@frontendTimeUpdate()
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<table style="width: 100%;">
|
||||
<tr>
|
||||
<td><%- @T( 'Shared' ) %></td>
|
||||
<td><%- @P( @organization.shared ) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%- @T( 'Note' ) %></td>
|
||||
<td><%- @P( @organization.note ) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% if @organization.users: %>
|
||||
<strong><%- @T('Users') %></strong>
|
||||
<ul>
|
||||
<% for user in @organization.users: %>
|
||||
<li><%= user.displayName() %></li>
|
||||
<% for row in @organizationData: %>
|
||||
<% if @organization[row.name]: %>
|
||||
<% if row.tag is 'richtext': %>
|
||||
<div class="customer-info" title="<%- @Ti( row.display ) %>"><%- @organization[row.name] %></div>
|
||||
<% else: %>
|
||||
<div class="customer-info" title="<%- @Ti( row.display ) %>"><%- @L( @P( @organization[row.name] ) ) %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if @organization.members: %>
|
||||
<hr>
|
||||
<%- @T('Members') %>
|
||||
<ul>
|
||||
<% for user in @organization.members: %>
|
||||
<li><%= user.displayName() %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
|
@ -1,13 +1,16 @@
|
|||
<% for row in @data: %>
|
||||
<% if @user[row.name]: %>
|
||||
<div class="customer-info" title="<%- @Ti( row.display ) %>"><%- @L( @P( @user[row.name] ) ) %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @user['organization']: %>
|
||||
<div class="customer-info">
|
||||
<strong><%- @T( 'Organization' ) %></strong><br/>
|
||||
<%- @P( @user['organization'] ) %>
|
||||
</div>
|
||||
<div class="customer-info">
|
||||
<%- @P( @user['organization'] ) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% for row in @userData: %>
|
||||
<% if @user[row.name]: %>
|
||||
<% if row.tag is 'richtext': %>
|
||||
<div class="customer-info" title="<%- @Ti( row.display ) %>"><%- @user[row.name] %></div>
|
||||
<% else: %>
|
||||
<div class="customer-info" title="<%- @Ti( row.display ) %>"><%- @L( @P( @user[row.name] ) ) %></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !_.isEmpty(@user['accounts']): %>
|
||||
<div class="customer-info">
|
||||
|
@ -24,7 +27,7 @@
|
|||
<% for item in link['items']: %>
|
||||
<% if item['url']: %>
|
||||
<a href="<%= item['url'] %>" title="<%- @Ti( item['title'] ) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>" <% if link.new_window: %>target="_blank"<% end %>>
|
||||
<% else: %>
|
||||
<% else: %>
|
||||
<span title="<%- @Ti( item['title'] ) %>" style="<%= item['style'] %>" data-type="<%= item['data'] %>" class="<%= item['class'] %>">
|
||||
<% end %>
|
||||
<%- @T( item['name'] ) %> <% if item['count'] isnt undefined: %><span class="count">(<%= item['count'] %>)</span><% end %>
|
||||
|
|
Loading…
Reference in a new issue