Updated Module Store to Install a Module directly from Store.tp

This commit is contained in:
Saurabh Bhatia 2014-01-14 11:20:30 +08:00
parent a154d16a7e
commit a108426412
24 changed files with 99 additions and 479 deletions

View File

@ -1,9 +1,49 @@
class Admin::ModuleStoreController < OrbitBackendController class Admin::ModuleStoreController < OrbitBackendController
@@store = STORE_CONFIG[:store_settings]["url"]
def index def index
@extensions = get_extensions
end end
def show def show
@extension = get_extension(params[:id]) rescue nil
end end
def download
#get extension related values
extension = get_extension(params[:id]) rescue nil
download_link = @@store + "/"+ extension["extension"]["extension"]["url"]
downloaded_file_name = extension["extension_filename"]
module_app_name = downloaded_file_name.split(/(.zip)/).first
#check if the directory exists or not
if Dir.exists?("#{Rails.root}/vendor/built_in_modules/#{module_app_name}")
flash[:notice] = "This module is already installed"
else
download_extension(download_link, downloaded_file_name,module_app_name)
flash[:notice] = "This module has been successfully installed"
end
redirect_to admin_module_store_path
end
protected
def get_extensions
JSON.parse(open("#{@@store}/api/extensions").read)
end
def get_extension(id)
JSON.parse(open("#{@@store}/api/extensions/#{id}").read)
end
def download_extension(download_link, downloaded_file_name,module_app_name)
puts %x(wget "#{download_link}")
puts %x(unzip "#{downloaded_file_name}")
puts %x(mv #{module_app_name} "#{Rails.root}/vendor/built_in_modules/")
puts %x(rm "#{downloaded_file_name}")
Rails.logger.info"@@@@@@@@"+Dir.exists?("#{Rails.root}/vendor/built_in_modules/location").inspect
site_restart
end
end end

View File

@ -1,7 +1,7 @@
class Admin::TemplateStoreController < OrbitBackendController class Admin::TemplateStoreController < OrbitBackendController
@@store_domain = "http://store.tp.rulingcom.com" @@store_domain = STORE_CONFIG[:store_settings]["url"]
def index def index
@store = @@store_domain @store = @@store_domain
@templates = JSON.parse(get_templates) @templates = JSON.parse(get_templates)
@ -33,6 +33,4 @@ class Admin::TemplateStoreController < OrbitBackendController
response.body response.body
end end
end end

View File

@ -14,6 +14,12 @@
<%= javascript_include_tag 'lib/retina' %> <%= javascript_include_tag 'lib/retina' %>
<%= javascript_include_tag 'lib/mudole_templates_status' %> <%= javascript_include_tag 'lib/mudole_templates_status' %>
</head> </head>
<!--
<% @extensions.each do |extension|%>
<%=link_to extension["title"], admin_module_store_show_path(extension["_slugs"][0])%>
<%end%> -->
<%= flash[:notice] rescue nil%>
<table id="mt-list" class="table main-list"> <table id="mt-list" class="table main-list">
<thead> <thead>
@ -25,6 +31,28 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @extensions.each do |extension|%>
<tr>
<td class="detail-row">
<div class="module_icon pull-left">
<%= image_tag "module_icon.png"%>
</div>
<h5 class="mt_title"><span><%=link_to extension["title"], admin_module_store_show_path(extension["_slugs"][0])%></span></h5>
<p class="mt_dev muted"><%=extension["author"]%></p>
</td>
<td class="detail-row">2013/07/12</td>
<td>
<%= extension["description"].html_safe%> <%= link_to 'Read More', admin_module_store_show_path(extension["_slugs"][0]) %>
</td>
<!-- <td class="active"><button class="act btn btn-mini" type="button">Uninstall</button></td>
--> <td class="active"><%= link_to 'Download', admin_module_store_download_path(:id => extension["_slugs"][0]), :class=>"act btn btn-mini btn-success" %></td>
</tr>
<% end %>
</tbody>
</table>
<!--
<tr> <tr>
<td class="detail-row"> <td class="detail-row">
<div class="module_icon pull-left"> <div class="module_icon pull-left">
@ -80,6 +108,5 @@
@detail @detail
</td> </td>
<td class="active"><button class="act btn btn-mini btn-info" type="button">Update</button></td> <td class="active"><button class="act btn btn-mini btn-info" type="button">Update</button></td>
</tr> </tr> -->
</tbody>
</table>

View File

@ -22,7 +22,7 @@
<div class="side"> <div class="side">
<div id="item-info"> <div id="item-info">
<img src="/assets/module/thumb/mt<%= params[:m] %>.jpg" alt="" class="item-thumb"> <img src="/assets/module/thumb/mt<%= params[:m] %>.jpg" alt="" class="item-thumb">
<h2 class="item-name">Module Name</h2> <h2 class="item-name"><%= @extension.first["title"] %></h2>
<a id="download" href="">free download</a> <a id="download" href="">free download</a>
<ul class="item-extra-info"> <ul class="item-extra-info">
<li><span class="title">downloads</span><span class="count"><%= Random.new.rand(10..100) %></span></li> <li><span class="title">downloads</span><span class="count"><%= Random.new.rand(10..100) %></span></li>
@ -38,16 +38,12 @@
</div> </div>
</div> </div>
<div class="main clearfix"> <div class="main clearfix">
<h3>description</h3> <h3>Description</h3>
<div id="desc-holder" class="paragraph">Pixel Unions Jitensha defines storefront minimalism. Japanese for “bicycle,” Jitensha offers clean typography and easy usability, including full color, font, logo, and footer customization. With its painless social media and blog integration, Jitensha gorgeously accomodates every aspect of your business. Any questions before you launch? Dont hesitate to email us: Support@PixelUnion.net.</div> <div id="desc-holder" class="paragraph"><%= @extension.first["description"].html_safe%></div>
<h3>screen shot</h3> <h3>screen shot</h3>
<div id="screen-shot"> <div id="screen-shot">
<div class="holder"> <div class="holder">
<img src="" alt="Thumbnail 1" class="preview item-thumb"> <%= image_tag "#{STORE_CONFIG[:store_settings]["url"]}/#{@extension.first['preview']['preview']['url']}"%>
<img src="" alt="Thumbnail 2" class="preview item-thumb">
<img src="" alt="Thumbnail 3" class="preview item-thumb">
<img src="" alt="Thumbnail 4" class="preview item-thumb">
<img src="" alt="Thumbnail 5" class="preview item-thumb">
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,2 @@
data = File.open(File.join(Rails.root, 'config', 'store_config.yml')).read
STORE_CONFIG = YAML::load(ERB.new(data).result(binding)).symbolize_keys

View File

@ -262,6 +262,7 @@ 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 'module_store/download' => 'module_store#download'
match 'template_store' => 'template_store#index' match 'template_store' => 'template_store#index'
match 'template_store/download_theme' => "template_store#download_theme" 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

2
config/store_config.yml Normal file
View File

@ -0,0 +1,2 @@
store_settings:
url: "http://store.tp.rulingcom.com"

View File

@ -1,131 +0,0 @@
var Locations = function(ls){
l = this;
this.name = "Locations";
this.locations = ls;
this.markerCounts = 0;
var map = null,
infowindow = new google.maps.InfoWindow(),
default_location = new google.maps.LatLng( 24.8043107, 121.03042159999995 ),
infowindow_template = "<div class='title'></div><div class='image'><img class='thumbnail' src='' /></div>",
markers = [];
var initialize = function() {
google.maps.visualRefresh = true;
var location = ( l.locations.length ? new google.maps.LatLng( l.locations[0].latitude, l.locations[0].longitude ) : default_location ),
mapOptions = {
zoom: 16,
center: location,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map( document.getElementById('map'), mapOptions );
for( i = 0; i < l.locations.length; i++ ){
markers.push( addMarker( new google.maps.LatLng(l.locations[i].latitude, l.locations[i].longitude), l.locations[i].color, i, function( index ){
}) );
}
}
var addMarker = function( location, pinColor, index, markerCallback ){
var pin = getPin(( pinColor.substr( 0, 1 ) == "#" ? pinColor.replace("#","") : pinColor )),
marker = new google.maps.Marker({
map: map,
icon: pin.image,
shadow: pin.shadow,
position: location,
zIndex: 10
});
google.maps.event.addListener( marker, 'click', function() {
infowindow.setContent( getTemplate( index ) );
infowindow.open( map, marker );
if( typeof markerCallback == "function" )
markerCallback.call( this, index );
});
l.markerCounts++;
return {"marker" : marker, "category_id" : l.locations[index].category_id};
}
var getTemplate = function( obj ){
var object = ( typeof obj == "number" ? l.locations[obj] : ( typeof obj == "object" ? obj : null ) );
if ( object ){
var template = $( "<div></div>" );
template.html( infowindow_template );
template.find( '.title' ).text( object.name );
template.find( "img.thumbnail" ).attr( "src", object.file.thumb.url );
return template.html();
}else{
throw new InvalidObjectError();
}
}
var getPin = function( color ){
var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + color,
new google.maps.Size(21, 34),
new google.maps.Point(0,0),
new google.maps.Point(10, 34));
var pinShadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
new google.maps.Size(40, 37),
new google.maps.Point(0, 0),
new google.maps.Point(12, 35));
return {"image":pinImage,"shadow":pinShadow};
}
this.getMarker = function( index ){
return markers[index];
}
this.getAllMarkers = function( ){
return markers;
}
this.clearFilter = function(){
var m = l.getAllMarkers();
for( i = 0; i < m.length; i++ ){
m[i].marker.setVisible(true);
}
}
this.filterMarkers = function( categories ){
var filtered = [],
m = l.getAllMarkers();
for( i = 0; i < m.length; i++ ){
m[i].marker.setVisible(false);
}
for( i = 0; i < categories.length; i++ ){
filtered = filtered.concat(m.filter(function(a){return a.category_id == categories[i]}));
}
for( i = 0; i < filtered.length; i++ ){
filtered[i].marker.setVisible(true);
}
return filtered;
}
initialize();
}
var InvalidObjectError = function(){
this.name = "InvalidObjectError";
this.message = "Object not valid";
}
InvalidObjectError.prototype = new Error();
InvalidObjectError.prototype.constructor = InvalidObjectError;

View File

@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.

View File

@ -1,19 +0,0 @@
class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendController
def index
@module_app_id = @module_app.id rescue nil
@categories = get_categories_for_index
@categories = @categories.page(params[:page]).per(10)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @categories }
end
end
def list
@module_app_id = @module_app.id rescue nil
@categories = get_categories_for_index
@categories = @categories.page(params[:page]).per(10)
render :layout => false
end
end

View File

@ -1,15 +1,9 @@
class Panel::Location::BackEnd::LocationsController < OrbitBackendController class Panel::Location::BackEnd::LocationsController < OrbitBackendController
include AdminHelper include AdminHelper
open_for_visitor :only => [:get_location_categories, :get_categorywise_locations]
def index def index
@locations = LocationInfo.all @location_infos = LocationInfo.all
@categories = get_categories_for_index @categories = get_categories_for_index
@location_infos = [];
@locations.each do |loc|
loc['color'] = Category.find(loc.category_id).custom_value
@location_infos << loc
end
respond_to do |format| respond_to do |format|
format.html # new.html.erb format.html # new.html.erb
format.json { render json: @locations } format.json { render json: @locations }
@ -28,8 +22,6 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
def edit def edit
@location_info = LocationInfo.find(params[:id]) @location_info = LocationInfo.find(params[:id])
@categories = get_categories_for_index
end end
def show def show
@ -42,7 +34,6 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
def create def create
@location_info = LocationInfo.new(params[:location_info]) @location_info = LocationInfo.new(params[:location_info])
@categories = get_categories_for_index
if @location_info.save if @location_info.save
flash[:success] = "Success!!" flash[:success] = "Success!!"
redirect_to panel_location_back_end_locations_url redirect_to panel_location_back_end_locations_url
@ -90,43 +81,4 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
render :json => JSON.pretty_generate(@data) render :json => JSON.pretty_generate(@data)
end end
def get_location_categories
check_mobile_api_openness
location_categories = get_categories_for_index
@data = Array.new
location_categories.each do |category|
I18n.locale = :en
name_en = category.title
I18n.locale = :zh_tw
name_zh_tw = category.title
category_id = category.id.to_s
@data << { name_en: name_en, name_zh_tw: name_zh_tw, category_id: category_id, location_link: "http://#{request.host_with_port}"+"/#{panel_location_back_end_locations_get_categorywise_locations_path}"+"?category_id=#{category_id}"}
end
render :json => JSON.pretty_generate(@data)
end
def get_categorywise_locations
check_mobile_api_openness
location_infos = LocationInfo.where(:category_id => params[:category_id])
@data = Array.new
location_infos.each do |location|
picurl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.url}"
thumburl = location.file.blank? ? '' : "http://#{request.host_with_port + location.file.thumb.url}"
@data << { id: location.id.to_s,
name: location.name,
pic_url: picurl,
thumb_url: thumburl,
longitude: location.longitude,
latitude: location.latitude,
description: location.description }
end
render :json => JSON.pretty_generate(@data)
end
end end

