Merge branch 'master' of http://gitlab.tp.rulingcom.com/saurabh/orbit-4-2
This commit is contained in:
commit
e705ba9a26
|
@ -1,9 +1,13 @@
|
||||||
class Admin::ModuleStoreController < OrbitBackendController
|
class Admin::ModuleStoreController < OrbitBackendController
|
||||||
before_filter :check_central_server_connection
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
if get_site.site_token?
|
||||||
@extensions = get_extensions
|
@extensions = get_extensions
|
||||||
@downloaded_extensions = get_downloaded_extension
|
@downloaded_extensions = get_downloaded_extension
|
||||||
|
else
|
||||||
|
@extensions = []
|
||||||
|
@downloaded_extensions = get_downloaded_extension
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
class Admin::SiteRegistrationController < OrbitBackendController
|
||||||
|
def index
|
||||||
|
@site = Site.first
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def register
|
||||||
|
@site = Site.find(params[:site][:id])
|
||||||
|
response = @site.register_site(params[:site][:url],params[:site][:university],params[:site][:department],params[:site][:email],params[:site][:country])
|
||||||
|
render :json => response.to_json
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,13 +3,17 @@ require 'uri'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'zip/zip'
|
require 'zip/zip'
|
||||||
class Admin::TemplateStoreController < OrbitBackendController
|
class Admin::TemplateStoreController < OrbitBackendController
|
||||||
before_filter :check_central_server_connection
|
|
||||||
before_filter :set_store
|
before_filter :set_store
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@site = Site.first
|
||||||
|
if @site.site_token?
|
||||||
@design_ids = Design.all.map{|d| d.template_store_id}
|
@design_ids = Design.all.map{|d| d.template_store_id}
|
||||||
@templates = get_templates.parsed_response
|
@templates = get_templates.parsed_response
|
||||||
render :layout => false
|
render :layout => false
|
||||||
|
else
|
||||||
|
render :partial => "admin/site_registration/site_registration"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -483,11 +483,15 @@ class ApplicationController < ActionController::Base
|
||||||
if @site.site_token?
|
if @site.site_token?
|
||||||
flash[:notice]="Connected to the Store"
|
flash[:notice]="Connected to the Store"
|
||||||
else
|
else
|
||||||
redirect_to admin_sites_register_site_path
|
redirect_to admin_site_registration_path
|
||||||
flash[:notice]="To Access the Store Please Connect It"
|
flash[:notice]="To Access the Store Please Connect It"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def site_token_present?
|
||||||
|
@site.site_token?
|
||||||
|
end
|
||||||
|
|
||||||
def store_session
|
def store_session
|
||||||
api_key = STORE_CONFIG[:store_settings]["api_key"]
|
api_key = STORE_CONFIG[:store_settings]["api_key"]
|
||||||
@store = Store.new(@site.id.to_s,@site.site_token,api_key) if @site.site_token
|
@store = Store.new(@site.id.to_s,@site.site_token,api_key) if @site.site_token
|
||||||
|
|
|
@ -104,11 +104,11 @@ class Site
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def register_site
|
def register_site(url,university,department,email,country)
|
||||||
api_key = STORE_CONFIG[:store_settings]["api_key"]
|
api_key = STORE_CONFIG[:store_settings]["api_key"]
|
||||||
self.generate_site_token
|
self.generate_site_token
|
||||||
store = Store.new(self.id.to_s,self.site_token,api_key)
|
store = Store.new(self.id.to_s,self.site_token,api_key)
|
||||||
store.post_client(self.id.to_s,self.site_token,self.title)
|
store.post_client(self.id.to_s,self.site_token,self.title,url,university,department,email,country)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -184,6 +184,9 @@
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-heading"><i class="icon-shopping-cart"></i><span class="break"></span><%= t(:module_store) %></div>
|
<div class="panel-heading"><i class="icon-shopping-cart"></i><span class="break"></span><%= t(:module_store) %></div>
|
||||||
<div class="pannel-body">
|
<div class="pannel-body">
|
||||||
|
<% if @extensions.empty? %>
|
||||||
|
<%= render :partial => "admin/site_registration/site_registration" %>
|
||||||
|
<% else %>
|
||||||
<table id="mt-list" class="table main-list">
|
<table id="mt-list" class="table main-list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="sort-header">
|
<tr class="sort-header">
|
||||||
|
@ -215,7 +218,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="pannel-footer">
|
<div class="pannel-footer">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
<div class="form register-form">
|
||||||
|
<h4 class="login-logo">Register with app store</h4>
|
||||||
|
<div class="form-block option-block">
|
||||||
|
<div class="form-list clearfix">
|
||||||
|
<form class="form-horizontal" action="<%= admin_site_registration_register_path %>" data-remote="true">
|
||||||
|
<div class="control-group clear">
|
||||||
|
<label class="control-label">Site name: </label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="control-label muted"><%= @site.title %></label>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="site[name]" value="<%= @site.title %>" />
|
||||||
|
</div>
|
||||||
|
<div class="control-group clear">
|
||||||
|
<label class="control-label">Site id: </label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="control-label muted"><%= @site.id.to_s %></label>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="site[id]" value="<%= @site.id.to_s %>" />
|
||||||
|
</div>
|
||||||
|
<div class="control-group clear">
|
||||||
|
<label class="control-label">Site url: </label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="control-label muted"><%= request.protocol + request.host %></label>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="site[url]" value="<%= request.protocol + request.host %>" />
|
||||||
|
</div>
|
||||||
|
<div class="control-group clear">
|
||||||
|
<label class="control-label">University name: </label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" name="site[university]" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group clear">
|
||||||
|
<label class="control-label">Department name: </label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" name="site[department]" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group clear">
|
||||||
|
<label class="control-label">Admin email: </label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" name="site[email]" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group clear">
|
||||||
|
<label class="control-label">Country name: </label>
|
||||||
|
<div class="controls">
|
||||||
|
<select id="country_list" name="site[country]"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="pull-right">
|
||||||
|
<input type="submit" class="btn btn-primary" value="Register"/>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<style type="text/css">
|
||||||
|
.register-form{
|
||||||
|
width:500px;
|
||||||
|
margin:auto;
|
||||||
|
border-width:1px;
|
||||||
|
border-style:dashed;
|
||||||
|
padding:5px;
|
||||||
|
border-color:#d7d7d7;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function() {
|
||||||
|
var country_list = ["Afghanistan","Albania","Algeria","Andorra","Angola","Anguilla","Antigua & Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia & Herzegovina","Botswana","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada", "Cape Verde","Cayman Islands","Chad","Chile","China","Colombia","Congo","Cook Islands","Costa Rica","Cote D Ivoire","Croatia","Cruise Ship","Cuba","Curaçao","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Falkland Islands","Faroe Islands","Fiji","Finland","France","French Polynesia","French West Indies","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guam","Guatemala","Guernsey","Guinea","Guinea Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kuwait","Kyrgyz Republic","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macau","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Mauritania","Mauritius","Mexico","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Namibia","Nepal","Netherlands","Netherlands Antilles","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico","Qatar","Reunion","Romania","Russia","Rwanda","Saint Pierre & Miquelon","Samoa","San Marino","Satellite","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","South Africa","South Korea","Spain","Sri Lanka","St Kitts & Nevis","St Lucia","St Vincent","St. Lucia","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Timor L'Este","Togo","Tonga","Trinidad & Tobago","Tunisia","Turkey","Turkmenistan","Turks & Caicos","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States", "Uruguay","Uzbekistan","Venezuela","Vietnam","Virgin Islands (US)","Yemen","Zambia","Zimbabwe"];
|
||||||
|
|
||||||
|
var cl = $("#country_list");
|
||||||
|
cl.html("<option value=''>Select a country</option>");
|
||||||
|
$.each(country_list,function(i,country){
|
||||||
|
cl.append("<option value='" + country + "'>" + country + "</option>");
|
||||||
|
})
|
||||||
|
$("form").submit(function(){
|
||||||
|
$(this).find("input[type=submit]").removeClass("btn-primary").addClass("btn-info").attr("disabled","disabled").val("Registering...");
|
||||||
|
})
|
||||||
|
$("form").on("ajax:complete",function(res,data){
|
||||||
|
$(this).find("input[type=submit]").removeClass("btn-info").addClass("btn-success").attr("disabled","disabled").val("Registered");
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
||||||
|
</script>
|
|
@ -0,0 +1 @@
|
||||||
|
<%= render :partial=> "site_registration" %>
|
|
@ -0,0 +1 @@
|
||||||
|
This is index
|
|
@ -263,6 +263,12 @@ Orbit::Application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
match 'site_registration/register' => 'site_registration#register'
|
||||||
|
resources :site_registration do
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 'module_store/download' => 'module_store#download'
|
match 'module_store/download' => 'module_store#download'
|
||||||
|
|
|
@ -26,8 +26,6 @@ module OrbitApp
|
||||||
def initialize(name,key,&block)
|
def initialize(name,key,&block)
|
||||||
@widgets = []
|
@widgets = []
|
||||||
@default_widget = nil
|
@default_widget = nil
|
||||||
@widget_title_enabled = true
|
|
||||||
@column_title_enabled = false
|
|
||||||
@categories_query = ''
|
@categories_query = ''
|
||||||
@tags_query = ''
|
@tags_query = ''
|
||||||
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||||
|
@ -103,8 +101,8 @@ module OrbitApp
|
||||||
|
|
||||||
def initialize(&block)
|
def initialize(&block)
|
||||||
@query = nil
|
@query = nil
|
||||||
@widget_title_enabled = true
|
@widget_title_enabled = false
|
||||||
@column_title_enabled = false
|
@column_title_enabled = true
|
||||||
@image = nil
|
@image = nil
|
||||||
@more_link = {}
|
@more_link = {}
|
||||||
@fields = []
|
@fields = []
|
||||||
|
|
|
@ -45,8 +45,8 @@ class Store
|
||||||
self.class.get("/extensions/#{id}", options)
|
self.class.get("/extensions/#{id}", options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_client(site_id,site_token,site_name)
|
def post_client(site_id,site_token,site_name,url,university,department,email,country)
|
||||||
options = @options_for_client.merge({ :body => {:site_name => site_name, :site_id => site_id, :site_token => site_token}.to_json })
|
options = @options_for_client.merge({ :body => {:site_name => site_name, :site_id => site_id,:url => url, :university => university, :department => department, :email => email, :country => country, :site_token => site_token}.to_json })
|
||||||
self.class.post('/clients', options )
|
self.class.post('/clients', options )
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue