Class: Archangel::Backend::SitesController

Inherits:
Archangel::BackendController show all
Defined in:
app/controllers/archangel/backend/sites_controller.rb

Overview

Backend sites controller

Instance Method Summary collapse

Methods included from Controllers::MetatagableConcern

#assign_meta_tags

Methods inherited from ApplicationController

#current_site, #render_401_error, #render_404_error, #render_error

Methods included from Controllers::PaginatableConcern

#page_num, #per_page

Methods included from Controllers::ActionableConcern

#action, #collection_action?, #member_action?

Instance Method Details

#editObject

Edit backend site

Formats

HTML, JSON

Request

GET /backend/site/edit
GET /backend/site/edit.json

Response

{
  "id": 123,
  "name": "Site Name",
  "theme": "my_theme",
  "locale": "en",
  "logo": {
    "url": "/uploads/file.png",
    "large": {
      "url": "/uploads/large_file.png"
    },
    "medium": {
      "url": "/uploads/medium_file.png"
    },
    "small": {
      "url": "/uploads/small_file.png"
    },
    "tiny": {
      "url": "/uploads/tiny_file.png"
    }
  }
}

84
85
86
87
88
# File 'app/controllers/archangel/backend/sites_controller.rb', line 84

def edit
  site = resource_content

  respond_with site
end

#showObject

Backend site

Formats

HTML, JSON

Request

GET /backend/site
GET /backend/site.json

Response

{
  "id": 123,
  "name": "Site Name",
  "theme": "my_theme",
  "locale": "en",
  "logo": {
    "url": "/uploads/file.png",
    "large": {
      "url": "/uploads/large_file.png"
    },
    "medium": {
      "url": "/uploads/medium_file.png"
    },
    "small": {
      "url": "/uploads/small_file.png"
    },
    "tiny": {
      "url": "/uploads/tiny_file.png"
    }
  }
}

45
46
47
48
49
# File 'app/controllers/archangel/backend/sites_controller.rb', line 45

def show
  site = resource_content

  respond_with site
end

#updateObject

Update backend site

Formats

HTML, JSON

Request

PATCH /backend/site
PATCH /backend/site.json
PUT   /backend/site
PUT   /backend/site.json

Response

{
  "site": {
    "name": "Site Name",
    "theme": "my_theme",
    "locale": "en",
    "logo": {
     "url": "/uploads/file.png",
      "large": {
        "url": "/uploads/large_file.png"
      },
      "medium": {
        "url": "/uploads/medium_file.png"
      },
      "small": {
        "url": "/uploads/small_file.png"
      },
      "tiny": {
        "url": "/uploads/tiny_file.png"
      }
    }
  }
}

126
127
128
129
130
131
132
# File 'app/controllers/archangel/backend/sites_controller.rb', line 126

def update
  site = resource_content

  site.update(resource_params)

  respond_with site, location: -> { location_after_update }
end