card 1.19.3 → 1.19.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/VERSION +1 -1
  4. data/card.gemspec +1 -3
  5. data/db/migrate_core_cards/20160914132636_fix_mod_files.rb +25 -0
  6. data/lib/card.rb +0 -2
  7. data/lib/card/content/diff.rb +3 -4
  8. data/lib/card/format/error.rb +1 -1
  9. data/mod/admin/set/self/admin.rb +2 -2
  10. data/mod/admin/set/self/trash.rb +9 -3
  11. data/mod/basic_types/set/type/html.rb +1 -1
  12. data/mod/bootstrap/set/all/bootstrap/layout.rb +58 -0
  13. data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +32 -0
  14. data/mod/carrierwave/lib/carrier_wave/cardmount.rb +0 -2
  15. data/mod/carrierwave/set/abstract/attachment/upload_cache.rb +2 -1
  16. data/mod/core/set/all/stages.rb +6 -4
  17. data/mod/history/lib/card/act.rb +8 -7
  18. data/mod/history/set/all/history.rb +10 -8
  19. data/mod/machines/set/abstract/script.rb +1 -1
  20. data/mod/machines/set/type/css.rb +1 -1
  21. data/mod/pointer/set/abstract/01_pointer.rb +1 -1
  22. data/mod/standard/file/credit_image/image-icon.png +0 -0
  23. data/mod/standard/file/credit_image/image-large.png +0 -0
  24. data/mod/standard/file/credit_image/image-medium.png +0 -0
  25. data/mod/standard/file/credit_image/image-small.png +0 -0
  26. data/mod/standard/file/favicon/image-icon.png +0 -0
  27. data/mod/standard/file/favicon/image-large.png +0 -0
  28. data/mod/standard/file/favicon/image-medium.png +0 -0
  29. data/mod/standard/file/favicon/image-small.png +0 -0
  30. data/mod/standard/file/logo/image-icon.png +0 -0
  31. data/mod/standard/file/logo/image-large.png +0 -0
  32. data/mod/standard/file/logo/image-medium.png +0 -0
  33. data/mod/standard/file/logo/image-small.png +0 -0
  34. data/mod/standard/set/self/recent.rb +2 -2
  35. data/spec/lib/card/diff_spec.rb +9 -9
  36. metadata +19 -156
  37. data/vendor/carrierwave/.gitignore +0 -19
  38. data/vendor/carrierwave/.rubocop.yml +0 -262
  39. data/vendor/carrierwave/.travis.yml +0 -58
  40. data/vendor/carrierwave/CHANGELOG.md +0 -81
  41. data/vendor/carrierwave/CONTRIBUTING.md +0 -37
  42. data/vendor/carrierwave/Gemfile +0 -5
  43. data/vendor/carrierwave/README.md +0 -995
  44. data/vendor/carrierwave/Rakefile +0 -26
  45. data/vendor/carrierwave/carrierwave.gemspec +0 -45
  46. data/vendor/carrierwave/cucumber.yml +0 -2
  47. data/vendor/carrierwave/features/caching.feature +0 -28
  48. data/vendor/carrierwave/features/download.feature +0 -20
  49. data/vendor/carrierwave/features/file_storage.feature +0 -37
  50. data/vendor/carrierwave/features/file_storage_overridden_filename.feature +0 -38
  51. data/vendor/carrierwave/features/file_storage_overridden_store_dir.feature +0 -38
  52. data/vendor/carrierwave/features/file_storage_reversing_processor.feature +0 -43
  53. data/vendor/carrierwave/features/fixtures/bork.txt +0 -1
  54. data/vendor/carrierwave/features/fixtures/monkey.txt +0 -1
  55. data/vendor/carrierwave/features/fixtures/upcased_bork.txt +0 -1
  56. data/vendor/carrierwave/features/mount_activerecord.feature +0 -46
  57. data/vendor/carrierwave/features/step_definitions/activerecord_steps.rb +0 -20
  58. data/vendor/carrierwave/features/step_definitions/caching_steps.rb +0 -12
  59. data/vendor/carrierwave/features/step_definitions/datamapper_steps.rb +0 -27
  60. data/vendor/carrierwave/features/step_definitions/download_steps.rb +0 -8
  61. data/vendor/carrierwave/features/step_definitions/file_steps.rb +0 -51
  62. data/vendor/carrierwave/features/step_definitions/general_steps.rb +0 -102
  63. data/vendor/carrierwave/features/step_definitions/mount_steps.rb +0 -17
  64. data/vendor/carrierwave/features/step_definitions/store_steps.rb +0 -16
  65. data/vendor/carrierwave/features/support/activerecord.rb +0 -18
  66. data/vendor/carrierwave/features/support/env.rb +0 -19
  67. data/vendor/carrierwave/features/versions_basics.feature +0 -50
  68. data/vendor/carrierwave/features/versions_caching_from_versions.feature +0 -32
  69. data/vendor/carrierwave/features/versions_nested_versions.feature +0 -70
  70. data/vendor/carrierwave/features/versions_overridden_filename.feature +0 -51
  71. data/vendor/carrierwave/features/versions_overriden_store_dir.feature +0 -41
  72. data/vendor/carrierwave/gemfiles/rails-4-0-stable.gemfile +0 -5
  73. data/vendor/carrierwave/gemfiles/rails-4-1-stable.gemfile +0 -5
  74. data/vendor/carrierwave/gemfiles/rails-4-2-stable.gemfile +0 -5
  75. data/vendor/carrierwave/gemfiles/rails-master.gemfile +0 -11
  76. data/vendor/carrierwave/lib/carrierwave.rb +0 -93
  77. data/vendor/carrierwave/lib/carrierwave/compatibility/paperclip.rb +0 -103
  78. data/vendor/carrierwave/lib/carrierwave/error.rb +0 -8
  79. data/vendor/carrierwave/lib/carrierwave/locale/cs.yml +0 -14
  80. data/vendor/carrierwave/lib/carrierwave/locale/de.yml +0 -14
  81. data/vendor/carrierwave/lib/carrierwave/locale/el.yml +0 -14
  82. data/vendor/carrierwave/lib/carrierwave/locale/en.yml +0 -14
  83. data/vendor/carrierwave/lib/carrierwave/locale/es.yml +0 -14
  84. data/vendor/carrierwave/lib/carrierwave/locale/fr-CA.yml +0 -14
  85. data/vendor/carrierwave/lib/carrierwave/locale/fr.yml +0 -14
  86. data/vendor/carrierwave/lib/carrierwave/locale/id.yml +0 -14
  87. data/vendor/carrierwave/lib/carrierwave/locale/ja.yml +0 -14
  88. data/vendor/carrierwave/lib/carrierwave/locale/nb.yml +0 -14
  89. data/vendor/carrierwave/lib/carrierwave/locale/nl.yml +0 -14
  90. data/vendor/carrierwave/lib/carrierwave/locale/pl.yml +0 -14
  91. data/vendor/carrierwave/lib/carrierwave/locale/pt-BR.yml +0 -14
  92. data/vendor/carrierwave/lib/carrierwave/locale/pt-PT.yml +0 -14
  93. data/vendor/carrierwave/lib/carrierwave/locale/ru.yml +0 -14
  94. data/vendor/carrierwave/lib/carrierwave/locale/sk.yml +0 -14
  95. data/vendor/carrierwave/lib/carrierwave/locale/tr.yml +0 -14
  96. data/vendor/carrierwave/lib/carrierwave/locale/zh-CN.yml +0 -14
  97. data/vendor/carrierwave/lib/carrierwave/locale/zh-TW.yml +0 -14
  98. data/vendor/carrierwave/lib/carrierwave/mount.rb +0 -444
  99. data/vendor/carrierwave/lib/carrierwave/mounter.rb +0 -163
  100. data/vendor/carrierwave/lib/carrierwave/orm/activerecord.rb +0 -103
  101. data/vendor/carrierwave/lib/carrierwave/processing.rb +0 -2
  102. data/vendor/carrierwave/lib/carrierwave/processing/mini_magick.rb +0 -328
  103. data/vendor/carrierwave/lib/carrierwave/processing/rmagick.rb +0 -379
  104. data/vendor/carrierwave/lib/carrierwave/sanitized_file.rb +0 -348
  105. data/vendor/carrierwave/lib/carrierwave/storage.rb +0 -2
  106. data/vendor/carrierwave/lib/carrierwave/storage/abstract.rb +0 -43
  107. data/vendor/carrierwave/lib/carrierwave/storage/file.rb +0 -118
  108. data/vendor/carrierwave/lib/carrierwave/storage/fog.rb +0 -462
  109. data/vendor/carrierwave/lib/carrierwave/test/matchers.rb +0 -394
  110. data/vendor/carrierwave/lib/carrierwave/uploader.rb +0 -67
  111. data/vendor/carrierwave/lib/carrierwave/uploader/cache.rb +0 -207
  112. data/vendor/carrierwave/lib/carrierwave/uploader/callbacks.rb +0 -33
  113. data/vendor/carrierwave/lib/carrierwave/uploader/configuration.rb +0 -203
  114. data/vendor/carrierwave/lib/carrierwave/uploader/content_type_blacklist.rb +0 -48
  115. data/vendor/carrierwave/lib/carrierwave/uploader/content_type_whitelist.rb +0 -48
  116. data/vendor/carrierwave/lib/carrierwave/uploader/default_url.rb +0 -17
  117. data/vendor/carrierwave/lib/carrierwave/uploader/download.rb +0 -92
  118. data/vendor/carrierwave/lib/carrierwave/uploader/extension_blacklist.rb +0 -51
  119. data/vendor/carrierwave/lib/carrierwave/uploader/extension_whitelist.rb +0 -51
  120. data/vendor/carrierwave/lib/carrierwave/uploader/file_size.rb +0 -41
  121. data/vendor/carrierwave/lib/carrierwave/uploader/magic_mime_blacklist.rb +0 -94
  122. data/vendor/carrierwave/lib/carrierwave/uploader/magic_mime_whitelist.rb +0 -94
  123. data/vendor/carrierwave/lib/carrierwave/uploader/mountable.rb +0 -38
  124. data/vendor/carrierwave/lib/carrierwave/uploader/processing.rb +0 -88
  125. data/vendor/carrierwave/lib/carrierwave/uploader/proxy.rb +0 -86
  126. data/vendor/carrierwave/lib/carrierwave/uploader/remove.rb +0 -21
  127. data/vendor/carrierwave/lib/carrierwave/uploader/serialization.rb +0 -28
  128. data/vendor/carrierwave/lib/carrierwave/uploader/store.rb +0 -93
  129. data/vendor/carrierwave/lib/carrierwave/uploader/url.rb +0 -41
  130. data/vendor/carrierwave/lib/carrierwave/uploader/versions.rb +0 -295
  131. data/vendor/carrierwave/lib/carrierwave/utilities.rb +0 -6
  132. data/vendor/carrierwave/lib/carrierwave/utilities/uri.rb +0 -21
  133. data/vendor/carrierwave/lib/carrierwave/validations/active_model.rb +0 -78
  134. data/vendor/carrierwave/lib/carrierwave/version.rb +0 -3
  135. data/vendor/carrierwave/lib/generators/templates/uploader.rb +0 -49
  136. data/vendor/carrierwave/lib/generators/uploader_generator.rb +0 -7
  137. data/vendor/carrierwave/script/console +0 -10
  138. data/vendor/carrierwave/script/destroy +0 -14
  139. data/vendor/carrierwave/script/generate +0 -14
  140. data/vendor/carrierwave/spec/compatibility/paperclip_spec.rb +0 -138
  141. data/vendor/carrierwave/spec/fixtures/Uppercase.jpg +0 -1
  142. data/vendor/carrierwave/spec/fixtures/bork.ttxt +0 -1
  143. data/vendor/carrierwave/spec/fixtures/bork.txt +0 -1
  144. data/vendor/carrierwave/spec/fixtures/bork.txtt +0 -1
  145. data/vendor/carrierwave/spec/fixtures/case.JPG +0 -1
  146. data/vendor/carrierwave/spec/fixtures/landscape.jpg +0 -0
  147. data/vendor/carrierwave/spec/fixtures/multi_page.pdf +0 -0
  148. data/vendor/carrierwave/spec/fixtures/new.jpeg +0 -1
  149. data/vendor/carrierwave/spec/fixtures/new.txt +0 -1
  150. data/vendor/carrierwave/spec/fixtures/old.jpeg +0 -1
  151. data/vendor/carrierwave/spec/fixtures/old.txt +0 -1
  152. data/vendor/carrierwave/spec/fixtures/portrait.jpg +0 -0
  153. data/vendor/carrierwave/spec/fixtures/ruby.gif +0 -0
  154. data/vendor/carrierwave/spec/fixtures/sponsored.doc +0 -1
  155. data/vendor/carrierwave/spec/fixtures/test+.jpg +0 -1
  156. data/vendor/carrierwave/spec/fixtures/test.jpeg +0 -1
  157. data/vendor/carrierwave/spec/fixtures/test.jpg +0 -1
  158. data/vendor/carrierwave/spec/generators/uploader_generator_spec.rb +0 -19
  159. data/vendor/carrierwave/spec/mount_multiple_spec.rb +0 -913
  160. data/vendor/carrierwave/spec/mount_single_spec.rb +0 -793
  161. data/vendor/carrierwave/spec/orm/activerecord_spec.rb +0 -1556
  162. data/vendor/carrierwave/spec/processing/mini_magick_spec.rb +0 -210
  163. data/vendor/carrierwave/spec/processing/rmagick_spec.rb +0 -250
  164. data/vendor/carrierwave/spec/sanitized_file_spec.rb +0 -805
  165. data/vendor/carrierwave/spec/spec_helper.rb +0 -105
  166. data/vendor/carrierwave/spec/storage/file_spec.rb +0 -82
  167. data/vendor/carrierwave/spec/storage/fog_credentials.rb +0 -46
  168. data/vendor/carrierwave/spec/storage/fog_helper.rb +0 -428
  169. data/vendor/carrierwave/spec/storage/fog_spec.rb +0 -48
  170. data/vendor/carrierwave/spec/support/activerecord.rb +0 -31
  171. data/vendor/carrierwave/spec/support/file_utils_helper.rb +0 -15
  172. data/vendor/carrierwave/spec/uploader/cache_spec.rb +0 -324
  173. data/vendor/carrierwave/spec/uploader/callback_spec.rb +0 -30
  174. data/vendor/carrierwave/spec/uploader/configuration_spec.rb +0 -133
  175. data/vendor/carrierwave/spec/uploader/content_type_blacklist_spec.rb +0 -61
  176. data/vendor/carrierwave/spec/uploader/content_type_whitelist_spec.rb +0 -63
  177. data/vendor/carrierwave/spec/uploader/default_url_spec.rb +0 -77
  178. data/vendor/carrierwave/spec/uploader/download_spec.rb +0 -204
  179. data/vendor/carrierwave/spec/uploader/extension_blacklist_spec.rb +0 -112
  180. data/vendor/carrierwave/spec/uploader/extension_whitelist_spec.rb +0 -102
  181. data/vendor/carrierwave/spec/uploader/file_size_spec.rb +0 -52
  182. data/vendor/carrierwave/spec/uploader/mountable_spec.rb +0 -26
  183. data/vendor/carrierwave/spec/uploader/overrides_spec.rb +0 -71
  184. data/vendor/carrierwave/spec/uploader/paths_spec.rb +0 -18
  185. data/vendor/carrierwave/spec/uploader/processing_spec.rb +0 -159
  186. data/vendor/carrierwave/spec/uploader/proxy_spec.rb +0 -79
  187. data/vendor/carrierwave/spec/uploader/remove_spec.rb +0 -71
  188. data/vendor/carrierwave/spec/uploader/store_spec.rb +0 -400
  189. data/vendor/carrierwave/spec/uploader/url_spec.rb +0 -273
  190. data/vendor/carrierwave/spec/uploader/versions_spec.rb +0 -633
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 057086042ff26905bb50428aa1e697887464f1ed
4
- data.tar.gz: 159c9cd1236f61f566ed10a4b132e84aadc3c369
3
+ metadata.gz: 2438311a0c0d3270f1d65eb41fbe38914740135f
4
+ data.tar.gz: 75fa9bdbf0fd463f171b47875624bb96025b50c9
5
5
  SHA512:
