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 %> <% if asset.step %>
<% is_image = asset.is_image? %> <% if asset.blank? and @asset.present? then asset = @asset end %>
<% timestamp = asset.created_at %> <% is_image = asset.is_image? %>
<% icon_class = is_image ? "glyphicon-picture" : "glyphicon-file" %> <% timestamp = asset.created_at %>
<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 %>"> <% icon_class = is_image ? "glyphicon-picture" : "glyphicon-file" %>
<div class="report-element-header"> <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="row"> <div class="report-element-header">
<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 %>
<div class="row"> <div class="row">
<div class="col-xs-12 file-image"> <div class="pull-left attachment-icon">
<%= report_image_asset_url(asset) %> <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>
<% 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>
<div class="report-element-children"> <% end %>
<%= children if (defined? children and children.present?) %>
</div>
</div>

View file

@ -1,34 +1,36 @@
<% if checklist.blank? and @checklist.present? then checklist = @checklist end %> <% if checklist.step %>
<% items = checklist.checklist_items %> <% if checklist.blank? and @checklist.present? then checklist = @checklist end %>
<% timestamp = checklist.created_at %> <% items = checklist.checklist_items %>
<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"> <% timestamp = checklist.created_at %>
<div class="report-element-header"> <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="row"> <div class="report-element-header">
<div class="pull-left attachment-icon"> <div class="row">
<span class="glyphicon glyphicon-list"></span> <div class="pull-left attachment-icon">
</div> <span class="glyphicon glyphicon-list"></span>
<div class="pull-left checklist-name"> </div>
<em><%=t "projects.reports.elements.step_checklist.checklist_name", name: checklist.name %></em> <div class="pull-left checklist-name">
</div> <em><%=t "projects.reports.elements.step_checklist.checklist_name", name: checklist.name %></em>
<div class="pull-left user-time"> </div>
<%=t "projects.reports.elements.step_checklist.user_time", timestamp: l(timestamp, format: :full) %> <div class="pull-left user-time">
</div> <%=t "projects.reports.elements.step_checklist.user_time", timestamp: l(timestamp, format: :full) %>
<div class="pull-right controls"> </div>
<%= render partial: "reports/elements/module_element_controls.html.erb" %> <div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
</div>
</div> </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>
<div class="report-element-body"> <% end %>
<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>

View file

@ -1,24 +1,26 @@
<% if table.blank? and @table.present? then table = @table end %> <% if table.step %>
<% timestamp = table.created_at %> <% if table.blank? and @table.present? then table = @table end %>
<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"> <% timestamp = table.created_at %>
<div class="report-element-header"> <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="row"> <div class="report-element-header">
<div class="pull-left attachment-icon"> <div class="row">
<span class="glyphicon glyphicon-th"></span> <div class="pull-left attachment-icon">
</div> <span class="glyphicon glyphicon-th"></span>
<div class="pull-left user-time"> </div>
<%=t "projects.reports.elements.step_table.user_time", timestamp: l(timestamp, format: :full) %> <div class="pull-left user-time">
</div> <%=t "projects.reports.elements.step_table.user_time", timestamp: l(timestamp, format: :full) %>
<div class="pull-right controls"> </div>
<%= render partial: "reports/elements/module_element_controls.html.erb" %> <div class="pull-right controls">
<%= render partial: "reports/elements/module_element_controls.html.erb" %>
</div>
</div> </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>
<div class="report-element-body"> <% end %>
<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>