diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb
index 96f0e7b93..ef054a1d8 100644
--- a/app/controllers/admin/assets_controller.rb
+++ b/app/controllers/admin/assets_controller.rb
@@ -32,12 +32,8 @@ class Admin::AssetsController < OrbitBackendController
def edit
@asset = Asset.find(params[:id])
- @asset_categories = AssetCategory.all
@tags = get_tags
- respond_to do |format|
- format.html {}
- format.js { render 'js/show_pop_up', :locals => {:partial => 'admin/assets/edit'} }
- end
+ render layout: false
end
def create
@@ -74,10 +70,7 @@ class Admin::AssetsController < OrbitBackendController
def update
@asset = Asset.find(params[:id])
if @asset.update_attributes(params[:asset])
- respond_to do |format|
- format.html { redirect_to admin_assets_url }
- format.js { render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} }
- end
+ render layout: false
else
flash[:error] = t('update.fail')
@asset_categories = AssetCategory.all
diff --git a/app/views/admin/assets/_asset.html.erb b/app/views/admin/assets/_asset.html.erb
index 860d39933..b7c30fe93 100644
--- a/app/views/admin/assets/_asset.html.erb
+++ b/app/views/admin/assets/_asset.html.erb
@@ -30,6 +30,6 @@
-
<%= t('editing.asset') %>
-
- <%= flash_messages %>
-
- <%= form_for @asset, :url => admin_asset_path(@asset), :html => {:id => (is_html ? nil : 'ajaxForm'), :multipart => true } do |f| %>
+<%= flash_messages %>
+
+<%= form_for @asset, :url => admin_asset_path(@asset), :remote => true do |f| %>
+
<%= f.error_messages %>
<%= render :partial => "form", :locals => { :f => f } %>
-
- <% end %>
-
\ No newline at end of file
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/admin/assets/_form.html.erb b/app/views/admin/assets/_form.html.erb
index 32817f82f..1e080678b 100644
--- a/app/views/admin/assets/_form.html.erb
+++ b/app/views/admin/assets/_form.html.erb
@@ -1,38 +1,46 @@
-
<%= t :title %>
-
- <%= f.fields_for :title_translations do |f| %>
- <% @site_valid_locales.each do |locale| %>
- <%= content_tag :label do -%>
-
- <%= I18nVariable.from_locale(locale) %>
- <%= f.text_field locale, :class => "input-large", :value => (@asset.title_translations[locale] rescue nil) %>
+
+ <% @site_valid_locales.each_with_index do |locale, i| %>
+
+
+ <%= f.label :description ,t('asset.description'), :class => "control-label muted" %>
+ <%= f.fields_for :description_translations do |f| %>
+
+
+ <%= f.text_area locale, :style=>"width:100%;height:100px", :class => '', :value => (@asset.description_translations[locale] rescue nil) %>
+
+
+ <% end %>
+
+
+ <% end %>
+
-
<%= f.label :category, t(:category) %>
-
- <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.title, t.id ]}, {}, :class => "input-large" %>
-
-
-
-
<%= t :tags %>
-
+
Tag
+
<% @tags.each do |tag| %>
- <%= content_tag :label, :class => "checkbox inline" do -%>
- <%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %>
+
+ <%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id)%>
<%= tag.name %>
- <%= hidden_field_tag 'asset[tag_ids][]', '' %>
- <% end %>
+
<% end %>
-
+
-
<%= f.label :data, t(:data) %>
+
<%= f.label :data, t(:data) %>
<%= f.file_field :data, :class => 'upload' %>
diff --git a/app/views/admin/assets/create.html.erb b/app/views/admin/assets/create.html.erb
deleted file mode 100644
index 81b112dc4..000000000
--- a/app/views/admin/assets/create.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<% if !request.xhr? %>
-
-<% end %>
\ No newline at end of file
diff --git a/app/views/admin/assets/edit.html.erb b/app/views/admin/assets/edit.html.erb
index b4b57fabf..c4c33e4ba 100644
--- a/app/views/admin/assets/edit.html.erb
+++ b/app/views/admin/assets/edit.html.erb
@@ -1,9 +1 @@
-<% content_for :secondary do %>
-
-
- <%= link_to t('new.asset'), new_admin_asset_path, :remote => true, :class => 'button positive' %>
-
-
-<% end -%>
-
<%= render :partial => 'edit', :locals => {:is_html => true} %>
\ No newline at end of file
diff --git a/app/views/admin/assets/index.html.erb b/app/views/admin/assets/index.html.erb
index 070c640d1..fc373d2e0 100644
--- a/app/views/admin/assets/index.html.erb
+++ b/app/views/admin/assets/index.html.erb
@@ -302,17 +302,9 @@
<% content_for :page_specific_javascript do %>
@@ -402,8 +394,18 @@ $(document).ready(function(){
deleteBtn.hide();
})
})
+ var currentEdit = null;
+ $(document).on("ajax:success","form[data-remote=true]",function(evt, data, xhr){
+ currentEdit.replaceWith($(data));
+ $("#editform").modal("hide");
+ })
+
$("#asset_sort_list").on(clickEvent,".editform",function(){
- $("#editform").modal("show");
+ currentEdit = $(this).parent().parent();
+ $.get($(this).attr("href"),function(data){
+ $("#editform").html(data).modal("show");
+ })
+ return false;
})
function getUrlParam( paramName ) {
diff --git a/app/views/admin/assets/update.html.erb b/app/views/admin/assets/update.html.erb
new file mode 100644
index 000000000..9154b6948
--- /dev/null
+++ b/app/views/admin/assets/update.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'asset', :object => @asset %>
\ No newline at end of file