card 1.16.13 → 1.16.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20150501010515_responsive_sidebar.rb +11 -0
  4. data/db/schema.rb +1 -1
  5. data/lib/card/auth.rb +3 -2
  6. data/lib/card/env.rb +1 -1
  7. data/lib/card/loader.rb +79 -40
  8. data/lib/card/query.rb +5 -5
  9. data/lib/card/query/sql_statement.rb +10 -4
  10. data/lib/card/query/value.rb +5 -8
  11. data/lib/card/set.rb +0 -1
  12. data/lib/cardio.rb +18 -22
  13. data/mod/01_core/chunk/link.rb +37 -34
  14. data/mod/01_core/chunk/query_reference.rb +1 -1
  15. data/mod/01_core/set/all/fetch.rb +66 -58
  16. data/mod/01_core/set/all/permissions.rb +84 -83
  17. data/mod/01_core/set/all/templating.rb +6 -5
  18. data/mod/01_core/set/all/type.rb +16 -14
  19. data/mod/02_basic_types/set/all/base.rb +3 -3
  20. data/mod/02_basic_types/set/type/pointer.rb +4 -4
  21. data/mod/02_basic_types/spec/set/all/base_spec.rb +16 -1
  22. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +65 -0
  23. data/mod/05_email/set/all/follow.rb +6 -10
  24. data/mod/05_email/set/type/email_template.rb +1 -1
  25. data/mod/05_standard/lib/file_uploader.rb +39 -41
  26. data/mod/05_standard/set/all/account.rb +18 -20
  27. data/mod/05_standard/set/all/rich_html/toolbar.rb +1 -1
  28. data/mod/05_standard/set/right/account.rb +2 -2
  29. data/mod/05_standard/set/right/email.rb +14 -13
  30. data/mod/05_standard/set/right/password.rb +20 -12
  31. data/mod/05_standard/set/right/status.rb +2 -2
  32. data/mod/05_standard/set/self/head.rb +66 -53
  33. data/mod/05_standard/set/type/search_type.rb +3 -2
  34. data/mod/05_standard/set/type/set.rb +3 -3
  35. data/mod/06_bootstrap/lib/stylesheets/bootstrap_cards.scss +50 -0
  36. data/spec/lib/card/query_spec.rb +7 -0
  37. data/spec/spec_helper.rb +1 -1
  38. metadata +3 -2
@@ -29,7 +29,7 @@ def template
29
29
  end
30
30
 
31
31
  # EXISTING CARDS
32
- elsif structure = structure_rule_card
32
+ elsif (structure = structure_rule_card)
33
33
  repair_type structure.type_id if assign_type_to?(structure)
34
34
  structure
35
35
  end
@@ -60,7 +60,7 @@ def structure_rule_card
60
60
  end
61
61
 
62
62
  def structuree_names
63
- if wql = structuree_spec
63
+ if (wql = structuree_spec)
64
64
  Auth.as_bot do
65
65
  Card::Query.run(wql.merge return: :name)
66
66
  end
@@ -82,7 +82,7 @@ def update_structurees args
82
82
  # note that this is not smart about overriding templating rules
83
83
  # for example, if someone were to change the type of a +*right+*structure rule that was overridden
84
84
  # by a +*type plus right+*structure rule, the override would not be respected.
85
- if query = structuree_spec
85
+ if (query = structuree_spec)
86
86
  Auth.as_bot do
87
87
  query[:return] = :id
88
88
  Card::Query.run(query).each_slice(100) do |id_batch|
@@ -115,8 +115,9 @@ def repair_type template_type_id
115
115
  end
116
116
 
117
117
  def structuree_spec
118
- if is_structure? and c=trunk and c.type_id = Card::SetID #could use is_rule?...
119
- c.get_query
118
+ # could use is_rule?...
119
+ if is_structure? && (ca = trunk) && (ca.type_id = Card::SetID)
120
+ ca.get_query
120
121
  end
121
122
  end
122
123
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  module ClassMethods
3
3
  def default_type_id
4
- @@default_type_id ||= Card[:all].fetch( trait: :default ).type_id
4
+ @@default_type_id ||= Card[:all].fetch(trait: :default).type_id
5
5
  end
6
6
  end
7
7
 
@@ -11,7 +11,7 @@ def type_card
11
11
  end
12
12
 
13
13
  def type_code
14
- Card::Codename[ type_id.to_i ]
14
+ Card::Codename[type_id.to_i]
15
15
  end
16
16
 