View File

@ -1,12 +0,0 @@
class Panel::Location::FrontEnd::LocationsController < OrbitWidgetController
def index
@categories = @module_app.categories.enabled
@locations = LocationInfo.all
@location_infos = [];
@locations.each do |loc|
loc['color'] = Category.find(loc.category_id).custom_value
@location_infos << loc
end
end
end

View File

@ -1,17 +0,0 @@
class Panel::Location::Widget::LocationsController < OrbitWidgetController
def location_widget
@categories = params[:category_id]
locations = LocationInfo.where(:category_id.in => @categories)
@url = "http://maps.googleapis.com/maps/api/staticmap?zoom=16&size=400x400&maptype=roadmap%20&sensor=false&"
markers = ""
locations.each do |loc|
color = Category.find(loc.category_id).custom_value
color.gsub!("#","")
markers = markers + "markers=color:0x#{color}|#{loc.latitude},#{loc.longitude}&"
end
@url = @url + markers.chop
# http://maps.googleapis.com/maps/api/staticmap?zoom=13&size=600x300&maptype=roadmap%20&markers=color:0xCF2C9B|40.702147,-74.015794&markers=color:CF2C9B|label:G|40.711614,-74.012318%20&markers=color:red|color:red|label:C|40.718217,-73.998284&sensor=false
end
end

