Merge branch 'gallery_orbit' of github.com:Rulingcom/orbit into gallery_orbit

Conflicts:
	vendor/built_in_modules/gallery/config/routes.rb
This commit is contained in:
chris 2012-11-20 10:11:59 +08:00
commit 747b0d4620
5 changed files with 1712 additions and 49 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
.widget_gallery {
margin-bottom: 20px;
}
.widget_gallery:after {
display: table;
width: 100%;
content: '';
}
.widget_gallery ul {
list-style: none;
margin: 0;
padding: 0;
}
.widget_gallery li a {
display: block;
}
.widget_gallery li a img {
height: auto;
display: block;
}
/* widget 1 */
.w1 ul {
margin: 0 -1%;
}
.w1 li {
float: left;
margin: 1%;
}
.w1.c2 li { width: 48%; }
.w1.c3 li { width: 31.3333%; }
.w1.c4 li { width: 23%; }
.w1.c5 li { width: 18%; }
.w1.c6 li { width: 14.6666%; }
.w1 li a:hover {
box-shadow: 0 0 20px rgba(0,0,0,0.9);
outline: solid 4px #429DFF;
position: relative;
}
.w1 li a img {
width: 100%;
}
/* widget 2 */
.w2 li {
width: 100%;
}
.w2 li a img {
width: 100%;
height: auto;
}
.w2 li a {
position: relative;
overflow: hidden;
color: #fff;
text-transform: capitalize;
}
.w2 li a .desc {
position: absolute;
bottom: -60px;
opacity: 0;
display: block;
width: 100%;
padding: 5%;
background-color: rgba(8, 166, 255, 0.8);
}

View File

@ -0,0 +1,23 @@
class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
def widget1
@settings = {"vertical"=>2,"horizontal"=>6}
@class = "c" + @settings["horizontal"].to_s
@total = @settings["vertical"] * @settings["horizontal"]
@rnd = Random.new
@images = []
for i in 0..@total-1
@sn = @rnd.rand(0...GalleryImage.count)
if @sn < 0
@sn = @sn * -1
end
image = GalleryImage.skip(@sn).limit(1).first
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
@images << values
end
end
def widget2
end
end

View File

@ -0,0 +1,20 @@
<%= stylesheet_link_tag "widget_gallery" %>
<%# content_for :page_specific_javascript do %>
<%#= javascript_include_tag "cycle" %>
<%# end %>
<div class="four columns">
<h4>Gallery Widget</h4>
<p>WIDGET 1</p>
<div class="widget_gallery w1 <%= @class %>">
<ul>
<% @images.each do |image| %>
<li><a href="<%= image['show_link'] %>" title="photo description 1"><img src="<%= image['thumb'] %>" alt=""/></a></li>
<% end %>
<!-- <li><a href="" title="photo description 2"><img src="images/assets/2.jpg" alt=""/></a></li>
<li><a href="" title="photo description 3"><img src="images/assets/3.jpg" alt=""/></a></li>
<li><a href="" title="photo description 4"><img src="images/assets/4.jpg" alt=""/></a></li>
<li><a href="" title="photo description 5"><img src="images/assets/5.jpg" alt=""/></a></li>
<li><a href="" title="photo description 6"><img src="images/assets/6.jpg" alt=""/></a></li> -->
</ul>
</div>
</div>

View File

@ -1,54 +1,57 @@
Rails.application.routes.draw do
namespace :panel do
namespace :gallery do
namespace :back_end do
match "get_albums" => "albums#get_albums"
match "upload_image" => "albums#upload_image"
match "save_tags" => "tags#save_tags"
match "albums/save_tags" => "tags#save_tags"
resources :albums do
match "set_cover" => "albums#set_cover"
match "imgs" => "albums#imgs"
match "upload_panel" => "albums#upload_panel"
match "images_tags" => "albums#images_tags"
collection do
get "get_album_json"
end
end
match "album_images/#!/:id" => "album_images#show"
namespace :panel do
namespace :gallery do
namespace :back_end do
match "get_albums" => "albums#get_albums"
match "upload_image" => "albums#upload_image"
match "save_tags" => "tags#save_tags"
match "albums/save_tags" => "tags#save_tags"
resources :albums do
match "set_cover" => "albums#set_cover"
match "imgs" => "albums#imgs"
match "upload_panel" => "albums#upload_panel"
match "images_tags" => "albums#images_tags"
end
resources :album_images
resources :gallery_categories
resources :tags
end
namespace :front_end do
match "get_albums" => "albums#get_albums"
match "orbit_galleries" => "orbit_galleries#index"
# match "gallery_category_save" => "orbit_galleries#new_category"
# match "categorylist" => "orbit_galleries#categorylist"
# match "gallery_category_delete" => "orbit_galleries#gallery_category_delete"
# match "add_album" => "orbit_galleries#add_album"
# match "create_album" => "orbit_galleries#create_album"
# match "get_albums" => "orbit_galleries#get_albums"
# match "upload_image" => "orbit_galleries#upload_image"
# match "upload_panel" => "orbit_galleries#upload_panel"
# match "get_images" => "orbit_galleries#get_images"
# match "theater" => "orbit_galleries#theater"
# match "delete_album" => "orbit_galleries#delete_album"
# match "edit_album" => "orbit_galleries#edit_album"
# match "set_cover" => "orbit_galleries#set_cover"
# match "delete_images" => "orbit_galleries#delete_images"
# match "update_album" => "orbit_galleries#update_album"
# match "save_tags" => "orbit_galleries#save_tags"
resources :albums do
member do
get "imgs"
get "theater"
end
end
resources :album_images
end
end
match "album_images/#!/:id" => "album_images#show"
resources :album_images
resources :gallery_categories
resources :tags
end
namespace :front_end do
match "orbit_galleries" => "orbit_galleries#index"
match "get_albums" => "albums#get_albums"
# match "orbit_galleries" => "orbit_galleries#index"
# match "gallery_category_save" => "orbit_galleries#new_category"
# match "categorylist" => "orbit_galleries#categorylist"
# match "gallery_category_delete" => "orbit_galleries#gallery_category_delete"
# match "add_album" => "orbit_galleries#add_album"
# match "create_album" => "orbit_galleries#create_album"
# match "get_albums" => "orbit_galleries#get_albums"
# match "upload_image" => "orbit_galleries#upload_image"
# match "upload_panel" => "orbit_galleries#upload_panel"
# match "get_images" => "orbit_galleries#get_images"
# match "theater" => "orbit_galleries#theater"
# match "delete_album" => "orbit_galleries#delete_album"
# match "edit_album" => "orbit_galleries#edit_album"
# match "set_cover" => "orbit_galleries#set_cover"
# match "delete_images" => "orbit_galleries#delete_images"
# match "update_album" => "orbit_galleries#update_album"
# match "save_tags" => "orbit_galleries#save_tags"
resources :albums do
member do
get "imgs"
get "theater"
end
end
resources :album_images
end
namespace :widget do
match "widget1" => "albums#widget1"
end
end
end
end