Skip to content

Commit

Permalink
Show abstract, details, pitch diff in proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
Barrett Clark committed Jul 12, 2020
1 parent dd0ec51 commit 6830cb9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ gem 'react-rails'

gem 'sidekiq'

gem 'diffy'
gem 'paper_trail'

group :production do
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.4.4)
diffy (3.3.0)
dotenv (2.7.5)
dotenv-rails (2.7.5)
dotenv (= 2.7.5)
Expand Down Expand Up @@ -440,6 +441,7 @@ DEPENDENCIES
country_select (~> 1.3)
database_cleaner (~> 1.6)
devise (~> 4.7)
diffy
dotenv-rails
draper (~> 3.0.1)
factory_bot_rails
Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/modules/_proposal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,9 @@ div.col-md-4 {
padding-bottom: 0;
}
}

.diff-view {
margin-bottom: 10px;
padding-bottom: 10px;
border-bottom: 1px solid grey;
}
7 changes: 7 additions & 0 deletions app/helpers/proposal_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
module ProposalHelper
def diff(content1, content2)
changes = Diffy::Diff.new(content1, content2,
include_plus_and_minus_in_html: true,
include_diff_info: true)
changes.to_s.present? ? changes.to_s(:html).html_safe : 'No Changes'
end

def rating_tooltip
<<-HTML
<p><strong>Ratings Guide</strong></p>
Expand Down
11 changes: 11 additions & 0 deletions app/views/proposals/_contents.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@
%div
= value.capitalize
%div

- unless proposal.changeset_fields.blank?
%h2.fieldset-legend Proposal Diff...
- proposal.versions.each do |version|
#diff-view
- version.changeset.each do |k, (old, new)|
%h3.control-label= k.titleize
%div= diff old, new

:css
= #{Diffy::CSS}

0 comments on commit 6830cb9

Please sign in to comment.