Diff
Copied: trunk/app/models/deprecation_event.rb (from rev 3180, trunk/app/models/wsdl_deprecation.rb) (0 => 3182)
--- trunk/app/models/deprecation_event.rb (rev 0)
+++ trunk/app/models/deprecation_event.rb 2012-11-12 14:33:59 UTC (rev 3182)
@@ -0,0 +1,10 @@
+class DeprecationEvent < ActiveRecord::Base
+
+ has_many :wsdl_deprecations
+ validates_presence_of :date
+
+ def affected_workflows
+ WorkflowProcessor.find_all_by_wsdl(wsdl_deprecations.map {|wd| wd.wsdl}, :include => :workflow).map {|wp| wp.workflow}.uniq.compact
+ end
+
+end
Modified: trunk/app/models/workflow.rb (3181 => 3182)
--- trunk/app/models/workflow.rb 2012-11-12 10:21:11 UTC (rev 3181)
+++ trunk/app/models/workflow.rb 2012-11-12 14:33:59 UTC (rev 3182)
@@ -366,8 +366,9 @@
APIStatistics.statistics(self)
end
- def wsdl_deprecations
- WsdlDeprecation.find_all_by_wsdl(workflow_processors.map {|wp| wp.wsdl})
+ # Returns a hash map of lists of wsdls grouped by their related deprecation event
+ def deprecations
+ WsdlDeprecation.find_all_by_wsdl(workflow_processors.map {|wp| wp.wsdl}).group_by {|wd| wd.deprecation_event}
end
end
Modified: trunk/app/models/wsdl_deprecation.rb (3181 => 3182)
--- trunk/app/models/wsdl_deprecation.rb 2012-11-12 10:21:11 UTC (rev 3181)
+++ trunk/app/models/wsdl_deprecation.rb 2012-11-12 14:33:59 UTC (rev 3182)
@@ -1,6 +1,7 @@
class WsdlDeprecation < ActiveRecord::Base
- validates_uniqueness_of :wsdl
+ validates_uniqueness_of :wsdl, :scope => :deprecation_event_id
+ belongs_to :deprecation_event
def affected_workflows
WorkflowProcessor.find_all_by_wsdl(wsdl, :include => :workflow).map {|wp| wp.workflow}.uniq.compact
Copied: trunk/app/views/workflows/_deprecation_event.html.erb (from rev 3181, trunk/app/views/workflows/_wsdl_deprecation.html.erb) (0 => 3182)
--- trunk/app/views/workflows/_deprecation_event.html.erb (rev 0)
+++ trunk/app/views/workflows/_deprecation_event.html.erb 2012-11-12 14:33:59 UTC (rev 3182)
@@ -0,0 +1,32 @@
+<% wsdl_deprecations = deprecation_event[1] %>
+<% deprecation_event = deprecation_event[0] %>
+
+<% time_string = deprecation_event.date.strftime("#{deprecation_event.date.day.ordinalize} %B %Y") -%>
+<div class="deprecation_event">
+ <p>
+ <img src="" style="vertical-align: middle; float: left; margin: 0.5em"/>
+ This workflow uses one or more services that
+ <% if deprecation_event.date.past? %>
+ are deprecated as of <strong><%= time_string -%></strong>
+ (<%= time_ago_in_words(deprecation_event.date) -%> ago), and may no longer function.
+ <% else %>
+ will be deprecated on <strong><%= time_string -%></strong>
+ (in <%= time_ago_in_words(deprecation_event.date) -%>), and may no longer function after this date.
+ <% end %>
+ <a href="" {el.toggle();})">Show details...</a>
+ </p>
+ <div class="hidden" style="display: none">
+ <p><strong>Affected service WSDL<%= "s" if wsdl_deprecations.size > 1-%>:</strong></p>
+ <ul>
+ <% wsdl_deprecations.each do |wd| %>
+ <li><%= wd.wsdl -%></li>
+ <% end %>
+ </ul>
+
+ <% unless deprecation_event.details.nil? %>
+ <p class="hidden" style="display: none">
+ <strong>Details:</strong> <%= deprecation_event.details %>
+ </p>
+ <% end %>
+ </div>
+</div>
Deleted: trunk/app/views/workflows/_wsdl_deprecation.html.erb (3181 => 3182)
--- trunk/app/views/workflows/_wsdl_deprecation.html.erb 2012-11-12 10:21:11 UTC (rev 3181)
+++ trunk/app/views/workflows/_wsdl_deprecation.html.erb 2012-11-12 14:33:59 UTC (rev 3182)
@@ -1,23 +0,0 @@
-<% time_string = wsdl_deprecation.deprecated_at.strftime("#{wsdl_deprecation.deprecated_at.day.ordinalize} %B %Y") -%>
-<div class="wsdl_deprecation">
- <p>
- <img src="" style="vertical-align: middle; float: left; margin: 0.5em"/>
- This workflow uses a service that
- <% if wsdl_deprecation.deprecated_at.past? %>
- is deprecated as of <strong><%= time_string -%></strong>
- (<%= time_ago_in_words(wsdl_deprecation.deprecated_at) -%> ago), and may no longer function.
- <% else %>
- will be deprecated on <strong><%= time_string -%></strong>
- (in <%= time_ago_in_words(wsdl_deprecation.deprecated_at) -%>), and may no longer function after this date.
- <% end %>
- <a href="" {el.toggle();})">Show details...</a>
- </p>
- <p class="hidden" style="display :none">
- <strong>Affected service WSDL:</strong> <%= wsdl_deprecation.wsdl %>
- </p>
- <% unless wsdl_deprecation.details.nil? %>
- <p class="hidden" style="display :none">
- <strong>Details:</strong> <%= wsdl_deprecation.details %>
- </p>
- <% end %>
-</div>
\ No newline at end of file
Modified: trunk/app/views/workflows/show.rhtml (3181 => 3182)
--- trunk/app/views/workflows/show.rhtml 2012-11-12 10:21:11 UTC (rev 3181)
+++ trunk/app/views/workflows/show.rhtml 2012-11-12 14:33:59 UTC (rev 3182)
@@ -1,6 +1,6 @@
<% t "#{h @workflow.title} (#{h @workflow.contributor_name}) [#{h(@workflow.type_display_name)} Workflow]" -%>
-<%= render :partial => "workflows/wsdl_deprecation", :collection => @workflow.wsdl_deprecations -%>
+<%= render :partial => "workflows/deprecation_event", :collection => @workflow.deprecations -%>
<ul class="sectionIcons">
<% if @authorised_to_edit -%>
Modified: trunk/public/stylesheets/styles.css (3181 => 3182)
--- trunk/public/stylesheets/styles.css 2012-11-12 10:21:11 UTC (rev 3181)
+++ trunk/public/stylesheets/styles.css 2012-11-12 14:33:59 UTC (rev 3182)
@@ -2381,7 +2381,7 @@
-webkit-border-bottom-right-radius: 6px;
}
-div.wsdl_deprecation {
+div.deprecation_event {
border: 1px solid #e24a3e;
background-color: #ffcccc;
padding: 0.5em;