wagn 1.13.0.pre1 → 1.13.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/controllers/card_controller.rb +3 -3
  4. data/db/migrate_cards/20140307231621_user_data_to_cards.rb +5 -1
  5. data/lib/card.rb +5 -7
  6. data/lib/card/chunk.rb +1 -0
  7. data/lib/card/codename.rb +48 -31
  8. data/lib/card/env.rb +0 -1
  9. data/lib/card/exceptions.rb +3 -3
  10. data/lib/card/format.rb +89 -166
  11. data/lib/card/generators/set/USAGE +1 -1
  12. data/lib/card/loader.rb +1 -1
  13. data/lib/card/set.rb +196 -112
  14. data/lib/card/set_pattern.rb +37 -71
  15. data/lib/wagn/cache.rb +8 -7
  16. data/lib/wagn/commands.rb +1 -1
  17. data/lib/wagn/config/environments/development.rb +1 -1
  18. data/lib/wagn/config/initializers/paperclip.rb +1 -0
  19. data/lib/wagn/generators/wagn/templates/Gemfile +59 -55
  20. data/lib/wagn/location.rb +2 -2
  21. data/mods/core/formats/html_format.rb +2 -6
  22. data/mods/core/formats/text_format.rb +1 -1
  23. data/mods/core/set_patterns/01_all.rb +0 -5
  24. data/mods/core/set_patterns/02_all_plus.rb +1 -3
  25. data/mods/core/set_patterns/07_type_plus_right.rb +0 -1
  26. data/mods/core/sets/all/active_card.rb +1 -1
  27. data/mods/core/sets/all/name.rb +3 -2
  28. data/mods/core/sets/all/pattern.rb +9 -23
  29. data/mods/core/sets/all/phases.rb +27 -13
  30. data/mods/core/sets/all/rules.rb +3 -3
  31. data/mods/core/sets/all/templating.rb +5 -2
  32. data/mods/core/sets/all/tracked_attributes.rb +2 -1
  33. data/mods/core/sets/right/structure.rb +13 -0
  34. data/mods/{standard → core}/sets/type/plain_text.rb +0 -0
  35. data/mods/standard/formats/email_html_format.rb +1 -1
  36. data/mods/standard/lib/card/machine.rb +16 -12
  37. data/mods/standard/lib/card/machine_input.rb +1 -1
  38. data/mods/standard/sets/all/attach.rb +1 -1
  39. data/mods/standard/sets/all/base.rb +92 -94
  40. data/mods/standard/sets/all/follow.rb +1 -1
  41. data/mods/standard/sets/all/rich_html.rb +5 -3
  42. data/mods/standard/sets/all/rss.rb +12 -5
  43. data/mods/standard/sets/right/account.rb +1 -1
  44. data/mods/standard/sets/right/add_help.rb +3 -1
  45. data/mods/standard/sets/right/comment.rb +92 -3
  46. data/mods/standard/sets/right/create.rb +2 -87
  47. data/mods/standard/sets/right/default.rb +3 -2
  48. data/mods/standard/sets/right/delete.rb +2 -5
  49. data/mods/standard/sets/right/help.rb +3 -1
  50. data/mods/standard/sets/right/machine_output.rb +9 -7
  51. data/mods/standard/sets/right/read.rb +2 -5
  52. data/mods/standard/sets/right/style.rb +3 -2
  53. data/mods/standard/sets/right/update.rb +2 -5
  54. data/mods/standard/sets/rstar/rules.rb +0 -2
  55. data/mods/standard/sets/self/head.rb +2 -3
  56. data/mods/standard/sets/self/navbox.rb +0 -7
  57. data/mods/standard/sets/self/recent.rb +2 -2
  58. data/mods/standard/sets/self/search.rb +10 -3
  59. data/mods/standard/sets/self/signin.rb +3 -3
  60. data/mods/standard/sets/type/cardtype.rb +2 -2
  61. data/mods/standard/sets/type/coffee_script.rb +4 -4
  62. data/mods/standard/sets/type/css.rb +12 -4
  63. data/mods/standard/sets/type/image.rb +19 -19
  64. data/mods/standard/sets/type/java_script.rb +1 -1
  65. data/mods/standard/sets/type/layout_type.rb +3 -2
  66. data/mods/standard/sets/type/pointer.rb +3 -2
  67. data/mods/standard/sets/type/scss.rb +6 -34
  68. data/mods/standard/sets/type/search_type.rb +22 -16
  69. data/mods/standard/sets/type/set.rb +2 -2
  70. data/mods/standard/sets/type/setting.rb +2 -2
  71. data/mods/standard/sets/type/skin.rb +4 -18
  72. data/spec/controllers/card_controller_spec.rb +2 -2
  73. data/spec/lib/card/flexmail_spec.rb +1 -0
  74. data/spec/lib/card/format_spec.rb +9 -9
  75. data/spec/lib/card/loader_spec.rb +1 -2
  76. data/spec/lib/card/name_spec.rb +7 -1
  77. data/spec/lib/card/set_pattern_spec.rb +5 -5
  78. data/spec/mods/core/sets/all/pattern_spec.rb +0 -9
  79. data/spec/mods/core/sets/all/phases_spec.rb +2 -1
  80. data/spec/mods/standard/lib/machine_input_spec.rb +20 -4
  81. data/spec/mods/standard/lib/machine_spec.rb +64 -14
  82. data/spec/mods/standard/sets/right/machine_output_spec.rb +2 -17
  83. data/spec/mods/standard/sets/right/script_spec.rb +9 -5
  84. data/spec/mods/standard/sets/right/style_spec.rb +11 -5
  85. data/spec/mods/standard/sets/type/coffeescript_spec.rb +5 -7
  86. data/spec/mods/standard/sets/type/css_spec.rb +3 -4
  87. data/spec/mods/standard/sets/type/javascript_spec.rb +3 -5
  88. data/spec/mods/standard/sets/type/scss_spec.rb +4 -7
  89. data/spec/mods/standard/sets/type/skin_spec.rb +29 -8
  90. metadata +5 -4
  91. data/mods/standard/sets/right/structure.rb +0 -12
