card 1.16.9 → 1.16.10

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/VERSION +1 -1
  3. data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +3 -1
  4. data/db/seed/new/card_actions.yml +389 -557
  5. data/db/seed/new/card_acts.yml +595 -1
  6. data/db/seed/new/card_changes.yml +22595 -7526
  7. data/db/seed/new/card_references.yml +379 -407
  8. data/db/seed/new/cards.yml +1694 -2072
  9. data/db/seed/test/fixtures/card_actions.yml +966 -1102
  10. data/db/seed/test/fixtures/card_acts.yml +1017 -399
  11. data/db/seed/test/fixtures/card_changes.yml +24750 -9681
  12. data/db/seed/test/fixtures/card_references.yml +603 -631
  13. data/db/seed/test/fixtures/cards.yml +2293 -2671
  14. data/lib/card/set.rb +1 -1
  15. data/mod/01_core/set/all/content.rb +14 -12
  16. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +1 -1
  17. data/mod/05_standard/set/abstract/attachment.rb +9 -9
  18. data/mod/05_standard/set/all/rich_html/content.rb +115 -103
  19. data/mod/05_standard/set/type/file.rb +1 -1
  20. data/tmpsets/set/mod001-01_core/all/active_card.rb +2 -1
  21. data/tmpsets/set/mod001-01_core/all/collection.rb +3 -3
  22. data/tmpsets/set/mod001-01_core/all/content.rb +2 -1
  23. data/tmpsets/set/mod001-01_core/all/erb.rb +2 -1
  24. data/tmpsets/set/mod001-01_core/all/fetch.rb +169 -93
  25. data/tmpsets/set/mod001-01_core/all/haml.rb +2 -1
  26. data/tmpsets/set/mod001-01_core/all/initialize.rb +11 -23
  27. data/tmpsets/set/mod001-01_core/all/name.rb +130 -80
  28. data/tmpsets/set/mod001-01_core/all/pattern.rb +2 -1
  29. data/tmpsets/set/mod001-01_core/all/permissions.rb +2 -1
  30. data/tmpsets/set/mod001-01_core/all/phases.rb +95 -96
  31. data/tmpsets/set/mod001-01_core/all/references.rb +2 -1
  32. data/tmpsets/set/mod001-01_core/all/rules.rb +2 -1
  33. data/tmpsets/set/mod001-01_core/all/states.rb +2 -1
  34. data/tmpsets/set/mod001-01_core/all/templating.rb +2 -1
  35. data/tmpsets/set/mod001-01_core/all/tracked_attributes.rb +85 -60
  36. data/tmpsets/set/mod001-01_core/all/trash.rb +16 -13
  37. data/tmpsets/set/mod001-01_core/all/type.rb +5 -25
  38. data/tmpsets/set/mod001-01_core/all/utils.rb +2 -1
  39. data/tmpsets/set/mod001-01_core/all/view_cache.rb +2 -1
  40. data/tmpsets/set/mod002-01_history/all/actions.rb +2 -1
  41. data/tmpsets/set/mod002-01_history/all/content_history.rb +7 -4
  42. data/tmpsets/set/mod002-01_history/all/history.rb +119 -83
  43. data/tmpsets/set/mod003-02_basic_types/all/all_css.rb +2 -1
  44. data/tmpsets/set/mod003-02_basic_types/all/all_csv.rb +2 -1
  45. data/tmpsets/set/mod003-02_basic_types/all/all_js.rb +2 -1
  46. data/tmpsets/set/mod003-02_basic_types/all/base.rb +52 -50
  47. data/tmpsets/set/mod003-02_basic_types/all/file.rb +2 -1
  48. data/tmpsets/set/mod003-02_basic_types/all/json.rb +2 -1
  49. data/tmpsets/set/mod003-02_basic_types/all/rss.rb +2 -1
  50. data/tmpsets/set/mod003-02_basic_types/all/text.rb +2 -1
  51. data/tmpsets/set/mod003-02_basic_types/type/html.rb +2 -1
  52. data/tmpsets/set/mod003-02_basic_types/type/plain_text.rb +2 -1
  53. data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +10 -1
  54. data/tmpsets/set/mod004-03_machines/right/machine_input.rb +2 -1
  55. data/tmpsets/set/mod004-03_machines/right/machine_output.rb +2 -1
  56. data/tmpsets/set/mod004-03_machines/self/script_ace.rb +2 -1
  57. data/tmpsets/set/mod004-03_machines/self/script_card_menu.rb +2 -1
  58. data/tmpsets/set/mod004-03_machines/self/script_html5shiv_printshiv.rb +2 -1
  59. data/tmpsets/set/mod004-03_machines/self/script_jquery.rb +2 -1
  60. data/tmpsets/set/mod004-03_machines/self/script_jquery_helper.rb +2 -1
  61. data/tmpsets/set/mod004-03_machines/self/script_slot.rb +2 -1
  62. data/tmpsets/set/mod004-03_machines/self/script_tinymce.rb +2 -1
  63. data/tmpsets/set/mod004-03_machines/self/style_bootstrap_compatible.rb +2 -1
  64. data/tmpsets/set/mod004-03_machines/self/style_cards.rb +2 -1
  65. data/tmpsets/set/mod004-03_machines/self/style_jquery_ui_smoothness.rb +2 -1
  66. data/tmpsets/set/mod004-03_machines/type/coffee_script.rb +2 -1
  67. data/tmpsets/set/mod004-03_machines/type/css.rb +2 -1
  68. data/tmpsets/set/mod004-03_machines/type/java_script.rb +2 -1
  69. data/tmpsets/set/mod004-03_machines/type/scss.rb +2 -1
  70. data/tmpsets/set/mod004-03_machines/type/skin.rb +2 -1
  71. data/tmpsets/set/mod005-04_settings/abstract/permission.rb +2 -1
  72. data/tmpsets/set/mod005-04_settings/right/add_help.rb +2 -1
  73. data/tmpsets/set/mod005-04_settings/right/comment.rb +2 -1
  74. data/tmpsets/set/mod005-04_settings/right/create.rb +2 -1
  75. data/tmpsets/set/mod005-04_settings/right/default.rb +2 -1
  76. data/tmpsets/set/mod005-04_settings/right/delete.rb +2 -1
  77. data/tmpsets/set/mod005-04_settings/right/help.rb +2 -1
  78. data/tmpsets/set/mod005-04_settings/right/read.rb +2 -1
  79. data/tmpsets/set/mod005-04_settings/right/script.rb +2 -1
  80. data/tmpsets/set/mod005-04_settings/right/structure.rb +2 -1
  81. data/tmpsets/set/mod005-04_settings/right/style.rb +2 -1
  82. data/tmpsets/set/mod005-04_settings/right/update.rb +2 -1
  83. data/tmpsets/set/mod005-04_settings/self/accountable.rb +2 -1
  84. data/tmpsets/set/mod005-04_settings/self/add_help.rb +2 -1
  85. data/tmpsets/set/mod005-04_settings/self/autoname.rb +2 -1
  86. data/tmpsets/set/mod005-04_settings/self/captcha.rb +2 -1
  87. data/tmpsets/set/mod005-04_settings/self/create.rb +2 -1
  88. data/tmpsets/set/mod005-04_settings/self/default.rb +2 -1
  89. data/tmpsets/set/mod005-04_settings/self/delete.rb +2 -1
  90. data/tmpsets/set/mod005-04_settings/self/help.rb +2 -1
  91. data/tmpsets/set/mod005-04_settings/self/input.rb +2 -1
  92. data/tmpsets/set/mod005-04_settings/self/layout.rb +2 -1
  93. data/tmpsets/set/mod005-04_settings/self/on_create.rb +2 -1
  94. data/tmpsets/set/mod005-04_settings/self/on_delete.rb +2 -1
  95. data/tmpsets/set/mod005-04_settings/self/on_update.rb +2 -1
  96. data/tmpsets/set/mod005-04_settings/self/options.rb +2 -1
  97. data/tmpsets/set/mod005-04_settings/self/options_label.rb +2 -1
  98. data/tmpsets/set/mod005-04_settings/self/read.rb +2 -1
  99. data/tmpsets/set/mod005-04_settings/self/recent_settings.rb +2 -1
  100. data/tmpsets/set/mod005-04_settings/self/script.rb +2 -1
  101. data/tmpsets/set/mod005-04_settings/self/structure.rb +2 -1
  102. data/tmpsets/set/mod005-04_settings/self/style.rb +2 -1
  103. data/tmpsets/set/mod005-04_settings/self/table_of_contents.rb +2 -1
  104. data/tmpsets/set/mod005-04_settings/self/thanks.rb +2 -1
  105. data/tmpsets/set/mod005-04_settings/self/update.rb +2 -1
  106. data/tmpsets/set/mod005-04_settings/type/setting.rb +2 -1
  107. data/tmpsets/set/mod006-05_email/all/email_html.rb +2 -1
  108. data/tmpsets/set/mod006-05_email/all/email_text.rb +2 -1
  109. data/tmpsets/set/mod006-05_email/all/follow.rb +2 -1
  110. data/tmpsets/set/mod006-05_email/all/notify.rb +2 -1
  111. data/tmpsets/set/mod006-05_email/all/observer.rb +2 -1
  112. data/tmpsets/set/mod006-05_email/right/bcc.rb +2 -1
  113. data/tmpsets/set/mod006-05_email/right/cc.rb +2 -1
  114. data/tmpsets/set/mod006-05_email/right/follow.rb +2 -1
  115. data/tmpsets/set/mod006-05_email/right/follow_fields.rb +2 -1
  116. data/tmpsets/set/mod006-05_email/right/followers.rb +7 -6
  117. data/tmpsets/set/mod006-05_email/right/following.rb +3 -2
  118. data/tmpsets/set/mod006-05_email/right/from.rb +2 -1
  119. data/tmpsets/set/mod006-05_email/right/html_message.rb +2 -1
  120. data/tmpsets/set/mod006-05_email/right/to.rb +2 -1
  121. data/tmpsets/set/mod006-05_email/self/always.rb +2 -1
  122. data/tmpsets/set/mod006-05_email/self/created.rb +2 -1
  123. data/tmpsets/set/mod006-05_email/self/edited.rb +2 -1
  124. data/tmpsets/set/mod006-05_email/self/follow.rb +2 -1
  125. data/tmpsets/set/mod006-05_email/self/follow_defaults.rb +2 -1
  126. data/tmpsets/set/mod006-05_email/self/never.rb +2 -1
  127. data/tmpsets/set/mod006-05_email/type/email_template.rb +2 -1
  128. data/tmpsets/set/mod006-05_email/type_plus_right/user/follow.rb +3 -2
  129. data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +22 -9
  130. data/tmpsets/set/mod007-05_standard/all/account.rb +2 -1
  131. data/tmpsets/set/mod007-05_standard/all/comment.rb +2 -1
  132. data/tmpsets/set/mod007-05_standard/all/error.rb +2 -1
  133. data/tmpsets/set/mod007-05_standard/all/event_viz.rb +2 -1
  134. data/tmpsets/set/mod007-05_standard/all/links.rb +2 -1
  135. data/tmpsets/set/mod007-05_standard/all/rich_html/content.rb +3 -2
  136. data/tmpsets/set/mod007-05_standard/all/rich_html/editing.rb +2 -1
  137. data/tmpsets/set/mod007-05_standard/all/rich_html/form.rb +23 -12
  138. data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +2 -1
  139. data/tmpsets/set/mod007-05_standard/all/rich_html/menu.rb +3 -2
  140. data/tmpsets/set/mod007-05_standard/all/rich_html/modal.rb +2 -1
  141. data/tmpsets/set/mod007-05_standard/all/rich_html/toolbar.rb +2 -1
  142. data/tmpsets/set/mod007-05_standard/all/rich_html/wrapper.rb +2 -1
  143. data/tmpsets/set/mod007-05_standard/right/account.rb +7 -6
  144. data/tmpsets/set/mod007-05_standard/right/discussion.rb +2 -1
  145. data/tmpsets/set/mod007-05_standard/right/email.rb +2 -1
  146. data/tmpsets/set/mod007-05_standard/right/password.rb +2 -1
  147. data/tmpsets/set/mod007-05_standard/right/salt.rb +2 -1
  148. data/tmpsets/set/mod007-05_standard/right/stats.rb +2 -1
  149. data/tmpsets/set/mod007-05_standard/right/status.rb +2 -1
  150. data/tmpsets/set/mod007-05_standard/right/token.rb +2 -1
  151. data/tmpsets/set/mod007-05_standard/right/when_created.rb +2 -1
  152. data/tmpsets/set/mod007-05_standard/right/when_last_edited.rb +2 -1
  153. data/tmpsets/set/mod007-05_standard/rstar/rules.rb +2 -1
  154. data/tmpsets/set/mod007-05_standard/self/account_links.rb +2 -1
  155. data/tmpsets/set/mod007-05_standard/self/alerts.rb +2 -1
  156. data/tmpsets/set/mod007-05_standard/self/all.rb +2 -1
  157. data/tmpsets/set/mod007-05_standard/self/foot.rb +2 -1
  158. data/tmpsets/set/mod007-05_standard/self/head.rb +2 -2
  159. data/tmpsets/set/mod007-05_standard/self/navbox.rb +2 -1
  160. data/tmpsets/set/mod007-05_standard/self/now.rb +2 -1
  161. data/tmpsets/set/mod007-05_standard/self/recent.rb +2 -1
  162. data/tmpsets/set/mod007-05_standard/self/search.rb +2 -1
  163. data/tmpsets/set/mod007-05_standard/self/signin.rb +45 -36
  164. data/tmpsets/set/mod007-05_standard/self/stats.rb +2 -1
  165. data/tmpsets/set/mod007-05_standard/self/version.rb +2 -1
  166. data/tmpsets/set/mod007-05_standard/type/basic.rb +2 -1
  167. data/tmpsets/set/mod007-05_standard/type/cardtype.rb +2 -1
  168. data/tmpsets/set/mod007-05_standard/type/date.rb +2 -1
  169. data/tmpsets/set/mod007-05_standard/type/file.rb +11 -3
  170. data/tmpsets/set/mod007-05_standard/type/image.rb +2 -1
  171. data/tmpsets/set/mod007-05_standard/type/layout_type.rb +2 -1
  172. data/tmpsets/set/mod007-05_standard/type/number.rb +2 -1
  173. data/tmpsets/set/mod007-05_standard/type/phrase.rb +2 -1
  174. data/tmpsets/set/mod007-05_standard/type/search_type.rb +70 -64
  175. data/tmpsets/set/mod007-05_standard/type/session.rb +2 -1
  176. data/tmpsets/set/mod007-05_standard/type/set.rb +2 -1
  177. data/tmpsets/set/mod007-05_standard/type/signup.rb +96 -64
  178. data/tmpsets/set/mod007-05_standard/type/toggle.rb +2 -1
  179. data/tmpsets/set/mod007-05_standard/type/uri.rb +2 -1
  180. data/tmpsets/set/mod007-05_standard/type/user.rb +50 -40
  181. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/form.rb +2 -1
  182. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/helper.rb +2 -1
  183. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/wrapper.rb +2 -1
  184. data/tmpsets/set/mod008-06_bootstrap/all/rich_bootstrap.rb +2 -1
  185. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_cards.rb +2 -1
  186. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_js.rb +2 -1
  187. data/tmpsets/set/mod008-06_bootstrap/self/bootswatch_shared.rb +2 -1
  188. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_css.rb +2 -1
  189. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_js.rb +2 -1
  190. metadata +2 -2
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Right; module Token; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/token.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Right; module Token; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/token.rb ~~~~~~~~~~~
3
4
  include All::Permissions::Accounts
