outpost-aggregator 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,15 @@
1
+ ## 1.1.3 (2014-03-19)
2
+ ### Fixes
3
+ * Fixed a z-index issue between dropzone empty message and alerts.
4
+
5
+ ### Changes
6
+ * Deprecated `dropLimit`. Replacement is `dropMaxLimit`.
7
+
8
+ ### Additions
9
+ * Added `dropMinLimit` to view options to notify the user when the minimum limit isn't satisfied. (Default: 0)
10
+ * Added a `dropRejectOverflow` option to determine whether or not the aggregator should reject upper-limit overflow. (default: true)
11
+
12
+
1
13
  ## 1.1.2
2
14
  ### Fixes
3
15
  * Fixed dropLimit
@@ -52,8 +52,10 @@ class outpost.Aggregator
52
52
  class @Base extends Backbone.View
53
53
  template: JST[Aggregator.TemplatePath + 'base']
54
54
  defaults:
55
- active: "recent"
56
- dropLimit: null
55
+ active : "recent"
56
+ dropMaxLimit : null,
57
+ dropMinLimit : 0
58
+ dropRejectOverflow : true
57
59
 
58
60
  #---------------------
59
61
 
@@ -89,11 +91,23 @@ class outpost.Aggregator
89
91
  @search = new outpost.Aggregator.Views.Search(base: @)
90
92
  @url = new outpost.Aggregator.Views.URL(base: @)
91
93
 
94
+ # Deprecation notice for dropLimit
95
+ if @options.dropLimit
96
+ console.warn(
97
+ "[outpost-aggregator] dropLimit is deprecated. " +
98
+ "Use dropMaxLimit and dropMinLimit")
99
+
100
+ if !@options.dropMaxLimit
101
+ @options.dropMaxLimit = @options.dropLimit
102
+
103
+
92
104
  # Build the Drop Zone section
93
105
  @dropZone = new outpost.Aggregator.Views.DropZone
94
106
  collection: @collection # The bootstrapped content
95
107
  base: @,
96
- limit: @options.dropLimit
108
+ minLimit : @options.dropMinLimit,
109
+ maxLimit : @options.dropMaxLimit,
110
+ rejectOverflow : @options.dropRejectOverflow
97
111
 
98
112
  @
99
113
 
@@ -118,7 +132,7 @@ class outpost.Aggregator
118
132
  new outpost.Notification(el, "warning",
119
133
  "That content is already in the drop zone.")
120
134
 
121
- limitReached: (el) ->
135
+ maxLimitReached: (el) ->
122
136
  new outpost.Notification(el, "warning",
123
137
  "The limit has been reached. Remove an article first.")
124
138
 
@@ -134,11 +148,16 @@ class outpost.Aggregator
134
148
 
135
149
  initialize: ->
136
150
  @base = @options.base
137
- @limit = @options.limit
151
+
152
+ @minLimit = @options.minLimit
153
+ @maxLimit = @options.maxLimit
154
+ @rejectOverflow = @options.rejectOverflow
138
155
 
139
156
  # Is there a limit? Add a notification to the top of the
140
- # drop zone to let them know.
141
- if @limit
157
+ # drop zone to let them know. For minLimit, we're taking
158
+ # advantage of 0 as falsey in Javascript. For maxLimit,
159
+ # the default is null, which is also falsey.
160
+ if @maxLimit or @minLimit
142
161
  @limitNotification =
143
162
  new outpost.Notification(@$el, "info", "Limit")
144
163
 
@@ -352,11 +371,16 @@ class outpost.Aggregator
352
371
  # Moves a model from the "found" section into the drop zone.
353
372
  # Converts its view into a ContentFull view.
354
373
  move: (el) ->
355
- # If the limit has already been reached.
374
+ # If the limit has already been reached, and we get here
375
+ # (i.e. we're trying to add another article), don't let
376
+ # the user add it. For minimum limits, we'll allow them
377
+ # to drop below the min limit, but will just warn them
378
+ # about it.
356
379
  # The updateLimitNotification() function should
357
380
  # warn the user about this.
358
- if @limitReached()
359
- @alert("limitReached")
381
+ if @maxLimit and @rejectOverflow and
382
+ @collection.length >= @maxLimit
383
+ @alert("maxLimitReached")
360
384
  return
