<commit_before>module RailsAdmin

  class JcropController < RailsAdmin::ApplicationController
    skip_before_filter :get_model
    before_filter :get_model, :get_object, :get_field, :get_fit_image

    helper_method :abstract_model, :geometry

    def edit
      @form_options = {}
      @form_options[:method] = :put
      @form_options[:'data-title'] = "#{I18n.t("admin.actions.crop.menu").capitalize} #{abstract_model.model.human_attribute_name @field}"
      
      @image_tag_options = {}
      @image_tag_options[:class] = "jcrop-subject"
      @image_tag_options[:'data-geometry'] = geometry(@object.send(@field).path).join(",")
      
      if @fit_image
        fit_image_geometry = fit_image_geometry(@object.send(@field).path)
        
        @form_options[:'style'] = "margin-left: #{fit_image_geometry[1]/2 - 15}px;"
        
        @image_tag_options[:style] = ""
        @image_tag_options[:style] << "width: #{fit_image_geometry[0]}px !important;"
        @image_tag_options[:style] << "height: #{fit_image_geometry[1]}px !important;"
        @image_tag_options[:style] << "border: 1px solid #AAA !important;"
      end
      
      respond_to do |format|
        format.html
        format.js   { render :edit, :layout => false }
      end
    end

    def update
      @object.rails_admin_crop! params
<commit_msg>fixing centralization glitch<commit_after>module RailsAdmin

  class JcropController < RailsAdmin::ApplicationController
    skip_before_filter :get_model
    before_filter :get_model, :get_object, :get_field, :get_fit_image

    helper_method :abstract_model, :geometry

    def edit
      @form_options = {}
      @form_options[:method] = :put
      @form_options[:'data-title'] = "#{I18n.t("admin.actions.crop.menu").capitalize} #{abstract_model.model.human_attribute_name @field}"
      
      @image_tag_options = {}
      @image_tag_options[:class] = "jcrop-subject"
      @image_tag_options[:'data-geometry'] = geometry(@object.send(@field).path).join(",")
      
      if @fit_image
        fit_image_geometry = fit_image_geometry(@object.send(@field).path)
        
        @form_options[:'style'] = "margin-left: #{375 - (fit_image_geometry[0]/2) - 15}px;"
        
        @image_tag_options[:style] = ""
        @image_tag_options[:style] << "width: #{fit_image_geometry[0]}px !important;"
        @image_tag_options[:style] << "height: #{fit_image_geometry[1]}px !important;"
        @image_tag_options[:style] << "border: 1px solid #AAA !important;"
      end
      
      respond_to do |format|
        format.html
        format.js   { render :edit, :layout => false }
      end
    end

    def update
      @object.rails_admin_crop! params

{'fraction_non_alphanumeric': 0.1370219086520609, 'fraction_numerical': 0.007797994801336799, 'mean_word_length': 3.303514376996805, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 5, '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': '3392899', 'n_tokens_mistral': 880, 'n_tokens_neox': 851, 'n_words': 139}