17
17
  def type_name
@@ -27,38 +27,40 @@ def type= type_name
27
27
  end
28
28
 
29
29
  def get_type_id_from_structure
30
- if name && (t = template)
31
- reset_patterns # still necessary even with new template handling?
32
- t.type_id
33
- end
30
+ return unless name && (t = template)
31
+ reset_patterns # still necessary even with new template handling?
32
+ t.type_id
34
33
  end
35
34
 
36
35
  event :validate_type_change, before: :approve, on: :update, changed: :type_id do
37
- if c = dup and c.action == :create and !c.valid?
38
- errors.add :type, "of #{ name } can't be changed; errors creating new #{ type_id }: #{ c.errors.full_messages * ', ' }"
36
+ if (c = dup) && c.action == :create && !c.valid?
37
+ errors.add :type, "of #{ name } can't be changed; errors creating new " \
38
+ "#{ type_id }: #{ c.errors.full_messages * ', ' }"
39
39
  end
40
40
  end
41
41
 
42
42
  event :validate_type, before: :approve, changed: :type_id do
43
43
  if !type_name
44
- errors.add :type, "No such type"
44
+ errors.add :type, 'No such type'
45
45
  end
46
46
 
47
- if rt = structure and rt.assigns_type? and type_id!=rt.type_id
48
- errors.add :type, "can't be changed because #{name} is hard templated to #{rt.type_name}"
47
+ if (rt = structure) && rt.assigns_type? && type_id != rt.type_id
48
+ errors.add :type, "can't be changed because #{name} is hard templated " \
49
+ "to #{rt.type_name}"
49
50
  end
50
51
  end
51
52
 
52
53
  event :reset_type_specific_fields, after: :store do
53
54
  Auth.as_bot do
54
- Card.search left: { left_id: type_id }, right: {codename: 'type_plus_right'} do |set_card|
55
+ Card.search left: { left_id: type_id },
56
+ right: { codename: 'type_plus_right' } do |set_card|
55
57
  set_card.reset_set_patterns
56
58
  end
57
59
  end
58
60
  end
59
61
 
60
- # Card.search left_plus: [ type_name, right_plus: {codename: 'type_plus_right'}] do |right_anchor|
62
+ # Card.search left_plus: [ type_name, right_plus: {codename:
63
+ # 'type_plus_right'}] do |right_anchor|
61
64
  # Card["#{lef}"]
62
65
  # set_card.reset_set_patterns
63
66
  # end
64
-
@@ -92,9 +92,9 @@ format do
92
92
  # FIXME: - relativity should be handled in smartname
93
93
  return '' unless args[:inc_name]
94
94
  name = args[:inc_name].to_name
95
- stripped_name = name.stripped.to_name
95
+ stripped = name.stripped
96
96
 
97
- if name.relative? && !stripped_name.starts_with_joint?
97
+ if name.relative? && !stripped.to_name.starts_with_joint?
98
98
  # not a simple relative name; just return the original syntax
99
99
  "{{#{args[:inc_syntax]}}}"
100
100
  else
@@ -105,7 +105,7 @@ format do
105
105
  when type = on_type_set
106
106
  "#{type}#{name}+#{Card[:type_plus_right].name}" # *type plus right
107
107
  else
108
- "#{stripped_name.gsub(/^\+/, '')}+#{Card[:right].name}" # *right
108
+ "#{stripped.gsub(/^\+/, '')}+#{Card[:right].name}" # *right
109
109
  end
110
110
  subformat(Card.fetch set_name).render_template_link args
111
111
  end
@@ -343,24 +343,24 @@ def options_rule_card
343
343
  end
344
344
 
345
345
  def option_names
346
- result_cards = if oc = options_rule_card
346
+ result_cards = if (oc = options_rule_card)
347
347
  oc.item_names default_limit: 50, context: name
348
348
  else
349
349
  Card.search sort: 'name', limit: 50, return: :name
350
350
  end
351
- if selected_options = item_names
351
+ if (selected_options = item_names)
352
352
  result_cards = result_cards | selected_options
353
353
  end
354
354
  result_cards
355
355
  end
356
356
 
357
357
  def option_cards
358
- result_cards = if oc = options_rule_card
358
+ result_cards = if (oc = options_rule_card)
359
359
  oc.item_cards default_limit: 50, context: name
360
360
  else
361
361
  Card.search sort: 'alpha', limit: 50
362
362
  end
363
- if selected_options = item_names
363
+ if (selected_options = item_names)
364
364
  selected_options.each do |item|
