Project

General

Profile

Plugin broken: 'remote' is not defined ... (ActionView::Template::Error (undefined method `remote' for ... ))

Added by Chris Moser about 7 years ago

Does someone have a hint, how to fix the RedmineParentIssueFilter-plugin?
Some others have similar problems with other plugins because 'remote' is missing.

The error

ActionView::Template::Error (undefined method `remote' for {:name=>"Parent task", :type=>:integer, :order=>96}:Hash):
    1: <%= javascript_tag do %>
    2: var operatorLabels = <%= raw_json Query.operators_labels %>;
    3: var operatorByType = <%= raw_json Query.operators_by_filter_type %>;
    4: var availableFilters = <%= raw_json query.available_filters_as_json %>;
    5: var labelDayPlural = <%= raw_json l(:label_day_plural) %>;
    6:
    7: var filtersUrl = <%= raw_json queries_filter_path(:project_id => @query.project.try(:id), :type => @query.type) %>;

The plugin code

module RedmineParentIssueFilter
  module QueryPatch
    def self.included(base) # :nodoc:
      base.send(:include, InstanceMethods)

      # Same as typing in the class
      base.class_eval do
        unloadable # Send unloadable so it will not be unloaded in development

        alias_method_chain :available_filters, :parent_id
      end
    end

    module InstanceMethods

      # Wrapper around the +available_filters+ to add a new Deliverable filter
      def available_filters_with_parent_id
        @available_filters = available_filters_without_parent_id

        parent_id_filters = {
          "parent_id" => { 
            :name => l(:field_parent_issue),
            :type => :integer,
            :order => @available_filters.size + 1},
          "root_id" => { 
            :name => l(:field_root_issue),
            :type => :integer,
            :order => @available_filters.size + 2}
        }

        return @available_filters.merge!(parent_id_filters)
      end
    end
  end
end

# Add module to Query
Query.send(:include, RedmineParentIssueFilter::QueryPatch)