GithubHelp home page GithubHelp logo

zealous-tech / note_change_notifier Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 16 KB

Note Change Notifier is a Redmine plugin that notifies note change of contact/deal in redmine_contacts' plugin by e-mail.

License: GNU General Public License v2.0

Ruby 72.73% HTML 27.27%

note_change_notifier's Introduction

Note Change Notifier

Note Change Notifier is a Redmine plugin that notifies note change of contact/deal in redmine_contacts' plugin by e-mail. Note Change Notifier is based on (modified) Journal Change Notifier. Plugin tested on redmine version 3.4.2 and 4.2.2

License

GPL 2 or later. See LICENSE for details.

Installation of note_change_notifier plugin

  1. Install plugin as usual:
$ sudo cp -r note_change_notifier [Redmine_Root]/plugins
$ cd [Redmine_Root]
$ sudo bundle install
$ sudo bundle exec rake redmine:plugins:migrate RAILS_ENV=production
$ sudo /etc/init.d/apache2 restart
  1. Edit [Redmine_Root]/plugins/redmine_contacts/app/controllers/notes_controller.rb (add call_hook to update and destroy methods), as follows:
...
...
...
  def update
    @note.safe_attributes = params[:note]
    if @note.save
      @note.note_time = params[:note][:note_time] if params[:note] && params[:note][:note_time]
      attachments = Attachment.attach_files(@note, (params[:attachments] || (params[:note] && params[:note][:uploads])))  
      render_attachment_warning_if_needed(@note)
      flash[:notice] = l(:notice_successful_update)
      respond_to do |format|
        format.html { redirect_back_or_default({ :action => 'show', :project_id => @note.source.project, :id => @note }) }
        format.api  { render_api_ok }
      end 
+     call_hook(:plugin_redmine_contacts_controller_notes_edit_post, { :note => @note, :params => params}) if Redmine::Plugin.installed?(:note_change_notifier)
    else
      respond_to do |format|
        format.html { render :action => 'edit', :project_id => params[:project_id], :id => @note }
        format.api  { render_validation_errors(@note) }
      end
    end
  end
...
...
...
  def destroy
    (render_403; return false) unless @note.destroyable_by?(User.current, @project)
    @note.destroy
    respond_to do |format|
      format.js
      format.html { redirect_to :action => 'show', :project_id => @project, :id => @note.source }
      format.api  { render_api_ok }
    end
+   call_hook(:plugin_redmine_contacts_controller_notes_edit_post, { :note => @note, :params => params}) if Redmine::Plugin.installed?(:note_change_notifier)
    # redirect_to :action => 'show', :project_id => @project, :id => @contact
  end
...
...
...

note_change_notifier's People

Contributors

suren-grigoryan-im avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.