IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ruby Discussion :

Erreur avec le plugin redmine_checklists de Redmine


Sujet :

Ruby

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif Avatar de supergeoffrey
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2010
    Messages
    802
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2010
    Messages : 802
    Par défaut Erreur avec le plugin redmine_checklists de Redmine
    Bonjour,

    Comme Redmine est écrit en Ruby, je pose ma question ici !

    J'ai un module qui me pose problème.

    Le code du module est celui-ci
    Code Ruby : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    # This file is a part of Redmine Checklists (redmine_checklists) plugin,
    # issue checklists management plugin for Redmine
    #
    # Copyright (C) 2011-2015 Kirill Bezrukov
    # http://www.redminecrm.com/
    #
    # redmine_checklists is free software: you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # redmine_checklists is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with redmine_checklists.  If not, see <http://www.gnu.org/licenses/>.
     
    module RedmineChecklists
      module Patches
        module IssuesHelperPatch
          def self.included(base)
            base.send(:include, InstanceMethods)
     
            base.class_eval do
              unloadable
     
              alias_method_chain :details_to_strings, :checklists
              alias_method_chain :render_email_issue_attributes, :checklists if Redmine::VERSION.to_s <= '2.4' && Redmine::VERSION.to_s >= '2.2'
            end
          end
     
     
          module InstanceMethods
     
            def render_email_issue_attributes_with_checklists(issue, html = false)
              journal = issue.journals.order(:id).last
              return render_email_issue_attributes_without_checklists(issue, html) unless journal
              details = journal.details
              return render_email_issue_attributes_without_checklists(issue, html) unless details
              checklist_details = details.select{ |x| x.prop_key == 'checklist'}
              return render_email_issue_attributes_without_checklists(issue, html) unless checklist_details.any?
              return render_email_issue_attributes_without_checklists(issue, html) + details_to_strings_with_checklists(checklist_details, !html).join(html ? "<br/>".html_safe : "\n")
            end
     
            def details_to_strings_with_checklists(details, no_html = false, options = {})
              details_checklist, details_other = details.partition{ |x| x.prop_key == 'checklist' }
              details_checklist.map do |detail|
                result = []
                diff = Hash.new([])
     
                if Checklist.old_format?(detail)
                  result << "<b>#{l(:label_checklist_item)}</b> #{l(:label_checklist_changed_from)} #{detail.old_value} #{l(:label_checklist_changed_to)} #{detail.value}"
                else
                  diff = JournalChecklistHistory.new(detail.old_value, detail.value).diff
                end
                if diff[:removed].any?
                  diff[:removed].each do |item|
                    result << "<b>#{l(:label_checklist_item)}</b> #{l(:label_checklist_deleted)} (<strike><i>#{item[:subject]}</i></strike>)"
                  end
                end
     
                if diff[:renamed].any?
                  diff[:renamed].each do |was, became|
                    result << "<b>#{l(:label_checklist_item)}</b> #{l(:label_checklist_changed_from)} <i>#{was}</i> #{l(:label_checklist_changed_to)} <i>#{became}</i>"
                  end
                end
     
                if diff[:added].any?
                  diff[:added].each do |item|
                    result << "<b>#{l(:label_checklist_item)}</b> <input type='checkbox' #{item.is_done ? 'checked' : '' } disabled> <i>#{item[:subject]}</i> #{l(:label_checklist_added)}"
                  end
                end
     
                if diff[:done].any?
                  diff[:done].each do |item|
                    result << "<b>#{l(:label_checklist_item)}</b> <input type='checkbox' #{item.is_done ? 'checked' : '' } disabled> <i>#{item[:subject]}</i> #{l(:label_checklist_done)}"
                  end
                end
     
                if diff[:undone].any?
                  diff[:undone].each do |item|
                    result << "<b>#{l(:label_checklist_item)}</b> <input type='checkbox' #{item.is_done ? 'checked' : '' } disabled> <i>#{item[:subject]}</i> #{l(:label_checklist_undone)}"
                  end
                end
     
                result = result.join('</li><li>').html_safe
                result = nil if result.blank?
                if result && no_html
                  result = result.gsub /<\/li><li>/, "\n"
                  result = result.gsub /<input type='checkbox'[^c^>]*checked[^>]*>/, '[x]'
                  result = result.gsub /<input type='checkbox'[^c^>]*>/, '[ ]'
                  result = result.gsub /<[^>]*>/, ''
                end
                result
              end.compact + details_to_strings_without_checklists(details_other, no_html, options)
            end
          end
        end
      end
    end
     
    unless IssuesHelper.included_modules.include?(RedmineChecklists::Patches::IssuesHelperPatch)
      IssuesHelper.send(:include, RedmineChecklists::Patches::IssuesHelperPatch)
    end

    Mon erreur est la suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
      Rendered mailer/_issue.text.erb (37.1ms)
      Rendered mailer/issue_edit.text.erb within layouts/mailer (49.6ms)
    Completed 500 Internal Server Error in 645ms
     
    ActionView::Template::Error (undefined method `details_to_strings_with_checklists' for #<#<Class:0x00000006cc0370>:0x000000078560b8>):
        1: <%= "#{issue.tracker.name} ##{issue.id}: #{issue.subject}" %>
        2: <%= issue_url %>
        3:
        4: <%= render_email_issue_attributes(issue) %>
        5: ----------------------------------------
        6: <%= issue.description %>
      app/views/mailer/_issue.text.erb:4:in `_app_views_mailer__issue_text_erb___1129937340004584198_65910080'
      app/views/mailer/issue_edit.text.erb:12:in `_app_views_mailer_issue_edit_text_erb___931973504302501804_59725100'
      app/models/mailer.rb:417:in `block in mail'
      app/models/mailer.rb:416:in `mail'
      app/models/mailer.rb:76:in `issue_edit'
      app/models/mailer.rb:427:in `initialize'
      app/models/mailer.rb:440:in `method_missing'
      app/models/journal_observer.rb:26:in `after_create'
      app/models/journal.rb:53:in `save'
      lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
      lib/redmine/hook.rb:61:in `each'
      lib/redmine/hook.rb:61:in `block in call_hook'
      lib/redmine/hook.rb:58:in `tap'
      lib/redmine/hook.rb:58:in `call_hook'
      app/models/issue.rb:1077:in `block in save_issue_with_child_records'
      app/models/issue.rb:1062:in `save_issue_with_child_records'
      app/controllers/issues_controller.rb:179:in `update'
    Le problème est du à la ligne suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    return render_email_issue_attributes_without_checklists(issue, html) + details_to_strings_with_checklists(checklist_details, !html).join(html ? "<br/>".html_safe : "\n")
    Je ne comprend pas pourquoi le Module n'arrive pas à appeler la méthode " details_to_strings_with_checklists" du même module.

    J'ai essayé les syntaxes suivantes mais sans succès
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    #1
    return render_email_issue_attributes_without_checklists(issue, html) + InstanceMethods::details_to_strings_with_checklists(checklist_details, !html).join(html ? "<br/>".html_safe : "\n")
    #2
    return render_email_issue_attributes_without_checklists(issue, html) + InstanceMethods.details_to_strings_with_checklists(checklist_details, !html).join(html ? "<br/>".html_safe : "\n")
    #3
    return render_email_issue_attributes_without_checklists(issue, html) + self.details_to_strings_with_checklists(checklist_details, !html).join(html ? "<br/>".html_safe : "\n")
    Quelqu'un aurait une idée ?

    Merci d'avance

  2. #2
    Membre très actif Avatar de supergeoffrey
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2010
    Messages
    802
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2010
    Messages : 802
    Par défaut
    Je clos c'est plus d'actualité.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. erreur avec conf de maven-checkstyle-plugin
    Par thierryler dans le forum Maven
    Réponses: 3
    Dernier message: 03/10/2011, 19h32
  2. [Hudson] Erreur avec le plugin Selenium
    Par geoffreyb dans le forum Intégration Continue
    Réponses: 0
    Dernier message: 22/10/2009, 15h54
  3. erreur avec le plugin GMF
    Par acer56 dans le forum Eclipse
    Réponses: 0
    Dernier message: 13/03/2009, 14h39
  4. [UML] Problème avec le plugin omondo.uml
    Par seawolfm dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 30/10/2003, 17h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo