Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
capturing collaborators for certain requests
This captures request collaborators for requests not related to user access. The collaborators are then set on the raised Zendesk ticket.
- Loading branch information
Showing
14 changed files
with
59 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
require 'tableless_model' | ||
|
||
class Requester < TablelessModel | ||
attr_accessor :email | ||
attr_accessor :email, :collaborator_emails | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
validates_presence_of :email | ||
validates :email, :format => {:with => /@/} | ||
|
||
validate :collaborator_emails_are_all_valid | ||
|
||
def collaborator_emails | ||
@collaborator_emails || [] | ||
end | ||
|
||
def collaborator_emails=(emails_as_string) | ||
@collaborator_emails = emails_as_string.split(",").collect(&:strip) | ||
end | ||
|
||
def collaborator_emails_are_all_valid | ||
unless collaborator_emails.blank? | ||
collaborator_emails.each do |collaborator_email| | ||
unless collaborator_email =~ /@/ | ||
errors.add(:collaborator_emails, "#{collaborator_email} is not a valid email") | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
<%= f.semantic_fields_for :requester do |r| %> | ||
<%= r.input :email, :label => "Your email", :as => :email, :required => true, :input_html => {:"aria-required" => true, :class => "span6"} %> | ||
<% if show_collaborators %> | ||
<%= r.input :collaborator_emails, :label => "Should anybody else be copied in on this request? (comma-separated list of emails)",:required => false, :input_html => {:class => "span6", :value => r.object.collaborator_emails.join(", ") } %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No big deal (and I can imagine how it happened), but isn't having attr_accessor for collaborator_emails redundant with the methods below?