condo_interface 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -150,23 +150,16 @@
150
150
  //
151
151
  // create a directive for attaching the input events
152
152
  //
153
- condoInterface.directive('coUploads', ['Condo.Broadcast', '$timeout', function(broadcast, $timeout) {
153
+ condoInterface.directive('coUploads', ['Condo.Broadcast', 'Condo.Config', '$timeout', function(broadcast, options, $timeout) {
154
154
  return {
155
155
  controller: 'Condo.Controller',
156
156
  link: function(scope, element, attrs) {
157
- var options = {
158
- delegate: attrs['coDelegate'] || element,
159
- drop_targets: attrs['coTargets'] || element,
160
- hover_class: attrs['coHoverClass'] || 'drag-hover',
161
- pre_check: attrs['coAccepts'] || '/./i',
162
- size_limit: attrs['coLimit'] || 0
163
- },
164
157
 
165
158
  //
166
159
  // Add files with their path information to the system
167
160
  // Queue items here until we decide they should be added to the view
168
161
  //
169
- processPending = function() {
162
+ var processPending = function() {
170
163
  var avaliable = view_limit - scope.upload_count;
171
164
 
172
165
  if(avaliable > 0 && pending_items.length > 0) {
@@ -259,11 +252,14 @@
259
252
  },
260
253
  view_limit = 50, // Number of uploads that should be displayed at once
261
254
  pending_items = []; // These are files or folders that have not been processed yet as we are at the view port limit
255
+
262
256
 
263
-
264
- if(!!attrs['coEndpoint'])
265
- scope.endpoint = attrs['coEndpoint'];
266
-
257
+
258
+ //
259
+ // Set some defaults
260
+ //
261
+ options.delegate = options.delegate || element;
262
+ options.drop_targets = options.drop_targets || element;
267
263
 
268
264
  scope.options = options;
269
265
  scope.remove_completed = false; // Remove completed uploads automatically
@@ -370,15 +366,21 @@
370
366
 
371
367
 
372
368
  //
373
- // Notify on errors
374
- // TODO:: need an unobtrusive notification system for failed adds
369
+ // Notification service
370
+ // {
371
+ // type: 'warn'|'error',
372
+ // number: 1
373
+ // file (optional)
374
+ // details (optional)
375
+ // }
375
376
  //
376
- scope.$on('coFileAddFailed', function() {
377
- alert('Failed to add file: ' + broadcast.message.reason);
378
- });
379
-
380
- scope.$on('coComponentLoadFailed', function() {
381
- alert('Error: failed to load ' + broadcast.message[1] + ' (' + broadcast.message[0] + ')');
377
+ var messages = {
378
+ warn: ['file not accepted', 'file add failed - server error'],
379
+ error: ['file add failed - missing required uploader', 'failed to load file fingerprinting component']
380
+ };
381
+ scope.$on('coNotice', function() {
382
+ if(!options.supress_notifications && broadcast.message.type != 'info')
383
+ alert(broadcast.message.type + ': ' + messages[broadcast.message.type][broadcast.message.number]);
382
384
  });
383
385
 
384
386
 
@@ -1,3 +1,3 @@
1
1
  module CondoInterface
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: condo_interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2012-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -161,3 +161,4 @@ test_files:
161
161
  - test/dummy/script/rails
162
162
  - test/integration/navigation_test.rb
163
163
  - test/test_helper.rb
164
+ has_rdoc: