<commit_before>- if action_name.in? %w{edit layout annotate} ##draft mode
  - if action_name == 'layout'
    - if @content.is_a? Content::Casebook
      = button_to t('content.actions.publish'), casebook_path(@casebook), method: :patch, params: {content_casebook: {public: true}}, class: 'action publish one-line'
      = link_to t('content.actions.preview'), casebook_path(@casebook), class: 'action one-line preview'
    - elsif @content.is_a? Content::Section
      = link_to t('content.actions.preview'), section_path(@casebook, @section), class: 'action one-line preview'
    = link_to t('content.actions.add-resource'), new_section_path(@casebook), class: 'action add-resource'
    = button_to t('content.actions.add-section'), sections_path(@casebook, params: {parent: @section.try(:id)}), method: :post, class: 'action add-section'
  - if @content.is_a? Content::Resource
    = link_to t('content.actions.preview'), resource_path(@casebook, @resource), class: 'action one-line preview'
- else
  - if @casebook.owners.include?(current_user)
    - if @casebook.public ## published version
      = link_to t('content.actions.revise'), edit_casebook_path(@casebook), class: 'action edit one-line'
    - else
      - if action_name == 'details' ##not sure when used
        - if @content.is_a? Content::Casebook
          = link_to t('content.actions.edit'), edit_casebook_path(@casebook), class: 'action edit one-line'
        - elsif @content.is_a? Content::Section
          = link_to t('content.actions.edit'), edit_section_path(@casebook, @section), class: 'action edit one-line'
        - elsif @content.is_a? Content::Resource
          = link_to t('content.actions.edit'), edit_resource_path(@casebook, @resource), class: 'action edit one-line'
      - elsif action_name == 'show' ## preview mode
        - if @content.is_a? Content::Casebook
          = link_to t('content.actions.edit'), layout_casebook_path(@casebook), class: 'action edit one-line'
        - elsif @content.is_a? Content::Section
          = link_to t('content.actions.edit'), layout_section_path(@casebook, @section), class: 'action edit one-line'
        - elsif @content.is_a? Content::Resource
          = link_to t('content.actions.edit'), annotate_resource_path(@casebook, @resource), class: 'action edit one-line'
  = button_to t('content.actions.clone-casebook'), clone_casebook_path(@casebook), method: :post, class: 'action clone-casebook'
  = link_to t('content.actions.export'), export_casebook_path(@casebook), class: 'action one-line export'<commit_msg>Preview mode has publish button.<commit_after>- if action_name.in? %w{edit layout annotate} ##draft mode
  - if action_name == 'layout'
    - if @content.is_a? Content::Casebook
      = button_to t('content.actions.publish'), casebook_path(@casebook), method: :patch, params: {content_casebook: {public: true}}, class: 'action publish one-line'
      = link_to t('content.actions.preview'), casebook_path(@casebook), class: 'action one-line preview'
    - elsif @content.is_a? Content::Section
      = link_to t('content.actions.preview'), section_path(@casebook, @section), class: 'action one-line preview'
    = link_to t('content.actions.add-resource'), new_section_path(@casebook), class: 'action add-resource'
    = button_to t('content.actions.add-section'), sections_path(@casebook, params: {parent: @section.try(:id)}), method: :post, class: 'action add-section'
  - if @content.is_a? Content::Resource
    = link_to t('content.actions.preview'), resource_path(@casebook, @resource), class: 'action one-line preview'
- else
  - if @casebook.owners.include?(current_user)
    - if @casebook.public ## published version
      = link_to t('content.actions.revise'), edit_casebook_path(@casebook), class: 'action edit one-line'
    - else
      - if action_name == 'details' ##not sure when used
        - if @content.is_a? Content::Casebook
          = link_to t('content.actions.edit'), edit_casebook_path(@casebook), class: 'action edit one-line'
        - elsif @content.is_a? Content::Section
          = link_to t('content.actions.edit'), edit_section_path(@casebook, @section), class: 'action edit one-line'
        - elsif @content.is_a? Content::Resource
          = link_to t('content.actions.edit'), edit_resource_path(@casebook, @resource), class: 'action edit one-line'
      - elsif action_name == 'show' ## preview mode
        - if @content.is_a? Content::Casebook
          = button_to t('content.actions.publish'), casebook_path(@casebook), method: :patch, params: {content_casebook: {public: true}}, class: 'action publish one-line'
          = link_to t('content.actions.edit'), layout_casebook_path(@casebook), class: 'action edit one-line'
        - elsif @content.is_a? Content::Section
          = link_to t('content.actions.edit'), layout_section_path(@casebook, @section), class: 'action edit one-line'
        - elsif @content.is_a? Content::Resource
          = link_to t('content.actions.edit'), annotate_resource_path(@casebook, @resource), class: 'action edit one-line'
  = button_to t('content.actions.clone-casebook'), clone_casebook_path(@casebook), method: :post, class: 'action clone-casebook'
  = link_to t('content.actions.export'), export_casebook_path(@casebook), class: 'action one-line export'
{'fraction_non_alphanumeric': 0.14901664145234494, 'fraction_numerical': 0.0, 'mean_word_length': 4.380467955239064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2746935', 'n_tokens_mistral': 1620, 'n_tokens_neox': 1627, 'n_words': 374}