add checking for step content

This commit is contained in:
zmagod 2016-08-01 11:23:22 +02:00
parent 2a0eafeebb
commit 6e3ce92348
3 changed files with 88 additions and 82 deletions

View file

@ -1,34 +1,36 @@
<% if asset.blank? and @asset.present? then asset = @asset end %>
<% is_image = asset.is_image? %>
<% timestamp = asset.created_at %>
<% icon_class = is_image ? "glyphicon-picture" : "glyphicon-file" %>
<div class="report-element report-step-attachment-element report-step-asset-element" data-ts="<%= timestamp.to_i %>" data-type="step_asset" data-id="<%= asset.id %>" data-name="<%=t "projects.reports.elements.step_asset.sidebar_name", file: asset.file_file_name %>" data-icon-class="<%= icon_class %>">
<div class="report-element-header">
<div class="row">
<div class="pull-left attachment-icon">
<span class="glyphicon <%= icon_class %>"></span>
</div>
<div class="pull-left file-name">
<em><%=t "projects.reports.elements.step_asset.file_name", file: truncate( asset.file_file_name, length: 50 ) %></em>
</div>
<div class="pull-left user-time">
<%=t "projects.reports.elements.step_asset.user_time", timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
</div>
</div>
</div>
<div class="report-element-body">
<% if is_image %>
<% if asset.step %>
<% if asset.blank? and @asset.present? then asset = @asset end %>
<% is_image = asset.is_image? %>
<% timestamp = asset.created_at %>
<% icon_class = is_image ? "glyphicon-picture" : "glyphicon-file" %>
<div class="report-element report-step-attachment-element report-step-asset-element" data-ts="<%= timestamp.to_i %>" data-type="step_asset" data-id="<%= asset.id %>" data-name="<%=t "projects.reports.elements.step_asset.sidebar_name", file: asset.file_file_name %>" data-icon-class="<%= icon_class %>">
<div class="report-element-header">
<div class="row">
<div class="col-xs-12 file-image">
<%= report_image_asset_url(asset) %>
<div class="pull-left attachment-icon">
<span class="glyphicon <%= icon_class %>"></span>
</div>
<div class="pull-left file-name">
<em><%=t "projects.reports.elements.step_asset.file_name", file: truncate( asset.file_file_name, length: 50 ) %></em>
</div>
<div class="pull-left user-time">
<%=t "projects.reports.elements.step_asset.user_time", timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
</div>
</div>
<% end %>
</div>
<div class="report-element-body">
<% if is_image %>
<div class="row">
<div class="col-xs-12 file-image">
<%= report_image_asset_url(asset) %>
</div>
</div>
<% end %>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>
<% end %>

View file

@ -1,34 +1,36 @@
<% if checklist.blank? and @checklist.present? then checklist = @checklist end %>
<% items = checklist.checklist_items %>
<% timestamp = checklist.created_at %>
<div class="report-element report-step-attachment-element report-step-checklist-element" data-ts="<%= timestamp.to_i %>" data-type="step_checklist" data-id="<%= checklist.id %>" data-name="<%= checklist.name %>" data-icon-class="glyphicon-list">
<div class="report-element-header">
<div class="row">
<div class="pull-left attachment-icon">
<span class="glyphicon glyphicon-list"></span>
</div>
<div class="pull-left checklist-name">
<em><%=t "projects.reports.elements.step_checklist.checklist_name", name: checklist.name %></em>
</div>
<div class="pull-left user-time">
<%=t "projects.reports.elements.step_checklist.user_time", timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
<% if checklist.step %>
<% if checklist.blank? and @checklist.present? then checklist = @checklist end %>
<% items = checklist.checklist_items %>
<% timestamp = checklist.created_at %>
<div class="report-element report-step-attachment-element report-step-checklist-element" data-ts="<%= timestamp.to_i %>" data-type="step_checklist" data-id="<%= checklist.id %>" data-name="<%= checklist.name %>" data-icon-class="glyphicon-list">
<div class="report-element-header">
<div class="row">
<div class="pull-left attachment-icon">
<span class="glyphicon glyphicon-list"></span>
</div>
<div class="pull-left checklist-name">
<em><%=t "projects.reports.elements.step_checklist.checklist_name", name: checklist.name %></em>
</div>
<div class="pull-left user-time">
<%=t "projects.reports.elements.step_checklist.user_time", timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
</div>
</div>
</div>
<div class="report-element-body">
<ul class="no-style">
<% items.each do |item| %>
<li>
<input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/>
<span class="<%= "checked" if item.checked %>"><%= item.text %></span>
</li>
<% end %>
</ul>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>
<div class="report-element-body">
<ul class="no-style">
<% items.each do |item| %>
<li>
<input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/>
<span class="<%= "checked" if item.checked %>"><%= item.text %></span>
</li>
<% end %>
</ul>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>
<% end %>

View file

@ -1,24 +1,26 @@
<% if table.blank? and @table.present? then table = @table end %>
<% timestamp = table.created_at %>
<div class="report-element report-step-attachment-element report-step-table-element" data-ts="<%= timestamp.to_i %>" data-type="step_table" data-id="<%= table.id %>" data-name="<%=t "projects.reports.elements.step_table.sidebar_name" %>" data-icon-class="glyphicon-th">
<div class="report-element-header">
<div class="row">
<div class="pull-left attachment-icon">
<span class="glyphicon glyphicon-th"></span>
</div>
<div class="pull-left user-time">
<%=t "projects.reports.elements.step_table.user_time", timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
<% if table.step %>
<% if table.blank? and @table.present? then table = @table end %>
<% timestamp = table.created_at %>
<div class="report-element report-step-attachment-element report-step-table-element" data-ts="<%= timestamp.to_i %>" data-type="step_table" data-id="<%= table.id %>" data-name="<%=t "projects.reports.elements.step_table.sidebar_name" %>" data-icon-class="glyphicon-th">
<div class="report-element-header">
<div class="row">
<div class="pull-left attachment-icon">
<span class="glyphicon glyphicon-th"></span>
</div>
<div class="pull-left user-time">
<%=t "projects.reports.elements.step_table.user_time", timestamp: l(timestamp, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
</div>
</div>
</div>
<div class="report-element-body">
<input type="hidden" class="hot-table-contents" value="<%= table.contents_utf_8 %>" />
<div class="hot-table-container"></div>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>
<div class="report-element-body">
<input type="hidden" class="hot-table-contents" value="<%= table.contents_utf_8 %>" />
<div class="hot-table-container"></div>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>
</div>
</div>
<% end %>