frontend updates

This commit is contained in:
Harry Bomrah 2012-09-04 17:17:18 +08:00
parent 4a12c9d6fb
commit a080667615
8 changed files with 12 additions and 308 deletions

View File

@ -1,11 +1,5 @@
class Panel::Gallery::FrontEnd::AlbumImagesController < OrbitWidgetController
def show
@tags = GalleryTag.all
@image = GalleryImage.find(params[:album_id])
@albumid = @image.gallery_album_id
@album = GalleryAlbum.find(@albumid)
@images = @album.gallery_images.all
end
end

View File

@ -89,7 +89,7 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
values.tag_ids.each do |tag|
tags << GalleryTag.find(tag)[I18n.locale]
end
@output << {"_id"=>values.id,"theater_link"=>panel_gallery_front_end_album_path(values)+"/theater","description"=>values.description,"title"=>values.title,"file"=>values.file,"gallery_album_id"=>values.gallery_album_id,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
@output << {"_id"=>values.id,"theater_link"=>theater_panel_gallery_front_end_album_path(values),"description"=>values.description,"title"=>values.title,"file"=>values.file,"gallery_album_id"=>values.gallery_album_id,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
end
render :json=>{"images" => @output}.to_json
end
@ -104,6 +104,14 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
render :json=>tags.to_json
end
def theater
@tags = GalleryTag.all
@image = GalleryImage.find(params[:album_id])
@albumid = @image.gallery_album_id
@album = GalleryAlbum.find(@albumid)
@images = @album.gallery_images.all
end
end

View File

@ -1,3 +0,0 @@
var gal = new galleryAPI();
gal.loadAlbums("all");
rcom.modalWindowClose();

View File

@ -1,137 +0,0 @@
<%= stylesheet_link_tag "gallery" %>
<div id="orbit_gallery" class="rg">
<div class="rgbody">
<div id="imgholder">
<ul class="breadcrumb">
<li><span>Home</span><span class="divider">/</span></li>
<li><span><%= t('admin.orbit_gallery') %></span><span class="divider">/</span></li>
<li class="text-blue"><%= t('gallery.edit') %></li>
</ul>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<!-- <form id="edit_album" action="update_album" method="post"> -->
<%= form_for @album, :url => panel_gallery_back_end_album_path(@album), :html => {:class => 'clear'} do |f| %>
<div class="tab_content">
<div class="albumname_edit">
<%= f.fields_for :name_translations do |name| %>
<%= f.label t("gallery.album_name") %>
<div class="inputui rginput rgih26 w380">
<% @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 %>
<%= name.text_field locale, :value => (@album_name[locale]), :class => "txtchange" %>
</div>
<% end %>
</div>
<% end %>
</div>
<div class='description_loader'>
<% @images.each_with_index do |image,x| %>
<div class="rgphoto_edit <%= locale %>" data-content="<%= image.id %>">
<%= link_to panel_gallery_back_end_album_image_path(image) do %>
<img src="<%= image.file.thumb.url %>" />
<% end %>
<div class="inputui rginput rgih98 w380">
<%= f.fields_for :gallery_images, image do |j| %>
<%= j.hidden_field :id, :value => (image.id) %>
<%= j.hidden_field :_destroy, :value => false, :class => "del_field" %>
<%= j.fields_for :description_translations do |desc| %>
<% @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 %>
<%= desc.text_area locale, :value => (image.description_translations[locale] rescue nil), :class => "txtchange" %>
</div>
<% end %>
<% end %>
<% end %>
</div>
<div class="edit_fn" no="<%= x %>">
<% if image.id.to_s == @cover %>
<a class="btn btn-primary rgbtsg bt-cover setcover active" onclick="return false;" title="<%= t("gallery.cover") %>" href="set_cover" for="<%= image.id %>"><span class="icon-star icon-white"></span></a>
<% else %>
<a class="btn rgbtsg bt-cover" onclick="return false;" title="<%= t("gallery.set_cover") %>" href="set_cover" for="<%= image.id %>"><span class="icon-star-empty"></span></a>
<% end %>
<a class="btn rgbtsg bt-tag" onclick="return false;" title="<%= t("gallery.photo_tag") %>" href="<%= image.id %>"><span class="icon-tags"></span></a>
<a class="btn rgbtsg bt-dels" onclick="return false;" title="<%= t("gallery.delete") %>" href="<%= image.id %>"><span class="icon-trash"></span></a>
</div>
</div>
<% end %>
</div>
<input type="hidden" name="delete_cover" value="false" class="del_cover" />
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<a href="<%= panel_gallery_back_end_album_path(@album) %>" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a>
<%= f.submit t('gallery.save'), :class=>'bt-save icon-ok btn btn-primary pull-right', :style=>"display:none;" %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- tag part -->
<div id="tag_panel" class="my_scroll">
<div class="scrollbar">
<div class="track">
<div class="thumb">
<div class="end"></div>
</div>
</div>
</div>
<%
@locales = Array.new
@site_valid_locales.each do |locale|
@locales << locale
end
%>
<div class="viewport">
<div class="overview">
<ul class="tag_list" id="gallery_tag_list">
<% @tags.each do |tag| %>
<li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
<% end %>
</ul>
</div>
</div>
<div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"> <div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
</div>
<script type="text/javascript">
var $tag_panel = $('#tag_panel');
orbit_bar_height = $('#orbit-bar').outerHeight();
action_panel_height = $('.form-actions').outerHeight();
window_height = $(window).height();
$tag_panel.height( window_height - orbit_bar_height - 90 );
$tag_panel.tinyscrollbar();
$(window).resize(function(){
$tag_panel.tinyscrollbar_update('relative');
$tag_panel.height( $(window).height() - orbit_bar_height - 90 );
});
</script>
<!-- tag end -->
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI" %>
<% end %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
gallery.editAlbum("<%= params[:id] %>");
</script>

View File

@ -1,51 +0,0 @@
<div class="modal-window" id="categories">
<div class="modal-header">
<h3><%= t("gallery.add_album") %></h3>
</div>
<%= form_for @album, :url => {:action => "create"}, :remote => true do |f| %>
<div class="modal-body add-album">
<div> <%= f.select(:gallery_category_id, GalleryCategory.all.collect {|p| [ p.name, p.id ] },{:prompt => t("gallery.select_category")},:class => "validate") %> </div>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab_content form-horizontal">
<%= f.fields_for :name_translations do |name| %>
<% @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 %>
<p class="control-group">
<%= label_tag(locale, t("gallery.album_name")) %>
<%= name.text_field locale, :class => "validate" %>
</p>
</div>
<% end %>
<% end %>
<%= f.fields_for :description_translations do |desc| %>
<% @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 %>
<p class="control-group">
<%= label_tag(locale, t("gallery.album_desc")) %>
<%= desc.text_field locale %>
</p>
</div>
<% end %>
<% end %>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" id="album_name_close_btn" onclick="return false;"><%= t("gallery.close") %></a>
<!-- <a href="#" class="btn btn-primary" id="album_name_save_btn" onclick="return false;"><%#= t("gallery.save_changes") %></a> -->
<%= f.submit t("gallery.save"), :class=> "btn btn-primary bt-form-save" %>
</div>
<% end %>
</div>

View File

@ -1,107 +0,0 @@
<html>
<head>
<%= csrf_meta_tag %>
<%= javascript_include_tag "jquery-latest" %>
<%= stylesheet_link_tag "jquery-ui" %>
<%= stylesheet_link_tag "jquery.fileupload-ui.css" %>
</head>
<body>
<div id='scroller_for_panel'>
<div id="fileupload">
<%= form_for @album, :url => panel_gallery_back_end_upload_image_path(@album), :html => {:class => 'clear'} do |f| %>
<div class="fileupload-buttonbar">
<label class="fileinput-button">
<span>Add files...</span>
<input type="file" name="files[]" multiple>
</label>
<input type="hidden" value="<%= params[:album_id] %>" name="album_id" id="fileupload_aid" />
<button type="submit" class="start">Start upload</button>
<button type="reset" class="cancel">Cancel upload</button>
<!-- <button type="button" class="delete">Delete files</button>-->
</div>
<!-- </form> -->
<% end %>
<div class="fileupload-content">
<table class="files"></table>
<div class="fileupload-progressbar"></div>
</div>
</div>
<script id="template-upload" type="text/x-jquery-tmpl">
<tr class="template-upload{{if error}} ui-state-error{{/if}}">
<td class="preview"></td>
<td class="name">{{if name}}${name}{{else}}Untitled{{/if}}</td>
<td class="size">${sizef}</td>
{{if error}}
<td class="error" colspan="2">Error:
{{if error === 'maxFileSize'}}File is too big
{{else error === 'minFileSize'}}File is too small
{{else error === 'acceptFileTypes'}}Filetype not allowed
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded
{{else}}${error}
{{/if}}
</td>
{{else}}
<td class="progress"><div></div></td>
<td class="start"><button>Start</button></td>
{{/if}}
<td class="cancel"><button>Cancel</button></td>
</tr>
</script>
<script id="template-download" type="text/x-jquery-tmpl">
<tr class="template-download{{if error}} ui-state-error{{/if}}">
{{if error}}
<td></td>
<td class="name">${name}</td>
<td class="size">${sizef}</td>
<td class="error" colspan="2">Error:
{{if error === 1}}File exceeds upload_max_filesize (php.ini directive)
{{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive)
{{else error === 3}}File was only partially uploaded
{{else error === 4}}No File was uploaded
{{else error === 5}}Missing a temporary folder
{{else error === 6}}Failed to write file to disk
{{else error === 7}}File upload stopped by extension
{{else error === 'maxFileSize'}}File is too big
{{else error === 'minFileSize'}}File is too small
{{else error === 'acceptFileTypes'}}Filetype not allowed
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded
{{else error === 'uploadedBytes'}}Uploaded bytes exceed file size
{{else error === 'emptyResult'}}Empty file upload result
{{else}}${error}
{{/if}}
</td>
{{else}}
<td class="preview">
{{if thumbnail_url}}
<a href="${url}" target="_blank"><img src="${thumbnail_url}"></a>
{{/if}}
</td>
<td class="name">
<a href="${url}"{{if thumbnail_url}} target="_blank"{{/if}}>${name}</a>
</td>
<td class="size">${sizef}</td>
<td colspan="2"></td>
{{/if}}
</tr>
</script>
</div>
<%= javascript_include_tag "jquery-ui.min" %>
<%= javascript_include_tag "jquery.tmpl.min" %>
<%= javascript_include_tag "jquery.iframe-transport" %>
<%= javascript_include_tag "jquery.fileupload" %>
<%= javascript_include_tag "jquery.fileupload-ui" %>
<%= javascript_include_tag "upload" %>
</body>
</html>
<!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script src="../../js/gallery/jquery.iframe-transport.js"></script>
<script src="../../js/gallery/jquery.fileupload.js"></script>
<script src="../../js/gallery/jquery.fileupload-ui.js"></script>
<script src="../../js/gallery/upload.js"></script> -->

View File

@ -41,11 +41,11 @@ Rails.application.routes.draw do
# match "delete_images" => "orbit_galleries#delete_images"
# match "update_album" => "orbit_galleries#update_album"
# match "save_tags" => "orbit_galleries#save_tags"
match "theater/:id" => "album_images#show", :as => "theater_link_path"
match "theater/:id" => "albums#theater"
resources :albums do
match "imgs" => "albums#imgs"
match "theater" => "album_images#show"
end
resources :album_images
end