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

View File

@ -1,9 +1,18 @@
class Admin::AssetsController < OrbitBackendController
open_for_user
open_for_admin
before_filter :setup_vars
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"
@assets = @assets.where(:content_type => /^image/)
end
@ -55,7 +64,6 @@ class Admin::AssetsController < OrbitBackendController
render :layout=>false
else
flash[:error] = t('create.fail')
@asset_categories = AssetCategory.all
@tags = get_tags
respond_to do |format|
format.js {
@ -75,7 +83,6 @@ class Admin::AssetsController < OrbitBackendController
render layout: false
else
flash[:error] = t('update.fail')
@asset_categories = AssetCategory.all
@tags = get_tags
respond_to do |format|
format.html { render :action => :edit }

View File

@ -188,11 +188,20 @@ class PagesController < ApplicationController
@item = Item.where(:category => category_ids).first
else
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
if !model.nil?
item = model.find(params[:id])
@item = Item.where(:category => [item.category_id.to_s]).first if !module_app.has_category.blank?
end
end
end
end

View File

@ -28,17 +28,6 @@
<% end %>
</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">
<label class="control-label muted"><%= f.label :data, t(:data) %></label>
<div class="controls">

View File

@ -222,7 +222,7 @@
</div>
</div>
<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">
<label class="control-label">Search Box :</label>
<div class="controls">