6
- metadata.gz: 7d9330f1f0e0e30a5bf642e80695ec4b460534e04c34843b9f316b154eb72aa56f3feb1d47b639bee6a55568e2e8fef3d14e1391eb8a406656aa86e2f26702ef
7
- data.tar.gz: cf1908a395f06b908b57f9dbbfcf67ef0d734ee51f30a93272725ddfe27d583256e326a416a149fd91ac4db5fc971eb0da1c8a1c957b38ccb9d6855094426062
6
+ metadata.gz: bec0abeaa624791be2ba54a2709fd6c3d75f39b07c53f758e7464c75ede3573eb84c16c048be5f3843141f9e4d715d5744004f3009c6a935c370d405fd4f02fe
7
+ data.tar.gz: 49c9dcec44ea2e97f112e14c8e5f7c1b7281fb07445172c2b7b3eda79cba2ea67116dc1a32b133039387050674b4c6cf8b96087f700066126fafe3e8b36ac8bd
data/.yardopts CHANGED
@@ -1,6 +1,7 @@
1
1
  lib/**/*.rb \
2
2
  mod/*/format/*.rb \
3
3
  mod/*/chunk/*.rb \
4
+ mod/*/lib/**/*.rb \
4
5
  tmpsets/set*/**/*.rb - \
