Skip to content

Commit

Permalink
DEPENDENCY: Switch template format from haml to erb for increased com…
Browse files Browse the repository at this point in the history
…patibility with non-erb apps.
  • Loading branch information
reidab committed Jul 18, 2011
1 parent a0204bf commit 1d85f39
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 77 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changes to `paper_trail_manager`
================================

* 0.1.2
* Switched template format from haml to erb for increased compatibility with non-haml apps.

* 0.1.1
* Fix `rake spec` to work with `factory_girl` 2.0.x gem.

Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
source "http://rubygems.org"

gem "rails", "~> 3.0"
gem "haml", "~> 3.0"
gem "paper_trail", "~> 2.0"
gem "will_paginate", "~> 3.0.pre2"

Expand Down
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ GEM
ffi (1.0.7)
rake (>= 0.8.7)
git (1.2.5)
haml (3.1.2)
i18n (0.5.0)
jeweler (1.5.2)
bundler (~> 1.0.0)
Expand Down Expand Up @@ -135,7 +134,6 @@ PLATFORMS
DEPENDENCIES
capybara (>= 0.4.0)
factory_girl_rails (~> 1.1.beta1)
haml (~> 3.0)
jeweler (~> 1.5.2)
paper_trail (~> 2.0)
rails (~> 3.0)
Expand Down
36 changes: 36 additions & 0 deletions app/views/paper_trail_manager/changes/_version.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<tr class='change_row <%= "#{version.event}, #{version.item_type.downcase}" %>'>
<td class='change_time'>
<span class='change_id'>Change #<%= version.id %></span>
<div class='date'> <%= version.created_at.strftime('%Y-%m-%d') %> </div>
<div class='time'> <%= version.created_at.strftime('%H:%M:%S') %> </div>
</td>
<td class='change_details'>
<p class='change_details_description'>
<strong class='event'><%= version.event %></strong>
<span class='item_type'><%= version.item_type %></span>
<span class='item_id'><%= version.item_id %></span>
<%= change_item_link(version) %>
<% if PaperTrailManager.whodunnit_class && version.whodunnit %>
<% if user = PaperTrailManager.whodunnit_class.find(version.whodunnit) rescue nil %>
by <%= link_to(h(user.send(PaperTrailManager.whodunnit_name_method)), user_path(user)) %>
<% end %>
<% end %>
<% if change_revert_allowed?(version) %>
<%= link_to 'Roll back', change_path(version), :method => 'put', :confirm => 'Are you sure?', :class => 'rollback' %>
<% end %>
</p>
<% if version.event == 'update' or version.event == 'create' %>
<% changes = changes_for(version) %>
<table class='change_details_table'>
<% changes.keys.sort.each_with_index do |key, i| %>
<tr class='<%= i%2==0 ? 'even' : 'odd' %>'>
<td class='change_detail_key previous'><%= key %></td>
<td class='change_detail_value previous'><%= text_or_nil(changes[key][:previous]) %></td>
<td class='change_detail_spacer'> &rarr; </td>
<td class='change_detail_value current'><%= text_or_nil(changes[key][:current]) %></td>
</tr>
<% end %>
</table>
<% end %>
</td>
</tr>
32 changes: 0 additions & 32 deletions app/views/paper_trail_manager/changes/_version.html.haml

This file was deleted.

35 changes: 35 additions & 0 deletions app/views/paper_trail_manager/changes/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<h1>Changes</h1>

<p class='changes_feed'><%= link_to 'Changes feed', changes_path(:format => 'atom') %></p>

<p>
Show:
<%= ([link_to('All', changes_path)] + change_item_types.map { |type| link_to(type.pluralize, changes_path(:type => type)) }).join(' | ').html_safe %>
</p>

<table class='changes_table'>
<tfoot>
<tr>
<td colspan='2'>
<%= will_paginate @versions %>
</td>
</tr>
</tfoot>
<thead>
<tr class='changes_header'>
<th class='change_time'>Time</th>
<th class='change_details'>Attribute with previous and current values</th>
</tr>
</thead>
<tbody>
<% if @versions.any? %>
<% @versions.each do |version| %>
<% next unless change_show_allowed?(version) %>
<%= render :partial => 'version', :object => version %>
<% end %>
<% else %>
<td rowspan='2'> &mdash; No changes found &mdash; </td>
<% end %>
</tbody>
</table>

26 changes: 0 additions & 26 deletions app/views/paper_trail_manager/changes/index.html.haml

This file was deleted.

10 changes: 10 additions & 0 deletions app/views/paper_trail_manager/changes/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<h1>Change <%= @version.id %></h1>

<table class='changes_table'>
<tr class='changes_header'>
<th class='change_time'>Time</th>
<th class='change_details'>Attribute with previous and current values</th>
<%= render :partial => 'version', :object => @version %>
</tr>
</table>

8 changes: 0 additions & 8 deletions app/views/paper_trail_manager/changes/show.html.haml

This file was deleted.

14 changes: 6 additions & 8 deletions paper_trail_manager.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Igal Koshevoy"]
s.date = %q{2011-07-13}
s.date = %q{2011-07-18}
s.description = %q{A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications.}
s.email = %q{[email protected]}
s.extra_rdoc_files = [
Expand All @@ -25,10 +25,10 @@ Gem::Specification.new do |s|
"VERSION",
"app/controllers/paper_trail_manager/changes_controller.rb",
"app/helpers/paper_trail_manager/changes_helper.rb",
"app/views/paper_trail_manager/changes/_version.html.haml",
"app/views/paper_trail_manager/changes/_version.html.erb",
"app/views/paper_trail_manager/changes/index.atom.builder",
"app/views/paper_trail_manager/changes/index.html.haml",
"app/views/paper_trail_manager/changes/show.html.haml",
"app/views/paper_trail_manager/changes/index.html.erb",
"app/views/paper_trail_manager/changes/show.html.erb",
"lib/paper_trail_manager.rb",
"paper_trail_manager.gemspec",
"spec/controllers/paper_trail_manager/changes_controller_spec.rb",
Expand Down Expand Up @@ -108,7 +108,7 @@ Gem::Specification.new do |s|
]
s.homepage = %q{http://github.com/igal/paper_trail_manager}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.6.2}
s.rubygems_version = %q{1.3.7}
s.summary = %q{A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications.}
s.test_files = [
"spec/controllers/paper_trail_manager/changes_controller_spec.rb",
Expand Down Expand Up @@ -162,11 +162,11 @@ Gem::Specification.new do |s|
]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
s.add_runtime_dependency(%q<haml>, ["~> 3.0"])
s.add_runtime_dependency(%q<paper_trail>, ["~> 2.0"])
s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
s.add_development_dependency(%q<capybara>, [">= 0.4.0"])
Expand All @@ -179,7 +179,6 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
else
s.add_dependency(%q<rails>, ["~> 3.0"])
s.add_dependency(%q<haml>, ["~> 3.0"])
s.add_dependency(%q<paper_trail>, ["~> 2.0"])
s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
s.add_dependency(%q<capybara>, [">= 0.4.0"])
Expand All @@ -193,7 +192,6 @@ Gem::Specification.new do |s|
end
else
s.add_dependency(%q<rails>, ["~> 3.0"])
s.add_dependency(%q<haml>, ["~> 3.0"])
s.add_dependency(%q<paper_trail>, ["~> 2.0"])
s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
s.add_dependency(%q<capybara>, [">= 0.4.0"])
Expand Down

0 comments on commit 1d85f39

Please sign in to comment.