View File

@ -1,21 +0,0 @@
<tr class="<%= 'disable' if category.disable %>">
<% @site_valid_locales.each_with_index do |locale, i| %>
<td>
<%= category.title_translations[locale] %>
<% if i == 0 %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if is_admin?%>
<li><%= link_to t(:edit), '#', class: "open-slide", data: {title: t(:edit_category), id: category.id.to_s, module: @module_app_id.to_s, form: category.title_translations.merge(color: category.custom_value)} %></li>
<li><%= link_to show_toggle_archive_btn(category), toggle_admin_module_app_category_path(@module_app_id, category), method: :post, remote: true, class: "archive_toggle" %></li>
<% end %>
<% if is_manager? || is_admin? %>
<li><%= link_to t(:category_auth), admin_authorizations_path(@module_app.key, 'category_authorization', category.id) %></li>
<% end %>
</ul>
</div>
<% end %>
</td>
<% end %>
<td><span class="badge" style="background-color: <%= category.custom_value %>;"><%= category.custom_value %></span></td>
</tr>

View File

@ -1,12 +0,0 @@
<%= flash_messages %>
<%= f.error_messages %>
<%= label_tag("color", t("location.color")) %>
<div class="input-append">
<%= f.text_field :custom_value, id: "color", :class => "color-picker miniColors input-small", :size => "7", :maxlength => "7", :autocomplete=>"off",:value=>"9100FF" %>
</div>
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<%= label_tag "name-#{locale}", "#{t(:name)} (#{I18nVariable.from_locale(locale)})" %>
<%= f.text_field locale, :class => 'input-large', :value => (@category.title_translations[locale] rescue ''), placeholder: t(:name), id: locale %>
<% end %>
<% end %>

View File

