Skip to content

Instantly share code, notes, and snippets.

View edavis10's full-sized avatar

Eric Davis edavis10

View GitHub Profile
class JournalObserver < ActiveRecord::Observer
def after_create(journal)
if Setting.notified_events.include?('issue_updated') ||
(Setting.notified_events.include?('issue_note_added') && journal.notes.present?) ||
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
Mailer.deliver_issue_edit(journal)
end
end
end
$ ls -1 vendor/plugins/
action_mailer_optional_tls
acts_as_activity_provider
acts_as_attachable
acts_as_customizable
acts_as_event
acts_as_list
acts_as_searchable
acts_as_tree
acts_as_versioned
# Edit the config file list so
[core]
repositoryformatversion = 0
filemode = true
bare = true
[remote "origin"]
mirror = true
url = git://github.com/edavis10/redmine.git
fetch = +refs/*:refs/*
@edavis10
edavis10 / plugin_to_gem.rb
Created October 15, 2009 16:07
Script to convert a Rails/Redmine plugin to a RubyGem
#!/usr/bin/env ruby
# Usage:
# ruby plugin_to_gem.rb my_plugin_directory
require 'fileutils'
@plugin_dir = ARGV[0]
@plugin_name = ARGV[0]
def rakefile_content
description = 'TODO'
# Redmine menu that calls a JavaScript function
Redmine::MenuManager.map :project_menu do |menu|
menu.push :javascript, { :controller => 'projects', :action => 'show' }, {:html => {:onclick => 'alert("hi"); return false;', :id => 'f'}}
end
module PatchingProjectForEirikb
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
after_save :do_something
end
@edavis10
edavis10 / gist:193635
Created September 25, 2009 15:45
Block access to .svn files
We couldn’t find that file to show.
class DefaultAssignProjectHook < Redmine::Hook::ViewListener
# context:
# * :form - the form builder
# * :project - the current project
def view_projects_form(context={})
return content_tag(:p,
context[:form].select(:default_assignee_id, context[:project].assignable_users.collect {|user| [user.name, user.id]}, {:include_blank => :none}))
<VirtualHost *:80>
ServerName projects.littlestreamsoftware.com
RewriteEngine On
# Redirect any non HTTPS requests to the HTTPS server
RewriteCond %{HTTP_HOST} ^projects.littlestreamsoftware.com$ [NC]
RewriteRule ^(.*)$ https://projects.littlestreamsoftware.com$1 [R=301,L]
Include /etc/apache2/common/hide-svn
$ rake db:show_me_a_migration
(in /home/edavis/dev/redmine/redmine-core)
Found 62 Models
class AddMissingIndexes < ActiveRecord::Migration
def self.up
add_index :custom_fields_projects, :
add_index :custom_fields_projects, :custom_field_id
add_index :workflows, :new_status_id
add_index :deliverables, :type
add_index :deliverables, :project_id