5
6
  **/*.rdoc \
6
7
  GPL \
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.19.3
1
+ 1.19.4
@@ -38,9 +38,7 @@ Gem::Specification.new do |s|
38
38
  [
39
39
  ["smartname", "0.3.1"],
40
40
  ["uuid", "~> 2.3"],
41
- # if carrierwave > 11 is availabe remove carrierwave git submodule and
42
- # load it here as gem
43
- # ["carrierwave", "<= 0.11.0"],
41
+ ["carrierwave", "1.0.0.beta"],
44
42
  ["htmlentities", "~> 4.3"],
45
43
  ["mini_magick", "~> 4.2"],
46
44
  # recaptcha 0.4.0 is last version that doesn't require ruby 2.0
@@ -0,0 +1,25 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ class FixModFiles < Card::Migration::Core
4
+ def up
5
+ Card.search(type: "image").each do |card|
6
+ next unless card.coded?
7
+ next unless card.content.include?("05_standard") ||
8
+ card.content.include?("06_bootstrap")
9
+ new_content = card.content.sub("05_standard", "standard")
10
+ .sub("06_bootstrap", "bootstrap")
11
+ card.update_column :db_content, new_content
12
+
13
+ update_history card
14
+ end
15
+ end
16
+
17
+ def update_history card
18
+ card.actions.each do |action|
19
+ next unless (content_change = action.change(:db_content))
20
+ new_value = content_change.value.gsub("05_standard", "standard")
21
+ .gsub("06_bootstrap", "bootstrap")
22
+ content_change.update_column :value, new_value
23
+ end
24
+ end
25
+ end
@@ -1,6 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
- cw_path = File.expand_path "../../vendor/carrierwave/lib", __FILE__
3
- $LOAD_PATH.unshift(cw_path) unless $LOAD_PATH.include?(cw_path)
4
2
  require "carrierwave"
5
3
 
6
4
  # if Cardio.file_buckets.present?
@@ -32,11 +32,10 @@ class Card
32
32
  # :raw = escape html tags and compare everything
33
33
  #
34
34
  # summary: {length: <number> , joint: <string> }
35
-
36
35
  def initialize old_version, new_version, opts={}
37
36
  @result = Result.new opts[:summary]
38
37
  if new_version
39
- lcs_opts = lcs_opts_for_format opts[:format]
38
+ lcs_opts = lcs_opts_for_format opts[:diff_format]
40
39
  LCS.new(lcs_opts).run(old_version, new_version, @result)
41
40
  end
42
41
  end
@@ -51,9 +50,9 @@ class Card
51
50
 
52
51
  private
53
52
 
54
- def lcs_opts_for_format format
53
+ def lcs_opts_for_format diff_format
55
54
  opts = {}
56
- case format
55
+ case diff_format
57
56
  when :html
58
57
  opts[:exclude] = /^</
59
58
  when :text
@@ -9,7 +9,7 @@ class Card
9
9
  end
10
10
 
11
11
  def debug_error e, view
12
- Rails.logger.info "\nError rendering #{error_cardname} / #{view}: "\
12
+ Rails.logger.info "#{rendering_error e, view}:\n" \
13
13
  "#{e.class} : #{e.message}"
14
14
  debug = Card[:debugger]
15
15
  raise e if debug && debug.content == "on"
@@ -51,11 +51,11 @@ format :html do
51
51
  stats = [
52
52
  { title: "solid cache",
53
53
  count: solid_cache_count, unit: " cards",
54
- link_text: "clear cache",
54
+ link_text: "clear solid cache",
55
55
  task: "clear_solid_cache" },
56
56
  { title: "machine cache",
57
57
  count: machine_cache_count, unit: " cards",
58
- link_text: "clear cache",
58
+ link_text: "clear machine cache",
59
59
  task: "clear_machine_cache" }
60
60
  ]
61
61
  return stats unless Card.config.view_cache
@@ -17,7 +17,7 @@ format :html do
17
17
  card.name,
18
18
  "#{time_ago_in_words(card.updated_at)} ago",
19
19
  Card[card.updater_id].name,
20
- restore_link(card)
20
+ "#{history_link(card)} | #{restore_link(card)}"
21
21
  ]
22
22
  end
23
23
 
@@ -40,10 +40,16 @@ format :html do
40
40
  content_tag :p, button
41
41
  end
42
42
 
43
+ def history_link trashed_card
44
+ card_link trashed_card, path_opts: { view: :history, look_in_trash: true },
45
+ text: "history"
46
+ end
47
+
43
48
  def restore_link trashed_card
44
49
  before_delete = trashed_card.actions[-2]
45
- link_path = path action: :update, view: :open, restore: trashed_card.id,
46
- action_ids: [before_delete]
50
+ link_path = path id: trashed_card.id, look_in_trash: true, action: :update,
51
+ view: :open, restore: trashed_card.id,
52
+ action_ids: [before_delete], success: { id: "~#{card.id}" }
47
53
  link_to "restore", link_path, method: :post, rel: "nofollow",
48
54
  remote: true, class: "slotter"
49
55
  end
@@ -5,7 +5,7 @@ def clean_html?
5
5
  end
6
6
 
7
7
  def diff_args
8
- { format: :raw }
8
+ { diff_format: :raw }
9
9
  end
10
10
 
11
11
  format do
@@ -0,0 +1,58 @@
1
+
2
+ format :html do
3
+ # generate bootstrap column layout
4
+ # @example
5
+ # layout container: true, fluid: true, class: "hidden" do
6
+ # row 6, 6, class: "unicorn"
7
+ # column "horn",
8
+ # column "rainbow", class: "colorful"
9
+ # end
10
+ # end
11
+ # @example
12
+ # layout do
13
+ # row 3, 3, 4, 2, class: "unicorn" do
14
+ # [ "horn", "body", "tail", "rainbow"]
15
+ # end
16
+ # row 6, 6, ["unicorn", "rainbow"], class: "horn"
17
+ # end
18
+ def layout opts={}
19
+ @rows = "".html_safe
20
+ yield
21
+ opts.delete(:container) ? container(@rows, opts) : @rows
22
+ end
23
+
24
+ def container content, opts={}
25
+ add_class opts, opts.delete(:fluid) ? "container-fluid" : "container"
26
+ content_tag :div, content, opts
27
+ end
28
+
29
+ def row *args
30
+ opts, cols, @col_widths = process_row_args args
31
+ @rows ||= "".html_safe
32
+ @columns = "".html_safe
33
+ cols ||= yield
34
+ cols.each { |col_content| column(col_content) } if cols.is_a? Array
35
+ add_class opts, "row"
36
+ @rows << content_tag(:div, @columns, opts)
37
+ end
38
+
39
+ def process_row_args args
40
+ opts = args.last.is_a?(Hash) ? args.pop : {}
41
+ cols = args.last.is_a?(Array) && args.pop
42
+ [opts, cols, check_col_widths(args)]
43
+ end
44
+
45
+ def check_col_widths args
46
+ raise Error, "bad argument" unless args.all? { |a| a.is_a? Fixnum }
47
+ total_width = args.inject(0) { |a, e| a + e }
48
+ raise Error, "column widths must sum up to 12" unless total_width == 12
49
+ args
50
+ end
51
+
52
+ # default column width type is for medium devices (col-md-)
53
+ def column content, opts={}
54
+ @columns ||= "".html_safe
55
+ add_class opts, "col-md-#{@col_widths.shift}"
56
+ @columns << content_tag(:div, content.html_safe, opts)
57
+ end
58
+ end
@@ -0,0 +1,32 @@
1
+ describe Card::Set::All::Bootstrap::Layout do
2
+ describe "layout dsl" do
3
+ subject { Card["A"].format(:html) }
4
+ it "creates correct layout with column array" do
5
+ layout = subject.layout container: true, fluid: true do
6
+ subject.row 6, 4, 2, class: "six-times-six" do
7
+ ["first column", "second column", "third column"]
8
+ end
9
+ end
10
+ assert_view_select layout, 'div[class="container-fluid"]' do
11
+ assert_select 'div[class="six-times-six row"]' do
12
+ assert_select 'div[class="col-md-6"]', text: "first column"
13
+ assert_select 'div[class="col-md-4"]', text: "second column"
14
+ assert_select 'div[class="col-md-2"]', text: "third column"
15
+ end
16
+ end
17
+ end
18
+
19
+ it "creates correct layout with column calls" do
20
+ layout = subject.layout do
21
+ subject.row 8, 4, class: "six-times-six" do
22
+ subject.column "first column"
23
+ subject.column "second column", class: "extra-class"
24
+ end
25
+ end
26
+ assert_view_select layout, 'div[class="six-times-six row"]' do
27
+ assert_select 'div[class="col-md-8"]', text: "first column"
28
+ assert_select 'div[class="extra-class col-md-4"]', text: "second column"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,3 @@
1
- cw_path = File.expand_path "../../../../../vendor/carrierwave/lib", __FILE__
2
- $LOAD_PATH.unshift(cw_path) unless $LOAD_PATH.include?(cw_path)
3
1
  require "carrierwave"
4
2
 
5
3
  module CarrierWave
@@ -60,7 +60,8 @@ end
60
60
 
61
61
  # used for uploads for new cards until the new card is created
62
62
  def upload_cache_card
63
- @upload_cache_card ||= Card["new_#{attachment_name}".to_sym]
63
+ @upload_cache_card ||=
64
+ Card["new_#{attachment_name}".to_sym] || Card[:new_file]
64
65
  end
65
66
 
66
67
  def preliminary_upload?
@@ -7,10 +7,12 @@ end
7
7
 
8
8
  def identify_action
9
9
  @action =
10
- case
11
- when trash then :delete
12
- when new_card? then :create
13
- else :update
10
+ if trash && trash_changed?
11
+ :delete
12
+ elsif new_card?
13
+ :create
14
+ else
15
+ :update
14
16
  end
15
17
  end
16
18
 
@@ -53,16 +53,17 @@ class Card
53
53
  # all actions that current user has permission to view
54
54
  # @return [Array of Actions]
55
55
  def all_viewable
56
- joins = "JOIN card_actions ON card_acts.id = card_act_id " \
57
- "JOIN cards ON cards.id = card_actions.card_id"
58
- where = [
59
- "card_actions.id is not null", # data check. should not be needed
60
- "cards.id is not null", # ditto
56
+ card_join = "JOIN cards ON cards.id = card_actions.card_id"
57
+ action_conditions = [
58
+ "card_acts.id = card_act_id",
59
+ "card_actions.card_id is not null",
61
60
  "draft is not true",
62
- Card::Query::SqlStatement.new.permission_conditions("cards")
61
+ Query::SqlStatement.new.permission_conditions("cards")
63
62
  ].compact.join " AND "
64
63
 
65
- joins(joins).where(where).uniq
64
+ viewable_actions =
65
+ Action.joins(card_join).where(action_conditions).to_sql
66
+ where("card_id is not null AND EXISTS (#{viewable_actions})")
66
67
  end
67
68
  end
68
69
 
@@ -233,7 +233,7 @@ format :html do
233
233
  end
234
234
 
235
235
  view :act_header do |_args|
236
- %(<h5 "class=act-header">#{card_link card}</h5>)
236
+ %(<h5 class="act-header">#{card_link card}</h5>)
237
237
  end
238
238
 
239
239
  view :act_metadata do |args|
@@ -283,10 +283,9 @@ format :html do
283
283
  = glyphicon 'plus-sign', (action.green? ? 'added-mark' : 'diff-invisible')
284
284
  = wrap_diff :name, name_diff
285
285
  = wrap_diff :type, type_diff
286
- -if content_diff
286
+ -if content_diff && action_view == :summary
287
287
  = glyphicon 'arrow-right', 'arrow'
288
- -if action_view == :summary
289
- = wrap_diff :content, content_diff
288
+ = wrap_diff :content, content_diff
290
289
  -if content_diff and action_view == :expanded
291
290
  .expanded
292
291
  = wrap_diff :content, content_diff
@@ -326,9 +325,12 @@ format :html do
326
325
  end
327
326
 
328
327
  def content_diff action, action_view, hide_diff
329
- action.new_content? && action.card.format.render_content_changes(
330
- action: action, diff_type: action_view, hide_diff: hide_diff
331
- )
328
+ diff = action.new_content? &&
329
+ action.card.format.render_content_changes(
330
+ action: action, diff_type: action_view, hide_diff: hide_diff
331
+ )
332
+ return "<i>empty</i>" unless diff.present?
333
+ diff
332
334
  end
333
335
 
334
336
  def wrap_diff field, content, extra_class=nil
@@ -412,7 +414,7 @@ format :html do
412
414
  end
413
415
 
414
416
  def diff_args
415
- { format: :text }
417
+ { diff_format: :text }
416
418
  end
417
419
 
418
420
  def has_edits?
@@ -38,5 +38,5 @@ format :html do
38
38
  end
39
39
 
40
40
  def diff_args
41
- { format: :text }
41
+ { diff_format: :text }
42
42
  end
@@ -56,5 +56,5 @@ format :html do
56
56
  end
57
57
 
58
58
  def diff_args
59
- { format: :text }
59
+ { diff_format: :text }
60
60
  end
@@ -125,7 +125,7 @@ event :standardize_items, :prepare_to_validate,
125
125
  end
126
126
 
127
127
  def diff_args
128
- { format: :pointer }
128
+ { diff_format: :pointer }
129
129
  end
130
130
 
131
131
  def item_cards args={}
@@ -16,8 +16,8 @@ format :html do
16
16
  acts = Act.all_viewable.order(id: :desc).page(page).per(ACTS_PER_PAGE)
17
17
  acts.map do |act|
18
18
  if (act_card = act.card)
19
- format = act_card.format :html
20
- format.render_act args.merge(act: act, act_context: :absolute)
19
+ act_view_args = args.merge(act: act, act_context: :absolute)
20
+ act_card.format(:html).render_act act_view_args
21
21
  else
22
22
  Rails.logger.info "bad data, act: #{act}"
23
23
  ""
@@ -64,7 +64,7 @@ describe Card::Content::Diff do
64
64
 
65
65
  describe "summary" do
66
66
  before(:all) do
67
- @opts = { format: :html }
67
+ @opts = { diff_format: :html }
68
68
  end
69
69
 
70
70
  it "omits unchanged text" do
@@ -118,7 +118,7 @@ describe Card::Content::Diff do
118
118
  it "removes html tags" do
119
119
  a = "<a>A</a>"
120
120
  b = "<b>B</b>"
121
- expect(summary a, b, format: :html).to eq(
121
+ expect(summary a, b, diff_format: :html).to eq(
122
122
  "#{del 'A'}#{ins 'B'}"
123
123
  )
124
124
  end
@@ -126,7 +126,7 @@ describe Card::Content::Diff do
126
126
  it "with html tags in raw format" do
127
127
  a = "<a>1</a>"
128
128
  b = "<b>1</b>"
129
- expect(summary a, b, format: :raw).to eq(
129
+ expect(summary a, b, diff_format: :raw).to eq(
130
130
  "#{del(tag 'a')}#{ins(tag 'b')}...#{del(tag '/a')}#{ins(tag '/b')}"
131
131
  )
132
132
  end
@@ -134,7 +134,7 @@ describe Card::Content::Diff do
134
134
 
135
135
  context "html format" do
136
136
  before(:all) do
137
- @opts = { format: :html }
137
+ @opts = { diff_format: :html }
138
138
  end
139
139
 
140
140
  it "doesn't change a text without changes" do
@@ -164,7 +164,7 @@ describe Card::Content::Diff do
164
164
 
165
165
  context "text format" do
166
166
  before(:all) do
167
- @opts = { format: :text }
167
+ @opts = { diff_format: :text }
168
168
  end
169
169
 
170
170
  it "removes html" do
@@ -172,19 +172,19 @@ describe Card::Content::Diff do
172
172
  end
173
173
 
174
174
  it "compares complete links" do
175
- diff = Card::Content::Diff.complete("[[A]]\n[[B]]", "[[A]]\n[[C]]", format: :html)
175
+ diff = Card::Content::Diff.complete("[[A]]\n[[B]]", "[[A]]\n[[C]]", diff_format: :html)
176
176
  expect(diff).to eq("[[A]]\n#{del '[[B]]'}#{ins '[[C]]'}")
177
177
  end
178
178
 
179
179
  it "compares complete nests" do
180
- diff = Card::Content::Diff.complete("{{A}}\n{{B}}", "{{A}}\n{{C}}", format: :html)
180
+ diff = Card::Content::Diff.complete("{{A}}\n{{B}}", "{{A}}\n{{C}}", diff_format: :html)
181
181
  expect(diff).to eq("{{A}}\n#{del '{{B}}'}#{ins '{{C}}'}")
182
182
  end
183
183
  end
184
184
 
185
185
  context "raw format" do
186
186
  before(:all) do
187
- @opts = { format: :raw }
187
+ @opts = { diff_format: :raw }
188
188
  end
189
189
 
190
190
  it "excapes html" do
@@ -198,7 +198,7 @@ describe Card::Content::Diff do
198
198
 
199
199
  context "pointer format" do
200
200
  before(:all) do
201
- @opts = { format: :pointer }
201
+ @opts = { diff_format: :pointer }
202
202
  end
203
203
 
204
204
  it "removes square brackets" do