filemanger authentication changes and also announcement preview fixed and also text search for files

Conflicts:
	app/views/admin/assets/index.html.erb
This commit is contained in:
Harry Bomrah 2013-12-11 18:43:38 +08:00 committed by saurabhbhatia
parent 5faa7e73c0
commit 0671d0b126
5 changed files with 28 additions and 17 deletions

View File

@ -108,8 +108,10 @@ $(document).ready(function(){
}) })
var currentEdit = null; var currentEdit = null;
$(document).on("ajax:success","form[data-remote=true]",function(evt, data, xhr){ $(document).on("ajax:success","form[data-remote=true]",function(evt, data, xhr){
if(currentEdit){
currentEdit.replaceWith($(data)); currentEdit.replaceWith($(data));
$("#editform").modal("hide"); $("#editform").modal("hide");
}
}) })
$("#asset_sort_list").on(clickEvent,".editform",function(){ $("#asset_sort_list").on(clickEvent,".editform",function(){
@ -120,6 +122,10 @@ $(document).ready(function(){
return false; return false;
}) })
$("#editform").on("hidden",function(){
currentEdit = null;
})
function getUrlParam( paramName ) { function getUrlParam( paramName ) {
var reParam = new RegExp( '(?:[\?&]|&)' + paramName + '=([^&]+)', 'i' ) ; var reParam = new RegExp( '(?:[\?&]|&)' + paramName + '=([^&]+)', 'i' ) ;
var match = window.location.search.match(reParam) ; var match = window.location.search.match(reParam) ;

View File

@ -1,9 +1,18 @@
class Admin::AssetsController < OrbitBackendController class Admin::AssetsController < OrbitBackendController
open_for_user
open_for_admin
before_filter :setup_vars before_filter :setup_vars
def index def index
@assets = (params[:sort] || @filter) ? get_sorted_and_filtered("asset") : Asset.all.desc(:created_at)
if params[:filter]
@assets = current_user.assets.where(title: /#{params[:filter]}/i)
else
@assets = current_user.assets.desc(:created_at)
end
if params[:type] == "image" if params[:type] == "image"
@assets = @assets.where(:content_type => /^image/) @assets = @assets.where(:content_type => /^image/)
end end
@ -55,7 +64,6 @@ class Admin::AssetsController < OrbitBackendController
render :layout=>false render :layout=>false
else else
flash[:error] = t('create.fail') flash[:error] = t('create.fail')
@asset_categories = AssetCategory.all
@tags = get_tags @tags = get_tags
respond_to do |format| respond_to do |format|
format.js { format.js {
@ -75,7 +83,6 @@ class Admin::AssetsController < OrbitBackendController
render layout: false render layout: false
else else
flash[:error] = t('update.fail') flash[:error] = t('update.fail')
@asset_categories = AssetCategory.all
@tags = get_tags @tags = get_tags
respond_to do |format| respond_to do |format|
format.html { render :action => :edit } format.html { render :action => :edit }

View File

@ -188,12 +188,21 @@ class PagesController < ApplicationController
@item = Item.where(:category => category_ids).first @item = Item.where(:category => category_ids).first
else else
if params[:action] && params[:action] == "show_from_link" if params[:action] && params[:action] == "show_from_link"
if params[:preview]
model = "preview".classify.constantize rescue nil
if !model.nil?
item = model.find(params[:id])
@item = Item.where(:category => [item.object['category_id']]).first if !module_app.has_category.blank?
end
else
model = params[:app_action].classify.constantize rescue nil model = params[:app_action].classify.constantize rescue nil
if !model.nil? if !model.nil?
item = model.find(params[:id]) item = model.find(params[:id])
@item = Item.where(:category => [item.category_id.to_s]).first if !module_app.has_category.blank? @item = Item.where(:category => [item.category_id.to_s]).first if !module_app.has_category.blank?
end end
end end
end
end end
@item = Item.root.children.where(:module_app_id => module_app.id).first unless @item @item = Item.root.children.where(:module_app_id => module_app.id).first unless @item

View File

@ -28,17 +28,6 @@
<% end %> <% end %>
</div> </div>
<div class="control-group">
<label class="control-label muted">Tag</label>
<div class="controls" data-toggle="buttons-checkbox">
<% @tags.each do |tag| %>
<label class="checkbox inline btn <%= 'active' if @asset.tag_ids.include?(tag.id) %>">
<%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id)%>
<%= tag.name %>
</label>
<% end %>
</div>
</div>
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= f.label :data, t(:data) %></label> <label class="control-label muted"><%= f.label :data, t(:data) %></label>
<div class="controls"> <div class="controls">

View File

@ -222,7 +222,7 @@
</div> </div>
</div> </div>
<div id="panel_l" class="tab-pane fade in active pull-left"> <div id="panel_l" class="tab-pane fade in active pull-left">
<form action=""> <form data-remote='true' action="<%= admin_assets_path(request.filtered_parameters) %>" method="get">
<div class="control-group"> <div class="control-group">
<label class="control-label">Search Box :</label> <label class="control-label">Search Box :</label>
<div class="controls"> <div class="controls">