code merged … ui updated
This commit is contained in:
parent
04877b9945
commit
91d45b64da
|
@ -35,6 +35,9 @@ var galleryAPI = function(){
|
|||
g.loadArea = "albums";
|
||||
passid = g.urlVars['tag'];
|
||||
g.loadAlbums(g.urlVars['tag']);
|
||||
}else if(g.urlVars["locale"]){
|
||||
g.loadArea = "albums";
|
||||
g.loadAlbums("all");
|
||||
}else if(g.urlVars.length == 0) {
|
||||
g.loadArea = "albums";
|
||||
g.loadAlbums("all");
|
||||
|
@ -493,15 +496,18 @@ var galleryAPI = function(){
|
|||
})
|
||||
g.albumArea.find(".rghead .rgfn .bt-save").click(function(){
|
||||
// var dataArray = Array();
|
||||
// $(".description_loader .txtchange").each(function(){
|
||||
// dataArray.push({"id":$(this).attr("for"),"text": $(this).val()});
|
||||
// $(".description_loader .en .txtchange").each(function(){
|
||||
// var thisid = $(this).attr("for");
|
||||
// dataArray.push({"id":thisid,"text":{"en":$(this).val(),"zh_tw":$(".description_loader .zh_tw .txtchange[for="+thisid+"]").val()}});
|
||||
// })
|
||||
// var albumnm = Array();
|
||||
// $(".albumname_edit .txtchange").each(function(){
|
||||
// albumnm.push($(this).val())
|
||||
// })
|
||||
var dataArray = $("form#edit_album").serialize();
|
||||
$.post("update_album",{"aid":id,"data":dataArray},function(){
|
||||
// var dataArray = $("form#edit_album").serialize();
|
||||
// $.post("update_album",{"data":dataArray},function(){
|
||||
|
||||
// })
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
@ -191,8 +191,24 @@ include AdminHelper
|
|||
# end
|
||||
# album = GalleryAlbum.find(aid)
|
||||
# album.update_attributes(:name => album_name)
|
||||
data = params['data']
|
||||
album_names = params[:albumnm]
|
||||
data = params[:data]
|
||||
aid =params[:aid]
|
||||
debugger
|
||||
data.each do |d|
|
||||
image = GalleryImage.find(d[1][:id])
|
||||
@site_valid_locales.each do |locale|
|
||||
image.description_translations[locale] = d[1][:text][locale]
|
||||
end
|
||||
image.save!
|
||||
end
|
||||
|
||||
album = GalleryAlbum.find(aid)
|
||||
|
||||
@site_valid_locales.each_with_index do |locale,i|
|
||||
album.name_translations[locale] = album_names[i]
|
||||
end
|
||||
album.save!
|
||||
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
|
|
@ -9,26 +9,26 @@
|
|||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<form id="edit_album">
|
||||
<form id="edit_album" action="update_album" method="post">
|
||||
<div class="tab_content">
|
||||
<% i = 0 %>
|
||||
<% @site_valid_locales.each do |locale| %>
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<% if i == 0 %>
|
||||
<div class="<%= locale %> fade tab-pane in active">
|
||||
<% else %>
|
||||
<div class="<%= locale %> fade tab-pane" >
|
||||
<% end %>
|
||||
<% i = 1 %>
|
||||
|
||||
<div class="albumname_edit">
|
||||
<label for=""><%= t("gallery.album_name") %></label>
|
||||
<div class="inputui rginput rgih26 w380"><input type="text" name="edit_album[name][<%= locale %>]" value="<%= @album_name[locale] %>" class="txtchange" /></div>
|
||||
<div class="inputui rginput rgih26 w380"><input type="text" name="gallery_album[name_translations][<%= locale %>]" value="<%= @album_name[locale] %>" class="txtchange" /></div>
|
||||
</div>
|
||||
|
||||
<div class='description_loader'>
|
||||
<% @images.each do |image| %>
|
||||
<div class="rgphoto_edit">
|
||||
<% @images.each_with_index do |image,x| %>
|
||||
<div class="rgphoto_edit <%= locale %>">
|
||||
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
|
||||
<div class="inputui rginput rgih98 w380">
|
||||
<textarea name="edit[description][<%= locale %>]" class="txtchange" for="<%= image.id%>"><%= image.description_translations[locale] %></textarea>
|
||||
<textarea name="gallery_album_gallery_images_attributes[<%= x %>][description_translations][<%= locale %>]" class="txtchange" for="<%= image.id %>"><%= image.description_translations[locale] %></textarea>
|
||||
</div>
|
||||
<div class="edit_fn">
|
||||
<% if image.id.to_s == @cover %>
|
||||
|
@ -43,8 +43,10 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<% end %>
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
|
||||
<!-- <div class="tab-pane in active">
|
||||
<div class="albumname_edit">
|
||||
<label for="">Album Name:</label>
|
||||
|
@ -71,4 +73,3 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
Reference in New Issue