4
5
 
5
6
  view :raw do |args|
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Right; module WhenCreated; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/when_created.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Right; module WhenCreated; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/when_created.rb ~~~~~~~~~~~
3
4
  view :raw do |args|
4
5
  card.left.new_card? ? '' : card.left.created_at.strftime('%A, %B %d, %Y %I:%M %p %Z')
5
6
  end
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Right; module WhenLastEdited; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/when_last_edited.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Right; module WhenLastEdited; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/when_last_edited.rb ~~~~~~~~~~~
3
4
  view :raw do |args|
4
5
  card.left.new_card? ? '' : card.left.updated_at.strftime('%A, %B %d, %Y %I:%M %p %Z')
5
6
  end
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Rstar; module Rules; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/rstar/rules.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Rstar; module Rules; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/rstar/rules.rb ~~~~~~~~~~~
3
4
  event :save_recently_edited_settings, before: :extend, on: :save, when: proc{|c| c.is_rule? } do
4
5
  if (recent = Card[:recent_settings])
5
6
  recent.insert_item 0, cardname.right
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module AccountLinks; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/account_links.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module AccountLinks; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/account_links.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
 
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Alerts; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/alerts.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Alerts; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/alerts.rb ~~~~~~~~~~~
3
4
 
4
5
  view :raw do |args|