@@ -1,3 +1,92 @@
1
- view :core, :right=>:create
2
- view :editor, :right=>:create
3
- view :closed_content, :right=>:create
1
+
2
+ format :html do
3
+ view :editor do |args|
4
+ set_name = card.cardname.trunk_name
5
+ set_card = Card.fetch(set_name)
6
+ not_set = set_card && set_card.type_id != SetID
7
+
8
+ group_options = Auth.as_bot { Card.search(:type_id=>RoleID, :sort=>'name') }
9
+
10
+ inheritable = not_set ? false : set_card.inheritable?
11
+ inheriting = inheritable && card.content=='_left'
12
+
13
+ item_names = inheriting ? [] : card.item_names
14
+
15
+ %{
16
+ #{ form.hidden_field :content, :class=>'card-content' }
17
+ <div class="perm-editor">
18
+
19
+ #{ if inheritable; %{
20
+ <div class="perm-inheritance perm-section">
21
+ #{ check_box_tag 'inherit', 'inherit', inheriting }
22
+ <label>
23
+ #{ core_inherit_content args.merge(:target=>'wagn_role') }
24
+ #{ content_tag( :a, :title=>"use left's #{card.cardname.tag} rule") { '?' } }
25
+ </label>
26
+ </div>
27
+ } end }
28
+
29
+ <div class="perm-group perm-vals perm-section">
30
+ <h5>Groups</h5>
31
+ #{
32
+ group_options.map do |option|
33
+ checked = !!item_names.delete(option.name)
34
+ %{
35
+ <div class="group-option">
36
+ #{ check_box_tag( "#{option.key}-perm-checkbox", option.name, checked, :class=>'perm-checkbox-button' ) }
37
+ <label>#{ link_to_page option.name, nil, :target=>'wagn_role' }</label>
38
+ </div>
39
+ }
40
+ end * "\n"
41
+ }
42
+ </div>
43
+
44
+ <div class="perm-indiv perm-vals perm-section">
45
+ <h5>Individuals</h5>
46
+ #{ _render_list :item_list=>item_names, :extra_css_class=>'perm-indiv-ul' }
47
+ </div>
48
+
49
+ </div>
50
+ }
51
+ end
52
+
53
+
54
+ view :pointer_core, :view=>:core, :mod=>Type::Pointer::HtmlFormat
55
+
56
+ view :core do |args|
57
+ args[:item] ||= :link
58
+ card.content=='_left' ? core_inherit_content(args) : render( :pointer_core, args )
59
+ end
60
+
61
+ view :closed_content do |args|
62
+ card.content=='_left' ? core_inherit_content(args) : render( :pointer_core, args )
63
+ end
64
+
65
+
66
+ private
67
+
68
+ def core_inherit_content args={}
69
+ sc = args[:set_context]
70
+ text = if sc && sc.tag_name.key == Card[:self].key
71
+ begin
72
+ task = card.tag.codename
73
+ ancestor = Card[sc.trunk_name.trunk_name]
74
+ links = ancestor.who_can( task.to_sym ).map do |card_id|
75
+ link_to_page Card[card_id].name, nil, :target=>args[:target]
76
+ end*", "
77
+ "Inherit ( #{links} )"
78
+ rescue
79
+ 'Inherit'
80
+ end
81
+ else
82
+ 'Inherit from left card'
83
+ end
84
+ %{<span class="inherit-perm">#{text}</span>}
85
+ end
86
+ end
87
+
88
+
89
+ def standardize_items
90
+ # noop to override default behavior, which wouldn't let '_left' through and would therefore break
91
+ end
92
+
@@ -1,88 +1,3 @@
1
1
 
2
- format do
3
- view :editor do |args|
4
- set_name = card.cardname.trunk_name
5
- set_card = Card.fetch(set_name)
6
- not_set = set_card && set_card.type_id != SetID
7
-
8
- group_options = Auth.as_bot { Card.search(:type_id=>RoleID, :sort=>'name') }
9
-
10
- inheritable = not_set ? false : set_card.inheritable?
11
- inheriting = inheritable && card.content=='_left'
12
-
13
- item_names = inheriting ? [] : card.item_names
14
-
15
- %{
16
- #{ form.hidden_field :content, :class=>'card-content' }
17
- <div class="perm-editor">
18
-
19
- #{ if inheritable; %{
20
- <div class="perm-inheritance perm-section">
21
- #{ check_box_tag 'inherit', 'inherit', inheriting }
22
- <label>
23
- #{ core_inherit_content args.merge(:target=>'wagn_role') }
24
- #{ content_tag( :a, :title=>"use left's #{card.cardname.tag} rule") { '?' } }
25
- </label>
26
- </div>
27
- } end }
28
-
29
- <div class="perm-group perm-vals perm-section">
30
- <h5>Groups</h5>
31
- #{
32
- group_options.map do |option|
33
- checked = !!item_names.delete(option.name)
34
- %{
35
- <div class="group-option">
36
- #{ check_box_tag( "#{option.key}-perm-checkbox", option.name, checked, :class=>'perm-checkbox-button' ) }
37
- <label>#{ link_to_page option.name, nil, :target=>'wagn_role' }</label>
38
- </div>
39
- }
40
- end * "\n"
41
- }
42
- </div>
43
-
44
- <div class="perm-indiv perm-vals perm-section">
45
- <h5>Individuals</h5>
46
- #{ _render_list :item_list=>item_names, :extra_css_class=>'perm-indiv-ul' }
47
- </div>
48
-
49
- </div>
50
- }
51
- end
52
-
53
- view :core do |args|
54
- args[:item] ||= :link
55
- card.content=='_left' ? core_inherit_content(args) : _final_pointer_type_core(args)
56
- end
57
-
58
- view :closed_content do |args|
59
- card.content=='_left' ? core_inherit_content(args) : _final_pointer_type_closed_content(args)
60
- end
61
-
62
-
63
- private
64
-
65
- def core_inherit_content args={}
66
- sc = args[:set_context]
67
- text = if sc && sc.tag_name.key == Card[:self].key
68
- begin
69
- task = card.tag.codename
70
- ancestor = Card[sc.trunk_name.trunk_name]
71
- links = ancestor.who_can( task.to_sym ).map do |card_id|
72
- link_to_page Card[card_id].name, nil, :target=>args[:target]
73
- end*", "
74
- "Inherit ( #{links} )"
75
- rescue
76
- 'Inherit'
77
- end
78
- else
79
- 'Inherit from left card'
80
- end
81
- %{<span class="inherit-perm">#{text}</span>}
82
- end
83
- end
84
-
85
-
86
- def standardize_items
87
- # noop to override default behavior, which wouldn't let '_left' through and would therefore break
88
- end
2
+ include Comment
3
+ format :html do include Comment::HtmlFormat end
@@ -1,2 +1,3 @@
1
- view :core, :right=>:structure
2
- view :closed_content, :right=>:structure
1
+ format :html do
2
+ include Structure::HtmlFormat
3
+ end
@@ -1,5 +1,2 @@
1
- include Right::Create
2
-
3
- view :core, :right=>:create
4
- view :editor, :right=>:create
5
- view :closed_content, :right=>:create
1
+ include Create
2
+ format :html do include Create::HtmlFormat end
@@ -1 +1,3 @@
1
- view :core, :right=>:structure
1
+ format :html do
2
+ include Structure::HtmlFormat
3
+ end
@@ -1,12 +1,14 @@
1
-
2
1
  format do
3
2
  view :not_found do |args|
4
- if card.left.kind_of? Machine
5
- card.left.update_machine_output
6
- self.error_status = 302
7
- wagn_path card.left.machine_output_card.attach.url(:default, :timestamp => false) # to get rid of additional number in url
3
+ srid = card.selected_revision_id
4
+ if card.left.kind_of? Machine and (card.new_card? or !srid or srid == card.current_revision_id)
5
+ # only regenerate output if it's really warranted
6
+ # (not when someone requests a specific old version that has been removed)
7
+ card.left.update_machine_output
8
+ root.error_status = 302
9
+ wagn_path card.left.machine_output_url
8
10
  else
9
- _final_not_found args
11
+ super args
10
12
  end
11
13
  end
12
- end
14
+ end
@@ -1,5 +1,2 @@
1
- include Right::Create
2
-
3
- view :core, :right=>:create
4
- view :editor, :right=>:create
5
- view :closed_content, :right=>:create
1
+ include Create
2
+ format :html do include Create::HtmlFormat end
@@ -7,7 +7,8 @@ def chunk_list #turn off autodetection of uri's
7
7
  #TODO with the new format pattern this should be handled in the js format
8
8
  :inclusion_only
9
9
  end
10
-
10
+
11
+ =begin
11
12
  format :file do
12
13
  view :core do |args|
13
14
  if params[:explicit_file] and r = controller.response
@@ -18,4 +19,4 @@ format :file do
18
19
  :x_sendfile=>true, :type=>'text/css', :disposition=>'inline' } ]
19
20
  end
20
21
  end
21
-
22
+ =end
@@ -1,5 +1,2 @@
1
- include Right::Create
2
-
3
- view :core, :right=>:create
4
- view :editor, :right=>:create
5
- view :closed_content, :right=>:create
1
+ include Create
2
+ format :html do include Create::HtmlFormat end
@@ -231,8 +231,6 @@ end
231
231
 
232
232
  =begin
233
233
 
234
- These are commented because they are not currently included (see notes in lib/card/set.rb re anchorless sets)
235
-
236
234
  def repair_set
237
235
  @set_repair_attempted = true
238
236
  if real?
@@ -1,4 +1,3 @@
1
-
2
1
  format :html do
3
2
 
4
3
  view :raw do |args|
@@ -45,7 +44,7 @@ format :html do
45
44
  # RSS # move to mods!
46
45
  if root.card.type_id == SearchTypeID
47
46
  opts = { :format => :rss }
48
- search_params[:vars].each { |key, val| opts["_#{key}"] = val }
47
+ root.search_params[:vars].each { |key, val| opts["_#{key}"] = val }
49
48
  bits << %{<link rel="alternate" type="application/rss+xml" title="RSS" href=#{page_path root.card.name, opts} />}
50
49
  end
51
50
  end
@@ -77,7 +76,7 @@ format :html do
77
76
  c=Card[:double_click] and !Card.toggle c.content and varvals << 'wagn.noDoubleClick=true'
78
77
  @css_path and varvals << "wagn.cssPath='#{@css_path}'"
79
78
 
80
- script_card = card.rule_card :script
79
+ script_card = root.card.rule_card :script
81
80
  ie9_card = Card[:script_html5shiv_printshiv]
82
81
  %(#{ javascript_tag do varvals * ';' end }
83
82
  #{ javascript_include_tag script_card.machine_output_url if script_card }
@@ -18,10 +18,3 @@ format :html do
18
18
 
19
19
  view :core, :raw
20
20
  end
21
-
22
- format do
23
- #hacky. here for override
24
- def goto_wql(term)
25
- { :complete=>term, :limit=>8, :sort=>'name', :return=>'name' }
26
- end
27
- end
@@ -1,6 +1,6 @@
1
1
 
2
2
  view :title do |args|
3
- _final_title args.merge( :title=>'Recent Changes' )
3
+ super args.merge( :title=>'Recent Changes' )
4
4
  end
5
5
 
6
6
  format :html do
@@ -13,7 +13,7 @@ format :html do
13
13
  begin
14
14
  stamp = card.updated_at
15
15
  day = Date.new(stamp.year, stamp.month, stamp.day)
16
- rescue Exception=>e
16
+ rescue =>e
17
17
  day = Date.today
18
18
  card.content = "(error getting date)"
19
19
  end
@@ -2,10 +2,11 @@
2
2
  format :html do
3
3
 
4
4
  view :title do |args|
5
- if vars = search_params[:vars] and keyword = vars[:keyword]
6
- args.merge! :title=> %{Search results for: <span class="search-keyword">#{keyword}</span>}
5
+ vars = root.search_params[:vars]
6
+ if vars && vars[:keyword]
7
+ args.merge! :title=> %{Search results for: <span class="search-keyword">#{ vars[:keyword] }</span>}
7
8
  end
8
- _final_title args
9
+ super args
9
10
  end
10
11
  end
11
12
 
@@ -33,4 +34,10 @@ format :json do
33
34
  }
34
35
 
35
36
  end
37
+
38
+ #hacky. here for override
39
+ def goto_wql(term)
40
+ { :complete=>term, :limit=>8, :sort=>'name', :return=>'name' }
41
+ end
42
+
36
43
  end
@@ -3,7 +3,7 @@ format :html do
3
3
 
4
4
  view :open do |args|
5
5
  args.merge! :title=>'Sign In', :optional_help=>:show
6
- _final_open args
6
+ super args
7
7
  end
8
8
 
9
9
  view :open_content do |args|
@@ -22,7 +22,7 @@ format :html do
22
22
  account = card.fetch :trait=>:account, :new=>{}
23
23
 
24
24
  form_args = {
25
- :hidden => { :success=>'REDIRECT: /' },
25
+ :hidden => { :success=>'REDIRECT: *previous' },
26
26
  :recaptcha => :off
27
27
  }
28
28
 
@@ -51,7 +51,7 @@ format :html do
51
51
  }
52
52
  } )
53
53
 
54
- Auth.as_bot { _final_edit args }
54
+ Auth.as_bot { super args }
55
55
  end
56
56
 
57
57
  view :raw do |args|
@@ -3,14 +3,14 @@ format :html do
3
3
 
4
4
  view :type do |args|
5
5
  args.merge!(:type_class=>'no-edit') if card.cards_of_type_exist?
6
- _final_type args
6
+ super args
7
7
  end
8
8
 
9
9
  view :type_fieldset do |args|
10
10
  if card.cards_of_type_exist?
11
11
  %{<div>Sorry, this card must remain a Cardtype so long as there are <strong>#{ card.name }</strong> cards.</div>}
12
12
  else
13
- _final_type_fieldset args
13
+ super args
14
14
  end
15
15
  end
16
16
 
@@ -6,13 +6,13 @@ include Machine
6
6
  include MachineInput
7
7
 
8
8
  def compile_coffee script
9
- Uglifier.compile(::CoffeeScript.compile script)
10
- rescue Exception=>e
9
+ ::CoffeeScript.compile script
10
+ rescue =>e
11
11
  e
12
12
  end
13
13
 
14
14
  machine_input do
15
- compile_coffee format(:format=>:js)._render_raw
15
+ Uglifier.compile( compile_coffee format(:format=>:js)._render_raw )
16
16
  end
17
17
 
18
18
  store_machine_output :filetype => "js"
@@ -28,7 +28,7 @@ end
28
28
 
29
29
 
30
30
  format :html do
31
- view :editor, :type=>:plain_text
31
+ view :editor, :mod=>PlainText::HtmlFormat
32
32
 
33
33
  view :core do |args|
34
34
  js = card.compile_coffee _render_raw
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'sass'
1
3
  include Machine
2
4
  include MachineInput
3
5
 
@@ -10,19 +12,25 @@ end
10
12
  def compress_css input
11
13
  begin
12
14
  Sass.compile input, :style=>:compressed
13
- rescue Exception=>e
15
+ rescue => e
14
16
  raise Card::Oops, "Stylesheet Error:\n#{ e.message }"
15
17
  end
16
18
  end
17
19
 
18
- format :html do
20
+ def clean_html?
21
+ false
22
+ end
23
+
24
+ def chunk_list #turn off autodetection of uri's
25
+ :inclusion_and_link
26
+ end
19
27
 
20
- view :editor, :type=>:plain_text
28
+ format :html do
29
+ view :editor, :mod=>PlainText::HtmlFormat
21
30
 
22
31
  view :core do |args|
23
32
  # FIXME: scan must happen before process for inclusion interactions to work, but this will likely cause
24
33
  # problems with including other css?
25
34
  process_content ::CodeRay.scan( _render_raw, :css ).div, :size=>:icon
26
35
  end
27
-
28
36
  end