IM-932 : File Metadata Distinction/Template Design

This commit is contained in:
Naomi 2013-08-28 15:40:10 -04:00
parent 3769f5e5db
commit e6b09308a5
3 changed files with 111 additions and 60 deletions

View File

@ -9,68 +9,71 @@
Name
<input id="template_name" type="text" value="<?php echo $this->template_name; ?>">
</label>
<?php $i = 0;
$usedFileMD = array();
?>
<ul class="template_item_list">
<?php foreach ($this->template_fields as $field): ?>
<?php if($field["isFileMd"]) {
$usedFileMD[] = $field["name"];
} ?>
<li id="<?php echo "field_".$i?>"
data-id="<?php echo isset($field["id"]) ? $field["id"] : ""; ?>"
data-name="<?php echo $field["name"]?>"
data-label="<?php echo $field["label"]?>"
data-type="<?php echo $field["type"]?>"
data-filemd="<?php echo var_export($field["isFileMd"], true)?>"
class="<?php echo ($field["isFileMd"]) ? 'field_filemd' : 'field_other' ?>">
<span><?php echo $field["label"]?></span>
<span><?php echo $field["type"]?></span>
<?php if(!in_array($field["name"], $this->required_fields)): ?>
<span class="template_item_remove">
<i class="icon icon-trash"></i>
</span>
<?php endif; ?>
</li>
<?php $i++; ?>
<?php endforeach; ?>
</ul>
</div>
<div class="add_more">
<?php $i = 0;
$usedFileMD = array();
?>
<ul class="template_item_list">
<?php foreach ($this->template_fields as $field): ?>
<?php if($field["isFileMd"]) {
$usedFileMD[] = $field["name"];
} ?>
<li id="<?php echo "field_".$i?>"
data-id="<?php echo isset($field["id"]) ? $field["id"] : ""; ?>"
data-name="<?php echo $field["name"]?>"
data-label="<?php echo $field["label"]?>"
data-type="<?php echo $field["type"]?>"
data-filemd="<?php echo var_export($field["isFileMd"], true)?>">
<span><?php echo $field["label"]?></span>
<span><?php echo $field["type"]?></span>
<?php if(!in_array($field["name"], $this->required_fields)): ?>
<span class="template_item_remove">
<i class="icon icon-trash"></i>
</span>
<?php endif; ?>
</li>
<?php $i++; ?>
<?php endforeach; ?>
</ul>
<p>Add more elements:</p>
<ul class="template_file_md">
<?php foreach ($this->fileMD as $md): ?>
<?php if(in_array($md["name"], $usedFileMD)) {
continue;
} ?>
<li id="<?php echo "md_".$md["name"]?>"
data-name="<?php echo $md["name"]?>"
data-type="<?php echo $md["type"]?>"
data-label="<?php echo $md["label"]?>">
<?php echo $md["label"] ?>
<a class="field_add" href="#"><i class="icon icon-plus"></i></a>
</li>
<?php endforeach; ?>
</ul>
<?php if ($this->template_type !== Application_Service_HistoryService::TEMPLATE_TYPE_FILE): ?>
<div class="template_item_add">
<input type="text" placeholder="Add New Field">
<select>
<?php foreach ($this->fields as $field): ?>
<option value="<?php echo $field; ?>"><?php echo $field; ?></option>
<?php endforeach; ?>
</select>
<button class="btn"><i class="icon-white icon-plus"></i> Add</button>
</div>
<?php endif; ?>
<p>Add more elements:</p>
<ul class="template_file_md">
<?php foreach ($this->fileMD as $md): ?>
<?php if(in_array($md["name"], $usedFileMD)) {
continue;
} ?>
<li id="<?php echo "md_".$md["name"]?>"
data-name="<?php echo $md["name"]?>"
data-type="<?php echo $md["type"]?>"
data-label="<?php echo $md["label"]?>">
<?php echo $md["label"] ?>
<a class="field_add" href="#"><i class="icon icon-plus"></i></a>
</li>
<?php endforeach; ?>
</ul>
<?php if ($this->template_type !== Application_Service_HistoryService::TEMPLATE_TYPE_FILE): ?>
<div class="template_item_add">
<input type="text" placeholder="Add New Field">
<select>
<?php foreach ($this->fields as $field): ?>
<option value="<?php echo $field; ?>"><?php echo $field; ?></option>
<?php endforeach; ?>
</select>
<button class="btn"><i class="icon-white icon-plus"></i> Add</button>
</div>
<?php endif; ?>
</div>
<div>
<?php if (!in_array($this->template_id, $this->configured)): ?>

View File

@ -135,3 +135,49 @@
.bootstrap-datetimepicker-widget thead tr:first-child th:hover {
background: #5C5C5C !important;
}
#configure_item_template {
width: 100%;
max-width: 620px;
}
.add_more {
float: right;
}
#configure_item_template #template_name {
margin-bottom: 14px;
}
#configure_item_template .template_item_list li {
width: 270px;
}
#configure_item_template li {
width: 270px;
}
#configure_item_template .template_item_list li.field_other {
background-color: #CACACA;
}
.ui-widget-content {
background: #C0C0C0 !important;
}
#history_content .btn-toolbar {
margin: 10px;
}
#history_content div.DTTT_container {
margin-top: 8px;
}
#history_content .dataTables_length {
margin-top: 9px;
margin-right: 10px;
}
.btn [class^="icon-"] {
margin-top: 0;
}

View File

@ -18,6 +18,7 @@ var AIRTIME = (function(AIRTIME) {
"data-type='<%= type %>' " +
"data-filemd='<%= filemd %>'" +
"data-label='<%= label %>'" +
"class='<%= (filemd) ? 'field_filemd' : 'field_other' %>'" +
">" +
"<span><%= label %></span>" +
"<span><%= type %></span>" +
@ -29,6 +30,7 @@ var AIRTIME = (function(AIRTIME) {
"data-type='<%= type %>' " +
"data-filemd='<%= filemd %>'" +
"data-label='<%= label %>'" +
"class='<%= (filemd) ? 'field_filemd' : 'field_other' %>'" +
">" +
"<span><%= label %></span>" +
"<span><%= type %></span>" +