Skip to content

Instantly share code, notes, and snippets.

@elchele
Last active August 29, 2015 14:06
Show Gist options
  • Save elchele/4f45249a478911ab091f to your computer and use it in GitHub Desktop.
Save elchele/4f45249a478911ab091f to your computer and use it in GitHub Desktop.
Expanding the default width on the Name column
{{!--
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
* Copyright (C) SugarCRM Inc. All rights reserved.
*
* Mod By: Angel Magaña -- [email protected]
* File: ./custom/clients/base/views/flex-list/flex-list.hbs
* Sugar Versions: 7.2.x
*
*/
--}}
{{#each meta.panels}}
<div class="flex-list-view-content">
<table class="table table-striped dataTable{{#has "ReorderableColumns" ../plugins}} reorderable-columns{{/has}}{{#if ../isLinkAction}} search-and-select{{/if}}">
<thead>
<tr>
{{#each ../leftColumns}}
<th{{#if name}} data-fieldname="{{name}}"{{/if}}>
<span>
{{field ../../this template="list-header"}}
</span>
</th>
{{/each}}
{{#each ../_fields.visible}} {{!-- AM: The next line contains special styling for 'name' column, giving us the expanded column effect --}}
<th {{#eq this.name "name"}}style="min-width: 250px"{{/eq}} class="{{#isSortable ../../module this}}sorting{{#eq ../../../orderBy.field name}}_{{../../../../orderBy.direction}}{{/eq}} orderBy{{name}}{{/isSortable}}"
{{#if name}} data-fieldname="{{name}}"{{/if}} data-orderby="{{orderBy}}">
{{#has "ReorderableColumns" ../../plugins}}
{{! Insert a <div> around all the inner element of the column.
This is a fix for firefox because the <th> does not support
a relative positioning.}}
<div>
<div class="th-droppable-placeholder" data-droppableindex="{{@index}}"></div>
{{! Insert a <div> around the <span> containing the field label.
That <div> is the draggable element.
This is a fix for firefox because dragging a <th> is not
supported.}}
<div{{#has "ReorderableColumns" ../../../plugins}} data-draggable="true"{{/has}}>
{{/has}}
<span>
{{str this.label ../../module}}
</span>
{{#has "ReorderableColumns" ../../plugins}}
</div>
{{#if @last}}
<div class="th-droppable-placeholder th-droppable-placeholder-last" data-droppableindex="{{../../../../_fields.visible.length}}"></div>
{{/if}}
</div>
{{/has}}
</th>
{{/each}}
{{#each ../rightColumns}}
{{#if isColumnDropdown}}
<th class="nosort morecol">
<div class="dropdown">
<button class="btn btn-invisible" data-toggle="dropdown" rel="tooltip" title="{{str "LBL_COLUMNS"}}" data-placement="bottom" data-action="fields-toggle" track="click:morecol"><i class="icon-ellipsis-horizontal"></i></button>
<ul class="dropdown-menu left">
{{#each ../../../_fields.all}}
<li>
<button class="{{#if selected}}active{{/if}}" data-field-toggle="{{name}}" track="click:{{name}}">
{{#if selected}}<i class="icon icon-ok"></i> {{/if}}{{str label ../../../../module}}
</button>
</li>
{{/each}}
</ul>
</div>
</th>
{{else}}
<th{{#if name}} data-fieldname="{{name}}"{{/if}}>
<span>
{{field ../../this template="list-header"}}
</span>
</th>
{{/if}}
{{/each}}
</tr>
<tr>
<th data-target="alert-container" class="alert alert-warning hide"{{#if ../this.colSpan}} colspan="{{../../this.colSpan}}"{{/if}}>
<div data-target="alert">
</div>
</th>
</tr>
</thead>
<tbody>
{{#each ../collection.models}}
<tr name="{{module}}_{{attributes.id}}" class="single">
{{#each ../../leftColumns}}
<td>
{{field ../../../this model=../this template=../../../this.viewName}}
</td>
{{/each}}
{{#each ../../_fields.visible}}
<td{{#if this.align}} class="{{this.align}}"{{/if}} {{#if this.maxWidth}}style="max-width:{{this.maxWidth}}" {{/if}}data-type="{{type}}">
{{field ../../../this model=../this template=../../../this.viewName}}
</td>
{{/each}}
{{#each ../../rightColumns}}
<td>
{{field ../../../this model=../this template=../../../this.viewName}}
</td>
{{/each}}
</tr>
{{/each}}
</tbody>
</table>
</div>
{{#if ../collection.dataFetched}}
{{#unless ../../collection.length}}
<div class="block-footer">
{{str "LBL_NO_DATA_AVAILABLE"}}
</div>
{{/unless}}
{{/if}}
{{/each}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment