Skip to content

Commit

Permalink
#603 #604 Fixed issues with mailer_extended.rb and with badly-formed …
Browse files Browse the repository at this point in the history
…HTML
  • Loading branch information
bigokro committed Mar 5, 2010
1 parent 69a9629 commit cd28d95
Show file tree
Hide file tree
Showing 56 changed files with 673 additions and 509 deletions.
106 changes: 53 additions & 53 deletions README 100644 → 100755
@@ -1,53 +1,53 @@
OVERVIEW

The purpose of the Arch Decision plugin for Redmine is to allow teams to collaborate on project decisions (primarily technical ones),
to encourage explicit statements of assumptions and prioritizations, and to provide tracking after the decision has been made so that
teams can have a collective memory as to how decisions were made in the past.

VERSION: 0.0.9

RELEASE NOTES

* Bug #598 - Labels missing for Redmine 0.9.2
* Feature #596 - Add support for Redmine version 0.9: The plugin is now compatible with Redmine "trunk" (0.9.2). A separate branch has been created for the 0.8.4-compatible version.

CURRENT FEATURES

* List Arch Decisions (currently only manually, via the /arch_decisions URL)
* List Factors (currently only manually, via the /factors URL)
* CRUD Arch Decisions (with only basic info)
* CRUD Factors (with only basic info)
* Associate Factors with ADs, and remove associations
* Reorder factor priorities for each AD
* List and CRUD Arch Decision Strategies
* Arch Decisions, Factors and Strategies each have their own Discussion section
* Project members and watchers receive email notifications for significant Arch Decision events
* Simple security model (using Redmine security) for enabling the creation and modification of ADs and related entities
* Can link ADs to Issues

ROADMAP

* Allow tagging of ADs and Factors for easy and flexible categorization and search
* Enable full-fledged search across all model types
* Allow changes to ADs to show up in the Activity list

KNOWN ISSUES

Note: there is now an official issue tracker for this plug-in. Please refer to http://opensource.integritas.com.br/projects/redmine-ad/issues for the complete list.

################################
# Issue #1
# [timothy.high@gmail.com]
# There is a problem in development mode with classes reloading / not reloading
# It shows up as errors in the web page such as:
# Project(#51730400) expected, got Project(#50128210)
# For more information, see http://dev.rubyonrails.org/ticket/8246
################################

A number of solutions are recommended in the ticket above. Of all the ones recommended (there are several changes to environment.rb), the only one
that worked was to patch association_proxy.rb. For more info, see:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/d2adc451ff0236c2/b95a3bc9cb97f988?#b95a3bc9cb97f988

UPDATE: Unfortunately, this hasn't solved the problem. It seems that not only have the exact class representation changed, but whole
methods have gone missing from the newly loaded versions! The only workaround left for me has been to run my local server in production mode.

OVERVIEW
The purpose of the Arch Decision plugin for Redmine is to allow teams to collaborate on project decisions (primarily technical ones),
to encourage explicit statements of assumptions and prioritizations, and to provide tracking after the decision has been made so that
teams can have a collective memory as to how decisions were made in the past.
VERSION: 0.0.9
RELEASE NOTES
* Bug #598 - Labels missing for Redmine 0.9.2
* Feature #596 - Add support for Redmine version 0.9: The plugin is now compatible with Redmine "trunk" (0.9.2). A separate branch has been created for the 0.8.4-compatible version.
CURRENT FEATURES
* List Arch Decisions (currently only manually, via the /arch_decisions URL)
* List Factors (currently only manually, via the /factors URL)
* CRUD Arch Decisions (with only basic info)
* CRUD Factors (with only basic info)
* Associate Factors with ADs, and remove associations
* Reorder factor priorities for each AD
* List and CRUD Arch Decision Strategies
* Arch Decisions, Factors and Strategies each have their own Discussion section
* Project members and watchers receive email notifications for significant Arch Decision events
* Simple security model (using Redmine security) for enabling the creation and modification of ADs and related entities
* Can link ADs to Issues
ROADMAP
* Allow tagging of ADs and Factors for easy and flexible categorization and search
* Enable full-fledged search across all model types
* Allow changes to ADs to show up in the Activity list
KNOWN ISSUES
Note: there is now an official issue tracker for this plug-in. Please refer to http://opensource.integritas.com.br/projects/redmine-ad/issues for the complete list.
################################
# Issue #1
# [timothy.high@gmail.com]
# There is a problem in development mode with classes reloading / not reloading
# It shows up as errors in the web page such as:
# Project(#51730400) expected, got Project(#50128210)
# For more information, see http://dev.rubyonrails.org/ticket/8246
################################
A number of solutions are recommended in the ticket above. Of all the ones recommended (there are several changes to environment.rb), the only one
that worked was to patch association_proxy.rb. For more info, see:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/d2adc451ff0236c2/b95a3bc9cb97f988?#b95a3bc9cb97f988
UPDATE: Unfortunately, this hasn't solved the problem. It seems that not only have the exact class representation changed, but whole
methods have gone missing from the newly loaded versions! The only workaround left for me has been to run my local server in production mode.
4 changes: 2 additions & 2 deletions app/controllers/arch_decision_discussions_controller.rb 100644 → 100755
Expand Up @@ -23,7 +23,7 @@ def new
@discussion.created_by = User.current
if @discussion.save
attach_files(@discussion, params[:attachments])
Mailer.deliver_arch_decision_discussion_add(@discussion)
ArchMailer.deliver_arch_decision_discussion_add(@discussion)
flash[:notice] = l(:notice_successful_create)
else
flash[:error] = @discussion.errors.empty? ? l(:notice_create_discussion_failed) : @discussion.errors.full_messages.join("<br/>")
Expand All @@ -37,7 +37,7 @@ def edit
render_403 and return false unless @discussion.editable_by?(User.current)
if request.post? && @discussion.update_attributes(params[:discussion])
attach_files(@discussion, params[:attachments])
Mailer.deliver_arch_decision_discussion_edit(@discussion)
ArchMailer.deliver_arch_decision_discussion_edit(@discussion)
flash[:notice] = l(:notice_successful_update)
redirect_to_show
end
Expand Down
Empty file modified app/controllers/arch_decision_issues_controller.rb 100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions app/controllers/arch_decisions_controller.rb
Expand Up @@ -55,7 +55,7 @@ def new
@arch_decision.updated_by = User.current
update_watch_list
if @arch_decision.save
Mailer.deliver_arch_decision_add(@arch_decision)
ArchMailer.deliver_arch_decision_add(@arch_decision)
flash[:notice] = l(:notice_successful_create)
redirect_to( :action => 'show', :project_id => @project, :id => @arch_decision )
end
Expand All @@ -66,7 +66,7 @@ def edit
if request.post?
update_watch_list
if @arch_decision.update_attributes(params[:arch_decision])
Mailer.deliver_arch_decision_edit(@arch_decision)
ArchMailer.deliver_arch_decision_edit(@arch_decision)
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'show', :project_id => @project, :id => @arch_decision
else
Expand Down Expand Up @@ -136,7 +136,7 @@ def reorder_factors

def register_and_notify_update
set_updated_by
Mailer.deliver_arch_decision_edit(@arch_decision)
ArchMailer.deliver_arch_decision_edit(@arch_decision)
end

private
Expand Down
Empty file modified app/models/arch_decision_discussion.rb 100644 → 100755
Empty file.
Empty file modified app/models/arch_decision_issue.rb 100644 → 100755
Empty file.
89 changes: 89 additions & 0 deletions app/models/arch_mailer.rb
@@ -0,0 +1,89 @@
class ArchMailer < Mailer

def arch_decision_add(ad)
redmine_headers 'Project' => ad.project.identifier,
'Arch-Decision-Id' => ad.id,
'Arch-Decision-Creator' => ad.created_by.login
redmine_headers 'Arch-Decision-Assignee' => ad.assigned_to.login if ad.assigned_to
recipients ad.recipients
cc(ad.watcher_recipients - @recipients)
subject "[#{ad.project.name} - Arch Decision ##{ad.id}] (#{ad.status.name}) #{ad.summary}"
body :arch_decision => ad,
:arch_decision_url => url_for(:controller => 'arch_decisions', :action => 'show', :id => ad, :project_id => ad.project)
render_multipart('arch_decision_add', body)
end

def arch_decision_edit(ad)
redmine_headers 'Project' => ad.project.identifier,
'Arch-Decision-Id' => ad.id,
'Arch-Decision-Creator' => ad.created_by.login
redmine_headers 'Arch-Decision-Assignee' => ad.assigned_to.login if ad.assigned_to
@author = ad.updated_by
recipients ad.recipients
# Watchers in cc
cc(ad.watcher_recipients - @recipients)
s = "[#{ad.project.name} - Arch Decision ##{ad.id}] "
s << "(#{ad.status.name}) "
s << ad.summary
subject s
body :arch_decision => ad,
:arch_decision_url => url_for(:controller => 'arch_decisions', :action => 'show', :id => ad, :project_id => ad.project)
render_multipart('arch_decision_edit', body)
end

def arch_decision_discussion_add(add)
redmine_headers 'Project' => discussion_project_id(add),
'Arch-Decision-Discussion-Id' => add.id,
'Arch-Decision-Discussion-Creator' => add.created_by.login
recipients add.recipients
cc(add.watcher_recipients - @recipients)
subject "[#{discussion_project_name(add)} - #{add.parent_type} ##{add.parent.id}] - New discussion comment added"
body :discussion => add,
:discussion_url => discussion_url(add),
:parent_description => discussion_parent_description(add)
render_multipart('arch_decision_discussion_add', body)
end

def arch_decision_discussion_edit(add)
redmine_headers 'Project' => discussion_project_id(add),
'Arch-Decision-Discussion-Id' => add.id,
'Arch-Decision-Discussion-Creator' => add.created_by.login
@author = add.created_by
recipients add.recipients
# Watchers in cc
cc(add.watcher_recipients - @recipients)
subject "[#{discussion_project_name(add)} - #{add.parent_type} ##{add.parent.id}] - Discussion comment updated"
body :discussion => add,
:discussion_url => discussion_url(add),
:parent_description => discussion_parent_description(add)
render_multipart('arch_decision_discussion_edit', body)
end

private

def discussion_project_id(add)
add.project.nil? ? "Redmine" : add.project.identifier
end

def discussion_project_name(add)
add.project.nil? ? "Redmine" : add.project.name
end

def discussion_url(add)
case add.parent
when ArchDecision then url_for(:controller => 'arch_decisions', :action => 'show', :id => add.parent.id, :project_id => add.project)
when Factor then url_for(:controller => 'factors', :action => 'show', :id => add.parent.id)
when Strategy then url_for(:controller => 'strategies', :action => 'show', :id => add.parent.id)
else url_for(:controller => 'projects') # Parent nil!
end
end

def discussion_parent_description(add)
description = case add.parent
when ArchDecision then add.arch_decision.summary
when Factor then add.factor.summary
when Strategy then add.strategy.short_name
else ""
end
end
end
Empty file modified app/views/arch_decision_discussions/_form.html.erb 100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions app/views/arch_decision_discussions/_related_discussions.html.erb 100644 → 100755
Expand Up @@ -14,8 +14,8 @@
<div class="wiki"><%= textilizable d, :content, :attachments => d.attachments %></div>
<%= link_to_attachments d, :author => false %>
</div>
<% end #discussions loop %>
<% end #unless %>
<% end %>
<% end %>
<% if authorize_for(:arch_decision_discussions, :new) %>
<div id="new_discussion_form_row" style="display:none;">
Expand All @@ -30,7 +30,7 @@
:with => "Form.serialize('new_discussion')",
:complete => "Element.scrollTo('preview')"
}, :accesskey => accesskey(:preview) %></p>
<% end #form %>
<% end %>
</div>
<div id="new_discussion_link">
<br/>
Expand All @@ -39,8 +39,8 @@
<div id="preview" class="wiki"></div>

<%= javascript_tag "initializeForm('new_discussion');" %>
<% end #if authorize_for %>
<% end %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end #content_for %>
<% end %>
</div>
Empty file modified app/views/arch_decision_discussions/edit.html.erb 100644 → 100755
Empty file.
116 changes: 58 additions & 58 deletions app/views/arch_decision_issues/_related_arch_decisions.html.erb 100644 → 100755
@@ -1,58 +1,58 @@
<div id="related_arch_decisions">
<hr />

<div class="contextual">
<% if authorize_for('arch_decision_issues', 'add_issue') %>
<%= toggle_link l(:button_add), 'add-arch-decision-form'%>
<% end %>
</div>

<p><strong><%=l(:label_arch_decisions_related)%></strong></p>

