From 1a90990311ea0316fbd594fe71c6cdcf00306745 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 6 Jan 2014 12:17:44 +0530 Subject: [PATCH] template_store and some changes for the store.. --- .../admin/module_store_controller.rb | 4 +- .../admin/template_store_controller.rb | 17 +++-- app/views/admin/template_store/index.html.erb | 68 ++++++++----------- app/views/admin/template_store/show.html.erb | 48 +++++++------ config/routes.rb | 2 + 5 files changed, 68 insertions(+), 71 deletions(-) diff --git a/app/controllers/admin/module_store_controller.rb b/app/controllers/admin/module_store_controller.rb index 98f9baf5..b5ccc1a4 100644 --- a/app/controllers/admin/module_store_controller.rb +++ b/app/controllers/admin/module_store_controller.rb @@ -1,7 +1,5 @@ class Admin::ModuleStoreController < OrbitBackendController - - layout "back_end" - + def index end diff --git a/app/controllers/admin/template_store_controller.rb b/app/controllers/admin/template_store_controller.rb index ee1571eb..e38d66c9 100644 --- a/app/controllers/admin/template_store_controller.rb +++ b/app/controllers/admin/template_store_controller.rb @@ -1,19 +1,24 @@ -class Admin::TemplateStoreController < ApplicationController - - layout "back_end" +class Admin::TemplateStoreController < OrbitBackendController + + @@store_domain = "http://store.tp.rulingcom.com" def index + @store = @@store_domain @templates = JSON.parse(get_templates) end def show + @store = @@store_domain @template = JSON.parse(get_template(params[:id])) rescue nil end + def download_theme + render :json => {"success"=>true}.to_json + end protected def get_template(id) - uri = URI.parse("http://#{APP_CONFIG['store_ip']}/store/design/#{id}") + uri = URI.parse("#{@@store_domain}/api/templates/#{id}") http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) @@ -21,11 +26,13 @@ class Admin::TemplateStoreController < ApplicationController end def get_templates - uri = URI.parse("http://#{APP_CONFIG['store_ip']}/store/designs") + uri = URI.parse("#{@@store_domain}/api/templates") http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) response.body end + + end \ No newline at end of file diff --git a/app/views/admin/template_store/index.html.erb b/app/views/admin/template_store/index.html.erb index 7dd70d3c..54a01c28 100644 --- a/app/views/admin/template_store/index.html.erb +++ b/app/views/admin/template_store/index.html.erb @@ -1,13 +1,3 @@ -<% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> -<% end %> - -<% content_for :page_specific_css do %> - <%= stylesheet_link_tag 'normalize' %> - <%= stylesheet_link_tag 'bootstrap-responsive' %> - <%= stylesheet_link_tag 'rulingorbit' %> - <%= stylesheet_link_tag 'template-store' %> -<% end %>
@@ -27,22 +17,7 @@
-
- Color -
-
    -
  • All
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
-
-
+
Category
@@ -78,28 +53,39 @@
    <% @templates.each do |template| %>
  • - <%= link_to admin_template_store_template_path(template['id']) do %> - <%= image_tag "http://#{APP_CONFIG['store_ip']}#{template['thumb']}", :class => "item-thumb" %> - + "> + + <%= template['title'] %> Free - <% end %> + + <%= link_to "Download", "javascript:void(0);", "data-url" => template['template']['template']['url'], :class=> 'btn btn-primary download-link' %>
  • <% end %> - <% (12-@templates.size).times do |i| %> -
  • - <%= link_to admin_template_store_template_path('show', :t => i + 1) do %> - - - Template <%= i + 1 %> - Free - - <% end %> -
  • - <% end %> +
+ diff --git a/app/views/admin/template_store/show.html.erb b/app/views/admin/template_store/show.html.erb index 13544e84..e954303a 100644 --- a/app/views/admin/template_store/show.html.erb +++ b/app/views/admin/template_store/show.html.erb @@ -1,18 +1,3 @@ -<% content_for :side_bar do %> - <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> -<% end %> - -<% content_for :page_specific_css do %> - <%= stylesheet_link_tag 'normalize' %> - <%= stylesheet_link_tag 'bootstrap-responsive' %> - <%= stylesheet_link_tag 'rulingorbit' %> - <%= stylesheet_link_tag 'template-store' %> -<% end %> -<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "jquery.cycle" %> - <%= javascript_include_tag "rulingorbit" %> -<% end %> - <% if @template %>
@@ -21,9 +6,9 @@
- <%= image_tag "http://#{APP_CONFIG['store_ip']}#{@template['thumb']}", :class => "item-thumb" %> + <%= image_tag "#{@store}#{@template['preview']['preview']['thumb']['url']}", :class => "item-thumb" %>

<%= @template['title'] %>

- <%= link_to 'free download', buy_template_admin_purchase_path(@template['id']), :id => "download" %> + <%= link_to "Download", "javascript:void(0);", "data-url" => @template['template']['template']['url'], :class=> 'btn btn-primary download-link' %>
  • views<%= Random.new.rand(10..100) %>
  • @@ -32,13 +17,11 @@

description

-
<%= @template['intro'] %>
+
<%#= @template['intro'] %>

screen shot

- <% @template['screenshots'].each do |screenshot| %> - <%= image_tag "http://#{APP_CONFIG['store_ip']}#{screenshot}", :class => "preview item-thumb" %> - <% end %> +
@@ -77,4 +60,25 @@
-<% end %> \ No newline at end of file +<% end %> + diff --git a/config/routes.rb b/config/routes.rb index ace0b525..0707d85e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -258,7 +258,9 @@ Orbit::Application.routes.draw do match 'module_store' => 'module_store#index' match 'module_store/show' => 'module_store#show' match 'template_store' => 'template_store#index' + match 'template_store/download_theme' => "template_store#download_theme" match 'template_store/template/:id' => 'template_store#show', :as => :template_store_template + # match 'template_store/cool_method' => "template_store#cool_method" end # end admin