365
365
  result_cards.push Card.fetch(item,new: {})
366
366
  end
@@ -51,7 +51,22 @@ describe Card::Set::All::Base do
51
51
  expect(render_card(:array, content: 'yoing')).to eq(%{["yoing"]})
52
52
  end
53
53
  end
54
-
54
+ it 'renders template rule of embed cards based on set' do
55
+ Card::Auth.as_bot
56
+ content = '{{_left+test_another_card|content|content;'\
57
+ 'structure:test_another_card_structure}}'
58
+ card = Card.create! name: 'test_card+*right+*structure',
59
+ type_id: Card::HTMLID, content: content
60
+ Card.create! name: 'test_another_card+*right+*structure',
61
+ type_id: Card::SearchTypeID,
62
+ content: ' {"type":"basic","left":"_1"}'
63
+ html = card.format.render_open
64
+ href = '/test_another_card+*right?view=template_editor'
65
+ text = '_left+test_another_card|content|content;'\
66
+ 'structure:test_another_card_structure'
67
+ expect(html).to have_tag('a', with: { class: 'slotter', href: href },
68
+ text: text)
69
+ end
55
70
  end
56
71
  end
57
72
 
@@ -174,9 +174,68 @@ $.extend wagn,
174
174
  /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(userAgent) or /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4))
175
175
 
176
176
 
177
+ # sidebars
178
+
179
+ wrapDeckoLayout = () ->
180
+ $('body > article, body > aside, body > footer').wrapAll('<div class="container"/>')
181
+ $('div.container > article, div.container > aside').wrapAll('<div class="row row-offcanvas">')
182
+
183
+ wrapSidebarToggle = (toggle) ->
184
+ "<div class='container'><div class='row'>#{toggle}</div></div>"
185
+
186
+ sidebarToggle = (side) ->
187
+ "<button class='offcanvas-toggle offcanvas-toggle-#{side} btn btn-secondary visible-xs' data-toggle='offcanvas-#{side}'><span class='glyphicon glyphicon-chevron-#{if side == 'left' then 'right' else 'left'}'/></button>"
188
+
189
+ singleSidebar = (side) ->
190
+ $article = $('body > article').first()
191
+ $aside = $('body > aside').first()
192
+ $article.addClass("col-xs-12 col-sm-9")
193
+ $aside.addClass("col-xs-6 col-sm-3 sidebar-offcanvas sidebar-offcanvas-#{side}")
194
+ if side == 'left'
195
+ $('body').append($aside).append($article)
196
+ else
197
+ $('body').append($article).append($aside)
198
+
199
+ wrapDeckoLayout()
200
+ $article.prepend(wrapSidebarToggle(sidebarToggle(side)))
201
+
202
+
203
+ doubleSidebar = ->
204
+ $article = $('body > article').first()
205
+ $asideLeft = $('body > aside').first()
206
+ $asideRight = $($('body > aside')[1])
207
+ $article.addClass("col-xs-12 col-sm-6")
208
+ $asideLeft.addClass("col-xs-6 col-sm-3 sidebar-offcanvas sidebar-offcanvas-left")
209
+ $asideRight.addClass("col-xs-6 col-sm-3 sidebar-offcanvas sidebar-offcanvas-right")
210
+ $('body').append($asideLeft).append($article).append($asideRight)
211
+
212
+ wrapDeckoLayout()
213
+ $article.prepend(wrapSidebarToggle("#{sidebarToggle('right')}#{sidebarToggle('left')}"))
177
214
 
178
215
  $(window).ready ->
179
216
 
217
+ #sidebar
218
+
219
+ switch
220
+ when $('body').hasClass('right-sidebar')
221
+ singleSidebar('right')
222
+
223
+ when $('body').hasClass('left-sidebar')
224
+ singleSidebar('left')
225
+
226
+ when $('body').hasClass('two-sidebar')
227
+ doubleSidebar()
228
+
229
+ $('[data-toggle="offcanvas-left"]').click ->
230
+ $('.row-offcanvas').removeClass('right-active').toggleClass('left-active')
231
+ $(this).find('span.glyphicon').toggleClass('glyphicon-chevron-left glyphicon-chevron-right')
232
+ $('[data-toggle="offcanvas-right"]').click ->
233
+ $('.row-offcanvas').removeClass('left-active').toggleClass('right-active')
234
+ $(this).find('span.glyphicon').toggleClass('glyphicon-chevron-left glyphicon-chevron-right')
235
+
236
+
237
+
238
+
180
239
  $('body').on 'click', '.cancel-upload', ->
