diff options
| -rw-r--r-- | help/app/models/ticket_comment.rb | 1 | ||||
| -rw-r--r-- | help/app/views/tickets/_comment.html.haml | 31 | ||||
| -rw-r--r-- | help/app/views/tickets/_new_comment.html.haml | 2 | 
3 files changed, 20 insertions, 14 deletions
diff --git a/help/app/models/ticket_comment.rb b/help/app/models/ticket_comment.rb index 49e5c6c..18da3e1 100644 --- a/help/app/models/ticket_comment.rb +++ b/help/app/models/ticket_comment.rb @@ -7,6 +7,7 @@ class TicketComment    property :posted_at, Time#, :protected => true    #property :posted_verified, TrueClass, :protected => true #should be true if current_user is set when the comment is created    property :body, String +  property :private, TrueClass # private comments are only viewable by admins    # ? timestamps!    validates :body, :presence => true diff --git a/help/app/views/tickets/_comment.html.haml b/help/app/views/tickets/_comment.html.haml index 26794dc..ae7f1d4 100644 --- a/help/app/views/tickets/_comment.html.haml +++ b/help/app/views/tickets/_comment.html.haml @@ -1,15 +1,18 @@  - # style is super ugly but just for now -%tr -  %td -    - if commenter = User.find(comment.posted_by) -      %b -        = 'Posted by' + (commenter.is_admin? ? ' admin' : '') + ':' -      = commenter.login -    - else -      Unauthenticated post -    .pull-right -      %b -        Posted at: -      = comment.posted_at.to_s(:short) -    %br -    = comment.body +- if admin? or !comment.private # only show comment if user is admin or comment is not private +  %tr +    %td +      - if commenter = User.find(comment.posted_by) +        %b +          = 'Posted by' + (commenter.is_admin? ? ' admin' : '') + ':' +        = commenter.login +      - else +        Unauthenticated post +      - if comment.private +        (Private comment) +      .pull-right +        %b +          Posted at: +        = comment.posted_at.to_s(:short) +      %br +      = comment.body
\ No newline at end of file diff --git a/help/app/views/tickets/_new_comment.html.haml b/help/app/views/tickets/_new_comment.html.haml index 7307dad..8d40bb6 100644 --- a/help/app/views/tickets/_new_comment.html.haml +++ b/help/app/views/tickets/_new_comment.html.haml @@ -1,2 +1,4 @@  = f.simple_fields_for :comments, @comment do |c|    = c.input :body, :label => 'Comment', :as => :text, :input_html => {:class => "span12", :rows=>4} +  - if admin? +    = c.input :private, :as => :boolean, :label => false, :inline_label => true  | 
