From 1d85f3916a613c657a31e79735b5e8e2c1a92691 Mon Sep 17 00:00:00 2001 From: Reid Beels Date: Mon, 18 Jul 2011 14:00:19 -0700 Subject: [PATCH] DEPENDENCY: Switch template format from haml to erb for increased compatibility with non-erb apps. --- CHANGES.md | 3 ++ Gemfile | 1 - Gemfile.lock | 2 -- .../changes/_version.html.erb | 36 +++++++++++++++++++ .../changes/_version.html.haml | 32 ----------------- .../changes/index.html.erb | 35 ++++++++++++++++++ .../changes/index.html.haml | 26 -------------- .../paper_trail_manager/changes/show.html.erb | 10 ++++++ .../changes/show.html.haml | 8 ----- paper_trail_manager.gemspec | 14 ++++---- 10 files changed, 90 insertions(+), 77 deletions(-) create mode 100644 app/views/paper_trail_manager/changes/_version.html.erb delete mode 100644 app/views/paper_trail_manager/changes/_version.html.haml create mode 100644 app/views/paper_trail_manager/changes/index.html.erb delete mode 100644 app/views/paper_trail_manager/changes/index.html.haml create mode 100644 app/views/paper_trail_manager/changes/show.html.erb delete mode 100644 app/views/paper_trail_manager/changes/show.html.haml diff --git a/CHANGES.md b/CHANGES.md index fa6c2f6..580fed4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. diff --git a/Gemfile b/Gemfile index fe033b3..da3d22e 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index dc4437e..aaab951 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) diff --git a/app/views/paper_trail_manager/changes/_version.html.erb b/app/views/paper_trail_manager/changes/_version.html.erb new file mode 100644 index 0000000..586ab9b --- /dev/null +++ b/app/views/paper_trail_manager/changes/_version.html.erb @@ -0,0 +1,36 @@ + + + Change #<%= version.id %> +
<%= version.created_at.strftime('%Y-%m-%d') %>
+
<%= version.created_at.strftime('%H:%M:%S') %>
+ + +

+ <%= version.event %> + <%= version.item_type %> + <%= version.item_id %> + <%= 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 %> +

+ <% if version.event == 'update' or version.event == 'create' %> + <% changes = changes_for(version) %> + + <% changes.keys.sort.each_with_index do |key, i| %> + '> + + + + + + <% end %> +
<%= key %><%= text_or_nil(changes[key][:previous]) %><%= text_or_nil(changes[key][:current]) %>
+ <% end %> + + diff --git a/app/views/paper_trail_manager/changes/_version.html.haml b/app/views/paper_trail_manager/changes/_version.html.haml deleted file mode 100644 index 7b2202d..0000000 --- a/app/views/paper_trail_manager/changes/_version.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -%tr.change_row{:class => [version.event, version.item_type.downcase]} - %td.change_time - %span.change_id== Change ##{version.id} - .date - = version.created_at.strftime('%Y-%m-%d') - .time - = version.created_at.strftime('%H:%M:%S') - %td.change_details - %p.change_details_description - %strong.event= version.event - %span.item_type= version.item_type - %span.item_id== ##{version.item_id} - = change_item_link(version) - - if PaperTrailManager.whodunnit_class - - if 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)) - - if change_revert_allowed?(version) - = link_to 'Roll back', change_path(version), :method => 'put', :confirm => 'Are you sure?', :class => 'rollback' - - - - if version.event == 'update' or version.event == 'create' - - changes = changes_for(version) - %table.change_details_table - - changes.keys.sort.each do |key| - %tr{:class => cycle('odd', 'even')} - %td.change_detail_key.previous= key - %td.change_detail_value.previous= text_or_nil(changes[key][:previous]) - %td.change_detail_spacer → - %td.change_detail_value.current= text_or_nil(changes[key][:current]) - - reset_cycle('change_detail') diff --git a/app/views/paper_trail_manager/changes/index.html.erb b/app/views/paper_trail_manager/changes/index.html.erb new file mode 100644 index 0000000..8de279e --- /dev/null +++ b/app/views/paper_trail_manager/changes/index.html.erb @@ -0,0 +1,35 @@ +

