- template list/show is loaded from central server
- buy a template downloads and creates it in DB - changes in designs index
This commit is contained in:
1 parent
eb53343bdb
commit
6f1748d2b3
12 files changed
+195
-96
No files matched your search
@@ -3,9 +3,29 @@ class Admin::TemplateStoreController < ApplicationController
|
||||
layout "new_admin"
|
||||
|
||||
def index
|
||||
@templates = JSON.parse(get_templates)
|
||||
end
|
||||
|
||||
def show
|
||||
@template = JSON.parse(get_template(params[:id]))
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def get_template(id)
|
||||
uri = URI.parse("http://#{APP_CONFIG['store_ip']}/store/design/#{id}")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
request = Net::HTTP::Get.new(uri.request_uri)
|
||||
response = http.request(request)
|
||||
response.body
|
||||
end
|
||||
|
||||
def get_templates
|
||||
uri = URI.parse("http://#{APP_CONFIG['store_ip']}/store/designs")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
request = Net::HTTP::Get.new(uri.request_uri)
|
||||
response = http.request(request)
|
||||
response.body
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user