forked from saurabh/orbit4-5
now data count works on engine setting of module
This commit is contained in:
parent
17598d482f
commit
a2774033a4
|
@ -106,7 +106,8 @@ var Items = function(){
|
|||
sidePanel.on("change","select.module_select", function(){
|
||||
var this_value = $(this).val(),
|
||||
categories_list = $("#categories_list")
|
||||
layouts_list = $("#layouts_list");
|
||||
layouts_list = $("#layouts_list"),
|
||||
data_count_area = $("#data_count_area");
|
||||
|
||||
categories_list.html("");
|
||||
if(this_value){
|
||||
|
@ -142,6 +143,19 @@ var Items = function(){
|
|||
layouts_list.parent().find("label.control-label").text("");
|
||||
layouts_list.empty();
|
||||
}
|
||||
if(data.data_count.present){
|
||||
data_count_area.parent().find("label.control-label").text("Data Count :");
|
||||
var controlDiv = $("<div class='controls'></div>"),
|
||||
select = $("<select name='page[data_count]'></select>");
|
||||
for(i=data.data_count.start;i <= data.data_count.end; i++){
|
||||
select.append("<option value='" + i + "'>" + i + "</option>");
|
||||
}
|
||||
controlDiv.html(select);
|
||||
data_count_area.html(controlDiv);
|
||||
}else{
|
||||
data_count_area.parent().find("label.control-label").text("");
|
||||
data_count_area.empty();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
@ -137,7 +137,11 @@ class PagesController < ApplicationController
|
|||
"id" => cat.id.to_s
|
||||
}
|
||||
end
|
||||
render :json => {"categories" => @categories,"layouts" => (get_layouts module_app.key)}.to_json
|
||||
if module_app.data_count.nil?
|
||||
render :json => {"categories" => @categories,"layouts" => (get_layouts module_app.key),"data_count" => {"present"=>false}}.to_json
|
||||
else
|
||||
render :json => {"categories" => @categories,"layouts" => (get_layouts module_app.key),"data_count" => {"present"=>true,"start"=>module_app.data_count.begin, "end" => module_app.data_count.end}}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -152,9 +156,9 @@ class PagesController < ApplicationController
|
|||
if params[:type] == "page"
|
||||
@pages = Page.where(:page_id.ne => "" , :page_id.exists => true)
|
||||
@modules = ModuleApp.all.frontend_enabled
|
||||
module_app = ModuleApp.find_by_key(@page.module) rescue nil
|
||||
@categories = module_app.categories rescue []
|
||||
@layout_types = get_layouts module_app.key
|
||||
@module_app = ModuleApp.find_by_key(@page.module) rescue nil
|
||||
@categories = @module_app.categories rescue []
|
||||
@layout_types = get_layouts @module_app.key
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -57,13 +57,19 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">Data Count :</label>
|
||||
<div class="controls">
|
||||
<select name="page[data_count]" id="data-count" class="span1">
|
||||
<% 11.times do |i| %>
|
||||
<option value="<%= i %>" <%= "selected='selected'" if i == @page.data_count %> ><%= (i == 0 ? "All" : i) %></option>
|
||||
<label class="control-label"><%= "Data count :" if params[:action] == "edit" && !@module_app.data_count.nil? %></label>
|
||||
<div id="data_count_area">
|
||||
<% if params[:action] == "edit" %>
|
||||
<% if !@module_app.data_count.nil? %>
|
||||
<div class="controls">
|
||||
<select name="page[data_count]" id="data-count" class="span1">
|
||||
<% (@module_app.data_count).each do |i| %>
|
||||
<option value="<%= i %>" <%= "selected='selected'" if i == @page.data_count %> ><%= i %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<% end %>
|
||||
</select>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" id="enable-menu">
|
||||
|
|
Loading…
Reference in New Issue