tawork 0.0.36 → 0.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWNjYjBmNjRiNGUxMWIyNWUwNzIzZTc2MTBiYWQyNDc0Mzc2MThjNg==
4
+ NjlkYTE3YTE3OTdlZjJiNGE5NGRjYWQxOTE0MjkxZjFmNTY0YWZkMQ==
5
5
  data.tar.gz: !binary |-
6
- Yjc4MGVjNmYwZGJiMjQ5ZGM3ZDc4MWFkZWQzZTliZWQwNzliZDQ2OA==
6
+ MGE2M2MyYzcwNTMwZDgwNGJhZDgxOTk3NWU2MmM2N2Q4NWY4ZTRlZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzUyMDdiNGJkNzY1NWUwNDA1NWIyYzllZTc5YzM4NTQ2NzAyZjdhNzVhZGY4
10
- MTZhNGVjODZlNjVlZTBmZmMxN2MzYTJlZTYxN2IxNmU4YTZjYWQ0MjYyMWNm
11
- ODE1Zjk3ZDA1MTg0YWJlMzY1YTIxMGYwMmI2MTVhYjcwZjA0NWQ=
9
+ YmJhZGM3N2Q2NWI5NGVlMTRmOTU4NTNiYjkxZTE3NmUyYjcxZTU1ODllMGI0
10
+ OGM2MzRkNzE3YzY3YzQwZmM3NGI4OTY4ODJkMGJhYWJkOTAwODFlNTFkMTM5
11
+ N2EwYWJhMjk5YTVkODkwYjQyOTFjYzhiZTkzNzE1NDVmNTM4ODk=
12
12
  data.tar.gz: !binary |-
13
- OWJjOTZkMjMzYzU1Y2E3MzU1Njg5ZjdjMTQ2YTYzMGI3OWViOGFkOGYzMzk3
14
- OTczYjNlN2Q4OWJjZGNhMTg2MzJlYTY3NGE5N2ZhNzM1NmRkYzA1YTc3YTA4
15
- OGRkNGRkM2NmMjkwMTMwZDQ5NzI2M2FhYjg2MGUwMDIyYjE1MzI=
13
+ ODY3YWU0MDA3ZDA5OWZkMTNhNzE2ZGJjMDA2MmY3NzE3MTQ2NmYwM2FjNWFj
14
+ Yzc3OGVlYTVjZjExODcyOTVlYjczM2ViYzg2Y2Q1MGU4ZDRjODlkZjdkMWZj
15
+ NWFkYTdlYThmZmUwYTBhNTdmNGRkMjZkOTg4N2Q1MTM2M2E1MmM=
data/Gemfile CHANGED
@@ -28,6 +28,7 @@ gem 'acts-as-taggable-on'
28
28
  gem 'public_activity'
29
29
  gem 'diffy'
30
30
  gem 'gollum-lib'
31
+ gem 'daisydiff'
31
32
 
32
33
  gem 'RedCloth'
33
34
  gem 'github-markdown'
data/Gemfile.lock CHANGED
@@ -94,6 +94,10 @@ GEM
94
94
  sass (~> 3.2)
95
95
  builder (3.2.2)
96
96
  charlock_holmes (0.6.9.4)
97
+ climate_control (0.0.3)
98
+ activesupport (>= 3.0)
99
+ cocaine (0.5.3)
100
+ climate_control (>= 0.0.3, < 1.0)
97
101
  coderay (1.1.0)
98
102
  coffee-rails (4.0.1)
99
103
  coffee-script (>= 2.2.0)
@@ -105,6 +109,9 @@ GEM
105
109
  columnize (0.3.6)
106
110
  coolline (0.4.3)
107
111
  daemons (1.1.9)
112
+ daisydiff (0.0.1)
113
+ cocaine (>= 0.5.1)
114
+ nokogiri (>= 1.4.2)
108
115
  debug_inspector (0.0.2)
109
116
  debugger (1.6.6)
110
117
  columnize (>= 0.3.1)
@@ -337,6 +344,7 @@ DEPENDENCIES
337
344
  blockuijs-rails!
338
345
  bootstrap-sass
339
346
  coffee-rails (~> 4.0.0)
347
+ daisydiff
340
348
  devise
341
349
  diffy
342
350
  docsplit