5
6
  '<!-- *alerts is deprecated. please remove from layout -->'
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module All; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/all.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module All; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/all.rb ~~~~~~~~~~~
3
4
 
4
5
  event :admin_tasks, on: :update, before: :approve do
5
6
  if task = Env.params[:task]
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Foot; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/foot.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Foot; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/foot.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
  view :raw do |args|
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Head; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/head.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Head; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/head.rb ~~~~~~~~~~~
3
4
  format :html do
4
5
 
5
6
  view :raw do |args|
@@ -86,7 +87,6 @@ format :html do
86
87
  elsif script_card
87
88
  javascript_include_tag script_card.machine_output_url
88
89
  end
89
-
90
90
  ie9_card = Card[:script_html5shiv_printshiv]
91
91
  %(#{ javascript_tag do varvals * ';' end }
92
92
  #{ @js_tag if @js_tag }
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Navbox; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/navbox.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Navbox; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/navbox.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
 
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Now; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/now.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Now; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/now.rb ~~~~~~~~~~~
3
4
 
4
5
  view :raw do |args|
5
6
  Time.now.strftime '%A, %B %d, %Y %I:%M %p %Z'
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Recent; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/recent.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Recent; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/recent.rb ~~~~~~~~~~~
3
4
 
4
5
  view :title do |args|
5
6
  super args.merge( title: 'Recent Changes' )
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Search; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/search.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Search; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/search.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
 
@@ -1,8 +1,8 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Signin; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/signin.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Signin; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/signin.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
-
6
6
  view :open do |args|
7
7
  args.merge! optional_help: :show
8
8
  super args
@@ -14,84 +14,93 @@ format :html do
14
14
 
15
15
  view :open_content do |args|
16
16
  # annoying step designed to avoid table of contents. sigh
17
- _render_core( args )
17
+ _render_core(args)
18
18
  end
19
19
 
20
- view :closed_content do |args|
20
+ view :closed_content do |_args|
21
21
  ''
22
22
  end
23
23
 
24
24
  def default_core_args args={}
25
25
  args[:buttons] = button_tag 'Sign in', situation: 'primary'
26
26
  if Card.new(type_id: Card::SignupID).ok? :create
27
- args[:buttons] += link_to( '...or sign up!', card_path("account/signup"))
27
+ args[:buttons] += link_to('...or sign up!', card_path('account/signup'))
28
28
  end
29
- args[:buttons] += raw("<div style='float:right'>#{ view_link 'RESET PASSWORD', :edit, path_opts: {slot: {hide: :toolbar}} }</div>") #FIXME - hardcoded styling
29
+ args[:buttons] += raw(
30
+ "<div style='float:right'>" \
31
+ "#{ view_link 'RESET PASSWORD', :edit,
32
+ path_opts: { slot: { hide: :toolbar } } }" \
33
+ '</div>') # FIXME: hardcoded styling
30
34
  args
31
35
  end
32
36
 
33
37
  view :core do |args|
34
- account = card.fetch trait: :account, new: {}
35
38
  form_args = {
36
39
  hidden: { success: "REDIRECT: #{Env.interrupted_action || '*previous'}" },
37
40
  recaptcha: :off
38
41
  }
39
-
40
42
  with_inclusion_mode :edit do
41
43
  card_form :update, form_args do
42
44
  [
43
- Auth.as_bot do
44
- subformat(account)._render :content_formgroup, structure: true, items: {autocomplete: 'on'}
45
- end,
46
- _optional_render( :button_formgroup, args )
45
+ _optional_render(:content_formgroup, args.merge(structure: true)),
46
+ _optional_render(:button_formgroup, args)
47
47
  ].join
48
48
  end
49
49
  end
50
50
  end
51
51
 
52
- #FORGOT PASSWORD
52
+ # FORGOT PASSWORD
53
53
  view :edit do |args|
54
- args.merge!( {
54
+ @forgot_password = true
55
+ args.merge!(
55
56
  title: 'Forgot Password',
56
57
  optional_help: :hide,
57
- buttons: button_tag( 'Reset my password', situation: 'primary' ),
58
+ buttons: button_tag('Reset my password', situation: 'primary'),
58
59
  structure: true,
59
60
  hidden: {
60
61
  reset_password: true,
61
62
  success: { view: :reset_password_success }
62
63
  }
63
- } )
64
+ )
64
65
 
