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 5f97300
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 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
24 changes: 13 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GEM
activerecord (>= 3.2, < 7.0)
rake (>= 10.4, < 14.0)
arel (9.0.0)
autoprefixer-rails (9.8.4)
autoprefixer-rails (9.8.5)
execjs
babel-source (5.8.35)
babel-transpiler (0.7.0)
Expand Down Expand Up @@ -112,10 +112,11 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.4.4)
dotenv (2.7.5)
dotenv-rails (2.7.5)
dotenv (= 2.7.5)
railties (>= 3.2, < 6.1)
diffy (3.3.0)
dotenv (2.7.6)
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
draper (3.0.1)
actionpack (~> 5.0)
activemodel (~> 5.0)
Expand All @@ -129,10 +130,10 @@ GEM
erubis (2.7.0)
eventmachine (1.2.7)
execjs (2.7.0)
factory_bot (6.0.2)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.0.0)
factory_bot (~> 6.0.0)
factory_bot_rails (6.1.0)
factory_bot (~> 6.1.0)
railties (>= 5.0.0)
faker (2.13.0)
i18n (>= 1.6, < 2)
Expand Down Expand Up @@ -218,12 +219,12 @@ GEM
mini_portile2 (2.4.0)
minitest (5.14.1)
msgpack (1.3.3)
multi_json (1.14.1)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
nenv (0.3.0)
nio4r (2.5.2)
nokogiri (1.10.9)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
notiffany (0.1.3)
nenv (~> 0.1)
Expand Down Expand Up @@ -416,7 +417,7 @@ GEM
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.2)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
Expand All @@ -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 5f97300

Please sign in to comment.