<%= error_messages_for 'arch_decision_issue' %>
<% if @issue.arch_decision_issues.any? %>
<table style="width:100%">
<% @issue.arch_decision_issues.each do |adissue| %>
<% ad = adissue.arch_decision %>
<tr>
<td>
<%= adissue.issue_type_phrase %>
<%= link_to(l(:label_arch_decision) + " ##{ad.id}", :controller => 'arch_decisions', :action => 'show', :id => ad) %>
</td>
<td><%= h(ad.summary) %> </td>
<td align="center" style="width:10%; white-space:nowrap;"><%= ad.status.name %></td>
<td>
<!-- Should be link_to_if_authorized, but for some reason it's not authorizing -->
<small><%= link_to_remote_if_authorized "",
{ :url => {:controller => 'arch_decision_issues',
:action => 'remove_issue',
:project_id => @project,
:arch_decision_id => ad,
:issue_id => @issue,
:return_to => "issue"
},
:confirm => l(:text_issue_arch_decision_remove_confirmation, :id => ad.id)},
:class => 'icon icon-del' %></small>
</td>
</tr>
<% end %>
</table>
<% end %>
<% if authorize_for(:arch_decision_issues, :add_issue) %>
<% remote_form_for(:arch_decision_issue, @arch_decision_issue,
:url => { :controller => "arch_decision_issues", :action => "add_issue", :project_id => @project, :return_to => "issue"},
:html => { :id => "add-arch-decision-form", :style => (@arch_decision_issue ? '' : 'display: none;') }) do |adi| %>
<%= adi.hidden_field :issue_id, :value => @issue.id %>
<%= adi.select :issue_type, (ArchDecisionIssue.issue_types.collect {|t| [ArchDecisionIssue.issue_type_phrase(t), t]}) %>
<%= l(:label_arch_decision) %> #
<%= adi.text_field :arch_decision_id, :size => 10 %>
<small>
<%= submit_tag l(:button_add) %>
<%= submit_tag l(:button_cancel), :onclick => "cancelForm('add_ad'); return false;" %>
</small>
</td>
<% end %>
<% end %>
</div>
<div id="related_arch_decisions">
<hr />

<div class="contextual">
<% if authorize_for('arch_decision_issues', 'add_issue') %>
<%= toggle_link l(:button_add), 'add-arch-decision-form'%>
<% end %>
</div>

<p><strong><%=l(:label_arch_decisions_related)%></strong></p>

<%= error_messages_for 'arch_decision_issue' %>
<% if @issue.arch_decision_issues.any? %>
<table style="width:100%">
<% @issue.arch_decision_issues.each do |adissue| %>
<% ad = adissue.arch_decision %>
<tr>
<td>
<%= adissue.issue_type_phrase %>
<%= link_to(l(:label_arch_decision) + " ##{ad.id}", :controller => 'arch_decisions', :action => 'show', :id => ad) %>
</td>
<td><%= h(ad.summary) %> </td>
<td align="center" style="width:10%; white-space:nowrap;"><%= ad.status.name %></td>
<td>
<!-- Should be link_to_if_authorized, but for some reason it's not authorizing -->
<small><%= link_to_remote_if_authorized "",
{ :url => {:controller => 'arch_decision_issues',
:action => 'remove_issue',
:project_id => @project,
:arch_decision_id => ad,
:issue_id => @issue,
:return_to => "issue"
},
:confirm => l(:text_issue_arch_decision_remove_confirmation, :id => ad.id)},
:class => 'icon icon-del' %></small>
</td>
</tr>
<% end %>
</table>
<% end %>
<% if authorize_for(:arch_decision_issues, :add_issue) %>
<% remote_form_for(:arch_decision_issue, @arch_decision_issue,
:url => { :controller => "arch_decision_issues", :action => "add_issue", :project_id => @project, :return_to => "issue"},
:html => { :id => "add-arch-decision-form", :style => (@arch_decision_issue ? '' : 'display: none;') }) do |adi| %>
<%= adi.hidden_field :issue_id, :value => @issue.id %>
<%= adi.select :issue_type, (ArchDecisionIssue.issue_types.collect {|t| [ArchDecisionIssue.issue_type_phrase(t), t]}) %>
<%= l(:label_arch_decision) %> #
<%= adi.text_field :arch_decision_id, :size => 10 %>
<small>
<%= submit_tag l(:button_add) %>
<%= submit_tag l(:button_cancel), :onclick => "cancelForm('add_ad'); return false;" %>
</small>
</td>
<% end %>
<% end %>
</div>
Empty file modified app/views/arch_decision_issues/_related_issues.html.erb 100644 → 100755
Empty file.

0 comments on commit cd28d95

Please sign in to comment.