Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Cottman-Fields committed Dec 17, 2012
2 parents 71c2daf + 7d432b4 commit 57f920e
Show file tree
Hide file tree
Showing 24 changed files with 15,377 additions and 17 deletions.
8 changes: 4 additions & 4 deletions app/assets/javascripts/angular/controllers/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function ListenCtrl($scope, $resource, $routeParams, Media, AudioEvent, Tag) {
// // HACK:
// $scope.spectrogram.url = "/media/" + recordingId + "_0_120_0_11025_512_g.png" + "?" + angularCopies.toKeyValue($scope.authTokenParams());

//$scope.model = $scope;
$scope.model = {};

var formatPaths = function () {
if ($scope.media && $scope.media.hasOwnProperty('recordingId')) {
Expand All @@ -47,7 +47,7 @@ function ListenCtrl($scope, $resource, $routeParams, Media, AudioEvent, Tag) {
$scope.$on('event:auth-loginRequired', formatPaths);
$scope.$on('event:auth-loginConfirmed', formatPaths);

$scope.media = Media.get($routeParams, {},
$scope.model.media = Media.get($routeParams, {},
function mediaGetSuccess() {
// reformat url's
formatPaths();
Expand All @@ -58,7 +58,7 @@ function ListenCtrl($scope, $resource, $routeParams, Media, AudioEvent, Tag) {


// TODO: add time bounds
$scope.audioEvents = AudioEvent.query({byAudioId: recordingId});
$scope.model.audioEvents = AudioEvent.query({byAudioId: recordingId});

$scope.tags = Tag.query();

Expand Down Expand Up @@ -88,7 +88,7 @@ function ListenCtrl($scope, $resource, $routeParams, Media, AudioEvent, Tag) {
console.log("Annotation creation successful");

// now update tag-list
$scope.audioEvents.push(response);
$scope.model.audioEvents.push(response);
$scope.selectedAnnotation = response;

},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,16 @@ angular.module('rails', [])
// and only if object has a __railsJsonRenamer__
// or if request is going to our server?

transformObject(data, underscore);
if ((headers()["Accept"] || "").indexOf("application/json") >= 0) {

stampObject(data, "camelCased->underscore");
if (data === undefined || data === null || !angular.isObject(data)) {
return;
}

transformObject(data, underscore);

stampObject(data, "camelCased->underscore");
}

return data;
};
Expand All @@ -92,6 +99,11 @@ angular.module('rails', [])
}

return response;
},
function (response) {
console.log("rails field naming interceptor, promise failed function", response);

return p.reject(response);
});
return p;
});
Expand Down Expand Up @@ -134,7 +146,7 @@ angular.module('rails', [])
//
$httpProvider.responseInterceptors.push( railsFieldRenamingInterceptor.$get());

$httpProvider.defaults.transformRequest.push(railsFieldRenamingInterceptor.$get());
$httpProvider.defaults.transformRequest.push(railsFieldRenamingTransformer.$get());
}]);


Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
//
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require jquery.ui.datepicker
// require jquery.ui.all // disabled because slow
// require jquery.ui.datepicker // disabled because slow
//= require angular.js
//= require angular-resource.js
//= require angular-ui.js
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require jquery.ui.all
* require jquery.ui.all # disabled because slow
*= require_tree ../../../vendor/assets/javascripts/.
*= require_tree ../images/.
*= require_tree .
Expand Down
2 changes: 1 addition & 1 deletion app/assets/templates/annotation_viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<div id="scroller">
<div class="annotation-viewer" id="annotation-viewer_{{id}}" >
<img ng-src="{{media.imageUrl}}">
<img ng-src="{{model.media.imageUrl}}" src="">
<div id="spectrogramAnnotations_{{id}}"></div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/assets/templates/listen.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>Listen</h1>
<p>Listen and annotate.</p>

<h3>Spectrogram</h3>
<baw-annotation-viewer model="media"></baw-annotation-viewer>
<baw-annotation-viewer model="model"></baw-annotation-viewer>

<h3>Audio Controls</h3>
<audio id="main-player" controls>
Expand Down Expand Up @@ -89,7 +89,7 @@ <h3>Annotations</h3>
</tr>
</thead>
<tbody>
<tr ng-repeat="ae in audioEvents">
<tr ng-repeat="ae in model.audioEvents">
<td>{{ae.id}}</td>
<td><a ng-href="/recordings/{{ae.audioRecording.uuid}}"
class="short-guid">{{ae.audioRecording.uuid}}</a></td>
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/api/callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ def store_provider_info(canonical_data,resource=nil)

if user.blank?
new_display_name = canonical_data[:display_name]
user = User.create!(:display_name => new_display_name.blank? ? '' : new_display_name, :email => canonical_data[:email], :password => Devise.friendly_token[0,20])

# HACK: for users created by external providers, dummy the user name with the .... field
user = User.create!(:display_name => new_display_name.blank? ? '' : new_display_name, :email => canonical_data[:email], :password => Devise.friendly_token[0,20], :user_name => -1 * Random.rand(100000))
user.user_name = user.id
user.save!
end
end

Expand Down
7 changes: 5 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ class User < ActiveRecord::Base

# validation
#validates_presence_of :display_name
validates :user_name, :presence => true, :uniqueness => { :case_sensitive => false },
:format => { :with => /\A[a-zA-Z0-9_ ]+\z/, :message => "only letters, numbers, space and underscore allowed" }
validates :user_name, :presence => true, :uniqueness => { :case_sensitive => false }
#:format => { :with => /\A[a-zA-Z0-9_ ]+\z/, :message => "only letters, numbers, space and underscore allowed" }
validates :display_name, :uniqueness => {:case_sensitive => false }, :presence => { :unless => Proc.new { |a| a.email.present? }, :message => "Please provide a name, email, or both." }
validates :email, :uniqueness => {:case_sensitive => false }, :presence => { :unless => Proc.new { |a| a.display_name.present? }, :message => "Please provide an email, name, or both." }
validates :user_name, :exclusion => { :in => %w(admin harvester analysis_runner) }
#friendly_id :display_name, :use_slug => true, :strip_non_ascii => true



end
2 changes: 1 addition & 1 deletion lib/modules/file_cacher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def self.create_audio_segment(modify_parameters = {})
else
end

raise "Audio recording was not ready: #{audio_recording.uuid}." unless audio_recording.status == :ready
raise "Audio recording was not ready: #{audio_recording.uuid}." unless audio_recording.status.to_sym == :ready

# create the cached audio file in each of the possible paths
target_possible_paths = Cache::possible_paths(Cache::cached_audio_storage_paths,target_file)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 57f920e

Please sign in to comment.