code merged … ui updated
This commit is contained in:
parent
94ee16ae01
commit
0799fb4f87
|
@ -35,7 +35,10 @@ var galleryAPI = function(){
|
||||||
g.loadArea = "albums";
|
g.loadArea = "albums";
|
||||||
passid = g.urlVars['tag'];
|
passid = g.urlVars['tag'];
|
||||||
g.loadAlbums(g.urlVars['tag']);
|
g.loadAlbums(g.urlVars['tag']);
|
||||||
}else if(g.urlVars.length == 0){
|
}else if(g.urlVars["locale"]){
|
||||||
|
g.loadArea = "albums";
|
||||||
|
g.loadAlbums("all");
|
||||||
|
}else if(g.urlVars.length == 0) {
|
||||||
g.loadArea = "albums";
|
g.loadArea = "albums";
|
||||||
g.loadAlbums("all");
|
g.loadAlbums("all");
|
||||||
}
|
}
|
||||||
|
@ -493,15 +496,18 @@ var galleryAPI = function(){
|
||||||
})
|
})
|
||||||
g.albumArea.find(".rghead .rgfn .bt-save").click(function(){
|
g.albumArea.find(".rghead .rgfn .bt-save").click(function(){
|
||||||
// var dataArray = Array();
|
// var dataArray = Array();
|
||||||
// $(".description_loader .txtchange").each(function(){
|
// $(".description_loader .en .txtchange").each(function(){
|
||||||
// dataArray.push({"id":$(this).attr("for"),"text": $(this).val()});
|
// 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();
|
// var albumnm = Array();
|
||||||
// $(".albumname_edit .txtchange").each(function(){
|
// $(".albumname_edit .txtchange").each(function(){
|
||||||
// albumnm.push($(this).val())
|
// albumnm.push($(this).val())
|
||||||
// })
|
// })
|
||||||
var dataArray = $("form#edit_album").serialize();
|
// var dataArray = $("form#edit_album").serialize();
|
||||||
$.post("update_album",{"aid":id,"data":dataArray},function(){
|
// $.post("update_album",{"data":dataArray},function(){
|
||||||
|
|
||||||
|
// })
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -191,8 +191,24 @@ include AdminHelper
|
||||||
# end
|
# end
|
||||||
# album = GalleryAlbum.find(aid)
|
# album = GalleryAlbum.find(aid)
|
||||||
# album.update_attributes(:name => album_name)
|
# album.update_attributes(:name => album_name)
|
||||||
data = params['data']
|
album_names = params[:albumnm]
|
||||||
|
data = params[:data]
|
||||||
|
aid =params[:aid]
|
||||||
debugger
|
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
|
render :json =>{"success"=>true}.to_json
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,42 +9,44 @@
|
||||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<form id="edit_album">
|
<form id="edit_album" action="update_album" method="post">
|
||||||
<div class="tab_content">
|
<div class="tab_content">
|
||||||
<% i = 0 %>
|
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% if i == 0 %>
|
||||||
<% if i == 0 %>
|
<div class="<%= locale %> fade tab-pane in active">
|
||||||
<div class="<%= locale %> fade tab-pane in active">
|
<% else %>
|
||||||
<% else %>
|
<div class="<%= locale %> fade tab-pane" >
|
||||||
<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>
|
|
||||||
<div class='description_loader'>
|
|
||||||
<% @images.each do |image| %>
|
|
||||||
<div class="rgphoto_edit">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
<div class="edit_fn">
|
|
||||||
<% if image.id.to_s == @cover %>
|
|
||||||
<a class="btn btn-primary rgbtsg bt-cover setcover active" onclick="return false;" title="Cover" href="<%= image.id %>"><span class="icon-star icon-white"></span></a>
|
|
||||||
<% else %>
|
|
||||||
<a class="btn rgbtsg bt-cover" onclick="return false;" title="Set Cover" href="<%= image.id %>"><span class="icon-star-empty"></span></a>
|
|
||||||
<% end %>
|
|
||||||
<a class="btn rgbtsg bt-tag" onclick="return false;" title="Tags" href="<%= image.id %>"><span class="icon-tags"></span></a>
|
|
||||||
<a class="btn rgbtsg bt-dels" onclick="return false;" title="Delete" href="<%= image.id %>"><span class="icon-trash"></span></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<div class="albumname_edit">
|
||||||
|
<label for=""><%= t("gallery.album_name") %></label>
|
||||||
|
<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_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="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 %>
|
||||||
|
<a class="btn btn-primary rgbtsg bt-cover setcover active" onclick="return false;" title="Cover" href="<%= image.id %>"><span class="icon-star icon-white"></span></a>
|
||||||
|
<% else %>
|
||||||
|
<a class="btn rgbtsg bt-cover" onclick="return false;" title="Set Cover" href="<%= image.id %>"><span class="icon-star-empty"></span></a>
|
||||||
|
<% end %>
|
||||||
|
<a class="btn rgbtsg bt-tag" onclick="return false;" title="Tags" href="<%= image.id %>"><span class="icon-tags"></span></a>
|
||||||
|
<a class="btn rgbtsg bt-dels" onclick="return false;" title="Delete" href="<%= image.id %>"><span class="icon-trash"></span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<input type="submit" value="Submit" />
|
||||||
|
</form>
|
||||||
|
|
||||||
<!-- <div class="tab-pane in active">
|
<!-- <div class="tab-pane in active">
|
||||||
<div class="albumname_edit">
|
<div class="albumname_edit">
|
||||||
<label for="">Album Name:</label>
|
<label for="">Album Name:</label>
|
||||||
|
@ -71,4 +73,3 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
|
Reference in New Issue