65
66
  Auth.as_bot { super args }
66
67
  end
67
68
 
68
- view :raw do |args|
69
- '{{+*email|title:email;type:Phrase}}'
69
+ view :raw do |_args|
70
+ if @forgot_password
71
+ "{{+#{Card[:email].name}|title:email;type:Phrase}}"
72
+ else
73
+ %(
74
+ {{+#{Card[:email].name}|titled;title:email}}
75
+ {{+#{Card[:password].name}|titled;title:password}}
76
+ )
77
+ end
70
78
  end
71
79
 
72
- view :reset_password_success do |args|
80
+ view :reset_password_success do |_args|
73
81
  frame { 'Check your email for a link to reset your password' }
74
82
  end
75
-
76
83
  end
77
84
 
78
85
  event :signin, before: :approve, on: :update do
79
- email = subcards["+#{Card[:email ].name}"]
80
- email &&= email['content']
81
- pword = subcards["+#{Card[:password].name}"]
82
- pword &&= pword['content']
86
+ email = subfield :email
87
+ email &&= email.content
88
+ pword = subfield :password
89
+ pword &&= pword.content
83
90
 
84
91
  abort :failure, 'bad signin args' unless email && pword
85
92
 
86
- if signin_id = Auth.authenticate( email, pword )
93
+ if (signin_id = Auth.authenticate(email, pword))
87
94
  Auth.signin signin_id
88
95
  else
89
- accted = Auth[ email.strip.downcase ]
90
- errors.add :signin, case
91
- when accted.nil? ; "Unrecognized email."
92
- when !accted.account.active? ; "Sorry, that account is not active."
93
- else ; "Wrong password"
96
+ accted = Auth[email.strip.downcase]
97
+ error_msg =
98
+ case
99
+ when accted.nil? then 'Unrecognized email.'
100
+ when !accted.account.active? then 'Sorry, that account is not active.'
101
+ else 'Wrong password'
94
102
  end
103
+ errors.add :signin, error_msg
95
104
  abort :failure
96
105
  end
97
106
  end
@@ -100,11 +109,13 @@ event :signin_success, after: :signin do
100
109
  abort :success
101
110
  end
102
111
 
103
- event :send_reset_password_token, before: :signin, on: :update, when: proc{ |c| Env.params[:reset_password] } do
104
- email = subcards["+#{Card[:email].name}"]
105
- email &&= email['content']
112
+ event :send_reset_password_token,
113
+ before: :signin, on: :update,
114
+ when: proc { Env.params[:reset_password] } do
115
+ email = subfield :email
116
+ email &&= email.content
106
117
 
107
- if accted = Auth[ email.strip.downcase ] and accted.account.active?
118
+ if (accted = Auth[email.strip.downcase]) && accted.account.active?
108
119
  accted.account.send_reset_password_token
109
120
  abort :success
110
121
  else
@@ -123,7 +134,5 @@ event :signout, before: :approve, on: :delete do
123
134
  end
124
135
 
125
136
 
126
-
127
-
128
137
  # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/signin.rb ~~~~~~~~~~~
129
138
  end;end;end;end;
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Stats; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/stats.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Stats; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/stats.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
  view :core do |args|
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module Version; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/version.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module Version; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/self/version.rb ~~~~~~~~~~~
3
4
  # -*- encoding : utf-8 -*-
4
5
  require_dependency 'card/version'
5
6
 
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Basic; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/basic.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Basic; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/basic.rb ~~~~~~~~~~~
3
4
  format :html do
4
5
  view :open_content do |args|
5
6
  content = _render_core args
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Cardtype; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/cardtype.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Cardtype; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/cardtype.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
 
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Date; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/date.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Date; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/date.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
 
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module File; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/file.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module File; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/file.rb ~~~~~~~~~~~
3
4
  attachment :file, uploader: FileUploader
4
5
 
5
6
  module SelectedAction
@@ -89,9 +90,11 @@ format :html do
89
90
  end
90
91
 
91
92
  view :preview_editor, tags: :unknown_ok do |args|
93
+ cached_upload_card_name = Card::Env.params[:attachment_upload]
94
+ cached_upload_card_name.gsub!(/\[\w+\]$/, "[cached_upload]")
92
95
  <<-HTML
93
96
  <div class="chosen-file">
94
- <input type="hidden" name="cached_upload" value="#{card.selected_action_id}">
97
+ <input type="hidden" name="#{cached_upload_card_name}" value="#{card.selected_action_id}">
95
98
  <table role="presentation" class="table table-striped"><tbody class="files">
96
99
  <tr class="template-download fade in">
97
100
  <td>
@@ -128,7 +131,12 @@ format :html do
128
131
  <span>
129
132
  #{card.new_card? ? 'Add' : 'Replace'} #{card.attachment_name}...
130
133
  </span>
131
- #{file_field card.attachment_name, class: 'file-upload slotter'}
134
+ <input class="file-upload slotter form-control" type="file"
135
+ name="card[#{card.type_code}]" id="card_#{card.type_code}">
136
+ #{hidden_field_tag 'attachment_type_id', card.type_id}
137
+ #{hidden_field card.attachment_name, class: "attachment_card_name",
138
+ value: ''}
139
+ #{hidden_field_tag 'file_card_name', card.cardname.url_key}
132
140
  </span>
133
141
  </div>
134
142
  <div id="progress" class="progress" style="display: none;">
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Image; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/image.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Image; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/image.rb ~~~~~~~~~~~
3
4
  attachment :image, uploader: ImageUploader
4
5
 
5
6
  include File::SelectedAction
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module LayoutType; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/layout_type.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module LayoutType; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/layout_type.rb ~~~~~~~~~~~
3
4
  # -*- encoding : utf-8 -*-
4
5
  include Html
5
6
 
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Number; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/number.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Number; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/number.rb ~~~~~~~~~~~
3
4
 
4
5
  view :editor do |args|
5
6
  text_field :content, class: 'card-content'
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Phrase; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/phrase.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Phrase; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/phrase.rb ~~~~~~~~~~~
3
4
  view :editor do |args|
4
5
  text_field :content, class: 'card-content'
5
6
  end
@@ -1,13 +1,13 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module SearchType; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/search_type.rb ~~~~~~~~~~~
3
-
2
+ class Card; module Set; module Type; module SearchType; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/search_type.rb ~~~~~~~~~~~
4
4
 
5
5
  def item_cards params={}
6
6
  s = query(params)
7
- raise("OH NO.. no limit") unless s[:limit]
7
+ raise('OH NO.. no limit') unless s[:limit]
8
8
  # forces explicit limiting
9
9
  # can be 0 or less to force no limit
10
- Card.search( s )
10
+ Card.search(s)
11
11
  end
12
12
 
13
13
  def item_names params={}
@@ -15,11 +15,12 @@ def item_names params={}
15
15
  end
16
16
 
17
17
  def item_type
18
+ return if query[:type].is_a?(Array) || query[:type].is_a?(Hash)
18
19
  query[:type]
19
20
  end
20
21
 
21
22
  def count params={}
22
- Card.count_by_wql query( params )
23
+ Card.count_by_wql query(params)
23
24
  end
24
25
 
25
26
  def query params={}
@@ -28,47 +29,50 @@ def query params={}
28
29
  end
29
30
 
30
31
  def get_query params={}
31
- query = Auth.as_bot do ## why is this a wagn_bot thing? can't deny search content??
32
+ # why is this a wagn_bot thing? can't deny search content??
33
+ query = Auth.as_bot do
32
34
  query_content = params.delete(:query) || raw_content
33
- if query_content.empty?
35
+ case
36
+ when query_content.empty?
34
37
  raise JSON::ParserError,
35
- "Error in card '#{self.name}':can't run search with empty content"
38
+ "Error in card '#{name}':can't run search with empty content"
39
+ when query_content.is_a?(String)
40
+ JSON.parse(query_content)
41
+ else query_content
36
42
  end
37
- String === query_content ? JSON.parse( query_content ) : query_content
38
43
  end
39
44
  query.symbolize_keys!.merge! params.symbolize_keys
40
- if default_limit = query.delete(:default_limit) and !query[:limit]
41
- query[:limit] = default_limit
45
+ if (default_limit = query.delete(:default_limit))
46
+ query[:limit] ||= default_limit
42
47
  end
43
48
  query[:context] ||= cardname
44
49
  query
45
50
  end
46
51
 
47
-
48
-
49
-
50
52
  format do
51
-
53
+ # rubocop:disable Style/ExtraSpacing
52
54
  view :core do |args|
53
- view = case search_results args
54
- when Exception ; :search_error
55
- when Integer ; :search_count
56
- when @mode == :template ; :raw
57
- else ; :card_list
55
+ view =
56
+ case search_results args
57
+ when Exception then :search_error
58
+ when Integer then :search_count
59
+ when @mode == :template then :raw
60
+ else :card_list
58
61
  end
59
62
  _render view, args
60
63
  end
64
+ # rubocop:enable Style/ExtraSpacing
61
65
 
62
-
63
- view :search_count do |args|
66
+ view :search_count do |_args|
64
67
  search_results.to_s
65
68
  end
66
69
 
67
- view :search_error do |args|
68
- %{#{search_results.class.to_s} :: #{search_results.message} :: #{card.raw_content}}
70
+ view :search_error do |_args|
71
+ sr_class = search_results.class.to_s
72
+ %{#{sr_class} :: #{search_results.message} :: #{card.raw_content}}
69
73
  end
70
74
 
71
- view :card_list do |args|
75
+ view :card_list do |_args|
72
76
  if search_results.empty?
73
77
  'no results'
74
78
  else
@@ -82,8 +86,8 @@ format do
82
86
  @search_vars ||=
83
87
  begin
84
88
  v = {}
85
- v[:query] = card.query( search_params )
86
- v[:item] = set_inclusion_opts args.merge( query_view: v[:query][:view] )
89
+ v[:query] = card.query(search_params)
90
+ v[:item] = set_inclusion_opts args.merge(query_view: v[:query][:view])
87
91
  v
88
92
  rescue JSON::ParserError => e
89
93
  { error: e }
@@ -96,9 +100,13 @@ format do
96
100
  if search_vars[:error]
97
101
  search_vars[:error]
98
102
  else
99
- raw_results = card.item_cards search_params
100
- is_count = search_vars[:query][:return] =='count'
101
- is_count ? raw_results.to_i : raw_results
103
+ begin
104
+ raw_results = card.item_cards search_params
105
+ is_count = search_vars[:query][:return] == 'count'
106
+ is_count ? raw_results.to_i : raw_results
107
+ rescue BadQuery => e
108
+ e
109
+ end
102
110
  end
103
111
  end
104
112
  end
@@ -108,7 +116,7 @@ format do
108
116
  begin
109
117
  card.item_names search_params
110
118
  rescue => e
111
- { error: e}
119
+ { error: e }
112
120
  end
113
121
  end
114
122
 
@@ -121,13 +129,12 @@ format do
121
129
  def set_inclusion_opts args
122
130
  @inclusion_defaults = nil
123
131
  @inclusion_opts ||= {}
124
- @inclusion_opts[:view] = args[:item] || inclusion_opts[:view] || args[:query_view] || default_item_view
132
+ @inclusion_opts[:view] = args[:item] || inclusion_opts[:view] ||
133
+ args[:query_view] || default_item_view
125
134
  # explicit > inclusion syntax > WQL > inclusion defaults
126
135
  end
127
136
 
128
-
129
-
130
- def page_link text, page, current=false, options={}
137
+ def page_link text, page, _current=false, options={}
131
138
  @paging_path_args[:offset] = page * @paging_limit
132
139
  options.merge!(class: 'card-paging-link slotter', remote: true)
133
140
  link_to raw(text), path(@paging_path_args), options
@@ -146,11 +153,13 @@ format do
146
153
  end
147
154
 
148
155
  def previous_page_link page
149
- page_li '<span aria-hidden="true">&laquo;</span>', page, false, 'aria-label'=>"Previous"
156
+ page_li '<span aria-hidden="true">&laquo;</span>', page, false,
157
+ 'aria-label' => 'Previous'
150
158
  end
151
159
 
152
160
  def next_page_link page
153
- page_li '<span aria-hidden="true">&raquo;</span>', page, false, 'aria-label'=>"Next"
161
+ page_li '<span aria-hidden="true">&raquo;</span>', page, false,
162
+ 'aria-label' => 'Next'
154
163
  end
155
164
 
156
165
  def ellipse_page
@@ -162,10 +171,8 @@ format do
162
171
  end
163
172
  end
164
173
 
165
-
166
174
  format :data do
167
-
168
- view :card_list do |args|
175
+ view :card_list do |_args|
169
176
  search_results.map do |c|
170
177
  nest c
171
178
  end
@@ -192,13 +199,13 @@ end
192
199
  format :rss do
193
200
  view :feed_body do |args|
194
201
  case raw_feed_items args
195
- when Exception ; @xml.item { render :search_error }
196
- when Integer ; @xml.item { render :search_count }
202
+ when Exception then @xml.item(render :search_error)
203
+ when Integer then @xml.item(render :search_count)
197
204
  else super args
198
205
  end
199
206
  end
200
207
 
201
- def raw_feed_items args
208
+ def raw_feed_items _args
202
209
  @raw_feed_items ||= begin
203
210
  search_params.merge!(default_limit: 25)
204
211
  search_results
@@ -207,7 +214,6 @@ format :rss do
207
214
  end
208
215
 
209
216
  format :html do
210
-
211
217
  view :card_list do |args|
212
218
  paging = _optional_render :paging, args
213
219
 
@@ -234,42 +240,44 @@ format :html do
234
240
  end
235
241
  end
236
242
 
237
-
238
243
  view :closed_content do |args|
239
244
  if @depth > self.class.max_depth
240
- "..."
245
+ '...'
241
246
  else
242
247
  search_limit = args[:closed_search_limit]
243
- search_params[:limit] = search_limit && search_limit < Card.config.closed_search_limit ?
244
- search_limit : Card.config.closed_search_limit
245
- _render_core args.merge( hide: 'paging', item: :link )
246
- # TODO: if item is queryified to be "name", then that should work. otherwise use link
248
+ search_params[:limit] =
249
+ search_limit && [search_limit, Card.config.closed_search_limit].min
250
+ _render_core args.merge(hide: 'paging', item: :link)
251
+ # TODO: if item is queryified to be "name", then that should work.
252
+ # otherwise use link
247
253
  end
248
254
  end
249
255
 
250
256
  view :editor, mod: Html::HtmlFormat
251
257
 
252
- view :no_search_results do |args|
258
+ view :no_search_results do |_args|
253
259
  %{<div class="search-no-results"></div>}
254
260
  end
255
261
 
256
- view :paging do |args|
262
+ view :paging do |_args|
257
263
  s = card.query search_params
258
264
  offset, limit = s[:offset].to_i, s[:limit].to_i
259
265
  return '' if limit < 1
260
- return '' if offset==0 && limit > offset + search_results.length #avoid query if we know there aren't enough results to warrant paging
266
+ # avoid query if we know there aren't enough results to warrant paging
267
+ return '' if offset == 0 && limit > offset + search_results.length
261
268
  total = card.count search_params
262
- return '' if limit >= total # should only happen if limit exactly equals the total
269
+ # should only happen if limit exactly equals the total
270
+ return '' if limit >= total
263
271
 
264
272
  @paging_path_args = { limit: limit, item: inclusion_defaults(card)[:view] }
265
273
  @paging_limit = limit
266
274
 
267
275
  s[:vars].each { |key, value| @paging_path_args["_#{key}"] = value }
268
276
 
269
- out = ['<nav><ul class="pagination paging">' ]
277
+ out = ['<nav><ul class="pagination paging">']
270
278
 
271
- total_pages = ((total-1) / limit).to_i
272
- current_page = ( offset / limit).to_i # should already be integer
279
+ total_pages = ((total - 1) / limit).to_i
280
+ current_page = (offset / limit).to_i # should already be integer
273
281
  window = 2 # should be configurable
274
282
  window_min = current_page - window
275
283
  window_max = current_page + window
@@ -277,19 +285,19 @@ format :html do
277
285
  previous_page = current_page > 0 ? current_page - 1 : false
278
286
  out << previous_page_link(previous_page)
279
287
  if window_min > 0
280
- out << page_li( 1, 0 )
288
+ out << page_li(1, 0)
281
289
  out << ellipse_page if window_min > 1
282
290
  end
283
291
 
284
- (window_min .. window_max).each do |page|
285
- next if page < 0 or page > total_pages
292
+ (window_min..window_max).each do |page|
293
+ next if page < 0 || page > total_pages
286
294
  text = page + 1
287
- out << page_li( text, page, page==current_page )
295
+ out << page_li(text, page, page == current_page)
288
296
  end
289
297
 
290
298
  if total_pages > window_max
291
299
  out << ellipse_page if total_pages > window_max + 1
292
- out << page_li( total_pages + 1, total_pages )
300
+ out << page_li(total_pages + 1, total_pages)
293
301
  end
294
302
 
295
303
  next_page = current_page < total_pages ? current_page + 1 : false
@@ -302,10 +310,8 @@ format :html do
302
310
  def default_search_params
303
311
  set_default_search_params default_limit: 20
304
312
  end
305
-
306
313
  end
307
314
 
308
315
 
309
-
310
316
  # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/search_type.rb ~~~~~~~~~~~
311
317
  end;end;end;end;