<commit_before>_ = require "underscore"
$ = require "jquery"
$1 = require "bootstrap/modal"
ActionTool = require "./action_tool"
preview_save_tool_template = require "./preview_save_tool_template"

class PreviewSaveToolView extends ActionTool.View
  className: "bk-bs-modal"
  template: preview_save_tool_template

  initialize: (options) ->
    super(options)
    @render()

  render: () ->
    @$el.empty()
    @$el.html(@template())
    @$el.attr("tabindex", "-1")
    @$el.on('hidden', () => @$el.modal('hide'))
    @$el.modal({show: false})

  do: () ->
    canvas = @plot_view.canvas_view.canvas[0]
    @$('.bk-bs-modal-body img').attr("src", canvas.toDataURL());
    @$el.modal('show')

class PreviewSaveTool extends ActionTool.Model
  default_view: PreviewSaveToolView
  type: "PreviewSaveTool"
  tool_name: "Preview/Save"
  icon: "bk-tool-icon-preview-save"

module.exports =
  Model: PreviewSaveTool
  View: PreviewSaveToolView
<commit_msg>Use appropriate icon name in PreviewSaveTool<commit_after>_ = require "underscore"
$ = require "jquery"
$1 = require "bootstrap/modal"
ActionTool = require "./action_tool"
preview_save_tool_template = require "./preview_save_tool_template"

class PreviewSaveToolView extends ActionTool.View
  className: "bk-bs-modal"
  template: preview_save_tool_template

  initialize: (options) ->
    super(options)
    @render()

  render: () ->
    @$el.empty()
    @$el.html(@template())
    @$el.attr("tabindex", "-1")
    @$el.on('hidden', () => @$el.modal('hide'))
    @$el.modal({show: false})

  do: () ->
    canvas = @plot_view.canvas_view.canvas[0]
    @$('.bk-bs-modal-body img').attr("src", canvas.toDataURL());
    @$el.modal('show')

class PreviewSaveTool extends ActionTool.Model
  default_view: PreviewSaveToolView
  type: "PreviewSaveTool"
  tool_name: "Preview/Save"
  icon: "bk-tool-icon-save"

module.exports =
  Model: PreviewSaveTool
  View: PreviewSaveToolView

{'fraction_non_alphanumeric': 0.16172646905876234, 'fraction_numerical': 0.0031201248049922, 'mean_word_length': 4.389355742296919, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2888274', 'n_tokens_mistral': 669, 'n_tokens_neox': 654, 'n_words': 123}