Permalink
Browse files

update validations

  • Loading branch information...
1 parent 382d173 commit 29518acf76df129346d87a02d002ca35500026c9 @michaelminter committed Sep 20, 2012
View
2 app.rb
@@ -72,6 +72,8 @@ def cycle_fully_sick
if @fracture.save
if @fracture.update(:encoded_uri => @fracture.id.to_s(36))
{ :fractured_url => "http://fracture.it/#{@fracture.encoded_uri}", :errors => '' }.to_json
+ else
+ { :fractured_url => '', :errors => 'Not a valid URL format' }.to_json
end
else
@fracture.errors.each do |e|
View
@@ -2,14 +2,13 @@ class Fracture
include DataMapper::Resource
property :id, Serial
- property :url, String, :length => 200
+ property :url, String, :length => 200, :required => true, :format => /\./
property :encoded_uri, String
property :created_at, DateTime
has n, :activities
- validates_length_of :url, :min => 6
- validates_format_of :url, :with => /\./, :message => 'Not a valid URL format'
+ # validates_format_of :url, :with => /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/, :message => 'Not a valid URL format'
before :save, :check_url
# after :save, :encode_uri
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Deleted file not rendered
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
@@ -6,13 +6,14 @@ $(document).ready(function() {
var form = $(this);
var post_url = form.attr('action');
var post_data = form.serialize();
- $('#messages small').html('<img src="/images/loading.gif" /> Please Wait...');
+ $('#messages small').html('Please Wait...');
$.ajax({
type: 'POST',
url: post_url,
data: post_data,
dataType: 'json',
success: function(msg) {
+ console.log(msg);
$('#messages small').fadeOut(500);
setTimeout(function() {
$('#messages small').html(msg.fractured_url).fadeIn(500);
@@ -23,6 +24,11 @@ $(document).ready(function() {
},500);
}
}
+ }).fail(function(e){
+ $('#messages small').fadeOut(500);
+ setTimeout(function() {
+ $('#messages small').html('Not a valid URL format').fadeIn(500);
+ }, 500);
});
});
});
@@ -8,7 +8,7 @@
}
#mainWrapper {
- background: url(/images/backgroundSurf.jpg) no-repeat center center fixed;
+ background: url(/images/fracture.jpeg) no-repeat center center fixed;
background-color: white;
-webkit-background-size: cover;
-moz-background-size: cover;
View
@@ -49,7 +49,7 @@
channel.bind('my_event', function(data) {
var url = '<a href="'+data.url+'" target="_blank">'+data.url+'</a>';
- var uri = '<a href="http://fracture.it/'+data.encoded_uri+'" target="_blank">http://fracture.it/'+data.encoded_uri+'</a>';
+ var uri = '<a href="/'+data.encoded_uri+'" target="_blank">http://fracture.it/'+data.encoded_uri+'</a>';
if ($('#pusher_container tr:first').attr('class') == 'even') {
$('#pusher_container').prepend($('<tr class="odd"><td>'+url+'</td><td>'+uri+'</td><td style="text-align:right;">'+data.created_at+'</td></tr>').fadeIn('slow'));
@@ -84,13 +84,6 @@
</script>
-<script type="text/javascript" src="http://include.reinvigorate.net/re_.js"></script>
-<script type="text/javascript">
-try {
-reinvigorate.track("kb1b0-2q03y772qs");
-} catch(err) {}
-</script>
-
<script type="text/javascript">var _tid="5761e977363bd4d3bc25fd3db39e2e08";(function(){var ts=document.createElement("script");ts.type="text/javascript";ts.async=true;ts.src="http://analytics.linkalert.io/la.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ts,s);})(); </script>
</body>

0 comments on commit 29518ac

Please sign in to comment.