181
240
  editor = $(this).closest '.card-editor'
182
241
  editor.find('.choose-file').show()
@@ -196,6 +255,8 @@ $(window).ready ->
196
255
  # sadly, it also causes odd navbox behavior, resetting the search term
197
256
  }
198
257
 
258
+
259
+
199
260
  #pointer mod
200
261
  $('body').on 'click', '.pointer-item-add', (event)->
201
262
  last_item = $(this).closest('.content-editor').find '.pointer-li:last'
@@ -485,3 +546,7 @@ navbox_select = (event, ui) ->
485
546
 
486
547
 
487
548
 
549
+
550
+
551
+
552
+
@@ -186,22 +186,22 @@ def follower_ids
186
186
  end
187
187
  end
188
188
 
189
-
190
189
  def direct_followers
191
190
  direct_follower_ids.map do |id|
192
191
  Card.fetch(id)
193
192
  end
194
193
  end
195
194
 
196
- # all ids of users that follow this card because of a follow rule that applies to this card
197
- # doesn't include users that follow this card because they are following parent cards or other cards that include this card
195
+ # all ids of users that follow this card because of a follow rule that applies
196
+ # to this card doesn't include users that follow this card because they are
197
+ # following parent cards or other cards that include this card
198
198
  def direct_follower_ids args={}
199
199
  result = ::Set.new
200
200
  with_follower_candidate_ids do
201
201
  set_names.each do |set_name|
202
202
  set_card = Card.fetch(set_name)
203
203
  set_card.all_user_ids_with_rule_for(:follow).each do |user_id|
204
- if (!result.include? user_id) and self.follow_rule_applies?(user_id)
204
+ if (!result.include? user_id) && self.follow_rule_applies?(user_id)
205
205
  result << user_id
206
206
  end
207
207
  end
@@ -216,7 +216,8 @@ def all_direct_follower_ids_with_reason
216
216
  set_names.each do |set_name|
217
217
  set_card = Card.fetch(set_name)
218
218
  set_card.all_user_ids_with_rule_for(:follow).each do |user_id|
219
- if (!visited.include?(user_id)) && (follow_option = self.follow_rule_applies?(user_id))
219
+ if (!visited.include?(user_id)) &&
220
+ (follow_option = self.follow_rule_applies?(user_id))
220
221
  visited << user_id
221
222
  yield(user_id, set_card: set_card, option: follow_option)
222
223
  end
@@ -225,8 +226,6 @@ def all_direct_follower_ids_with_reason
225
226
  end
226
227
  end
227
228
 
228
-
229
-
230
229
  #~~~~~ cache methods
231
230
 
232
231
  def write_follower_ids_cache user_ids
@@ -240,7 +239,6 @@ def read_follower_ids_cache
240
239
  end
241
240
 
242
241
  module ClassMethods
243
-
244
242
  def follow_caches_expired
245
243
  Card.clear_follower_ids_cache
246
244
  Card.clear_user_rule_cache
@@ -257,6 +255,4 @@ module ClassMethods
257
255
  def clear_follower_ids_cache
258
256
  Card.cache.write FOLLOWER_IDS_CACHE_KEY, nil
259
257
  end
260
-
261
258
  end
262
-
@@ -101,7 +101,7 @@ format do
101
101
 
102
102
  if attachment_list
103
103
  attachment_list.each_with_index do |cardname, i|
104
- if c = Card[ cardname ] and c.respond_to?(:attachment)
104
+ if (c = Card[ cardname ]) && c.respond_to?(:attachment)
105
105
  add_file filename: "attachment-#{i + 1}.#{c.attachment.extension}", content: File.read( c.attachment.path )
106
106
  end
107
107
  end
