Skip to content
Browse files

Remove spaces on develop so that the merges won't show them anymore

  • Loading branch information...
1 parent fd98166 commit 35df7fcd39afa800104b8dda2477232d531e2823 Gerry Gleason committed
Showing with 1,685 additions and 1,690 deletions.
  1. +2 −2 app/assets/javascripts/application.js
  2. +29 −29 app/assets/javascripts/wagn.js.coffee
  3. +17 −18 app/assets/javascripts/wagn_pack.js.coffee
  4. +1 −1 app/assets/stylesheets/application-all.css
  5. +57 −57 app/assets/stylesheets/card.css
  6. +23 −23 app/assets/stylesheets/defaults.css
  7. +5 −5 app/assets/stylesheets/jquery-ui-smoothness.css
  8. +17 −17 app/assets/stylesheets/page.css
  9. +9 −9 app/assets/stylesheets/print.css
  10. +3 −3 app/assets/stylesheets/settings.css
  11. +2 −2 app/controllers/account_controller.rb
  12. +8 −8 app/controllers/admin_controller.rb
  13. +26 −26 app/controllers/application_controller.rb
  14. +8 −8 app/controllers/card_controller.rb
  15. +1 −1 app/controllers/stub_card_controller.rb
  16. +3 −3 app/helpers/location_helper.rb
  17. +4 −4 app/helpers/wagn_helper.rb
  18. +13 −13 app/mailers/mailer.rb
  19. +40 −40 app/models/card.rb
  20. +6 −6 app/models/card/reference.rb
  21. +3 −3 app/models/card/revision.rb
  22. +5 −5 app/models/session.rb
  23. +2 −2 app/models/user.rb
  24. +6 −6 app/views/account/_edit.erb
  25. +13 −13 app/views/account/invite.erb
  26. +5 −5 app/views/account/signin.erb
  27. +9 −9 app/views/account/signup.erb
  28. +4 −4 app/views/admin/setup.erb
  29. +2 −2 app/views/mailer/signup_alert.html.erb
  30. +20 −20 config/application.rb
  31. +2 −2 config/cruise/README
  32. +3 −3 config/cruise/cruise_builder.sh
  33. +2 −2 config/cruise/cruise_config.rb
  34. +3 −3 config/environments/development.rb
  35. +2 −2 config/environments/production.rb
  36. +1 −1 config/environments/profile.rb
  37. +6 −6 config/initializers/01_init_ruby_extensions.rb
  38. +1 −1 config/initializers/inflections.rb
  39. +5 −5 config/initializers/postgresql_schema_support.rb
  40. +6 −6 config/initializers/schema_views.rb
  41. +2 −2 config/routes.rb
  42. +7 −7 config/samples/database.yml.erb
  43. +4 −4 config/samples/wagn.yml
  44. +5 −5 features/autonaming.feature
  45. +7 −7 features/content_settings.feature
  46. +5 −6 features/flexmail.feature
  47. +6 −6 features/google_maps.feature
  48. +4 −5 features/hello_wagn.feature
  49. +2 −2 features/layouts.feature
  50. +10 −11 features/notifications.feature
  51. +5 −5 features/pattern_settings.feature
  52. +7 −7 features/pointer_inputs.feature
  53. +1 −1 features/presetting_content.feature
  54. +7 −7 features/step_definitions/notification_steps.rb
  55. +21 −21 features/step_definitions/wagn_steps.rb
  56. +7 −7 features/step_definitions/web_steps.rb
  57. +4 −4 features/support/env.rb
  58. +3 −3 features/support/paths.rb
  59. +4 −4 features/support/scopes.rb
  60. +8 −8 features/table_of_contents.feature
  61. +7 −8 features/templates.feature
  62. +10 −10 features/update_includers.feature
  63. +1 −1 features/virtual_cards.feature
  64. +12 −12 features/watch.feature
  65. +18 −18 lib/active_record/foreign_keys.rb
  66. +14 −14 lib/active_record/quoting_and_matching.rb
  67. +3 −3 lib/authenticated_system.rb
  68. +14 −14 lib/authenticated_test_helper.rb
  69. +12 −12 lib/chunk_manager.rb
  70. +8 −8 lib/chunks/chunk.rb
  71. +1 −1 lib/chunks/literal.rb
  72. +4 −4 lib/chunks/reference.rb
  73. +14 −14 lib/chunks/transclude.rb
  74. +29 −29 lib/chunks/uri.rb
  75. +36 −36 lib/diff.rb
  76. +3 −3 lib/generators/card_migration/USAGE
  77. +19 −19 lib/generators/card_migration/card_migration_generator.rb
  78. +8 −8 lib/old_modules/flexmail.rb
  79. +4 −4 lib/old_modules/google_maps_addon.rb
  80. +1 −1 lib/old_modules/notification.rb
  81. +4 −4 lib/packs/default/base_pack.rb
  82. +2 −2 lib/packs/default/csv_pack.rb
  83. +2 −2 lib/packs/default/kml_pack.rb
  84. +38 −38 lib/packs/default/rich_html_pack.rb
  85. +3 −3 lib/packs/default/rss_pack.rb
  86. +1 −1 lib/packs/default/text_pack.rb
  87. +5 −5 lib/packs/default/xml_pack.rb
  88. +2 −2 lib/packs/right/email_pack.rb
  89. +8 −8 lib/packs/right/permissions_pack.rb
  90. +5 −5 lib/packs/right/rstar_pack.rb
  91. +3 −3 lib/packs/right/template_pack.rb
  92. +4 −4 lib/packs/right/when_pack.rb
  93. +1 −1 lib/packs/self/account_links_pack.rb
  94. +12 −12 lib/packs/self/head_and_foot_pack.rb
  95. +1 −1 lib/packs/self/misc_pack.rb
  96. +9 −9 lib/packs/self/navbox_pack.rb
  97. +3 −3 lib/packs/type/account_request_pack.rb
  98. +1 −1 lib/packs/type/date_pack.rb
  99. +1 −1 lib/packs/type/etherpad_pack.rb
  100. +7 −7 lib/packs/type/file_and_image_pack.rb
  101. +1 −1 lib/packs/type/layout_pack.rb
  102. +3 −3 lib/packs/type/plaintext_phrase_html_and_number_pack.rb
  103. +12 −12 lib/packs/type/pointer_pack.rb
  104. +2 −2 lib/packs/type/ruby_and_script_pack.rb
  105. +21 −21 lib/packs/type/search_pack.rb
  106. +3 −3 lib/packs/type/setting_pack.rb
  107. +14 −14 lib/tasks/bootstrap.rake
  108. +2 −2 lib/tasks/cache.rake
  109. +2 −2 lib/tasks/cucumber.rake
  110. +3 −3 lib/tasks/db.rake
  111. +21 −21 lib/tasks/fixtures.rake
  112. +9 −9 lib/tasks/install.rake
  113. +1 −1 lib/tasks/restart_with_debug.rake
  114. +3 −3 lib/tasks/testspec.rake
  115. +2 −2 lib/tasks/update_references.rake
  116. +13 −13 lib/util/card_builder.rb
  117. +9 −9 lib/util/dumper.rb
  118. +27 −27 lib/util/loader.rb
  119. +8 −8 lib/wagn/cache.rb
  120. +29 −29 lib/wagn/cardname.rb
  121. +2 −2 lib/wagn/codename.rb
  122. +12 −12 lib/wagn/hook.rb
  123. +1 −1 lib/wagn/model.rb
  124. +11 −11 lib/wagn/model/attach.rb
  125. +18 −18 lib/wagn/model/attribute_tracking.rb
  126. +8 −8 lib/wagn/model/collection.rb
  127. +2 −2 lib/wagn/model/exceptions.rb
  128. +15 −15 lib/wagn/model/fetch.rb
  129. +11 −11 lib/wagn/model/pattern.rb
  130. +4 −4 lib/wagn/model/permissions.rb
  131. +14 −14 lib/wagn/model/references.rb
  132. +4 −4 lib/wagn/model/settings.rb
  133. +4 −4 lib/wagn/model/templating.rb
  134. +35 −35 lib/wagn/model/tracked_attributes.rb
  135. +4 −4 lib/wagn/model/traits.rb
  136. +1 −1 lib/wagn/pack.rb
  137. +77 −77 lib/wagn/renderer.rb
  138. +12 −12 lib/wagn/renderer/html.rb
  139. +1 −1 lib/wagn/renderer/text.rb
  140. +6 −6 lib/wagn/renderer/xml.rb
  141. +2 −2 lib/wagn/set/type/account_request.rb
  142. +2 −2 lib/wagn/set/type/basic.rb
  143. +1 −1 lib/wagn/set/type/cardtype.rb
  144. +1 −1 lib/wagn/set/type/etherpad.rb
  145. +2 −2 lib/wagn/set/type/number.rb
  146. +1 −1 lib/wagn/set/type/pointer.rb
  147. +1 −1 lib/wagn/set/type/search_type.rb
  148. +3 −3 lib/wagn/set/type/set.rb
  149. +5 −5 lib/wagn/version.rb
  150. +24 −24 lib/wiki_content.rb
  151. +112 −112 lib/wql.rb
  152. +18 −18 spec/controllers/captcha_spec.rb
  153. +41 −41 spec/controllers/card_controller_spec.rb
  154. +11 −11 spec/helpers/wagn_helper_spec.rb
  155. +1 −1 spec/javascripts/support/jasmine.yml
  156. +7 −7 spec/javascripts/wagn_spec.coffee
  157. +2 −2 spec/lib/if_card_spec.rb
  158. +1 −1 spec/lib/wagn/cache_spec.rb
  159. +42 −42 spec/lib/wagn/cardname_spec.rb
  160. +3 −3 spec/lib/wagn/codename_spec.rb
  161. +6 −6 spec/lib/wagn/hook_spec.rb
  162. +4 −4 spec/lib/wagn/model/fetch_spec.rb
  163. +17 −17 spec/lib/wagn/model/old_setting_spec.rb
  164. +11 −11 spec/lib/wagn/model/pattern_spec.rb
  165. +69 −69 spec/lib/wagn/model/permissions_spec.rb
  166. +4 −4 spec/lib/wagn/model/setting_spec.rb
  167. +19 −19 spec/lib/wagn/model/template_spec.rb
  168. +3 −3 spec/lib/wagn/model/traits_spec.rb
  169. +2 −2 spec/lib/wagn/pack_spec.rb
  170. +14 −14 spec/lib/wagn/renderer/xml_spec.rb
  171. +6 −6 spec/lib/wagn/renderer_spec.rb
Sorry, we could not display the entire diff because it was too big.
View
4 app/assets/javascripts/application.js
@@ -15,8 +15,8 @@
//= require wagn
-/*
-Note: I attempted to get tinymce up with tinymce-jquery,
+/*
+Note: I attempted to get tinymce up with tinymce-jquery,
but it overrode val() in ways that broke our filed updating / autosave
*/
View
58 app/assets/javascripts/wagn.js.coffee
@@ -11,7 +11,7 @@ wagn.prepUrl = (url, slot)->
xtra['main'] = main if main?
if slot
home_view = slot.attr 'home_view'
- item = slot.attr 'item'
+ item = slot.attr 'item'
xtra['home_view'] = home_view if home_view?
xtra['item'] = item if item?
xtra['is_main'] = true if slot.isMain()
@@ -19,7 +19,7 @@ wagn.prepUrl = (url, slot)->
jQuery.fn.extend {
slot: -> @closest '.card-slot'
-
+
setSlotContent: (val) ->
s = @slot()
v = $(val)
@@ -27,8 +27,8 @@ jQuery.fn.extend {
v.attr 'item', s.attr 'item'
s.replaceWith v
v
-
- notify: (message) ->
+
+ notify: (message) ->
notice = @slot().find '.card-notice'
return false unless notice[0]
notice.html message
@@ -41,9 +41,9 @@ jQuery.fn.extend {
report.html message
report.show 'drop', 750
setTimeout (->report.hide 'drop', 750), 3000
-
+
isMain: -> @slot().parent('#main')[0]
-
+
loadCaptcha: -> Recaptcha.create wagn.recaptchaKey, this[0]
autosave: ->
@@ -58,7 +58,7 @@ jQuery.fn.extend {
reportee = ''
#might be better to put this href base in the html
-
+
$.ajax wagn.rootPath + '/card/save_draft/~' + id, {
data : { 'card[content]' : @val() },
type : 'POST',
@@ -68,17 +68,17 @@ jQuery.fn.extend {
setContentFieldsFromMap: (map) ->
map = wagn.editorContentFunctionMap unless map?
this_form = $(this)
- $.each map, (selector, fn)->
+ $.each map, (selector, fn)->
this_form.setContentFields(selector, fn)
setContentFields: (selector, fn) ->
$.each @find(selector), ->
- $(this).setContentField(fn)
+ $(this).setContentField(fn)
setContentField: (fn)->
field = @closest('.card-editor').find('.card-content')
init_val = field.val() # tinymce-jquery overrides val(); that's why we're not using it.
new_val = fn.call this
field.val new_val
- field.change() if init_val != new_val
+ field.change() if init_val != new_val
}
#~~~~~ ( EVENTS )
@@ -87,10 +87,10 @@ setInterval (-> $('.card-form').setContentFieldsFromMap()), 20000
$(window).ready ->
$.ajaxSetup cache: false
-
+
setTimeout (-> wagn.initializeEditors $('body')), 10
# dislike the timeout, but without this forms with multiple TinyMCE editors were failing to load properly
-
+
$('body').delegate '.slotter', "ajax:success", (event, data) ->
newslot = $(this).setSlotContent data
wagn.initializeEditors newslot
@@ -103,30 +103,30 @@ $(window).ready ->
$(this).setSlotContent result
else
$(this).notify result
-
+
s = $(this).slot()
if xhr.status == 409 #edit conflict
s.find('.current_revision_id').val s.find('.new-current-revision-id').text()
else if xhr.status == 449
s.find('.recaptcha-box').loadCaptcha()
-
-
+
+
$('body').delegate 'button.slotter', 'click', (event)->
return false if !$.rails.allowAction $(this)
$.rails.handleRemote($(this))
$('.slotter').live 'ajax:beforeSend', (event, xhr, opt)->
return if opt.skip_before_send
-
+
unless opt.url.match /home_view/ #avoiding duplication. could be better test?
opt.url = wagn.prepUrl opt.url, $(this).slot()
-
+
if $(this).is('form')
if wagn.recaptchaKey and $(this).attr('recaptcha')=='on' and !($(this).find('.recaptcha-box')[0])
newCaptcha(this)
return false
-
+
if data = $(this).data 'file-data'
# NOTE - this entire solution is temporary.
input = $(this).find '.file-upload'
@@ -134,7 +134,7 @@ $(window).ready ->
$(this).notify "Wagn does not yet support multiple files in a single form."
return false
widget = input.data 'fileupload' #jQuery UI widget
-
+
unless widget._isXHRUpload(widget.options) # browsers that can't do ajax uploads use iframe
$(this).find('[name=success]').val('TO-CARD') # can't do normal redirects.
# iframe response not passed back; all responses treated as success. boo
@@ -143,11 +143,11 @@ $(window).ready ->
iframeUploadFilter = (data)-> data.find('body').html()
opt.dataFilter = iframeUploadFilter
# gets rid of default html and body tags
-
+
args = $.extend opt, (widget._getAJAXSettings data), url: opt.url
- # combines settings from wagn's slotter and jQuery UI's upload widget
+ # combines settings from wagn's slotter and jQuery UI's upload widget
args.skip_before_send = true #avoid looping through this method again
-
+
$.ajax( args )
false
@@ -155,10 +155,10 @@ $(window).ready ->
$(this).setContentFieldsFromMap()
$(this).find('.card-content').attr('no-autosave','true')
true
-
+
$('body').delegate 'button.redirecter', 'click', ->
window.location = $(this).attr('href')
-
+
unless wagn.noDoubleClick
$('.card-slot').live 'dblclick', (event)->
s = $(this)
@@ -177,7 +177,7 @@ $(window).ready ->
input = $(this).find '[name=success]'
if input and !(input.val().match /^REDIRECT/)
input.val ( if target == 'REDIRECT' then target + ': ' + input.val() else target )
-
+
#more of this info should be in views; will need to refactor for HTTP DELETE anyway...
$('.card-slot').delegate '.standard-delete', 'click', ->
return if $(this).attr('success-ready') == 'true' #prevent double-click weirdness
@@ -199,12 +199,12 @@ $(window).ready ->
$('.autosave .card-content').live 'change', ->
content_field = $(this)
setTimeout ( -> content_field.autosave() ), 500
-
+
$('.go-to-selected select').live 'change', ->
- val = $(this).val()
+ val = $(this).val()
if val != ''
window.location = wagn.rootPath + escape( val )
-
+
$('[hover_content]').live 'mouseenter', ->
$(this).attr 'hover_restore', $(this).html()
$(this).html $(this).attr( 'hover_content' )
@@ -218,5 +218,5 @@ newCaptcha = (form)->
$.getScript recapUri, -> recapDiv.loadCaptcha()
-
+
warn = (stuff) -> console.log stuff if console?
View
35 app/assets/javascripts/wagn_pack.js.coffee
@@ -18,29 +18,29 @@ wagn.editorInitFunctionMap = {
'.etherpad-textarea' : -> $(this).closest('form').find('.edit-submit-button').attr('class', 'etherpad-submit-button')
}
-wagn.initPointerList = (input)->
+wagn.initPointerList = (input)->
optionsCard = input.closest('ul').attr('options-card')
input.autocomplete { source: wagn.prepUrl wagn.rootPath + '/' + optionsCard + '.json?view=name_complete' }
wagn.initTinyMCE = (el_id) ->
# verify_html: false -- note: this option needed for empty paragraphs to add space.
-
+
conf = if wagn.tinyMCEConfig? then wagn.tinyMCEConfig else {}
- $.extend conf, {
+ $.extend conf, {
mode: 'exact'
plugins: 'autoresize'
autoresize_max_height: 500 #probably want to make several of these overridable....
- elements: el_id
+ elements: el_id
content_css: wagn.rootPath + '/assets/application-all.css' + ',' + wagn.rootPath + wagn.local_css_path
entity_encoding: 'raw'
- }
+ }
tinyMCE.init conf
wagn.chooseFile = (e, data) ->
file = data.files[0]
$(this).fileupload '_normalizeFile', 0, file # so file objects have same fields in all browsers
$(this).closest('form').data 'file-data', data # stores data on form for use at submission time
-
+
if name_field = $(this).slot().find( '.card-name-field' )
# populates card name if blank
if name_field[0] and name_field.val() == ''
@@ -50,11 +50,11 @@ wagn.chooseFile = (e, data) ->
editor.find('.choose-file').hide()
editor.find('.chosen-filename').text file.name
editor.find('.chosen-file').show()
-
+
contentFieldName = this.name.replace( /attach\]$/, 'content]' )
editor.append '<input type="hidden" value="CHOSEN" class="upload-card-content" name="' + contentFieldName + '">'
- # we add and remove the contentField to insure that nothing is added / updated when nothing is chosen.
-
+ # we add and remove the contentField to insure that nothing is added / updated when nothing is chosen.
+
$(window).ready ->
@@ -70,7 +70,7 @@ $(window).ready ->
html: 'html',
source: navbox_results,
select: navbox_select
- # autoFocus: true,
+ # autoFocus: true,
# this makes it so the first option ("search") is pre-selected.
# sadly, it also causes odd navbox behavior, resetting the search term
}
@@ -82,7 +82,7 @@ $(window).ready ->
input = new_item.find('input')
input.val ''
last_item.after new_item
- wagn.initPointerList(input)
+ wagn.initPointerList(input)
event.preventDefault() # Prevent link from following its href
$('.pointer-item-delete').live 'click', ->
@@ -96,7 +96,7 @@ $(window).ready ->
# permissions pack
$('.perm-vals input').live 'click', ->
$(this).slot().find('#inherit').attr('checked',false)
-
+
$('.perm-editor #inherit').live 'click', ->
slot = $(this).slot()
slot.find('.perm-group input:checked').attr('checked', false)
@@ -134,7 +134,7 @@ $(window).ready ->
$(wagn.padform)[0].submit()
false
-
+
permissionsContent = (ed) ->
return '_left' if ed.find('#inherit').attr('checked')
groups = ed.find('.perm-group input:checked').map( -> $(this).val() )
@@ -155,7 +155,7 @@ navbox_results = (request, response) ->
view_field.val 'complete'
formData = f.serialize()
view_field.val orig_view
-
+
this.xhr = $.ajax {
url: wagn.prepUrl wagn.rootPath + '/:search.json'
data: formData
@@ -184,10 +184,10 @@ navboxize = (term, results)->
items.push i
$.each results['goto'], (index, val) ->
- items.push { type: 'goto', prefix: 'go to', value: val[0], label: val[1], href: '/' + val[2] }
+ items.push { type: 'goto', prefix: 'go to', value: val[0], label: val[1], href: '/' + val[2] }
$.each items, (index, i) ->
- i.label =
+ i.label =
'<span class="navbox-item-label '+ i.type + '-icon">' + i.prefix + ':</span> ' +
'<span class="navbox-item-value">' + i.label + '</span>'
@@ -198,6 +198,5 @@ navbox_select = (event, ui) ->
$(this).closest('form').submit()
else
window.location = wagn.rootPath + ui.item.href
-
+
$(this).attr('disabled', 'disabled')
-
View
2 app/assets/stylesheets/application-all.css
@@ -6,5 +6,5 @@
*= require defaults
*= require card
*= require settings
-
+
*/
View
114 app/assets/stylesheets/card.css
@@ -26,14 +26,14 @@ html>body .open-view {
.card-slot,
.ALL {
overflow: hidden;
- white-space: normal;
+ white-space: normal;
}
/*----- header ---------*/
.card-header {
background: #005800;
- padding: 5px;
+ padding: 5px;
margin: 0px;
-moz-border-radius: 6px 6px 0 0;
border-radius: 6px 6px 0 0;
@@ -42,7 +42,7 @@ html>body .open-view {
.title-menu {
line-height: 18px;
}
-.title {
+.title {
margin: 0px 2px;
font-weight: bold;
font-size: 13px;
@@ -69,7 +69,7 @@ html>body .card-header a.page-icon {
background-image: url(page.png);
}
-
+
/* FIXE: these need the IE gifs as well */
@@ -83,20 +83,20 @@ html>body .card-header a.page-icon {
float: left;
width: 50px;
padding: 3px 0 3px 25px;
- background: left no-repeat;
+ background: left no-repeat;
}
.search-icon { background-image: url(search.png); }
.add-icon { background-image: url(plus.png); }
.goto-icon { background-image: url(page.png); }
-.cardtype {
+.cardtype {
font-style: italic;
font-size: 10px;
}
.card-header,
.card-header a {
- color: #fff
+ color: #fff
}
html>body .card-menu-left,
html>body .page-icon {
@@ -117,7 +117,7 @@ div:hover.card-header .card-menu-left {
right: 0px;
z-index: 1;
}
-.card-menu li {
+.card-menu li {
padding: 1px 5px;
margin: 0px;
-moz-border-radius: 4px 4px 0 0;
@@ -176,19 +176,19 @@ div:hover.card-header .card-menu-left {
border-radius: 0px 0px 6px 6px;
}
html>body .card-footer .footer-content {
- display: none;
+ display: none;
}
div:hover.card-footer .footer-content {
display: inline;
-}
+}
.card-footer .footer-content {
- width: 100%;
-}
+ width: 100%;
+}
.card-footer .watch-view {
float: right;
text-align: right;
white-space: nowrap;
-}
+}
/*------------- TABS -------*/
@@ -198,20 +198,20 @@ div:hover.card-footer .footer-content {
.faint {
color: #bbc;
}
-.joint {
- color: #960;
+.joint {
+ color: #960;
}
-a.wanted-card {
- color: #900
+a.wanted-card {
+ color: #900
}
-a.external-link,
-.closed-content a.external-link {
- color: #979;
+a.external-link,
+.closed-content a.external-link {
+ color: #979;
background: url(external_link.png) center right no-repeat;
padding-right: 13px !important;
}
-a.email-link {
- color: #979
+a.email-link {
+ color: #979
}
.missing-view a {
color: #99b;
@@ -223,12 +223,12 @@ a.email-link {
background: #ffc;
}
-.content-view p,
-.content-view span,
-.content-view a,
-.content-view ul,
-.content-view ol,
-.content-view h1,
+.content-view p,
+.content-view span,
+.content-view a,
+.content-view ul,
+.content-view ol,
+.content-view h1,
.content-view h2 {
background-color: inherit;
-moz-border-radius: inherit;
@@ -236,7 +236,7 @@ a.email-link {
}
-/* note: ".card-slot .content-view div not(.editor)" was not working properly and was breaking nested block elements.
+/* note: ".card-slot .content-view div not(.editor)" was not working properly and was breaking nested block elements.
without it nested divs in content-view areas probably won't highlight */
@@ -405,11 +405,11 @@ div.content-view {
.revision-navigation span {
margin: 0px 10px
}
-ins.diffmod,
+ins.diffmod,
.diffins {
background: #aea;
}
-del.diffmod,
+del.diffmod,
.diffdel {
background: #eaa;
}
@@ -482,7 +482,7 @@ del.diffmod,
#secondary .card-menu {
- display: none;
+ display: none;
float:none; /* necessary for IE */
}
@@ -537,30 +537,30 @@ body#wagn .card-slot.recent-changes h2 {
padding-right: 0px;
}
.closed-content,
-.closed-content tr,
-.closed-content td,
+.closed-content tr,
+.closed-content td,
.closed-content p,
-.closed-content h1,
-.closed-content h2,
-.closed-content h3,
-.closed-content h4,
-.closed-content h5,
-.closed-content h6,
-.closed-content ul,
+.closed-content h1,
+.closed-content h2,
+.closed-content h3,
+.closed-content h4,
+.closed-content h5,
+.closed-content h6,
+.closed-content ul,
.closed-content li,
-.closed-content pre,
-.closed-content ol,
-.closed-content hr,
-.closed-content div,
+.closed-content pre,
+.closed-content ol,
+.closed-content hr,
+.closed-content div,
.closed-content span,
.closed-content a,
.closed-content blockquote {
- display: inline !important;
- margin: 0px 4px;
+ display: inline !important;
+ margin: 0px 4px;
padding: 0px !important;
border: 0px !important;
- font-size: 11px !important;
- white-space: nowrap !important;
+ font-size: 11px !important;
+ white-space: nowrap !important;
float: none !important;
}
.closed-content a {
@@ -572,7 +572,7 @@ body#wagn .card-slot.recent-changes h2 {
float: none;
padding: 0px;
}
-.closed-content br,
+.closed-content br,
.closed-content hr,
.closed-content input,
.closed-content textarea,
@@ -619,11 +619,11 @@ body#wagn .card-slot.recent-changes h2 {
margin: 0px 0px 0px 40px;
}
.table-of-contents ol {
- list-style-type: upper-roman;
+ list-style-type: upper-roman;
}
.table-of-contents ol ol {
list-style-type: upper-alpha;
- padding-left: 25px
+ padding-left: 25px
}
/*-------------( Pointer )--------*/
@@ -656,7 +656,7 @@ body#wagn .card-slot.recent-changes h2 {
/*---------( Search ) ---------- */
.search-no-results:after {
- content:'0 results';
+ content:'0 results';
}
.search-count {
float: right;
@@ -687,7 +687,7 @@ div.search-result-list .search-result-item {
}
.radio-option-description,
.checkbox-option-description {
- margin-left: 40px;
+ margin-left: 40px;
}
/*-----------( Image ) -----------*/
@@ -743,14 +743,14 @@ table.perm-editor .pointer-item-text {
}
/*---------- comment-box -------------------------------------- */
-.comment-box textarea {
+.comment-box textarea {
margin-bottom:5px;
-}
+}
.comment-box input {
padding: 0px;
font-size: 12px;
}
-.comment-box {
+.comment-box {
background: #cce;
padding: 8px;
margin: 0px;
View
46 app/assets/stylesheets/defaults.css
@@ -18,10 +18,10 @@ body, p, ol, ul {
/*--------- headers and links --------------*/
h1 {
- font-size: 15px;
+ font-size: 15px;
}
h2 {
- font-size: 13px;
+ font-size: 13px;
}
h1, h2 {
color:#644;
@@ -29,20 +29,20 @@ h1, h2 {
margin: 0px;
}
/* headers outside of cards */
-h1.page-header,
-h2.page-header {
- color: #22d;
- font-weight: normal;
+h1.page-header,
+h2.page-header {
+ color: #22d;
+ font-weight: normal;
margin: 0 0 10px 0;
}
a {
- color: #484;
-}
-a:link,
-a:visited {
+ color: #484;
+}
+a:link,
+a:visited {
text-decoration: none;
}
-a:hover,
+a:hover,
a:focus {
text-decoration: underline;
}
@@ -68,7 +68,7 @@ td, th {
/*---- headers --------*/
-input[type=text],
+input[type=text],
input[type=password],
input[type=checkbox],
textarea,
@@ -80,7 +80,7 @@ select {
background: #f9f9ed;
}
body#tinymce {
- background: #f9f9ed;
+ background: #f9f9ed;
}
input:focus,
select:focus,
@@ -88,34 +88,34 @@ textarea:focus,
body#tinymce:focus {
background: #ffffee;
}
-input[type=submit]:focus,
+input[type=submit]:focus,
input[type=button]:focus {
color: #000
}
textarea {
- width: 98%;
+ width: 98%;
}
-body.mceContentBody {
+body.mceContentBody {
margin: 4px;
}
/*-- miscellaneous --*/
-form {
- margin: 0px;
+form {
+ margin: 0px;
padding: 0px;
display: inline;
}
-p {
- margin: 0px;
-}
+p {
+ margin: 0px;
+}
hr {
margin: 10px
-}
+}
img {
border: 0px;
vertical-align: middle;
-}
+}
li {
margin-bottom: 2px;
}
View
10 app/assets/stylesheets/jquery-ui-smoothness.css
@@ -67,7 +67,7 @@
*
* http://docs.jquery.com/UI/Autocomplete#theming
*/
-.ui-autocomplete { position: absolute; cursor: default; }
+.ui-autocomplete { position: absolute; cursor: default; }
/* workarounds */
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
@@ -123,8 +123,8 @@
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
-.ui-button-icons-only { width: 3.4em; }
-button.ui-button-icons-only { width: 3.7em; }
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
/*button text element */
.ui-button .ui-button-text { display: block; line-height: 1.4; }
@@ -170,7 +170,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
-.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
@@ -227,7 +227,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
*/
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
-.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
View
34 app/assets/stylesheets/page.css
@@ -20,7 +20,7 @@
background: #005800;
margin-bottom: 20px;
padding: 2px;
-}
+}
#menu a {
color: white;
padding: 0px 4px;
@@ -46,15 +46,15 @@
#logo {
text-align: center;
padding: 10px 0px;
- background: #fff;
- border: 1px solid #777;
- -moz-border-radius: 8px;
- border-radius: 8px;
+ background: #fff;
+ border: 1px solid #777;
+ -moz-border-radius: 8px;
+ border-radius: 8px;
}
-#logo a,
+#logo a,
#logo a:link,
-#logo a:visited {
- color: #448;
+#logo a:visited {
+ color: #448;
text-decoration: none;
text-align: center;
}
@@ -70,30 +70,30 @@
/*----- fieldset tables --------*/
-.fieldset {
- width: 100%;
+.fieldset {
+ width: 100%;
}
-.fieldset td {
- padding: 5px 3px 5px 3px;
- border-bottom: 1px solid #ddd;
+.fieldset td {
+ padding: 5px 3px 5px 3px;
+ border-bottom: 1px solid #ddd;
}
.fieldset th {
text-align: center;
padding: 8px;
font-style: normal;
}
-.fieldset .label {
- text-align: right;
+.fieldset .label {
+ text-align: right;
white-space: nowrap;
padding-right: 6px;
vertical-align: middle;
}
-.fieldset .field {
+.fieldset .field {
width: 25%;
vertical-align: middle;
padding: 7px
}
-.fieldset .help {
+.fieldset .help {
padding-left: 6px;
width: 50%;
}
View
18 app/assets/stylesheets/print.css
@@ -31,25 +31,25 @@ body, p, ol, ul, td, th {
font-weight: normal;
line-height: 21px;
}
-p {
- margin: 0px;
-}
+p {
+ margin: 0px;
+}
a {
- color: #484;
+ color: #484;
}
-a:link,
-a:visited {
+a:link,
+a:visited {
text-decoration: none;
}
-a:hover,
+a:hover,
a:focus {
text-decoration: underline;
}
h1 {
- font-size: 15px;
+ font-size: 15px;
}
h2 {
- font-size: 13px;
+ font-size: 13px;
}
h1, h2 {
color:#644;
View
6 app/assets/stylesheets/settings.css
@@ -18,12 +18,12 @@
.set-rules td.rule-cell {
text-align: left;
border-bottom: 1px solid #eee;
- padding: 2px 5px;
+ padding: 2px 5px;
}
.rule-setting {
font-weight: bold;
}
-td.rule-setting {
+td.rule-setting {
width: 30%;
}
.rule-type {
@@ -62,7 +62,7 @@ td.missing-rule {
float: left;
width: 25%;
}
-.rule-column-2 {
+.rule-column-2 {
float: right;
width: 70%;
border: 1px solid #eee;
View
4 app/controllers/account_controller.rb
@@ -122,7 +122,7 @@ def forgot_password
end
protected
-
+
def render_user_errors
@user.errors.each do |field, err|
@card.errors.add field, err unless @card.errors[field]
@@ -130,7 +130,7 @@ def render_user_errors
end
errors
end
-
+
def password_authentication(login, password)
if self.session_user = User.authenticate( params[:login], params[:password] )
flash[:notice] = "Successfully signed in" #ENGLISH
View
16 app/controllers/admin_controller.rb
@@ -4,7 +4,7 @@ class AdminController < ApplicationController
def setup
Wagn::Cardname #loading oddity made this necessary in dev. pls don't remove without testing setup.
-
+
raise(Wagn::Oops, "Already setup") unless Session.no_logins? && !User[:first]
Wagn::Conf[:recaptcha_on] = false
if request.post?
@@ -32,22 +32,22 @@ def setup
@account = User.new( params[:user] || {} )
end
end
-
+
def show_cache
key = params[:id].to_cardname.key
@cache_card = Card.fetch(key)
@db_card = Card.find_by_key(key)
end
-
+
def clear_cache
- response =
+ response =
if Session.always_ok?
Wagn::Cache.reset_global
'Cache cleared'
else
"You don't have permission to clear the cache"
end
- render :text =>response, :layout=> true
+ render :text =>response, :layout=> true
end
def tasks
@@ -58,12 +58,12 @@ def tasks
<p>&nbsp;</p>
<p>Account permissions are now controlled through +*account cards and role permissions through +*role cards.</p>
}
- render :text =>response, :layout=> true
-
+ render :text =>response, :layout=> true
+
end
private
-
+
def set_default_request_recipient
to_card = Card.fetch_or_new('*request+*to')
to_card.content=params[:account][:email]
View
52 app/controllers/application_controller.rb
@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
helper :all
before_filter :per_request_setup, :except=>[:fast_404]
layout :wagn_layout, :except=>[:fast_404]
-
+
attr_accessor :recaptcha_count
def fast_404
@@ -26,26 +26,26 @@ def per_request_setup
Wagn::Conf[:host] = host = request.env['HTTP_HOST']
Wagn::Conf[:base_url] = 'http://' + host
Wagn::Conf[:main_name] = nil
- Wagn::Conf[:controller] = self
+ Wagn::Conf[:controller] = self
Wagn::Renderer.ajax_call = ajax?
Wagn::Renderer.current_slot = nil
-
+
Wagn::Cache.renew
-
+
#warn "set curent_user (app-cont) #{self.session_user}, U.cu:#{Session.user_id}"
Session.user = self.session_user || Card::AnonID
#warn "set curent_user a #{session_user}, U.cu:#{Session.user_id}"
-
+
# RECAPTCHA HACKS
- Wagn::Conf[:recaptcha_on] = !Session.logged_in? && # this too
+ Wagn::Conf[:recaptcha_on] = !Session.logged_in? && # this too
!!( Wagn::Conf[:recaptcha_public_key] && Wagn::Conf[:recaptcha_private_key] )
@recaptcha_count = 0
-
+
@action = params[:action]
# end
end
-
+
def wagn_layout
layout = nil
respond_to do |format|
@@ -57,7 +57,7 @@ def wagn_layout
def ajax?
request.xhr? || params[:simulate_xhr]
end
-
+
def html?
[nil, 'html'].member?(params[:format])
end
@@ -75,7 +75,7 @@ def wagn_redirect url
render :text => url, :status => 303
else
redirect_to url
- end
+ end
end
def deny action=nil
@@ -94,8 +94,8 @@ def errors options={}
def show view = nil, status = 200
ext = request.parameters[:format]
- known = FORMATS.split('|').member? ext
-
+ known = FORMATS.split('|').member? ext
+
if !known && @card && @card.error_view
ext, known = 'txt', true
# render simple text for errors on unknown formats; without this, file/image permissions checks are meaningless
@@ -111,45 +111,45 @@ def show view = nil, status = 200
render :text=>"unknown format: #{extension}", :status=>404
end
end
-
+
def show_file
return fast_404 if !@card
-
+
@card.selected_rev_id = (@rev_id || @card.current_revision_id).to_i
format = @card.attachment_format(params[:format])
return fast_404 if !format
if ![format, 'file'].member?( params[:format] )
- return redirect_to( request.fullpath.sub( /\.#{params[:format]}\b/, '.' + format ) ) #@card.attach.url(style) )
+ return redirect_to( request.fullpath.sub( /\.#{params[:format]}\b/, '.' + format ) ) #@card.attach.url(style) )
end
- style = @card.attachment_style @card.type_id, ( params[:size] || @style )
+ style = @card.attachment_style @card.type_id, ( params[:size] || @style )
return fast_404 if !style
-
+
# check file existence? or just rescue MissingFile errors and raise NotFound?
# we do see some errors from not having this, though I think they're mostly from legacy issues....
- send_file @card.attach.path(style),
+ send_file @card.attach.path(style),
:type => @card.attach_content_type,
:filename => "#{@card.cardname.url_key}#{style.blank? ? '' : '-'}#{style}.#{format}",
:x_sendfile => true,
:disposition => (params[:format]=='file' ? 'attachment' : 'inline' )
end
-
-
+
+
rescue_from Exception do |exception|
Rails.logger.info "exception = #{exception.class}: #{exception.message}"
-
+
view, status = case exception
when Wagn::NotFound, ActiveRecord::RecordNotFound
- [ :not_found, 404 ]
+ [ :not_found, 404 ]
when Wagn::PermissionDenied, Card::PermissionDenied
[ :denial, 403]
- when Wagn::BadAddress, ActionController::UnknownController, AbstractController::ActionNotFound
+ when Wagn::BadAddress, ActionController::UnknownController, AbstractController::ActionNotFound
[ :bad_address, 404 ]
else
notify_airbrake exception if Airbrake.configuration.api_key
-
+
if [Wagn::Oops, ActiveRecord::RecordInvalid].member?( exception.class ) && @card && @card.errors.any?
[ :errors, 422]
else
@@ -158,10 +158,10 @@ def show_file
Rails.logger.level == 0 ? raise( exception ) : [ :server_error, 500 ]
end
end
-
+
errors :view=>view, :status=>status
end
-
+
end
View
16 app/controllers/card_controller.rb
@@ -42,7 +42,7 @@ def delete
success 'REDIRECT: TO-PREVIOUS'
end
-
+
def index
read
@@ -52,7 +52,7 @@ def index
def read_file
show_file
end #FIXME! move to pack
-
+
@@ -78,7 +78,7 @@ def comment
"#{session[:comment_author] = params[:card][:comment_author]} (Not signed in)" : "[[#{Session.user.card.name}]]"
comment = params[:card][:comment].split(/\n/).map{|c| "<p>#{c.strip.empty? ? '&nbsp;' : c}</p>"} * "\n"
@card.comment = "<hr>#{comment}<p><em>&nbsp;&nbsp;--#{author}.....#{Time.now}</em></p>"
-
+
if @card.save
show
else
@@ -115,7 +115,7 @@ def update_account
if params[:save_roles]
role_card = @card.trait_card :roles
role_card.ok! :update
-
+
role_hash = params[:user_roles] || {}
role_card = role_card.refresh if role_card.frozen?
role_card.items= role_hash.keys.map &:to_i
@@ -125,7 +125,7 @@ def update_account
if account and account_args = params[:account]
unless Session.as_id == @card.id and !account_args[:blocked]
@card.trait_card(:account).ok! :update
- end
+ end
account.update_attributes account_args
end
@@ -177,14 +177,14 @@ def index_preload
def load_card
@card = case params[:id]
- when '*previous' ; return wagn_redirect( previous_location )
+ when '*previous' ; return wagn_redirect( previous_location )
when /^\~(\d+)$/ ; Card.fetch $1.to_i
when /^\:(\w+)$/ ; Card.fetch $1.to_sym
else
opts = params[:card] ? params[:card].clone : {}
opts[:type] ||= params[:type] # for /new/:type shortcut. we should fix and deprecate this.
name = params[:id] ? Wagn::Cardname.unescape( params[:id] ) : opts[:name]
-
+
if @action == 'create'
# FIXME we currently need a "new" card to catch duplicates (otherwise #save will just act like a normal update)
# I think we may need to create a "#create" instance method that handles this checking.
@@ -195,7 +195,7 @@ def load_card
Card.fetch_or_new name, opts
end
end
-
+
Wagn::Conf[:main_name] = params[:main] || (@card && @card.name) || ''
true
end
View
2 app/controllers/stub_card_controller.rb
@@ -3,7 +3,7 @@ class StubCardController < CardController
def url_options
default_url_options
end
-
+
def params() {} end
def session() {} end
end
View
6 app/helpers/location_helper.rb
@@ -22,7 +22,7 @@ def location_history
def save_location
return if ajax? || !html? || !@card.known?
-
+
discard_locations_for(@card)
@previous_location = wagn_path(@card)
location_history.push @previous_location
@@ -41,7 +41,7 @@ def discard_locations_for(card)
end.compact
@previous_location = nil
end
-
+
def url_key_for_location(location)
location.match( /\/([^\/]*$)/ ) ? $1 : nil
end
@@ -69,7 +69,7 @@ def wagn_path( rel ) #should be in cardname?
def wagn_url( rel ) #should be in cardname?
"#{Wagn::Conf[:base_url]}#{wagn_path(rel)}"
end
-
+
# Links ----------------------------------------------------------------------
View
8 app/helpers/wagn_helper.rb
@@ -8,10 +8,10 @@ module WagnHelper
def slot() Wagn::Renderer.current_slot end
def card() @card ||= slot.card end
-
+
def params()
if controller
- controller.params
+ controller.params
else
slot and slot.params
end
@@ -22,7 +22,7 @@ def get_slot(card=nil)
nil_given = card.nil?
card ||= @card
- slot =
+ slot =
if current = Wagn::Renderer.current_slot
nil_given ? current : current.subrenderer(card)
else
@@ -68,7 +68,7 @@ def error_messages_for(object)
def wrap_slot(renderer=nil, args={}, &block)
renderer ||= (Wagn::Renderer.current_slot || get_slot)
- content = with_output_buffer { yield(renderer) }
+ content = with_output_buffer { yield(renderer) }
renderer.wrap(:open, args) { content }
end
# ------------( helpers ) --------------
View
26 app/mailers/mailer.rb
@@ -7,7 +7,7 @@ class Mailer < ActionMailer::Base
@@defaults[:return_path] ||= @@defaults[:from] if @@defaults[:from]
@@defaults[:charset] ||= 'utf-8'
default @@defaults
-
+
include LocationHelper
def account_info(user, subject, message)
@@ -34,20 +34,20 @@ def signup_alert invite_request
@card = invite_request
@email= invite_request.to_user.email
@name = invite_request.name
- @content = invite_request.content
+ @content = invite_request.content
@request_url = wagn_url invite_request
@requests_url = wagn_url Card['Account Request']
- args = {
+ args = {
:to => Card.setting('*request+*to'),
:subject => "#{invite_request.name} signed up for #{@site}",
:content_type => 'text/html',
}
set_from_args args, Card.setting('*request+*from') || "#{@name} <#{@email}"
mail args
- end
+ end
+
-
def change_notice user, card, action, watched, subedits=[], updated_card=nil
return unless user = User===user ? user : User.from_id(user)
#warn "change_notice( #{user.email}, #{card.inspect}, #{action.inspect}, #{watched.inspect} Uc:#{updated_card.inspect}...)"
@@ -68,27 +68,27 @@ def change_notice user, card, action, watched, subedits=[], updated_card=nil
:subject => "[#{Card.setting :title} notice] #{@updater} #{action} \"#{card.name}\"" ,
:content_type => 'text/html',
}
- set_from_args args, User.admin.email
+ set_from_args args, User.admin.email
mail args
end
def flexmail config
@message = config.delete(:message)
-
+
if attachment_list = config.delete(:attach) and !attachment_list.empty?
attachment_list.each_with_index do |cardname, i|
- if c = Card[ cardname ] and c.respond_to?(:attach)
+ if c = Card[ cardname ] and c.respond_to?(:attach)
attachments["attachment-#{i + 1}.#{c.attach_extension}"] = File.read( c.attach.path )
end
end
end
-
+
set_from_args config, config[:from]
mail config
end
-
+
private
-
+
def set_from_args args, from
from_name, from_email = parse_address( from )
if default_from=@@defaults[:from]
@@ -98,10 +98,10 @@ def set_from_args args, from
args[:from] = from
end
end
-
+
def parse_address addr
name, email = (addr =~ /(.*)\<(.*)>/) ? [$1.strip, $2] : [nil, addr]
end
-
+
end
View
80 app/models/card.rb
@@ -17,22 +17,22 @@ class Card < ActiveRecord::Base
:cards, :loaded_trunk, :nested_edit, # should be possible to merge these concepts
:error_view, :error_status, #yuck
:attachment_id #should build flexible handling for set-specific attributes
-
+
attr_writer :update_read_rule_list
attr_reader :type_args, :broken_type
-
+
belongs_to :card, :class_name => 'Card', :foreign_key => :creator_id
belongs_to :card, :class_name => 'Card', :foreign_key => :updater_id
before_save :set_stamper, :base_before_save, :set_read_rule, :set_tracked_attributes
after_save :base_after_save, :update_ruled_cards, :update_queue, :expire_related
-
+
cache_attributes 'name', 'type_id' #Review - still worth it in Rails 3?
- #~~~~~~ CLASS METHODS ~~~~~~~~~~~~~~~~~~~~~
+ #~~~~~~ CLASS METHODS ~~~~~~~~~~~~~~~~~~~~~
class << self
- JUNK_INIT_ARGS = %w{ missing skip_virtual id }
+ JUNK_INIT_ARGS = %w{ missing skip_virtual id }
def new args={}, options={}
args = (args || {}).stringify_keys
@@ -55,14 +55,14 @@ def new args={}, options={}
end
super args
end
-
+
ID_CONST_ALIAS = {
:default_type => :basic,
:anon => :anonymous,
:auth => :anyone_signed_in,
:admin => :administrator
}
-
+
def const_missing const
if const.to_s =~ /^([A-Z]\S*)ID$/ and code=$1.underscore.to_sym
code = ID_CONST_ALIAS[code] || code
@@ -76,7 +76,7 @@ def const_missing const
super
end
end
-
+
def setting name
Session.as_bot do
card=Card[name] and !card.content.strip.empty? and card.content
@@ -103,9 +103,9 @@ def toggle val
def initialize args={}
args['name'] = args['name' ].to_s
args['type_id'] = args['type_id'].to_i
-
+
args.delete('type_id') if args['type_id'] == 0 # can come in as 0, '', or nil
-
+
@type_args = { # these are cached to optimize #new
:type => args.delete('type' ),
:typecode => args.delete('typecode'),
@@ -115,7 +115,7 @@ def initialize args={}
skip_modules = args.delete 'skip_modules'
super args # ActiveRecord #initialize
-
+
if tid = get_type_id(@type_args)
self.type_id_without_tracking = tid
end
@@ -133,19 +133,19 @@ def get_type_id args={}
when args[:type] ; Card.fetch_id args[:type]
else :noop
end
-
+
case type_id
- when :noop ;
+ when :noop ;
when false, nil ; @broken_type = args[:type] || args[:typecode]
else ; return type_id
end
-
+
if name && t=template
reset_patterns #still necessary even with new template handling?
t.type_id
else
# if we get here we have no *all+*default -- let's address that!
- DefaultTypeID
+ DefaultTypeID
end
end
@@ -163,7 +163,7 @@ def reset_mods
#does this really do anything if it doesn't reset @set_modules??? can we get rid of this?
@set_mods_loaded=false
end
-
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# STATES
@@ -174,7 +174,7 @@ def new_card?
def known?
real? || virtual?
end
-
+
def real?
!new_card?
end
@@ -187,7 +187,7 @@ def assign_attributes args={}, options={}
args[:type_id] = Card.fetch_id( newtype )
end
reset_patterns
-
+
super args, options
end
@@ -196,12 +196,12 @@ def set_stamper
self.creator_id = self.updater_id if new_card?
end
- before_validation :on => :create do
+ before_validation :on => :create do
pull_from_trash if new_record?
self.trash = !!trash
true
end
-
+
after_validation do
begin
raise PermissionDenied.new(self) unless approved?
@@ -212,14 +212,14 @@ def set_stamper
raise e
end
end
-
+
def save
super
rescue Exception => e
expire_pieces
raise e
end
-
+
def save!
super
rescue Exception => e
@@ -229,7 +229,7 @@ def save!
def base_before_save
if self.respond_to?(:before_save) and self.before_save == false
- errors.add(:save, "could not prepare card for destruction") #fixme - screwy error handling!!
+ errors.add(:save, "could not prepare card for destruction") #fixme - screwy error handling!!
return false
end
end
@@ -283,7 +283,7 @@ def pull_from_trash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# DESTROY
-
+
def destroy
run_callbacks( :destroy ) do
deps = self.dependents # already called once. reuse?
@@ -295,7 +295,7 @@ def destroy
end
true
end
- end
+ end
before_destroy do
errors.clear
@@ -321,7 +321,7 @@ def destroy!
destroy or raise Wagn::Oops, "Destroy failed: #{errors.full_messages.join(',')}"
end
- def validate_destroy
+ def validate_destroy
if !dependents.empty? && !confirm_destroy
errors.add(:confirmation_required, "because #{name} has #{dependents.size} dependents")
else
@@ -348,10 +348,10 @@ def junction?() cardname.junction? end
def left() Card.fetch cardname.left end
def right() Card.fetch cardname.right end
-
+
def trunk() Card.fetch cardname.trunk end
def tag() Card.fetch cardname.tag end
-
+
def dependents
return [] if new_card?
@@ -396,7 +396,7 @@ def repair_key
def type_card
Card[ type_id.to_i ]
end
-
+
def typecode # FIXME - change to "type_code"
Wagn::Codename[ type_id.to_i ]
end
@@ -421,7 +421,7 @@ def content
current_revision.content
end
end
-
+
def raw_content