Class: ApplicationTemplatesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/application_templates_controller.rb

Constant Summary

Constants inherited from BaseController

BaseController::API_VERSION, BaseController::SUPPORTED_API_VERSIONS

Instance Method Summary collapse

Methods included from UserActionLogger

#get_action_logger, #log_action

Instance Method Details

#indexObject



5
6
7
8
# File 'app/controllers/application_templates_controller.rb', line 5

def index
  templates = ApplicationTemplate.find_all.map{|t| RestApplicationTemplate.new(t, get_url, nolinks)}
  render_success(:ok, "application_templates", templates, "LIST_TEMPLATES", "Showing all templates")
end

#showObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/application_templates_controller.rb', line 10

def show
  id_or_tag = params[:id]
  template = ApplicationTemplate.find(id_or_tag)
  return render_success(:ok, "application_template", RestApplicationTemplate.new(template, get_url, nolinks),
                        "SHOW_TEMPLATE", "Showing template for '#{id_or_tag}'") if template

  templates = ApplicationTemplate.find_all(id_or_tag).map{|t| RestApplicationTemplate.new(t, get_url, nolinks)}
  render_success(:ok, "application_templates", templates, "LIST_TEMPLATES",  "Showing template for '#{id_or_tag}'")
end