description and tags for gallery fixed

This commit is contained in:
Harry Bomrah 2013-11-26 20:08:38 +08:00 committed by Manson Wang
parent eb4cf1d165
commit dc7710cc65
3 changed files with 7 additions and 7 deletions

View File

@ -81,6 +81,7 @@ $(function() {
obj = photosData.filter(function(a) { obj = photosData.filter(function(a) {
return a.id == image_id; return a.id == image_id;
})[0]; })[0];
switch($e.attr("for")){ switch($e.attr("for")){
case "description": case "description":
if(obj.description){ if(obj.description){
@ -91,6 +92,10 @@ $(function() {
} }
instance.find("input[type=hidden]").val(image_id); instance.find("input[type=hidden]").val(image_id);
instance.find("form").bind("ajax:success",function(evt, data, status){
$.pageslide.close();
photosData = data;
})
break; break;
case "tags": case "tags":
instance.find('.tags-groups').cardCheck({ instance.find('.tags-groups').cardCheck({
@ -141,11 +146,6 @@ $(function() {
} }
} }
$('form[data-remote]').bind("ajax:success",function(evt, data, status){
$.pageslide.close();
photosData = data;
})
var photosData = null; var photosData = null;
if($("#imgholder").length){ if($("#imgholder").length){
$.getJSON(window.location.pathname, function(json, textStatus) { $.getJSON(window.location.pathname, function(json, textStatus) {

View File

@ -29,7 +29,7 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
def update_image def update_image
image = AlbumImage.find(params[:image_id]) image = AlbumImage.find(params[:image_id])
image.update_attributes(params[:album_image]) image.update_attributes(params[:album_image])
image.save image.save!
@album = Album.find(image.album_id.to_s) @album = Album.find(image.album_id.to_s)
@images = @album.album_images @images = @album.album_images
@image_content = [] @image_content = []

View File

@ -150,7 +150,7 @@
<legend>Description</legend> <legend>Description</legend>
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
<label><%= I18nVariable.from_locale(locale) %></label> <label><%= I18nVariable.from_locale(locale) %></label>
<textarea rows="10" name="gallery_image[description_translations][<%= locale %>]" for="<%= locale %>"></textarea> <textarea rows="10" name="album_image[description_translations][<%= locale %>]" for="<%= locale %>"></textarea>
<% end %> <% end %>
<div class="form-actions"> <div class="form-actions">
<a href="javascript:$.pageslide.close()" class="btn btn-small">Cancel</a> <a href="javascript:$.pageslide.close()" class="btn btn-small">Cancel</a>