diff options
author | jessib <jessib@riseup.net> | 2013-01-03 11:19:02 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-01-03 11:19:02 -0800 |
commit | 8b6c66af53a1f7e8c4300c17dc226eaef74a89d3 (patch) | |
tree | 2bb2a4ddad3348fab9a177c737919c9848699bf1 | |
parent | 38c87ba6eb30d8345c9c59b4f9b0d84955543ba0 (diff) | |
parent | bf80482c34034a59307193ced0dcfac7db05f055 (diff) |
Merge pull request #11 from leapcode/feature/ticket-client-side-validations
Client-side validations, including only validating email address format ...
-rw-r--r-- | help/app/models/ticket.rb | 2 | ||||
-rw-r--r-- | help/app/views/tickets/_new_comment.html.haml | 2 | ||||
-rw-r--r-- | help/app/views/tickets/new.html.haml | 2 | ||||
-rw-r--r-- | help/app/views/tickets/show.html.haml | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb index a5c9ee5..ef7b2d6 100644 --- a/help/app/models/ticket.rb +++ b/help/app/models/ticket.rb @@ -55,7 +55,7 @@ class Ticket < CouchRest::Model::Base # html5 has built-in validation which isn't ideal, as it says 'please enter an email address' for invalid email addresses, which implies an email address is required, and it is not. - validates :email, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, :if => :email #email address is optional + validates :email, :allow_blank => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ #email address is optional #TODO: #def set_created_by diff --git a/help/app/views/tickets/_new_comment.html.haml b/help/app/views/tickets/_new_comment.html.haml index 7307dad..31d134f 100644 --- a/help/app/views/tickets/_new_comment.html.haml +++ b/help/app/views/tickets/_new_comment.html.haml @@ -1,2 +1,2 @@ = f.simple_fields_for :comments, @comment do |c| - = c.input :body, :label => 'Comment', :as => :text, :input_html => {:class => "span12", :rows=>4} + = c.input :body, :label => 'Comment', :as => :text, :input_html => {:class => "span9", :rows=>4} diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml index 750b990..ee7adb2 100644 --- a/help/app/views/tickets/new.html.haml +++ b/help/app/views/tickets/new.html.haml @@ -1,6 +1,6 @@ .span12 %h2=t :new_ticket - = simple_form_for(@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test + = simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f| = f.input :title = f.input :email if !current_user #hmm--might authenticated users want to submit an alternate email? = render :partial => 'new_comment', :locals => {:f => f} diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml index 3f00b35..a69048b 100644 --- a/help/app/views/tickets/show.html.haml +++ b/help/app/views/tickets/show.html.haml @@ -8,7 +8,7 @@ = render(:partial => "comment", :collection => @ticket.comments) = #render @ticket.comments should work if view is in /app/views/comments/_comment - = simple_form_for(@ticket, :html => {:novalidate => true}) do |f| #turn off html5 validations to test + = simple_form_for @ticket, :html => {:class => 'form-horizontal'} do |f| # don't need validations so long as this is so simple = render :partial => 'new_comment', :locals => {:f => f} .span10.offset3 = f.button :submit, @post_reply_str, :class => 'btn-primary' |