Changes

+ +

<%= link_to 'Changes feed', changes_path(:format => 'atom') %>

+ +

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

+ + + + + + + + + + + + + + + <% if @versions.any? %> + <% @versions.each do |version| %> + <% next unless change_show_allowed?(version) %> + <%= render :partial => 'version', :object => version %> + <% end %> + <% else %> + + <% end %> + +
+ <%= will_paginate @versions %> +
TimeAttribute with previous and current values
— No changes found —
+ diff --git a/app/views/paper_trail_manager/changes/index.html.haml b/app/views/paper_trail_manager/changes/index.html.haml deleted file mode 100644 index 785ebd6..0000000 --- a/app/views/paper_trail_manager/changes/index.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%h1 Changes - -%p.changes_feed - = link_to 'Changes feed', changes_path(:format => 'atom') - -%p - Show: - != ([link_to('All', changes_path)] + change_item_types.map { |type| link_to(type.pluralize, changes_path(:type => type)) }).join(' | ') - -%table.changes_table - %tfoot - %tr - %td{:colspan => 2} - = will_paginate @versions - %thead - %tr.changes_header - %th.change_time Time - %th.change_details Attribute with previous and current values - %tbody - - if @versions.any? - - @versions.each do |version| - - next unless change_show_allowed?(version) - = render :partial => 'version', :object => version - - else - %td{:rowspan => 2} - — No changes found — diff --git a/app/views/paper_trail_manager/changes/show.html.erb b/app/views/paper_trail_manager/changes/show.html.erb new file mode 100644 index 0000000..2d5fa9c --- /dev/null +++ b/app/views/paper_trail_manager/changes/show.html.erb @@ -0,0 +1,10 @@ +

Change <%= @version.id %>

+ + + + + + <%= render :partial => 'version', :object => @version %> + +
TimeAttribute with previous and current values
+ diff --git a/app/views/paper_trail_manager/changes/show.html.haml b/app/views/paper_trail_manager/changes/show.html.haml deleted file mode 100644 index 35bb94e..0000000 --- a/app/views/paper_trail_manager/changes/show.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -%h1 - == Change ##{@version.id} - -%table.changes_table - %tr.changes_header - %th.change_time Time - %th.change_details Attribute with previous and current values - = render :partial => 'version', :object => @version diff --git a/paper_trail_manager.gemspec b/paper_trail_manager.gemspec index 34ffb3b..184e052 100644 --- a/paper_trail_manager.gemspec +++ b/paper_trail_manager.gemspec @@ -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{igal@pragmaticraft.com} s.extra_rdoc_files = [ @@ -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", @@ -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", @@ -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, ["~> 3.0"]) - s.add_runtime_dependency(%q, ["~> 3.0"]) s.add_runtime_dependency(%q, ["~> 2.0"]) s.add_runtime_dependency(%q, ["~> 3.0.pre2"]) s.add_development_dependency(%q, [">= 0.4.0"]) @@ -179,7 +179,6 @@ Gem::Specification.new do |s| s.add_development_dependency(%q, [">= 0"]) else s.add_dependency(%q, ["~> 3.0"]) - s.add_dependency(%q, ["~> 3.0"]) s.add_dependency(%q, ["~> 2.0"]) s.add_dependency(%q, ["~> 3.0.pre2"]) s.add_dependency(%q, [">= 0.4.0"]) @@ -193,7 +192,6 @@ Gem::Specification.new do |s| end else s.add_dependency(%q, ["~> 3.0"]) - s.add_dependency(%q, ["~> 3.0"]) s.add_dependency(%q, ["~> 2.0"]) s.add_dependency(%q, ["~> 3.0.pre2"]) s.add_dependency(%q, [">= 0.4.0"])