<commit_before>module ButtonsHelper
  include IconsHelper
  def garden_plant_something_button(garden)
    return unless can? :edit, garden

    link_to new_planting_path(garden_id: garden.id), class: "btn btn-default" do
      planting_icon + ' ' + t('buttons.plant_something_here')
    end
  end

  def plant_something_button
    return unless can? :create, Planting

    link_to new_planting_path, class: "btn btn-default" do
      planting_icon + ' ' + t('buttons.plant_something')
    end
  end

  def garden_mark_active_button(garden)
    link_to t('buttons.mark_as_active'),
            garden_path(garden, garden: { active: 1 }),
            method: :put, class: 'btn'
  end

  def garden_mark_inactive_button(garden)
    link_to t('buttons.mark_as_inactive'),
            garden_path(garden, garden: { active: 0 }),
            method: :put, class: 'btn',
            data: { confirm: 'All plantings associated with this garden will be marked as finished. Are you sure?' }
  end

  def crop_plant_button(crop)
    return unless can? :create, Planting

    link_to new_planting_path(params: { crop_id: crop.id }), class: 'btn btn-sm' do
      planting_icon + ' ' + t('buttons.plant')
    end
  end

  def crop_save_seeds_button(crop)
    return unless can?(:create, Seed)

    link_to new_seed_path(params: { crop_id: crop.id }), class: "btn btn-sm" do
      seed_icon + ' ' + t('buttons.save_seeds')
    end
  end

  def crop_edit_button(crop)
    edit_button(edit_crop_path(crop))
  end

  def seed_edit_button(seed)
    edit_button(edit_seed_path(seed))
  end

  def harvest_edit_button(harvest)
    edit_button(edit_harvest_path(harvest))
  end

  def garden_edit_button(garden)
    edit_button(edit_garden_path(garden))
  end

  def planting_edit_button(planting, classes: "btn btn-raised btn-info")
    edit_button(edit_planting_path(planting), classes: classes)
  end

  def planting_finish_button(planting, classes: 'btn btn-default btn-secondary')
    return unless can?(:edit, planting) || planting.finished

    link_to planting_path(planting, planting: { finished: 1 }),
            method: :put, class: "#{classes} append-date" do
      finished_icon + ' ' + t('buttons.mark_as_finished')
    end
  end

  def seed_finish_button(seed)
    return unless can?(:create, Planting) && seed.active?

    link_to seed_path(seed, seed: { finished: 1 }), method: :put, class: 'btn btn-default append-date' do
      finished_icon + ' ' + t('buttons.mark_as_finished')
    end
  end

  def planting_harvest_button(planting, classes: 'btn btn-default')
    return unless planting.active? && can?(:create, Harvest) && can?(:edit, planting)

    link_to new_planting_harvest_path(planting), class: classes do
      harvest_icon + ' ' + t('buttons.record_harvest')<commit_msg>seeds button helper, for actions links<commit_after>module ButtonsHelper
  include IconsHelper
  def garden_plant_something_button(garden)
    return unless can? :edit, garden

    link_to new_planting_path(garden_id: garden.id), class: "btn btn-default" do
      planting_icon + ' ' + t('buttons.plant_something_here')
    end
  end

  def plant_something_button
    return unless can? :create, Planting

    link_to new_planting_path, class: "btn btn-default" do
      planting_icon + ' ' + t('buttons.plant_something')
    end
  end

  def garden_mark_active_button(garden)
    link_to t('buttons.mark_as_active'),
            garden_path(garden, garden: { active: 1 }),
            method: :put, class: 'btn'
  end

  def garden_mark_inactive_button(garden)
    link_to t('buttons.mark_as_inactive'),
            garden_path(garden, garden: { active: 0 }),
            method: :put, class: 'btn',
            data: { confirm: 'All plantings associated with this garden will be marked as finished. Are you sure?' }
  end

  def crop_plant_button(crop)
    return unless can? :create, Planting

    link_to new_planting_path(params: { crop_id: crop.id }), class: 'btn btn-sm' do
      planting_icon + ' ' + t('buttons.plant')
    end
  end

  def crop_save_seeds_button(crop)
    return unless can?(:create, Seed)

    link_to new_seed_path(params: { crop_id: crop.id }), class: "btn btn-sm" do
      seed_icon + ' ' + t('buttons.save_seeds')
    end
  end

  def crop_edit_button(crop)
    edit_button(edit_crop_path(crop))
  end

  def seed_edit_button(seed, classes: "btn btn-raised btn-info")
    edit_button(edit_seed_path(seed), classes: classes)
  end

  def harvest_edit_button(harvest)
    edit_button(edit_harvest_path(harvest))
  end

  def garden_edit_button(garden)
    edit_button(edit_garden_path(garden))
  end

  def planting_edit_button(planting, classes: "btn btn-raised btn-info")
    edit_button(edit_planting_path(planting), classes: classes)
  end

  def planting_finish_button(planting, classes: 'btn btn-default btn-secondary')
    return unless can?(:edit, planting) || planting.finished

    link_to planting_path(planting, planting: { finished: 1 }),
            method: :put, class: "#{classes} append-date" do
      finished_icon + ' ' + t('buttons.mark_as_finished')
    end
  end

  def seed_finish_button(seed, classes: 'btn btn-default')
    return unless can?(:create, Planting) && seed.active?

    link_to seed_path(seed, seed: { finished: 1 }), method: :put, class: "#{classes} append-date" do
      finished_icon + ' ' + t('buttons.mark_as_finished')
    end
  end

  def planting_harvest_button(planting, classes: 'btn btn-default')
    return unless planting.active? && can?(:create, Harvest) && can?(:edit, planting)

    link_to new_planting_harvest_path(planting), class: classes do
      harvest_icon + ' ' + t('buttons.record_harvest')
{'fraction_non_alphanumeric': 0.10981638418079095, 'fraction_numerical': 0.0014124293785310734, 'mean_word_length': 3.792724196277496, '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': '7562227', 'n_tokens_mistral': 1919, 'n_tokens_neox': 1865, 'n_words': 436}