@ -1,66 +0,0 @@
<%= stylesheet_link_tag "jquery.miniColors" %>
<%= javascript_include_tag "jquery.miniColors.min" %>
<%= javascript_include_tag "admin/categories" %>
<div id="categories_index">
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @site_valid_locales.each_with_index do |locale, i| %>
<th class="<%= 'span5' if i <= 1 %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th>
<% end %>
<th class="span2"><a href="#"><%= t('event_category.color') %></a></th>
</tr>
</thead>
<tbody>
<%= render partial: 'category', collection: @categories %>
</tbody>
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %>
</div>
<div class="pagination pagination-centered">
<%= paginate @categories unless @categories.blank? %>
</div>
</div>
</div>
<div id="pageslide">
<div class="page-title clearfix">
<a class="pull-right" href="javascript:$.pageslide.close()">
<i class="icons-arrow-left-2"></i>
</a>
<span></span>
</div>
<div class="view-page">
<div class="nano">
<div class="content">
<%= form_for :category, url: nil, html:{:id=>"color"}, remote: true do |f| %>
<fieldset>
<%= render :partial => "form", :locals => { :f => f } %>
<div class="form-actions">
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
</div>
</fieldset>
<% end %>
</div>
</div>
</div>
</div>
<script type="text/javascript">
if($('.color-picker').length > 0){
$('.color-picker').miniColors(); // just in category view
$('.miniColors-trigger').addClass('btn');
}
$("form#color").bind("ajax:complete",function(){
$.get("<%= panel_location_back_end_location_categories_list_path %>",function(data){
$("#categories_index").html(data);
openSlide();
})
})
</script>

View File

@ -1,21 +0,0 @@
<table class="table main-list">
<thead>
<tr class="sort-header">
<% @site_valid_locales.each_with_index do |locale, i| %>
<th class="<%= 'span5' if i <= 1 %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th>
<% end %>
<th class="span2"><a href="#"><%= t('location_category.color') %></a></th>
</tr>
</thead>
<tbody>
<%= render partial: 'category', collection: @categories %>
</tbody>
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %>
</div>
<div class="pagination pagination-centered">
<%= paginate @categories unless @categories.blank? %>
</div>
</div>

View File

@ -19,8 +19,8 @@
<div class="control-group"> <div class="control-group">
<label class="control-label" for=""><%= t 'coordinates' %></label> <label class="control-label" for=""><%= t 'coordinates' %></label>
<div class="controls"> <div class="controls">
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Latitude" %>
<%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %> <%= f.text_field :longitude, :class=>"span2", :placeholder => "Longitude" %>
<%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
</div> </div>
</div> </div>

View File

@ -1,5 +1,3 @@
<script src="http://maps.google.com/maps/api/js?sensor=true"></script>
<%= javascript_include_tag "location" %>
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr> <tr>
@ -30,44 +28,6 @@
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<div>
Categories :
</div>
<div class="btn-group">
<% @categories.each do |category| %>
<button class="btn cat-filter" data-category='<%= category.id %>'><%= category.title %></button>
<% end %>
</div>
<a href="javascript:void(0);" id="clear_filter">Clear Filter</a>
<div id="map" style="width: 100%; height: 500px;"></div>
<%if is_manager? %> <%if is_manager? %>
<td><%= link_to 'Add', new_panel_location_back_end_location_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn"%></td> <td><%= link_to 'Add', new_panel_location_back_end_location_path, :class => "btn btn-primary pull-right", :id=>"create_event_btn", :ref=>"add-btn"%></td>
<% end %> <% end %>
<script>
var loc = new Locations(<%= @location_infos.to_json.html_safe %>);
jQuery(document).ready(function($) {
var filterCategories = [];
$("button.cat-filter").bind( clickEvent,function(){
var catid = $( this ).data('category');
if ( $( this ).hasClass('active') ){
$( this ).removeClass('active');
var index = filterCategories.indexOf(filterCategories.filter(function(a,i){ return a == catid })[0]);
filterCategories.splice( index, 1 );
}else{
$( this ).addClass('active');
filterCategories.push( catid );
}
loc.filterMarkers(filterCategories);
})
$("a#clear_filter").bind( clickEvent, function(){
filterCategories = [];
$("button.cat-filter").removeClass('active');
loc.clearFilter();
})
});
</script>

View File

@ -1,40 +0,0 @@
<%= javascript_include_tag "location" %>
<div>
Categories :
<% @categories.each do |category| %>
<input type="checkbox" class="btn cat-filter" data-category='<%= category.id %>' /><%= category.title %>
<% end %>
</div>
<a href="javascript:void(0);" id="clear_filter">Clear Filter</a>
<div id="map" style="width: 100%; height: 500px;"></div>
<script>
var loc = null;
var initialize = function(){
loc = new Locations(<%= @location_infos.to_json.html_safe %>);
}
jQuery(document).ready(function($) {
var filterCategories = [];
$("input.cat-filter").bind( "click",function(){
var catid = $( this ).data('category');
if ( !$( this ).is(':checked') ){
var index = filterCategories.indexOf(filterCategories.filter(function(a,i){ return a == catid })[0]);
filterCategories.splice( index, 1 );
}else{
filterCategories.push( catid );
}
loc.filterMarkers(filterCategories);
})
$("a#clear_filter").bind( "click", function(){
filterCategories = [];
$("input.cat-filter").prop('checked',false);
loc.clearFilter();
})
});
</script>
<script src="http://maps.google.com/maps/api/js?sensor=true&callback=initialize"></script>

View File

@ -1,3 +0,0 @@
<a href="<%= panel_location_front_end_locations_path %>" >
<%= image_tag @url, :width=>"300", :height=>"300" %>
</a>

View File

@ -2,22 +2,12 @@ Rails.application.routes.draw do
namespace :panel do namespace :panel do
namespace :location do namespace :location do
namespace :back_end do namespace :back_end do
match 'location_categories/list' => "location_categories#list"
match "locations/get_locations" => "locations#get_locations"
match "locations/get_categorywise_locations" => "locations#get_categorywise_locations"
match "locations/get_location_categories" => "locations#get_location_categories"
resources :location_categories
match "locations/get_locations" => "locations#get_locations" match "locations/get_locations" => "locations#get_locations"
match "locations/get_categories" => "locations#get_categories" match "locations/get_categories" => "locations#get_categories"
resources :locations resources :locations
end end
namespace :front_end do
resources :locations
end
namespace :widget do
match "location_widget" => "locations#location_widget"
end
end end
end end
end end

View File

@ -4,17 +4,15 @@ module Location
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
# personal_plugin :enable => true,:path=>"panel/location/plugin/profile",:i18n=>'admin.location' # personal_plugin :enable => true,:path=>"panel/location/plugin/profile",:i18n=>'admin.location'
version "0.1" # version "0.1"
organization "Rulingcom" # organization "Rulingcom"
author "RD dep" # author "RD dep"
intro "I am intro" # intro "I am intro"
update_info 'some update_info' # update_info 'some update_info'
front_end do # front_end do
app_page 'locations' do # app_page 'bulletins'
frontend_i18n 'location.location' # end
end
end
# category ["BulletinCategory"] # category ["BulletinCategory"]
@ -36,36 +34,30 @@ module Location
categorizable categorizable
authorizable authorizable
widgets do
customize_widget "location_widget" do
widget_i18n "location.location"
end
end
side_bar do side_bar do
head_label_i18n 'location.location',:icon_class=>"icons-location" head_label_i18n 'location.location',:icon_class=>"icons-location"
available_for [:admin,:guest,:manager,:sub_manager] available_for [:admin,:guest,:manager,:sub_manager]
active_for_controllers ({:private=>['locations','location_categories']}) active_for_controllers ({:private=>['locations']})
head_link_path "panel_location_back_end_locations_path" head_link_path "panel_location_back_end_locations_path"
context_link 'location.all_locations', context_link 'location.all_locations',
:link_path=>"panel_location_back_end_locations_path" , :link_path=>"panel_location_back_end_locations_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{:locations=>:index}, :active_for_action=>{:localtions=>:index},
:available_for => [:manager] :available_for => [:manager]
context_link 'location.add_location', context_link 'location.add_location',
:link_path=>"new_panel_location_back_end_location_path" , :link_path=>"new_panel_location_back_end_location_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{:locations=>:new}, :active_for_action=>{:localtions=>:new},
:available_for => [:manager] :available_for => [:manager]
context_link 'location.categories', context_link 'location.categories',
:link_path=>"panel_location_back_end_location_categories_path" , :link_path=>"admin_module_app_categories_path(get_module_app)" ,
:priority=>1, :priority=>1,
:active_for_category => 'Location', :active_for_action=>{:localtion_categories=>:index},
:available_for => [:manager] :available_for => [:manager]
end end