From 3f9dc65636afb57fed441978dca4bf7d3209bd2d Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 7 Feb 2014 14:38:56 +0100 Subject: rename authorize to require_login authorize_admin -> require_admin also add require_token which will ensure token has been used for auth. --- help/app/controllers/tickets_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'help/app') diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index c193ff4..d65ee43 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -4,7 +4,7 @@ class TicketsController < ApplicationController respond_to :html, :json #has_scope :open, :type => boolean - before_filter :authorize, :only => [:index] + before_filter :require_login, :only => [:index] before_filter :fetch_ticket, :only => [:show, :update, :destroy] # don't now have an edit method before_filter :fetch_user before_filter :set_title -- cgit v1.2.3 From 636692f9921bd695d726695d2d46c91f5a6e56f3 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 11 Apr 2014 10:03:19 +0200 Subject: move engines into engines directory Also renamed help to support so it's harder to confuse it with documentation --- help/app/assets/javascripts/tickets.js | 4 - help/app/controllers/tickets_controller.rb | 153 --------------------- help/app/designs/ticket/by_includes_post_by.js | 13 -- .../ticket/by_includes_post_by_and_created_at.js | 12 -- ..._includes_post_by_and_is_open_and_created_at.js | 12 -- ..._includes_post_by_and_is_open_and_updated_at.js | 12 -- .../ticket/by_includes_post_by_and_updated_at.js | 12 -- help/app/helpers/auto_tickets_path_helper.rb | 53 ------- help/app/helpers/tickets_helper.rb | 76 ---------- help/app/models/account_extension/tickets.rb | 13 -- help/app/models/ticket.rb | 105 -------------- help/app/models/ticket_comment.rb | 43 ------ help/app/models/ticket_selection.rb | 71 ---------- help/app/views/tickets/_comment.html.haml | 20 --- help/app/views/tickets/_edit_form.html.haml | 48 ------- help/app/views/tickets/_new_comment_form.html.haml | 13 -- help/app/views/tickets/_tabs.html.haml | 23 ---- help/app/views/tickets/_ticket.html.haml | 6 - help/app/views/tickets/index.html.haml | 19 --- help/app/views/tickets/new.html.haml | 30 ---- help/app/views/tickets/show.html.haml | 12 -- 21 files changed, 750 deletions(-) delete mode 100644 help/app/assets/javascripts/tickets.js delete mode 100644 help/app/controllers/tickets_controller.rb delete mode 100644 help/app/designs/ticket/by_includes_post_by.js delete mode 100644 help/app/designs/ticket/by_includes_post_by_and_created_at.js delete mode 100644 help/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js delete mode 100644 help/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js delete mode 100644 help/app/designs/ticket/by_includes_post_by_and_updated_at.js delete mode 100644 help/app/helpers/auto_tickets_path_helper.rb delete mode 100644 help/app/helpers/tickets_helper.rb delete mode 100644 help/app/models/account_extension/tickets.rb delete mode 100644 help/app/models/ticket.rb delete mode 100644 help/app/models/ticket_comment.rb delete mode 100644 help/app/models/ticket_selection.rb delete mode 100644 help/app/views/tickets/_comment.html.haml delete mode 100644 help/app/views/tickets/_edit_form.html.haml delete mode 100644 help/app/views/tickets/_new_comment_form.html.haml delete mode 100644 help/app/views/tickets/_tabs.html.haml delete mode 100644 help/app/views/tickets/_ticket.html.haml delete mode 100644 help/app/views/tickets/index.html.haml delete mode 100644 help/app/views/tickets/new.html.haml delete mode 100644 help/app/views/tickets/show.html.haml (limited to 'help/app') diff --git a/help/app/assets/javascripts/tickets.js b/help/app/assets/javascripts/tickets.js deleted file mode 100644 index 18537aa..0000000 --- a/help/app/assets/javascripts/tickets.js +++ /dev/null @@ -1,4 +0,0 @@ -//$(document).ready(function () { -// $.fn.editable.defaults.mode = 'inline'; -// $('#subject').editable(); -//}); \ No newline at end of file diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb deleted file mode 100644 index d65ee43..0000000 --- a/help/app/controllers/tickets_controller.rb +++ /dev/null @@ -1,153 +0,0 @@ -class TicketsController < ApplicationController - include AutoTicketsPathHelper - - respond_to :html, :json - #has_scope :open, :type => boolean - - before_filter :require_login, :only => [:index] - before_filter :fetch_ticket, :only => [:show, :update, :destroy] # don't now have an edit method - before_filter :fetch_user - before_filter :set_title - - def new - @ticket = Ticket.new - @ticket.comments.build - end - - def create - @ticket = Ticket.new(params[:ticket]) - - @ticket.comments.last.posted_by = (logged_in? ? current_user.id : nil) #protecting posted_by isn't working, so this should protect it. - @ticket.comments.last.private = false unless admin? - @ticket.created_by = current_user.id if logged_in? - @ticket.email = current_user.email_address if logged_in? and current_user.email_address - - if @ticket.save - flash[:notice] = t(:thing_was_successfully_created, :thing => t(:ticket)) - end - - # cannot set this until ticket has been saved, as @ticket.id will not be set - if !logged_in? and flash[:notice] - flash[:notice] += " " + t(:access_ticket_text, :full_url => ticket_url(@ticket.id)) - end - respond_with(@ticket, :location => auto_ticket_path(@ticket)) - end - - def show - @comment = TicketComment.new - if !@ticket - redirect_to auto_tickets_path, :alert => t(:no_such_thing, :thing => t(:ticket)) - return - end - end - - def update - if params[:commit] == 'close' - @ticket.is_open = false - @ticket.save - redirect_to_tickets - elsif params[:commit] == 'open' - @ticket.is_open = true - @ticket.save - redirect_to auto_ticket_path(@ticket) - else - @ticket.attributes = cleanup_ticket_params(params[:ticket]) - - if params[:commit] == 'reply_and_close' - @ticket.close - end - - if @ticket.comments_changed? - @ticket.comments.last.posted_by = (current_user ? current_user.id : nil) - @ticket.comments.last.private = false unless admin? - end - - if @ticket.changed? and @ticket.save - flash[:notice] = t(:changes_saved) - redirect_to_tickets - else - flash[:error] = @ticket.errors.full_messages.join(". ") if @ticket.changed? - redirect_to auto_ticket_path(@ticket) - end - end - end - - def index - @all_tickets = Ticket.search(search_options(params)) - @tickets = @all_tickets.page(params[:page]).per(APP_CONFIG[:pagination_size]) - end - - def destroy - # should we allow non-admins to delete their own tickets? i don't think necessary. - @ticket.destroy if admin? - redirect_to auto_tickets_path - end - - protected - - def set_title - @title = t(:tickets) - end - - private - - # - # redirects to ticket index, if appropriate. - # otherwise, just redirects to @ticket - # - def redirect_to_tickets - if logged_in? - if params[:commit] == t(:reply_and_close) - redirect_to auto_tickets_path - else - redirect_to auto_ticket_path(@ticket) - end - else - # if we are not logged in, there is no index to view - redirect_to auto_ticket_path(@ticket) - end - end - - # - # unset comments hash if no new comment was typed - # - def cleanup_ticket_params(ticket) - if ticket && ticket[:comments_attributes] - if ticket[:comments_attributes].values.first[:body].blank? - ticket[:comments_attributes] = nil - end - end - return ticket - end - - def ticket_access? - @ticket and (admin? or !@ticket.created_by or (current_user and current_user.id == @ticket.created_by)) - end - - def fetch_ticket - @ticket = Ticket.find(params[:id]) - if !@ticket and admin? - redirect_to auto_tickets_path, :alert => t(:no_such_thing, :thing => 'ticket') - return - end - access_denied unless ticket_access? - end - - def fetch_user - if params[:user_id] - @user = User.find(params[:user_id]) - end - end - - # - # clean up params for ticket search - # - def search_options(params) - params.merge( - :admin_status => params[:user_id] ? 'mine' : 'all', - :user_id => @user ? @user.id : current_user.id, - :is_admin => admin? - ) - end - -end diff --git a/help/app/designs/ticket/by_includes_post_by.js b/help/app/designs/ticket/by_includes_post_by.js deleted file mode 100644 index 2eeac89..0000000 --- a/help/app/designs/ticket/by_includes_post_by.js +++ /dev/null @@ -1,13 +0,0 @@ -// TODO: This view is only used in tests--should we keep it? -function(doc) { - var arr = {} - if (doc['type'] == 'Ticket' && doc.comments) { - doc.comments.forEach(function(comment){ - if (comment.posted_by && !arr[comment.posted_by]) { - //don't add duplicates - arr[comment.posted_by] = true; - emit(comment.posted_by, 1); - } - }); - } -} diff --git a/help/app/designs/ticket/by_includes_post_by_and_created_at.js b/help/app/designs/ticket/by_includes_post_by_and_created_at.js deleted file mode 100644 index 72169b0..0000000 --- a/help/app/designs/ticket/by_includes_post_by_and_created_at.js +++ /dev/null @@ -1,12 +0,0 @@ -function(doc) { - var arr = {} - if (doc['type'] == 'Ticket' && doc.comments) { - doc.comments.forEach(function(comment){ - if (comment.posted_by && !arr[comment.posted_by]) { - //don't add duplicates - arr[comment.posted_by] = true; - emit([comment.posted_by, doc.created_at], 1); - } - }); - } -} diff --git a/help/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js b/help/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js deleted file mode 100644 index 33dfe0b..0000000 --- a/help/app/designs/ticket/by_includes_post_by_and_is_open_and_created_at.js +++ /dev/null @@ -1,12 +0,0 @@ -function(doc) { - var arr = {} - if (doc['type'] == 'Ticket' && doc.comments) { - doc.comments.forEach(function(comment){ - if (comment.posted_by && !arr[comment.posted_by]) { - //don't add duplicates - arr[comment.posted_by] = true; - emit([comment.posted_by, doc.is_open, doc.created_at], 1); - } - }); - } -} diff --git a/help/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js b/help/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js deleted file mode 100644 index 3bd2a74..0000000 --- a/help/app/designs/ticket/by_includes_post_by_and_is_open_and_updated_at.js +++ /dev/null @@ -1,12 +0,0 @@ -function(doc) { - var arr = {} - if (doc['type'] == 'Ticket' && doc.comments) { - doc.comments.forEach(function(comment){ - if (comment.posted_by && !arr[comment.posted_by]) { - //don't add duplicates - arr[comment.posted_by] = true; - emit([comment.posted_by, doc.is_open, doc.updated_at], 1); - } - }); - } -} diff --git a/help/app/designs/ticket/by_includes_post_by_and_updated_at.js b/help/app/designs/ticket/by_includes_post_by_and_updated_at.js deleted file mode 100644 index 2b4304f..0000000 --- a/help/app/designs/ticket/by_includes_post_by_and_updated_at.js +++ /dev/null @@ -1,12 +0,0 @@ -function(doc) { - var arr = {} - if (doc['type'] == 'Ticket' && doc.comments) { - doc.comments.forEach(function(comment){ - if (comment.posted_by && !arr[comment.posted_by]) { - //don't add duplicates - arr[comment.posted_by] = true; - emit([comment.posted_by, doc.updated_at], 1); - } - }); - } -} diff --git a/help/app/helpers/auto_tickets_path_helper.rb b/help/app/helpers/auto_tickets_path_helper.rb deleted file mode 100644 index 93f3cb9..0000000 --- a/help/app/helpers/auto_tickets_path_helper.rb +++ /dev/null @@ -1,53 +0,0 @@ -# -# These "auto" forms of the normal ticket path route helpers allow us to do two things automatically: -# -# (1) include the user in the path if appropriate. -# (2) retain the sort params, if appropriate. -# -# Tickets views with a user_id are limited to that user. For admins, they don't need a user_id for any ticket action. -# -# This is available both to the views and the tickets_controller. -# -module AutoTicketsPathHelper - - protected - - def auto_tickets_path(options={}) - return unless options.class == Hash - options = ticket_view_options.merge options - if @user - user_tickets_path(@user, options) - else - tickets_path(options) - end - end - - def auto_ticket_path(ticket, options={}) - options = ticket_view_options.merge options - if @user - user_ticket_path(@user, ticket, options) - else - ticket_path(ticket, options) - end - end - - def auto_new_ticket_path(options={}) - return unless options.class == Hash - options = ticket_view_options.merge options - if @user - new_user_ticket_path(@user, options) - else - new_ticket_path(options) - end - end - - private - - def ticket_view_options - hsh = {} - hsh[:open_status] = params[:open_status] if params[:open_status] && !params[:open_status].empty? - hsh[:sort_order] = params[:sort_order] if params[:sort_order] && !params[:sort_order].empty? - hsh - end - -end \ No newline at end of file diff --git a/help/app/helpers/tickets_helper.rb b/help/app/helpers/tickets_helper.rb deleted file mode 100644 index 7af50d6..0000000 --- a/help/app/helpers/tickets_helper.rb +++ /dev/null @@ -1,76 +0,0 @@ -module TicketsHelper - # - # FORM HELPERS - # - - # - # hidden fields that should be added to ever ticket form. - # these are use for proper redirection after successful actions. - # - def hidden_ticket_fields - haml_concat hidden_field_tag('open_status', params[:open_status]) - haml_concat hidden_field_tag('sort_order', params[:sort_order]) - haml_concat hidden_field_tag('user_id', params[:user_id]) - "" - end - - # - # PARAM HELPERS - # - - def search_status - if action?(:index) - params[:open_status] || 'open' - else - nil - end - end - - def search_order - params[:sort_order] || 'updated_at_desc' - end - - # - # LINK HELPERS - # - - def link_to_status(new_status) - if new_status == "open" - label = t(:open_tickets) - elsif new_status == "closed" - label = t(:closed_tickets) - elsif new_status == "all" - label = t(:all_tickets) - end - link_to label, auto_tickets_path(:open_status => new_status, :sort_order => search_order) - end - - def link_to_order(order_field) - if search_order.start_with?(order_field) - # link for currently-filtered field. Link to other direction of this field. - if search_order.end_with? 'asc' - direction = 'desc' - icon_direction = 'up' - else - direction = 'asc' - icon_direction = 'down' - end - arrow = content_tag(:i, '', class: 'icon-arrow-'+ icon_direction) - else - # for not-currently-filtered field, don't display an arrow, and link to descending direction - arrow = '' - direction = 'desc' - end - - if order_field == 'updated' - label = t(:updated) - elsif order_field == 'created' - label = t(:created) - end - - link_to auto_tickets_path(:sort_order => order_field + '_at_' + direction, :open_status => search_status) do - arrow + label - end - end - -end diff --git a/help/app/models/account_extension/tickets.rb b/help/app/models/account_extension/tickets.rb deleted file mode 100644 index f898b56..0000000 --- a/help/app/models/account_extension/tickets.rb +++ /dev/null @@ -1,13 +0,0 @@ -module AccountExtension::Tickets - extend ActiveSupport::Concern - - def destroy_with_tickets - Ticket.destroy_all_from(self.user) - destroy_without_tickets - end - - included do - alias_method_chain :destroy, :tickets - end - -end diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb deleted file mode 100644 index cd22758..0000000 --- a/help/app/models/ticket.rb +++ /dev/null @@ -1,105 +0,0 @@ -# -# TODO: thought i should reverse keys for descending, but that didn't work. -# look into whether that should be tweaked, and whether it works okay with -# pagination (seems to now...) -# -# TODO: better validation of email -# -# TODO: don't hardcode strings 'unknown user' and 'unauthenticated user' -# -class Ticket < CouchRest::Model::Base - use_database "tickets" - - property :created_by, String, :protected => true # nil for anonymous tickets, should never be changed - property :regarding_user, String # may be nil or valid username - property :subject, String - property :email, String - property :is_open, TrueClass, :default => true - property :comments, [TicketComment] - - timestamps! - - before_validation :set_email, :set_regarding_user, :on => :create - - design do - view :by_updated_at - view :by_created_at - view :by_created_by - - view :by_is_open_and_created_at - view :by_is_open_and_updated_at - - own_path = Pathname.new(File.dirname(__FILE__)) - load_views(own_path.join('..', 'designs', 'ticket')) - end - - validates :subject, :presence => true - validates :email, :allow_blank => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ - - def self.search(options = {}) - @selection = TicketSelection.new(options) - @selection.tickets - end - - def self.destroy_all_from(user) - self.by_created_by.key(user.id).each do |ticket| - ticket.destroy - end - end - - def is_creator_validated? - !!created_by - end - - def set_email - self.email = nil if self.email == "" - end - - def set_regarding_user - self.regarding_user = nil if self.regarding_user == "" - end - - def close - self.is_open = false - end - - def reopen - self.is_open = true - end - - def commenters - commenters = [] - self.comments.each do |comment| - if comment.posted_by - if user = User.find(comment.posted_by) - commenters << user.login if user and !commenters.include?(user.login) - else - commenters << 'unknown user' if !commenters.include?('unknown user') - end - else - commenters << 'unauthenticated user' if !commenters.include?('unauthenticated user') - end - end - commenters.join(', ') - end - - # - # update comments. User should be set by controller. - # - def comments_attributes=(attributes) - if attributes - comment = TicketComment.new(attributes.values.first) - comment.posted_at = Time.now - comments << comment - end - end - - def created_by_user - User.find(self.created_by) - end - - def regarding_user_actual_user - User.find_by_login(self.regarding_user) - end - -end diff --git a/help/app/models/ticket_comment.rb b/help/app/models/ticket_comment.rb deleted file mode 100644 index bed5237..0000000 --- a/help/app/models/ticket_comment.rb +++ /dev/null @@ -1,43 +0,0 @@ -class TicketComment - include CouchRest::Model::Embeddable - - #belongs_to :ticket #is this best way to do it? will want to access all of a tickets comments, so maybe this isn't the way? - property :posted_by, String#, :protected => true #Integer#this should be current_user if that is set, meaning the user is logged in #cannot have it be protected and set via comments_attributes=. also, if it is protected and we set in the tickets_controller, it gets unset. TODO---is this okay to have it not protected and manually check it? We do not users to be able to set this. - # if the current user is not set, then we could just say the comment comes from an 'unauthenticated user', which would be somebody with the secret URL - 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 #this is checked when set, to make sure it was set by an admin - - # ? timestamps! - validates :body, :presence => true - #before_validation :set_time#, :set_posted_by - - #design do - # view :by_posted_at - # view :by_body - #end - - def is_comment_validated? - !!posted_by - end - - def posted_by_user - User.find(posted_by) if posted_by - end - -=begin - #TODO. - #this is resetting all comments associated with the ticket: - def set_time - self.posted_at = Time.now - end -=end - -=begin - def set_posted_by - self.posted_by = User.current if User.current - end -=end - -end diff --git a/help/app/models/ticket_selection.rb b/help/app/models/ticket_selection.rb deleted file mode 100644 index 74d5b78..0000000 --- a/help/app/models/ticket_selection.rb +++ /dev/null @@ -1,71 +0,0 @@ -class TicketSelection - - # - # supported options: - # - # user_id: id of the user (uuid string) - # open_status: open | closed | all - # sort_order: updated_at_desc | updated_at_asc | created_at_desc | created_at_asc - # admin_status: mine | all - # is_admin: true | false - # - def initialize(options = {}) - @user_id = options[:user_id].gsub /[^a-z0-9]/, '' - @open_status = allow options[:open_status], 'open', 'closed', 'all' - @sort_order = allow options[:sort_order], 'updated_at_desc', 'updated_at_asc', 'created_at_desc', 'created_at_asc' - @admin_status = allow options[:admin_status], 'mine', 'all' - @is_admin = allow options[:is_admin], false, true - end - - def tickets - Ticket.send(finder_method).startkey(startkey).endkey(endkey).send(order) - end - - protected - - def allow(source, *allowed) - if allowed.include?(source) - source - else - allowed.first - end - end - - def finder_method - method = 'by_' - method += 'includes_post_by_and_' if only_mine? - method += 'is_open_and_' if @open_status != 'all' - method += @sort_order.sub(/_(de|a)sc$/, '') - end - - def startkey - startkeys = [] - startkeys << @user_id if only_mine? - startkeys << (@open_status == 'open') if @open_status != 'all' - startkeys << 0 - startkeys = startkeys.join if startkeys.length == 1 # want string not array if just one thing in array - startkeys - end - - def endkey - endtime = Time.now + 2.days # TODO. this obviously isn't ideal - if self.startkey.is_a?(Array) - endkeys = self.startkey - endkeys.pop - endkeys << endtime - else - endtime - end - end - - def order - # we have defined the ascending method to return the view itself: - (@sort_order.end_with? 'desc') ? 'descending' : 'ascending' - end - - - def only_mine? - !@is_admin || @admin_status == 'mine' - end - -end diff --git a/help/app/views/tickets/_comment.html.haml b/help/app/views/tickets/_comment.html.haml deleted file mode 100644 index 778ca13..0000000 --- a/help/app/views/tickets/_comment.html.haml +++ /dev/null @@ -1,20 +0,0 @@ -- if admin? or !comment.private # only show comment if user is admin or comment is not private - %tr - %td.user - %div - %strong - - if comment.posted_by_user - = comment.posted_by_user.login - - else - = t(:anonymous) - %div= comment.posted_at.to_s(:short) - - if comment.posted_by_user && comment.posted_by_user.is_admin? - %div - %span.label.label-inverse - = t(:admin) - - if comment.private - %div - %span.label.label-important - = t(:private) - %td.comment - = simple_format(comment.body) \ No newline at end of file diff --git a/help/app/views/tickets/_edit_form.html.haml b/help/app/views/tickets/_edit_form.html.haml deleted file mode 100644 index 714f8ff..0000000 --- a/help/app/views/tickets/_edit_form.html.haml +++ /dev/null @@ -1,48 +0,0 @@ -:ruby - # created by user link - if @ticket.created_by_user - created_by = link_to @ticket.created_by_user.login, @ticket.created_by_user - else - created_by = t(:anonymous) - end - - # regarding user link - if admin? - if @ticket.regarding_user_actual_user - regarding_user_link = link_to @ticket.regarding_user_actual_user.login, @ticket.regarding_user_actual_user - else - regarding_user_link = "(#{t(:unknown)})" - end - else - regarding_user_link = '' - end - -= form_for @ticket do |f| - = hidden_ticket_fields - %p.first - - if @ticket.is_open? - %span.label.label-info= t(:open) - - else - %span.label.label-success= t(:closed) - %span.label.label-clear= t(:created_by_on, :user => created_by, :time => @ticket.created_at.to_s(:short)).html_safe - %div= t(:subject) - = f.text_field :subject, :class => 'large full-width' - .row-fluid - .span4 - %div= t(:status) - = f.select :is_open, [[t(:open), "true"], [t(:closed), "false"]] - .span4 - %div= t(:email) - = f.text_field :email - .span4 - %div - = t(:regarding_account) - = regarding_user_link - = f.text_field :regarding_user - = f.button t(:save), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'save' - - if @ticket.is_open? - = f.button t(:close), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'close' - - else - = f.button t(:open), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'open' - - if admin? - = link_to t(:destroy), auto_ticket_path(@ticket), :confirm => t(:are_you_sure), :method => :delete, :class => 'btn' diff --git a/help/app/views/tickets/_new_comment_form.html.haml b/help/app/views/tickets/_new_comment_form.html.haml deleted file mode 100644 index 8418e01..0000000 --- a/help/app/views/tickets/_new_comment_form.html.haml +++ /dev/null @@ -1,13 +0,0 @@ --# --# for posting a new comment to an existing ticket. --# -= simple_form_for @ticket, :html => {:class => 'slim'} do |f| - = hidden_ticket_fields - = f.simple_fields_for :comments, @comment, :wrapper => :none, :html => {:class => 'slim'} do |c| - = c.input :body, :label => false, :as => :text, :input_html => {:class => "full-width", :rows=> 5} - - if admin? - = c.input :private, :as => :boolean, :label => false, :inline_label => true - = f.button :button, t(:post_reply), :name => 'commit', :class => 'btn-primary', :type => 'submit', :value => 'post_reply' - - if logged_in? && @ticket.is_open - = f.button :button, t(:reply_and_close), :name => 'commit', :class => 'btn', :type => 'submit', :value => 'reply_and_close' - = link_to t(:cancel), auto_tickets_path, :class => :btn diff --git a/help/app/views/tickets/_tabs.html.haml b/help/app/views/tickets/_tabs.html.haml deleted file mode 100644 index b7b5d3a..0000000 --- a/help/app/views/tickets/_tabs.html.haml +++ /dev/null @@ -1,23 +0,0 @@ --# --# SORT ORDER TABS --# -- unless action?(:new) - %ul.nav.nav-pills.pull-right.slim - %li{:class=> ("active" if search_order.start_with? 'created_at')} - = link_to_order('created') - %li{:class=> ("active" if search_order.start_with? 'updated_at')} - = link_to_order('updated') - --# --# STATUS FILTER TABS --# -%ul.nav.nav-tabs - - if logged_in? - %li{:class => ("active" if search_status == 'open')} - = link_to_status 'open' - %li{:class => ("active" if search_status == 'closed')} - = link_to_status 'closed' - %li{:class => ("active" if search_status == 'all')} - = link_to_status 'all' - %li{:class => ("active" if action?(:new))} - = link_to icon(:plus, :black) + t(:new_ticket), auto_new_ticket_path diff --git a/help/app/views/tickets/_ticket.html.haml b/help/app/views/tickets/_ticket.html.haml deleted file mode 100644 index 5bc33c8..0000000 --- a/help/app/views/tickets/_ticket.html.haml +++ /dev/null @@ -1,6 +0,0 @@ -- url = auto_ticket_path(ticket) -%tr - %td= link_to ticket.subject, url - %td= link_to ticket.created_at.to_s(:short), url - %td= link_to ticket.updated_at.to_s(:short), url - %td= ticket.commenters diff --git a/help/app/views/tickets/index.html.haml b/help/app/views/tickets/index.html.haml deleted file mode 100644 index c02a326..0000000 --- a/help/app/views/tickets/index.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -- @show_navigation = !params[:user_id].nil? - -= render 'tickets/tabs' - -%table.table.table-striped.table-bordered - %thead - %tr - %th= t(:subject) - %th= t(:created) - %th= t(:updated) - %th= t(:voices) - %tbody - - if @tickets.any? - = render @tickets.all - - else - %tr - %td{:colspan=>4}= t(:none) - -= paginate @tickets diff --git a/help/app/views/tickets/new.html.haml b/help/app/views/tickets/new.html.haml deleted file mode 100644 index 8f217a5..0000000 --- a/help/app/views/tickets/new.html.haml +++ /dev/null @@ -1,30 +0,0 @@ -- @show_navigation = !params[:user_id].nil? - -= render 'tickets/tabs' - -- if admin? && @user - - email = @user.email_address - - regarding = @user.login -- elsif logged_in? - - email = current_user.email_address - - regarding = current_user.login - -= simple_form_for @ticket, :validate => true, :html => {:class => 'form-horizontal'} do |f| - = hidden_ticket_fields - = f.input :subject - - if logged_in? - = f.input :email, input_html: {value: email} - = f.input :regarding_user, input_html: {value: regarding} - - else - = f.input :email - = f.input :regarding_user - = f.simple_fields_for :comments, @comment do |c| - = c.input :body, :label => t(:description), :as => :text, :input_html => {:class => "full-width", :rows=> 5} - - if admin? - = c.input :private, :as => :boolean, :label => false, :inline_label => true - .form-actions - = f.button :submit, :class => 'btn-primary', :value => t(:create_thing, :thing => t(:ticket)) - - if logged_in? - = link_to t(:cancel), auto_tickets_path, :class => :btn - - else - = link_to t(:cancel), home_path, :class => 'btn' \ No newline at end of file diff --git a/help/app/views/tickets/show.html.haml b/help/app/views/tickets/show.html.haml deleted file mode 100644 index bfdb773..0000000 --- a/help/app/views/tickets/show.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -- @show_navigation = !params[:user_id].nil? - -.ticket - = render 'tickets/edit_form' - %table.table.table-striped.table-bordered - %tbody - = render :partial => 'tickets/comment', :collection => @ticket.comments - %tr - %td.user - = logged_in? ? current_user.login : t(:anonymous) - %td.comment - = render 'tickets/new_comment_form' \ No newline at end of file -- cgit v1.2.3