From 5d905f0094ebb34c7525d309cce5061b12248cef Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Thu, 29 Sep 2016 14:18:04 +0200 Subject: [PATCH] refactoring --- app/views/steps/_step.html.erb | 168 ++++++++++++++++----------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/app/views/steps/_step.html.erb b/app/views/steps/_step.html.erb index b360b722b..5bf44f780 100644 --- a/app/views/steps/_step.html.erb +++ b/app/views/steps/_step.html.erb @@ -41,102 +41,102 @@
- <% end %> - <% if step.description.blank? %> - <%= t("protocols.steps.no_description") %> - <% else %> - <%= step.description %> - <% end %> -
-
- <% unless step.tables.blank? then %> -
- <%= t("protocols.steps.tables") %> - <% step.tables.each do |table| %> -
- <%= hidden_field(table, :contents, value: table.contents_utf_8, class: "hot-contents") %> -
+ + <% if step.description.blank? %> + <%= t("protocols.steps.no_description") %> + <% else %> + <%= step.description %> + <% end %> +
+
+ <% unless step.tables.blank? then %> +
+ <%= t("protocols.steps.tables") %> + <% step.tables.each do |table| %> +
+ <%= hidden_field(table, :contents, value: table.contents_utf_8, class: "hot-contents") %> +
+
+ <% end %>
<% end %> -
- <% end %> - <% assets = ordered_assets(step) %> - <% unless assets.blank? then %> -
- <%= t("protocols.steps.files") %> -
    - <% assets.each do |asset| %> -
  • - <% if can_view_or_download_step_assets(@protocol) %> - <% if asset.file_present %> - <%= link_to download_asset_path(asset), data: {no_turbolink: true, id: true, status: "asset-present"} do %> - <%= image_tag preview_asset_path(asset) if asset.is_image? %> -

    <%= truncate(asset.file_file_name, length: 50) %>

    - <% end %> - <% else %> - <%= asset_loading_span(asset) %> + <% assets = ordered_assets(step) %> + <% unless assets.blank? then %> +
    + <%= t("protocols.steps.files") %> +
      + <% assets.each do |asset| %> +
    • + <% if can_view_or_download_step_assets(@protocol) %> + <% if asset.file_present %> + <%= link_to download_asset_path(asset), data: {no_turbolink: true, id: true, status: "asset-present"} do %> + <%= image_tag preview_asset_path(asset) if asset.is_image? %> +

      <%= truncate(asset.file_file_name, length: 50) %>

      + <% end %> + <% else %> + <%= asset_loading_span(asset) %> + <% end %> + <% else %> + <%= image_tag preview_asset_path(asset) if asset.is_image? %> +

      <%= truncate(asset.file_file_name, length: 50) %>

      + <% end %> +
    • <% end %> - <% else %> - <%= image_tag preview_asset_path(asset) if asset.is_image? %> -

      <%= truncate(asset.file_file_name, length: 50) %>

      - <% end %> - +
    +
    <% end %> -
-
- <% end %> - <% unless step.checklists.blank? then %> -
- <% step.checklists.each do |checklist| %> - <%= checklist.name %> - <% if checklist.checklist_items.empty? %> -
- <%= t("protocols.steps.empty_checklist") %> -
- <% else %> - <% ordered_checklist_items(checklist).each do |checklist_item| %> -
> -
+ <% end %> +
+ + <% if @protocol.in_module? %> + <% if !step.completed? and can_complete_step_in_protocol(@protocol) %> +
+ +
+ <% elsif step.completed? and can_uncomplete_step_in_protocol(@protocol) %> +
+ +
<% end %> <% end %>
- <% end %> -
- <% if @protocol.in_module? %> - <% if !step.completed? and can_complete_step_in_protocol(@protocol) %> -
- -
- <% elsif step.completed? and can_uncomplete_step_in_protocol(@protocol) %> -
- -
- <% end %> - <% end %> -<% if @protocol.in_module? %> + <% if can_view_step_comments(@protocol) %> +
+
+
+
+ <% end %>
- <% if can_view_step_comments(@protocol) %> -
-
-
-
- <% end %>
-
-<% end %> + <% end %>