361
385
 
362
386
  id = el.attr("data-id")
@@ -439,23 +463,41 @@ class outpost.Aggregator
439
463
 
440
464
 
441
465
  # Check if the limit has been reached, only if it exists.
442
- limitReached: ->
443
- @limit and @collection.length >= @limit
466
+ minLimitOk: ->
467
+ return true if !@minLimit
468
+ @collection.length >= @minLimit
469
+
470
+ maxLimitOk: ->
471
+ return true if !@maxLimit
472
+ @collection.length <= @maxLimit
473
+
474
+ withinRange: ->
475
+ @minLimitOk() and @maxLimitOk()
444
476
 
445
477
 
446
478
  # Updates the limit notification.
447
479
  # Updates the count, and changes the type if necessary.
448
480
  updateLimitNotification: ->
449
481
  return if not @limitNotification
482
+ spacer = "&nbsp;|&nbsp;"
450
483
 
451
484
  @limitNotification.message =
452
- "<strong>Limit:</strong> " +
453
- "#{@collection.length} / #{@limit}"
485
+ "<strong>Count:</strong> #{@collection.length}"
486
+
487
+ if @maxLimit
488
+ @limitNotification.message += spacer
489
+ @limitNotification.message +=
490
+ "<strong>Maximum:</strong> #{@maxLimit}"
491
+
492
+ if @minLimit
493
+ @limitNotification.message += spacer
494
+ @limitNotification.message +=
495
+ "<strong>Minimum:</strong> #{@minLimit}"
454
496
 
455
- if @limitReached()
497
+ if @withinRange()
456
498
  @limitNotification.type = "success"
457
499
  else
458
- @limitNotification.type = "info"
500
+ @limitNotification.type = "error"
459
501
 
460
502
  @limitNotification.rerender()
461
503
 
@@ -18,7 +18,9 @@
18
18
  .drop-zone.empty {
19
19
  position: relative;
20
20
  color: $grayLight;
21
+
21
22
  h1 {
23
+ z-index: 0;
22
24
  position: absolute;
23
25
  top: 60px;
24
26
  left: 50px;
@@ -28,6 +30,12 @@
28
30
  .drop-zone {
29
31
  max-height: 500px;
30
32
  overflow: auto;
33
+
34
+ .alert {
35
+ // Make alerts show in front of "Empty Message"
36
+ z-index: 1;
37
+ position: relative;
38
+ }
31
39
  }
32
40
 
33
41
  .content-list, .help-content {
@@ -1,5 +1,5 @@
1
1
  module Outpost
2
2
  module Aggregator
3
- VERSION = "1.1.2"
3
+ VERSION = "1.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outpost-aggregator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-07 00:00:00.000000000 Z
12
+ date: 2014-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &70110278587040 !ruby/object:Gem::Requirement
16
+ requirement: &70299703934960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.3'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70110278587040
24
+ version_requirements: *70299703934960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70110278585260 !ruby/object:Gem::Requirement
27
+ requirement: &70299703934380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70110278585260
35
+ version_requirements: *70299703934380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &70110278582300 !ruby/object:Gem::Requirement
38
+ requirement: &70299703933340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70110278582300
46
+ version_requirements: *70299703933340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: combustion
49
- requirement: &70110274963500 !ruby/object:Gem::Requirement
49
+ requirement: &70299703932720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70110274963500
57
+ version_requirements: *70299703932720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activerecord
60
- requirement: &70110274961840 !ruby/object:Gem::Requirement
60
+ requirement: &70299708901480 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70110274961840
68
+ version_requirements: *70299708901480
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3
71
- requirement: &70110274959860 !ruby/object:Gem::Requirement
71
+ requirement: &70299708900980 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '1.3'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70110274959860
79
+ version_requirements: *70299708900980
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: factory_girl
82
- requirement: &70110274958320 !ruby/object:Gem::Requirement
82
+ requirement: &70299708900480 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '4.2'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70110274958320
90
+ version_requirements: *70299708900480
91
91
  description: Content aggregator for Outpost
92
92
  email:
93
93
  - bricker88@gmail.com