card 1.16.3 → 1.16.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/card.gemspec +1 -1
  4. data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +1 -1
  5. data/db/migrate_core_cards/20150824135418_update_file_history.rb +20 -0
  6. data/db/migrate_core_cards/20150903130006_attachment_upload_cards.rb +13 -0
  7. data/db/seed/new/card_actions.yml +16 -0
  8. data/db/seed/new/card_acts.yml +1 -1
  9. data/db/seed/new/card_changes.yml +56 -80
  10. data/db/seed/new/card_references.yml +282 -58
  11. data/db/seed/new/cards.yml +1348 -1312
  12. data/db/seed/test/fixtures/card_actions.yml +884 -868
  13. data/db/seed/test/fixtures/card_acts.yml +250 -250
  14. data/db/seed/test/fixtures/card_changes.yml +1935 -1959
  15. data/db/seed/test/fixtures/card_references.yml +1024 -800
  16. data/db/seed/test/fixtures/cards.yml +2402 -2366
  17. data/db/version_core_cards.txt +1 -1
  18. data/lib/card.rb +3 -1
  19. data/lib/card/cache.rb +5 -5
  20. data/lib/card/chunk.rb +2 -0
  21. data/lib/card/env.rb +1 -1
  22. data/lib/card/query/card_clause.rb +59 -58
  23. data/lib/card/set.rb +7 -0
  24. data/lib/card/success.rb +143 -0
  25. data/mod/01_core/chunk/query_reference.rb +16 -7
  26. data/mod/01_core/chunk/reference.rb +3 -3
  27. data/mod/01_core/set/all/collection.rb +1 -1
  28. data/mod/01_core/set/all/name.rb +2 -1
  29. data/mod/01_core/set/all/phases.rb +12 -2
  30. data/mod/01_core/set/all/type.rb +5 -5
  31. data/mod/01_history/set/all/actions.rb +6 -2
  32. data/mod/01_history/set/all/content_history.rb +17 -2
  33. data/mod/01_history/set/all/history.rb +1 -1
  34. data/mod/02_basic_types/set/all/file.rb +0 -31
  35. data/mod/03_machines/lib/javascript/jquery.fileupload.js +539 -182
  36. data/mod/03_machines/lib/javascript/wagn.js.coffee +3 -0
  37. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +20 -18
  38. data/mod/03_machines/lib/stylesheets/style_cards.scss +28 -1
  39. data/mod/05_email/set/all/notify.rb +1 -1
  40. data/mod/05_standard/file/favicon/image-icon.png +0 -0
  41. data/mod/05_standard/file/favicon/image-large.png +0 -0
  42. data/mod/05_standard/file/favicon/image-medium.png +0 -0
  43. data/mod/05_standard/file/favicon/image-original.png +0 -0
  44. data/mod/05_standard/file/favicon/image-small.png +0 -0
  45. data/mod/05_standard/lib/carrier_wave/cardmount.rb +25 -6
  46. data/mod/05_standard/lib/file_uploader.rb +27 -11
  47. data/mod/05_standard/lib/image_uploader.rb +7 -4
  48. data/mod/05_standard/set/abstract/attachment.rb +132 -14
  49. data/mod/05_standard/set/right/account.rb +2 -2
  50. data/mod/05_standard/set/self/signin.rb +0 -1
  51. data/mod/05_standard/set/type/file.rb +48 -19
  52. data/mod/05_standard/set/type/image.rb +9 -12
  53. data/mod/05_standard/spec/chunk/include_spec.rb +13 -12
  54. data/mod/05_standard/spec/chunk/query_reference_spec.rb +50 -0
  55. data/mod/05_standard/spec/set/right/account_spec.rb +24 -25
  56. data/mod/05_standard/spec/set/type/file_spec.rb +1 -1
  57. data/spec/lib/card/reference_spec.rb +14 -0
  58. data/spec/lib/card/success_spec.rb +142 -0
  59. data/tmpsets/set/mod001-01_core/all/collection.rb +1 -1
  60. data/tmpsets/set/mod001-01_core/all/name.rb +2 -1
  61. data/tmpsets/set/mod001-01_core/all/phases.rb +12 -2
  62. data/tmpsets/set/mod001-01_core/all/type.rb +5 -5
  63. data/tmpsets/set/mod002-01_history/all/actions.rb +6 -2
  64. data/tmpsets/set/mod002-01_history/all/content_history.rb +17 -2
  65. data/tmpsets/set/mod002-01_history/all/history.rb +1 -1
  66. data/tmpsets/set/mod003-02_basic_types/all/file.rb +0 -24
  67. data/tmpsets/set/mod003-02_basic_types/all/rss.rb +8 -5
  68. data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +2 -2
  69. data/tmpsets/set/mod005-04_settings/right/structure.rb +7 -2
  70. data/tmpsets/set/mod006-05_email/all/notify.rb +1 -1
  71. data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +132 -14
  72. data/tmpsets/set/mod007-05_standard/all/links.rb +8 -0
  73. data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +5 -7
  74. data/tmpsets/set/mod007-05_standard/right/account.rb +2 -2
  75. data/tmpsets/set/mod007-05_standard/self/signin.rb +0 -1
  76. data/tmpsets/set/mod007-05_standard/type/file.rb +49 -20
  77. data/tmpsets/set/mod007-05_standard/type/image.rb +9 -12
  78. data/tmpsets/set/mod007-05_standard/type/search_type.rb +40 -22
  79. data/tmpsets/set/mod008-06_bootstrap/self/bootswatch_shared.rb +1 -1
  80. metadata +10 -4
@@ -149,5 +149,13 @@ format :html do
149
149
  end
150
150
 
151
151
 
152
+ format :css do
153
+ def link_to text, href, opts={}
154
+ interpret_href href
155
+ end
156
+
157
+ end
158
+
159
+
152
160
  # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/all/links.rb ~~~~~~~~~~~
153
161
  end;end;end;end;
@@ -17,13 +17,11 @@ format :html do
17
17
  end
18
18
 
19
19
  def default_header_args args
20
- if @slot_view == :open
21
- if (show_view?(:toolbar,args.merge(:default_visibility=>:hide)) || toolbar_pinned?) && card.type_code != :basic
22
- args[:optional_type_info] ||= :show
23
- end
24
- if toolbar_pinned?
25
- args[:optional_toolbar] ||= :show
26
- end
20
+ if @slot_view == :open && toolbar_pinned?
21
+ args[:optional_toolbar] ||= :show
22
+ end
23
+ if show_view?(:toolbar,args.merge(:default_visibility=>:hide)) && card.type_code != :basic
24
+ args[:optional_type_info] ||= :show
27
25
  end
28
26
  end
29
27
 
@@ -96,11 +96,11 @@ event :reset_password, :on=>:update, :before=>:approve, :when=>proc{ |c| c.has_r
96
96
  case ( result = authenticate_by_token @env_token )
97
97
  when Integer
98
98
  Auth.signin result
99
- Env.params[:success] = edit_password_success_args
99
+ success << edit_password_success_args
100
100
  abort :success
101
101
  when :token_expired
102
102
  send_reset_password_token
103
- Env.params[:success] = {
103
+ success << {
104
104
  :id => '_self',
105
105
  :view => 'message',
106
106
  :message => "Sorry, this token has expired. Please check your email for a new password reset link."
@@ -32,7 +32,6 @@ format :html do
32
32
 
33
33
  view :core do |args|
34
34
  account = card.fetch :trait=>:account, :new=>{}
35
-
36
35
  form_args = {
37
36
  :hidden => { :success=>"REDIRECT: #{interrupted_action || '*previous'}" },
38
37
  :recaptcha => :off
@@ -1,9 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
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 ~~~~~~~~~~~
3
- include Abstract::Attachment
4
-
5
- set_specific_attributes :file, :remote_file_url
6
- mount_uploader :file, FileUploader
3
+ attachment :file, :uploader=>FileUploader
7
4
 
8
5
  format do
9
6
  view :source do |args|
@@ -42,7 +39,7 @@ format :file do
42
39
  [ file.path,
43
40
  {
44
41
  :type => file.content_type,
45
- :filename => "#{card.cardname.safe_key}.#{file.extension}",
42
+ :filename => "#{card.cardname.safe_key}#{file.extension}",
46
43
  :x_sendfile => true,
47
44
  :disposition => (params[:format]=='file' ? 'attachment' : 'inline' )
48
45
  }
@@ -68,29 +65,61 @@ format :html do
68
65
  end
69
66
 
70
67
  view :editor do |args|
71
- #Rails.logger.debug "editor for file #{card.inspect}"
72
68
  file_chooser args
73
69
  end
74
70
 
75
- def file_chooser args, db_column=:file
76
- preview =
77
- if !card.new_card?
78
- content_tag :div, _render_core(args).html_safe,
79
- :class=>'attachment-preview', :id=>"#{card.attachment.filename}-preview"
80
- end
81
71
 
72
+ def preview args
73
+ ''
74
+ end
75
+
76
+ view :preview_editor, :tags=>:unknown_ok do |args|
77
+ <<-HTML
78
+ <div class="chosen-file">
79
+ <input type="hidden" name="cached_upload" value="#{card.selected_action_id}">
80
+ <table role="presentation" class="table table-striped"><tbody class="files">
81
+ <tr class="template-download fade in">
82
+ <td>
83
+ <span class="preview">
84
+ #{preview(args)}
85
+ </span>
86
+ </td>
87
+ <td>
88
+ <p class="name">
89
+ #{card.original_filename}
90
+ </p>
91
+ </td>
92
+ <td>
93
+ <span class="size">#{number_to_human_size(card.attachment.size)}</span>
94
+ </td>
95
+ <td class="pull-right">
96
+ <button class="btn btn-danger delete cancel-upload" data-type="DELETE">
97
+ <i class="glyphicon glyphicon-trash"></i>
98
+ <span>Delete</span>
99
+ </button>
100
+ </td>
101
+ </tr></tbody>
102
+ </table>
103
+ </div>
104
+ HTML
105
+ end
106
+
107
+ def file_chooser args
82
108
  <<-HTML
83
109
  <div class="choose-file">
84
- #{preview}
85
- <div>#{file_field db_column, :class=>'file-upload slotter'}</div>
110
+ #{preview(args)}
111
+ <span class="btn btn-success fileinput-button">
112
+ <i class="glyphicon glyphicon-cloud-upload"></i>
113
+ <span>
114
+ #{@slot_view == :edit ? 'Replace' : 'Add'} #{card.attachment_name}...
115
+ </span>
116
+ #{file_field card.attachment_name, :class=>'file-upload slotter'}
117
+ </span>
86
118
  </div>
87
- <div class="chosen-file" style="display:none">
88
- <div>
89
- <label>File chosen:</label>
90
- <span class="chosen-filename"></span>
91
- </div>
92
- <div><a class="cancel-upload">Unchoose</a></div>
119
+ <div id="progress" class="progress" style="display: none;">
120
+ <div class="progress-bar progress-bar-success" style="width: 0%;"></div>
93
121
  </div>
122
+ <div class="chosen-file"></div>
94
123
  HTML
95
124
  end
96
125
 
@@ -1,9 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
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 ~~~~~~~~~~~
3
- include Abstract::Attachment
4
- set_specific_attributes :image, :remote_image_url
5
- mount_uploader :image, ImageUploader
6
-
3
+ attachment :image, :uploader=>ImageUploader
7
4
 
8
5
  format do
9
6
 
@@ -33,28 +30,28 @@ end
33
30
  format :html do
34
31
  include File::HtmlFormat
35
32
 
36
-
37
- view :editor do |args|
38
- file_chooser args, :image
39
- end
40
-
41
-
42
33
  view :core do |args|
43
34
  handle_source args do |source|
44
35
  source == 'missing' ? "<!-- image missing #{@card.name} -->" : image_tag(source)
45
36
  end
46
37
  end
47
38
 
39
+ def preview args
40
+ if !card.new_card? || card.preliminary_upload?
41
+ content_tag( :div, _render_core(args.merge(:size=>:medium)).html_safe,
42
+ :class=>'attachment-preview', :id=>"#{card.attachment.filename}-preview")
43
+ end
44
+ end
48
45
 
49
46
  view :content_changes do |args|
50
47
  out = ''
51
48
  size = args[:diff_type]==:summary ? :icon : :medium
52
49
  if !args[:hide_diff] and args[:action] and last_change = card.last_change_on(:db_content,:before=>args[:action])
53
50
  card.selected_action_id=last_change.card_action_id
54
- out << Card::Diff.render_added_chunk(_render_core(:size=>size))
51
+ out << Card::Diff.render_deleted_chunk(_render_core(:size=>size))
55
52
  end
56
53
  card.selected_action_id=args[:action].id
57
- out << Card::Diff.render_deleted_chunk(_render_core(:size=>size))
54
+ out << Card::Diff.render_added_chunk(_render_core(:size=>size))
58
55
  out
59
56
  end
60
57
 
@@ -48,18 +48,22 @@ end
48
48
  format do
49
49
 
50
50
  view :core do |args|
51
- search_vars args
52
-
53
- case
54
- when e = search_vars[:error]
55
- %{#{e.class.to_s} :: #{e.message} :: #{card.raw_content}}
56
- when search_vars[:query][:return] =='count'
57
- search_results.to_s
58
- when @mode == :template
59
- render :raw
60
- else
61
- _render_card_list args
62
- end
51
+ view = case search_results args
52
+ when Exception ; :search_error
53
+ when Integer ; :search_count
54
+ when @mode == :template ; :raw
55
+ else ; :card_list
56
+ end
57
+ _render view, args
58
+ end
59
+
60
+
61
+ view :search_count do |args|
62
+ search_results.to_s
63
+ end
64
+
65
+ view :search_error do |args|
66
+ %{#{search_results.class.to_s} :: #{search_results.message} :: #{card.raw_content}}
63
67
  end
64
68
 
65
69
  view :card_list do |args|
@@ -76,7 +80,7 @@ format do
76
80
  @search_vars ||=
77
81
  begin
78
82
  v = {}
79
- v[:query] = card.query(search_params)
83
+ v[:query] = card.query( search_params )
80
84
  v[:item] = set_inclusion_opts args.merge( :query_view=>v[:query][:view] )
81
85
  v
82
86
  rescue =>e
@@ -84,13 +88,17 @@ format do
84
88
  end
85
89
  end
86
90
 
87
- def search_results
88
- @search_results ||=
89
- begin
90
- card.item_cards search_params
91
- rescue => e
92
- { :error => e}
91
+ def search_results args={}
92
+ @search_results ||= begin
93
+ search_vars args
94
+ if search_vars[:error]
95
+ search_vars[:error]
96
+ else
97
+ raw_results = card.item_cards search_params
98
+ is_count = search_vars[:query][:return] =='count'
99
+ is_count ? raw_results.to_i : raw_results
93
100
  end
101
+ end
94
102
  end
95
103
 
96
104
  def search_result_names
@@ -180,9 +188,19 @@ format :json do
180
188
  end
181
189
 
182
190
  format :rss do
183
- def raw_feed_items
184
- search_params.merge!(:default_limit => 25)
185
- search_results
191
+ view :feed_body do |args|
192
+ case raw_feed_items args
193
+ when Exception ; @xml.item { render :search_error }
194
+ when Integer ; @xml.item { render :search_count }
195
+ else super
196
+ end
197
+ end
198
+
199
+ def raw_feed_items args
200
+ @raw_feed_items ||= begin
201
+ search_params.merge!(:default_limit => 25)
202
+ search_results
203
+ end
186
204
  end
187
205
  end
188
206
 
@@ -7,7 +7,7 @@ view :raw do |args|
7
7
  content = File.read("#{bootstrap_path}/_variables.scss")
8
8
  content += %{
9
9
  $bootstrap-sass-asset-helper: false;
10
- $icon-font-path: "#{card_path '/assets/fonts/'}";
10
+ $icon-font-path: "#{card_path 'assets/fonts/'}";
11
11
  }
12
12
  # mixins
13
13
  content += Dir.glob("#{bootstrap_path}/mixins/*.scss").map do |name|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.3
4
+ version: 1.16.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-08-23 00:00:00.000000000 Z
14
+ date: 2015-09-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: smartname
@@ -89,14 +89,14 @@ dependencies:
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: '4.2'
92
+ version: 4.2.10
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: '4.2'
99
+ version: 4.2.10
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: recaptcha
102
102
  requirement: !ruby/object:Gem::Requirement
@@ -302,6 +302,8 @@ files:
302
302
  - db/migrate_core_cards/20150702130543_remove_edit_toolbar_pinned.rb
303
303
  - db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb
304
304
  - db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb
305
+ - db/migrate_core_cards/20150824135418_update_file_history.rb
306
+ - db/migrate_core_cards/20150903130006_attachment_upload_cards.rb
305
307
  - db/migrate_core_cards/data/1.11_help_text.json
306
308
  - db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss
307
309
  - db/migrate_core_cards/data/1.12_stylesheets/common.scss
@@ -402,6 +404,7 @@ files:
402
404
  - lib/card/set_pattern.rb
403
405
  - lib/card/simplecov_helper.rb
404
406
  - lib/card/spec_helper.rb
407
+ - lib/card/success.rb
405
408
  - lib/card/version.rb
406
409
  - lib/card/view_cache.rb
407
410
  - lib/card/view_name.rb
@@ -722,6 +725,7 @@ files:
722
725
  - mod/05_standard/set/type/user.rb
723
726
  - mod/05_standard/spec/chunk/include_spec.rb
724
727
  - mod/05_standard/spec/chunk/link_spec.rb
728
+ - mod/05_standard/spec/chunk/query_reference_spec.rb
725
729
  - mod/05_standard/spec/format/css_format_spec.rb
726
730
  - mod/05_standard/spec/format/csv_format_spec.rb
727
731
  - mod/05_standard/spec/format/email_html_format_spec.rb
@@ -957,6 +961,7 @@ files:
957
961
  - spec/lib/card/reference_spec.rb
958
962
  - spec/lib/card/set_pattern_spec.rb
959
963
  - spec/lib/card/set_spec.rb
964
+ - spec/lib/card/success_spec.rb
960
965
  - spec/mailers/mailer_spec.rb
961
966
  - spec/models/card/cardtype_spec.rb
962
967
  - spec/models/card/create_spec.rb
@@ -1185,6 +1190,7 @@ test_files:
1185
1190
  - spec/lib/card/reference_spec.rb
1186
1191
  - spec/lib/card/set_pattern_spec.rb
1187
1192
  - spec/lib/card/set_spec.rb
1193
+ - spec/lib/card/success_spec.rb
1188
1194
  - spec/mailers/mailer_spec.rb
1189
1195
  - spec/models/card/cardtype_spec.rb
1190
1196
  - spec/models/card/create_spec.rb