@@ -311,3 +311,10 @@ div.tokenfield.form-control
311
311
  font-size: .75em
312
312
  color: lighten(red, 15)
313
313
 
314
+ .compare-column
315
+ min-height: 300px
316
+ border-right: 1px solid gray
317
+ border-left: 1px solid gray
318
+ img
319
+ width: 100%
320
+ max-width: 100%
@@ -12,3 +12,27 @@
12
12
  .diff ins strong{font-weight:normal;background:#9f9;}
13
13
  .diff li.diff-comment { display: none; }
14
14
  .diff li.diff-block-info { background: none repeat scroll 0 0 gray; }
15
+
16
+ span.diff-html-removed {
17
+ background: #fcc;
18
+ /* text-decoration: line-through; */
19
+ cursor: default;
20
+ }
21
+
22
+ span.diff-html-added {
23
+ background: #9f9;
24
+ cursor: default;
25
+ }
26
+
27
+ span.diff-html-changed {
28
+ border-bottom: dotted 2px red;
29
+ cursor: default;
30
+ }
31
+
32
+ [changetype="diff-added-image"] {
33
+ border: dotted 2px #9f9;
34
+ }
35
+
36
+ [changetype="diff-removed-image"] {
37
+ border: dotted 2px #fcc;
38
+ }
@@ -30,6 +30,24 @@ class Wiki::PagesController < ApplicationController
30
30
  def history
31
31
  end
32
32
 
33
+ def compare
34
+ version = @page.versions.select{|x| x.sha == params[:version]}.first
35
+ filename = version.show.first.b_path
36
+
37
+ #TODO: should cache the diffs (store on save page in delayed job)
38
+ @old_html = version.repo.git.show({}, "#{version.sha}~1:#{filename}").force_encoding('UTF-8')
39
+ @new_html = version.repo.git.show({}, "#{version.sha}:#{filename}").force_encoding('UTF-8')
40
+
41
+ giri = Nokogiri::HTML(DaisyDiff.strings(@old_html, @new_html))
42
+ @diff_html = giri.css("body")
43
+ @diff_html.css(".diffpage-html-firstlast").remove
44
+ @diff_html.css("script").remove
45
+ @diff_html.xpath('//@onclick').remove
46
+ @diff_html.xpath('//@onload').remove
47
+ @diff_html.xpath('//@onerror').remove
48
+ @diff_html.xpath('//@onabort').remove
49
+ end
50
+
33
51
  def combined
34
52
  @subtree = @page.subtree.arrange
35
53
  render layout: "minimal"
@@ -21,6 +21,7 @@ module Tawork
21
21
 
22
22
  def title(page_title)
23
23
  content_for(:title) { page_title }
24
+ page_title
24
25
  end
25
26
 
26
27
  def icon_for(thing)
@@ -35,5 +36,13 @@ module Tawork
35
36
 
36
37
  tag(:i, class: "fa fa-#{icon}")
37
38
  end
39
+
40
+ def body_layout
41
+ if params[:controller] == "wiki/pages" && params[:action] == "compare"
42
+ return "layouts/compare_layout"
43
+ end
44
+
45
+ "layouts/default_layout"
46
+ end
38
47
  end
39
48
  end
@@ -0,0 +1,3 @@
1
+ .container-fluid
2
+ .row
3
+ = yield
@@ -0,0 +1,26 @@
1
+ .container-fluid
2
+ .row
3
+ .col-md-9.col-md-offset-3
4
+ - if notice.present?
5
+ .alert.alert-success= notice
6
+ - if alert.present?
7
+ .alert.alert-error= alert
8
+
9
+ .container-fluid
10
+ .row
11
+ .col-md-3.sidebar
12
+ - if current_user.present?
13
+ = render 'layouts/spaces'
14
+
15
+ - if TAWORK_CONFIG["show_projects"].nil? || TAWORK_CONFIG["show_projects"]
16
+ %ul.nav.nav-list.nav-list-panel
17
+ %li.nav-header
18
+ Projects
19
+ - Project.all.each do |project|
20
+ %li
21
+ = link_to project.title, project_path(project)
22
+ %li
23
+ = link_to new_project_path do
24
+ %i.fa.fa-plus
25
+ .col-md-9.col-md-offset-3
26
+ = yield
@@ -15,32 +15,6 @@
15
15
 
16
16
  %body
17
17
  = render 'layouts/nav_header'
18
-
19
- .container-fluid
20
- .row
21
- .col-md-9.col-md-offset-3
22
- - if notice.present?
23
- .alert.alert-success= notice
24
- - if alert.present?
25
- .alert.alert-error= alert
26
-
27
- .container-fluid
28
- .row
29
- .col-md-3.sidebar
30
- - if current_user.present?
31
- = render 'layouts/spaces'
32
-
33
- - if TAWORK_CONFIG["show_projects"].nil? || TAWORK_CONFIG["show_projects"]
34
- %ul.nav.nav-list.nav-list-panel
35
- %li.nav-header
36
- Projects
37
- - Project.all.each do |project|
38
- %li
39
- = link_to project.title, project_path(project)
40
- %li
41
- = link_to new_project_path do
42
- %i.fa.fa-plus
43
- .col-md-9.col-md-offset-3
44
- = yield
18
+ = render body_layout
45
19
 
46
20
  #global-autocomplete-results
@@ -0,0 +1,19 @@
1
+ .col-md-12
2
+ - page_title = title "Comparing version #{params[:version]} for #{@page.title}"
3
+ = render 'breadcrumb', link_last: true
4
+
5
+ = link_to "Back to History", history_wiki_page_path(@page), class: "btn btn-primary"
6
+
7
+
8
+ %h2
9
+ #{@page.title}
10
+ %small= params[:version]
11
+
12
+ %hr/
13
+
14
+ .col-md-6.compare-column
15
+ #wiki-content.wiki-content.content-description
16
+ = raw @old_html
17
+ .col-md-6.compare-column
18
+ #wiki-content.wiki-content.content-description
19
+ = raw @diff_html
@@ -2,13 +2,14 @@
2
2
  = render 'breadcrumb', link_last: true
3
3
 
4
4
  %h2 History
5
- - @page.versions.each do |version|
6
- .media
7
- - version.diffs.each do |diff|
8
- %a.pull-left{:href => "#"}
9
- .media-body
10
- %h4.media-heading Date: #{version.authored_date}
11
5
 
12
- - diffy = Diffy::Diff.new("", "")
13
- - diffy.instance_variable_set(:@diff, diff.diff)
14
- =raw Diffy::HtmlFormatter.new(diffy, highlight_words: true, include_plus_and_minus_in_html: true).to_s
6
+ %table.table
7
+ %tr
8
+ %th Author
9
+ %th Date
10
+ %th
11
+ - @page.versions.each do |version|
12
+ %tr
13
+ %td= version.author
14
+ %td= version.authored_date.to_s(:long)
15
+ %td= link_to "Compare", compare_wiki_page_path(@page, version: version.sha)
data/config/routes.rb CHANGED
@@ -22,6 +22,7 @@ Rails.application.class.routes.draw do
22
22
  get :subpages_dropdown
23
23
  get :combined
24
24
  get :history
25
+ get :compare
25
26
  post :reorder
26
27
  post :star
27
28
  post :add_tag
@@ -1,3 +1,3 @@
1
1
  module Tawork
2
- VERSION = '0.0.36'
2
+ VERSION = '0.0.37'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tawork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.36
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adnan Ali
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-26 00:00:00.000000000 Z
11
+ date: 2014-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -112,6 +112,8 @@ files:
112
112
  - app/views/devise/unlocks/new.html.erb
113
113
  - app/views/home/index.html.haml
114
114
  - app/views/layouts/_activity_wrapper.html.haml
115
+ - app/views/layouts/_compare_layout.html.haml
116
+ - app/views/layouts/_default_layout.html.haml
115
117
  - app/views/layouts/_nav_header.html.haml
116
118
  - app/views/layouts/_spaces.html.haml
117
119
  - app/views/layouts/application.html.haml
@@ -164,6 +166,7 @@ files:
164
166
  - app/views/wiki/pages/_tree_node.html.haml
165
167
  - app/views/wiki/pages/attach.js.coffee
166
168
  - app/views/wiki/pages/combined.html.haml
169
+ - app/views/wiki/pages/compare.html.haml
167
170
  - app/views/wiki/pages/create.js.coffee
168
171
  - app/views/wiki/pages/edit.html.haml
169
172
  - app/views/wiki/pages/history.html.haml