template_store and some changes for the store..
This commit is contained in:
parent
db86d5248f
commit
1a90990311
|
@ -1,7 +1,5 @@
|
||||||
class Admin::ModuleStoreController < OrbitBackendController
|
class Admin::ModuleStoreController < OrbitBackendController
|
||||||
|
|
||||||
layout "back_end"
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
class Admin::TemplateStoreController < ApplicationController
|
class Admin::TemplateStoreController < OrbitBackendController
|
||||||
|
|
||||||
layout "back_end"
|
|
||||||
|
|
||||||
|
@@store_domain = "http://store.tp.rulingcom.com"
|
||||||
def index
|
def index
|
||||||
|
@store = @@store_domain
|
||||||
@templates = JSON.parse(get_templates)
|
@templates = JSON.parse(get_templates)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@store = @@store_domain
|
||||||
@template = JSON.parse(get_template(params[:id])) rescue nil
|
@template = JSON.parse(get_template(params[:id])) rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def download_theme
|
||||||
|
render :json => {"success"=>true}.to_json
|
||||||
|
end
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def get_template(id)
|
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)
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
request = Net::HTTP::Get.new(uri.request_uri)
|
request = Net::HTTP::Get.new(uri.request_uri)
|
||||||
response = http.request(request)
|
response = http.request(request)
|
||||||
|
@ -21,11 +26,13 @@ class Admin::TemplateStoreController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_templates
|
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)
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
request = Net::HTTP::Get.new(uri.request_uri)
|
request = Net::HTTP::Get.new(uri.request_uri)
|
||||||
response = http.request(request)
|
response = http.request(request)
|
||||||
response.body
|
response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -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 %>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
@ -27,22 +17,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="filter fn">
|
|
||||||
<span class="label">Color</span>
|
|
||||||
<div class="select single-select" id="color-filter">
|
|
||||||
<ul class="option-list">
|
|
||||||
<li><a href="" class="ui btn option-default">All</a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag red"></span></a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag yellow"></span></a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag green"></span></a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag blue"></span></a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag purple"></span></a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag white"></span></a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag gray"></span></a></li>
|
|
||||||
<li><a class="ui btn" href=""><span class="color-tag black"></span></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="filter fn">
|
<div class="filter fn">
|
||||||
<span class="label">Category</span>
|
<span class="label">Category</span>
|
||||||
<div class="drop-menu ui">
|
<div class="drop-menu ui">
|
||||||
|
@ -78,28 +53,39 @@
|
||||||
<ul class="clearfix">
|
<ul class="clearfix">
|
||||||
<% @templates.each do |template| %>
|
<% @templates.each do |template| %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to admin_template_store_template_path(template['id']) do %>
|
<a href="<%= admin_template_store_template_path(template["_slugs"][0]) %>">
|
||||||
<%= image_tag "http://#{APP_CONFIG['store_ip']}#{template['thumb']}", :class => "item-thumb" %>
|
<img src="<%= @store + template['preview']['preview']['thumb']['url'] %>" class="item-thumb" />
|
||||||
<span class="item-info">
|
<span class="item-info">
|
||||||
<b class="item-name"><%= template['title'] %></b>
|
<b class="item-name"><%= template['title'] %></b>
|
||||||
<span class="item-price">Free</span>
|
<span class="item-price">Free</span>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
</a>
|
||||||
|
<%= link_to "Download", "javascript:void(0);", "data-url" => template['template']['template']['url'], :class=> 'btn btn-primary download-link' %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% (12-@templates.size).times do |i| %>
|
|
||||||
<li>
|
|
||||||
<%= link_to admin_template_store_template_path('show', :t => i + 1) do %>
|
|
||||||
<img src="/assets/template/thumb/tb<%= i + 1 %>.jpg" alt="" class="item-thumb">
|
|
||||||
<span class="item-info">
|
|
||||||
<b class="item-name">Template <%= i + 1 %></b>
|
|
||||||
<span class="item-price">Free</span>
|
|
||||||
</span>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function(){
|
||||||
|
$("a.download-link").on(clickEvent,function(){
|
||||||
|
var el = $(this),
|
||||||
|
downloadurl = $(this).data("url");
|
||||||
|
|
||||||
|
el.removeClass("btn-primary").addClass("btn-info").text("Installing").attr('disabled',"disabled");
|
||||||
|
$.ajax({
|
||||||
|
url : "<%= admin_template_store_download_theme_path %>",
|
||||||
|
data : {"url" : downloadurl},
|
||||||
|
dataType : "json",
|
||||||
|
type : "post",
|
||||||
|
success : function(data){
|
||||||
|
if(data.success){
|
||||||
|
el.removeClass('btn-info').addClass('btn-success').text("Installed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
|
|
|
@ -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 %>
|
<% if @template %>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div id="toolbar">
|
<div id="toolbar">
|
||||||
|
@ -21,9 +6,9 @@
|
||||||
<div id="content" class="clearfix">
|
<div id="content" class="clearfix">
|
||||||
<div class="side">
|
<div class="side">
|
||||||
<div id="item-info">
|
<div id="item-info">
|
||||||
<%= image_tag "http://#{APP_CONFIG['store_ip']}#{@template['thumb']}", :class => "item-thumb" %>
|
<%= image_tag "#{@store}#{@template['preview']['preview']['thumb']['url']}", :class => "item-thumb" %>
|
||||||
<h2 class="item-name"><%= @template['title'] %></h2>
|
<h2 class="item-name"><%= @template['title'] %></h2>
|
||||||
<%= 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' %>
|
||||||
<ul class="item-extra-info">
|
<ul class="item-extra-info">
|
||||||
<li><span class="title">views</span><span class="count"><%= Random.new.rand(10..100) %></span></li>
|
<li><span class="title">views</span><span class="count"><%= Random.new.rand(10..100) %></span></li>
|
||||||
<!-- <li><span class="title">color</span><span class="color-tag green"></span></li> -->
|
<!-- <li><span class="title">color</span><span class="color-tag green"></span></li> -->
|
||||||
|
@ -32,13 +17,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="main clearfix">
|
<div class="main clearfix">
|
||||||
<h3>description</h3>
|
<h3>description</h3>
|
||||||
<div id="desc-holder" class="paragraph"><%= @template['intro'] %></div>
|
<div id="desc-holder" class="paragraph"><%#= @template['intro'] %></div>
|
||||||
<h3>screen shot</h3>
|
<h3>screen shot</h3>
|
||||||
<div id="screen-shot">
|
<div id="screen-shot">
|
||||||
<div class="holder">
|
<div class="holder">
|
||||||
<% @template['screenshots'].each do |screenshot| %>
|
|
||||||
<%= image_tag "http://#{APP_CONFIG['store_ip']}#{screenshot}", :class => "preview item-thumb" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,3 +61,24 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function(){
|
||||||
|
$("a.download-link").on(clickEvent,function(){
|
||||||
|
var el = $(this),
|
||||||
|
downloadurl = $(this).data("url");
|
||||||
|
|
||||||
|
el.removeClass("btn-primary").addClass("btn-info").text("Installing").attr('disabled',"disabled");
|
||||||
|
$.ajax({
|
||||||
|
url : "<%= admin_template_store_download_theme_path %>",
|
||||||
|
data : {"url" : downloadurl},
|
||||||
|
dataType : "json",
|
||||||
|
type : "post",
|
||||||
|
success : function(data){
|
||||||
|
if(data.success){
|
||||||
|
el.removeClass('btn-info').addClass('btn-success').text("Installed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
|
|
|
@ -258,7 +258,9 @@ Orbit::Application.routes.draw do
|
||||||
match 'module_store' => 'module_store#index'
|
match 'module_store' => 'module_store#index'
|
||||||
match 'module_store/show' => 'module_store#show'
|
match 'module_store/show' => 'module_store#show'
|
||||||
match 'template_store' => 'template_store#index'
|
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/template/:id' => 'template_store#show', :as => :template_store_template
|
||||||
|
# match 'template_store/cool_method' => "template_store#cool_method"
|
||||||
|
|
||||||
end
|
end
|
||||||
# end admin
|
# end admin
|
||||||
|
|
Reference in New Issue