@@ -1,38 +1,33 @@
1
- =begin
2
-
3
- *DATABASE_CONTENT*
4
- if in mod:
5
- :codename/modname.ext
6
- else
7
- ~card_id/action_id.ext
8
-
9
- *FILE SYSTEM*
10
- if in mod
11
- (mod_dir)/files/codename/type_code-variant.ext (no colon on codename!)
12
- else
13
- (files_dir)/id/action_id-variant.ext (no tilde on id!)
14
-
15
- variant = icon|small|medium|large|original (only for images)
16
-
17
- *URLS*
18
- mark.ext
19
- mark/revision.ext
20
- mark/revision-variant.ext
21
-
22
- revision = modname or action_id
23
-
24
- Examples:
25
- ~22/33-medium.png
26
- :yeti_skin/05_standard-large.png
27
-
28
- =end
29
-
1
+ # *DATABASE_CONTENT*
2
+ # if in mod:
3
+ # :codename/modname.ext
4
+ # else
5
+ # ~card_id/action_id.ext
6
+ #
7
+ # *FILE SYSTEM*
8
+ # if in mod
9
+ # (mod_dir)/files/codename/type_code-variant.ext (no colon on codename!)
10
+ # else
11
+ # (files_dir)/id/action_id-variant.ext (no tilde on id!)
12
+ #
13
+ # variant = icon|small|medium|large|original (only for images)
14
+ #
15
+ # *URLS*
16
+ # mark.ext
17
+ # mark/revision.ext
18
+ # mark/revision-variant.ext
19
+ #
20
+ # revision = modname or action_id
21
+ #
22
+ # Examples:
23
+ # ~22/33-medium.png
24
+ # :yeti_skin/05_standard-large.png
30
25
 
31
26
  module CarrierWave::Uploader::Versions
32
27
  private
33
28
 
34
29
  # put version at the end of the filename
35
- def full_filename(for_file)
30
+ def full_filename for_file
36
31
  name = super(for_file)
37
32
  parts = name.split '.'
38
33
  basename = [parts.shift, version_name].compact.join('-')
@@ -56,9 +51,9 @@ class FileUploader < CarrierWave::Uploader::Base
56
51
 
57
52
  def extension
58
53
  case
59
- when file && file.extension.present? ; ".#{file.extension}"
60
- when card_content = model.content ; File.extname(card_content)
61
- when orig = original_filename ; File.extname(orig)
54
+ when file && file.extension.present? then ".#{file.extension}"
55
+ when card_content = model.content then File.extname(card_content)
56
+ when orig = original_filename then File.extname(orig)
62
57
  else ''
63
58
  end.downcase
64
59
  end
@@ -68,7 +63,7 @@ class FileUploader < CarrierWave::Uploader::Base
68
63
  if opts[:mod] && !model.load_from_mod
69
64
  model.load_from_mod = opts[:mod]
70
65
  end
71
- "%s/%s" % [file_dir, url_filename(opts)]
66
+ '%s/%s' % [file_dir, url_filename(opts)]
72
67
  end
73
68
 
74
69
  def url_filename opts={}
@@ -84,7 +79,8 @@ class FileUploader < CarrierWave::Uploader::Base
84
79
  end
85
80
 
86
81
  def url opts = {}
87
- "%s/%s/%s" % [card_path(Card.config.files_web_path), file_dir, full_filename(url_filename(opts))]
82
+ '%s/%s/%s' % [card_path(Card.config.files_web_path), file_dir,
83
+ full_filename(url_filename(opts))]
88
84
  end
89
85
 
90
86
  def file_dir
@@ -104,8 +100,9 @@ class FileUploader < CarrierWave::Uploader::Base
104
100
  # Carrierwave calls store_path without argument when it stores the file
105
101
  # and with the identifier from the db when it retrieves the file
106
102
  # In our case the first part of our identifier is not part of the path
107
- # but we can construct the filename from db data. So we don't need the identifier.
108
- def store_path(for_file=nil) #
103
+ # but we can construct the filename from db data. So we don't need the
104
+ # identifier.
105
+ def store_path for_file=nil
109
106
  if for_file
110
107
  retrieve_path
111
108
  else
@@ -124,17 +121,18 @@ class FileUploader < CarrierWave::Uploader::Base
124
121
  File.join model.tmp_upload_dir, filename
125
122
  end
126
123
 
127
- def create_versions? new_file
124
+ def create_versions? _new_file
128
125
  model.create_versions?
129
126
  end
130
127
 
131
128
  # paperclip compatibility used in type/file.rb#core (base format)
132
- def path(version=nil)
129
+ def path version=nil
133
130
  version ? versions[version].path : super()
134
131
  end
135
132
 
136
133
  def original_filename
137
- @original_filename ||= (model.selected_action && model.selected_action.comment)
134
+ @original_filename ||= model.selected_action &&
135
+ model.selected_action.comment
138
136
  end
139
137
 
140
138
  def store_dir
@@ -152,4 +150,4 @@ class FileUploader < CarrierWave::Uploader::Base
152
150
  def action_id
153
151
  model.selected_content_action_id
154
152
  end
155
- end
153
+ end