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